diff --git a/common/component/src/main/ets/default/CusDialogComp.ets b/common/component/src/main/ets/default/CusDialogComp.ets index 959e2dade5c8ce76224032a2a0999eec84cc433a..c0a449eb4e43564056ffe8dc18378fa87cf4f1d5 100644 --- a/common/component/src/main/ets/default/CusDialogComp.ets +++ b/common/component/src/main/ets/default/CusDialogComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -59,7 +59,7 @@ export struct NewOrEditFolderDialog { .placeholderFont({ size: 18 }) .maxLength(20) .borderRadius(15) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.New_folder_input_box_color")) .width('90%') .onChange((value: string) => { this.inputName = value @@ -72,9 +72,10 @@ export struct NewOrEditFolderDialog { Text($r("app.string.category_already_exist")) .fontSize(10) .margin({ left: 64 }) - .fontColor("#FA2A2D") + .fontColor($r("app.color.category_already_exist_font_color")) .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) - Divider().height(1) + Divider() + .height(1) .margin({ left: 64, right: 24 }) .color($r("app.color.divider_color_182431")) // button group @@ -114,7 +115,7 @@ export struct NewOrEditFolderDialog { } .width(336) .borderRadius(36) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.create_folder_bg_color")) .alignItems(HorizontalAlign.Start) .margin({ bottom: 16, left: 12, right: 12 }) } @@ -242,7 +243,7 @@ export struct DeleteDialog { .height(117) .borderRadius(36) .padding({ top: 24, bottom: 16, left: 16, right: 16 }) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.delete_note_bg_color")) .margin({ bottom: 16, left: 12, right: 12 }) } } @@ -335,7 +336,7 @@ export struct NoteDataMoveDialog { .borderRadius(36) .height(this.AllFolderArray.length > 12 ? 616 : (this.AllFolderArray.length - 1) * 56) .padding({ left: 24, right: 24 }) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.choose_folder_bg_color")) .margin({ bottom: 16, left: 12, right: 12 }) } } @@ -344,7 +345,7 @@ export struct NoteDataMoveDialog { export struct EditContentDialog { editContentDialogCtl: CustomDialogController confirm: (excuteJs: string) => void - @Consume('SelectedColor') selectedColor: string + @State selectFontColor: string = fontColorArray[0] @State inSetValue: number = 20 private circleColor: string private fontSize: number @@ -540,10 +541,10 @@ export struct EditContentDialog { .fill(colorStr) Circle({ width: 12, height: 12 }) .fill($r("app.color.color_ffffff")) - .visibility(colorStr == this.selectedColor ? Visibility.Visible : Visibility.None) + .visibility(colorStr == this.selectFontColor ? Visibility.Visible : Visibility.None) }.onClick(() => { - this.selectedColor = colorStr - this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectedColor + "')") + this.selectFontColor = colorStr + this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectFontColor + "')") }) }, colorStr => colorStr) }.padding({ bottom: 11 }) @@ -618,7 +619,7 @@ export struct EditTitleDialog { .placeholderFont({ size: 18 }) .maxLength(20) .borderRadius(15) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.title_input_bg_color")) .width('90%') .onChange((value: string) => { this.inputName = value @@ -657,7 +658,7 @@ export struct EditTitleDialog { } .width(336) .borderRadius(36) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.Edit_title_bg_color")) .alignItems(HorizontalAlign.Start) .margin({ bottom: 16, left: 12, right: 12 }) } @@ -667,13 +668,11 @@ export struct EditTitleDialog { export struct EditContentDialogPortrait { editContentDialogCtl: CustomDialogController; confirm: (excuteJs: string) => void - @Consume('SelectedColor') selectedColor: string; + @State selectFontColor: string = fontColorArray[0] @State inSetValue: number = 20 private circleColor: string private fontSize: number - - build() { Column() { Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, @@ -851,10 +850,10 @@ export struct EditContentDialogPortrait { Stack({ alignContent: Alignment.Center }) { Circle({ width: 24, height: 24 }).fill(colorStr) Circle({ width: 12, height: 12 }).fill($r("app.color.color_ffffff")) - .visibility(colorStr == this.selectedColor ? Visibility.Visible : Visibility.None) + .visibility(colorStr == this.selectFontColor ? Visibility.Visible : Visibility.None) }.onClick(() => { - this.selectedColor = colorStr - this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectedColor + "')") + this.selectFontColor = colorStr + this.confirm("javascript:RICH_EDITOR.setTextColor('" + this.selectFontColor + "')") }) }, colorStr => colorStr) } diff --git a/common/component/src/main/ets/default/FolderListComp.ets b/common/component/src/main/ets/default/FolderListComp.ets index a1f6d7f804209ae001774815f59a33c5718afdb6..56199f62546d4ab29482a62e35fd34f3875b865e 100644 --- a/common/component/src/main/ets/default/FolderListComp.ets +++ b/common/component/src/main/ets/default/FolderListComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,6 +41,7 @@ export struct FolderListComp { .onClick(() => { if (this.sectionStatus == 1) { this.expandStatus = !this.expandStatus + AppStorage.SetOrCreate('ContinueExpand', this.expandStatus) } else { this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) // 迁移 @@ -232,11 +233,9 @@ struct FolderItemComp { this.selectedFolderData = FolderUtil.getFolderData(this.AllFolderArray, SysDefFolderUuid.AllNotes) this.selectedNoteData = NoteUtil.getFirstNoteData(this.AllNoteArray, SysDefFolderUuid.AllNotes) // save continue data - let continueFolder: string = JSON.stringify(this.selectedFolderData.toFolderObject()) let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueFolder', continueFolder) AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(this.TAG, "onDeleteConfirm, set continue folder and note success") + LogUtil.info(this.TAG, "onDeleteConfirm, set continue note success") } } // Folder Create Dialog @@ -318,7 +317,7 @@ struct FolderItemComp { .height(154) .padding({ top: 4, bottom: 4, left: 16, right: 16 }) .borderRadius(16) - .backgroundColor(Color.White) + .backgroundColor($r("app.color.press_folder_bg_color")) .visibility(this.folderItem.folder_type == FolderType.CusDef ? Visibility.Visible : Visibility.None) } @@ -365,12 +364,10 @@ struct FolderItemComp { // 刷新web界面 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) // save continue data - let continueFolder: string = JSON.stringify(this.selectedFolderData.toFolderObject()) let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueFolder', continueFolder) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', 3) - LogUtil.info(this.TAG, "FolderItemComp, set continue folder and note success") + LogUtil.info(this.TAG, "FolderItemComp, set continue note success") } }) } diff --git a/common/component/src/main/ets/default/NoteContent.ets b/common/component/src/main/ets/default/NoteContent.ets new file mode 100644 index 0000000000000000000000000000000000000000..176520164b3fe072296f5a5bdb399d316902aa54 --- /dev/null +++ b/common/component/src/main/ets/default/NoteContent.ets @@ -0,0 +1,374 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import DateUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/DateUtil.ets' +import RdbStoreUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' +import FolderData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' +import NoteData from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' +import {TableName, NoteTableColumn, SysDefFolderUuid, Favorite, Delete +} from '../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' +import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' +import {EditContentDialog, DeleteDialog, EditTitleDialog} from './CusDialogComp.ets' +import FolderUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/FolderUtil.ets' +import NoteUtil from '../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' +import prompt from '@system.prompt' +import featureAbility from '@ohos.ability.featureAbility' +import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import OperationUtils from '../../../../../../common/utils/src/main/ets/default/baseUtil/OperationUtils.ets' +import mediaquery from '@ohos.mediaquery' +import router from '@system.router'; + +const TAG = "NoteContent" + +@Component +export struct NoteContent { + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get("NewNote") + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Provide('Issave') issave: number = 0 + controllerShow: WebController + private editContentFlag = false + + noteContent = { + callbackhtml: (html) => { + LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid) + this.selectedNoteData.content_text = html + this.selectedNoteData.modified_time = new Date().getTime() + // updata note image + this.selectedNoteData.content_img = RdbStoreUtil.updataNoteImage(this.selectedNoteData.content_text) + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid) + AppStorage.SetOrCreate('NewNote', this.selectedNoteData) + } + } + + build() { + Stack({ alignContent: Alignment.Bottom }) { + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, + alignItems: ItemAlign.Start, alignContent: FlexAlign.SpaceAround }) { + Column() { + ToolBarComp({ controllerShow: this.controllerShow }) + } + + Column() { + NoteContentOverViewComp() + + Web({ src: $rawfile('editor.html'), controller: this.controllerShow }) + .javaScriptAccess(true) + .onPageEnd((e) => { + if (this.editContentFlag == false) { + this.controllerShow.registerJavaScriptProxy({ + object: this.noteContent, + name: "callBackToApp", // html--> name.method + methodList: ["callbackhtml"], + }) + LogUtil.info(TAG, "finish register") + this.controllerShow.refresh() + this.editContentFlag = true + } + LogUtil.info(TAG, "finish loadurl") + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) + }) + .zoomAccess(false) + .height(450) + .width('100%') + } + .margin({ top: 16 }) + .width(StyleConstants.PERCENTAGE_100) + .onClick(() => { + this.issave = 0 + }) + } + .height(StyleConstants.PERCENTAGE_100) + .margin({ left: 24, right: 24 }) + } + .height(StyleConstants.PERCENTAGE_100) + .width(StyleConstants.PERCENTAGE_100) + } + + aboutToAppear(): void{ + LogUtil.info(TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(TAG, "aboutToDisappear") + } +} + +@Component +export struct ToolBarComp { + @Consume('SelectedNoteData') selectedNoteData: NoteData + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') + @Consume('Issave') issave: number + controllerShow: WebController + + editContentDialogCtl: CustomDialogController = new CustomDialogController({ + builder: EditContentDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Bottom, + autoCancel: true, + customStyle: true, + }) + + confirm(excuteJs: string) { + this.controllerShow.runJavaScript({ script: excuteJs }) + } + + build() { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, + justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Image($r('app.media.zoom')) + .height(24) + .width(24) + .onClick(() => { + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) + this.controllerShow.runJavaScript({ script: "get_html_content()" }) + 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(() => { + // 清单 + 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) + .onClick(() => { + 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 () => { + 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 + // 保存笔记信息到数据库 + this.controllerShow.runJavaScript({ script: "get_html_content()" }) + if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { + LogUtil.info(TAG, "note is empty,save note failed") + } + }) + }.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(() => { + + 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(() => { + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.redo()" }) + }) + }.width(42) + .height(42) + .borderRadius(8) + .backgroundColor($r('app.color.color_ffffff')) + }.width(274) + } + .width(StyleConstants.PERCENTAGE_100) + .height(80) + } +} + +@Component +export struct NoteContentOverViewComp { + @Consume('SelectedNoteData') selectedNoteData: NoteData + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + editTitleDialogCtl: CustomDialogController = new CustomDialogController({ + builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), + alignment: DialogAlignment.Center, + autoCancel: false, + customStyle: true, + }) + + confirm(newTitle: string) { + this.selectedNoteData.title = newTitle + this.selectedNoteData.modified_time = new Date().getTime() + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + } + + @Builder MenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + List() { + ForEach(this.AllFolderArray, (item) => { + ListItem() { + NoteDataMoveItemComp({ folderItem: item }) + } + .onClick(() => { + this.selectedNoteData.folder_uuid = item.uuid + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + }) + }, noteItem => noteItem.uuid) + }.listDirection(Axis.Vertical) + .edgeEffect(EdgeEffect.Spring) + .height(this.AllFolderArray.length > 12 ? 504 : (this.AllFolderArray.length - 3) * 56) + } + .width(148) + .backgroundColor($r("app.color.color_fffffB")) + .padding({ left: 24, right: 24 }) + } + + build() { + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, + justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Row() { + Text(this.selectedNoteData.title).fontSize(30) + .onClick(() => { + this.editTitleDialogCtl.open() + }) + }.height(40) + .width(StyleConstants.PERCENTAGE_100) + + Row() { + Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))) + .fontSize(12) + .padding({ top: 4, bottom: 4 }) + .fontColor($r("app.color.modified_time_font_color")) + Row() { + Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) + .fontSize(12) + Image($r('app.media.triangle')) + .width(6) + .height(12) + .margin({ left: 4 }) + } + .padding({ left: 8, right: 8, top: 4, bottom: 4 }) + .margin({ left: 8 }) + .borderRadius(16) + .backgroundColor(NoteUtil.getNoteBgColor(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid, SysDefFolderUuid.AllNotes, false)) + .bindMenu(this.MenuBuilder) + }.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100) + } + .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) + .width(StyleConstants.PERCENTAGE_100) + .height(80) + } +} + +@Component +struct NoteDataMoveItemComp { + @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] + @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] + private folderItem: FolderData + + build() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap }) { + Image(FolderUtil.getFolderIcon(this.folderItem.uuid)) + .objectFit(ImageFit.ScaleDown) + .width(24) + .height(24) + .fillColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) + } + .width(24) + + Column() { + Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { + Text(FolderUtil.getFolderText(this.folderItem)) + .fontSize(16) + .fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) + .textAlign(TextAlign.Center) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .flexShrink(1) + } + .width('100%') + .height(55) + + Divider() + .color($r("app.color.divider_color_e4e4e4")) + .strokeWidth(1) + } + .padding({ left: 16 }) + } + .width('100%') + .height(56) + .visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None) + } +} \ No newline at end of file diff --git a/common/component/src/main/ets/default/NoteContentComp.ets b/common/component/src/main/ets/default/NoteContentComp.ets index 83b5684575b3d6901f73ef0acf460044b8a1ca73..14c2316c3acfc59f03fb4e6c7f021f6b9da969b9 100644 --- a/common/component/src/main/ets/default/NoteContentComp.ets +++ b/common/component/src/main/ets/default/NoteContentComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -42,6 +42,7 @@ export struct NoteContentComp { @Consume('EditModel') editModel: boolean @Consume('SectionStatus') sectionStatus: number @Consume('LastSectionStatus') lastSectionStatus: number + @Consume('Issave') issave: number controllerShow: WebController private editContentFlag = false @State uri1: string = "" @@ -78,12 +79,12 @@ export struct NoteContentComp { let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) LogUtil.info(TAG, "callbackhtml, set continue note success") - // 删除空白笔记 - if(NoteUtil.deleteEmptyNote(this.selectedNoteData,this.AllNoteArray,this.controllerShow)) { - this.selectedNoteData = this.AllNoteArray[0] - LogUtil.info(TAG, "selectedNoteData note:" + this.selectedNoteData.uuid) - this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"}) - } + // save continue data + LogUtil.info(TAG, "callbackhtmlSave, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + LogUtil.info(TAG, "callbackhtmlSave, set continue section success") + this.sectionStatus = this.lastSectionStatus + this.sectionStatus = mediaquery.matchMediaSync('(width < 2000)').matches ? 2 : 3 return "AceString" }, @@ -123,7 +124,7 @@ export struct NoteContentComp { .onPageEnd((e) => { if (this.editContentFlag == false) { this.controllerShow.registerJavaScriptProxy({ - obj: this.noteContent, + object: this.noteContent, name: "callBackToApp", // html--> name.method methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave"], }) @@ -144,31 +145,29 @@ export struct NoteContentComp { } .margin({ top: 16 }) .width(StyleConstants.PERCENTAGE_100) - .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) .enabled(this.selectedNoteData.is_deleted == Delete.Yes ? false : true) .onClick(() => { + this.issave = 0 // 点击第三屏进入全屏编辑模式 if (this.sectionStatus != 1) { this.lastSectionStatus = this.sectionStatus this.sectionStatus = 1 this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) this.editModel = !this.editModel - // 添加定时器:5s自动保存 + // 添加定时器:3s自动保存 timeId = setInterval(() => { this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) - }, 5000) - LogUtil.info(TAG, "NoteContentComp, setInterval timeId : " + timeId) + }, 3000) + LogUtil.info(TAG, "setInterval timeId : " + timeId) // save continue data AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) - LogUtil.info(TAG, "NoteContentComp, set continue section success") + LogUtil.info(TAG, "set continue section success") } }) } .height(StyleConstants.PERCENTAGE_100) .margin({ left: 24, right: 24 }) .visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible) - - DeleteNoteComp() } .height(StyleConstants.PERCENTAGE_100) .width(StyleConstants.PERCENTAGE_100) @@ -250,7 +249,8 @@ export struct NoteContentOverViewComp { Row() { Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))) .fontSize(12) - .padding({ top: 4, bottom: 4 }).fontColor('#A3A7AD') + .padding({ top: 4, bottom: 4 }) + .fontColor($r("app.color.modified_time_font_color")) Row() { Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) .fontSize(12) @@ -266,6 +266,7 @@ export struct NoteContentOverViewComp { .bindMenu(this.MenuBuilder) }.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100) } + .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) .width(StyleConstants.PERCENTAGE_100) .height(80) } @@ -282,22 +283,16 @@ export struct ToolBarComp { @Consume('PortraitModel') portraitModel: boolean @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('EditModel') editModel: boolean + @Consume('Issave') issave: number controllerShow: WebController private context = getContext(this) -//private lastSectionStatus: number noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({ builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), alignment: DialogAlignment.Center, autoCancel: false, customStyle: true, }) - noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ - builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), - alignment: DialogAlignment.Bottom, - autoCancel: false, - customStyle: true, - }) onDeleteConfirm() { if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { @@ -318,6 +313,7 @@ export struct ToolBarComp { this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) @@ -338,48 +334,37 @@ export struct ToolBarComp { build() { Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { - if (this.portraitModel == true) { - Image($r('app.media.back')) - .height(24) - .width(24) - .onClick(() => { - this.chooseNote = false - }) - } else { - Image($r('app.media.zoom')) - .height(24) - .width(24) - .onClick(() => { - if (this.sectionStatus != 1) { - this.lastSectionStatus = this.sectionStatus - this.sectionStatus = 1 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) - } else { - if (this.lastSectionStatus != undefined) { - // 切换为小屏预览模式 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - // 退出全屏时存库 - LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) - this.controllerShow.runJavaScript({ script: "save_html_content()" }) - this.sectionStatus = this.lastSectionStatus - this.sectionStatus = mediaquery.matchMediaSync('(width < 2000)').matches ? 2 : 3 - // 清除定时器 - if (timeId != undefined) { - LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId) - clearInterval(timeId) - } - } else { - this.sectionStatus = 3 + Image($r('app.media.zoom')) + .height(24) + .width(24) + .onClick(() => { + if (this.sectionStatus != 1) { + this.lastSectionStatus = this.sectionStatus + this.sectionStatus = 1 + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) + } else { + if (this.lastSectionStatus != undefined) { + // 切换为小屏预览模式 + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) + // 退出全屏时存库 + LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) + this.controllerShow.runJavaScript({ script: "save_html_content()" }) + // 清除定时器 + if (timeId != undefined) { + LogUtil.info(TAG, "zoom, clearInterval timeId : " + timeId) + clearInterval(timeId) } + } else { + this.sectionStatus = 3 } - this.editModel = !this.editModel - // 迁移 - LogUtil.info(TAG, "ToolBarComp, set continue section") - AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) - LogUtil.info(TAG, "ToolBarComp, set continue section success") - }) - .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) - } + } + this.editModel = !this.editModel + // 迁移 + LogUtil.info(TAG, "ToolBarComp, set continue section") + AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) + LogUtil.info(TAG, "ToolBarComp, set continue section success") + }) + .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.None : Visibility.Visible) if (this.selectedNoteData.is_deleted == Delete.Yes) { Row({ space: StyleConstants.SPACE_24 }) { @@ -398,6 +383,7 @@ export struct ToolBarComp { prompt.showToast({ message: "已恢复", duration: 2000 }) this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.chooseNote = false + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // update note to db let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) @@ -411,38 +397,6 @@ export struct ToolBarComp { LogUtil.info(TAG, "recover, set continue note success") }) }.width(72) - .visibility(this.portraitModel ? Visibility.None : Visibility.Visible) - } else if (this.portraitModel == true && this.editModel == true) { - Row({ space: StyleConstants.SPACE_24 }) { - Image($r('app.media.undo')) - .height(24) - .width(24) - .onClick(() => { - this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.undo()" }) - }) - Image($r('app.media.todo')) - .height(24) - .width(24) - .onClick(() => { - this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.redo()" }) - }) - Image($r('app.media.tick_thin')) - .height(24) - .width(24) - .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") - prompt.showToast({ message: $r('app.string.empty_note'), duration: 2000 }) - } - // 清除定时器 - if (timeId != undefined) { - LogUtil.info(TAG, "tick_thin, clearInterval timeId : " + timeId) - clearInterval(timeId) - } - }) - }.width(120) } else if (this.editModel == true) { Row({ space: StyleConstants.SPACE_6 }) { Button({ type: ButtonType.Normal, stateEffect: true }) { @@ -485,7 +439,9 @@ export struct ToolBarComp { 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()" }) if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { @@ -547,11 +503,7 @@ export struct ToolBarComp { .height(24) .width(24) .onClick(() => { - if (this.portraitModel) { - this.noteDataDeleteDialogCtlBottom.open() - } else { - this.noteDataDeleteDialogCtl.open() - } + this.noteDataDeleteDialogCtl.open() }) }.width(72) } @@ -561,91 +513,6 @@ export struct ToolBarComp { } } -@Component -export struct DeleteNoteComp { - @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') - @Consume('SelectedFolderData') selectedFolderData: FolderData - @Consume('RefreshFlag') refreshFlag: number - @Consume('SelectedNoteData') selectedNoteData: NoteData - @Consume('PortraitModel') portraitModel: boolean - @Consume('ChooseNote') chooseNote: boolean - noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ - builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }), - alignment: DialogAlignment.Bottom, - autoCancel: false, - customStyle: true, - }) - - onDeleteConfirm() { - if (this.selectedFolderData.uuid != SysDefFolderUuid.RecentDeletes) { - this.selectedNoteData.is_deleted = Delete.Yes - this.selectedNoteData.deleted_time = new Date().getTime() - // 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) - } else { - NoteUtil.removeNoteData(this.AllNoteArray, this.selectedNoteData.uuid) - // delete note from db - let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) - predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) - RdbStoreUtil.delete(predicates_note, null) - } - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) - this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) - this.chooseNote = false - // save continue data - let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(TAG, "DeleteNoteComp, onDeleteConfirm, set continue note success") - } - - build() { - Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { - Column() { - Image($r('app.media.delete')) - .width(24) - .height(24) - .onClick(() => { - this.noteDataDeleteDialogCtlBottom.open() - }) - Text($r("app.string.delete")) - .fontSize(10) - .fontColor('#182431') - .padding({ top: 5 }) - } - .alignItems(HorizontalAlign.Center) - - Column() { - Image($r('app.media.recover')) - .width(24) - .height(24) - .onClick(() => { - this.selectedNoteData.is_deleted = Delete.No - this.selectedNoteData.deleted_time = 0 - prompt.showToast({ message: "已恢复", duration: 2000 }) - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) - this.chooseNote = false - // 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) - }) - Text($r("app.string.recover")) - .fontSize(10) - .fontColor('#182431') - .padding({ top: 5 }) - } - .alignItems(HorizontalAlign.Center) - } - .width(360) - .height(56) - .visibility(this.selectedNoteData.is_deleted == Delete.Yes && this.portraitModel == true ? - Visibility.Visible : Visibility.None) - } -} - @Component struct NoteDataMoveItemComp { @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] diff --git a/common/component/src/main/ets/default/NoteContentCompPortrait.ets b/common/component/src/main/ets/default/NoteContentCompPortrait.ets index 6fbd3d79d877d5de11b9b644e2538922e769badd..e99eaa75f486b53717b516fc48a874443b2cd2e4 100644 --- a/common/component/src/main/ets/default/NoteContentCompPortrait.ets +++ b/common/component/src/main/ets/default/NoteContentCompPortrait.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,23 +27,21 @@ import prompt from '@system.prompt' import featureAbility from '@ohos.ability.featureAbility'; import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' import OperationUtils from '../../../../../../common/utils/src/main/ets/default/baseUtil/OperationUtils.ets' +import router from '@system.router' -const TAG = "NoteContentComp" +var timeId: number + +const TAG = "NoteContentCompPortrait" // Note content component @Component export struct NoteContentCompPortrait { - @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get("NewNote") + @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get("NewFolder") @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') - @Consume('SelectedFolderData') selectedFolderData: FolderData - @Consume('RefreshFlag') refreshFlag: number - @Consume('SectionStatus') sectionStatus: number - @Consume('ChooseNote') chooseNote: boolean - @Consume('EditModel') editModel: boolean - private controllerShow: WebController = new WebController() + @Provide('EditModel') editModel: boolean = false + controllerShow: WebController private editContentFlag = false - @State uri1: string = ""; - private context = getContext(this) noteContent = { callbackhtml: (html) => { LogUtil.info(TAG, 'note uuid is:' + this.selectedNoteData.uuid) @@ -55,7 +53,6 @@ export struct NoteContentCompPortrait { predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) LogUtil.info(TAG, 'update note success:' + this.selectedNoteData.uuid) - return "AceString"; } } @@ -69,25 +66,21 @@ export struct NoteContentCompPortrait { Column() { NoteContentOverViewComp() - Text(this.refreshFlag.toString()).visibility(Visibility.None) - Text(this.AllNoteArray.length.toString()).visibility(Visibility.None) // 用于强制刷新使用 Web({ src: $rawfile('editor.html'), controller: this.controllerShow }) .javaScriptAccess(true) .onPageEnd((e) => { if (this.editContentFlag == false) { this.controllerShow.registerJavaScriptProxy({ - obj: this.noteContent, + object: this.noteContent, name: "callBackToApp", // html--> name.method methodList: ["callbackhtml"], - }); + }) LogUtil.info(TAG, "finish register") this.controllerShow.refresh() this.editContentFlag = true } LogUtil.info(TAG, "finish loadurl") - // 初次进入预览模式 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) @@ -96,18 +89,14 @@ export struct NoteContentCompPortrait { .height(450) .width('100%') } - .margin({ top: 16 }) - .width(StyleConstants.PERCENTAGE_100) - .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) - .enabled(this.selectedNoteData.is_deleted == Delete.Yes ? false : true) .onClick(() => { - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) this.editModel = true }) + .margin({ top: 16 }) + .width(StyleConstants.PERCENTAGE_100) } .height(StyleConstants.PERCENTAGE_100) .margin({ left: 24, right: 24 }) - .visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible) EditNoteCompForPortrait({ controllerShow: this.controllerShow }) DeleteNoteComp() @@ -115,14 +104,21 @@ export struct NoteContentCompPortrait { .height(StyleConstants.PERCENTAGE_100) .width(StyleConstants.PERCENTAGE_100) } + + aboutToAppear(): void{ + LogUtil.info(TAG, "aboutToAppear") + } + + aboutToDisappear(): void{ + LogUtil.info(TAG, "aboutToDisappear") + } } @Component export struct NoteContentOverViewComp { - @Consume('SelectedNoteData') selectedNoteData: NoteData; + @Consume('SelectedNoteData') selectedNoteData: NoteData @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = [] @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - @Consume('SectionStatus') sectionStatus: number editTitleDialogCtl: CustomDialogController = new CustomDialogController({ builder: EditTitleDialog({ confirm: this.confirm.bind(this), dialogType: 0 }), alignment: DialogAlignment.Center, @@ -147,6 +143,9 @@ export struct NoteContentOverViewComp { } .onClick(() => { this.selectedNoteData.folder_uuid = item.uuid + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) }) }, noteItem => noteItem.uuid) }.listDirection(Axis.Vertical) @@ -166,11 +165,14 @@ export struct NoteContentOverViewComp { .onClick(() => { this.editTitleDialogCtl.open() }) - }.height(40).width(StyleConstants.PERCENTAGE_100) + }.height(40) + .width(StyleConstants.PERCENTAGE_100) Row() { - Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))).fontSize(12) + Text(DateUtil.formateDateForNoteContent(new Date(this.selectedNoteData.modified_time))) + .fontSize(12) .padding({ top: 4, bottom: 4 }) + .fontColor($r("app.color.modified_time_font_color")) Row() { Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) .fontSize(12) @@ -186,6 +188,7 @@ export struct NoteContentOverViewComp { .bindMenu(this.MenuBuilder) }.alignItems(VerticalAlign.Top).height(40).width(StyleConstants.PERCENTAGE_100) } + .opacity(this.selectedNoteData.is_deleted == Delete.Yes ? 0.4 : 1) .width(StyleConstants.PERCENTAGE_100) .height(80) } @@ -193,14 +196,10 @@ export struct NoteContentOverViewComp { @Component export struct ToolBarComp { - @Consume('SelectedNoteData') selectedNoteData: NoteData; - @Consume('RefreshFlag') refreshFlag: number - @Consume('SectionStatus') sectionStatus: number + @Consume('SelectedNoteData') selectedNoteData: NoteData @Consume('SelectedFolderData') selectedFolderData: FolderData - @Consume('ChooseNote') chooseNote: boolean - @Consume('PortraitModel') portraitModel: boolean - @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('EditModel') editModel: boolean + @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') controllerShow: WebController build() { @@ -209,14 +208,8 @@ export struct ToolBarComp { Image($r('app.media.back')).height(24).width(24) .onClick(() => { - // 退出全屏时存库 this.controllerShow.runJavaScript({ script: "get_html_content()" }) - // 删除空白笔记 - NoteUtil.deleteEmptyNote(this.selectedNoteData, this.AllNoteArray, this.controllerShow) - this.chooseNote = false - // 进入预览模式 - this.controllerShow.runJavaScript({ script: "RE.setInputEnabled(false)" }) - this.editModel = false + router.back() }) if (this.editModel == false) { @@ -225,18 +218,12 @@ export struct ToolBarComp { .height(24).width(24) .onClick(() => { this.selectedNoteData.is_favorite = (this.selectedNoteData.is_favorite == Favorite.Yes ? Favorite.No : Favorite.Yes) - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) // 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) if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) { this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites) - // 迁移 - LogUtil.info(TAG, "ToolBarComp, set continue note") - let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) - AppStorage.SetOrCreate('ContinueNote', continueNote) - LogUtil.info(TAG, "ToolBarComp, set continue note success") } }) }.width(36) @@ -268,11 +255,6 @@ export struct ToolBarComp { .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.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) this.editModel = false }) }.width(42) @@ -296,8 +278,6 @@ export struct DeleteNoteComp { @Consume('SelectedFolderData') selectedFolderData: FolderData @Consume('RefreshFlag') refreshFlag: number @Consume('SelectedNoteData') selectedNoteData: NoteData; - @Consume('PortraitModel') portraitModel: boolean - @Consume('ChooseNote') chooseNote: boolean noteDataDeleteDialogCtlBottom: CustomDialogController = new CustomDialogController({ builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this), multiSelect: true }), alignment: DialogAlignment.Bottom, @@ -320,9 +300,6 @@ export struct DeleteNoteComp { predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) RdbStoreUtil.delete(predicates_note, null) } - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) - this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) - this.chooseNote = false } build() { @@ -335,7 +312,8 @@ export struct DeleteNoteComp { this.noteDataDeleteDialogCtlBottom.open() }) Text($r("app.string.delete")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.delete_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -349,21 +327,21 @@ export struct DeleteNoteComp { this.selectedNoteData.deleted_time = 0 prompt.showToast({ message: $r('app.string.restore'), duration: 2000 }) this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) - this.chooseNote = false // 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) }) Text($r("app.string.recover")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.recover_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) } .width(360) .height(56) - .visibility(this.selectedNoteData.is_deleted == Delete.Yes && this.portraitModel == true ? + .visibility(this.selectedNoteData.is_deleted == Delete.Yes ? Visibility.Visible : Visibility.None) } } @@ -373,10 +351,7 @@ export struct EditNoteCompForPortrait { @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('SelectedFolderData') selectedFolderData: FolderData - @Consume('RefreshFlag') refreshFlag: number @Consume('SelectedNoteData') selectedNoteData: NoteData; - @Consume('PortraitModel') portraitModel: boolean - @Consume('ChooseNote') chooseNote: boolean @Consume('EditModel') editModel: boolean controllerShow: WebController editContentDialogCtl: CustomDialogController = new CustomDialogController({ @@ -401,7 +376,8 @@ export struct EditNoteCompForPortrait { this.controllerShow.runJavaScript({ script: "javascript:RICH_EDITOR.setTodo()" }) }) Text($r("app.string.list")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.list_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -414,7 +390,8 @@ export struct EditNoteCompForPortrait { this.editContentDialogCtl.open() }) Text($r("app.string.style")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.style_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -425,7 +402,8 @@ export struct EditNoteCompForPortrait { .height(24) Text($r("app.string.photo")) - .fontSize(10).fontColor('#182431') + .fontSize(10) + .fontColor($r('app.color.photo_font_color')) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) @@ -467,7 +445,9 @@ struct NoteDataMoveItemComp { .width('100%') .height(55) - Divider().color($r("app.color.divider_color_e4e4e4")).strokeWidth(1) + Divider() + .color($r("app.color.divider_color_e4e4e4")) + .strokeWidth(1) } .padding({ left: 16 }) } @@ -475,4 +455,4 @@ struct NoteDataMoveItemComp { .height(56) .visibility(FolderUtil.isFolderMoveIn(this.folderItem) ? Visibility.Visible : Visibility.None) } -} +} \ No newline at end of file diff --git a/common/component/src/main/ets/default/NoteListComp.ets b/common/component/src/main/ets/default/NoteListComp.ets index 528cc182ced24f154108110e27e9a80e2d065821..b11bd4db1e36133053b39f09d5d4de235fa31957 100644 --- a/common/component/src/main/ets/default/NoteListComp.ets +++ b/common/component/src/main/ets/default/NoteListComp.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,9 +25,21 @@ import FolderUtil from '../../../../../../common/utils/src/main/ets/default/base import StyleConstants from '../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' import SearchModel from '../../../../../../common/utils/src/main/ets/default/model/searchModel/SearchModel.ets' import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' +import router from '@system.router'; const TAG = "NoteListComp" +async function routePage() { + let options = { + uri: 'pages/NoteContentHome' + } + try { + await router.push(options) + } catch (err) { + LogUtil.info(TAG, "fail callback") + } +} + // Note list component @Component export struct NoteListComp { @@ -87,6 +99,7 @@ struct NoteOverViewComp { .onClick(() => { if (this.sectionStatus == 1) { this.expandStatus = !this.expandStatus + AppStorage.SetOrCreate('ContinueExpand', this.expandStatus) } else { this.sectionStatus = (this.sectionStatus == 3 ? 2 : 3) // 迁移 @@ -104,16 +117,16 @@ struct NoteOverViewComp { }) { Text(FolderUtil.getFolderText(this.selectedFolderData)) .fontSize(30) - .fontColor('#182431') + .fontColor($r("app.color.all_notes_font_color")) .fontWeight(FontWeight.Bold) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row() { Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString()) .fontSize(14) - .fontColor('#A3A7AD') + .fontColor($r("app.color.num_of_notes_font_color")) Text($r("app.string.noteslist")) .fontSize(14) - .fontColor('#A3A7AD') + .fontColor($r("app.color.num_of_notes_font_color")) .textOverflow({ overflow: TextOverflow.Ellipsis }) } .visibility((FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0) ? Visibility.None : Visibility.Visible) @@ -130,7 +143,7 @@ struct NoteOverViewComp { }) Text(this.CheckedNoteArray.length == 0 ? $r("app.string.none_selected") : $r("app.string.selected", this.CheckedNoteArray.length)) .fontSize(20) - .fontColor('#182431') + .fontColor($r("app.color.note_selected_font_color")) .margin({ left: 16 }) .textOverflow({ overflow: TextOverflow.Ellipsis }) }.alignItems(VerticalAlign.Center) @@ -180,9 +193,9 @@ export struct NoteItemComp { }), item => { if (item.data.type == 0) { - Span(item.data.text).fontColor('#182431').fontSize(16).fontWeight(FontWeight.Medium) + Span(item.data.text).fontColor($r("app.color.note_title_font_color")).fontSize(16).fontWeight(FontWeight.Medium) } else if (item.data.type == 1) { - Span(item.data.text).fontColor(Color.Blue).fontSize(16).fontWeight(FontWeight.Medium) + Span(item.data.text).fontColor($r("app.color.note_title_font_color_blue")).fontSize(16).fontWeight(FontWeight.Medium) } }, item => item.index) @@ -192,7 +205,7 @@ export struct NoteItemComp { Row({ space: 4 }) { Text(DateUtil.formateDateForNoteTitle(new Date(this.noteItem.modified_time))) .fontSize(14) - .fontColor('#99182431') + .fontColor($r("app.color.list_modified_time_font_color")) .fontWeight(FontWeight.Regular) .textOverflow({ overflow: TextOverflow.Ellipsis }) Image($r("app.media.favorite")) @@ -255,6 +268,7 @@ export struct NoteItemComp { } else { this.selectedNoteData = this.noteItem this.chooseNote = true + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) @@ -263,6 +277,11 @@ export struct NoteItemComp { if(this.portraitModel == false) { this.controllerShow.runJavaScript({script:"RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" }) } + if(this.portraitModel == true) { + AppStorage.SetOrCreate('NewNote', this.selectedNoteData) + AppStorage.SetOrCreate('NewFolder', this.selectedFolderData) + routePage() + } this.selectedAll = this.CheckedNoteArray.length == NoteUtil.getNoteDataArray(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).length this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) @@ -325,7 +344,7 @@ export struct NoteItemListComp { Flex({ justifyContent: FlexAlign.Center }) { Text($r("app.string.permanently_delete_tips")) .fontSize(12) - .fontColor('#18181A') + .fontColor($r("app.color.Recently_delete_prompt_font_color")) } .margin({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 }) .width('100%') @@ -340,7 +359,7 @@ export struct NoteItemListComp { .height(120) Text($r("app.string.Empty_page")) .fontSize(12) - .fontColor('#A3A7AD') + .fontColor($r("app.color.Empty_page_font_color")) } } .width('100%') @@ -553,23 +572,23 @@ export struct AddNoteComp { LogUtil.info(TAG, 'insert new note is:' + noteData.uuid) this.selectedNoteData = noteData - if (this.sectionStatus != 1) { - this.lastSectionStatus = this.sectionStatus - this.sectionStatus = 1 - this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) - } else { - this.sectionStatus = this.lastSectionStatus + AppStorage.SetOrCreate('NewNote', noteData) + if (this.portraitModel == false) { + 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 + "')" }) + if (this.portraitModel == true) { + this.editModel = true } - this.editModel = true this.chooseNote = true + AppStorage.SetOrCreate('ContinueChoose', this.chooseNote) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', this.sectionStatus) LogUtil.info(TAG, "addNote, set continue note and section success") + routePage() }) .visibility(this.longpress || this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.None : Visibility.Visible) } @@ -593,9 +612,9 @@ export struct SearchComp { Flex({ justifyContent: FlexAlign.Start }) { Image($r('app.media.search')).width(18).height(18) - TextInput({ text: this.inputKeyword, placeholder: $r('app.string.searchNote') }) + TextInput({ placeholder: $r('app.string.searchNote') }) .backgroundColor($r("app.color.color_ffffff")) - .caretColor('#F86D05') + .caretColor($r("app.color.search_note_caret_color")) .onChange((value: string) => { LogUtil.info(TAG, "Search value: " + value) this.inputKeyword = value @@ -700,7 +719,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.set_top")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.set_top_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -717,7 +736,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.delete")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.delete_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -734,7 +753,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.move")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.move_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -764,7 +783,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.recover")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.recover_font_color")) .padding({ top: 5 }) } .opacity(this.CheckedNoteArray.length == 0 ? 0.4 : 1) @@ -788,7 +807,7 @@ export struct OperateNoteCompForPortrait { }) Text($r("app.string.check_all")) .fontSize(10) - .fontColor('#182431') + .fontColor($r("app.color.check_all_font_color")) .padding({ top: 5 }) } .alignItems(HorizontalAlign.Center) diff --git a/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets b/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets index 3756840b9ebdff41f797714e05314ca1f0a636c2..6022ad51c16e5b73b4c712c3bf61d458cdd01d0c 100644 --- a/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets +++ b/common/utils/src/main/ets/default/access/MediaLibraryAccess.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from '../baseUtil/LogUtil.ets' import MediaLib from '@ohos.multimedia.mediaLibrary'; diff --git a/common/utils/src/main/ets/default/baseUtil/DateUtil.ets b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets index af971c413977b9133feb71e27a1b4b7a5cc21bee..4e68264528738e9be9a5eb0861582ccd5f7fcc88 100644 --- a/common/utils/src/main/ets/default/baseUtil/DateUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/DateUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets deleted file mode 100644 index 09eb7d11f4cb7838a1bf55935f62d9abc8d44f50..0000000000000000000000000000000000000000 --- a/common/utils/src/main/ets/default/baseUtil/FakerRdbStoreUtil.ets +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {LogUtil} from '../../common/baseUtil/LogUtil.ets' -import SysDefData from '../../model/databaseModel/SysDefData.ets' -import FolderData from '../../model/databaseModel/FolderData.ets' -import NoteData from '../../model/databaseModel/NoteData.ets' - -const TAG = "FakerRdbStoreUtil" -let folderDataArray = [] -let noteDataArray = [] - -function FakerInitFolder(folderdata: any) { - return new FolderData(0, folderdata.name, folderdata.uuid, folderdata.color, folderdata.folder_type, folderdata.is_deleted, - folderdata.created_time, folderdata.modified_time) -} - -function FakerInitFolderArray(folderdataList: any[]) { - folderdataList.forEach((folderData) => { - folderDataArray.push(FakerInitFolder(folderData)) - }) -} - -function FakerInitNote(noteData: any): NoteData { - return new NoteData(0, noteData.title, noteData.uuid, noteData.folder_uuid, noteData.content_text, noteData.content_img, - noteData.note_type, 0, 0, 0, noteData.created_time, noteData.modified_time, noteData.deleted_time) -} - -function FakerInitNoteArray(noteDataList: any[]) { - noteDataList.forEach((noteData) => { - noteDataArray.push(FakerInitNote(noteData)) - }) -} - -export default { - FakerInitAppStorage() { - FakerInitFolderArray([SysDefData.sys_def_allNotes, SysDefData.sys_def_unClassified, SysDefData.sys_def_life, SysDefData.sys_def_recentDeletes, SysDefData.sys_def_myFavorites, - SysDefData.sys_def_personal, SysDefData.sys_def_work]) - FakerInitNoteArray([SysDefData.sys_def_note1, SysDefData.sys_def_note2, SysDefData.sys_def_note3, SysDefData.sys_def_note4]) - AppStorage.SetOrCreate('AllNoteArray', noteDataArray) - AppStorage.SetOrCreate('AllFolderArray', folderDataArray) - for (let folderData of folderDataArray) { - LogUtil.info(TAG, "folderDataUuid : " + JSON.stringify(folderData.uuid)) - } - for (let noteData of noteDataArray) { - LogUtil.info(TAG, "noteDataArrayUuid : " + JSON.stringify(noteData.uuid)) - } - AppStorage.SetOrCreate('DBQueryFinished', 1) - } -} \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets b/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets index 33ca9807d9e4e551c821fad8478240c411a10218..460be37148220cbe7091b6002b43c08dc29e15cb 100644 --- a/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/FolderUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {folderIconMap, folderTextMap} from '../model/NoteBaseData.ets' import FolderData from '../model/databaseModel/FolderData.ets' import NoteData from '../model/databaseModel/NoteData.ets' diff --git a/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets index edfa97019f4b23c54d39e834e3046d7e0dd33de1..9ceac318a95d41456a5e9e9ae51889e9f3312b35 100644 --- a/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets +++ b/common/utils/src/main/ets/default/baseUtil/GlobalResourceManager.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import Rsm from '@ohos.resourceManager'; import {LogUtil} from './LogUtil.ets' @@ -21,7 +22,7 @@ export class GlobalResourceManager { public async getStringByResource(res: any): Promise { let json = JSON.parse(JSON.stringify(res)); let id = json.id; - LogUtil.info(TAG, "ResourceID = %d" + id) + LogUtil.info(TAG, "ResourceID = " + id) return await this.getStringById(id); } diff --git a/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets index 514e43bdd9294349b114380f73b9197c49d8a312..0e867fa8e8817e3c2073f56d70fe7fa08091f46b 100644 --- a/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/LogUtil.ets b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets index 85689be912b8e0a9cf395b65ef512e81dc6dddc3..0f5a5619800af7db49ab471d2a6cd33d50a437bf 100644 --- a/common/utils/src/main/ets/default/baseUtil/LogUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/LogUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets index 851a7bd9cf71335b708f7ab6e444fe90978006c8..73d66ddaaee689e145e5089734cf4e4ddf76f603 100644 --- a/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/NoteUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,10 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {WidthWeightMessage, unSelectedNoteBgColorMap, selectedNoteBgColorMap, folderTextMap, widthWeightMessageMap} from '../model/NoteBaseData.ets' + +import {WidthWeightMessage, unSelectedNoteBgColorMap, selectedNoteBgColorMap, folderTextMap, widthWeightMessageMap +} from '../model/NoteBaseData.ets' import FolderData from '../model/databaseModel/FolderData.ets' import NoteData from '../model/databaseModel/NoteData.ets' -import {SysDefFolderUuid, FolderType, Favorite, Delete, TableName, NoteTableColumn,} from '../model/databaseModel/EnumData.ets' +import {SysDefFolderUuid, FolderType, Favorite, Delete, TableName, NoteTableColumn, +} from '../model/databaseModel/EnumData.ets' import GlobalResourceManager from './GlobalResourceManager.ets' import StyleConstants from '../constants/StyleConstants.ets' import {LogUtil} from './LogUtil.ets' @@ -141,7 +144,7 @@ export class NoteUtil { if (folderData.color == "#ffffff") { return "#FFEBE1" } - LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + isSelected.toString() + folderData.color.toString()) + LogUtil.info(TAG, "isSelected " + isSelected.toString() + ", folderData.color: " + folderData.color.toString()) return isSelected ? selectedNoteBgColorMap[folderData.color] : unSelectedNoteBgColorMap[folderData.color] } @@ -158,7 +161,7 @@ export class NoteUtil { LogUtil.info(TAG, "NoteBgColor is ffffff") return $r("app.color.color_ffffff") } - LogUtil.info(TAG, "isSelected %s, folderData.color: %s" + folderData.color.toString()) + LogUtil.info(TAG, "isSelected " + folderData.color.toString() + ", folderData.color: " + folderData.color.toString()) if (folderData.color == "#ffffff") { return "#ff9516" } @@ -249,16 +252,16 @@ export class NoteUtil { index == -1 ? null : allNoteDataArray.splice(index, 1) } - deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[],controllerShow: WebController):boolean { + deleteEmptyNote(selectedNoteData: NoteData, AllNoteArray: NoteData[], controllerShow: WebController): boolean { if (selectedNoteData.title == "标题" && selectedNoteData.content_text == "") { - // delete note from db - noteUtil.removeNoteData(AllNoteArray,selectedNoteData.uuid) - LogUtil.info(TAG, "delete note:" + selectedNoteData.uuid) - let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) - predicates_note.equalTo(NoteTableColumn.Uuid, selectedNoteData.uuid) - RdbStoreUtil.delete(predicates_note, null) - LogUtil.info(TAG, "delete note success:" + selectedNoteData.uuid) - return true + // delete note from db + noteUtil.removeNoteData(AllNoteArray, selectedNoteData.uuid) + LogUtil.info(TAG, "delete note:" + selectedNoteData.uuid) + let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) + predicates_note.equalTo(NoteTableColumn.Uuid, selectedNoteData.uuid) + RdbStoreUtil.delete(predicates_note, null) + LogUtil.info(TAG, "delete note success:" + selectedNoteData.uuid) + return true } return false } diff --git a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets index 7ece3f5d78d15565565cefe0237f86cf8a2fa005..eb3a43c45d4d0137ef21b24b7bdfdb8b02fdefe9 100644 --- a/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets +++ b/common/utils/src/main/ets/default/baseUtil/OperationUtils.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from './LogUtil.ets' import {MediaLibraryAccess} from '../access/MediaLibraryAccess.ets'; import fileio from '@ohos.fileio'; @@ -42,15 +43,10 @@ export class OperationUtils { var dir = context.filesDir // 2、生成本地文件名 var time = new Date().getTime() - var imagePath = dir + "/" + time.toString().substr(10) + "_note"+ numId + ".jpg" + var imagePath = dir + "/" + time.toString().substr(5) + "_note" + numId + ".jpg" // 3、拷贝 - fileio.copyFile(fd, imagePath).then(() => { - LogUtil.info(TAG, "[save]copyFile successfully") - }).catch((err) => { - LogUtil.info(TAG, "[save]copyFile failed : " + err) - }); + await fileio.copyFile(fd, imagePath) // 4、关闭安fd,Asset - fileAsset.close(fd); await MediaLibraryAccess.closeAsset(fd, fileAsset); } catch (error) { LogUtil.info(TAG, "create error: " + error); diff --git a/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets index bedecf33a4f5192d08b618a12ade6d9b547d0479..736ae5227eb29e11c1364602cf9e0a4d89dfd9ca 100644 --- a/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets +++ b/common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -90,18 +90,12 @@ export default { LogUtil.info(TAG, "AppStorage[sysdef] set AllFolderArray and AllNoteArray success") // save continue data - let isContinue = AppStorage.Get('IsContinue'); + let isContinue = AppStorage.Get('IsContinue'); LogUtil.info(TAG, "createRdbStore, isContinue is " + isContinue) - if (isContinue != undefined && isContinue == 1) { - LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue true") - let continueFolder: string = AppStorage.Get('ContinueFolder') + if (isContinue) { let continueNote: string = AppStorage.Get('ContinueNote') let continueSection = AppStorage.Get('ContinueSection') - let folderObj = JSON.parse(continueFolder) - let folderData = new FolderData(folderObj.uuid, folderObj.name, folderObj.uuid, folderObj.color, - folderObj.folder_type, folderObj.is_deleted, folderObj.created_time, folderObj.modified_time) - let noteObj = JSON.parse(continueNote) let noteData = new NoteData(noteObj.uuid, noteObj.title, noteObj.uuid, noteObj.folder_uuid, noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite, @@ -155,9 +149,11 @@ export default { AppStorage.SetOrCreate('Note', noteData) AppStorage.SetOrCreate('Section', continueSection) } else { - LogUtil.info(TAG, "RdbStoreUtil createRdbStore, IsContinue false") + LogUtil.info(TAG, "createRdbStore, IsContinue false") AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) - AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes)) + let note = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes) + AppStorage.SetOrCreate('Note', note) + AppStorage.SetOrCreate('ContinueNote', JSON.stringify(note.toNoteObject())) AppStorage.SetOrCreate('Section', 3) } AppStorage.SetOrCreate('DBQueryFinished', 1) @@ -223,17 +219,12 @@ export default { LogUtil.info(TAG, "AppStorage[query] set AllFolderArray and AllNoteArray success") // 迁移 - let isContinue = AppStorage.Get('IsContinue'); + let isContinue = AppStorage.Get('IsContinue'); LogUtil.info(TAG, "initAppStorage, isContinue is " + isContinue) - if (isContinue != undefined && isContinue == 1) { - let continueFolder: string = AppStorage.Get('ContinueFolder') + if (isContinue) { let continueNote: string = AppStorage.Get('ContinueNote') let continueSection = AppStorage.Get('ContinueSection') - let folderObj = JSON.parse(continueFolder) - let folderData = new FolderData(folderObj.uuid, folderObj.name, folderObj.uuid, folderObj.color, - folderObj.folder_type, folderObj.is_deleted, folderObj.created_time, folderObj.modified_time) - let noteObj = JSON.parse(continueNote) let noteData = new NoteData(noteObj.uuid, noteObj.title, noteObj.uuid, noteObj.folder_uuid, noteObj.content_text, noteObj.content_img, noteObj.note_type, noteObj.is_top, noteObj.is_favorite, @@ -289,7 +280,9 @@ export default { } else { LogUtil.info(TAG, "RdbStoreUtil initAppStorage, IsContinue false") AppStorage.SetOrCreate('Folder', AppStorage.Get('AllFolderArray')[0]) - AppStorage.SetOrCreate('Note', NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes)) + let note = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.AllNotes) + AppStorage.SetOrCreate('Note', note) + AppStorage.SetOrCreate('ContinueNote', JSON.stringify(note.toNoteObject())) AppStorage.SetOrCreate('Section', 3) } AppStorage.SetOrCreate('DBQueryFinished', 1) diff --git a/common/utils/src/main/ets/default/constants/StyleConstants.ets b/common/utils/src/main/ets/default/constants/StyleConstants.ets index 809fa78d8250cedb30bc2645d30c5da8a76899b2..863f41780e98196ff63aa0b830a4d4e84f315a7b 100644 --- a/common/utils/src/main/ets/default/constants/StyleConstants.ets +++ b/common/utils/src/main/ets/default/constants/StyleConstants.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/NoteBaseData.ets b/common/utils/src/main/ets/default/model/NoteBaseData.ets index 92aa8764eb29f1661ba39139599b22c8c111de1a..c887364e7a0e42eb346433c1918d601fb3a57b22 100644 --- a/common/utils/src/main/ets/default/model/NoteBaseData.ets +++ b/common/utils/src/main/ets/default/model/NoteBaseData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets index 4a42fd075fab8f3f8f8ddd114e56a07395b55dac..f4723ae8b996bfab686dc3de7df9ee970261b92e 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/AttachmentData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets index b89c5efaab620aed81e84ad8232d65afbf8eb7bd..191ea274962ecf86a1edf77c6a98b1b8f699687f 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/EnumData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets index e3fb9b5d431d467e3c09223da57903bdac34d95d..1801997e9af8e4db033c52184c8e05b326a97701 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/FolderData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets index ff646decea5956276ec3fafee20f6d0ef5649af7..d65c6c5941bc2e0f2334b5123fa2ad0f738aa5c2 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/NoteData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at 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 22c3921db89ef246d276722e93b5d6994414cb56..92e6d1b7ecf8104e0b7f5d5240bc5da7443d5874 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -114,7 +114,7 @@ export default { "title": "数学公式", "uuid": "note1_uuid", "folder_uuid": SysDefFolderUuid.UnClassified, - "content_text": '好好学习,天天向上


', + "content_text": '

好好学习,天天向上



', "content_img": "/res/shuxue.png", "note_type": NoteType.SysDef, "is_top": Top.Yes, @@ -146,7 +146,7 @@ export default { "title": "旅游心得", "uuid": "note3_uuid", "folder_uuid": SysDefFolderUuid.Work, - "content_text": '旅游心得


', + "content_text": '

旅游心得



', "content_img": "/res/lvyou.png", "note_type": NoteType.SysDef, "is_top": Top.No, @@ -162,7 +162,7 @@ export default { "title": "蛋糕做法", "uuid": "note4_uuid", "folder_uuid": SysDefFolderUuid.Life, - "content_text": '蛋糕做法


', + "content_text": '

蛋糕做法



', "content_img": "/res/cake.png", "note_type": NoteType.CusDef, "is_top": Top.No, diff --git a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets index 44d3c91503d08c80f02871f99fae28e9bc6c9639..d855f85c6b89d36449149df1c962b6a302bb7d7d 100644 --- a/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets +++ b/common/utils/src/main/ets/default/model/searchModel/SearchModel.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -42,7 +42,7 @@ export class SearchModel { } let searchData: NoteData[] = []; noteDataArray.forEach((noteData) => { - if (noteData.content_text.replace(/<[^>]+>/g,"").toLowerCase().indexOf(query.toLowerCase()) != -1 + if (decodeURI(noteData.content_text).replace(/<[^>]+>/g,"").toLowerCase().indexOf(query.toLowerCase()) != -1 || noteData.title.toLowerCase().indexOf(query.toLowerCase()) != -1) { LogUtil.info(TAG, "uuid " + noteData.uuid) searchData.push(noteData); diff --git a/product/pc/src/main/ets/MainAbility/app.ets b/product/pc/src/main/ets/MainAbility/app.ets index 0f7643026af7575807ee0a7aa6e9dfffee64819f..5f980b7d7a09738f854f8f6eaee79ec9a5aad06a 100644 --- a/product/pc/src/main/ets/MainAbility/app.ets +++ b/product/pc/src/main/ets/MainAbility/app.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import {LogUtil} from '../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' const TAG = "app" diff --git a/product/pc/src/main/ets/MainAbility/pages/index.ets b/product/pc/src/main/ets/MainAbility/pages/index.ets index 63827718107518a838ab95454a9e69ffa1f9a41e..3b95ec9d50af1be1ac7a3b7d6f25e3e29c03420d 100644 --- a/product/pc/src/main/ets/MainAbility/pages/index.ets +++ b/product/pc/src/main/ets/MainAbility/pages/index.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + @Entry @Component struct Index { diff --git a/product/pc/src/main/resources/base/element/color.json b/product/pc/src/main/resources/base/element/color.json index 6e15ec2ea3f55bb0cd8814b91854e8a8d02f7ddf..02771c324f3a1fff11a4b2d89e0e6843427fe282 100644 --- a/product/pc/src/main/resources/base/element/color.json +++ b/product/pc/src/main/resources/base/element/color.json @@ -75,6 +75,110 @@ { "name": "notelist_bgcolor_000000", "value": "#000000" + }, + { + "name": "New_folder_input_box_color", + "value": "#ffffff" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ No newline at end of file diff --git a/product/pc/src/main/resources/base/element/string.json b/product/pc/src/main/resources/base/element/string.json index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/pc/src/main/resources/base/element/string.json +++ b/product/pc/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/pc/src/main/resources/en_US/element/string.json b/product/pc/src/main/resources/en_US/element/string.json index a7618c3e9a3b813e6e9a55e2fd463012cfae0a6d..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/pc/src/main/resources/en_US/element/string.json +++ b/product/pc/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/pc/src/main/resources/zh_CN/element/string.json b/product/pc/src/main/resources/zh_CN/element/string.json index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/pc/src/main/resources/zh_CN/element/string.json +++ b/product/pc/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/phone/src/main/config.json b/product/phone/src/main/config.json index de43749897f58de6658f4ccb0b04d86519ca5aa2..5dac9c8e5b6e0ec70fac4a00bf5c3fe9c10d51b2 100644 --- a/product/phone/src/main/config.json +++ b/product/phone/src/main/config.json @@ -59,7 +59,8 @@ }, "pages": [ "pages/MyNoteHome", - "pages/NoteHome" + "pages/NoteHomePortrait", + "pages/NoteContentHome" ], "name": "MainAbility", "window": { diff --git a/product/phone/src/main/ets/MainAbility/MainAbility.ts b/product/phone/src/main/ets/MainAbility/MainAbility.ts index ef95f8f69536dc29e49b92076b120fcf0c49edae..1b17702d12bbb4282f6a65d8a6e4194341eabb0a 100644 --- a/product/phone/src/main/ets/MainAbility/MainAbility.ts +++ b/product/phone/src/main/ets/MainAbility/MainAbility.ts @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,23 +14,39 @@ */ import Ability from '@ohos.application.Ability' -import {WebViewUtil} from './WebViewUtil.ets' import fileio from '@ohos.fileio' export default class MainAbility extends Ability { + private Tag = "Phone_Note_MainAbility" + onCreate(want, launchParam) { - console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason) + console.info(this.Tag + " onCreate, launchReason is " + launchParam.launchReason) + // 折叠状态 + AppStorage.SetOrCreate('Expand', false) + AppStorage.SetOrCreate('Choose', false) if (launchParam.launchReason == 3) { // 获取对端的迁移数据 - let continueFolder: string = want.parameters["ContinueFolder"] let continueNote: string = want.parameters["ContinueNote"] let continueSection: number = want.parameters["ContinueSection"] - // 迁移数据存入AppStorage - AppStorage.SetOrCreate('ContinueFolder', continueFolder) + console.info(this.Tag + " continueSection : " + continueSection) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', continueSection) + // 折叠状态 + let continueExpand: boolean = want.parameters["ContinueExpand"] + let continueChoose: boolean = want.parameters["ContinueChoose"] + console.info(this.Tag + " continueExpand : " + continueExpand + " , continueChoose : " + continueChoose) + AppStorage.SetOrCreate('Expand', continueExpand) + AppStorage.SetOrCreate('Choose', continueChoose) // 设置迁移标记 - AppStorage.SetOrCreate('IsContinue', 1) + AppStorage.SetOrCreate('IsContinue', true) + + // 来自平板的迁移 + if (continueExpand == undefined && continueChoose == undefined) { + console.info(this.Tag + " from tablet") + AppStorage.SetOrCreate('Choose', true) + AppStorage.SetOrCreate('ContinueChoose', true) + } + this.context.restoreWindowStage(null) } AppStorage.SetOrCreate('openPhoto', 0) @@ -39,32 +55,23 @@ export default class MainAbility extends Ability { } onDestroy() { - console.log("MainAbility onDestroy") + console.info(this.Tag + " onDestroy") } onWindowStageCreate(windowStage) { - console.log("MainAbility onWindowStageCreate") + console.info(this.Tag + " onWindowStageCreate") windowStage.setUIContent(this.context, "pages/MyNoteHome", null) } onWindowStageDestroy() { - console.log("MainAbility onWindowStageDestroy") + console.info(this.Tag + " onWindowStageDestroy") } onForeground() { - console.log("MainAbility onForeground") + console.info(this.Tag + " onForeground") } onBackground() { - console.log("MainAbility onBackground") - let controllerShow = WebViewUtil.getWebController() - if (controllerShow == undefined || controllerShow == null) { - console.info("MainAbility onBackground, controllerShow is error") - } - console.log("MainAbility controllerShow : " + controllerShow) - controllerShow.runJavaScript({ - script: "get_html_content()" - }) - console.log("MainAbility controllerShow end") + console.info(this.Tag + " onBackground") } } \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/app.ets b/product/phone/src/main/ets/MainAbility/app.ets index 1e6c8b3d40694f57a81b67eca79af24449cdb756..00231a43a909b6c4cb48c86f3980db488ebaabc9 100644 --- a/product/phone/src/main/ets/MainAbility/app.ets +++ b/product/phone/src/main/ets/MainAbility/app.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets index 1012e8b0a0da4fdbe34df1124a2f3920f548538d..7f1b253be7866ff2fa1222639233a74c41d0e3be 100644 --- a/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets +++ b/product/phone/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,6 @@ import fileio from '@ohos.fileio' import bundle from '@ohos.bundle' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import {NoteHomeComp} from './NoteHome.ets' import {NoteHomePortraitComp} from './NoteHomePortrait.ets' import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' @@ -26,17 +25,15 @@ import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default 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) { - if (this.portraitModel == true) { - NoteHomePortraitComp() - } else { - NoteHomeComp() - } + NoteHomePortraitComp({ controllerShow: this.controllerShow }) } } .width('100%').height('100%') @@ -103,4 +100,9 @@ export struct MyNoteHomeComp { aboutToDisappear(): void{ LogUtil.info(this.TAG, "aboutToDisappear") } + + onPageShow(): void{ + LogUtil.info(this.TAG, "onPageShow") + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + } } \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/WebViewUtil.ets b/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets similarity index 39% rename from product/phone/src/main/ets/MainAbility/WebViewUtil.ets rename to product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets index 44ed6a2715c9a45cefd162633968411cc79da1ad..8992eba4fb69f9a475353107f8204b0431c9c064 100644 --- a/product/phone/src/main/ets/MainAbility/WebViewUtil.ets +++ b/product/phone/src/main/ets/MainAbility/pages/NoteContentHome.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,23 +13,30 @@ * limitations under the License. */ -/** - * WebView Util - */ -export class WebViewUtil { - private static controllerShow: WebController +import {NoteContentCompPortrait} from '../../../../../../../common/component/src/main/ets/default/NoteContentCompPortrait.ets' +import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' - private constructor() { +@Entry +@Component +struct NoteContentHome { + @Provide('RefreshFlag') refreshFlag: number = 0 + private controllerShow: WebController = new WebController() + TAG = "NoteContentHome" + build() { + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContentCompPortrait({ controllerShow: this.controllerShow }) + } + .backgroundColor($r("app.color.notecontent_color_ffffff")) + .width('100%') + .height('100%') } - public static getWebController(): WebController{ - console.info('WebViewUtil, getWebController') - if (!this.controllerShow && AppStorage.Get('openPhoto') == 0 && AppStorage.Get('openPerm') == 0) { - console.info('WebViewUtil, controllerShow is null') - this.controllerShow = new WebController() - } - return this.controllerShow + onBackPress():void{ + LogUtil.info(this.TAG, "onBackPress") + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) + this.controllerShow.runJavaScript({ script: "get_html_content()" }) } } \ No newline at end of file diff --git a/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets b/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets deleted file mode 100644 index 54175a316b2b68a780caacd96c1eade25a1f25ec..0000000000000000000000000000000000000000 --- a/product/phone/src/main/ets/MainAbility/pages/NoteHome.ets +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' -import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' -import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' -import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' -import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' -import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' -import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' -import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' -import {SysDefFolderUuid} from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' -import LayoutUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets' -import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' - -@Entry -@Component -export struct NoteHomeComp { - @Provide('RefreshFlag') refreshFlag: number = 0 - @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') - @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') - @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - - // 当前文件夹、笔记、分栏 - @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') - @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') - @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section') - @Provide('SelectedColor') selectedColor: string = circleColorArray[0] - @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 - @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 - @Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开 - @Provide('Search') search: boolean = false // 是否处于搜索状态 - @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 - @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 - - TAG = "NoteHomeComp" - - build() { - Flex({ justifyContent: FlexAlign.Start }) { - // Folder list display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { - FolderListComp() - } - .flexShrink(0) - .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) - .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).folderListWeight) - .height(StyleConstants.PERCENTAGE_100) - .visibility( - LayoutUtil.getWidthWeightMessage(this.sectionStatus) - .folderListVisibility == 0 ? Visibility.None : Visibility.Visible) - .enabled(this.search ? false : true) - - Divider() - .vertical(true) - .strokeWidth(1) - .color($r("app.color.divider_color_182431")) - .height("100%") - .opacity(StyleConstants.OPACITY_10) - // Note list display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { - NoteListComp() - } - .flexShrink(0) - .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) - .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteListWeight) - .height(StyleConstants.PERCENTAGE_100) - .visibility( - LayoutUtil.getWidthWeightMessage(this.sectionStatus) - .noteListVisibility == 0 ? Visibility.None : Visibility.Visible) - - Divider() - .vertical(true) - .strokeWidth(1) - .color($r("app.color.divider_color_182431")) - .height("100%") - .opacity(StyleConstants.OPACITY_10) - // Note content display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { - NoteContentComp() - } - .flexShrink(0) - .backgroundColor($r("app.color.notecontent_color_ffffff")) - .width(LayoutUtil.getWidthWeightMessage(this.sectionStatus).noteCotentWeight) - .height(StyleConstants.PERCENTAGE_100) - .enabled(this.longpress || this.search && this.inputKeyword.length == 0 ? false : true) - } - .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) - } - - aboutToAppear(): void{ - LogUtil.info(this.TAG, "aboutToAppear") - } - - aboutToDisappear(): void{ - LogUtil.info(this.TAG, "aboutToDisappear") - } -} \ 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 7fef71723d544389c550d04136cea1b72d3931b2..79772b70b8db011b962f5e84f4855fb9f981fe7a 100644 --- a/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets +++ b/product/phone/src/main/ets/MainAbility/pages/NoteHomePortrait.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,26 +28,29 @@ import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/bas @Entry @Component export struct NoteHomePortraitComp { - @Provide('RefreshFlag') refreshFlag: number = 0 @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - // 当前文件夹、笔记、分栏 +// 当前文件夹、笔记、分栏 @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') @Provide('SectionStatus') sectionStatus: number = 1; // 表示分栏状态, 3表示三分栏, 2表示二分栏,1表示一分栏 @Provide('LastSectionStatus') lastSectionStatus: number = 1; // 记录分栏上一次的状态 @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 - @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 - @Provide('ChooseNote') chooseNote: boolean = false // 是否选择笔记进行打开 + +// 分栏状态 + @Provide('ExpandStatus') expandStatus: boolean = AppStorage.Get('Expand') // 笔记本折叠展开状态 + @Provide('ChooseNote') chooseNote: boolean = AppStorage.Get('Choose') // 是否选择笔记进行打开 + @Provide('Search') search: boolean = false // 是否处于搜索状态 @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 @Provide('SelectedAll') selectedAll:boolean = false; @Provide('EditModel') editModel: boolean = false + controllerShow: WebController TAG = "NoteHomeComp" @@ -70,17 +73,6 @@ export struct NoteHomePortraitComp { .width(StyleConstants.PERCENTAGE_60) .height(StyleConstants.PERCENTAGE_100) .visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible) - - - // Note content display area - if(this.chooseNote == true ) { - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { - NoteContentCompPortrait() - } - .backgroundColor($r("app.color.notecontent_color_ffffff")) - .width(StyleConstants.PERCENTAGE_100) - .height(StyleConstants.PERCENTAGE_100) - } } .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) } diff --git a/product/phone/src/main/resources/base/element/color.json b/product/phone/src/main/resources/base/element/color.json index 6e6bbdac32de78757f85ad89f172343d2d82fa5a..23674b867de2c4512eae37f886b611eb44eb0e07 100644 --- a/product/phone/src/main/resources/base/element/color.json +++ b/product/phone/src/main/resources/base/element/color.json @@ -91,6 +91,110 @@ { "name": "font_stylecolor_AD182431", "value": "#AD182431" + }, + { + "name": "New_folder_input_box_color", + "value": "#FFFFFF" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ No newline at end of file diff --git a/product/phone/src/main/resources/base/element/string.json b/product/phone/src/main/resources/base/element/string.json index acd4635b4360dc8df47911ab5f7eb9121f4642fa..522035231224349594b5ed2dec6cf5cc9640823d 100644 --- a/product/phone/src/main/resources/base/element/string.json +++ b/product/phone/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/phone/src/main/resources/en_US/element/string.json b/product/phone/src/main/resources/en_US/element/string.json index acbe6f3dab36de535c5933ec661d0e1f82b11967..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/phone/src/main/resources/en_US/element/string.json +++ b/product/phone/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "Name" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/phone/src/main/resources/rawfile/editor_style.css b/product/phone/src/main/resources/rawfile/editor_style.css index 9f7121f75abee2a52f66cab923ae7bcf720dbfd0..abf650a03b41d3e337c45387269afacb1db9f6c7 100644 --- a/product/phone/src/main/resources/rawfile/editor_style.css +++ b/product/phone/src/main/resources/rawfile/editor_style.css @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/product/phone/src/main/resources/rawfile/rich_editor.js b/product/phone/src/main/resources/rawfile/rich_editor.js index 53b746d3cac6970b706297d04d31f5821dadcab5..c30a8ddf69186fd993eb193849f2cfad34f71349 100644 --- a/product/phone/src/main/resources/rawfile/rich_editor.js +++ b/product/phone/src/main/resources/rawfile/rich_editor.js @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,19 +25,6 @@ RICH_EDITOR.getHtml = function() { return RICH_EDITOR.editor.innerHTML; } -RICH_EDITOR.getText = function() { - console.log(RICH_EDITOR.editor.innerText); - return RICH_EDITOR.editor.innerText; -} - -RICH_EDITOR.setBaseTextColor = function(color) { - RICH_EDITOR.editor.style.color = color; -} - -RICH_EDITOR.setBaseFontSize = function(size) { - RICH_EDITOR.editor.style.fontSize = size; -} - RICH_EDITOR.undo = function() { document.execCommand('undo', false, null); } @@ -174,13 +161,6 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); } -RICH_EDITOR.setTextBackgroundColor = function(color) { - RICH_EDITOR.restorerange(); - document.execCommand("styleWithCSS", null, true); - document.execCommand('hiliteColor', false, color); - document.execCommand("styleWithCSS", null, false); -} - RICH_EDITOR.setFontSize = function(fontSize){ document.execCommand("fontSize", false, fontSize); } @@ -192,10 +172,6 @@ RICH_EDITOR.execFontSize = function (size, unit) { fontElements.style.fontSize = size + 'px' }; -RICH_EDITOR.setHeading = function(heading) { - document.execCommand('formatBlock', false, ''); -} - RICH_EDITOR.setIndent = function() { document.execCommand('indent', false, null); } @@ -216,12 +192,7 @@ RICH_EDITOR.setJustifyRight = function() { document.execCommand('justifyRight', false, null); } -RICH_EDITOR.setBlockquote = function() { - document.execCommand('formatBlock', false, '
'); -} - RICH_EDITOR.insertImage = function(url) { - console.log("js,url:" + url) var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false) @@ -291,17 +262,17 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ } function get_html_content() { - console.log('hhh Ark WebComponent'); + console.log('get_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtml(htmlString) - console.log('hhh objName.test result:' + str); + console.log('get_html_content end'); } function save_html_content() { - console.log('hhh Ark WebComponent'); + console.log('save_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtmlSave(htmlString) - console.log('hhh objName.test result:' + str); + console.log('save_html_content end'); } function scheduled_save_content() { diff --git a/product/phone/src/main/resources/zh_CN/element/string.json b/product/phone/src/main/resources/zh_CN/element/string.json index fb355baaa36d57d35d46cb9b79df976621b604ad..d8cc1649a2b74453ef6c1a37bb5f953b6cf99d66 100644 --- a/product/phone/src/main/resources/zh_CN/element/string.json +++ b/product/phone/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/tablet/src/main/config.json b/product/tablet/src/main/config.json index bc6af9fac9e9a63fe44f30a481e705966dee4c1a..bd5f01225dec3242bc6f834d690245d07462a9d6 100644 --- a/product/tablet/src/main/config.json +++ b/product/tablet/src/main/config.json @@ -59,7 +59,8 @@ }, "pages": [ "pages/MyNoteHome", - "pages/NoteHome" + "pages/NoteHome", + "pages/NoteContentHome" ], "name": "MainAbility", "window": { diff --git a/product/tablet/src/main/ets/MainAbility/MainAbility.ts b/product/tablet/src/main/ets/MainAbility/MainAbility.ts index ef95f8f69536dc29e49b92076b120fcf0c49edae..4fdad236d31128f3bb75a49e202db0886e8bab94 100644 --- a/product/tablet/src/main/ets/MainAbility/MainAbility.ts +++ b/product/tablet/src/main/ets/MainAbility/MainAbility.ts @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,23 +14,27 @@ */ import Ability from '@ohos.application.Ability' -import {WebViewUtil} from './WebViewUtil.ets' import fileio from '@ohos.fileio' export default class MainAbility extends Ability { + private Tag = "Tablet_Note_MainAbility" + onCreate(want, launchParam) { - console.log("MainAbility onCreate, launchReason is " + launchParam.launchReason) + console.info(this.Tag + " onCreate, launchReason is " + launchParam.launchReason) if (launchParam.launchReason == 3) { // 获取对端的迁移数据 - let continueFolder: string = want.parameters["ContinueFolder"] let continueNote: string = want.parameters["ContinueNote"] let continueSection: number = want.parameters["ContinueSection"] - // 迁移数据存入AppStorage - AppStorage.SetOrCreate('ContinueFolder', continueFolder) + console.info(this.Tag + " continueSection : " + continueSection) AppStorage.SetOrCreate('ContinueNote', continueNote) AppStorage.SetOrCreate('ContinueSection', continueSection) // 设置迁移标记 - AppStorage.SetOrCreate('IsContinue', 1) + AppStorage.SetOrCreate('IsContinue', true) + + // 来自手机的迁移 + let isChoose: boolean = want.parameters["ContinueChoose"] + console.info(this.Tag + " from phone, isChoose : " + isChoose) + AppStorage.SetOrCreate('IsChoose', isChoose) this.context.restoreWindowStage(null) } AppStorage.SetOrCreate('openPhoto', 0) @@ -39,32 +43,23 @@ export default class MainAbility extends Ability { } onDestroy() { - console.log("MainAbility onDestroy") + console.info(this.Tag + " onDestroy") } onWindowStageCreate(windowStage) { - console.log("MainAbility onWindowStageCreate") + console.info(this.Tag + " onWindowStageCreate") windowStage.setUIContent(this.context, "pages/MyNoteHome", null) } onWindowStageDestroy() { - console.log("MainAbility onWindowStageDestroy") + console.info(this.Tag + " onWindowStageDestroy") } onForeground() { - console.log("MainAbility onForeground") + console.info(this.Tag + " onForeground") } onBackground() { - console.log("MainAbility onBackground") - let controllerShow = WebViewUtil.getWebController() - if (controllerShow == undefined || controllerShow == null) { - console.info("MainAbility onBackground, controllerShow is error") - } - console.log("MainAbility controllerShow : " + controllerShow) - controllerShow.runJavaScript({ - script: "get_html_content()" - }) - console.log("MainAbility controllerShow end") + console.info(this.Tag + " onBackground") } } \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets b/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets deleted file mode 100644 index 44ed6a2715c9a45cefd162633968411cc79da1ad..0000000000000000000000000000000000000000 --- a/product/tablet/src/main/ets/MainAbility/WebViewUtil.ets +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * WebView Util - */ -export class WebViewUtil { - private static controllerShow: WebController - - private constructor() { - - } - - public static getWebController(): WebController{ - console.info('WebViewUtil, getWebController') - if (!this.controllerShow && AppStorage.Get('openPhoto') == 0 && AppStorage.Get('openPerm') == 0) { - console.info('WebViewUtil, controllerShow is null') - this.controllerShow = new WebController() - } - return this.controllerShow - } - -} \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/app.ets b/product/tablet/src/main/ets/MainAbility/app.ets index 1e6c8b3d40694f57a81b67eca79af24449cdb756..00231a43a909b6c4cb48c86f3980db488ebaabc9 100644 --- a/product/tablet/src/main/ets/MainAbility/app.ets +++ b/product/tablet/src/main/ets/MainAbility/app.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets index 874c354b9448aa8a44c5407a11f5d1511a3ba66f..83ece2bb93d25ca1221a78800f809d32212e54c0 100644 --- a/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/MyNoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,26 +17,24 @@ import fileio from '@ohos.fileio' import bundle from '@ohos.bundle' import abilityAccessCtrl from '@ohos.abilityAccessCtrl' import {NoteHomeComp} from './NoteHome.ets' -import {NoteHomePortraitComp} from './NoteHomePortrait.ets' import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' import RdbStoreUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets' +import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' @Entry @Component export struct MyNoteHomeComp { @StorageLink('DBQueryFinished') dBQueryFinished: number = 0 @Provide('PortraitModel') portraitModel: boolean = false + @Provide('RefreshFlag') refreshFlag: number = 0 + private controllerShow: WebController = new WebController() private context = getContext(this) TAG = "MyNoteHomeComp" build() { Row() { if (this.dBQueryFinished == 1) { - if (this.portraitModel == true) { - NoteHomePortraitComp() - } else { - NoteHomeComp() - } + NoteHomeComp({ controllerShow: this.controllerShow }) } } .width('100%') @@ -104,4 +102,13 @@ export struct MyNoteHomeComp { aboutToDisappear(): void{ LogUtil.info(this.TAG, "aboutToDisappear") } + + onPageShow(): void{ + LogUtil.info(this.TAG, "onPageShow") + let currentNote = AppStorage.Get('NewNote') + if (currentNote != null) { + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setHtml('" + currentNote.content_text + "')" }) + } + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) + } } \ No newline at end of file diff --git a/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets similarity index 41% rename from common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets rename to product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets index 27dd60f3a18e5fc6f71630e9fdb323cd137ba718..14e624423b331c83d26072d70e0dc69b84189149 100644 --- a/common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteContentHome.ets @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,23 +13,29 @@ * limitations under the License. */ -/** - * WebView Util - */ -export class WebViewUtil { - private static controllerShow: WebController +import {NoteContent} from '../../../../../../../common/component/src/main/ets/default/NoteContent.ets' +import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' - private constructor() { +@Entry +@Component +struct NoteContentHome { + private controllerShow: WebController = new WebController() + TAG = "NoteContentHome" + build() { + // Note content display area + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { + NoteContent({ controllerShow: this.controllerShow }) + } + .backgroundColor($r("app.color.notecontent_color_ffffff")) + .width('100%') + .height('100%') } - public static getWebController(): WebController{ - console.info('WebViewUtil, getWebController') - if (!this.controllerShow) { - console.info('WebViewUtil, controllerShow is null') - this.controllerShow = new WebController() - } - return this.controllerShow + onBackPress():void{ + LogUtil.info(this.TAG, "onBackPress") + this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) + this.controllerShow.runJavaScript({ script: "get_html_content()" }) } } \ No newline at end of file diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets index 7251496d49593148ae99a23b854fd3e1d46a14b9..84d9e6d5c6421ff7f85ffe6f98c07b85d8354f4a 100644 --- a/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets +++ b/product/tablet/src/main/ets/MainAbility/pages/NoteHome.ets @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,18 +24,16 @@ import NoteData from '../../../../../../../common/utils/src/main/ets/default/mod import {SysDefFolderUuid} from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/EnumData.ets' import LayoutUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LayoutUtil.ets' import NoteUtil from '../../../../../../../common/utils/src/main/ets/default/baseUtil/NoteUtil.ets' -import {WebViewUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/WebViewUtil.ets' import mediaquery from '@ohos.mediaquery' @Entry @Component export struct NoteHomeComp { - @Provide('RefreshFlag') refreshFlag: number = 0 @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - // 当前文件夹、笔记、分栏 +// 当前文件夹、笔记、分栏 @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section') @@ -49,7 +47,8 @@ export struct NoteHomeComp { @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 @Provide('SelectedAll') selectedAll: boolean = false @Provide('EditModel') editModel: boolean = false //编辑模式:临时方案 - private controllerShow: WebController = WebViewUtil.getWebController() //第三栏展示 + @Provide('Issave') issave: number = 0 + controllerShow: WebController TAG = "NoteHomeComp" @@ -116,6 +115,17 @@ export struct NoteHomeComp { LogUtil.info(this.TAG, "aboutToAppear") this.narrowWinListener.on('change', this.onWinSizeChange.bind(this)) this.sectionStatus = this.narrowWinListener.matches ? 2 : 3 + let isContinue = AppStorage.Get('IsContinue') + LogUtil.info(this.TAG, "aboutToAppear, isContinue : " + isContinue) + if (isContinue) { + this.sectionStatus = AppStorage.Get('Section') + } + // continue from phone + let isChoose = AppStorage.Get('IsChoose') + LogUtil.info(this.TAG, "aboutToAppear, isChoose : " + isChoose) + if (isChoose) { + this.sectionStatus = 1 + } } aboutToDisappear(): void{ diff --git a/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets b/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets deleted file mode 100644 index 5968cae3fbfb5234ebf1bbbfbb18427ece55d05a..0000000000000000000000000000000000000000 --- a/product/tablet/src/main/ets/MainAbility/pages/NoteHomePortrait.ets +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {FolderListComp} from '../../../../../../../common/component/src/main/ets/default/FolderListComp.ets' -import {NoteListComp} from '../../../../../../../common/component/src/main/ets/default/NoteListComp.ets' -import {NoteContentComp} from '../../../../../../../common/component/src/main/ets/default/NoteContentComp' -import StyleConstants from '../../../../../../../common/utils/src/main/ets/default/constants/StyleConstants.ets' -import {LogUtil} from '../../../../../../../common/utils/src/main/ets/default/baseUtil/LogUtil.ets' -import {circleColorArray} from '../../../../../../../common/utils/src/main/ets/default/model/NoteBaseData.ets' -import FolderData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/FolderData.ets' -import NoteData from '../../../../../../../common/utils/src/main/ets/default/model/databaseModel/NoteData.ets' - -@Entry -@Component -export struct NoteHomePortraitComp { - @Provide('RefreshFlag') refreshFlag: number = 0 - @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') - @StorageLink('AllFolderArray') AllFolderArray: FolderData[] = AppStorage.Link('AllFolderArray') - @StorageLink('CheckedNoteArray') CheckedNoteArray: NoteData[] = [] - - // 当前文件夹、笔记、分栏 - @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') - @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') - @Provide('SectionStatus') sectionStatus: number = AppStorage.Get('Section') - @Provide('SelectedColor') selectedColor: string = circleColorArray[0] - @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 - @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 - @Provide('ChooseNote') chooseNote: boolean = true // 是否选择笔记进行打开 - @Provide('Search') search: boolean = false // 是否处于搜索状态 - @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 - @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 - - TAG = "NoteHomeComp" - - build() { - Stack({ alignContent: Alignment.Start }) { - - // Note list display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { - NoteListComp() - } - .width(StyleConstants.PERCENTAGE_100) - .height(StyleConstants.PERCENTAGE_100) - .enabled(this.expandStatus ? false : true) - - //Folder list display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.Center }) { - FolderListComp() - } - .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) - .width(StyleConstants.PERCENTAGE_60) - .height(StyleConstants.PERCENTAGE_100) - .visibility(this.expandStatus == false ? Visibility.None : Visibility.Visible) - - - // Note content display area - Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { - NoteContentComp() - } - .backgroundColor($r("app.color.notecontent_color_ffffff")) - .width(StyleConstants.PERCENTAGE_100) - .height(StyleConstants.PERCENTAGE_100) - .visibility(this.chooseNote == false ? Visibility.None : Visibility.Visible) - } - .width(StyleConstants.PERCENTAGE_100) - .height(StyleConstants.PERCENTAGE_100) - } - - aboutToAppear(): void{ - LogUtil.info(this.TAG, "aboutToAppear") - } - - aboutToDisappear(): void{ - LogUtil.info(this.TAG, "aboutToDisappear") - } -} \ 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 6e6bbdac32de78757f85ad89f172343d2d82fa5a..23674b867de2c4512eae37f886b611eb44eb0e07 100644 --- a/product/tablet/src/main/resources/base/element/color.json +++ b/product/tablet/src/main/resources/base/element/color.json @@ -91,6 +91,110 @@ { "name": "font_stylecolor_AD182431", "value": "#AD182431" + }, + { + "name": "New_folder_input_box_color", + "value": "#FFFFFF" + }, + { + "name": "category_already_exist_font_color", + "value": "#FA2A2D" + }, + { + "name": "create_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "delete_note_bg_color", + "value": "#FFFFFF" + }, + { + "name": "choose_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "title_input_bg_color", + "value": "#FFFFFF" + }, + { + "name": "Edit_title_bg_color", + "value": "#FFFFFF" + }, + { + "name": "press_folder_bg_color", + "value": "#FFFFFF" + }, + { + "name": "modified_time_font_color", + "value": "#A3A7AD" + }, + { + "name": "delete_font_color", + "value": "#182431" + }, + { + "name": "recover_font_color", + "value": "#182431" + }, + { + "name": "list_font_color", + "value": "#182431" + }, + { + "name": "style_font_color", + "value": "#182431" + }, + { + "name": "photo_font_color", + "value": "#182431" + }, + { + "name": "all_notes_font_color", + "value": "#182431" + }, + { + "name": "num_of_notes_font_color", + "value": "#A3A7AD" + }, + { + "name": "note_selected_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color", + "value": "#182431" + }, + { + "name": "note_title_font_color_blue", + "value": "#0000ff" + }, + { + "name": "list_modified_time_font_color", + "value": "#99182431" + }, + { + "name": "Recently_delete_prompt_font_color", + "value": "#18181A" + }, + { + "name": "Empty_page_font_color", + "value": "#A3A7AD" + }, + { + "name": "search_note_caret_color", + "value": "#F86D05" + }, + { + "name": "set_top_font_color", + "value": "#182431" + }, + { + "name": "move_font_color", + "value": "#182431" + }, + { + "name": "check_all_font_color", + "value": "#182431" } ] } \ No newline at end of file diff --git a/product/tablet/src/main/resources/base/element/string.json b/product/tablet/src/main/resources/base/element/string.json index b27e5711573ec0bac80f8b16c8a07b04653dbee9..8ac010350d924e2ad157cb5c5d0c81a149b6ac48 100644 --- a/product/tablet/src/main/resources/base/element/string.json +++ b/product/tablet/src/main/resources/base/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?" diff --git a/product/tablet/src/main/resources/base/media/tick_thick.svg b/product/tablet/src/main/resources/base/media/tick_thick.svg index ca03aeffca1cffce401404f626ca0d9250aec3a3..7db3a2014c767a11f2e20fbe2bdd11b17528b756 100644 --- a/product/tablet/src/main/resources/base/media/tick_thick.svg +++ b/product/tablet/src/main/resources/base/media/tick_thick.svg @@ -1 +1 @@ -勾 粗 \ No newline at end of file +勾 粗 \ No newline at end of file diff --git a/product/tablet/src/main/resources/en_US/element/string.json b/product/tablet/src/main/resources/en_US/element/string.json index a7618c3e9a3b813e6e9a55e2fd463012cfae0a6d..8529f1b81ecaf343aef05f44e5aad139272bda41 100644 --- a/product/tablet/src/main/resources/en_US/element/string.json +++ b/product/tablet/src/main/resources/en_US/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "DELETE" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "Do you want to delete this folder and its contents?" diff --git a/product/tablet/src/main/resources/rawfile/editor_style.css b/product/tablet/src/main/resources/rawfile/editor_style.css index dfb83e11437ebf4eff807f79d47cb0d3ea76c7f9..abf650a03b41d3e337c45387269afacb1db9f6c7 100644 --- a/product/tablet/src/main/resources/rawfile/editor_style.css +++ b/product/tablet/src/main/resources/rawfile/editor_style.css @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,7 +16,7 @@ html { height: 15%; font-family: sans-serif; --webkit-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; } body { diff --git a/product/tablet/src/main/resources/rawfile/rich_editor.js b/product/tablet/src/main/resources/rawfile/rich_editor.js index 53b746d3cac6970b706297d04d31f5821dadcab5..c30a8ddf69186fd993eb193849f2cfad34f71349 100644 --- a/product/tablet/src/main/resources/rawfile/rich_editor.js +++ b/product/tablet/src/main/resources/rawfile/rich_editor.js @@ -1,5 +1,5 @@ -/** - * Copyright (c) 2021 Huawei Device Co., Ltd. +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,19 +25,6 @@ RICH_EDITOR.getHtml = function() { return RICH_EDITOR.editor.innerHTML; } -RICH_EDITOR.getText = function() { - console.log(RICH_EDITOR.editor.innerText); - return RICH_EDITOR.editor.innerText; -} - -RICH_EDITOR.setBaseTextColor = function(color) { - RICH_EDITOR.editor.style.color = color; -} - -RICH_EDITOR.setBaseFontSize = function(size) { - RICH_EDITOR.editor.style.fontSize = size; -} - RICH_EDITOR.undo = function() { document.execCommand('undo', false, null); } @@ -174,13 +161,6 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); } -RICH_EDITOR.setTextBackgroundColor = function(color) { - RICH_EDITOR.restorerange(); - document.execCommand("styleWithCSS", null, true); - document.execCommand('hiliteColor', false, color); - document.execCommand("styleWithCSS", null, false); -} - RICH_EDITOR.setFontSize = function(fontSize){ document.execCommand("fontSize", false, fontSize); } @@ -192,10 +172,6 @@ RICH_EDITOR.execFontSize = function (size, unit) { fontElements.style.fontSize = size + 'px' }; -RICH_EDITOR.setHeading = function(heading) { - document.execCommand('formatBlock', false, ''); -} - RICH_EDITOR.setIndent = function() { document.execCommand('indent', false, null); } @@ -216,12 +192,7 @@ RICH_EDITOR.setJustifyRight = function() { document.execCommand('justifyRight', false, null); } -RICH_EDITOR.setBlockquote = function() { - document.execCommand('formatBlock', false, '
'); -} - RICH_EDITOR.insertImage = function(url) { - console.log("js,url:" + url) var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false) @@ -291,17 +262,17 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ } function get_html_content() { - console.log('hhh Ark WebComponent'); + console.log('get_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtml(htmlString) - console.log('hhh objName.test result:' + str); + console.log('get_html_content end'); } function save_html_content() { - console.log('hhh Ark WebComponent'); + console.log('save_html_content'); var htmlString = encodeURI(RICH_EDITOR.getHtml()) var str = callBackToApp.callbackhtmlSave(htmlString) - console.log('hhh objName.test result:' + str); + console.log('save_html_content end'); } function scheduled_save_content() { diff --git a/product/tablet/src/main/resources/zh_CN/element/string.json b/product/tablet/src/main/resources/zh_CN/element/string.json index a48ce08cf932a3c4af493b1cedf61c47a38a2cb4..8ed957f19d9ba2df4c8a5cf2f1335fe8590b47b4 100644 --- a/product/tablet/src/main/resources/zh_CN/element/string.json +++ b/product/tablet/src/main/resources/zh_CN/element/string.json @@ -60,10 +60,6 @@ "name": "delete", "value": "删除" }, - { - "name": "name", - "value": "名称" - }, { "name": "delete_tips", "value": "是否删除此文件夹及其中的内容?"