From 7bfed1b056d2740cbbb06bd33856bc770d79416b Mon Sep 17 00:00:00 2001 From: nobbo Date: Thu, 24 Nov 2022 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E9=94=AE=E7=9B=98=E6=96=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9B=E4=BF=AE=E6=94=B9=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nobbo --- features/src/main/ets/components/NoteContent.ets | 16 ++++++++-------- .../src/main/ets/components/NoteContentComp.ets | 12 ++++++------ .../ets/components/NoteContentCompPortrait.ets | 15 +++++++++------ .../src/main/ets/MainAbility/MainAbility.ts | 2 +- .../default/src/main/ets/pages/MyNoteHome.ets | 2 +- .../src/main/ets/pages/NoteContentHome.ets | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/features/src/main/ets/components/NoteContent.ets b/features/src/main/ets/components/NoteContent.ets index 6b718f8..f395090 100644 --- a/features/src/main/ets/components/NoteContent.ets +++ b/features/src/main/ets/components/NoteContent.ets @@ -295,14 +295,14 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); // 清单 this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) }) }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.font_style')) @@ -310,7 +310,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); LogUtil.info(TAG, 'editContentDialogCtl start') this.closeEditContentDialog = false this.editContentDialogCtl.open() @@ -318,13 +318,13 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.picture_white')).height(24).width(24) .onClick(async () => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); LogUtil.info(TAG, 'startAbility start') await globalThis.noteContext.startAbilityForResult({ parameters: { uri: "singleselect" }, @@ -356,7 +356,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { @@ -365,7 +365,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) }) }.width(42) @@ -379,7 +379,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) }) }.width(42) diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 28b93ab..8fe0c08 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -498,7 +498,7 @@ export struct ToolBarComp { LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) this.controllerShow.runJavaScript({ script: "saveHtmlContent()" }) //退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); // 清除定时器 if (timeId != undefined) { LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId) @@ -570,7 +570,7 @@ export struct ToolBarComp { // 清单 this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + iinputMethod.getController().stopInputSession(); }) }.width(42) .height(42) @@ -583,7 +583,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.closeEditContentDialog = false this.editContentDialogCtl.open() }) @@ -598,7 +598,7 @@ export struct ToolBarComp { .width(24) .onClick(async () => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); LogUtil.info(TAG, 'startAbility start') await globalThis.noteContext.startAbilityForResult({ parameters: { uri: "singleselect" }, @@ -639,7 +639,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) }) }.width(42) @@ -653,7 +653,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) }) }.width(42) diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets index 458642c..efbc0b8 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -402,11 +402,14 @@ export struct ToolBarComp { RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) { this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites) + this.controllerShow.runJavaScript({ + script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" + }) + // save continue data + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + AppStorage.SetOrCreate('ContinueNote', continueNote) + LogUtil.info(TAG, "ToolBarComp, set continue note success") } - // save continue data - let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(TAG, 'ToolBarComp, set continue note success') }) Image($r('app.media.delete')).height(24).width(24) .onClick(() => { @@ -420,7 +423,7 @@ export struct ToolBarComp { Image($r('app.media.undo')).height(24).width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.undo()" }) }) }.width(42) @@ -432,7 +435,7 @@ export struct ToolBarComp { Image($r('app.media.todo')).height(24).width(24) .onClick(() => { // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" }) }) }.width(42) diff --git a/product/default/src/main/ets/MainAbility/MainAbility.ts b/product/default/src/main/ets/MainAbility/MainAbility.ts index 9554abd..9011f1b 100644 --- a/product/default/src/main/ets/MainAbility/MainAbility.ts +++ b/product/default/src/main/ets/MainAbility/MainAbility.ts @@ -101,7 +101,7 @@ export default class MainAbility extends Ability { onBackground() { LogUtil.info(this.Tag, " onBackground") // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); } onContinue(wantParam: { [key: string]: any }) { diff --git a/product/default/src/main/ets/pages/MyNoteHome.ets b/product/default/src/main/ets/pages/MyNoteHome.ets index 8c252ae..a48f3b3 100644 --- a/product/default/src/main/ets/pages/MyNoteHome.ets +++ b/product/default/src/main/ets/pages/MyNoteHome.ets @@ -151,6 +151,6 @@ export struct MyNoteHomeComp { onBackPress() { LogUtil.info(this.TAG, "onBackPress") // 退出键盘 - inputMethod.getInputMethodController().stopInput(); + inputMethod.getController().stopInputSession(); } } \ No newline at end of file diff --git a/product/default/src/main/ets/pages/NoteContentHome.ets b/product/default/src/main/ets/pages/NoteContentHome.ets index 4370cbc..c409d74 100644 --- a/product/default/src/main/ets/pages/NoteContentHome.ets +++ b/product/default/src/main/ets/pages/NoteContentHome.ets @@ -51,7 +51,7 @@ struct NoteContentHome { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) if (deviceInfo.deviceType !== 'phone' && deviceInfo.deviceType !== 'default') { - inputMethod.getInputMethodController().stopInput() + inputMethod.getController().stopInputSession(); } } -- Gitee