chore(client/ts): port components/note_context

This commit is contained in:
Elian Doran
2024-12-23 15:16:41 +02:00
parent c06dc23ecf
commit 8a47b2f5a8
7 changed files with 85 additions and 38 deletions

View File

@@ -22,6 +22,7 @@ import { Node } from "../services/tree.js";
import LoadResults from "../services/load_results.js";
import { Attribute } from "../services/attribute_parser.js";
import NoteTreeWidget from "../widgets/note_tree.js";
import { GetTextEditorCallback } from "./note_context.js";
interface Layout {
getRootWidget: (appContext: AppContext) => RootWidget;
@@ -39,7 +40,7 @@ interface BeforeUploadListener extends Component {
* Base interface for the data/arguments for a given command (see {@link CommandMappings}).
*/
export interface CommandData {
ntxId?: string;
ntxId?: string | null;
}
/**
@@ -59,6 +60,10 @@ export interface NoteCommandData extends CommandData {
viewScope?: ViewScope;
}
export interface ExecuteCommandData extends CommandData {
resolve: unknown;
}
/**
* The keys represent the different commands that can be triggered via {@link AppContext#triggerCommand} (first argument), and the values represent the data or arguments definition of the given command. All data for commands must extend {@link CommandData}.
*/
@@ -130,6 +135,12 @@ export type CommandMappings = {
executeInActiveNoteDetailWidget: CommandData & {
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void
};
executeWithTextEditor: CommandData & ExecuteCommandData & {
callback?: GetTextEditorCallback;
};
executeWithCodeEditor: CommandData & ExecuteCommandData;
executeWithContentElement: CommandData & ExecuteCommandData;
executeWithTypeWidget: CommandData & ExecuteCommandData;
addTextToActiveEditor: CommandData & {
text: string;
};
@@ -181,8 +192,7 @@ type EventMappings = {
};
addNewLabel: CommandData;
addNewRelation: CommandData;
sqlQueryResults: {
ntxId: string;
sqlQueryResults: CommandData & {
results: SqlExecuteResults;
}
}