fix: prevent duplicate image paste in editor
This commit is contained in:
parent
22fd61a33c
commit
bb73c27476
1 changed files with 6 additions and 2 deletions
|
|
@ -1072,17 +1072,21 @@ export default function App() {
|
|||
const target = pasteImageTargetRef.current
|
||||
if (target === "feature" && featureImageHoverRef.current && selectedArticleRef.current) {
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
pasteImageTargetRef.current = null
|
||||
void setFeatureImageFile(file)
|
||||
return
|
||||
}
|
||||
if (target === "editor" && editorImageHoverBlockRef.current && !featureImageHoverRef.current) {
|
||||
event.preventDefault()
|
||||
event.stopImmediatePropagation()
|
||||
pasteImageTargetRef.current = null
|
||||
void replaceEditorImageFile(file, editorImageHoverBlockRef.current)
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("paste", handleImagePaste)
|
||||
return () => window.removeEventListener("paste", handleImagePaste)
|
||||
window.addEventListener("paste", handleImagePaste, true)
|
||||
return () => window.removeEventListener("paste", handleImagePaste, true)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue