]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/tiny_mce_popup.js
WordPress 4.5.1-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / tiny_mce_popup.js
index 9150f8654b86b59123bf6eeee1267acfe5c94010..4dbe732f0ee759358252d396e424281fb44730ba 100644 (file)
@@ -1,8 +1,8 @@
 /**
- * Popup.js
+ * tinymce_mce_popup.js
  *
- * Copyright, Moxiecode Systems AB
  * Released under LGPL License.
+ * Copyright (c) 1999-2015 Ephox Corp. All rights reserved
  *
  * License: http://www.tinymce.com/license
  * Contributing: http://www.tinymce.com/contributing
@@ -78,7 +78,7 @@ var tinyMCEPopup = {
                 * tinyMCEPopup.onInit.add(function(ed) {
                 *     alert(ed.selection.getContent());
                 * });
-                * 
+                *
                 * // Executes the init method on page load in some object using the SomeObject scope
                 * tinyMCEPopup.onInit.add(SomeObject.init, SomeObject);
                 */
@@ -107,7 +107,7 @@ var tinyMCEPopup = {
         * Returns a window argument/parameter by name.
         *
         * @method getWindowArg
-        * @param {String} name Name of the window argument to retrive.
+        * @param {String} name Name of the window argument to retrieve.
         * @param {String} defaultValue Optional default value to return.
         * @return {String} Argument value or default value if it wasn't found.
         */
@@ -121,7 +121,7 @@ var tinyMCEPopup = {
         * Returns a editor parameter/config option value.
         *
         * @method getParam
-        * @param {String} name Name of the editor config option to retrive.
+        * @param {String} name Name of the editor config option to retrieve.
         * @param {String} defaultValue Optional default value to return.
         * @return {String} Parameter value or default value if it wasn't found.
         */
@@ -249,18 +249,21 @@ var tinyMCEPopup = {
         * @param {string} element_id Element id to be filled with the color value from the picker.
         */
        pickColor : function(e, element_id) {
-               this.execCommand('mceColorPicker', true, {
-                       color : document.getElementById(element_id).value,
-                       func : function(c) {
-                               document.getElementById(element_id).value = c;
-
-                               try {
-                                       document.getElementById(element_id).onchange();
-                               } catch (ex) {
-                                       // Try fire event, ignore errors
-                               }
-                       }
-               });
+               var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback;
+               if (colorPickerCallback) {
+                       colorPickerCallback.call(
+                               this.editor,
+                               function (value) {
+                                       el.value = value;
+                                       try {
+                                               el.onchange();
+                                       } catch (ex) {
+                                               // Try fire event, ignore errors
+                                       }
+                               },
+                               el.value
+                       );
+               }
        },
 
        /**
@@ -324,7 +327,7 @@ var tinyMCEPopup = {
                }
        },
 
-       // Internal functions   
+       // Internal functions
 
        _restoreSelection : function() {
                var e = window.event.srcElement;
@@ -356,7 +359,7 @@ var tinyMCEPopup = {
                                "browse": "Browse"
                        };
 
-                       var langCode = tinymce.settings.language || 'en';
+                       var langCode = (tinymce.settings ? tinymce.settings : t.editor.settings).language || 'en';
                        for (var key in map) {
                                tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
                        }
@@ -520,7 +523,7 @@ tinymce.util.Dispatcher = function(scope) {
                var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;
 
                self.inDispatch = true;
-               
+
                // Needs to be a real loop since the listener count might change while looping
                // And this is also more efficient
                for (i = 0; i < listeners.length; i++) {