witten
/
luminotes
Archived
1
0
Fork 0

Note tree link order now updates when notes are themselves reordered.

This commit is contained in:
Dan Helfman 2009-02-10 22:08:42 -08:00
parent de60f7a852
commit e366e324a7
1 changed files with 16 additions and 1 deletions

View File

@ -1046,6 +1046,8 @@ Wiki.prototype.editor_focused = function ( editor, synchronous, remove_empty ) {
Wiki.prototype.editor_moved = function ( editor, position_after, position_before ) {
this.save_editor( editor, false, null, null, null, position_after, position_before );
if ( this.note_tree )
this.note_tree.move_link( editor, position_after, position_before );
// reset the revision for each open editor. this is because the server is updating the revisions
// on the server while reordering the ntoes. and we don't want to have a stale idea of what the
@ -4649,7 +4651,7 @@ Note_tree.prototype.display_child_links = function ( result, link, children_area
if ( expander && link.parentNode.parentNode == expander.parentNode.parentNode ) {
swapElementClass( expander, "tree_expander_expanded", "tree_expander_empty" );
disconnectAll( expander );
return;
return
}
return;
@ -4664,6 +4666,18 @@ Note_tree.prototype.display_child_links = function ( result, link, children_area
connect_expander( expander, note_id );
}
Note_tree.prototype.move_link = function ( editor, position_after, position_before ) {
var item = getElement( "note_tree_item_" + editor.id );
if ( position_after ) {
var after_item = getElement( "note_tree_item_" + position_after.id );
insertSiblingNodesAfter( after_item, item );
} else if ( position_before ) {
var before_item = getElement( "note_tree_item_" + position_before.id );
insertSiblingNodesBefore( before_item, item );
}
}
Note_tree.prototype.start_link_add = function () {
// if the add is already in progress, end the add instead of starting one
var new_note_tree_link_field = getElement( "new_note_tree_link_field" );
@ -4786,6 +4800,7 @@ Note_tree.prototype.save_and_display_startup_note = function ( note ) {
} );
}
function Recent_notes( wiki, notebook_id, invoker ) {
this.wiki = wiki;
this.notebook_id = notebook_id;