aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraaravkumar <aarav.kumar1510@gmail.com>2025-06-02 10:34:03 -0400
committeraaravkumar <aarav.kumar1510@gmail.com>2025-06-02 10:34:03 -0400
commite4b5aa5e72cca6dd51e9acf28017cde4233b5cc6 (patch)
tree09999c20b46320a56eb267eecb98ed44b06f112f
parent025b55a5a8fe8e37a67713d3b0bbcfeea0899c5e (diff)
added separate /ask toggle for prompts menu
-rw-r--r--src/client/views/nodes/formattedText/DailyJournal.tsx41
1 files changed, 38 insertions, 3 deletions
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<FieldViewProps>()
@observable isLoadingPrompts: boolean = false; // track if prompts are loading
@observable showPromptMenu = false;
@observable inlinePromptsEnabled = true;
+ @observable askPromptsEnabled = true;
+
_ref = React.createRef<FormattedTextBox>(); // reference to the formatted textbox
@@ -105,6 +107,13 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
@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<FieldViewProps>()
// 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<FieldViewProps>()
*/
@action insertPredictiveQuestion = async () => {
- // if (!this.inlinePromptsEnabled) return;
const editorView = this._ref.current?.EditorView;
if (!editorView) return;
@@ -470,6 +478,34 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
width: '100%',
}}
>
+ /ask
+ <input
+ type="checkbox"
+ checked={this.askPromptsEnabled}
+ onChange={this.toggleAskPrompts}
+ style={{ margin: 0 }}
+ />
+ </label>
+ </div>
+
+ <div
+ style={{
+ display: 'flex',
+ justifyContent: 'flex-end',
+ alignItems: 'center',
+ marginBottom: '10px',
+ }}
+ >
+ <label
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ gap: '6px',
+ fontSize: '14px',
+ justifyContent: 'flex-end',
+ width: '100%',
+ }}
+ >
Inline Prompting
<input
type="checkbox"
@@ -478,7 +514,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
style={{ margin: 0 }}
/>
</label>
-
</div>
<button