TinyMCE 5 editor API deprecations
See TinyMCE’s guide for migrating from TinyMCE 4 to TinyMCE 5.
Event handling
Event handling is based on the new way of binding events introduced in TinyMCE 4.0. See Event handling and Handling Editor events for more details. You can skip event handling if you've already migrated your code to TinyMCE 4.0.
Below is an example for listening to mouse click event. You should apply the new method for other events as well.
Deprecated method | New method | Docs for new API |
---|---|---|
editor.onClick.add(callbackFunction) | editor.on("Click", callbackFunction) | API reference |
editor.onClick.addToTop(callbackFunction) | editor.on("Click", callbackFunction, true) | |
editor.onClick.dispatch() | editor.fire("Click") | |
editor.onClick.remove(callbackFunction) | editor.off("Click", callbackFunction) |
Changed UI API method namespace
The API methods for registering UI components have moved. They are now part of TinyMCE 5 Ui registration API.
Deprecated method | New method | Doc for new API |
---|---|---|
editor.addButton(identifier, configuration) | editor.ui.registry.addButton(identifier, configuration) | API reference |
Translation i18n
Deprecated method | New method | Docs for new API |
---|---|---|
tinymce.addI18n(key, data) Parameters
Sample
| tinymce.addI18n(languageCode, data) tinymce.util.i18n.add(languageCode, data) Parameters
Sample
| |
editor.getLang(key, defaultValue) | editor.translate(key) tinymce.util.i18n.translate(key) |
editor = tinymce.activeEditor (editor is the active editor)