From 13a132ccce46d1131022e3f2e9e3917f4585870b Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Mon, 23 Sep 2024 15:03:55 +0800 Subject: [PATCH] refactor: fix for when not new line --- web/core/lib/editor/action/AiActionExecutor.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/core/lib/editor/action/AiActionExecutor.ts b/web/core/lib/editor/action/AiActionExecutor.ts index 8c8ba74..03ac968 100644 --- a/web/core/lib/editor/action/AiActionExecutor.ts +++ b/web/core/lib/editor/action/AiActionExecutor.ts @@ -63,6 +63,11 @@ export class AiActionExecutor { }) ); + if (buffer.length > 0) { + const pos = actionPosition(action, this.editor.state.selection); + this.editor.chain().focus()?.insertContentAt(pos, buffer).run(); + } + if (this.editor == null) { console.error('editor is not, can not insert content'); return;