]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dijit/_editor/plugins/TextColor.js
lib: Upgrade Dojo and Dijit from 1.8.3 to 1.12.1
[tt-rss.git] / lib / dijit / _editor / plugins / TextColor.js
index 2f24d04243c2802d9a2261b1561d25c510086bea..013f1a4b06cf340de47a7fe6a668e9eca961521b 100644 (file)
@@ -1,105 +1,2 @@
-/*
-       Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
-       Available via Academic Free License >= 2.1 OR the modified BSD license.
-       see: http://dojotoolkit.org/license for details
-*/
-
-
-if(!dojo._hasResource["dijit._editor.plugins.TextColor"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dijit._editor.plugins.TextColor"] = true;
-dojo.provide("dijit._editor.plugins.TextColor");
-dojo.require("dijit._editor._Plugin");
-dojo.require("dijit.ColorPalette");
-
-
-dojo.declare("dijit._editor.plugins.TextColor", dijit._editor._Plugin, {
-       // summary:
-       //              This plugin provides dropdown color pickers for setting text color and background color
-       //
-       // description:
-       //              The commands provided by this plugin are:
-       //              * foreColor - sets the text color
-       //              * hiliteColor - sets the background color
-       
-       // Override _Plugin.buttonClass to use DropDownButton (with ColorPalette) to control this plugin
-       buttonClass: dijit.form.DropDownButton,
-       
-       // useDefaultCommand: Boolean
-       //              False as we do not use the default editor command/click behavior.
-       useDefaultCommand: false,
-
-       constructor: function(){
-               this.dropDown = new dijit.ColorPalette();
-               this.connect(this.dropDown, "onChange", function(color){
-                       this.editor.execCommand(this.command, color);
-                       
-               });
-       },
-
-       updateState: function(){
-               // summary:
-               //              Overrides _Plugin.updateState().  This updates the ColorPalette
-               //              to show the color of the currently selected text.
-               // tags:
-               //              protected
-               
-               var _e = this.editor;
-               var _c = this.command;
-               if(!_e || !_e.isLoaded || !_c.length){
-                       return;
-               }
-               
-               if(this.button){
-                       var disabled = this.get("disabled");
-                       this.button.set("disabled", disabled);
-                       if(disabled){ return; }
-                       
-                       var value;
-                       try{
-                               value = _e.queryCommandValue(_c)|| "";
-                       }catch(e){
-                               //Firefox may throw error above if the editor is just loaded, ignore it
-                               value = "";
-                       }
-               }
-               
-               if(value == ""){
-                       value = "#000000";
-               }
-               if(value == "transparent"){
-                       value = "#ffffff";
-               }
-
-               if(typeof value == "string"){
-                       //if RGB value, convert to hex value
-                       if(value.indexOf("rgb")> -1){
-                               value = dojo.colorFromRgb(value).toHex();
-                       }
-               }else{  //it's an integer(IE returns an MS access #)
-                       value =((value & 0x0000ff)<< 16)|(value & 0x00ff00)|((value & 0xff0000)>>> 16);
-                       value = value.toString(16);
-                       value = "#000000".slice(0, 7 - value.length)+ value;
-                       
-               }
-               
-               if(value !== this.dropDown.get('value')){
-                       this.dropDown.set('value', value, false);
-               }
-       }
-});
-
-// Register this plugin.
-dojo.subscribe(dijit._scopeName + ".Editor.getPlugin", null, function(o){
-       if(o.plugin){
-               return;
-       }
-       switch(o.args.name){
-               case "foreColor":
-               case "hiliteColor":
-                       o.plugin = new dijit._editor.plugins.TextColor({
-                               command: o.args.name
-                       });
-       }
-});
-
-}
+//>>built
+define("dijit/_editor/plugins/TextColor",["require","dojo/colors","dojo/_base/declare","dojo/_base/lang","../_Plugin","../../form/DropDownButton"],function(_1,_2,_3,_4,_5,_6){var _7=_3("dijit._editor.plugins.TextColor",_5,{buttonClass:_6,colorPicker:"dijit/ColorPalette",useDefaultCommand:false,_initButton:function(){this.command=this.name;this.inherited(arguments);var _8=this;this.button.loadDropDown=function(_9){function _a(_b){_8.button.dropDown=new _b({dir:_8.editor.dir,ownerDocument:_8.editor.ownerDocument,value:_8.value,onChange:function(_c){_8.editor.execCommand(_8.command,_c);},onExecute:function(){_8.editor.execCommand(_8.command,this.get("value"));}});_9();};if(typeof _8.colorPicker=="string"){_1([_8.colorPicker],_a);}else{_a(_8.colorPicker);}};},updateState:function(){var _d=this.editor;var _e=this.command;if(!_d||!_d.isLoaded||!_e.length){return;}if(this.button){var _f=this.get("disabled");this.button.set("disabled",_f);if(_f){return;}var _10;try{_10=_d.queryCommandValue(_e)||"";}catch(e){_10="";}}if(_10==""){_10="#000000";}if(_10=="transparent"){_10="#ffffff";}if(typeof _10=="string"){if(_10.indexOf("rgb")>-1){_10=_2.fromRgb(_10).toHex();}}else{_10=((_10&255)<<16)|(_10&65280)|((_10&16711680)>>>16);_10=_10.toString(16);_10="#000000".slice(0,7-_10.length)+_10;}this.value=_10;var _11=this.button.dropDown;if(_11&&_11.get&&_10!==_11.get("value")){_11.set("value",_10,false);}}});_5.registry["foreColor"]=function(_12){return new _7(_12);};_5.registry["hiliteColor"]=function(_13){return new _7(_13);};return _7;});
\ No newline at end of file