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

[Bug]: Content other than text can't be part of a simulated paste within an insertContent command #5150

Open
1 task done
gabemagee-ev opened this issue May 14, 2024 · 0 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@gabemagee-ev
Copy link

gabemagee-ev commented May 14, 2024

Affected Packages

core

Version(s)

2.3.2

Bug Description

As of #5046, users can apply paste rules to the insertContent command, which is really helpful! Unfortunately, if the content the user inserts is an Object rather than a string, the paste rule fails because there is no length property of Objects. We can simply convert the text property of the simulatedPasteMeta to a string in order to get a more accurate representation of the state.

Browser Used

Firefox

Code Example URL

No response

Expected Behavior

When appendTransaction() is called, it calls processEvent(), which within run() calls state.doc.nodesBetween(). In the case where non-string Content is passed to insertContent, no paste rules will be applied since to is NaN (see

state.doc.nodesBetween(from, to, (node, pos) => {
). Thus, no paste rules will be applied. We want paste rules to be applied.

Additional Context (Optional)

No response

Dependency Updates

  • Yes, I've updated all my dependencies.
@gabemagee-ev gabemagee-ev added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels May 14, 2024
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap May 14, 2024
gabemagee-ev added a commit to gabemagee-ev/tiptap that referenced this issue May 14, 2024
gabemagee-ev added a commit to gabemagee-ev/tiptap that referenced this issue Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Status: Triage open
Development

No branches or pull requests

1 participant