Skip to content
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

[PRO]: Styled text within threads are not wrapped in thread classes #6115

Open
1 task done
Jordan-Templeman opened this issue Feb 19, 2025 · 1 comment
Open
1 task done
Labels
Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@Jordan-Templeman
Copy link

Affected Packages

CommentsKit

Version(s)

2.17.3

Description of the Bug

If any styles(bold, italic, color, marks, etc.) are added to text within a thread, the .tiptap-thread--unresolved and .tiptap-thread--selected classes do not wrap these elements. This prevents adding CSS to nodes with styling applied when it is within a thread. This seems to be related to how these elements are being structured within the DOM.

DOM output

<p style="text-align: left">
  <span data-inline-thread="" data-thread-id="1">
    <span
      class="tiptap-thread tiptap-thread--inline tiptap-thread--unresolved"
      data-state="default"
      data-status="open"
      data-status-all="open"
      data-type="inline"
    >
      Comment with
    </span>
  </span>
  <strong>
    <span data-inline-thread="" data-thread-id="1">
      bolded
    </span>
  </strong>
  <span data-inline-thread="" data-thread-id="1">
    <span
      class="tiptap-thread tiptap-thread--inline tiptap-thread--unresolved"
      data-state="default"
      data-status="open"
      data-status-all="open"
      data-type="inline"
    >
      text
    </span>
  </span>
</p>

Image

Browser Used

Chrome

Code Example (Preferred)

No response

Expected Behavior

I would expect these elements to remain within the <span class="tiptap-thread tiptap-thread--inline tiptap-thread--unresolved" even with any sort of styling applied to the text node

Additional Context (Optional)

I was able to reproduce this issue within this demo https://next-comments-template.vercel.app/comments/tgzcLtJp6n as well as within our app locally

Dependency Updates

  • Yes, I've updated all my dependencies.
@Jordan-Templeman Jordan-Templeman added Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Feb 19, 2025
@guanriyue
Copy link
Contributor

Thread classes are just additional inline decoration. The problem lies in this check.

if (e.type.name !== n.blockThreadTypeName && e.marks.some(e => e.type.name !== n.inlineThreadTypeName))
   return;

If a node carries a mark other than inlineThread, that node will not render the decoration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Pro The issue or pull request is related to the pro packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants