-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Short description of the issue
When creating a new link in a CKEditor field via ProcessPageEditLink no $sanitizer method is applied to the link href. Arguably this is fine as the link will be part of the CKEditor content and subject to whatever ACF and HTML Purifier settings the user has configured.
But when editing an existing link the href value is passed through $sanitizer->url - this is inconsistent. Either it is essential to apply this sanitizer in which case it should be applied to new links also, or it is not essential in which case it should not be applied when editing an existing link.
Or better: it should be configurable whether to apply the sanitizer to both new and existing links and configurable what $sanitizer->url options are applied.
Incidentally, it is impossible for a javascript link to pass validation by $sanitizer->url even when the 'javascript' scheme is explicitly allowed, as a javascript link cannot pass PHP's FILTER_VALIDATE_URL which is always applied by $sanitizer->url. This makes it impossible to edit an existing link in ProcessPageEditLink that uses the 'javascript' scheme. It's probably not a great idea to allow JS links in a CKEditor field but it seems like it ought to be possible if a user is determined to allow this.
The forum topic that prompted this issue: https://processwire.com/talk/topic/16212-ckeditor-custom-config-option-linkjavascriptlinksallowed-true-doesnt-work/
Setup/Environment
- ProcessWire version: 3.0.61