mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-01 19:15:01 +02:00
CLI: Added support for sub-notebooks
This commit is contained in:
parent
e1dee546dc
commit
cf9246796d
@ -18,19 +18,20 @@ class FolderListWidget extends ListWidget {
|
|||||||
this.notesParentType_ = 'Folder';
|
this.notesParentType_ = 'Folder';
|
||||||
this.updateIndexFromSelectedFolderId_ = false;
|
this.updateIndexFromSelectedFolderId_ = false;
|
||||||
this.updateItems_ = false;
|
this.updateItems_ = false;
|
||||||
|
this.trimItemTitle = false;
|
||||||
|
|
||||||
this.itemRenderer = (item) => {
|
this.itemRenderer = (item) => {
|
||||||
let output = [];
|
let output = [];
|
||||||
if (item === '-') {
|
if (item === '-') {
|
||||||
output.push('-'.repeat(this.innerWidth));
|
output.push('-'.repeat(this.innerWidth));
|
||||||
} else if (item.type_ === Folder.modelType()) {
|
} else if (item.type_ === Folder.modelType()) {
|
||||||
output.push(Folder.displayTitle(item));
|
output.push(' '.repeat(this.folderDepth(this.folders, item.id)) + Folder.displayTitle(item));
|
||||||
} else if (item.type_ === Tag.modelType()) {
|
} else if (item.type_ === Tag.modelType()) {
|
||||||
output.push('[' + Folder.displayTitle(item) + ']');
|
output.push('[' + Folder.displayTitle(item) + ']');
|
||||||
} else if (item.type_ === BaseModel.TYPE_SEARCH) {
|
} else if (item.type_ === BaseModel.TYPE_SEARCH) {
|
||||||
output.push(_('Search:'));
|
output.push(_('Search:'));
|
||||||
output.push(item.title);
|
output.push(item.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (item && item.id) output.push(item.id.substr(0, 5));
|
// if (item && item.id) output.push(item.id.substr(0, 5));
|
||||||
|
|
||||||
@ -38,6 +39,17 @@ class FolderListWidget extends ListWidget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
folderDepth(folders, folderId) {
|
||||||
|
let output = 0;
|
||||||
|
while (true) {
|
||||||
|
const folder = BaseModel.byId(folders, folderId);
|
||||||
|
if (!folder.parent_id) return output;
|
||||||
|
output++;
|
||||||
|
folderId = folder.parent_id;
|
||||||
|
}
|
||||||
|
throw new Error('unreachable');
|
||||||
|
}
|
||||||
|
|
||||||
get selectedFolderId() {
|
get selectedFolderId() {
|
||||||
return this.selectedFolderId_;
|
return this.selectedFolderId_;
|
||||||
}
|
}
|
||||||
|
807
CliClient/package-lock.json
generated
807
CliClient/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -58,7 +58,7 @@
|
|||||||
"strip-ansi": "^4.0.0",
|
"strip-ansi": "^4.0.0",
|
||||||
"tar": "^4.4.0",
|
"tar": "^4.4.0",
|
||||||
"tcp-port-used": "^0.1.2",
|
"tcp-port-used": "^0.1.2",
|
||||||
"tkwidgets": "^0.5.25",
|
"tkwidgets": "^0.5.26",
|
||||||
"url-parse": "^1.2.0",
|
"url-parse": "^1.2.0",
|
||||||
"uuid": "^3.0.1",
|
"uuid": "^3.0.1",
|
||||||
"valid-url": "^1.0.9",
|
"valid-url": "^1.0.9",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user