Skip to content

Commit

Permalink
Fixed some issues with the autosave and visualchars plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
spocke committed Jun 16, 2010
1 parent 4b2d627 commit c39a310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jscripts/tiny_mce/plugins/autosave/editor_plugin_src.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -303,7 +303,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();

Expand Down
6 changes: 3 additions & 3 deletions jscripts/tiny_mce/plugins/visualchars/editor_plugin_src.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'});

ed.onBeforeGetContent.add(function(ed, o) {
if (t.state && o.format != 'raw') {
if (t.state && o.format != 'raw' && !o.draft) {
t.state = true;
t._toggleVisualChars();
}
Expand Down Expand Up @@ -55,12 +55,12 @@
nl.push(n);
}, 'childNodes');

for (i=0; i<nl.length; i++) {
for (i = 0; i < nl.length; i++) {
nv = nl[i].nodeValue;
nv = nv.replace(/(\u00a0)/g, '<span _mce_bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');

div = ed.dom.create('div', null, nv);
while (node = div.firstChild)
while (node = div.lastChild)
ed.dom.insertAfter(node, nl[i]);

ed.dom.remove(nl[i]);
Expand Down

0 comments on commit c39a310

Please sign in to comment.