From 6ee250dddd8460461ab3a0a628c6e9e3b4105b8d Mon Sep 17 00:00:00 2001 From: zhangjintao Date: Mon, 24 Jun 2024 15:08:53 +0800 Subject: [PATCH] =?UTF-8?q?fixed=208e50f9f=20from=20https://gitee.com/zhan?= =?UTF-8?q?gjintao66/applications=5Fnotes/pulls/269=20=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=A4=87=E5=BF=98=E5=BD=95=EF=BC=8C=E7=82=B9=E5=87=BB=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E7=95=8C=E9=9D=A2=E5=85=89=E6=A0=87=E6=89=94?= =?UTF-8?q?=E5=A4=84=E4=BA=8E=E8=BE=93=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 2c2b642..2c1a5a1 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -506,6 +506,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', () => { if (callBackToApp.getBreakPoint() === 'sm') { document.getElementById('buttonBox').style.display = 'flex'; diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index eab792e..2d29e4a 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 20da32a..f4de231 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -614,6 +614,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') } -- Gitee