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.
Do you want to see it in action? Visit http://valtlfelipe.github.io/TinyMCE-LocalAutoSave/.
This plugin requires jQuery 1.10.x or newer.
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"
});
Currently available translations: de
, en
, es
, fr
, it
, pt_BR
, ru
, 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!
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
}
});
Feel free to report issues, or even submit your pull request with new features or bug fixes. I would love to see some contribution. Thank you to all Contributors.
View the License for this repository.