-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Cannot copy paste atomic nodes in Chrome #884
Comments
Ugh. I'm not sure if the browser is intentionally deciding that copying makes no sense when uneditable content is selected or if it's just bugging out somehow, but yeah, that's awkward. I haven't been able to find a reasonable fix on the library level yet, but adding either |
FIX: Fix an issue where node selections on uneditable nodes couldn't be copied or cut on Chrome. Issue ProseMirror/prosemirror#884
Attached patch might be a reasonable workaround, but I'm not entirely sure it won't have side effects. Could you give it a try and see how well it works for you? |
Sorry for the long delay. Unfortunately this patch doesn't work for me. Enabling/disabling dragging has no effect on copy-ability of these nodes in Chrome. This might be because my usecase renders deeply nested divs inside the NodeView. We were previously using the Setting I've attached a patch (please use the one below, oops) where we turn it on for atomic nodes. Out of interest, why do we explicitly disallow setting the value of contenteditable? Widgets, for instance, already have the (admittedly undocumented) |
Making such nodes editable means that typed text might end up inside them (for example, in Chrome, when they are the only child of their parent textblock that seems to commonly happen). As such, this solution doesn't look very attractive. |
Yeah, good point. Would only modifying the "content-editable" attribute if it hasn't already been set by the nodeview constructor sound reasonable? |
That'd be a reasonable (if somewhat obscure) way to opt out of the setting of |
@ahixon I happeded to run into this issue too in my project. And I was able to solve this issue by setting one line css to the But I don't see the logic here for doing this. Would be appreciate, if anyone could explain more detail for why this worked. |
Won't that CSS make the node editable again, though? (With all the problems, such as typed content accidentally ending up somewhere inside it, that entails.)
I'm not sure what 'this' refers to in this sentence. |
Yes, it's the werid part of the behavior by the browser by setting both
'this' refers to setting |
I'm having this same issue. Non content editable nodes will sometimes be copiable - other times the copy event doesnt fire at all. it seems worse when there are multiple non editable nodes next to each other vs if there is editable content in between non editable nodes is there anyone who has discovered a reasonable fix for this? |
Issue details
Chrome, and possibly Webkit, doesn't seem to differentiate easily between sequential nodes that are atomic (contain no directly editable content).
Despite the div being entirely selected (either by clicking, or by programatically creating a NodeSelection), trying to copy/paste in Chrome causes no
copy
event to fire within thecontentEditable
.Steps to reproduce
https://heather-shape.glitch.me/
https://glitch.com/edit/#!/heather-shape
As above, trying to create a NodeSelection manually around any of those nodes will create the selection, but any copy keyboard events do nothing.
ProseMirror version
Versions that are available via the
examples
require.Also exhibited with:
Affected platforms
Possible workaround
Interestingly, changing the
toDOM
to serialise the nodes to anobject
rather than adiv
or similar element allows the node to be selected, copy and pasted correctly.I'm not sure how cross browser this is, or if this is even a solution for Prosemirror to handle.
The text was updated successfully, but these errors were encountered: