tinymce.plugins.AutoSave

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

getExpDatemethod

public function getExpDate():String
Returns an expiration date UTC string.

Returns

String - Expiration date UTC string.

getInfomethod

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.

hasDraftmethod

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.

initmethod

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

ed:Editor Editor instance that the plugin is initialized in.
url:string Absolute URL to where the plugin is located.

removeDraftmethod

public function removeDraft():void
Removes the currently stored draft.

restoreDraftmethod

public function restoreDraft():void
This method will restore the contents from the storage engine back to the editor.

setupStoragemethod

public function setupStorage():void
This method will setup the storage engine. If the browser has support for it.

storeDraftmethod

public function storeDraft():void
This method will store the current contents in the the storage engine.

Event details

onRemoveDraftevent

public event onRemoveDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft removed/expired.

Parameters

sender:AutoSave Plugin instance sending the event.
draft:Object Draft object containing the HTML contents of the editor.

onStoreDraftevent

public event onStoreDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft is stored to local storage.

Parameters

sender:AutoSave Plugin instance sending the event.
draft:Object Draft object containing the HTML contents of the editor.

onStoreDraftevent

public event onStoreDraft(sender:AutoSave, draft:Object)
This event gets fired when a draft is restored from local storage.

Parameters

sender:AutoSave Plugin instance sending the event.
draft:Object Draft object containing the HTML contents of the editor.