witten
/
luminotes
Archived
1
0
Fork 0

Fixed a Firefox 3.5 bug in which bold mode (or italics mode) would inexplicably end after typing a few characters.

This commit is contained in:
Dan Helfman 2009-07-12 13:27:31 -07:00
parent 12719951c9
commit 73ba66ea72
3 changed files with 35 additions and 23 deletions

2
NEWS
View File

@ -3,6 +3,8 @@
* Fixed a Firefox 3.5 bug in which after ending a link ctrl-L, typed text
ended up as part of the link. Now, ctrl-L properly ends the link and any
typed text after the link does not become linked itself.
* Fixed a Firefox 3.5 bug in which bold mode (or italics mode) would
inexplicably end after typing a few characters.
1.6.14: June 14, 2009
* Fixed a bug in which some printed or exported notes appeared in

View File

@ -941,17 +941,6 @@ Editor.prototype.key_released = function ( event ) {
}
Editor.prototype.cleanup_html = function ( key_code ) {
if ( this.iframe.contentWindow.getSelection ) {
var selection = this.iframe.contentWindow.getSelection();
if ( selection.rangeCount > 0 )
var range = selection.getRangeAt( 0 );
else
var range = this.document.createRange();
var fragment = range.cloneContents();
if ( fragment.childNodes.length == 0 )
this.exec_command( "removeformat" );
}
if ( WEBKIT ) {
// if enter is pressed while in a title, end title mode, since WebKit doesn't do that for us
var ENTER = 13; BACKSPACE = 8;
@ -1041,6 +1030,20 @@ Editor.prototype.cleanup_html = function ( key_code ) {
}
}
Editor.prototype.cleanup_range = function () {
if ( !this.iframe.contentWindow.getSelection )
return;
var selection = this.iframe.contentWindow.getSelection();
if ( selection.rangeCount > 0 )
var range = selection.getRangeAt( 0 );
else
var range = this.document.createRange();
if ( range.collapsed )
this.exec_command( "removeformat" );
}
Editor.prototype.unformat_selection = function () {
if ( !this.iframe || !this.document )
return false;

View File

@ -1478,10 +1478,13 @@ Wiki.prototype.toggle_button = function ( event, button_id ) {
}
Wiki.prototype.update_button = function ( button_id, state_name, node_names ) {
if ( state_name && node_names && 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 );
return 1;
}
this.up_image_button( button_id );
return 0;
}
Wiki.prototype.update_toolbar = function() {
@ -1497,16 +1500,20 @@ Wiki.prototype.update_toolbar = function() {
link = this.focused_editor.find_link_at_cursor();
}
var enabled = 0;
this.update_button( "newNote" );
this.update_button( "bold", "b", node_names );
this.update_button( "italic", "i", node_names );
this.update_button( "underline", "u", node_names );
this.update_button( "strikethrough", "strike", node_names );
this.update_button( "color", "color", node_names );
this.update_button( "font", "fontface", node_names );
this.update_button( "title", "h3", node_names );
this.update_button( "insertUnorderedList", "ul", node_names );
this.update_button( "insertOrderedList", "ol", node_names );
enabled += this.update_button( "bold", "b", node_names );
enabled += this.update_button( "italic", "i", node_names );
enabled += this.update_button( "underline", "u", node_names );
enabled += this.update_button( "strikethrough", "strike", node_names );
enabled += this.update_button( "color", "color", node_names );
enabled += this.update_button( "font", "fontface", node_names );
enabled += this.update_button( "title", "h3", node_names );
enabled += this.update_button( "insertUnorderedList", "ul", node_names );
enabled += this.update_button( "insertOrderedList", "ol", node_names );
if ( this.focused_editor && enabled == 0 )
this.focused_editor.cleanup_range();
if ( link ) {
// determine whether the link is a note link or a file link