1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/CliClient/app/gui/FolderListWidget.js

28 lines
598 B
JavaScript
Raw Normal View History

2017-10-08 00:17:10 +02:00
const Folder = require('lib/models/folder.js').Folder;
const ListWidget = require('tkwidgets/ListWidget.js');
class FolderListWidget extends ListWidget {
constructor() {
super();
this.selectedFolderId_ = 0;
2017-10-09 20:05:01 +02:00
this.itemRenderer = (item) => {
2017-10-08 00:17:10 +02:00
return item.title;
2017-10-09 20:05:01 +02:00
};
2017-10-08 00:17:10 +02:00
}
get selectedFolderId() {
return this.selectedFolderId_;
}
set selectedFolderId(v) {
if (v === this.selectedFolderId_) return;
this.selectedFolderId_ = v;
const index = this.itemIndexByKey('id', this.selectedFolderId_);
this.currentIndex = index >= 0 ? index : 0;
}
}
module.exports = FolderListWidget;