aboutsummaryrefslogtreecommitdiffstats
path: root/library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js')
-rw-r--r--[-rwxr-xr-x]library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js b/library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
index d8cc1120f..8311483f9 100755..100644
--- a/library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
+++ b/library/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
@@ -106,7 +106,7 @@
ed.addButton(RESTORE_DRAFT, {
title : PLUGIN_NAME + ".restore_content",
onclick : function() {
- if (ed.getContent().replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {
+ if (ed.getContent({draft: true}).replace(/\s|&nbsp;|<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {
// Show confirm dialog if the editor isn't empty
ed.windowManager.confirm(
PLUGIN_NAME + ".warning_message",
@@ -257,15 +257,24 @@
userDataElement.setAttribute(key, value);
userDataElement.expires = self.getExpDate();
- userDataElement.save("TinyMCE");
+
+ try {
+ userDataElement.save("TinyMCE");
+ } catch (e) {
+ // Ignore, saving might fail if "Userdata Persistence" is disabled in IE
+ }
},
getItem : function(key) {
var userDataElement = ed.getElement();
- userDataElement.load("TinyMCE");
-
- return userDataElement.getAttribute(key);
+ try {
+ userDataElement.load("TinyMCE");
+ return userDataElement.getAttribute(key);
+ } catch (e) {
+ // Ignore, loading might fail if "Userdata Persistence" is disabled in IE
+ return null;
+ }
},
removeItem : function(key) {
@@ -303,7 +312,7 @@
return;
// Store contents if the contents if longer than the minlength of characters
- content = editor.getContent();
+ content = editor.getContent({draft: true});
if (content.length > editor.settings.autosave_minlength) {
expires = self.getExpDate();
@@ -326,7 +335,7 @@
* @method restoreDraft
*/
restoreDraft : function() {
- var self = this, storage = self.storage;
+ var self = this, storage = self.storage, content;
if (storage) {
content = storage.getItem(self.key);