Paul
Paul

Reputation: 209

Replace Default WYSIWYG Engine on Page Load

We use a closed source knowledge base solution currently, and the WYSIWYG to create articles is TinyMCE (looks like it may be a modified/simplified).

They do not currently allow changing it at all (adding plugins, etc, unless you can inject plugins somehow).

I do have full access to the header and can use javascript, so the question is, is there a way to remove the existing tinymce instance and replace it with my own on page load?

Upvotes: 0

Views: 35

Answers (1)

Michael Fromin
Michael Fromin

Reputation: 13746

...is there a way to remove the existing tinymce instance and replace it with my own on page load?

Indeed there is but it may be more work than you want to take on.

If you cannot modify the code that the app uses to load TinyMCE the best you could do would be to...

  1. Wait for the page to load and TinyMCE to initialize
  2. Manually remove TinyMCE from the page using the remove() API
  3. Initialize a new TinyMCE instance on that same textarea using the init() API

Remove API: https://www.tinymce.com/docs/api/tinymce/root_tinymce/#remove

Init API: https://www.tinymce.com/docs/api/tinymce/root_tinymce/#init

You can play with these APIs on http://fiddle.tinymce.com/ to see how they work before you try to mess with the app's codebase. This should get you started: http://fiddle.tinymce.com/kpgaab

Upvotes: 1

Related Questions