-
-
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
Remove div.codex-editor__redactor click listener #1051
Comments
Or even just let the click propagate |
May be related to #1020 |
Additional info: some frameworks like React bind most of its syntetic or native events to document for performance and other reasons (single event handler provides flexibility and single dom node traversing is slow). So if you kill of event propagation to document, then this click event never reaches document and framework events do not trigger. |
This is a duplicate of #946, isn' it @gohabereg? FTR: this might be related to this issue and provides a (temporary) solution: #946 (comment). |
@natterstefan ref passing is bad practice for react components, please do not use this. Better temporary solution would be setting section for tool wrapper using already known dom node and setting user-select: none; in css to hide visual selection (as this already works when there is a selection set, which may or may not be a bug).
|
Hi @aablinov, I know, the solution was not provided by me and in our app we adjusted it tbh. Thanks for the objection. Actually, this looks pretty good to me (I just formatted it properly): asdf() {
const wrapper = document.createElement('div')
this.api.listeners.on(
wrapper,
'click',
e => {
this.api.selection.expandToTag(wrapper)
},
false,
)
ReactDOM.render(<SomeCustomComponent />, wrapper)
return wrapper
} Thanks for sharing it with me and others. |
@2277Dhruv I too have a similar issue and implemented a solution by simply binding the redactor clicks to a new element. Hopefully the pull-request will be merged and this can be used in the official release. Until then you can install this version: https://github.com/elis/editor.js#d02af95 $ yarn add https://github.com/elis/editor.js#d02af95 works like a charm. |
I have some components that I built using React inside Editor JS and everything's working smoothly except for the fact that the div.codex-editor__redactor has a click listener, so the onClick for the div holding my React component is not registering.
I can remove the listener on chrome, but that's not going to be a "universal" browser solution. So, is there a way to remove this listener for all browsers?
Thanks, I really appreciate this! I love Editor JS!!!
The text was updated successfully, but these errors were encountered: