-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Does not work in Shadow DOM in Safari 10. #476
Comments
Safari isn't really known for responding to bugs quickly. Is there a kludge you know of that lets us access the shadow dom's selection in another way in the meantime? |
I haven't had time to look into this yet unfortunately. In any case if it turns out that one does not exist, there are other kludges that might be tolerable on my side like using a polyfill implementation of Shadow DOM rather than native. I'll make sure to update this issue with any discoveries. |
Has anyone checked whether the Safari shipped with 10.12.4 fixes this? |
Checked, still broken. That's Safari 10.1. Also still broken in Safari 10.2 (Tech Preview 26) |
Looks like this might be an answer: https://github.com/GoogleChromeLabs/shadow-selection-polyfill Could just flag in docs and encourage users to bundle the polyfill for safari. Note haven't tested it myself yet, was just released. Will spin up a fresh env to see if it resolves the issue when I get a mo. |
I'm just working my way through the very first introductory steps in your documentation in an attempt to get ProseMirror working in a web component using Shadow DOM and ran into this. There may be things it doesn't address, but adding a I made an NPM package shadow-root-get-selection-polyfill for it. |
Last time I looked, |
I didn't have Safari to test with, but looking into it more, I doubt it does anything helpful in Safari. The fix only works in Firefox because of a quirk in its implementation of ShadowRoot. |
Just encountered this issue with CodeMirror 6 prototype while trying to pass in a Shadow DOM to the editor root configuration. |
Thanks, that's useful to know. |
ProseMirror/prosemirror-view@bf61fc34b74baf2fb7884fa might help with this. (And if not, I don't believe there anything ProseMirror can do about this, so I'm closing this issue.) |
On closer thought, no, that patch definitely won't help with this. Did anyone have any success getting ProseMirror to work in a shadow root in Safari? |
We found a (somehow horrible) kludge for this in CodeMirror 6 that seems to mostly work. If this is still important for someone, we could look into porting that to ProseMirror. |
I'd be interested in that. I really don't want to drop shadow DOM for my rich text editor component just to support Safari, but as of now it's looking like I'm gonna need to 😞 |
@marijnh Would love to see this in ProseMirror. Porting out ProseMirror-based Angular component to Web Component (with Shadow DOM) is on my TODO list :) |
I think we just ran into this issue too with Angular and ProseMirror |
@marijnh Are there any updates on this? We are having the same problem, unfortunately 😕 |
FIX: Work around the five-year-old Safari bug where it won't accurately report the selection inside shadow roots, which would break ProseMirror when put in shadow DOM. Issue #142 Issue ProseMirror/prosemirror#476
Could people who are interested in this issue test the current master branch? |
Hey @marijnh, thank you for this fix, I have checked demo with shadow dom and for me all works as expected. Could you pls publish a patch for this. |
I've tagged this as 1.28.3 |
Hey @marijnh , can't we have a function like setRoot() that sets the root of the prosemirror dynamically? We have a requirement where we have initialisied prosemirror within shadowRoot and at some point in time we need to bring it outside the shadowRoot to the body. So in these cases, if we have some function like setRoot(), it will be easier. Is there any technical difficulty in implementing this? |
FEATURE: The new `EditorView.updateRoot` method can be used to make the editor update its DOM root when it is moved to a new document or shadow tree. Issue ProseMirror/prosemirror#476
Could you see if attached patch (which simply sets |
It works on basic level of testing, thanks for the quick fix @marijnh 👍 . |
Tagged as 1.32.0 |
When ProseMirror adopts an element inside a Shadow DOM in Safari 10, an exception is thrown.
The reason appears to be that in Safari 10 the extensions to
DocumentOrShadowRoot
don't appear to have all been applied to the shadow root.This means that in
rangeToDOM
,getSelection
is undefined, which when invoked throws an exception.We've raised https://bugs.webkit.org/show_bug.cgi?id=163921 to track this against Safari.
The text was updated successfully, but these errors were encountered: