From e4b5aa5e72cca6dd51e9acf28017cde4233b5cc6 Mon Sep 17 00:00:00 2001 From: aaravkumar Date: Mon, 2 Jun 2025 10:34:03 -0400 Subject: added separate /ask toggle for prompts menu --- .../views/nodes/formattedText/DailyJournal.tsx | 41 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/formattedText/DailyJournal.tsx b/src/client/views/nodes/formattedText/DailyJournal.tsx index fc7290988..ae5582ef7 100644 --- a/src/client/views/nodes/formattedText/DailyJournal.tsx +++ b/src/client/views/nodes/formattedText/DailyJournal.tsx @@ -20,6 +20,8 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() @observable isLoadingPrompts: boolean = false; // track if prompts are loading @observable showPromptMenu = false; @observable inlinePromptsEnabled = true; + @observable askPromptsEnabled = true; + _ref = React.createRef(); // reference to the formatted textbox @@ -105,6 +107,13 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() @action.bound toggleInlinePrompts() { this.inlinePromptsEnabled = !this.inlinePromptsEnabled; } + + /** + * Method to toggle on/off inline /ask prompts + */ + @action.bound toggleAskPrompts() { + this.askPromptsEnabled = !this.askPromptsEnabled; + } /** * Method to handle click on document (to close prompt menu) @@ -164,7 +173,7 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() // characters before cursor const triggerText = state.doc.textBetween(Math.max(0, cursorPos - 4), cursorPos); - if (triggerText === '/ask') { + if (triggerText === '/ask' && this.askPromptsEnabled) { // remove /ask text const tr = state.tr.delete(cursorPos - 4, cursorPos); editorView.dispatch(tr); @@ -187,7 +196,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() */ @action insertPredictiveQuestion = async () => { - // if (!this.inlinePromptsEnabled) return; const editorView = this._ref.current?.EditorView; if (!editorView) return; @@ -452,6 +460,34 @@ export class DailyJournal extends ViewBoxAnnotatableComponent() overflow: 'auto', }} > +
+ +
+
() style={{ margin: 0 }} /> -