witten
/
luminotes
Archived
1
0
Fork 0

Prevent one note from "shadowing" another note with the same name. Previously,

if you clicked a link with a note id and a note with the link's title was
already open, it just highlighted that note, regardless of the id. Now, that
will only happen if the link has no id.
This commit is contained in:
Dan Helfman 2007-09-05 19:54:04 +00:00
parent 8a2c872e0a
commit 439fd49880
1 changed files with 11 additions and 11 deletions

View File

@ -278,17 +278,6 @@ Wiki.prototype.load_editor = function ( note_title, note_id, revision, link ) {
}
}
// if the note corresponding to the link's title is already open, highlight it and bail
if ( !revision ) {
var editor = this.open_editors[ note_title ];
if ( editor ) {
editor.highlight();
if ( link )
link.href = "/notebooks/" + this.notebook_id + "?note_id=" + editor.id;
return;
}
}
// if the note_title corresponds to a "magic" note's title, then dynamically create the note
var self = this;
if ( note_title == "all notes" ) {
@ -301,6 +290,17 @@ Wiki.prototype.load_editor = function ( note_title, note_id, revision, link ) {
// if there's not a valid destination note id, then load by title instead of by id
if ( note_id == undefined || note_id == "new" || note_id == "null" ) {
// but if the note corresponding to the link's title is already open, highlight it and bail
if ( !revision ) {
var editor = this.open_editors[ note_title ];
if ( editor ) {
editor.highlight();
if ( link )
link.href = "/notebooks/" + this.notebook_id + "?note_id=" + editor.id;
return;
}
}
this.invoker.invoke(
"/notebooks/load_note_by_title", "GET", {
"notebook_id": this.notebook_id,