From 4b0ca3a8b3636db3e64b650d541e1d4cb4c1ac6b Mon Sep 17 00:00:00 2001 From: zhuhong <1870495044@qq.com> Date: Tue, 29 Mar 2022 11:02:24 +0800 Subject: [PATCH] note update Signed-off-by: zhuhong <1870495044@qq.com> --- .../src/main/ets/default/CusDialogComp.ets | 17 +- .../src/main/ets/default/FolderListComp.ets | 4 +- .../src/main/ets/default/NoteContent.ets | 249 +++++++++--------- .../src/main/ets/default/NoteContentComp.ets | 56 ++-- .../ets/default/NoteContentCompPortrait.ets | 13 +- .../src/main/ets/default/NoteListComp.ets | 8 +- .../model/databaseModel/SysDefData.ets | 13 +- .../main/resources/base/element/color.json | 6 +- .../main/ets/MainAbility/pages/MyNoteHome.ets | 3 +- .../ets/MainAbility/pages/NoteContentHome.ets | 3 - .../MainAbility/pages/NoteHomePortrait.ets | 1 - .../main/resources/base/element/color.json | 6 +- .../src/main/resources/rawfile/editor.html | 3 - .../src/main/resources/rawfile/rich_editor.js | 28 +- .../ets/MainAbility/pages/NoteContentHome.ets | 3 - .../main/resources/base/element/color.json | 6 +- .../resources/base/media/foldMove_select.svg | 4 +- .../src/main/resources/rawfile/editor.html | 3 - .../src/main/resources/rawfile/rich_editor.js | 28 +- 19 files changed, 248 insertions(+), 206 deletions(-) diff --git a/common/component/src/main/ets/default/CusDialogComp.ets b/common/component/src/main/ets/default/CusDialogComp.ets index cb39392..addde37 100644 --- a/common/component/src/main/ets/default/CusDialogComp.ets +++ b/common/component/src/main/ets/default/CusDialogComp.ets @@ -60,7 +60,7 @@ export struct NewOrEditFolderDialog { .maxLength(20) .borderRadius(15) .backgroundColor($r("app.color.New_folder_input_box_color")) - .width('90%') + .width('100%') .onChange((value: string) => { this.inputName = value FolderUtil.duplicateDetection(this.inputName, this.AllFolderArray).then(result => { @@ -69,15 +69,17 @@ export struct NewOrEditFolderDialog { }) }.margin({ bottom: 4, left: 24, right: 24 }) + Divider() + .height(1) + .margin({ left: 64, right: 24 }) + .color((this.isExisted && this.inputName != this.oriInputName) ? $r("app.color.category_already_exist_divider_color"):$r("app.color.divider_color_182431")) + Text($r("app.string.category_already_exist")) .fontSize(10) - .margin({ left: 64 }) + .margin({ left: 64, top: 4 }) .fontColor($r("app.color.category_already_exist_font_color")) .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) - Divider() - .height(1) - .margin({ left: 64, right: 24 }) - .color($r("app.color.divider_color_182431")) + // button group Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { Text($r("app.string.cancel")) @@ -305,6 +307,7 @@ export struct NoteDataMoveDialog { Flex({ alignItems: ItemAlign.Center }) { Text($r("app.string.chooseFolder")) .fontSize(20) + .fontWeight(600) }.height(56) .width(288) @@ -325,7 +328,7 @@ export struct NoteDataMoveDialog { Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text($r("app.string.cancel")) .fontSize(16) - .fontColor($r("app.color.text_color_3f97e9")) + .fontColor($r("app.color.button_color_f86d05")) .onClick(() => { this.noteDataMoveDialogCtl.close() }) diff --git a/common/component/src/main/ets/default/FolderListComp.ets b/common/component/src/main/ets/default/FolderListComp.ets index 725a512..5c5a4bb 100644 --- a/common/component/src/main/ets/default/FolderListComp.ets +++ b/common/component/src/main/ets/default/FolderListComp.ets @@ -362,7 +362,9 @@ struct FolderItemComp { this.selectedFolderData = this.folderItem this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.folderItem.uuid) // 刷新web界面 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) + if (this.portraitModel == false) { + 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) diff --git a/common/component/src/main/ets/default/NoteContent.ets b/common/component/src/main/ets/default/NoteContent.ets index 4ca57ec..3a5c873 100644 --- a/common/component/src/main/ets/default/NoteContent.ets +++ b/common/component/src/main/ets/default/NoteContent.ets @@ -40,6 +40,7 @@ export struct NoteContent { @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get("NewNote") @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Provide('Issave') issave: number = 0 + @Provide('EditModel') editModel: boolean = false controllerShow: WebController private editContentFlag = false @@ -112,12 +113,13 @@ export struct NoteContent { .margin({ top: 16 }) .width(StyleConstants.PERCENTAGE_100) .onClick(() => { - this.issave = 0 // 添加定时器:3s自动保存 timeID = setInterval(() => { this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) }, 3000) LogUtil.info(TAG, "setInterval timeID : " + timeID) + this.issave = 0 + this.editModel = true }) } .height(StyleConstants.PERCENTAGE_100) @@ -141,6 +143,7 @@ export struct ToolBarComp { @Consume('SelectedNoteData') selectedNoteData: NoteData @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('Issave') issave: number + @Consume('EditModel') editModel: boolean controllerShow: WebController editContentDialogCtl: CustomDialogController = new CustomDialogController({ @@ -168,131 +171,141 @@ export struct ToolBarComp { LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID) clearInterval(timeID) } - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); router.back() }) .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) - Row({ space: StyleConstants.SPACE_6 }) { - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.circle_tick1')) - .height(24) - .width(24) - .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - // 清单 - this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) - }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.font_style')) - .height(24) - .width(24) + if (this.editModel == false) { + Row({ space: StyleConstants.SPACE_24 }) { + Image(this.selectedNoteData.is_favorite == Favorite.Yes ? $r('app.media.favorite') : $r('app.media.favorite_cancel')) + .height(24).width(24) .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - LogUtil.info(TAG, 'editContentDialogCtl start') - this.editContentDialogCtl.open() + this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes) + // update note to db + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.picture_white')).height(24).width(24) - .onClick(async () => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - LogUtil.info(TAG, 'startAbility start') - AppStorage.SetOrCreate('openPhoto', 1) - await globalThis.noteContext.startAbilityForResult({ - parameters: { uri: "singleselect" }, - bundleName: "com.ohos.photos", - abilityName: "com.ohos.photos.MainAbility", + }.width(36) + .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) + } else { + Row({ space: StyleConstants.SPACE_6 }) { + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.circle_tick1')) + .height(24) + .width(24) + .onClick(() => { + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + // 清单 + this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) }) - .then(v => { - AppStorage.SetOrCreate('openPhoto', 0) - let want = v['want']; - if (want != null && want != undefined) { - let param = want['parameters']; - let imageUri = "" - if (param != null && param != undefined) { - let uri = param['select-item-list']; - imageUri = uri; - } - // 拷贝 - if(imageUri != null && imageUri != "") { - OperationUtils.copy(imageUri).then((uriPath) => { - var path = "file://" + uriPath - LogUtil.info(TAG, 'image uri is:' + path) - this.controllerShow.runJavaScript({script:"javascript:RICH_EDITOR.insertImage('" + path + "')"}) - }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.font_style')) + .height(24) + .width(24) + .onClick(() => { + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + LogUtil.info(TAG, 'editContentDialogCtl start') + this.editContentDialogCtl.open() + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.picture_white')).height(24).width(24) + .onClick(async () => { + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + LogUtil.info(TAG, 'startAbility start') + AppStorage.SetOrCreate('openPhoto', 1) + await globalThis.noteContext.startAbilityForResult({ + parameters: { uri: "singleselect" }, + bundleName: "com.ohos.photos", + abilityName: "com.ohos.photos.MainAbility", + }) + .then(v => { + AppStorage.SetOrCreate('openPhoto', 0) + let want = v['want']; + if (want != null && want != undefined) { + let param = want['parameters']; + let imageUri = "" + if (param != null && param != undefined) { + let uri = param['select-item-list']; + imageUri = uri; + } + // 拷贝 + if(imageUri != null && imageUri != "") { + OperationUtils.copy(imageUri).then((uriPath) => { + var path = "file://" + uriPath + LogUtil.info(TAG, 'image uri is:' + path) + this.controllerShow.runJavaScript({script:"javascript:RICH_EDITOR.insertImage('" + path + "')"}) + }) + } } - } - }); - }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.tick_thick')) - .height(24) - .width(24) - .fillColor(this.issave == 0 ? Color.Black : Color.Grey) - .onClick(() => { - this.issave = 1 - // 清除定时器 - if (timeID != undefined) { - LogUtil.info(TAG, "tick_thick, clearInterval timeID : " + timeID) - clearInterval(timeID) - } - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) - }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.undo')) - .height(24) - .width(24) - .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) - }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - - Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.todo')) - .height(24) - .width(24) - .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) - }) - }.width(42) - .height(42) - .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) - }.width(274) + }); + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.undo')) + .height(24) + .width(24) + .onClick(() => { + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.todo')) + .height(24) + .width(24) + .onClick(() => { + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Image($r('app.media.tick_thick')) + .height(24) + .width(24) + .fillColor(this.issave == 0 ? Color.Black : Color.Grey) + .onClick(() => { + this.issave = 1 + // 保存笔记信息到数据库 + this.controllerShow.runJavaScript({ script: "get_html_content()" }) + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + }.width(274) + } } .width(StyleConstants.PERCENTAGE_100) .height(80) diff --git a/common/component/src/main/ets/default/NoteContentComp.ets b/common/component/src/main/ets/default/NoteContentComp.ets index 7aca880..54bc430 100644 --- a/common/component/src/main/ets/default/NoteContentComp.ets +++ b/common/component/src/main/ets/default/NoteContentComp.ets @@ -113,7 +113,7 @@ export struct NoteContentComp { } Column() { - NoteContentOverViewComp() + NoteContentOverViewComp({ controllerShow: this.controllerShow }) Text(this.refreshFlag.toString()).visibility(Visibility.None) Text(this.AllNoteArray.length.toString()).visibility(Visibility.None) // 用于强制刷新使用 @@ -146,12 +146,14 @@ export struct NoteContentComp { .enabled(this.selectedNoteData.is_deleted == Delete.Yes ? false : true) .onClick(() => { this.issave = 0 + LogUtil.info(TAG, "editModel : " + this.editModel + ", sectionStatus : " + this.sectionStatus) + let isContinue = AppStorage.Get('IsContinue') + LogUtil.info(TAG, "isContinue : " + isContinue) // 点击第三屏进入全屏编辑模式 - if (this.sectionStatus != 1) { + if (this.sectionStatus != 1 || isContinue) { this.lastSectionStatus = this.sectionStatus this.sectionStatus = 1 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) - this.editModel = !this.editModel // 添加定时器:3s自动保存 timeId = setInterval(() => { this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) @@ -160,6 +162,8 @@ export struct NoteContentComp { // save continue data AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) LogUtil.info(TAG, "set continue section success") + this.editModel = !this.editModel + AppStorage.SetOrCreate('IsContinue', false) } }) } @@ -186,9 +190,12 @@ export struct NoteContentOverViewComp { @Consume('SelectedNoteData') selectedNoteData: NoteData @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('SelectedFolderData') selectedFolderData: FolderData @Consume('EditModel') editModel: boolean @Consume('SectionStatus') sectionStatus: number @Consume('RefreshFlag') refreshFlag: number + controllerShow: WebController editTitleDialogCtl: CustomDialogController = new CustomDialogController({ builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), alignment: DialogAlignment.Center, @@ -216,7 +223,13 @@ export struct NoteContentOverViewComp { let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid) + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + // save continue data + let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) + AppStorage.SetOrCreate('ContinueNote', continueNote) + LogUtil.info(TAG, "NoteContentOverViewComp, MenuBuilder, set continue note success") }) }, noteItem => noteItem.uuid) }.listDirection(Axis.Vertical) @@ -342,8 +355,6 @@ export struct ToolBarComp { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) } else { if (this.lastSectionStatus != undefined) { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); // 切换为小屏预览模式 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) // 退出全屏时存库 @@ -403,15 +414,10 @@ export struct ToolBarComp { .height(24) .width(24) .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); // 清单 this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) - // 清除定时器 - if (timeId != undefined) { - LogUtil.info(TAG, "circle_tick1, clearInterval timeId : " + timeId) - clearInterval(timeId) - } + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); }) }.width(42) .height(42) @@ -441,20 +447,15 @@ export struct ToolBarComp { .borderRadius(8) .backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.tick_thick')) + Image($r('app.media.undo')) .height(24) .width(24) - .fillColor(this.issave == 0 ? Color.Black : Color.Grey) .onClick(() => { // 退出键盘 inputMethod.getInputMethodController().stopInput(); - this.issave = 1 - // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) - if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { - LogUtil.info(TAG, "note is empty,save note failed") - } + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) }) }.width(42) .height(42) @@ -462,27 +463,34 @@ export struct ToolBarComp { .backgroundColor($r('app.color.color_ffffff')) Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.undo')) + Image($r('app.media.todo')) .height(24) .width(24) .onClick(() => { // 退出键盘 inputMethod.getInputMethodController().stopInput(); - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.undo()" }) + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) }) }.width(42) .height(42) .borderRadius(8) .backgroundColor($r('app.color.color_ffffff')) + Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.todo')) + Image($r('app.media.tick_thick')) .height(24) .width(24) + .fillColor(this.issave == 0 ? Color.Black : Color.Grey) .onClick(() => { + // 保存笔记信息到数据库 + this.controllerShow.runJavaScript({ script: "get_html_content()" }) + if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { + LogUtil.info(TAG, "note is empty,save note failed") + } + this.issave = 1 // 退出键盘 inputMethod.getInputMethodController().stopInput(); - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) }) }.width(42) .height(42) diff --git a/common/component/src/main/ets/default/NoteContentCompPortrait.ets b/common/component/src/main/ets/default/NoteContentCompPortrait.ets index 3487509..52b1d39 100644 --- a/common/component/src/main/ets/default/NoteContentCompPortrait.ets +++ b/common/component/src/main/ets/default/NoteContentCompPortrait.ets @@ -111,12 +111,12 @@ export struct NoteContentCompPortrait { .width('100%') } .onClick(() => { - this.editModel = true // 添加定时器:3s自动保存 time_id = setInterval(() => { this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) }, 3000) LogUtil.info(TAG, "setInterval time_id : " + time_id) + this.editModel = true }) .margin({ top: 16 }) .width(StyleConstants.PERCENTAGE_100) @@ -251,8 +251,6 @@ export struct ToolBarComp { LogUtil.info(TAG, "back, clearInterval time_id : " + time_id) clearInterval(time_id) } - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); router.back() }) @@ -305,16 +303,11 @@ export struct ToolBarComp { Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.tick_thin')).height(24).width(24) .onClick(() => { - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); // 保存笔记信息到数据库 this.controllerShow.runJavaScript({ script: "get_html_content()" }) this.editModel = false - // 清除定时器 - if (time_id != undefined) { - LogUtil.info(TAG, "tick_thin, clearInterval time_id : " + time_id) - clearInterval(time_id) - } + // 退出键盘 + inputMethod.getInputMethodController().stopInput(); }) }.width(42) .height(42) diff --git a/common/component/src/main/ets/default/NoteListComp.ets b/common/component/src/main/ets/default/NoteListComp.ets index 62244e4..990429d 100644 --- a/common/component/src/main/ets/default/NoteListComp.ets +++ b/common/component/src/main/ets/default/NoteListComp.ets @@ -313,6 +313,7 @@ export struct NoteItemListComp { @Consume @Watch('doSearch') inputKeyword: string @Consume('SearchResultList') searchResultList: NoteData[] @Consume('SelectedNoteData') selectedNoteData: NoteData + @Consume('PortraitModel') portraitModel:boolean controllerShow: WebController doSearch() { @@ -325,7 +326,9 @@ export struct NoteItemListComp { } else { this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) } - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) + if(this.portraitModel == false) { + 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) @@ -419,6 +422,9 @@ export struct OperateNoteComp { RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) }) this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, this.selectedFolderData.uuid) + if(this.portraitModel == false) { + this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) + } this.longpress = false this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) diff --git a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets index 704c427..3f9c2fa 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets @@ -146,12 +146,7 @@ export default { "title": "旅游心得", "uuid": "note3_uuid", "folder_uuid": SysDefFolderUuid.Work, - "content_text": '

出门在外首要是安全问题,不然命都没有了还谈什么?其次是身上的财物,要知道,你一到某地,身上的行李很容易被狼盯上。' + - '背着旅行袋的人到那里都是任人宰割的对象,所以不要完成全相信陌生人的话,也不要走行人稀少的小道,方便的话最好是将包裹就近寄存,免去这道危险。' + - '同时在身上相对安全的地方保留贴身的救命钱,狡兔三窟,千万不要将开心的旅游变成伤心的流浪!

' + - '

出门在外要想整个旅程无遗憾,关键是心态。首先要对即将到的目的地有一个正确的认识和恰当的期望。

' + - '

一般每个自然风景区旅游区都有着自己的特色,带著一种游九寨沟桂林山水的心情和期望去陕西的人肯定会失望而归。' + - '同样带着游西部的心情和期望去海南.桂林你也会觉得那里也没有什么,只不过山和水比别的地方特别一点。

', + "content_text": '

要想整个旅程无遗憾,关键是心态。首先要对即将到的目的地有一个正确的认识和恰当的期望。

', "content_img": "", "note_type": NoteType.SysDef, "is_top": Top.No, @@ -172,9 +167,9 @@ export default { '  糖60g
' + '' + '  玉米油40g
' + - '
    1. 准备小盆打入三个鸡蛋,加盐加糖,蛋糕粉分两次加入蛋糊内。
' + - '    2. 玉米油倒入碗里,再加入牛奶,用打蛋器打到完全融为一体,烤箱预热15分钟。
' + - '    3. 再加入葡萄干、核桃仁,把蛋糕放进烤箱,定时40分钟,取出即可食用。

' + + '
    1. 添加鸡蛋、盐、糖、蛋糕粉
' + + '    2. 加入玉米油、牛奶,烤箱预热15分钟
' + + '    3. 加入葡萄干、核桃仁,烤箱定时40分钟

' + '


', "content_img": "/res/cake.png", "note_type": NoteType.CusDef, diff --git a/product/pc/src/main/resources/base/element/color.json b/product/pc/src/main/resources/base/element/color.json index 02771c3..9576e70 100644 --- a/product/pc/src/main/resources/base/element/color.json +++ b/product/pc/src/main/resources/base/element/color.json @@ -84,6 +84,10 @@ "name": "category_already_exist_font_color", "value": "#FA2A2D" }, + { + "name": "category_already_exist_divider_color", + "value": "#FA2A2D" + }, { "name": "create_folder_bg_color", "value": "#FFFFFF" @@ -158,7 +162,7 @@ }, { "name": "Recently_delete_prompt_font_color", - "value": "#18181A" + "value": "#99182431" }, { "name": "Empty_page_font_color", diff --git a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets index eb9a721..ff7b4ae 100644 --- a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets +++ b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -27,14 +27,13 @@ export struct MyNoteHomeComp { @StorageLink('DBQueryFinished') dBQueryFinished: number = 0 @Provide('PortraitModel') portraitModel: boolean = true @Provide('RefreshFlag') refreshFlag: number = 0 - private controllerShow: WebController = new WebController() private context = getContext(this) TAG = "MyNoteHomeComp" build() { Flex() { if (this.dBQueryFinished == 1) { - NoteHomePortraitComp({ controllerShow: this.controllerShow }) + NoteHomePortraitComp() } } .width('100%').height('100%') diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets b/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets index 06d5c2e..aeb1330 100644 --- a/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets +++ b/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets @@ -38,8 +38,5 @@ struct NoteContentHome { LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.controllerShow.runJavaScript({ script: "get_html_content()" }) - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); } - } \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets index 79772b7..9960800 100644 --- a/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets +++ b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets @@ -50,7 +50,6 @@ export struct NoteHomePortraitComp { @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 @Provide('SelectedAll') selectedAll:boolean = false; @Provide('EditModel') editModel: boolean = false - controllerShow: WebController TAG = "NoteHomeComp" diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json index 23674b8..76374a3 100644 --- a/product/phone/src/main/resources/base/element/color.json +++ b/product/phone/src/main/resources/base/element/color.json @@ -100,6 +100,10 @@ "name": "category_already_exist_font_color", "value": "#FA2A2D" }, + { + "name": "category_already_exist_divider_color", + "value": "#FA2A2D" + }, { "name": "create_folder_bg_color", "value": "#FFFFFF" @@ -174,7 +178,7 @@ }, { "name": "Recently_delete_prompt_font_color", - "value": "#18181A" + "value": "#99182431" }, { "name": "Empty_page_font_color", diff --git a/product/phone/src/main/resources/rawfile/editor.html b/product/phone/src/main/resources/rawfile/editor.html index 5daf07b..b1d03d8 100644 --- a/product/phone/src/main/resources/rawfile/editor.html +++ b/product/phone/src/main/resources/rawfile/editor.html @@ -4,9 +4,6 @@ "editorJs" - diff --git a/product/phone/src/main/resources/rawfile/rich_editor.js b/product/phone/src/main/resources/rawfile/rich_editor.js index 3590ccb..ee14669 100644 --- a/product/phone/src/main/resources/rawfile/rich_editor.js +++ b/product/phone/src/main/resources/rawfile/rich_editor.js @@ -57,7 +57,7 @@ RICH_EDITOR.setUnderline = function() { document.execCommand('underline', false, null); } -RICH_EDITOR.setStart = function () { +RICH_EDITOR.getListStyle = function () { var selection, type; if (window.getSelection) { selection = getSelection(); @@ -70,12 +70,12 @@ RICH_EDITOR.setStart = function () { if (child.nodeName == "OL") { console.info('insertOrderedList') document.execCommand('insertOrderedList', false, null); - break; + return child.style["list-style"] } if (child.nodeName == "UL") { console.info('insertUnorderedList') document.execCommand('insertUnorderedList', false, null); - break; + return child.style["list-style"] } if (child.parentNode) { child = child.parentNode @@ -85,11 +85,14 @@ RICH_EDITOR.setStart = function () { } } -} +} RICH_EDITOR.setNumbers = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "decimal") { + return + } document.execCommand('insertOrderedList', false, null); var selection, type; if (window.getSelection) { @@ -115,7 +118,10 @@ RICH_EDITOR.setNumbers = function () { } RICH_EDITOR.setABC = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "lower-alpha") { + return + } document.execCommand('insertOrderedList', false, null); var selection, type; if (window.getSelection) { @@ -141,7 +147,10 @@ RICH_EDITOR.setABC = function () { } RICH_EDITOR.setBullets = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "disc") { + return + } document.execCommand('insertUnorderedList', false, null); var selection, type; if (window.getSelection) { @@ -167,7 +176,10 @@ RICH_EDITOR.setBullets = function () { } RICH_EDITOR.setSquare = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "square") { + return + } document.execCommand('insertUnorderedList', false, null); var selection, type; if (window.getSelection) { diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets index aca088c..fcbffb5 100644 --- a/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets @@ -37,8 +37,5 @@ struct NoteContentHome { LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.controllerShow.runJavaScript({ script: "get_html_content()" }) - // 退出键盘 - inputMethod.getInputMethodController().stopInput(); } - } \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/element/color.json b/product/tablet/src/main/resources/base/element/color.json index 23674b8..76374a3 100644 --- a/product/tablet/src/main/resources/base/element/color.json +++ b/product/tablet/src/main/resources/base/element/color.json @@ -100,6 +100,10 @@ "name": "category_already_exist_font_color", "value": "#FA2A2D" }, + { + "name": "category_already_exist_divider_color", + "value": "#FA2A2D" + }, { "name": "create_folder_bg_color", "value": "#FFFFFF" @@ -174,7 +178,7 @@ }, { "name": "Recently_delete_prompt_font_color", - "value": "#18181A" + "value": "#99182431" }, { "name": "Empty_page_font_color", diff --git a/product/tablet/src/main/resources/base/media/foldMove_select.svg b/product/tablet/src/main/resources/base/media/foldMove_select.svg index 6b7b9d1..f02ccc3 100644 --- a/product/tablet/src/main/resources/base/media/foldMove_select.svg +++ b/product/tablet/src/main/resources/base/media/foldMove_select.svg @@ -3,10 +3,10 @@ diff --git a/product/tablet/src/main/resources/rawfile/editor.html b/product/tablet/src/main/resources/rawfile/editor.html index 5daf07b..b1d03d8 100644 --- a/product/tablet/src/main/resources/rawfile/editor.html +++ b/product/tablet/src/main/resources/rawfile/editor.html @@ -4,9 +4,6 @@ "editorJs" - diff --git a/product/tablet/src/main/resources/rawfile/rich_editor.js b/product/tablet/src/main/resources/rawfile/rich_editor.js index 3590ccb..ee14669 100644 --- a/product/tablet/src/main/resources/rawfile/rich_editor.js +++ b/product/tablet/src/main/resources/rawfile/rich_editor.js @@ -57,7 +57,7 @@ RICH_EDITOR.setUnderline = function() { document.execCommand('underline', false, null); } -RICH_EDITOR.setStart = function () { +RICH_EDITOR.getListStyle = function () { var selection, type; if (window.getSelection) { selection = getSelection(); @@ -70,12 +70,12 @@ RICH_EDITOR.setStart = function () { if (child.nodeName == "OL") { console.info('insertOrderedList') document.execCommand('insertOrderedList', false, null); - break; + return child.style["list-style"] } if (child.nodeName == "UL") { console.info('insertUnorderedList') document.execCommand('insertUnorderedList', false, null); - break; + return child.style["list-style"] } if (child.parentNode) { child = child.parentNode @@ -85,11 +85,14 @@ RICH_EDITOR.setStart = function () { } } -} +} RICH_EDITOR.setNumbers = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "decimal") { + return + } document.execCommand('insertOrderedList', false, null); var selection, type; if (window.getSelection) { @@ -115,7 +118,10 @@ RICH_EDITOR.setNumbers = function () { } RICH_EDITOR.setABC = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "lower-alpha") { + return + } document.execCommand('insertOrderedList', false, null); var selection, type; if (window.getSelection) { @@ -141,7 +147,10 @@ RICH_EDITOR.setABC = function () { } RICH_EDITOR.setBullets = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "disc") { + return + } document.execCommand('insertUnorderedList', false, null); var selection, type; if (window.getSelection) { @@ -167,7 +176,10 @@ RICH_EDITOR.setBullets = function () { } RICH_EDITOR.setSquare = function () { - RICH_EDITOR.setStart() + let listStyle = RICH_EDITOR.getListStyle() + if(listStyle == "square") { + return + } document.execCommand('insertUnorderedList', false, null); var selection, type; if (window.getSelection) { -- Gitee