Fixing Firefox link creation when in the middle of a line.
This commit is contained in:
parent
5dca7e972e
commit
de9e3a55e3
|
@ -327,8 +327,16 @@ Editor.prototype.start_link = function () {
|
||||||
|
|
||||||
this.exec_command( "createLink", "/notes/new" );
|
this.exec_command( "createLink", "/notes/new" );
|
||||||
|
|
||||||
container.nodeValue = "";
|
var links = getElementsByTagAndClassName( "a", null, parent = this.document );
|
||||||
selection.collapse( container, 0 );
|
for ( var i in links ) {
|
||||||
|
var link = links[ i ];
|
||||||
|
var char_code = link.firstChild.nodeValue.charCodeAt( 0 );
|
||||||
|
// look for links titled with a space or nbsp character
|
||||||
|
if ( link.firstChild.nodeValue.length == 1 && char_code == 0x20 || char_code == 0xa0 ) {
|
||||||
|
link.firstChild.nodeValue = "";
|
||||||
|
selection.collapse( link.firstChild, 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
// otherwise, just create a link with the selected text as the link title
|
// otherwise, just create a link with the selected text as the link title
|
||||||
} else {
|
} else {
|
||||||
this.exec_command( "createLink", "/notes/new" );
|
this.exec_command( "createLink", "/notes/new" );
|
||||||
|
|
Reference in New Issue