Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
9a5c9d78
Commit
9a5c9d78
authored
Jun 27, 2022
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 富文本组件搜索人员出错
parent
9a46a6e1
Pipeline
#54014
failed with stages
in 5 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
index.js
packages/base-components/RichText/src/index.js
+25
-23
No files found.
packages/base-components/RichText/src/index.js
View file @
9a5c9d78
...
...
@@ -47,7 +47,7 @@ const RichText = forwardRef((props, ref) => {
method
:
'get'
,
params
:
{},
}).
then
((
res
)
=>
{
setSelectList
(
res
?.
data
?.
data
||
[])
;
allPeople
=
res
?.
data
?.
data
||
[]
;
});
};
// 图片上传
...
...
@@ -168,7 +168,7 @@ const RichText = forwardRef((props, ref) => {
}
});
editor
.
txt
.
eventHooks
.
imgClickEvents
.
push
((
e
)
=>
{
});
editor
.
txt
.
eventHooks
.
imgClickEvents
.
push
((
e
)
=>
{});
// 粘贴图片上传
editor
.
txt
.
eventHooks
.
pasteEvents
.
push
((
e
)
=>
{
const
file
=
e
?.
clipboardData
?.
items
[
0
]?.
getAsFile
()
||
null
;
...
...
@@ -220,8 +220,8 @@ const RichText = forwardRef((props, ref) => {
const
keyDownEvent
=
(
evet
)
=>
{
// 上下方向键
if
(
evet
.
key
===
'ArrowDown'
||
evet
.
key
===
'ArrowUp'
)
{
evet
.
preventDefault
();
if
(
selectBoxRef
.
current
?.
style
?.
display
===
'block'
)
{
evet
.
preventDefault
();
const
max
=
selectBoxRef
.
current
.
querySelectorAll
(
'.selectItem'
)?.
length
||
1000
;
let
val
=
selectPersonIndex
;
if
(
evet
.
key
===
'ArrowDown'
)
{
...
...
@@ -240,7 +240,7 @@ const RichText = forwardRef((props, ref) => {
}
if
(
evet
.
key
===
'Enter'
)
{
// 解决无法回车换行的bug
console
.
log
(
selectBoxRef
.
current
.
style
.
display
===
'block'
,)
console
.
log
(
selectBoxRef
.
current
.
style
.
display
===
'block'
);
if
(
selectBoxRef
.
current
.
style
.
display
===
'block'
)
{
evet
.
preventDefault
();
if
(
selectPerson
[
selectPersonIndex
])
{
...
...
@@ -252,11 +252,11 @@ const RichText = forwardRef((props, ref) => {
};
useEffect
(()
=>
{
richTextRef
.
current
&&
richTextRef
.
current
.
removeEventListener
(
'input'
,
(
e
)
=>
{
});
richTextRef
.
current
&&
richTextRef
.
current
.
removeEventListener
(
'input'
,
(
e
)
=>
{});
init
();
getAllPeople
();
return
()
=>
{
richTextRef
.
current
&&
richTextRef
.
current
.
removeEventListener
(
'input'
,
(
e
)
=>
{
});
richTextRef
.
current
&&
richTextRef
.
current
.
removeEventListener
(
'input'
,
(
e
)
=>
{});
editor
&&
editor
.
destroy
();
editor
=
null
;
};
...
...
@@ -347,6 +347,7 @@ const RichText = forwardRef((props, ref) => {
}
};
const
handleChange
=
(
val
,
list
)
=>
{
console
.
log
(
'🚀 ~ val'
,
val
);
if
(
timer
)
{
clearTimeout
(
timer
);
}
...
...
@@ -377,24 +378,25 @@ const RichText = forwardRef((props, ref) => {
request
(
API
.
POST_UPLOADERFILES
,
{
method
:
'POST'
,
data
:
formData
,
}).
then
((
res
)
=>
{
if
(
res
.
data
)
{
const
arr
=
[...
fileList
];
const
url
=
res
.
data
.
replace
(
/
[\\
\/
=
]
/g
,
'/'
);
arr
.
unshift
({
name
:
file
.
name
,
type
:
file
.
type
?
file
.
type
.
toLowerCase
()
:
''
,
size
:
file
.
size
,
path
:
`
${
API
.
GET_DOWNLOADFILES
}
?filePath=
${
url
}
`
,
});
// setFileList(arr);
props
.
onChangeFile
(
arr
);
setLoading
(
false
);
}
else
{
message
.
error
(
res
.
msg
);
setLoading
(
false
);
}
})
.
then
((
res
)
=>
{
if
(
res
.
data
)
{
const
arr
=
[...
fileList
];
const
url
=
res
.
data
.
replace
(
/
[\\
\/
=
]
/g
,
'/'
);
arr
.
unshift
({
name
:
file
.
name
,
type
:
file
.
type
?
file
.
type
.
toLowerCase
()
:
''
,
size
:
file
.
size
,
path
:
`
${
API
.
GET_DOWNLOADFILES
}
?filePath=
${
url
}
`
,
});
// setFileList(arr);
props
.
onChangeFile
(
arr
);
setLoading
(
false
);
}
else
{
message
.
error
(
res
.
msg
);
setLoading
(
false
);
}
})
.
catch
((
err
)
=>
{
setLoading
(
false
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment