Make WordPress Core

Opened 10 years ago

Closed 7 years ago

#39423 closed enhancement (wontfix)

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

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

Description

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
10 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: https://www.tinymce.com/docs/configure/content-appearance/#content_css. Adding arbitrary JS to the editor iframe is not supported.

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

#2 @azaozz
10 years ago

  • Component EditorTinyMCE

#3 @azaozz
7 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed

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

Note: See TracTickets for help on using tickets.