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

Question: how to set (more) attributes with setLink #3788

Closed
1 of 2 tasks
seanhakbb opened this issue Feb 24, 2023 · 1 comment
Closed
1 of 2 tasks

Question: how to set (more) attributes with setLink #3788

seanhakbb opened this issue Feb 24, 2023 · 1 comment
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@seanhakbb
Copy link

What’s the bug you are facing?

Hi
I'm having difficulties adding extra attributes on my link.

I tried following:

editor
			?.chain()
			.focus()
			.extendMarkRange('link')
			.setLink({ href: linkpickerUrl, target: linkpickerTarget })
			.updateAttributes('link', { title: linkpickerTitle })
			.run();

also tried with running extendedMarkRange again. extendedMarkRange.setLink().extendedMarkRange().updateAttributes(...
my Link config also includes title in HTMLAttributes, in case it was that....

I'm probably doing it wrong?

@Ken-vdE did have a solution for adding class as an extra attribute, but I couldn't get that to work,
#2758 seems be in the branch, but in my beta 2 branch i'm only getting href and target (also using typescript).

Thanks for any guidance!

Which browser was this experienced in? Are any special extensions installed?

Edge, Chrome and firefox for PC.

How can we reproduce the bug on our side?

nextjs 13, typescript, tiptap/react 2.0.0-beta.217

Can you provide a CodeSandbox?

No response

What did you expect to happen?

I expected the updateAttributes to chain.

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. 💖
@seanhakbb seanhakbb added the Type: Bug The issue or pullrequest is related to a bug label Feb 24, 2023
@seanhakbb
Copy link
Author

I had to extend Link and use addAttributes for the updateAttributes to take! I thought updateAttributes allowed us to add any attributes dynamically, but clearly it needs to be added as well!

Thanks for all your hard and great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

No branches or pull requests

1 participant