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]: extension-link: multiple tabs are opened when click anchor link in readonly editor #4143

Open
1 of 2 tasks
takaaa220 opened this issue Jun 21, 2023 · 5 comments
Open
1 of 2 tasks
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

@takaaa220
Copy link

takaaa220 commented Jun 21, 2023

Which packages did you experience the bug in?

extension-link

What Tiptap version are you using?

2.0.0-beta.220

What’s the bug you are facing?

Multiple tabs are opened when click anchor link in readonly editor (editor.editable is set to false).
The behavior differs depending on the browser and OS, but when using Firefox and MacOS, it looks like this video.

2023-06-21.19.47.17.mov

What browser are you using?

Firefox

Code example

https://codesandbox.io/s/zealous-taussig-px4w3y

What did you expect to happen?

Only one tab is opened when click anchor link.

Anything to add? (optional)

I think it would to return false if view.editable is false at here, but I'm not familiar with the internal implementation of tiptap, so I'm not sure.

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. 💖
@takaaa220 takaaa220 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 Jun 21, 2023
@takaaa220
Copy link
Author

I found a related pull request #3312 but it seems there is no progress 😢

@dragosdev-code
Copy link

I have the same issue, but I got it to work disabling the openOnClick property when I set the editor to be not editable.

type Props = {
  readOnly?: boolean;
};

const RichTextEditor: React.FC<Props> = ({
  readOnly,
}) => {
  const editor = useEditor({
    extensions: [
      Link.configure({
        openOnClick: !readOnly,
      }),    
    ],
    editable: !readOnly,
    // ...rest of the configuration
  });

  return (
      <EditorContent
        className={classes.editorContent}
        editor={editor}
      />
  );
};

However, if the changes from #3312 are implemented, it could be a little more elegant.

@takaaa220
Copy link
Author

I have the same issue, but I got it to work disabling the openOnClick property when I set the editor to be not editable.

Thanks for your sharing! I was able to resolve by that way.

However, if the changes from #3312 are implemented, it could be a little more elegant.

On second thought, #3312 doesn't solve my issue...

@Nantris
Copy link
Contributor

Nantris commented Jul 22, 2023

I can't reproduce this with your repro on Chrome 115 on Linux, but I'd advise upgrading out of beta.

@bdbch bdbch added this to Tiptap Aug 4, 2023
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Aug 4, 2023
@chaoyue-z-colab
Copy link

i can still repro this but only on firefox with "@tiptap/extension-link": "^2.1.8". note, this only happen on firefox in read only editor.

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: Triage open
Development

No branches or pull requests

6 participants