diff --git a/NEWS b/NEWS index ea7d566..1abb684 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ 1.5.9: * Fixed a Chrome/Safari bug in which ending a link didn't always work. + * Fixed a rare Chrome/Safari bug in which pressing backspace sometimes made + the text cursor vanish. 1.5.8: November 24, 2008 * Fixed a bug that prevented notes from being automatically saved in certain diff --git a/static/js/Editor.js b/static/js/Editor.js index 9ef625d..4f5659f 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -329,10 +329,14 @@ Editor.prototype.key_released = function ( event ) { Editor.prototype.cleanup_html = function ( key_code ) { if ( WEBKIT ) { // if enter is pressed while in a title, end title mode, since WebKit doesn't do that for us - var ENTER = 13; + var ENTER = 13; BACKSPACE = 8; if ( key_code == ENTER && this.state_enabled( "h3" ) ) this.exec_command( "h3" ); + // if backspace is pressed, skip WebKit style scrubbing since it can cause problems + if ( key_code == BACKSPACE ) + return null; + // as of this writing, WebKit doesn't support execCommand( "styleWithCSS" ). for more info, see // https://bugs.webkit.org/show_bug.cgi?id=13490 // so to make up for this shortcoming, manually scrub WebKit style spans and other nodes, diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 9faebce..c25fd94 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1073,6 +1073,10 @@ Wiki.prototype.key_pressed = function ( event ) { if ( code == 78 ) this.create_blank_editor( event ); } + + // prevent backspace from going back to the previous page + if ( code == 8 ) + event.stop(); } Wiki.prototype.editor_key_pressed = function ( editor, event ) {