Namespace | tinymce.plugins |
Class | AutoSave |
This plugin adds auto-save capability to the TinyMCE text editor to rescue content inadvertently lost. By using localStorage.
Public Methods
Method | Defined By |
---|---|
getExpDate():String : Returns an expiration date UTC string. | AutoSave |
getInfo():Object : Returns information about the plugin as a name/value array. | AutoSave |
hasDraft():boolean : This method will return true/false if there is a local storage draft available. | AutoSave |
init(ed:Editor, url:string):void : Initializes the plugin, this will be executed after the plugin has been created. | AutoSave |
removeDraft():void : Removes the currently stored draft. | AutoSave |
restoreDraft():void : This method will restore the contents from the storage engine back to the editor. | AutoSave |
setupStorage():void : This method will setup the storage engine. | AutoSave |
storeDraft():void : This method will store the current contents in the the storage engine. | AutoSave |
Public Events
Event | Defined By |
---|---|
onRemoveDraft(sender:AutoSave, draft:Object) : This event gets fired when a draft removed/expired. | AutoSave |
onStoreDraft(sender:AutoSave, draft:Object) : This event gets fired when a draft is stored to local storage. | AutoSave |
onStoreDraft(sender:AutoSave, draft:Object) : This event gets fired when a draft is restored from local storage. | AutoSave |
Method details
getExpDate
public function getExpDate():String
Returns an expiration date UTC string.
Returns
String - Expiration date UTC string.
getInfo
public function getInfo():Object
Returns information about the plugin as a name/value array. The current keys are longname, author, authorurl, infourl and version.
Returns
Object - Name/value array containing information about the plugin.
hasDraft
public function hasDraft():boolean
This method will return true/false if there is a local storage draft available.
Returns
boolean - true/false state if there is a local draft.
init
public function init(ed:Editor, url:string):void
Initializes the plugin, this will be executed after the plugin has been created. This call is done before the editor instance has finished it's initialization so use the onInit event of the editor instance to intercept that event.
Parameters
Param | Detail |
---|---|
ed:Editor | Editor instance that the plugin is initialized in. |
url:string | Absolute URL to where the plugin is located. |
removeDraft
public function removeDraft():void
Removes the currently stored draft.
restoreDraft
public function restoreDraft():void
This method will restore the contents from the storage engine back to the editor.
setupStorage
public function setupStorage():void
This method will setup the storage engine. If the browser has support for it.
storeDraft
public function storeDraft():void
This method will store the current contents in the the storage engine.
Event details
onRemoveDraft
public event onRemoveDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft removed/expired.
Parameters
Param | Detail |
---|---|
sender:AutoSave | Plugin instance sending the event. |
draft:Object | Draft object containing the HTML contents of the editor. |
onStoreDraft
public event onStoreDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft is stored to local storage.
Parameters
Param | Detail |
---|---|
sender:AutoSave | Plugin instance sending the event. |
draft:Object | Draft object containing the HTML contents of the editor. |
onStoreDraft
public event onStoreDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft is restored from local storage.
Parameters
Param | Detail |
---|---|
sender:AutoSave | Plugin instance sending the event. |
draft:Object | Draft object containing the HTML contents of the editor. |
Was this article helpful? Yes - No
Well, that's awkward . Would you mind opening an issue or helping us out?
Thanks for the feedback!
Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.