Archived
1
0

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.
This commit is contained in:
Dan Helfman 2008-07-07 15:38:16 -07:00
parent 94b53832d5
commit 6ac620beb0
3 changed files with 19 additions and 6 deletions

10
NEWS
View File

@ -1,8 +1,12 @@
1.4.12: July ??, 2008: 1.4.12: July ??, 2008:
* Fixed bug in which tab/shift-tab for indending/outdenting nested lists no * Fixed a bug in which tab/shift-tab for indending/outdenting nested lists
longer worked, and in the process made it work in IE as well (which it no longer worked. Also made it work in IE as well (which it never has).
never has).
* controller.Root.guide() now accepts an optional note_id parameter. * 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: 1.4.11: June 29, 2008:
* Fixed bug in which bolding of suggest-as-you-type search text was case * Fixed bug in which bolding of suggest-as-you-type search text was case

View File

@ -674,7 +674,10 @@ Editor.prototype.shutdown = function( event ) {
} }
Editor.prototype.summarize = function () { 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 ) { function summarize_html( html, title ) {

View File

@ -2773,11 +2773,17 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
var self = this; var self = this;
connect( this.title_field, "onclick", function ( event ) { self.title_field_clicked( event ); } ); 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, "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, "onkeydown", function ( event ) { self.title_field_key_pressed( event ); } );
connect( this.title_field, "onkeyup", function ( event ) { self.title_field_key_released( 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, createDOM( "span", { "class": "field_label" }, "links to: " ) );
appendChildNodes( this.div, this.title_field ); appendChildNodes( this.div, this.title_field );
appendChildNodes( this.div, this.note_summary ); appendChildNodes( this.div, this.note_summary );