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