Local AutoSave plugin for TinyMCE 4.x
Save the TinyMCE (v4.x) content to LocalStorage* or SessionStorage* in your Browser to avoid losing your content on a page refresh, etc.
*Only if Browser supports webstorage. See a list of Supported Browsers.
*Cookie support has been disabled for now.
Demo
Do you want to see it in action? Visit http://valtlfelipe.github.io/TinyMCE-LocalAutoSave/.
Quick start
Install with Bower:
bower install tinymce-localautosave
And use:
tinymce.init({
plugins: "localautosave",
toolbar1: "localautosave",
external_plugins : {
"localautosave" : "bower_components/tinymce-localautosave/localautosave/plugin.min.js"
}
});
Or download it manually:
-
Unzip the
localautosave
folder in your TinyMCE plugin foldertinymce/plugins/
. -
Initialize plugin and add it to the toolbar. Example:
tinymce.init({
plugins: "localautosave",
toolbar1: "localautosave"
});
Translation
Currently available translations: de
, en
, es
, fr
, it
, pt_BR
, tr
, zh_CN
.
If you have translated this plugin, please create a pull request or send me a message so I can add your translation to this repository. Thanks!
Documentation
You can configure this plugin using the methods listed here (those configurations are optional):
-
las_seconds
=> set the period to save the content in seconds (default 6). -
las_keyName
=> set the key name for the LocalStorage, SessionStorage. -
las_callback
=> fires an function with two variables inthis
object when content is saved successfully. -
las_nVersions
=> number of versions of content you want to store (default 15, set 0 to disable)
Example:
tinymce.init({
plugins: "localautosave",
toolbar1: "localautosave",
las_seconds: 15,
las_nVersions: 15,
las_keyName: "LocalAutoSave",
las_callback: function() {
var content = this.content; //content saved
var time = this.time; //time on save action
}
});
License
View the License for this repository.
Contributors
Thank you to Valerio Gentile, gastonsanguinetti, Quentin Delettre, Burak Ozdemir, Zhiqian MA and Hubertus Becker for contributing.