show: function(){ // summary: // Display the setting dialog. If the internal interval value is "" // set it to zero // tags: // public if(this._value == ""){ this._value = 0; this.intBox.set("value", 0); }else{ this.intBox.set("value", this._value); } this.dialog.show(); dijit.selectInputText(this.intBox.focusNode); },
hide: function(){ // summray: // Hide the setting dialog. // tags: // public this.dialog.hide();
This plugin provides the auto save capability to the editor. The
plugin saves the content of the editor in interval. When
the save action is performed, the document in the editor frame
will be posted to the URL provided, or none, if none provided.
url [public] String
The URL to POST the content back to. Used by the save function.
var interval = this.interval = this._saveSettingDialog.get("value") * this._MIN; if(interval > 0){ this._setSaveInterval(interval); // Change the menu "Set Auto-Save Interval..." to "Turn off Auto-Save" // Connect it to another handler that terminates the auto-save. dojo.disconnect(this._menuItemAutoSaveClickHandler); this._menuItemAutoSave.set("label", this._strings["saveSettingLabelOff"]); this._menuItemAutoSaveClickHandler = dojo.connect(this._menuItemAutoSave, "onClick", this, "_onStopClick"); // Change the icon of the main button to auto-save style this.button.set("iconClass", this._iconClassPrefix + "Setting " + this._iconClassPrefix); }
summary
If the interval is set (larger than 0), enable auto-save.
this._clearSaveInterval(); // Change the menu "Turn off Auto-Save" to "Set Auto-Save Interval...". // Connect it to another handler that show the setting dialog. dojo.disconnect(this._menuItemAutoSaveClickHandler); this._menuItemAutoSave.set("label", this._strings["saveSettingLabelOn"]); this._menuItemAutoSaveClickHandler = dojo.connect(this._menuItemAutoSave, "onClick", this, "_showAutSaveSettingDialog"); // Change the icon of the main button this.button.set("iconClass", this._iconClassPrefix + "Default " + this._iconClassPrefix);
if(interval <= 0){ return; } this._clearSaveInterval(); this._intervalHandler = setInterval(dojo.hitch(this, function(){ if(!this._isWorking && !this.get("disabled")){ // If the plugin is not disabled (ViewSource, etc.) // and not working. Do saving! this._isWorking = true; this._save(); } }), interval);