diff --git a/NEWS b/NEWS index f057058..fd7cdd1 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,12 @@ 1.4.12: July ??, 2008: - * Fixed bug in which tab/shift-tab for indending/outdenting nested lists no - longer worked, and in the process made it work in IE as well (which it - never has). + * Fixed a bug in which tab/shift-tab for indending/outdenting nested lists + no longer worked. Also made it work in IE as well (which it never has). * controller.Root.guide() now accepts an optional note_id parameter. + * Fixed a bug in which clicking a note title suggestion from within the link + info title field sometimes didn't update the link properly. This was due + to a race condition between the link info pulldown's onblur/onchange + handler and the suggestion onclick handler, both of which tried to update + the link, title, and summary at about the same time. 1.4.11: June 29, 2008: * Fixed bug in which bolding of suggest-as-you-type search text was case diff --git a/static/js/Editor.js b/static/js/Editor.js index b5fcab4..3a9defb 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -674,7 +674,10 @@ Editor.prototype.shutdown = function( event ) { } Editor.prototype.summarize = function () { - return summarize_html( scrapeText( this.document.body ), this.title ); + if ( this.document && this.document.body ) + return summarize_html( scrapeText( this.document.body ), this.title ); + + return ""; } function summarize_html( html, title ) { diff --git a/static/js/Wiki.js b/static/js/Wiki.js index a4403e7..6bb1b68 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -2773,11 +2773,17 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) { var self = this; connect( this.title_field, "onclick", function ( event ) { self.title_field_clicked( event ); } ); connect( this.title_field, "onfocus", function ( event ) { self.title_field_focused( event ); } ); - connect( this.title_field, "onchange", function ( event ) { self.title_field_changed( event ); } ); - connect( this.title_field, "onblur", function ( event ) { self.title_field_changed( event ); } ); connect( this.title_field, "onkeydown", function ( event ) { self.title_field_key_pressed( event ); } ); connect( this.title_field, "onkeyup", function ( event ) { self.title_field_key_released( event ); } ); + // the timeout prevents a race condition between these handlers and a suggesting being clicked + connect( this.title_field, "onchange", function ( event ) { + setTimeout( function () { self.title_field_changed( event ); }, 250 ); + } ); + connect( this.title_field, "onblur", function ( event ) { + setTimeout( function () { self.title_field_changed( event ); }, 250 ); + } ); + appendChildNodes( this.div, createDOM( "span", { "class": "field_label" }, "links to: " ) ); appendChildNodes( this.div, this.title_field ); appendChildNodes( this.div, this.note_summary );