aboutsummaryrefslogtreecommitdiff
path: root/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
diff options
context:
space:
mode:
Diffstat (limited to 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js')
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
index d8cc1120f..061cf1351 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
+++ b/mod/tinymce/vendor/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();