[Bug]: Text selection doesn't work in React node views #4036
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Triage: Open
A new issue or pullrequest that requires triage (added by default)
Type: Bug
The issue or pullrequest is related to a bug
Which packages did you experience the bug in?
core, react
What Tiptap version are you using?
2.0.3
What’s the bug you are facing?
I'm rendering a table in a React node view, and would like to enable text in table cells to be selectable by users (i.e.
user-select: auto
), e.g. so they can copy/paste text to their clipboards.It seems text cannot be selected by default in any React node view (see CodeSandbox for a minimal repro).
I suspect this is because a
draggable="true"
HTML attr is being added to a node when you start trying to select text, even though I havedraggable: false
on my node spec (seems odd - probably added by Prosemirror?).If I set
selectable: false
on the node, it works (but this isn't desirable - I want the node to be selectable).Text selection also works (but node selection doesn't) if I override
stopEvent
to stop all events:How can I enable text selection, without blocking node selection?
What browser are you using?
Chrome
Code example
https://codesandbox.io/s/tiptap-react-text-selection-bug-lvhk0e
What did you expect to happen?
I would expect text can be selected in interactive Node views (at least if the node isn't draggable). This seems like the most natural default (matching
user-select: auto
in the browser). A dev could setuser-select: none
if this isn't desired.Or at least, there would be some workaround to enable text selection without disabling node selection completely.
Anything to add? (optional)
This part of
stopEvent
looks possibly related:tiptap/packages/core/src/NodeView.ts
Lines 134 to 139 in 164eebf
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: