From 8e50f9f9a46f2262020f28c331fd9c8eb321499a Mon Sep 17 00:00:00 2001 From: zhangjintao Date: Mon, 24 Jun 2024 15:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=A4=87=E5=BF=98=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E5=AE=8C=E6=88=90=EF=BC=8C=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=85=89=E6=A0=87=E6=89=94=E5=A4=84=E4=BA=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangjintao --- common/resources/src/main/resources/rawfile/rich_editor.js | 4 ++++ features/src/main/ets/components/NoteContentComp.ets | 1 + features/src/main/ets/components/NoteContentCompPortrait.ets | 1 + 3 files changed, 6 insertions(+) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 7c87f5d..119d9f4 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -508,6 +508,10 @@ RICH_EDITOR.getFocus = function () { return document.getElementById('editorjs_box').focus(); } +RICH_EDITOR.getBlur = function () { + return document.getElementById('editorjs_box').blur(); +} + document.getElementById('editorjs_box').addEventListener('click', () => { document.getElementById('buttonBox').style.display = 'flex'; }) \ No newline at end of file diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index be331c1..e1f3e95 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -757,6 +757,7 @@ export struct ToolBarComp { .onClick(() => { // 保存笔记信息到数据库 this.controllerShow.runJavaScript("getHtmlContent()") + this.controllerShow.runJavaScript("javascript:RICH_EDITOR.getBlur()") if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { LogUtil.info(TAG, "note is empty,save note failed") } diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets index e5ef28d..f7cf8c9 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -616,6 +616,7 @@ export struct ToolBarComp { // 保存笔记信息到数据库 this.controllerShow.runJavaScript("getHtmlContent()") this.editModel = false + this.controllerShow.runJavaScript("javascript:RICH_EDITOR.getBlur()") } catch (error) { LogUtil.info(TAG, 'tick_thin error') }