No longer popping up a link info box when clicking on a note link.
This commit is contained in:
parent
cf00a491a7
commit
c0cf5892be
3
NEWS
3
NEWS
|
@ -1,3 +1,6 @@
|
||||||
|
1.2.8: March 10, 2008
|
||||||
|
* No longer popping up a link info box when clicking on a note link.
|
||||||
|
|
||||||
1.2.7: March 10, 2008
|
1.2.7: March 10, 2008
|
||||||
* Fixed a bug where, after you highlighted a link and clicked the link button
|
* Fixed a bug where, after you highlighted a link and clicked the link button
|
||||||
to unlink it, the link info box popped up.
|
to unlink it, the link info box popped up.
|
||||||
|
|
|
@ -317,7 +317,7 @@ Editor.prototype.key_released = function ( event ) {
|
||||||
|
|
||||||
this.cleanup_html();
|
this.cleanup_html();
|
||||||
|
|
||||||
signal( this, "state_changed", this );
|
signal( this, "state_changed", this, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor.prototype.cleanup_html = function () {
|
Editor.prototype.cleanup_html = function () {
|
||||||
|
@ -348,41 +348,39 @@ Editor.prototype.cleanup_html = function () {
|
||||||
|
|
||||||
Editor.prototype.mouse_clicked = function ( event ) {
|
Editor.prototype.mouse_clicked = function ( event ) {
|
||||||
this.link_started = null;
|
this.link_started = null;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
// update the state no matter what, in case the cursor has moved
|
function handle_click( event ) {
|
||||||
if ( this.edit_enabled )
|
|
||||||
signal( this, "state_changed", this );
|
|
||||||
|
|
||||||
// we only want to deal with left mouse button clicks
|
// we only want to deal with left mouse button clicks
|
||||||
if ( event.mouse().button.middle || event.mouse().button.right )
|
if ( event.mouse().button.middle || event.mouse().button.right )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
// search through the tree of elements containing the clicked target. if a link isn't found, bail
|
// search through the tree of elements containing the clicked target. if a link isn't found, bail
|
||||||
var link = event.target()
|
var link = event.target()
|
||||||
while ( link.nodeName != "A" ) {
|
while ( link.nodeName != "A" ) {
|
||||||
link = link.parentNode;
|
link = link.parentNode;
|
||||||
if ( !link )
|
if ( !link )
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if ( !link.href ) return;
|
if ( !link.href ) return false;
|
||||||
|
|
||||||
// links with targets are considered to be external links pointing outside of this wiki
|
// links with targets are considered to be external links pointing outside of this wiki
|
||||||
if ( link.target ) {
|
if ( link.target ) {
|
||||||
// if this is a read-only editor, bail and let the browser handle the link normally
|
// if this is a read-only editor, bail and let the browser handle the link normally
|
||||||
if ( !this.edit_enabled ) return;
|
if ( !self.edit_enabled ) return true;
|
||||||
|
|
||||||
// otherwise, this is a read-write editor, so we've got to launch the external link ourselves.
|
// otherwise, this is a read-write editor, so we've got to launch the external link ourselves.
|
||||||
// note that this ignores what the link target actually contains and assumes it's "_new"
|
// note that this ignores what the link target actually contains and assumes it's "_new"
|
||||||
window.open( link.href );
|
window.open( link.href );
|
||||||
event.stop();
|
event.stop();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case for links to uploaded files
|
// special case for links to uploaded files
|
||||||
if ( !link.target && /\/files\//.test( link.href ) ) {
|
if ( !link.target && /\/files\//.test( link.href ) ) {
|
||||||
if ( !/\/files\/new$/.test( link.href ) )
|
if ( !/\/files\/new$/.test( link.href ) )
|
||||||
location.href = link.href;
|
location.href = link.href;
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.stop();
|
event.stop();
|
||||||
|
@ -391,7 +389,16 @@ Editor.prototype.mouse_clicked = function ( event ) {
|
||||||
var query = parse_query( link );
|
var query = parse_query( link );
|
||||||
var title = link_title( link, query );
|
var title = link_title( link, query );
|
||||||
var id = query.note_id;
|
var id = query.note_id;
|
||||||
signal( this, "load_editor", title, id, null, link, this.iframe );
|
signal( self, "load_editor", title, id, null, link, self.iframe );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var link_clicked = handle_click( event );
|
||||||
|
|
||||||
|
// in case the cursor has moved, update the state
|
||||||
|
if ( this.edit_enabled )
|
||||||
|
signal( this, "state_changed", this, link_clicked );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor.prototype.scrape_title = function () {
|
Editor.prototype.scrape_title = function () {
|
||||||
|
|
|
@ -698,8 +698,10 @@ Wiki.prototype.resize_editors = function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Wiki.prototype.editor_state_changed = function ( editor ) {
|
Wiki.prototype.editor_state_changed = function ( editor, link_clicked ) {
|
||||||
this.update_toolbar();
|
this.update_toolbar();
|
||||||
|
|
||||||
|
if ( !link_clicked )
|
||||||
this.display_link_pulldown( editor );
|
this.display_link_pulldown( editor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue