witten
/
luminotes
Archived
1
0
Fork 0

Rewrote Editor.empty() to rely on scrapeText() again.

This commit is contained in:
Dan Helfman 2009-01-08 12:42:00 -08:00
parent 5773efc884
commit d5b0351bb4
1 changed files with 9 additions and 5 deletions

View File

@ -677,7 +677,14 @@ Editor.title_placeholder_pattern = /\u200b/g;
Editor.title_placeholder_html = "​​";
Editor.prototype.empty = function () {
return this.contents( true ).length == 0;
if ( this.div )
var node = this.div;
else if ( this.document && this.document.body )
var node = this.document.body;
else
return true;
return ( scrapeText( node ).replace( Editor.title_placeholder_pattern, "" ).length == 0 );
}
Editor.prototype.insert_link = function ( url ) {
@ -822,7 +829,7 @@ Editor.prototype.focus = function () {
this.iframe.contentWindow.focus();
}
Editor.prototype.contents = function ( no_initial_text ) {
Editor.prototype.contents = function () {
if ( this.div ) {
var static_contents = getFirstElementByTagAndClassName( "span", "static_note_contents", this.div );
if ( static_contents )
@ -832,9 +839,6 @@ Editor.prototype.contents = function ( no_initial_text ) {
if ( this.document && this.document.body )
return this.document.body.innerHTML;
if ( no_initial_text )
return "";
return this.initial_text || "";
}