froot Posted August 24, 2020 Share Posted August 24, 2020 Can I automatically add the attribute target="_blank" to all links created in a CKeditor body field? Link to comment Share on other sites More sharing options...
Orkun Posted August 24, 2020 Share Posted August 24, 2020 Hi @fruid Perhaps you can copy the TextformatterMakeLink Module and adjust it to your needs and then select the new adjusted Module inside the requested textarea field? KR Orkun Link to comment Share on other sites More sharing options...
dragan Posted August 24, 2020 Share Posted August 24, 2020 1 hour ago, fruid said: Can I automatically add the attribute target="_blank" to all links created in a CKeditor body field? Are you really sure you want to add that to every single link? What about email links? Anchor links? Links to internal PW-pages? If so, you could inject these with a hook, or via JS; but if you have lots of pages and RTE fields, that might not be the most efficient approach. But apparently, you can also configure CKEditor to do what you want:https://ckeditor.com/old/forums/CKEditor/Set-link-default-target-to-new-window-blankhttps://ckeditor.com/docs/ckeditor4/latest/guide/dev_howtos_dialog_windows.htmlhttp://handsomedogstudio.com/ckeditor-set-default-target-blank Link to comment Share on other sites More sharing options...
adrian Posted August 25, 2020 Share Posted August 25, 2020 I hate this behavior, but if you just want it for external links, there is: http://modules.processwire.com/modules/textformatter-mark-external-links/ or my highly modified version attached. I do my best to convince clients not to this, but some just won't listen. Read why it's a bad idea:https://www.smashingmagazine.com/2008/07/should-links-open-in-new-windows/https://www.w3.org/TR/WCAG20-TECHS/G200.htmlhttps://pinksheepmedia.com/2019/05/in-general-hyperlinks-should-open-in-the-same-window/https://knowbility.org/blog/2019/links-opening-new-windows-no-warning/ TextformatterMarkExternalLinks.module 3 Link to comment Share on other sites More sharing options...
froot Posted August 25, 2020 Author Share Posted August 25, 2020 I meant only for external links @dragan OK, thanks all for the suggestions and advice. I will reconsider now. In any case, good to know there's a module for this. Link to comment Share on other sites More sharing options...
PWaddict Posted August 26, 2020 Share Posted August 26, 2020 Feel free to checkout my module https://github.com/PWaddict/TextformatterOptimizeExternalLinks where you can optimize all the external links. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now