Jump to content

CKEditor Custom Config Option "linkJavaScriptLinksAllowed: true" doesn't work.


montapro
 Share

Recommended Posts

Hi @montapro, welcome to the PW forums. :)

It's likely that HTML Purifier will strip javascript links regardless of the CKEditor config. So I think you'll have to set "Use HTML Purifier" to "No" in the field options if you want to insert links like that. JS links worked for me with HTML Purifier off.

  • Like 1
Link to comment
Share on other sites

3 hours ago, Robin S said:

Hi @montapro, welcome to the PW forums. :)

It's likely that HTML Purifier will strip javascript links regardless of the CKEditor config. So I think you'll have to set "Use HTML Purifier" to "No" in the field options if you want to insert links like that. JS links worked for me with HTML Purifier off.

Thank you @Robin S,

is not the perfect solution, because pw shows me an error after save and edit the link in CKEditor.
But at least it's saved and it is enough for my case.

Link to comment
Share on other sites

9 hours ago, montapro said:

is not the perfect solution, because pw shows me an error after save and edit the link in CKEditor.

What is the error? Maybe there is a solution for this too.

Link to comment
Share on other sites

8 hours ago, Robin S said:

What is the error? Maybe there is a solution for this too.

It's saved and it works for me, but when i want to edit the link it promt an error and the "Link to URL" field is empty.
Take a look at the screenshot.

Edit Page  MKL Transporte • mkl transporte.de.png

Link to comment
Share on other sites

1 hour ago, montapro said:

It's saved and it works for me, but when i want to edit the link it promt an error and the "Link to URL" field is empty.

Unfortunately there's no good solution to this that I can see while still using ProcessPageEditLink (i.e. the link modal window). That's because ProcessPageEditLink applies $sanitizer->url to existing link hrefs and the options for it are not configurable within the module. And even if the options were configurable it turns out that it's impossible for javascript links to pass this sanitizer because PHP's FILTER_VALIDATE_URL is always applied. The workings of ProcessPageEditLink seem a bit inconsistent to me so I have opened a GitHub issue.

A workaround you could use is to create a Hanna code for inserting javascript links, with attributes for 'href' and 'text'. If you install Hanna Code Dialog you can get a dialog UI in CKEditor.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...