From 6ef468adc49cc29fc89c4f03bada624dc084f886 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 20 Sep 2025 11:37:57 +0300 Subject: [PATCH] chore(react/type_widget): bring back scroll to end --- apps/client/src/widgets/note_detail.ts.bak | 14 -------------- apps/client/src/widgets/type_widgets/code/Code.tsx | 7 +++++++ .../type_widgets_old/abstract_code_type_widget.ts | 5 ----- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/apps/client/src/widgets/note_detail.ts.bak b/apps/client/src/widgets/note_detail.ts.bak index 8b6610201..b85c7263d 100644 --- a/apps/client/src/widgets/note_detail.ts.bak +++ b/apps/client/src/widgets/note_detail.ts.bak @@ -149,20 +149,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget { widget.focus(); } - async scrollToEndEvent({ ntxId }: EventData<"scrollToEnd">) { - if (this.noteContext?.ntxId !== ntxId) { - return; - } - - await this.refresh(); - const widget = this.getTypeWidget(); - await widget.initialized; - - if (widget.scrollToEnd) { - widget.scrollToEnd(); - } - } - async beforeNoteSwitchEvent({ noteContext }: EventData<"beforeNoteSwitch">) { if (this.isNoteContext(noteContext.ntxId)) { await this.spacedUpdate.updateNowIfNecessary(); diff --git a/apps/client/src/widgets/type_widgets/code/Code.tsx b/apps/client/src/widgets/type_widgets/code/Code.tsx index e78d86948..731141f4a 100644 --- a/apps/client/src/widgets/type_widgets/code/Code.tsx +++ b/apps/client/src/widgets/type_widgets/code/Code.tsx @@ -131,6 +131,13 @@ function CodeEditor({ note, parentComponent, ntxId, containerRef: externalContai resolve(refToJQuerySelector(containerRef)); }); + useTriliumEvent("scrollToEnd", () => { + const editor = codeEditorRef.current; + if (!editor) return; + editor.scrollToEnd(); + editor.focus(); + }); + return