witten
/
luminotes
Archived
1
0
Fork 0

IE now properly shows link pulldown when you end a link. Also, in all

browsers, now silently refusing to close a pulldown upon request when it's
been open less than a quarter second.
This commit is contained in:
Dan Helfman 2007-08-30 20:17:10 +00:00
parent a1fb86f306
commit 2732e262f0
2 changed files with 13 additions and 6 deletions

View File

@ -394,6 +394,7 @@ Editor.prototype.end_link = function () {
}
signal( this, "resolve_link", link_title( link ), link );
return link;
}
Editor.prototype.find_link_at_cursor = function () {
@ -513,7 +514,7 @@ Editor.prototype.shutdown = function( event ) {
// convenience function for parsing a link that has an href URL containing a query string
function parse_query( link ) {
if ( !link.href )
if ( !link || !link.href )
return new Array();
return parseQueryString( link.href.split( "?" ).pop() );

View File

@ -420,8 +420,9 @@ Wiki.prototype.editor_title_changed = function ( editor, old_title, new_title )
this.open_editors[ new_title ] = editor;
}
Wiki.prototype.display_link_pulldown = function ( editor ) {
var link = editor.find_link_at_cursor();
Wiki.prototype.display_link_pulldown = function ( editor, link ) {
if ( !link )
link = editor.find_link_at_cursor();
if ( !link ) {
this.clear_pulldowns();
@ -546,6 +547,7 @@ Wiki.prototype.update_toolbar = function() {
Wiki.prototype.toggle_link_button = function ( event ) {
this.clear_messages();
this.clear_pulldowns();
var link = null;
if ( this.focused_editor && this.focused_editor.read_write ) {
this.focused_editor.focus();
@ -553,9 +555,9 @@ Wiki.prototype.toggle_link_button = function ( event ) {
if ( hasElementClass( "createLink", "button_down" ) )
this.focused_editor.start_link();
else
this.focused_editor.end_link();
link = this.focused_editor.end_link();
this.display_link_pulldown( this.focused_editor );
this.display_link_pulldown( this.focused_editor, link );
}
event.stop();
@ -856,7 +858,10 @@ Wiki.prototype.clear_pulldowns = function () {
for ( var i in results ) {
var result = results[ i ];
result.pulldown.shutdown();
// close the pulldown if it's been open at least a quarter second
if ( new Date() - result.pulldown.init_time >= 250 )
result.pulldown.shutdown();
}
}
@ -898,6 +903,7 @@ function Pulldown( wiki, notebook_id, pulldown_id, anchor, relative_to ) {
this.notebook_id = notebook_id;
this.div = createDOM( "div", { "id": pulldown_id, "class": "pulldown" } );
this.div.pulldown = this;
this.init_time = new Date();
this.anchor = anchor;
this.relative_to = relative_to;