diff --git a/NEWS b/NEWS index 1d0f078..385557a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.3.27: May 14, 2008 + * Fixed a bug where the toolbar didn't auto-resize if there were no + notes open. + 1.3.26: May 13, 2008 * New strikethough toolbar button. diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 3749dd0..0463b82 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1085,17 +1085,21 @@ Wiki.prototype.toggle_button = function ( event, button_id ) { } Wiki.prototype.update_button = function ( button_id, state_name, node_names ) { - if ( state_name && this.focused_editor.state_enabled( state_name, node_names ) ) + if ( state_name && node_names && this.focused_editor.state_enabled( state_name, node_names ) ) this.down_image_button( button_id ); else this.up_image_button( button_id ); } Wiki.prototype.update_toolbar = function() { - if ( !this.focused_editor ) - return; + var node_names = null; + var link = null; + + if ( this.focused_editor ) { + node_names = this.focused_editor.current_node_names(); + link = this.focused_editor.find_link_at_cursor(); + } - var node_names = this.focused_editor.current_node_names(); this.update_button( "newNote" ); this.update_button( "bold", "b", node_names ); this.update_button( "italic", "i", node_names ); @@ -1105,7 +1109,6 @@ Wiki.prototype.update_toolbar = function() { this.update_button( "insertUnorderedList", "ul", node_names ); this.update_button( "insertOrderedList", "ol", node_names ); - var link = this.focused_editor.find_link_at_cursor(); if ( link ) { // determine whether the link is a note link or a file link if ( link.target || !/\/files\//.test( link.href ) ) {