mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-31 20:22:27 +08:00
chore(client/ts): port components/main_tree_executors
This commit is contained in:
parent
ec685db093
commit
68d4f9f507
@ -21,6 +21,7 @@ import { ConfirmWithMessageOptions, ConfirmWithTitleOptions } from "../widgets/d
|
|||||||
import { Node } from "../services/tree.js";
|
import { Node } from "../services/tree.js";
|
||||||
import LoadResults from "../services/load_results.js";
|
import LoadResults from "../services/load_results.js";
|
||||||
import { Attribute } from "../services/attribute_parser.js";
|
import { Attribute } from "../services/attribute_parser.js";
|
||||||
|
import NoteTreeWidget from "../widgets/note_tree.js";
|
||||||
|
|
||||||
interface Layout {
|
interface Layout {
|
||||||
getRootWidget: (appContext: AppContext) => RootWidget;
|
getRootWidget: (appContext: AppContext) => RootWidget;
|
||||||
@ -149,6 +150,13 @@ export type CommandMappings = {
|
|||||||
addNewRelation: CommandData;
|
addNewRelation: CommandData;
|
||||||
addNewLabelDefinition: CommandData;
|
addNewLabelDefinition: CommandData;
|
||||||
addNewRelationDefinition: CommandData;
|
addNewRelationDefinition: CommandData;
|
||||||
|
|
||||||
|
cloneNoteIdsTo: CommandData & {
|
||||||
|
noteIds: string[];
|
||||||
|
};
|
||||||
|
moveBranchIdsTo: CommandData & {
|
||||||
|
branchIds: string[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventMappings = {
|
type EventMappings = {
|
||||||
@ -204,6 +212,7 @@ class AppContext extends Component {
|
|||||||
beforeUnloadListeners: WeakRef<BeforeUploadListener>[];
|
beforeUnloadListeners: WeakRef<BeforeUploadListener>[];
|
||||||
tabManager!: TabManager;
|
tabManager!: TabManager;
|
||||||
layout?: Layout;
|
layout?: Layout;
|
||||||
|
noteTreeWidget?: NoteTreeWidget;
|
||||||
|
|
||||||
constructor(isMainWindow: boolean) {
|
constructor(isMainWindow: boolean) {
|
||||||
super();
|
super();
|
||||||
|
@ -15,12 +15,20 @@ export default class MainTreeExecutors extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cloneNotesToCommand() {
|
async cloneNotesToCommand() {
|
||||||
|
if (!this.tree) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const selectedOrActiveNoteIds = this.tree.getSelectedOrActiveNodes().map(node => node.data.noteId);
|
const selectedOrActiveNoteIds = this.tree.getSelectedOrActiveNodes().map(node => node.data.noteId);
|
||||||
|
|
||||||
this.triggerCommand('cloneNoteIdsTo', {noteIds: selectedOrActiveNoteIds});
|
this.triggerCommand('cloneNoteIdsTo', {noteIds: selectedOrActiveNoteIds});
|
||||||
}
|
}
|
||||||
|
|
||||||
async moveNotesToCommand() {
|
async moveNotesToCommand() {
|
||||||
|
if (!this.tree) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const selectedOrActiveBranchIds = this.tree.getSelectedOrActiveNodes().map(node => node.data.branchId);
|
const selectedOrActiveBranchIds = this.tree.getSelectedOrActiveNodes().map(node => node.data.branchId);
|
||||||
|
|
||||||
this.triggerCommand('moveBranchIdsTo', {branchIds: selectedOrActiveBranchIds});
|
this.triggerCommand('moveBranchIdsTo', {branchIds: selectedOrActiveBranchIds});
|
||||||
@ -40,6 +48,10 @@ export default class MainTreeExecutors extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async createNoteAfterCommand() {
|
async createNoteAfterCommand() {
|
||||||
|
if (!this.tree) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const node = this.tree.getActiveNode();
|
const node = this.tree.getActiveNode();
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
Loading…
x
Reference in New Issue
Block a user