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]: linkOnPaste: false doesn't work at all - pasted links are still linkified #4256

Closed
1 of 2 tasks
Nantris opened this issue Jul 27, 2023 · 3 comments · Fixed by #4292
Closed
1 of 2 tasks

[Bug]: linkOnPaste: false doesn't work at all - pasted links are still linkified #4256

Nantris opened this issue Jul 27, 2023 · 3 comments · Fixed by #4292
Assignees
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

Comments

@Nantris
Copy link
Contributor

Nantris commented Jul 27, 2023

Which packages did you experience the bug in?

extension-link

What Tiptap version are you using?

2.1.0-rc.12

What’s the bug you are facing?

When linkOnPaste is set to false, I'd expect the pasteHandler code not to run, but instead nearly all of it runs.

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

pasteHandler code should be fully or almost fully skipped over during execution.

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@Nantris Nantris added 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 labels Jul 27, 2023
@Nantris Nantris changed the title [Bug]: linkOnPaste: false should remove the pasteHandler, rather than running all of the logic [Bug]: linkOnPaste: false doesn't work at all - pasted links are still linkified Jul 27, 2023
@Nantris
Copy link
Contributor Author

Nantris commented Jul 27, 2023

This appears to be the same issue as #2441 and it makes it quite nearly impossible for developers to prevent this pasting behavior.

@Nantris
Copy link
Contributor Author

Nantris commented Jul 27, 2023

I also found this issue which advises the following code, but it also makes no difference and potential links are forcibly linkified.

  addPasteRules() {
    return [];
  },

This is especially problematic because of #3893

@Nantris
Copy link
Contributor Author

Nantris commented Jul 27, 2023

The issue seems to occur because of these lines:

if (link && selection.empty) {
options.editor.commands.insertContent(`<a href="${link.href}">${link.href}</a>`)

It also seems to cause #3893

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. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants