1

I have a Javascript for tooltips and other things which work fine in front end but I want the same Javascript to run inside CKEditor too so that the user can see what he/she will get in the front end. I have successfully linked my custom CSS with CKEditor using function hook_ckeditor_css_alter which completes my half target but I didn't find any hooks for attaching custom Javascript.

Please share a tip or point me to any resource which may help in this regard. Thanks

  • You'll need to write a custom ckeditor plugin to do that. Once you've done that, introducing it to Drupal is pretty easy: drupal.stackexchange.com/questions/139075/… – Clive Sep 27 '17 at 7:51
  • @Clive I can't see in those links where the add a custom javascript. The only scripts they add are those which are needed by the plugin itself. I know this part of the stuff but I may be missing something seriously. – Shujaat Ali Khan Sep 27 '17 at 8:07
  • You probably don't need a plugin, actually, you can use CKEditor.scriptLoader. I haven't personally used it so I can't help further I'm afraid – Clive Sep 27 '17 at 8:11
  • @Clive Thanks for the pointers. I will checkout your hints more deeply to see if they work out for me. – Shujaat Ali Khan Sep 27 '17 at 8: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.