We have disabled 'Convert URLs into links'.

When you copy a url link from a browser url field like: drupal.org. Your clipboard contains the FQDN: https://www.drupal.org/. When you past this into Ckeditor. It becomes a working hyperlink. This is expected. Can I stop this from happening? We want to allow url links to be pasted/added only through the Ckeditor Linkit module.

Below is an example if you use Linkit external links or if you paste a copied link in. The markup in the Ckeditor source is the same. How can I target the pasted link and strip it out the href attribute?. I thought about adding a link attribute in Linkit to distinguish it. Then use regex that targets href without that attribute and strip out the href.

<p><a href="https://www.drupal.org/"https://www.drupal.org/</a>
<p><a href="https://www.drupal.org/">https://www.drupal.org/</a>
  • I guess this is a CKeditor thing, as there is a button Paste as plain text (Ctrl + Shift + V) that prevents link conversion. – Hudri Nov 14 '19 at 14:29
  • 1
    Its more likely the "Convert URLs into links" option in the text format you're using under "/admin/config/content/formats" – Leigh Nov 14 '19 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.