-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paste event is dispatched multiple times when multiple EditorJS are launched. #1011
Comments
Confirm and rolled back to previous version (npm install @editorjs/editorjs@2.15.1 --save), it solves problem) |
I've tried to return to v2.15.1 and It works fine, no double paste behavior on the page. |
Experienced the same hope this issue will be fixed soon 👍 |
From what I've observed it will pasted multiple times based on how many instances of editorjs there is |
For the meantime I've published an editorjs with the assumed "fix" on the paste issue -> @ponnex/editorjs will delete this one when the pull request is accepted or when a fix is already available |
thanks to @ponnex, I could write this workarround. class PatchedEditor extends EditorJS {
constructor(configuration?: EditorConfig|string) {
super(configuration);
}
public exportAPI(editor: any) {
super['exportAPI'](editor);
const Paste = editor.moduleInstances.Paste;
const onPastes = Paste.Editor.Listeners.findAll(document, 'paste');
Paste.Editor.Listeners.allListeners = (Paste.Editor.Listeners.allListeners as []).filter(l => !onPastes.includes(l));
onPastes.forEach(paste => paste.element.removeEventListener(paste.eventType, paste.handler, paste.options));
Paste.Editor.Listeners.on(Paste.Editor.UI.nodes.holder, 'paste', Paste.handlePasteEvent);
}
} |
Hi all! 2.17 is already released with this I will be deleting @ponnex/editorjs, those that are using the package kindly move to @editorjs/editorjs@2.17 |
Hi All, Thanks. |
Hi, can you write what exactly you did? |
Hi, Earlier I was using two instance of editor.js.
It caused the above mentioned issue. Then I changed it to
This solved the issue. |
thx for answer. |
Please let me know if that solved your issue or you're facing a different issue. |
Unfortunately, it didn't solve it. I think I have something different, thank you anyway. |
I'll write more detail soon. 😃
The text was updated successfully, but these errors were encountered: