-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
Enter within node views breaks node on iOS #1162
Comments
You really don't want to return |
Yeah, I just returned true to demonstrate the issue, because no other browser triggers ignoreMutation in this case. If I return false the node view gets re-created on enter. Is there anything else I can do? |
Well, just return false. The node view should be recreated, since the browser messed it up. (Enter is intentionally not prevent-defaulted on iOS because doing that screws up the state of the virtual keyboard.) |
My ignoreMutation handler is basically doing something like this: ignoreMutation(mutation) {
if (mutation.type === 'selection') {
if (this.node.isLeaf) {
return true
}
return false
}
if (!this.contentDOM) {
return true
}
return this.contentDOM.contains(mutation.target)
} But I try to find a workaround for iOS myself. You can close this if you want. |
I think the last condition is the dangerous one—if |
Issue details
When pressing enter within a simple node view with contentDOM, iOS duplicates nodes. This only happens if I add a class to
dom
. I think it’s the same issue as described in #1127. Maybe the applied fix fixed it for nodes but not for node views?When pressing enter
ignoreMutation
is called (only on iOS) with the following value:I could find a workaround by returning
false
for ignoreMutation in this situation but this will re-render the node view which is not an optimal solution.Steps to reproduce
demo: https://glitch.com/edit/#!/thundering-fast-question?path=index.js
ProseMirror version
prosemirror-view: 1.18.3
Affected platforms
Screenshots / Screencast (Optional)
RPReplay_Final1619511128.MP4
The text was updated successfully, but these errors were encountered: