Allow inline editing of collection names
Can be triggered by double-clicking or Return and also by F2 on Windows/Linux This does mean double-clicking no longer toggles the collection open and closed. If we wanted to preserve that we could probably capture the double-click. Closes Trac ticket 231, only 8 years later
This commit is contained in:
parent
326d2bc1e3
commit
c0d6648b9e
2 changed files with 23 additions and 2 deletions
|
@ -575,6 +575,28 @@ Zotero.CollectionTreeView.prototype.isSelectable = function (row, col) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tree method for whether to allow inline editing (not to be confused with this.editable)
|
||||
*/
|
||||
Zotero.CollectionTreeView.prototype.isEditable = function (row, col) {
|
||||
return this.itemGroup.isCollection() && this.editable;
|
||||
}
|
||||
|
||||
|
||||
Zotero.CollectionTreeView.prototype.setCellText = function (row, col, val) {
|
||||
val = val.trim();
|
||||
if (val === "") {
|
||||
return;
|
||||
}
|
||||
this.itemGroup.ref.name = val;
|
||||
this.itemGroup.ref.save();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns TRUE if the underlying view is editable
|
||||
*/
|
||||
Zotero.CollectionTreeView.prototype.__defineGetter__('editable', function () {
|
||||
return this._getItemAtRow(this.selection.currentIndex).editable;
|
||||
});
|
||||
|
@ -1803,7 +1825,6 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient, dataTransfer)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Zotero.CollectionTreeView.prototype.isSorted = function() { return false; }
|
||||
Zotero.CollectionTreeView.prototype.isEditable = function(row, idx) { return false; }
|
||||
|
||||
/* Set 'highlighted' property on rows set by setHighlightedRows */
|
||||
Zotero.CollectionTreeView.prototype.getRowProperties = function(row, prop) {
|
||||
|
|
|
@ -301,7 +301,7 @@
|
|||
<tree id="zotero-collections-tree" hidecolumnpicker="true" context="zotero-collectionmenu"
|
||||
onmouseover="ZoteroPane_Local.collectionsView.setHighlightedRows();"
|
||||
onselect="ZoteroPane_Local.onCollectionSelected();"
|
||||
seltype="cell" flex="1">
|
||||
seltype="cell" flex="1" editable="true">
|
||||
<treecols>
|
||||
<treecol
|
||||
id="zotero-collections-name-column"
|
||||
|
|
Loading…
Reference in a new issue