mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
removed last global keyboard handlers
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import BasicWidget from "./basic_widget.js";
|
||||
import hoistedNoteService from "../services/hoisted_note.js";
|
||||
import searchNotesService from "../services/search_notes.js";
|
||||
import treeService from "../services/tree.js";
|
||||
@@ -34,6 +33,8 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
constructor(appContext) {
|
||||
super(appContext);
|
||||
|
||||
window.glob.cutIntoNote = () => this.cutIntoNoteListener();
|
||||
|
||||
this.tree = null;
|
||||
}
|
||||
|
||||
@@ -453,4 +454,41 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
||||
treeService.setNodeTitleWithPrefix(node);
|
||||
}
|
||||
}
|
||||
|
||||
async createNoteAfterListener() {
|
||||
const node = this.getActiveNode();
|
||||
const parentNoteId = node.data.parentNoteId;
|
||||
const isProtected = await treeUtils.getParentProtectedStatus(node);
|
||||
|
||||
if (node.data.noteId === 'root' || node.data.noteId === await hoistedNoteService.getHoistedNoteId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await treeService.createNote(node, parentNoteId, 'after', {
|
||||
isProtected: isProtected,
|
||||
saveSelection: true
|
||||
});
|
||||
}
|
||||
|
||||
async createNoteIntoListener() {
|
||||
const node = this.getActiveNode();
|
||||
|
||||
if (node) {
|
||||
await treeService.createNote(node, node.data.noteId, 'into', {
|
||||
isProtected: node.data.isProtected,
|
||||
saveSelection: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async cutIntoNoteListener() {
|
||||
const node = this.getActiveNode();
|
||||
|
||||
if (node) {
|
||||
await treeService.createNote(node, node.data.noteId, 'into', {
|
||||
isProtected: node.data.isProtected,
|
||||
saveSelection: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user