Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#39423 closed enhancement (wontfix)

Create add_editor_script, analogous to add_editor_style (add JavaScript to TinyMCE)

Reported by: paulschreiber's profile paulschreiber Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: TinyMCE Keywords: close
Focuses: Cc:


It would be helpful to be able to load external and inline JavaScript in to TinyMCE.

Suggestion: create an add_editor_script() function, analogous to add_editor_style().

Use case: embed handlers or shortcode handlers that require custom JavaScript.

Change History (3)

#1 @azaozz
7 years ago

  • Keywords close added

Don't think this is a good idea. If you want to run js or manipulate the DOM in the editor iframe, you should use "proper" plugin. TinyMCE has extensive APIs for that, look at editor.dom and editor.$ (which is pretty similar to jQuery but inside the contenteditable body).

If you cannot use the editor APIs, you should look into using wpview that will insert an iframe and make it non-editable.

Also add_editor_style() extends and exposes an existing TinyMCE setting, see: Adding arbitrary JS to the editor iframe is not supported.

Version 0, edited 7 years ago by azaozz (next)

#2 @azaozz
7 years ago

  • Component changed from Editor to TinyMCE

#3 @azaozz
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Still don't think this is a good idea :)

Note: See TracTickets for help on using tickets.