From 8cb270fa472759dd576f81c5e55a4f49764b2f20 Mon Sep 17 00:00:00 2001 From: nobbo Date: Sat, 26 Nov 2022 15:35:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nobbo --- features/src/main/ets/components/CusDialogComp.ets | 5 ----- features/src/main/ets/components/NoteContent.ets | 10 ---------- features/src/main/ets/components/NoteContentComp.ets | 12 +----------- .../main/ets/components/NoteContentCompPortrait.ets | 12 +----------- .../default/src/main/ets/MainAbility/MainAbility.ts | 1 - 5 files changed, 2 insertions(+), 38 deletions(-) diff --git a/features/src/main/ets/components/CusDialogComp.ets b/features/src/main/ets/components/CusDialogComp.ets index fb01bf3..7a5423b 100644 --- a/features/src/main/ets/components/CusDialogComp.ets +++ b/features/src/main/ets/components/CusDialogComp.ets @@ -391,7 +391,6 @@ export struct EditContentDialog { @Consume('SelectedNoteData') selectedNoteData: NoteData private circleColor: string private fontSize: number - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') aboutToAppear() { this.confirm("javascript:RICH_EDITOR.getFontSizes()") @@ -579,7 +578,6 @@ export struct EditContentDialog { .fillColor('#99182431') .onClick(() => { this.editContentDialogCtl.close() - this.closeEditContentDialog = true }) } .height(36) @@ -730,7 +728,6 @@ export struct EditContentDialogPortrait { confirm: (excuteJs: string) => void @State selectFontColor: string = fontColorArray[0] @Consume('SelectedNoteData') selectedNoteData: NoteData - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') private circleColor: string private fontSize: number @@ -748,13 +745,11 @@ export struct EditContentDialogPortrait { .fillColor($r("app.color.font_stylecolor_AD182431")) .onClick(() => { this.editContentDialogCtl.close() - this.closeEditContentDialog = true }) } .height(48) .padding({ left: 24, right: 24 }) - Row({ space: 16 }) { Button({ type: ButtonType.Normal }) { Image($r('app.media.action_bold')) diff --git a/features/src/main/ets/components/NoteContent.ets b/features/src/main/ets/components/NoteContent.ets index 3578d9f..a5d3c2e 100644 --- a/features/src/main/ets/components/NoteContent.ets +++ b/features/src/main/ets/components/NoteContent.ets @@ -44,7 +44,6 @@ var timeID: number @Component export struct NoteContent { - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('NewNote') @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Provide('Issave') issave: number = 0 @@ -211,9 +210,7 @@ export struct NoteContent { clearInterval(timeID) } timeID = setInterval(() => { - if (this.closeEditContentDialog) { this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) - } }, 3000) LogUtil.info(TAG, "setInterval timeID : " + timeID) this.issave = 0 @@ -238,7 +235,6 @@ export struct NoteContent { @Component export struct ToolBarComp { - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') @Consume('SelectedNoteData') selectedNoteData: NoteData @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('Issave') issave: number @@ -249,13 +245,8 @@ export struct ToolBarComp { alignment: DialogAlignment.Bottom, autoCancel: true, customStyle: true, - cancel: this.existApp }) - existApp() { - this.closeEditContentDialog = true - } - confirm(excuteJs: string) { this.controllerShow.runJavaScript({ script: excuteJs }) } @@ -323,7 +314,6 @@ export struct ToolBarComp { // @ts-ignore inputMethod.getController().stopInputSession(); LogUtil.info(TAG, 'editContentDialogCtl start') - this.closeEditContentDialog = false this.editContentDialogCtl.open() }) }.width(42) diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 03eedc1..2e91d38 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -54,7 +54,6 @@ export struct NoteContentComp { @Consume('LastSectionStatus') lastSectionStatus: number @Consume('Issave') issave: number @Consume('Search') search: boolean - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') controllerShow: WebController private editContentFlag = false @State uri1: string = "" @@ -260,9 +259,7 @@ export struct NoteContentComp { clearInterval(timeId) } timeId = setInterval(() => { - if (this.closeEditContentDialog) { this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) - } }, 3000) LogUtil.info(TAG, "setInterval timeId : " + timeId) // save continue data @@ -442,7 +439,6 @@ export struct ToolBarComp { @Consume('Issave') issave: number controllerShow: WebController private context = getContext(this) - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({ builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), alignment: DialogAlignment.Center, @@ -480,14 +476,9 @@ export struct ToolBarComp { builder: EditContentDialog({ confirm: this.confirm.bind(this) }), alignment: DialogAlignment.Bottom, autoCancel: true, - customStyle: true, - cancel: this.exisApp + customStyle: true }) - exisApp() { - this.closeEditContentDialog = true - } - confirm(excuteJs: string) { this.controllerShow.runJavaScript({ script: excuteJs }) } @@ -602,7 +593,6 @@ export struct ToolBarComp { // 退出键盘 // @ts-ignore inputMethod.getController().stopInputSession(); - this.closeEditContentDialog = false this.editContentDialogCtl.open() }) }.width(42) diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets index 82e2d05..7344932 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -56,7 +56,6 @@ export struct NoteContentCompPortrait { @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder") @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Provide('EditModel') editModel: boolean = false - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') controllerShow: WebController private editContentFlag = false @StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0 @@ -211,9 +210,7 @@ export struct NoteContentCompPortrait { } // 添加定时器:3s自动保存 time_id = setInterval(() => { - if (this.closeEditContentDialog) { this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) - } }, 3000) LogUtil.info(TAG, "setInterval time_id : " + time_id) this.editModel = true @@ -585,20 +582,14 @@ export struct EditNoteCompForPortrait { @Consume('SelectedFolderData') selectedFolderData: FolderData @Consume('SelectedNoteData') selectedNoteData: NoteData; @Consume('EditModel') editModel: boolean - @StorageLink('closeEditContentDialog') closeEditContentDialog: boolean = AppStorage.Link('closeEditContentDialog') controllerShow: WebController editContentDialogCtl: CustomDialogController = new CustomDialogController({ builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }), alignment: DialogAlignment.Bottom, autoCancel: true, - customStyle: true, - cancel: this.exissApp + customStyle: true }) - exissApp() { - this.closeEditContentDialog = true - } - confirm(excuteJs: string) { this.controllerShow.runJavaScript({ script: excuteJs }) } @@ -630,7 +621,6 @@ export struct EditNoteCompForPortrait { .height(24) .responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 }) .onClick(() => { - this.closeEditContentDialog = false this.editContentDialogCtl.open() }) Text($r("app.string.style")) diff --git a/product/default/src/main/ets/MainAbility/MainAbility.ts b/product/default/src/main/ets/MainAbility/MainAbility.ts index 4d81612..2689a41 100644 --- a/product/default/src/main/ets/MainAbility/MainAbility.ts +++ b/product/default/src/main/ets/MainAbility/MainAbility.ts @@ -35,7 +35,6 @@ export default class MainAbility extends Ability { LogUtil.info(this.Tag, " getLastWindow:" + windowWidth) this.screenBreakPoints(windowWidth) }) - AppStorage.SetOrCreate('closeEditContentDialog', true) LogUtil.info(this.Tag, " onCreate, launchReason is " + launchParam.launchReason + ", deviceType" + deviceInfo.deviceType) if (deviceInfo.deviceType === 'phone' || deviceInfo.deviceType === 'default') { -- Gitee From e53416acd2035dd806d4814937d6b37a5b323e62 Mon Sep 17 00:00:00 2001 From: nobbo Date: Sat, 26 Nov 2022 15:38:10 +0800 Subject: [PATCH 2/2] bugfix Signed-off-by: nobbo --- features/src/main/ets/components/NoteContentComp.ets | 2 +- features/src/main/ets/components/NoteContentCompPortrait.ets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 2e91d38..42c7d5b 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -476,7 +476,7 @@ export struct ToolBarComp { builder: EditContentDialog({ confirm: this.confirm.bind(this) }), alignment: DialogAlignment.Bottom, autoCancel: true, - customStyle: true + customStyle: true, }) confirm(excuteJs: string) { diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets index 7344932..455c379 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -587,7 +587,7 @@ export struct EditNoteCompForPortrait { builder: EditContentDialogPortrait({ confirm: this.confirm.bind(this) }), alignment: DialogAlignment.Bottom, autoCancel: true, - customStyle: true + customStyle: true, }) confirm(excuteJs: string) { -- Gitee