From b707874fa975d78886ff4d9d56dafb308cc93c3f Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 2 Jan 2014 01:06:58 +0000 Subject: [PATCH] TinyMCE: add stubs for the missing tinymce.util.Cookie, windowManager.onOpen and windowManager.onClose to the compat3x plugin. See #24067, fixes #26750. git-svn-id: https://develop.svn.wordpress.org/trunk@26890 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/compat3x/plugin.js | 22 +++++++++++++++++-- src/wp-includes/version.php | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js b/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js index 76f438627f..31b78ca468 100644 --- a/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js @@ -31,6 +31,11 @@ function Dispatcher(target, newEventName, argsMap, defaultScope) { target = target || this; + if ( ! newEventName ) { + this.add = this.addToTop = this.remove = this.dispatch = function(){}; + return; + } + this.add = function(callback, scope) { log('.on' + newEventName + ".add(..)"); @@ -85,10 +90,17 @@ }; } + tinymce.util.Dispatcher = Dispatcher; tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload"); tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor"); tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor"); + function noop(){} + + tinymce.util.Cookie = { + get: noop, getHash: noop, remove: noop, set: noop, setHash: noop + }; + function patchEditor(editor) { function patchEditorEvents(oldEventNames, argsMap) { tinymce.each(oldEventNames.split(" "), function(oldName) { @@ -132,7 +144,7 @@ if (this.buttons[name]) { this.buttons[name].active(state); } - }, + } }; patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor"); @@ -193,8 +205,14 @@ selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection); selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection); selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection); + }); - editor.windowManager.createInstance = function(className, a, b, c, d, e) { + editor.on('BeforeRenderUI', function() { + var windowManager = editor.windowManager; + + windowManager.onOpen = new Dispatcher(); + windowManager.onClose = new Dispatcher(); + windowManager.createInstance = function(className, a, b, c, d, e) { log("windowManager.createInstance(..)"); var constr = tinymce.resolve(className); diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php index 288184c49d..34d0a28633 100644 --- a/src/wp-includes/version.php +++ b/src/wp-includes/version.php @@ -18,7 +18,7 @@ $wp_db_version = 26691; * * @global string $tinymce_version */ -$tinymce_version = '4012-20131228'; +$tinymce_version = '4012-20140101'; /** * Holds the required PHP version