diff --git a/editor/plugins/AutoSave.js b/editor/plugins/AutoSave.js index ef999f3ae9..d5f10d45a3 100644 --- a/editor/plugins/AutoSave.js +++ b/editor/plugins/AutoSave.js @@ -30,7 +30,7 @@ define([ dojo.experimental("dojox.editor.plugins.AutoSave"); -dojo.declare("dojox.editor.plugins._AutoSaveSettingDialog", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { +var AutoSaveSettingDialog = dojo.declare("dojox.editor.plugins._AutoSaveSettingDialog", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { // dialogTitle [public] String // The tile of the Auto-Save setting dialog @@ -177,7 +177,7 @@ dojo.declare("dojox.editor.plugins._AutoSaveSettingDialog", [_Widget, _Templated } }); -dojo.declare("dojox.editor.plugins.AutoSave", Save, { +var AutoSave = dojo.declare("dojox.editor.plugins.AutoSave", Save, { // summary: // This plugin provides the auto save capability to the editor. The // plugin saves the content of the editor in interval. When @@ -235,7 +235,7 @@ dojo.declare("dojox.editor.plugins.AutoSave", Save, { this._strings = dojo.i18n.getLocalization("dojox.editor.plugins", "AutoSave"); this._initButton(); - this._saveSettingDialog = new dojox.editor.plugins._AutoSaveSettingDialog({ + this._saveSettingDialog = new AutoSaveSettingDialog({ "dialogTitle": this._strings["saveSettingdialogTitle"], "dialogDescription": this._strings["saveSettingdialogDescription"], "paramName": this._strings["saveSettingdialogParamName"], @@ -419,12 +419,15 @@ dojo.declare("dojox.editor.plugins.AutoSave", Save, { } }); +// For monkey patching +AutoSave._AutoSaveSettingDialog = AutoSaveSettingDialog; + // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name == "autosave"){ - o.plugin = new dojox.editor.plugins.AutoSave({ + o.plugin = new AutoSave({ url: ("url" in o.args) ? o.args.url : "", logResults: ("logResults" in o.args) ? o.args.logResults : true, interval: ("interval" in o.args) ? o.args.interval : 5 @@ -432,6 +435,6 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ } }); -return dojox.editor.plugins.AutoSave; +return AutoSave; }); diff --git a/editor/plugins/AutoUrlLink.js b/editor/plugins/AutoUrlLink.js index c9a82afbb7..05bc336c60 100644 --- a/editor/plugins/AutoUrlLink.js +++ b/editor/plugins/AutoUrlLink.js @@ -8,7 +8,7 @@ define([ "dojo/string" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.AutoUrlLink", [_Plugin], { +var AutoUrlLink = dojo.declare("dojox.editor.plugins.AutoUrlLink", [_Plugin], { // summary: // This plugin can recognize a URL like string // (such as http://www.website.com) and turn it into @@ -223,10 +223,10 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "autourllink"){ - o.plugin = new dojox.editor.plugins.AutoUrlLink(); + o.plugin = new AutoUrlLink(); } }); -return dojox.editor.plugins.AutoUrlLink; +return AutoUrlLink; }); diff --git a/editor/plugins/Blockquote.js b/editor/plugins/Blockquote.js index 2339402401..b97da5bbb9 100755 --- a/editor/plugins/Blockquote.js +++ b/editor/plugins/Blockquote.js @@ -10,7 +10,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/Blockquote" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.Blockquote", _Plugin, { +var Blockquote = dojo.declare("dojox.editor.plugins.Blockquote", _Plugin, { // summary: // This plugin provides Blockquote capability to the editor. // window/tab @@ -504,10 +504,10 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "blockquote"){ - o.plugin = new dojox.editor.plugins.Blockquote({}); + o.plugin = new Blockquote({}); } }); -return dojox.editor.plugins.Blockquote; +return Blockquote; }); diff --git a/editor/plugins/Breadcrumb.js b/editor/plugins/Breadcrumb.js index b52aaeef1d..1650e746d6 100755 --- a/editor/plugins/Breadcrumb.js +++ b/editor/plugins/Breadcrumb.js @@ -22,7 +22,7 @@ define([ dojo.experimental("dojox.editor.plugins.Breadcrumb"); -dojo.declare("dojox.editor.plugins._BreadcrumbMenuTitle",[_Widget, _TemplatedMixin, _Contained],{ +var BreadcrumbMenuTitle = dojo.declare("dojox.editor.plugins._BreadcrumbMenuTitle",[_Widget, _TemplatedMixin, _Contained],{ // summary: // Simple internal, non-clickable, menu entry to act as a menu title bar. templateString: "", @@ -44,7 +44,7 @@ dojo.declare("dojox.editor.plugins._BreadcrumbMenuTitle",[_Widget, _TemplatedMix }); -dojo.declare("dojox.editor.plugins.Breadcrumb", _Plugin,{ +var Breadcrumb = dojo.declare("dojox.editor.plugins.Breadcrumb", _Plugin,{ // summary: // This plugin provides Breadcrumb capability to the editor. As you move // around the editor, it updates with your current indention depth. @@ -86,7 +86,7 @@ dojo.declare("dojox.editor.plugins.Breadcrumb", _Plugin,{ }); // Build the menu - this._menuTitle = new dojox.editor.plugins._BreadcrumbMenuTitle({menuTitle: strings.nodeActions}); + this._menuTitle = new BreadcrumbMenuTitle({menuTitle: strings.nodeActions}); this._selCMenu = new dijit.MenuItem({label: strings.selectContents, onClick: dojo.hitch(this, this._selectContents)}); this._delCMenu = new dijit.MenuItem({label: strings.deleteContents, onClick: dojo.hitch(this, this._deleteContents)}); this._selEMenu = new dijit.MenuItem({label: strings.selectElement, onClick: dojo.hitch(this, this._selectElement)}); @@ -338,15 +338,18 @@ dojo.declare("dojox.editor.plugins.Breadcrumb", _Plugin,{ } }); +// For monkey patching +Breadcrumb._BreadcrumbMenuTitle = BreadcrumbMenuTitle; + // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "breadcrumb"){ - o.plugin = new dojox.editor.plugins.Breadcrumb({}); + o.plugin = new Breadcrumb({}); } }); -return dojox.editor.plugins.Breadcrumb; +return Breadcrumb; }); diff --git a/editor/plugins/CollapsibleToolbar.js b/editor/plugins/CollapsibleToolbar.js index 17576cb53b..0a3698cb99 100644 --- a/editor/plugins/CollapsibleToolbar.js +++ b/editor/plugins/CollapsibleToolbar.js @@ -13,7 +13,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/CollapsibleToolbar" ], function(dojo, dijit, dojox, _Widget, _TemplatedMixin, _Plugin) { -dojo.declare("dojox.editor.plugins._CollapsibleToolbarButton", [_Widget, _TemplatedMixin], { +var CollapsibleToolbarButton = dojo.declare("dojox.editor.plugins._CollapsibleToolbarButton", [_Widget, _TemplatedMixin], { // summary: // Simple internal widget for representing a clickable button for expand/collapse // with A11Y support. @@ -45,8 +45,7 @@ dojo.declare("dojox.editor.plugins._CollapsibleToolbarButton", [_Widget, _Templa } }); - -dojo.declare("dojox.editor.plugins.CollapsibleToolbar", _Plugin, { +var CollapsibleToolbar = dojo.declare("dojox.editor.plugins.CollapsibleToolbar", _Plugin, { // summary: // This plugin provides a weappable toolbar container to allow expand/collapse // of the editor toolbars. This plugin should be registered first in most cases to @@ -84,14 +83,14 @@ dojo.declare("dojox.editor.plugins.CollapsibleToolbar", _Plugin, { var menuTd = dojo.create("td", {style: { width: "100%" }, tabindex: -1}, row); var m = dojo.create("span", {style: { width: "100%" }, tabindex: -1}, menuTd); - var collapseButton = new dojox.editor.plugins._CollapsibleToolbarButton({ + var collapseButton = new CollapsibleToolbarButton({ buttonClass: "dojoxCollapsibleToolbarCollapse", title: strings.collapse, text: "-", textClass: "dojoxCollapsibleToolbarCollapseText" }); dojo.place(collapseButton.domNode, openTd); - var expandButton = new dojox.editor.plugins._CollapsibleToolbarButton({ + var expandButton = new CollapsibleToolbarButton({ buttonClass: "dojoxCollapsibleToolbarExpand", title: strings.expand, text: "+", @@ -171,15 +170,18 @@ dojo.declare("dojox.editor.plugins.CollapsibleToolbar", _Plugin, { } }); +// For monkey patching +CollapsibleToolbar._CollapsibleToolbarButton = CollapsibleToolbarButton; + // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "collapsibletoolbar"){ - o.plugin = new dojox.editor.plugins.CollapsibleToolbar({}); + o.plugin = new CollapsibleToolbar({}); } }); -return dojox.editor.plugins.CollapsibleToolbar; +return CollapsibleToolbar; }); diff --git a/editor/plugins/EntityPalette.js b/editor/plugins/EntityPalette.js index 3b44e0fc82..bb488febcf 100755 --- a/editor/plugins/EntityPalette.js +++ b/editor/plugins/EntityPalette.js @@ -13,21 +13,12 @@ define([ dojo.experimental("dojox.editor.plugins.EntityPalette"); -dojo.declare("dojox.editor.plugins.EntityPalette", - [_Widget, _TemplatedMixin, _PaletteMixin], - { +var EntityPalette = dojo.declare("dojox.editor.plugins.EntityPalette", [_Widget, _TemplatedMixin, _PaletteMixin], { // summary: // A keyboard accessible HTML entity-picking widget (for inserting symbol characters) // description: // Grid showing various entities, so the user can pick a certain entity. // Can be used standalone, or as a popup. - // - // example: - // |
- // - // example: - // | var picker = new dojox.editor.plugins.EntityPalette({ },srcNode); - // | picker.startup(); // templateString: [protected] String // The basic template used to render the palette. @@ -197,7 +188,7 @@ dojo.declare("dojox.editor.plugins.EntityPalette", } }); -dojo.declare("dojox.editor.plugins.LatinEntity", +EntityPalette.LatinEntity = dojo.declare("dojox.editor.plugins.LatinEntity", null, { // summary: @@ -227,6 +218,6 @@ dojo.declare("dojox.editor.plugins.LatinEntity", } }); -return dojox.editor.plugins.EntityPalette; +return EntityPalette; }); diff --git a/editor/plugins/FindReplace.js b/editor/plugins/FindReplace.js index 93bcd5d156..c4107c12cf 100755 --- a/editor/plugins/FindReplace.js +++ b/editor/plugins/FindReplace.js @@ -17,7 +17,7 @@ define([ "dijit/form/Button", "dijit/form/DropDownButton", "dijit/form/ToggleButton", - "dojox/editor/plugins/ToolbarLineBreak", + "./ToolbarLineBreak", "dojo/_base/connect", "dojo/_base/declare", "dojo/i18n", @@ -29,7 +29,8 @@ define([ dojo.experimental("dojox.editor.plugins.FindReplace"); -dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { +var FindReplaceCloseBox = dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", + [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { // summary: // Base class for widgets that contains a button labeled X // to close the tool bar. @@ -58,7 +59,7 @@ dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [_Widget, _TemplatedMi }); -dojo.declare("dojox.editor.plugins._FindReplaceTextBox", +var FindReplaceTextBox = dojo.declare("dojox.editor.plugins._FindReplaceTextBox", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin],{ // summary: // Base class for widgets that contains a label (like "Font:") @@ -164,7 +165,7 @@ dojo.declare("dojox.editor.plugins._FindReplaceTextBox", }); -dojo.declare("dojox.editor.plugins._FindReplaceCheckBox", +var FindReplaceCheckBox = dojo.declare("dojox.editor.plugins._FindReplaceCheckBox", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin],{ // summary: // Base class for widgets that contains a label (like "Match case: ") @@ -245,7 +246,7 @@ dojo.declare("dojox.editor.plugins._FindReplaceCheckBox", }); -dojo.declare("dojox.editor.plugins._FindReplaceToolbar", Toolbar, { +var FindReplaceToolbar = dojo.declare("dojox.editor.plugins._FindReplaceToolbar", Toolbar, { // summary: // A toolbar that derived from dijit.Toolbar, which // eliminates some unnecessary event response such as LEFT_ARROW pressing @@ -276,7 +277,7 @@ dojo.declare("dojox.editor.plugins._FindReplaceToolbar", Toolbar, { } }); -dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ +var FindReplace = dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ // summary: // This plugin provides a Find/Replace capability for the editor. // Note that this plugin is NOT supported on Opera currently, as opera @@ -450,7 +451,7 @@ dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ // public this.inherited(arguments); if(!dojo.isOpera){ - var _tb = (this._frToolbar = new dojox.editor.plugins._FindReplaceToolbar()); + var _tb = (this._frToolbar = new FindReplaceToolbar()); dojo.style(_tb.domNode, "display", "none"); dojo.place(_tb.domNode, toolbar.domNode, "after"); _tb.startup(); @@ -458,15 +459,15 @@ dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ // IE6 will put the close box in a new line when its style is "float: right". // So place the close box ahead of the other fields, which makes it align with // the other components. - this._closeBox = new dojox.editor.plugins._FindReplaceCloseBox(); + this._closeBox = new FindReplaceCloseBox(); _tb.addChild(this._closeBox); // Define the search/replace fields. - this._findField = new dojox.editor.plugins._FindReplaceTextBox( + this._findField = new FindReplaceTextBox( {label: this._strings["findLabel"], tooltip: this._strings["findTooltip"]}); _tb.addChild(this._findField); - this._replaceField = new dojox.editor.plugins._FindReplaceTextBox( + this._replaceField = new FindReplaceTextBox( {label: this._strings["replaceLabel"], tooltip: this._strings["replaceTooltip"]}); _tb.addChild(this._replaceField); @@ -489,11 +490,11 @@ dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ _tb.addChild(this._replaceAllButton); // Define the option checkboxes. - this._caseSensitive = new dojox.editor.plugins._FindReplaceCheckBox( + this._caseSensitive = new FindReplaceCheckBox( {label: this._strings["matchCase"], tooltip: this._strings["matchCaseTooltip"]}); _tb.addChild(this._caseSensitive); - this._backwards = new dojox.editor.plugins._FindReplaceCheckBox( + this._backwards = new FindReplaceCheckBox( {label: this._strings["backwards"], tooltip: this._strings["backwardsTooltip"]}); _tb.addChild(this._backwards); @@ -841,16 +842,21 @@ dojo.declare("dojox.editor.plugins.FindReplace",[_Plugin],{ } }); +// For monkey patching +FindReplace._FindReplaceCloseBox = FindReplaceCloseBox; +FindReplace._FindReplaceTextBox = FindReplaceTextBox; +FindReplace._FindReplaceCheckBox = FindReplaceCheckBox; +FindReplace._FindReplaceToolbar = FindReplaceToolbar; // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "findreplace"){ - o.plugin = new dojox.editor.plugins.FindReplace({}); + o.plugin = new FindReplace({}); } }); -return dojox.editor.plugins.FindReplace; +return FindReplace; }); diff --git a/editor/plugins/InsertAnchor.js b/editor/plugins/InsertAnchor.js index a7f9cc1bdc..f77b5f654d 100755 --- a/editor/plugins/InsertAnchor.js +++ b/editor/plugins/InsertAnchor.js @@ -20,7 +20,7 @@ define([ "dojo/i18n!dijit/nls/common" ], function(dojo, dijit, dojox, _Plugin ) { -dojo.declare("dojox.editor.plugins.InsertAnchor", _Plugin, { +var InsertAnchor = dojo.declare("dojox.editor.plugins.InsertAnchor", _Plugin, { // summary: // This plugin provides the basis for an insert anchor dialog for the // dijit.Editor @@ -422,10 +422,10 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ var name = o.args.name; if(name) { name = name.toLowerCase(); } if(name === "insertanchor"){ - o.plugin = new dojox.editor.plugins.InsertAnchor(); + o.plugin = new InsertAnchor(); } }); -return dojox.editor.plugins.InsertAnchor; +return InsertAnchor; }); diff --git a/editor/plugins/InsertEntity.js b/editor/plugins/InsertEntity.js index 53f53e4273..c7eb4c0548 100755 --- a/editor/plugins/InsertEntity.js +++ b/editor/plugins/InsertEntity.js @@ -13,7 +13,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/InsertEntity" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.InsertEntity", _Plugin,{ +var InsertEntity = dojo.declare("dojox.editor.plugins.InsertEntity", _Plugin,{ // summary: // This plugin allows the user to select from standard Symbols (HTML Entities) // to insert at the current cursor position. It binds to the key pattern: @@ -96,12 +96,12 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name? o.args.name.toLowerCase() : ""; if(name === "insertentity"){ - o.plugin = new dojox.editor.plugins.InsertEntity({ + o.plugin = new InsertEntity({ showCode: ("showCode" in o.args)?o.args.showCode:false, showEntityName: ("showEntityName" in o.args)?o.args.showEntityName:false }); } }); -return dojox.editor.plugins.InsertEntity; +return InsertEntity; }); diff --git a/editor/plugins/NormalizeIndentOutdent.js b/editor/plugins/NormalizeIndentOutdent.js index c9f4d1550e..e7db50f967 100755 --- a/editor/plugins/NormalizeIndentOutdent.js +++ b/editor/plugins/NormalizeIndentOutdent.js @@ -6,7 +6,7 @@ define([ "dojo/_base/declare" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.NormalizeIndentOutdent", _Plugin, { +var NormalizeIndentOutdent = dojo.declare("dojox.editor.plugins.NormalizeIndentOutdent", _Plugin, { // summary: // This plugin provides improved indent and outdent handling to // the editor. It tries to generate valid HTML, as well as be @@ -854,7 +854,7 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "normalizeindentoutdent"){ - o.plugin = new dojox.editor.plugins.NormalizeIndentOutdent({ + o.plugin = new NormalizeIndentOutdent({ indentBy: ("indentBy" in o.args) ? (o.args.indentBy > 0 ? o.args.indentBy : 40) : 40, @@ -865,6 +865,6 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ } }); -return dojox.editor.plugins.NormalizeIndentOutdent; +return NormalizeIndentOutdent; }); diff --git a/editor/plugins/NormalizeStyle.js b/editor/plugins/NormalizeStyle.js index eb145db957..33e24900eb 100755 --- a/editor/plugins/NormalizeStyle.js +++ b/editor/plugins/NormalizeStyle.js @@ -8,7 +8,7 @@ define([ "dojo/_base/declare" ], function(dojo, dijit, dojox, _Plugin, editorHtml) { -dojo.declare("dojox.editor.plugins.NormalizeStyle", _Plugin,{ +var NormalizeStyle = dojo.declare("dojox.editor.plugins.NormalizeStyle", _Plugin,{ // summary: // This plugin provides NormalizeStyle capability to the editor. It is // a headless plugin that tries to normalize how content is styled when @@ -550,13 +550,13 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "normalizestyle"){ - o.plugin = new dojox.editor.plugins.NormalizeStyle({ + o.plugin = new NormalizeStyle({ mode: ("mode" in o.args)?o.args.mode:"semantic", condenseSpans: ("condenseSpans" in o.args)?o.args.condenseSpans:true }); } }); -return dojox.editor.plugins.NormalizeStyle; +return NormalizeStyle; }); diff --git a/editor/plugins/PageBreak.js b/editor/plugins/PageBreak.js index 5cefe217f3..a4405d25f3 100755 --- a/editor/plugins/PageBreak.js +++ b/editor/plugins/PageBreak.js @@ -10,7 +10,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/PageBreak" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.PageBreak", _Plugin, { +var PageBreak = dojo.declare("dojox.editor.plugins.PageBreak", _Plugin, { // summary: // This plugin provides a simple CSS page break plugin that // lets your insert browser print recognizable page breaks in @@ -164,10 +164,10 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "pagebreak"){ - o.plugin = new dojox.editor.plugins.PageBreak({}); + o.plugin = new PageBreak({}); } }); -return dojox.editor.plugins.PageBreak; +return PageBreak; }); diff --git a/editor/plugins/PrettyPrint.js b/editor/plugins/PrettyPrint.js index 0ea5ebe323..268cbafa71 100755 --- a/editor/plugins/PrettyPrint.js +++ b/editor/plugins/PrettyPrint.js @@ -8,7 +8,7 @@ define([ "dojox/html/format" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.PrettyPrint", _Plugin,{ +var PrettyPrint = dojo.declare("dojox.editor.plugins.PrettyPrint", _Plugin,{ // summary: // This plugin provides a mechanism by which to 'beautify HTML' // generated by the editor. It is by no means perfect. @@ -90,7 +90,7 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "prettyprint"){ - o.plugin = new dojox.editor.plugins.PrettyPrint({ + o.plugin = new PrettyPrint({ indentBy: ("indentBy" in o.args)?o.args.indentBy:-1, lineLength: ("lineLength" in o.args)?o.args.lineLength:-1, entityMap: ("entityMap" in o.args)?o.args.entityMap:dojox.html.entities.html.concat([ @@ -103,6 +103,6 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ } }); -return dojox.editor.plugins.PrettyPrint; +return PrettyPrint; }); diff --git a/editor/plugins/Preview.js b/editor/plugins/Preview.js index e02b57c3de..8ace90b212 100755 --- a/editor/plugins/Preview.js +++ b/editor/plugins/Preview.js @@ -10,7 +10,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/Preview" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.Preview", _Plugin, { +var Preview = dojo.declare("dojox.editor.plugins.Preview", _Plugin, { // summary: // This plugin provides Preview capability to the editor. When // clicked, the document in the editor frame will displayed in a separate @@ -94,13 +94,13 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "preview"){ - o.plugin = new dojox.editor.plugins.Preview({ + o.plugin = new Preview({ styles: ("styles" in o.args)?o.args.styles:"", stylesheets: ("stylesheets" in o.args)? o.args.stylesheets:null }); } }); -return dojox.editor.plugins.Preview; +return Preview; }); diff --git a/editor/plugins/ResizeTableColumn.js b/editor/plugins/ResizeTableColumn.js index 719dfe1f93..b8f18ca598 100644 --- a/editor/plugins/ResizeTableColumn.js +++ b/editor/plugins/ResizeTableColumn.js @@ -1,10 +1,13 @@ -dojo.provide("dojox.editor.plugins.ResizeTableColumn"); +define([ + "dojo", + "dijit", + "dojox", + "./TablePlugins" +], function(dojo, dijit, dojox, TablePlugins) { -dojo.require("dojox.editor.plugins.TablePlugins"); -dojo.declare("dojox.editor.plugins.ResizeTableColumn", dojox.editor.plugins.TablePlugins, { + var ResizeTableColumn = dojo.declare("dojox.editor.plugins.ResizeTableColumn", TablePlugins, { - constructor: function(){ // summary: // Because IE will ignore the cursor style when the editMode of the document is on, @@ -277,15 +280,18 @@ dojo.declare("dojox.editor.plugins.ResizeTableColumn", dojox.editor.plugins.Tabl } } } -}); + }); -dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ - if(o.plugin){ return; } - // make first character lower case - if(o.args && o.args.command){ - var cmd = o.args.command.charAt(0).toLowerCase() + o.args.command.substring(1, o.args.command.length); - if(cmd == "resizeTableColumn"){ - o.plugin = new dojox.editor.plugins.ResizeTableColumn({commandName: cmd}); + dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ + if(o.plugin){ return; } + // make first character lower case + if(o.args && o.args.command){ + var cmd = o.args.command.charAt(0).toLowerCase() + o.args.command.substring(1, o.args.command.length); + if(cmd == "resizeTableColumn"){ + o.plugin = new ResizeTableColumn({commandName: cmd}); + } } - } -}); + }); + + return ResizeTableColumn; +}); \ No newline at end of file diff --git a/editor/plugins/SafePaste.js b/editor/plugins/SafePaste.js index d1acea2faf..4eb105c37d 100644 --- a/editor/plugins/SafePaste.js +++ b/editor/plugins/SafePaste.js @@ -13,7 +13,7 @@ define([ "dojo/i18n!dijit/_editor/nls/commands" ], function(dojo, dijit, dojox, PasteFromWord) { -dojo.declare("dojox.editor.plugins.SafePaste", [PasteFromWord],{ +var SafePaste = dojo.declare("dojox.editor.plugins.SafePaste", [PasteFromWord],{ // summary: // This plugin extends from the PasteFromWord plugin and provides // 'safe pasting', meaning that it will not allow keyboard/menu pasting @@ -102,7 +102,7 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "safepaste"){ - o.plugin = new dojox.editor.plugins.SafePaste({ + o.plugin = new SafePaste({ width: (o.args.hasOwnProperty("width"))?o.args.width:"400px", height: (o.args.hasOwnProperty("height"))?o.args.width:"300px", stripTags: (o.args.hasOwnProperty("stripTags"))?o.args.stripTags:null @@ -110,6 +110,6 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ } }); -return dojox.editor.plugins.SafePaste; +return SafePaste; }); diff --git a/editor/plugins/Save.js b/editor/plugins/Save.js index 1b60bc0bfb..2edfff36e2 100755 --- a/editor/plugins/Save.js +++ b/editor/plugins/Save.js @@ -10,7 +10,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/Save" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.Save", _Plugin, { +var Save = dojo.declare("dojox.editor.plugins.Save", _Plugin, { // summary: // This plugin provides Save capability to the editor. When // clicked, the document in the editor frame will be posted to the URL @@ -132,13 +132,13 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "save"){ - o.plugin = new dojox.editor.plugins.Save({ + o.plugin = new Save({ url: ("url" in o.args)?o.args.url:"", logResults: ("logResults" in o.args)?o.args.logResults:true }); } }); -return dojox.editor.plugins.Save; +return Save; }); diff --git a/editor/plugins/ShowBlockNodes.js b/editor/plugins/ShowBlockNodes.js index bd684c2fd8..8fc5a6bcb2 100755 --- a/editor/plugins/ShowBlockNodes.js +++ b/editor/plugins/ShowBlockNodes.js @@ -11,7 +11,7 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/ShowBlockNodes" ], function(dojo, dijit, dojox, _Plugin) { -dojo.declare("dojox.editor.plugins.ShowBlockNodes", _Plugin, { +var ShowBlockNodes = dojo.declare("dojox.editor.plugins.ShowBlockNodes", _Plugin, { // summary: // This plugin provides ShowBlockNodes capability to the editor. When // clicked, the document in the editor will apply a class to specific @@ -177,10 +177,10 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "showblocknodes"){ - o.plugin = new dojox.editor.plugins.ShowBlockNodes(); + o.plugin = new ShowBlockNodes(); } }); -return dojox.editor.plugins.ShowBlockNodes; +return ShowBlockNodes; }); diff --git a/editor/plugins/Smiley.js b/editor/plugins/Smiley.js index b7cfd6c791..fbcf7a0aa6 100644 --- a/editor/plugins/Smiley.js +++ b/editor/plugins/Smiley.js @@ -14,7 +14,7 @@ define([ dojo.experimental("dojox.editor.plugins.Smiley"); -dojo.declare("dojox.editor.plugins.Smiley", _Plugin, { +var Smiley = dojo.declare("dojox.editor.plugins.Smiley", _Plugin, { // summary: // This plugin allows the user to select from emoticons or "smileys" // to insert at the current cursor position. @@ -148,10 +148,10 @@ dojo.declare("dojox.editor.plugins.Smiley", _Plugin, { dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } if(o.args.name === "smiley"){ - o.plugin = new dojox.editor.plugins.Smiley(); + o.plugin = new Smiley(); } }); -return dojox.editor.plugins.Smiley; +return Smiley; }); diff --git a/editor/plugins/SpellCheck.js b/editor/plugins/SpellCheck.js index 60f64eb01a..b2be1b09e9 100644 --- a/editor/plugins/SpellCheck.js +++ b/editor/plugins/SpellCheck.js @@ -1,20 +1,22 @@ -dojo.provide("dojox.editor.plugins.SpellCheck"); - -dojo.require("dijit._base.popup"); -dojo.require("dijit._Widget"); -dojo.require("dijit._Templated"); -dojo.require("dijit.form.TextBox"); -dojo.require("dijit.form.DropDownButton"); -dojo.require("dijit.TooltipDialog"); -dojo.require("dijit.form.MultiSelect"); -dojo.require("dojo.io.script"); -dojo.require("dijit.Menu"); - -dojo.requireLocalization("dojox.editor.plugins", "SpellCheck"); +define([ + "dojo", + "dijit", + "dojo/io/script", + "dijit/popup", + "dijit/_Widget", + "dijit/_Templated", + "dijit/_editor/_Plugin", + "dijit/form/TextBox", + "dijit/form/DropDownButton", + "dijit/TooltipDialog", + "dijit/form/MultiSelect", + "dijit/Menu", + "dojo/i18n!dojox/editor/plugins/nls/SpellCheck" +], function(dojo, dijit, script, popup, _Widget, _Templated, _Plugin){ dojo.experimental("dojox.editor.plugins.SpellCheck"); -dojo.declare("dojox.editor.plugins._spellCheckControl", [dijit._Widget, dijit._Templated], { +var SpellCheckControl = dojo.declare("dojox.editor.plugins._spellCheckControl", [_Widget, _Templated], { // summary: // The widget that is used for the UI of the batch spelling check @@ -273,13 +275,12 @@ dojo.declare("dojox.editor.plugins._spellCheckControl", [dijit._Widget, dijit._T // Set the visibility of the progress icon // tags: // private - var id = this.id + "_progressIcon", - cmd = show ? "removeClass" : "addClass"; - dojo[cmd](id, "hidden"); + var id = this.id + "_progressIcon"; + dojo.toggleClass(id, "hidden", !show); } }); -dojo.declare("dojox.editor.plugins._SpellCheckScriptMultiPart", null, { +var SpellCheckScriptMultiPart = dojo.declare("dojox.editor.plugins._SpellCheckScriptMultiPart", null, { // summary: // It is a base network service component. It transfers text to a remote service port // with cross domain ability enabled. It can split text into specified pieces and send @@ -466,7 +467,7 @@ dojo.declare("dojox.editor.plugins._SpellCheckScriptMultiPart", null, { } }); -dojo.declare("dojox.editor.plugins.SpellCheck", [dijit._editor._Plugin], { +var SpellCheck = dojo.declare("dojox.editor.plugins.SpellCheck", [_Plugin], { // summary: // This plugin provides a spelling check capability for the editor. @@ -577,7 +578,7 @@ dojo.declare("dojox.editor.plugins.SpellCheck", [dijit._editor._Plugin], { strings = (this._strings = dojo.i18n.getLocalization("dojox.editor.plugins", "SpellCheck")), dialogPane = (this._dialog = new dijit.TooltipDialog()); - dialogPane.set("content", (this._dialogContent = new dojox.editor.plugins._spellCheckControl({ + dialogPane.set("content", (this._dialogContent = new SpellCheckControl({ unfound: strings["unfound"], skip: strings["skip"], skipAll: strings["skipAll"], @@ -607,7 +608,7 @@ dojo.declare("dojox.editor.plugins.SpellCheck", [dijit._editor._Plugin], { } } if(this._opened){ - dijit.popup.close(this.dropDown); + popup.close(this.dropDown); if(focus){ this.focus(); } this._opened = false; this.state = ""; @@ -628,7 +629,7 @@ dojo.declare("dojox.editor.plugins.SpellCheck", [dijit._editor._Plugin], { var comms = this.exArgs; if(!this._service){ - var service = (this._service = new dojox.editor.plugins._SpellCheckScriptMultiPart()); + var service = (this._service = new SpellCheckScriptMultiPart()); service.serviceEndPoint = this.url; service.maxBufferLength = this.bufferLength; service.setWaitingTime(this.timeout); @@ -1392,12 +1393,16 @@ dojo.declare("dojox.editor.plugins.SpellCheck", [dijit._editor._Plugin], { } }); +// For monkey patching +SpellCheck._SpellCheckControl = SpellCheckControl; +SpellCheck._SpellCheckScriptMultiPart = SpellCheckScriptMultiPart; + // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "spellcheck"){ - o.plugin = new dojox.editor.plugins.SpellCheck({ + o.plugin = new SpellCheck({ url: ("url" in o.args) ? o.args.url : "", interactive: ("interactive" in o.args) ? o.args.interactive : false, bufferLength: ("bufferLength" in o.args) ? o.args.bufferLength: 100, @@ -1406,3 +1411,7 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ }); } }); + +return SpellCheck; + +}); diff --git a/editor/plugins/StatusBar.js b/editor/plugins/StatusBar.js index d598afb1b2..68fffaa336 100755 --- a/editor/plugins/StatusBar.js +++ b/editor/plugins/StatusBar.js @@ -11,7 +11,8 @@ define([ ], function(dojo, dijit, dojox, _Widget, _TemplatedMixin, _Plugin) { dojo.experimental("dojox.editor.plugins.StatusBar"); -dojo.declare("dojox.editor.plugins._StatusBar", [_Widget, _TemplatedMixin],{ + +var _StatusBar = dojo.declare("dojox.editor.plugins._StatusBar", [_Widget, _TemplatedMixin],{ // templateString: String // Template for the widget. Currently using table to get the alignment behavior and // bordering I wanted. Would prefer not to use table, though. @@ -50,7 +51,7 @@ dojo.declare("dojox.editor.plugins._StatusBar", [_Widget, _TemplatedMixin],{ } }); -dojo.declare("dojox.editor.plugins.StatusBar", _Plugin, { +var StatusBar = dojo.declare("dojox.editor.plugins.StatusBar", _Plugin, { // summary: // This plugin provides StatusBar capability to the editor. // Basically a footer bar where status can be published. It also @@ -73,7 +74,7 @@ dojo.declare("dojox.editor.plugins.StatusBar", _Plugin, { // editor: Object // The editor to configure for this plugin to use. this.editor = editor; - this.statusBar = new dojox.editor.plugins._StatusBar(); + this.statusBar = new _StatusBar(); if(this.resizer){ this.resizeHandle = new dojox.layout.ResizeHandle({targetId: this.editor, activeResize: true}, this.statusBar.handle); this.resizeHandle.startup(); @@ -165,16 +166,19 @@ dojo.declare("dojox.editor.plugins.StatusBar", _Plugin, { } }); +// For monkey patching +StatusBar._StatusBar = _StatusBar; + // Register this plugin. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ if(o.plugin){ return; } var name = o.args.name.toLowerCase(); if(name === "statusbar"){ var resizer = ("resizer" in o.args)?o.args.resizer:true; - o.plugin = new dojox.editor.plugins.StatusBar({resizer: resizer}); + o.plugin = new StatusBar({resizer: resizer}); } }); -return dojox.editor.plugins.StatusBar; +return StatusBar; }); diff --git a/editor/plugins/TablePlugins.js b/editor/plugins/TablePlugins.js index 8b3c41d59e..33fc0ab579 100644 --- a/editor/plugins/TablePlugins.js +++ b/editor/plugins/TablePlugins.js @@ -49,20 +49,7 @@ define([ ) { dojo.experimental("dojox.editor.plugins.TablePlugins"); -// summary: -// A series of plugins that give the Editor the ability to create and edit -// HTML tables. See the end of this document for all available plugins -// and dojox/editorPlugins/tests/editorTablePlugs.html for an example -// -// example: -// |
-// | Editor text is here -// |
-// + // TODO: // Currently not supporting merging or splitting cells // @@ -813,11 +800,81 @@ var TableContextMenu = declare(TablePlugins, { } }); +var EditorTableDialog = declare("dojox.editor.plugins.EditorTableDialog", [Dialog, _TemplatedMixin, _WidgetsInTemplateMixin], { + // summary: + // Dialog box with options for table creation + + baseClass:"EditorTableDialog", + + templateString: insertTableTemplate, + + postMixInProperties: function(){ + dojo.mixin(this, tableDialogStrings); + this.inherited(arguments); + }, + + postCreate: function(){ + dojo.addClass(this.domNode, this.baseClass); //FIXME - why isn't Dialog accepting the baseClass? + this.inherited(arguments); + }, + + onInsert: function(){ + console.log("insert"); + + var rows = this.selectRow.get("value") || 1, + cols = this.selectCol.get("value") || 1, + width = this.selectWidth.get("value"), + widthType = this.selectWidthType.get("value"), + border = this.selectBorder.get("value"), + pad = this.selectPad.get("value"), + space = this.selectSpace.get("value"), + _id = "tbl_"+(new Date().getTime()), + t = '\n'; + + for(var r=0;r \n'; + } + t += '\t\n'; + } + t += '

'; + + //console.log(t); + this.onBuildTable({htmlText:t, id:_id}); + var cl = dojo.connect(this, "onHide", function(){ + dojo.disconnect(cl); + var self = this; + setTimeout(function(){ + self.destroyRecursive(); + }, 10); + }); + this.hide(); + }, + + onCancel: function(){ + // summary: + // Function to clean up memory so that the dialog is destroyed + // when closed. + var c = dojo.connect(this, "onHide", function(){ + dojo.disconnect(c); + var self = this; + setTimeout(function(){ + self.destroyRecursive(); + }, 10); + }); + }, + + onBuildTable: function(tableText){ + //stub + } +}); + var InsertTable = declare("dojox.editor.plugins.InsertTable", TablePlugins, { alwaysAvailable: true, modTable: function(){ - var w = new dojox.editor.plugins.EditorTableDialog({}); + var w = new EditorTableDialog({}); w.show(); var c = dojo.connect(w, "onBuildTable", this, function(obj){ dojo.disconnect(c); @@ -833,6 +890,137 @@ var InsertTable = declare("dojox.editor.plugins.InsertTable", TablePlugins, { } }); +var EditorModifyTableDialog = declare([Dialog, _TemplatedMixin, _WidgetsInTemplateMixin], { + + // summary: + // Dialog box with options for editing a table + // + + baseClass:"EditorTableDialog", + + table:null, //html table to be modified + tableAtts:{}, + templateString: modifyTableTemplate, + + postMixInProperties: function(){ + dojo.mixin(this, tableDialogStrings); + this.inherited(arguments); + }, + + postCreate: function(){ + dojo.addClass(this.domNode, this.baseClass); //FIXME - why isn't Dialog accepting the baseClass? + this.inherited(arguments); + var w1 = new this.colorPicker({params: this.params}); + this.connect(w1, "onChange", function(color){ + if(!this._started){ return; } // not during startup() + dijit.popup.close(w1); + this.setBrdColor(color); + }); + this.connect(w1, "onBlur", function(){ + dijit.popup.close(w1); + }); + this.connect(this.borderCol, "click", function(){ + w1.set('value', this.brdColor, false); + dijit.popup.open({popup:w1, around:this.borderCol}); + w1.focus(); + }); + var w2 = new this.colorPicker({params: this.params}); + + this.connect(w2, "onChange", function(color){ + if(!this._started){ return; } // not during startup() + dijit.popup.close(w2); + this.setBkColor(color); + }); + this.connect(w2, "onBlur", function(){ + dijit.popup.close(w2); + }); + this.connect(this.backgroundCol, "click", function(){ + w2.set('value', this.bkColor, false); + dijit.popup.open({popup:w2, around:this.backgroundCol}); + w2.focus(); + }); + this.own(w1, w2); + this.pickers = [ w1, w2 ]; + + this.setBrdColor(domStyle.get(this.table, "borderColor")); + this.setBkColor(domStyle.get(this.table, "backgroundColor")); + var w = domAttr.get(this.table, "width"); + if(!w){ + w = this.table.style.width; + } + var p = "pixels"; + if(dojo.isString(w) && w.indexOf("%")>-1){ + p = "percent"; + w = w.replace(/%/, ""); + } + + if(w){ + this.selectWidth.set("value", w); + this.selectWidthType.set("value", p); + }else{ + this.selectWidth.set("value", ""); + this.selectWidthType.set("value", "percent"); + } + + this.selectBorder.set("value", domAttr.get(this.table, "border")); + this.selectPad.set("value", domAttr.get(this.table, "cellPadding")); + this.selectSpace.set("value", domAttr.get(this.table, "cellSpacing")); + this.selectAlign.set("value", domAttr.get(this.table, "align")); + }, + startup: function() { + array.forEach(this.pickers, function(picker){ picker.startup(); }); + this.inherited(arguments); + }, + + setBrdColor: function(color){ + this.brdColor = color; + domStyle.set(this.borderCol, "backgroundColor", color); + }, + + setBkColor: function(color){ + this.bkColor = color; + domStyle.set(this.backgroundCol, "backgroundColor", color); + }, + onSet: function(){ + domStyle.set(this.table, "borderColor", this.brdColor); + domStyle.set(this.table, "backgroundColor", this.bkColor); + if(this.selectWidth.get("value")){ + // Just in case, remove it from style since we're setting it as a table attribute. + domStyle.set(this.table, "width", ""); + domAttr.set(this.table, "width", (this.selectWidth.get("value") + ((this.selectWidthType.get("value")=="pixels")?"":"%") )); + } + domAttr.set(this.table, "border", this.selectBorder.get("value")); + domAttr.set(this.table, "cellPadding", this.selectPad.get("value")); + domAttr.set(this.table, "cellSpacing", this.selectSpace.get("value")); + domAttr.set(this.table, "align", this.selectAlign.get("value")); + var c = dojo.connect(this, "onHide", function(){ + dojo.disconnect(c); + var self = this; + setTimeout(function(){ + self.destroyRecursive(); + }, 10); + }); + this.hide(); + }, + + onCancel: function(){ + // summary: + // Function to clean up memory so that the dialog is destroyed + // when closed. + var c = dojo.connect(this, "onHide", function(){ + dojo.disconnect(c); + var self = this; + setTimeout(function(){ + self.destroyRecursive(); + }, 10); + }); + }, + + onSetTable: function(tableText){ + //stub + } +}); + var ModifyTable = declare("dojox.editor.plugins.ModifyTable", TablePlugins, { // colorPicker: Constructor // The color picker dijit to use, defaults to dijit/form/ColorPalette @@ -1044,207 +1232,6 @@ var ColorTableCell = declare("dojox.editor.plugins.ColorTableCell", TablePlugins } }); -declare("dojox.editor.plugins.EditorTableDialog", [Dialog, _TemplatedMixin, _WidgetsInTemplateMixin], { - // summary: - // Dialog box with options for table creation - - baseClass:"EditorTableDialog", - - templateString: insertTableTemplate, - - postMixInProperties: function(){ - dojo.mixin(this, tableDialogStrings); - this.inherited(arguments); - }, - - postCreate: function(){ - dojo.addClass(this.domNode, this.baseClass); //FIXME - why isn't Dialog accepting the baseClass? - this.inherited(arguments); - }, - - onInsert: function(){ - console.log("insert"); - - var rows = this.selectRow.get("value") || 1, - cols = this.selectCol.get("value") || 1, - width = this.selectWidth.get("value"), - widthType = this.selectWidthType.get("value"), - border = this.selectBorder.get("value"), - pad = this.selectPad.get("value"), - space = this.selectSpace.get("value"), - _id = "tbl_"+(new Date().getTime()), - t = '\n'; - - for(var r=0;r \n'; - } - t += '\t\n'; - } - t += '

'; - - //console.log(t); - this.onBuildTable({htmlText:t, id:_id}); - var cl = dojo.connect(this, "onHide", function(){ - dojo.disconnect(cl); - var self = this; - setTimeout(function(){ - self.destroyRecursive(); - }, 10); - }); - this.hide(); - }, - - onCancel: function(){ - // summary: - // Function to clean up memory so that the dialog is destroyed - // when closed. - var c = dojo.connect(this, "onHide", function(){ - dojo.disconnect(c); - var self = this; - setTimeout(function(){ - self.destroyRecursive(); - }, 10); - }); - }, - - onBuildTable: function(tableText){ - //stub - } -}); - -var EditorModifyTableDialog = declare([Dialog, _TemplatedMixin, _WidgetsInTemplateMixin], { - - // summary: - // Dialog box with options for editing a table - // - - baseClass:"EditorTableDialog", - - table:null, //html table to be modified - tableAtts:{}, - templateString: modifyTableTemplate, - - postMixInProperties: function(){ - dojo.mixin(this, tableDialogStrings); - this.inherited(arguments); - }, - - postCreate: function(){ - dojo.addClass(this.domNode, this.baseClass); //FIXME - why isn't Dialog accepting the baseClass? - this.inherited(arguments); - var w1 = new this.colorPicker({params: this.params}); - this.connect(w1, "onChange", function(color){ - if(!this._started){ return; } // not during startup() - dijit.popup.close(w1); - this.setBrdColor(color); - }); - this.connect(w1, "onBlur", function(){ - dijit.popup.close(w1); - }); - this.connect(this.borderCol, "click", function(){ - w1.set('value', this.brdColor, false); - dijit.popup.open({popup:w1, around:this.borderCol}); - w1.focus(); - }); - var w2 = new this.colorPicker({params: this.params}); - - this.connect(w2, "onChange", function(color){ - if(!this._started){ return; } // not during startup() - dijit.popup.close(w2); - this.setBkColor(color); - }); - this.connect(w2, "onBlur", function(){ - dijit.popup.close(w2); - }); - this.connect(this.backgroundCol, "click", function(){ - w2.set('value', this.bkColor, false); - dijit.popup.open({popup:w2, around:this.backgroundCol}); - w2.focus(); - }); - this.own(w1, w2); - this.pickers = [ w1, w2 ]; - - this.setBrdColor(domStyle.get(this.table, "borderColor")); - this.setBkColor(domStyle.get(this.table, "backgroundColor")); - var w = domAttr.get(this.table, "width"); - if(!w){ - w = this.table.style.width; - } - var p = "pixels"; - if(dojo.isString(w) && w.indexOf("%")>-1){ - p = "percent"; - w = w.replace(/%/, ""); - } - - if(w){ - this.selectWidth.set("value", w); - this.selectWidthType.set("value", p); - }else{ - this.selectWidth.set("value", ""); - this.selectWidthType.set("value", "percent"); - } - - this.selectBorder.set("value", domAttr.get(this.table, "border")); - this.selectPad.set("value", domAttr.get(this.table, "cellPadding")); - this.selectSpace.set("value", domAttr.get(this.table, "cellSpacing")); - this.selectAlign.set("value", domAttr.get(this.table, "align")); - }, - startup: function() { - array.forEach(this.pickers, function(picker){ picker.startup(); }); - this.inherited(arguments); - }, - - setBrdColor: function(color){ - this.brdColor = color; - domStyle.set(this.borderCol, "backgroundColor", color); - }, - - setBkColor: function(color){ - this.bkColor = color; - domStyle.set(this.backgroundCol, "backgroundColor", color); - }, - onSet: function(){ - domStyle.set(this.table, "borderColor", this.brdColor); - domStyle.set(this.table, "backgroundColor", this.bkColor); - if(this.selectWidth.get("value")){ - // Just in case, remove it from style since we're setting it as a table attribute. - domStyle.set(this.table, "width", ""); - domAttr.set(this.table, "width", (this.selectWidth.get("value") + ((this.selectWidthType.get("value")=="pixels")?"":"%") )); - } - domAttr.set(this.table, "border", this.selectBorder.get("value")); - domAttr.set(this.table, "cellPadding", this.selectPad.get("value")); - domAttr.set(this.table, "cellSpacing", this.selectSpace.get("value")); - domAttr.set(this.table, "align", this.selectAlign.get("value")); - var c = dojo.connect(this, "onHide", function(){ - dojo.disconnect(c); - var self = this; - setTimeout(function(){ - self.destroyRecursive(); - }, 10); - }); - this.hide(); - }, - - onCancel: function(){ - // summary: - // Function to clean up memory so that the dialog is destroyed - // when closed. - var c = dojo.connect(this, "onHide", function(){ - dojo.disconnect(c); - var self = this; - setTimeout(function(){ - self.destroyRecursive(); - }, 10); - }); - }, - - onSetTable: function(tableText){ - //stub - } -}); - // Register these plugins. function registerGeneric(args) { return new TablePlugins(args); diff --git a/editor/plugins/TextColor.js b/editor/plugins/TextColor.js index 25c1be6534..7172e59b0e 100755 --- a/editor/plugins/TextColor.js +++ b/editor/plugins/TextColor.js @@ -18,7 +18,8 @@ define([ ], function(dojo, dijit, dojox, popup, _Widget, _TemplatedMixin, _WidgetsInTemplateMixin, _Plugin) { dojo.experimental("dojox.editor.plugins.TextColor"); -dojo.declare("dojox.editor.plugins._TextColorDropDown", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { + +var TextColorDropDown = dojo.declare("dojox.editor.plugins._TextColorDropDown", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin], { // summary: // A sample widget that uses/creates a dropdown with a dojox.widget.ColorPicker. Also provides // passthroughs to the value of the color picker and convenient hook points. @@ -98,7 +99,7 @@ dojo.declare("dojox.editor.plugins._TextColorDropDown", [_Widget, _TemplatedMixi }); -dojo.declare("dojox.editor.plugins.TextColor", _Plugin, { +var TextColor = dojo.declare("dojox.editor.plugins.TextColor", _Plugin, { // summary: // This plugin provides dropdown color pickers for setting text color and background color // and makes use of the nicer-looking (though not entirely accessible), dojox.widget.ColorPicker. @@ -116,7 +117,7 @@ dojo.declare("dojox.editor.plugins.TextColor", _Plugin, { useDefaultCommand: false, constructor: function(){ - this._picker = new dojox.editor.plugins._TextColorDropDown(); + this._picker = new TextColorDropDown(); dojo.body().appendChild(this._picker.domNode); this._picker.startup(); this.dropDown = this._picker.dialog; @@ -189,6 +190,9 @@ dojo.declare("dojox.editor.plugins.TextColor", _Plugin, { } }); +// For monkey-patching +TextColor._TextColorDropDown = TextColorDropDown; + // Register this plugin. Uses the same name as the dijit one, so you // use one or the other, not both. dojo.subscribe(dijit._scopeName + ".Editor.getPlugin", null, function(o){ @@ -198,12 +202,12 @@ dojo.subscribe(dijit._scopeName + ".Editor.getPlugin", null, function(o){ switch(o.args.name){ case "foreColor": case "hiliteColor": - o.plugin = new dojox.editor.plugins.TextColor({ + o.plugin = new TextColor({ command: o.args.name }); } }); -return dojox.editor.plugins.TextColor; +return TextColor; }); diff --git a/editor/plugins/UploadImage.js b/editor/plugins/UploadImage.js index 2a082c58d7..3f76f27bd9 100644 --- a/editor/plugins/UploadImage.js +++ b/editor/plugins/UploadImage.js @@ -9,11 +9,9 @@ define([ "dijit/_editor/_Plugin" ], function(dojo, dijit, dojox, _Plugin) { -dojo.experimental("dojox.editor.plugins.UploadImage"); + dojo.experimental("dojox.editor.plugins.UploadImage"); -dojo.declare("dojox.editor.plugins.UploadImage", - _Plugin, - { + var UploadImage = dojo.declare("dojox.editor.plugins.UploadImage", _Plugin, { // summary: // Adds an icon to the Editor toolbar that when clicked, opens a system dialog // Although the toolbar icon is a tiny "image" the uploader could be used for @@ -97,18 +95,15 @@ dojo.declare("dojox.editor.plugins.UploadImage", var iTxt = ''; this.editor.execCommand('inserthtml', iTxt); } - - } -); - -dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ - if(o.plugin){ return; } - switch(o.args.name){ - case "uploadImage": - o.plugin = new dojox.editor.plugins.UploadImage({url: o.args.url}); - } -}); + }); -return dojox.editor.plugins.UploadImage; + dojo.subscribe(dijit._scopeName + ".Editor.getPlugin",null,function(o){ + if(o.plugin){ return; } + switch(o.args.name){ + case "uploadImage": + o.plugin = new UploadImage({url: o.args.url}); + } + }); + return UploadImage; }); diff --git a/editor/plugins/_SmileyPalette.js b/editor/plugins/_SmileyPalette.js index 78fc11d018..53281f8101 100644 --- a/editor/plugins/_SmileyPalette.js +++ b/editor/plugins/_SmileyPalette.js @@ -11,138 +11,133 @@ define([ "dojo/i18n!dojox/editor/plugins/nls/Smiley" ], function(dojo, dijit, dojox, _Widget, _TemplatedMixin, _PaletteMixin) { -dojo.experimental("dojox.editor.plugins._SmileyPalette"); - -dojo.declare("dojox.editor.plugins._SmileyPalette", - [_Widget, _TemplatedMixin, _PaletteMixin], - { - // summary: - // A keyboard accessible emoticon-picking widget (for inserting smiley characters) - // description: - // Grid showing various emoticons. - // Can be used standalone, or as a popup. - // example: - // |
- // example: - // | var picker = new dojox.editor.plugins._SmileyPalette({ },srcNode); - // | picker.startup(); - - // templateString: - // The template of this widget. - templateString: - '
', - - baseClass: "dijitEditorSmileyPalette", - - _palette: [ + dojo.experimental("dojox.editor.plugins._SmileyPalette"); + + var Emoticon = dojo.declare("dojox.editor.plugins.Emoticon", + null, + { + // summary: + // JS Object representing an emoticon + + constructor: function(/*String*/ id){ + // summary: + // Create emoticon object from an id (like "smile") + // value: String + // alias name 'smile', 'cool' .. + this.id = id; + }, + + getValue: function(){ + // summary: + // Returns a emoticon string in ascii representation, ex: :-) + return Emoticon.ascii[this.id]; + }, + + imgHtml: function(/*String*/ clazz){ + // summary: + // Return the HTML string for an `` node that shows this smiley + var eId = "emoticon" + this.id.substr(0,1).toUpperCase() + this.id.substr(1), + src = dojo.moduleUrl("dojox.editor.plugins", "resources/emoticons/" + eId + ".gif"), + label = dojo.i18n.getLocalization("dojox.editor.plugins", "Smiley")[eId], + html = ['\"',']; + return html.join(""); + }, + + fillCell: function(/*DOMNode*/cell, /*String*/ blankGif){ + dojo.place(this.imgHtml("dijitPaletteImg"), cell); + } + }); + + Emoticon.ascii = { + smile: ":-)", + laughing: "lol", + wink: ";-)", + grin: ":-D", + cool: "8-)", + angry: ":-@", + half: ":-/", + eyebrow: "/:)", + frown: ":-(", + shy: ":-$", + goofy: ":-S", + oops: ":-O", + tongue: ":-P", + idea: "(i)", + yes: "(y)", + no: "(n)", + angel: "0:-)", + crying: ":'(", + happy: "=)" + }; + + Emoticon.fromAscii = function(/*String*/str){ + // summary: + // Factory to create Emoticon object based on string like ":-)" rather than id like "smile" + var ascii = Emoticon.ascii; + for(var i in ascii){ + if(str == ascii[i]){ + return new Emoticon(i); + } + } + return null; + }; + + var SmileyPalette = dojo.declare("dojox.editor.plugins._SmileyPalette", [_Widget, _TemplatedMixin, _PaletteMixin], { + // summary: + // A keyboard accessible emoticon-picking widget (for inserting smiley characters) + // description: + // Grid showing various emoticons. + // Can be used standalone, or as a popup. + + // templateString: + // The template of this widget. + templateString: + '
', + + baseClass: "dijitEditorSmileyPalette", + + _palette: [ ["smile", "laughing", "wink", "grin"], ["cool", "angry", "half", "eyebrow"], ["frown", "shy", "goofy", "oops"], ["tongue", "idea", "angel", "happy"], ["yes", "no", "crying", ""] - ], + ], - dyeClass: 'dojox.editor.plugins.Emoticon', + dyeClass: Emoticon, - buildRendering: function(){ - // Instantiate the template, which makes a skeleton into which we'll insert a bunch of - // nodes - this.inherited(arguments); + buildRendering: function(){ + // Instantiate the template, which makes a skeleton into which we'll insert a bunch of + // nodes + this.inherited(arguments); - var i18n = dojo.i18n.getLocalization("dojox.editor.plugins", "Smiley"); + var i18n = dojo.i18n.getLocalization("dojox.editor.plugins", "Smiley"); - // Generate hash from emoticon standard name (like "smile") to translation - var emoticonI18n = {}; - for(var name in i18n){ - if(name.substr(0,8) == "emoticon"){ - emoticonI18n[name.substr(8).toLowerCase()] = i18n[name]; + // Generate hash from emoticon standard name (like "smile") to translation + var emoticonI18n = {}; + for(var name in i18n){ + if(name.substr(0,8) == "emoticon"){ + emoticonI18n[name.substr(8).toLowerCase()] = i18n[name]; + } } + this._preparePalette( + this._palette, + emoticonI18n + ); } - this._preparePalette( - this._palette, - emoticonI18n - ); - } -}); - -dojo.declare("dojox.editor.plugins.Emoticon", - null, - { - // summary: - // JS Object representing an emoticon - - constructor: function(/*String*/ id){ - // summary: - // Create emoticon object from an id (like "smile") - // value: String - // alias name 'smile', 'cool' .. - this.id = id; - }, - - getValue: function(){ - // summary: - // Returns a emoticon string in ascii representation, ex: :-) - return dojox.editor.plugins.Emoticon.ascii[this.id]; - }, - - imgHtml: function(/*String*/ clazz){ - // summary: - // Return the HTML string for an `` node that shows this smiley - var eId = "emoticon" + this.id.substr(0,1).toUpperCase() + this.id.substr(1), - src = dojo.moduleUrl("dojox.editor.plugins", "resources/emoticons/" + eId + ".gif"), - label = dojo.i18n.getLocalization("dojox.editor.plugins", "Smiley")[eId], - html = ['\"',']; - return html.join(""); - }, - - fillCell: function(/*DOMNode*/cell, /*String*/ blankGif){ - dojo.place(this.imgHtml("dijitPaletteImg"), cell); - } -}); - -dojox.editor.plugins.Emoticon.ascii = { - smile: ":-)", - laughing: "lol", - wink: ";-)", - grin: ":-D", - cool: "8-)", - angry: ":-@", - half: ":-/", - eyebrow: "/:)", - frown: ":-(", - shy: ":-$", - goofy: ":-S", - oops: ":-O", - tongue: ":-P", - idea: "(i)", - yes: "(y)", - no: "(n)", - angel: "0:-)", - crying: ":'(", - happy: "=)" -}; - -dojox.editor.plugins.Emoticon.fromAscii = function(/*String*/str){ - // summary: - // Factory to create Emoticon object based on string like ":-)" rather than id like "smile" - var ascii = dojox.editor.plugins.Emoticon.ascii; - for(var i in ascii){ - if(str == ascii[i]){ - return new dojox.editor.plugins.Emoticon(i); - } - } - return null; -}; + }); -return dojox.editor.plugins._SmileyPalette; + // For monkey-patching + SmileyPalette.Emoticon = Emoticon; + return SmileyPalette; }); diff --git a/editor/plugins/_SpellCheckParser.js b/editor/plugins/_SpellCheckParser.js index 4dfd975878..aaf3eed14f 100644 --- a/editor/plugins/_SpellCheckParser.js +++ b/editor/plugins/_SpellCheckParser.js @@ -5,7 +5,7 @@ define([ "dojo/_base/declare" ], function(dojo, dojox) { -dojo.declare("dojox.editor.plugins._SpellCheckParser", null, { +var SpellCheckParser = dojo.declare("dojox.editor.plugins._SpellCheckParser", null, { lang: "english", parseIntoWords: function(/*String*/ text){ @@ -29,7 +29,7 @@ dojo.declare("dojox.editor.plugins._SpellCheckParser", null, { while(index < length){ var ch; - // Skip the white charactor and need to treat HTML entity respectively + // Skip the white character and need to treat HTML entity respectively while(index < length && !isCharExt(ch = text.charAt(index)) && ch != "&"){ index++; } if(ch == "&"){ // An HTML entity, skip it while(++index < length && (ch = text.charAt(index)) != ";" && isCharExt(ch)){} @@ -60,9 +60,9 @@ dojo.declare("dojox.editor.plugins._SpellCheckParser", null, { // Register this parser in the SpellCheck plugin. dojo.subscribe(dijit._scopeName + ".Editor.plugin.SpellCheck.getParser", null, function(sp){ if(sp.parser){ return; } - sp.parser = new dojox.editor.plugins._SpellCheckParser(); + sp.parser = new SpellCheckParser(); }); -return dojox.editor.plugins._SpellCheckParser; +return SpellCheckParser; }); \ No newline at end of file