From 5944d1f20dc0aa276ba7ff405489cdcbec0080e9 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Mon, 6 Oct 2008 15:48:32 -0700 Subject: [PATCH] Fixed bug in Safari/Chrome in which hiding an empty note caused it to get saved and end up in the "recent updates". --- static/js/Editor.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/Editor.js b/static/js/Editor.js index 2f09a3c..cb05a1f 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -521,17 +521,17 @@ Editor.prototype.blurred = function () { this.scrape_title(); } +Editor.title_placeholder_char = "\u200b"; +Editor.title_placeholder_pattern = /\u200b/g; +Editor.title_placeholder_html = "​​"; + Editor.prototype.empty = function () { if ( !this.document || !this.document.body ) return true; // consider it empty as of now - return ( scrapeText( this.document.body ).length == 0 ); + return ( scrapeText( this.document.body ).replace( Editor.title_placeholder_pattern, "" ).length == 0 ); } -Editor.title_placeholder_char = "\u200b"; -Editor.title_placeholder_pattern = /\u200b/g; -Editor.title_placeholder_html = "​​"; - Editor.prototype.insert_link = function ( url ) { // get the current selection, which is the link title if ( this.iframe.contentWindow && this.iframe.contentWindow.getSelection ) { // browsers such as Firefox