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

ckeditor 5 wrong rendering for target _blank links #8225

Closed
confettidc opened this issue Oct 7, 2020 · 6 comments
Closed

ckeditor 5 wrong rendering for target _blank links #8225

confettidc opened this issue Oct 7, 2020 · 6 comments
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:question This issue asks a question (how to...).

Comments

@confettidc
Copy link

We found that ckeditor rendered wrong link with target _blank structure as below:

Testing url (open in new tab)

As a result, the link cannot be clicked and link disappeared when load editor again.

Please help check, thanks.

@Mgsy
Copy link
Member

Mgsy commented Oct 7, 2020

Hi, can you provide more information about your issue? It would be great if you can add steps to reproduce, expected result and actual result.

@Mgsy Mgsy added pending:feedback This issue is blocked by necessary feedback. type:question This issue asks a question (how to...). labels Oct 7, 2020
@confettidc
Copy link
Author

confettidc commented Oct 7, 2020

Hi,

I'm following to make target _blank links with below instructions:
https://ckeditor.com/docs/ckeditor5/latest/features/link.html#adding-target-and-rel-attributes-to-external-links

Due to program structure, I need to use updateSourceElement() to update data back to textarea

To reproduce the issue, please refer to below video:
2020-10-07_21-43-00.zip

Expected result: should be simple format like below:
<a href="https://www.google.com" target="_blank">text</a>

Thanks.

@FilipTokarski
Copy link
Member

FilipTokarski commented Oct 8, 2020

Hi, thanks for the information. I tried using link decorators and always got the expected data. I'd suggest that this double link issue might be caused by your integration and not by the bug in the feature itself. Hovewer, if you are sure that there's a bug in the feature, I guess we'll need a step-by-step guide to reproduce this, together with the editor configuration.

@confettidc
Copy link
Author

Hi,

Thanks and I have spoted out the issue that there may be conflicts between making target _blank and target _top links, here is my configuration:

link: {
decorators: {
isExternal: {
mode: 'manual',
label: '',
attributes: {
target: '_blank',
rel: 'noopener noreferrer'
}
},
targetTop: {
mode: 'automatic',
callback: url => /^(https?:)?///.test( url ),
attributes: {
target: '_top',
rel: 'noopener noreferrer'
}
}
}
}

My idea is automatically convert http links to target _top, and switch to target _blank if the switch is turned on, any suggestions can archive this?

Thanks.

@confettidc
Copy link
Author

It's the best if end user can self define target _self, _blank, _top, thanks

@FilipTokarski
Copy link
Member

Ok, I think now I see what happens here. There seems to be a bug when adding a manual decorator with some other target attribute. As it comes to your integration, it seems that unfortunately there is no out-of-the box way to fix things right away.
I'll close this ticket as a duplicate and we'll be tracking this issue here #8230. Please add there 👍 if you'd like to see it fixed faster and also feel free to add there anything you find important.

@FilipTokarski FilipTokarski added resolution:duplicate This issue is a duplicate of another issue and was merged into it. and removed pending:feedback This issue is blocked by necessary feedback. labels Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

3 participants