Closes #156, Double-clicking a note in the item list should open it in a popup window
This commit is contained in:
parent
b79420e75b
commit
04ce48ae64
2 changed files with 24 additions and 4 deletions
|
@ -26,6 +26,7 @@ var ScholarPane = new function()
|
|||
this.getSelectedItems = getSelectedItems;
|
||||
this.buildCollectionContextMenu = buildCollectionContextMenu;
|
||||
this.buildItemContextMenu = buildItemContextMenu;
|
||||
this.onDoubleClick = onDoubleClick;
|
||||
this.openNoteWindow = openNoteWindow;
|
||||
this.newNote = newNote;
|
||||
this.addFileFromDialog = addFileFromDialog;
|
||||
|
@ -180,11 +181,11 @@ var ScholarPane = new function()
|
|||
var noteEditor = document.getElementById('scholar-note-editor');
|
||||
noteEditor.item = null;
|
||||
noteEditor.note = item.ref;
|
||||
document.getElementById('scholar-view-note').lastChild.setAttribute('noteID',item.ref.getID());
|
||||
document.getElementById('scholar-view-note-button').setAttribute('noteID',item.ref.getID());
|
||||
if(item.ref.getSource() != null)
|
||||
document.getElementById('scholar-view-note').lastChild.setAttribute('sourceID',item.ref.getSource());
|
||||
document.getElementById('scholar-view-note-button').setAttribute('sourceID',item.ref.getSource());
|
||||
else
|
||||
document.getElementById('scholar-view-note').lastChild.removeAttribute('sourceID');
|
||||
document.getElementById('scholar-view-note-button').removeAttribute('sourceID');
|
||||
document.getElementById('item-pane').selectedIndex = 2;
|
||||
}
|
||||
else if(item.isFile())
|
||||
|
@ -370,6 +371,24 @@ var ScholarPane = new function()
|
|||
}
|
||||
}
|
||||
|
||||
// Adapted from: http://www.xulplanet.com/references/elemref/ref_tree.html#cmnote-9
|
||||
function onDoubleClick(event, tree)
|
||||
{
|
||||
if (event && tree && (event.type == "click" || event.type == "dblclick"))
|
||||
{
|
||||
var row = {}, col = {}, obj = {};
|
||||
tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
|
||||
if (obj.value && itemsView && itemsView.selection.currentIndex > -1)
|
||||
{
|
||||
var item = getSelectedItems()[0];
|
||||
if(item && item.isNote())
|
||||
{
|
||||
document.getElementById('scholar-view-note-button').doCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function newNote()
|
||||
{
|
||||
var c = getSelectedCollection();
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
</hbox>
|
||||
<tree
|
||||
id="items-tree" context="scholar-itemmenu"
|
||||
ondblclick="ScholarPane.onDoubleClick(event, this);"
|
||||
enableColumnDrag="true" onkeypress="if(event.keyCode == event.DOM_VK_BACK_SPACE){ ScholarPane.deleteSelectedItem(); return false; }"
|
||||
onselect="ScholarPane.itemSelected();"
|
||||
ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ScholarPane.getItemsView());"
|
||||
|
@ -182,7 +183,7 @@
|
|||
<deck id="scholar-view-item" flex="1"/>
|
||||
<vbox id="scholar-view-note" flex="1">
|
||||
<noteeditor id="scholar-note-editor" flex="1"/>
|
||||
<button label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/>
|
||||
<button id="scholar-view-note-button" label="Edit in a separate window" oncommand="ScholarPane.openNoteWindow(this.getAttribute('noteID')); if(this.hasAttribute('sourceID')) ScholarPane.selectItem(this.getAttribute('sourceID'));"/>
|
||||
</vbox>
|
||||
<vbox id="scholar-view-file" flex="1">
|
||||
<label id="scholar-file-label"/>
|
||||
|
|
Loading…
Reference in a new issue