diff --git a/common/component/src/main/ets/components/CusDialogComp.ets b/common/component/src/main/ets/components/CusDialogComp.ets index 03bcf2de6fef1919a3b0554f9b0045f786537e0b..eecf811248690b2f8af58b5664241e8bf820f390 100644 --- a/common/component/src/main/ets/components/CusDialogComp.ets +++ b/common/component/src/main/ets/components/CusDialogComp.ets @@ -41,12 +41,13 @@ export struct NewOrEditFolderDialog { .fontSize(20) .height(56) .margin({ left: 24 }) + .fontWeight(FontWeight.Medium) // folder color choose Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { ForEach(circleColorArray, (colorStr: string) => { ColorCircleComp({ circleColor: colorStr }) }, colorStr => colorStr) - }.margin({ bottom: 24, left: 24, right: 24 }) + }.margin({ bottom: 12, left: 24, right: 24 }) // folder name input Flex({ wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { Image($r("app.media.folder")) @@ -61,6 +62,7 @@ export struct NewOrEditFolderDialog { .borderRadius(15) .backgroundColor($r("app.color.New_folder_input_box_color")) .width('100%') + .padding({left: 12, bottom: -12}) .onChange((value: string) => { this.inputName = value FolderUtil.duplicateDetection(this.inputName, this.AllFolderArray).then(result => { @@ -74,11 +76,17 @@ export struct NewOrEditFolderDialog { .margin({ left: 64, right: 24 }) .color((this.isExisted && this.inputName != this.oriInputName) ? $r("app.color.category_already_exist_divider_color") : $r("app.color.divider_color_182431")) - Text($r("app.string.category_already_exist")) - .fontSize(10) - .margin({ left: 64, top: 4 }) - .fontColor($r("app.color.category_already_exist_font_color")) - .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) + if(this.isExisted && this.inputName != this.oriInputName){ + Text($r("app.string.category_already_exist")) + .fontSize(10) + .margin({ left: 64, top: 4 }) + .fontColor($r("app.color.category_already_exist_font_color")) + .visibility((this.isExisted && this.inputName != this.oriInputName) ? Visibility.Visible : Visibility.None) + }else{ + Column(){} + .height(16) + .width("100%") + } // button group Flex({ wrap: FlexWrap.Wrap, justifyContent: FlexAlign.SpaceBetween }) { @@ -633,6 +641,7 @@ export struct EditTitleDialog { editTitleDialog: CustomDialogController confirm: (newTitle: string) => void @State inputName: string = "" + private isEquivalentVal: boolean = true build() { Column() { @@ -650,6 +659,12 @@ export struct EditTitleDialog { .backgroundColor($r("app.color.title_input_bg_color")) .width('90%') .onChange((value: string) => { + if (this.inputName == value) { + this.isEquivalentVal = true + } + else { + this.isEquivalentVal = false + } this.inputName = value }) }.margin({ bottom: 4, left: 24, right: 24 }) @@ -671,8 +686,8 @@ export struct EditTitleDialog { .strokeWidth(1) .color($r("app.color.divider_color_e4e4e4")) Text($r("app.string.save")) - .opacity((this.inputName == "") ? 0.4 : 1) - .enabled((this.inputName == "") ? false : true) + .opacity(this.isEquivalentVal ? 0.4 : 1) + .enabled(this.isEquivalentVal ? false : true) .fontSize(18) .textAlign(TextAlign.Center) .fontColor($r("app.color.button_color_419fff")) @@ -708,7 +723,11 @@ export struct EditContentDialogPortrait { Text($r("app.string.style")).margin({ top: 8 }) .fontSize(14).fontColor($r("app.color.font_stylecolor_AD182431")) - Image($r('app.media.cross')).height(16).width(16).margin({ top: 8 }).fillColor($r("app.color.font_stylecolor_AD182431")) + Image($r('app.media.cross')) + .height(16) + .width(16) + .margin({ top: 8 }) + .fillColor($r("app.color.font_stylecolor_AD182431")) .onClick(() => { this.editContentDialogCtl.close() }) diff --git a/common/component/src/main/ets/components/FolderListComp.ets b/common/component/src/main/ets/components/FolderListComp.ets index df972713d8646817510359ff4923fbd939dfac35..e2b28ee6005333b54eae92b2471ee6e5ddc69e3f 100644 --- a/common/component/src/main/ets/components/FolderListComp.ets +++ b/common/component/src/main/ets/components/FolderListComp.ets @@ -54,6 +54,7 @@ export struct FolderListComp { .width("100%") .margin({ top: 28 }) .padding({ left: 24 }) + .flexGrow(1) NoteAndCreateComp() // center @@ -65,8 +66,9 @@ export struct FolderListComp { } } }, folderItem => folderItem.name.toString()) - }.width('100%') + }.width('100%').height(450) .padding({ left: 12, right: 12 }) + .flexGrow(1) } @@ -80,8 +82,10 @@ export struct FolderListComp { controllerShow: this.controllerShow }) } + .backgroundColor($r("app.color.folderlist_bgcolor_f1f3f5")) + .flexGrow(0) .width("100%") - .padding({ left: 12, right: 12 }) + .padding({ left: 12, right: 12,bottom: 24 }) } .padding({ bottom: 24 }) .height("100%") @@ -408,7 +412,6 @@ export struct FolderListBackGround { .width("100%") .height("100%") .backgroundColor($r('app.color.folder_color_d6d6d6')) - .opacity(0.4) .blur(60) } } \ No newline at end of file diff --git a/common/component/src/main/ets/components/NoteContent.ets b/common/component/src/main/ets/components/NoteContent.ets index 2a4c95f1b4ef8f148eb7a18e47a14a84b2ebad6c..3c87f0a94fd785f425842e975ec2ce28f1a4c51a 100644 --- a/common/component/src/main/ets/components/NoteContent.ets +++ b/common/component/src/main/ets/components/NoteContent.ets @@ -116,9 +116,11 @@ export struct NoteContent { .width(StyleConstants.PERCENTAGE_100) .onClick(() => { // 添加定时器:3s自动保存 - timeID = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) - }, 3000) + if (timeID == undefined) { + timeID = setInterval(() => { + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) + }, 3000) + } LogUtil.info(TAG, "setInterval timeID : " + timeID) this.issave = 0 this.editModel = true @@ -135,6 +137,7 @@ export struct NoteContent { } aboutToDisappear(): void{ + clearInterval(timeID) LogUtil.info(TAG, "aboutToDisappear") } } @@ -166,7 +169,7 @@ export struct ToolBarComp { .width(24) .onClick(() => { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) // 清除定时器 if (timeID != undefined) { LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID) @@ -299,7 +302,7 @@ export struct ToolBarComp { .onClick(() => { this.issave = 1 // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) }) }.width(42) .height(42) diff --git a/common/component/src/main/ets/components/NoteContentComp.ets b/common/component/src/main/ets/components/NoteContentComp.ets index 9ded13eb8043102421e92afccbcaa1e447059d00..d3f58fc4fe274a07fb96808382e988deb7b4ba69 100644 --- a/common/component/src/main/ets/components/NoteContentComp.ets +++ b/common/component/src/main/ets/components/NoteContentComp.ets @@ -45,6 +45,7 @@ export struct NoteContentComp { @Consume('SectionStatus') sectionStatus: number @Consume('LastSectionStatus') lastSectionStatus: number @Consume('Issave') issave: number + @Consume('Search') search: boolean controllerShow: WebController private editContentFlag = false @State uri1: string = "" @@ -163,7 +164,7 @@ export struct NoteContentComp { this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(true)" }) // 添加定时器:3s自动保存 timeId = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) }, 3000) LogUtil.info(TAG, "setInterval timeId : " + timeId) // save continue data @@ -176,6 +177,13 @@ export struct NoteContentComp { } .height(StyleConstants.PERCENTAGE_100) .visibility(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) == 0 ? Visibility.Hidden : Visibility.Visible) + Column() { + } + .height("100%") + .width("100%") + .backgroundColor("#18181A") + .opacity(0.1) + .visibility(this.search ? Visibility.Visible : Visibility.Hidden) } .height(StyleConstants.PERCENTAGE_100) .width(StyleConstants.PERCENTAGE_100) @@ -186,6 +194,7 @@ export struct NoteContentComp { } aboutToDisappear(): void{ + clearInterval(timeId) LogUtil.info(TAG, "aboutToDisappear") } @@ -257,7 +266,7 @@ export struct NoteContentOverViewComp { Row() { Text(this.selectedNoteData.title) .fontSize(30) - .margin({ left: 12, right: 24 }) + .margin({ left: 0, right: 24 }) .onClick(() => { this.editModel = true this.sectionStatus = 1 @@ -274,11 +283,12 @@ export struct NoteContentOverViewComp { .fontSize(12) .padding({ top: 4, bottom: 4 }) .fontColor($r("app.color.modified_time_font_color")) - .margin({ left: 12 }) + .margin({ left: 0 }) Row() { Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) .fontSize(12) .fontColor($r("app.color.list_modified_time_font_color")) + .padding({ top: 1 }) Image($r('app.media.triangle')) .width(6) .height(12) @@ -373,7 +383,7 @@ export struct ToolBarComp { this.sectionStatus = this.lastSectionStatus // 退出全屏时存库 LogUtil.info(TAG, "close note" + this.selectedNoteData.uuid) - this.controllerShow.runJavaScript({ script: "save_html_content()" }) + this.controllerShow.runJavaScript({ script: "saveHtmlContent()" }) //退出键盘 inputMethod.getInputMethodController().stopInput(); // 清除定时器 @@ -438,7 +448,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.styles')) @@ -452,7 +462,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.picture_white')) @@ -490,7 +500,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { @@ -505,7 +515,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { Image($r('app.media.todo')) @@ -519,17 +529,17 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) Button({ type: ButtonType.Normal, stateEffect: true }) { - Image($r('app.media.tick_thick')) + Image($r('app.media.tick_thin')) .height(24) .width(24) .fillColor(this.issave == 0 ? Color.Black : Color.Grey) .onClick(() => { // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) if (this.selectedNoteData.title == "标题" && this.selectedNoteData.content_text == "") { LogUtil.info(TAG, "note is empty,save note failed") } @@ -538,7 +548,7 @@ export struct ToolBarComp { }.width(42) .height(42) .borderRadius(8) - .backgroundColor($r('app.color.color_ffffff')) + .backgroundColor($r('app.color.color_fffffB')) }.width(274) } else { Row({ space: StyleConstants.SPACE_24 }) { @@ -597,6 +607,7 @@ struct NoteDataMoveItemComp { Column() { Flex({ alignItems: ItemAlign.Center, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween }) { Text(FolderUtil.getFolderText(this.folderItem)) + .padding({ top: 3 }) .fontSize(16) .fontColor(FolderUtil.getFolderIconColor(this.AllFolderArray, this.folderItem.uuid, false)) .textAlign(TextAlign.Center) diff --git a/common/component/src/main/ets/components/NoteContentCompPortrait.ets b/common/component/src/main/ets/components/NoteContentCompPortrait.ets index c0cce27309169526d5586ff265f48989be8049dc..6135b4897debf08b6bb2cf69b9be699193bc9e46 100644 --- a/common/component/src/main/ets/components/NoteContentCompPortrait.ets +++ b/common/component/src/main/ets/components/NoteContentCompPortrait.ets @@ -121,7 +121,7 @@ export struct NoteContentCompPortrait { .onClick(() => { // 添加定时器:3s自动保存 time_id = setInterval(() => { - this.controllerShow.runJavaScript({ script: "scheduled_save_content()" }) + this.controllerShow.runJavaScript({ script: "scheduledSaveContent()" }) }, 3000) LogUtil.info(TAG, "setInterval time_id : " + time_id) this.editModel = true @@ -144,6 +144,7 @@ export struct NoteContentCompPortrait { } aboutToDisappear(): void{ + clearInterval(time_id) LogUtil.info(TAG, "aboutToDisappear") } } @@ -293,7 +294,7 @@ export struct ToolBarComp { .width(24) .responseRegion({ x: -15.0, y: -15.0, width: 54, height: 54 }) .onClick(() => { - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) // 清除定时器 if (time_id != undefined) { LogUtil.info(TAG, "back, clearInterval time_id : " + time_id) @@ -356,7 +357,7 @@ export struct ToolBarComp { Image($r('app.media.tick_thin')).height(24).width(24) .onClick(() => { // 保存笔记信息到数据库 - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) this.editModel = false }) }.width(42) diff --git a/common/component/src/main/ets/components/NoteListComp.ets b/common/component/src/main/ets/components/NoteListComp.ets index 77299927e7b733c200c1d45198d9d0eb930048dd..81de7b59455181affcf819e3fcd2399aa8465baa 100644 --- a/common/component/src/main/ets/components/NoteListComp.ets +++ b/common/component/src/main/ets/components/NoteListComp.ets @@ -128,7 +128,7 @@ struct NoteOverViewComp { Text(FolderUtil.getFolderText(this.selectedFolderData)) .fontSize(30) .fontColor($r("app.color.all_notes_font_color")) - .fontWeight(FontWeight.Bold) + .fontWeight(FontWeight.Medium) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row() { Text(FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid).toString()) @@ -384,7 +384,8 @@ export struct NoteItemListComp { .padding({ bottom: this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? 12 : 0 }) .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) .width('100%') - .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes ? Visibility.Visible : Visibility.None) + .visibility(this.selectedFolderData.uuid == SysDefFolderUuid.RecentDeletes + && FolderUtil.getNoteCount(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) > 0 ? Visibility.Visible : Visibility.None) Column() { List({ initialIndex: 0 }) { @@ -680,11 +681,12 @@ export struct SearchComp { }) Flex({ justifyContent: FlexAlign.Start }) { - Image($r('app.media.search')).width(18).height(18) + Image($r('app.media.search')).width(20).height(20) TextInput({ placeholder: $r('app.string.searchNote') }) .backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") : $r("app.color.color_ffffff")) .caretColor($r("app.color.search_note_caret_color")) .enabled(this.longpress ? false : true) + .padding({ left:6, top:1 }) .padding({left:6}) .onEditChange((isEditing: boolean) => { this.search = isEditing @@ -733,7 +735,7 @@ export struct OperateNoteCompForPortrait { }) opacityChange() { - if (this.CheckedNoteArray.length == 0) { + if (this.CheckedNoteArray.length == 0 && this.longpress == true) { this.greyOpacity = true LogUtil.info(TAG, "none checked array") } else { @@ -787,8 +789,8 @@ export struct OperateNoteCompForPortrait { }) } NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) - this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.longpress = false + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) @@ -814,6 +816,7 @@ export struct OperateNoteCompForPortrait { RdbStoreUtil.update(noteItem.toNoteObject(), predicates_note, null) }) this.longpress = false + this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) NoteUtil.unsetAllNotesChecked(this.CheckedNoteArray) }) Text($r("app.string.set_top")) diff --git a/common/resources/src/main/resources/base/element/color.json b/common/resources/src/main/resources/base/element/color.json index 416d7d4399a22cc1e88ac4fee2633eea28781e28..de3abcb26695a5f9bb60782a3f4380591113a503 100644 --- a/common/resources/src/main/resources/base/element/color.json +++ b/common/resources/src/main/resources/base/element/color.json @@ -2,11 +2,11 @@ "color": [ { "name": "color_ffffff", - "value": "#ffffff" + "value": "#F1F3F5" }, { "name": "color_fffffB", - "value": "#FFFBFBFB" + "value": "#ffffff" }, { "name": "delete_color_fa2a2d", diff --git a/common/resources/src/main/resources/rawfile/editor_style.css b/common/resources/src/main/resources/rawfile/editor_style.css index 06b9eb899100d8037967d7d5550e3be165f6830f..174544d846ba4c424ba09831ca141f57177abd96 100644 --- a/common/resources/src/main/resources/rawfile/editor_style.css +++ b/common/resources/src/main/resources/rawfile/editor_style.css @@ -50,7 +50,7 @@ body { .note-checkbox:checked { background: #F88805; - border: 2px solid #F88805; + border: 1px solid #F88805; outline: none; margin-left: 0px; margin-right: 0px; @@ -58,10 +58,12 @@ body { } .note-checkbox { - width: 20px; - height: 20px; + width: 18px; + height: 18px; + line-height: 22.4px; background-color: #ffffff; - border: 2px solid #555555; + border: 2px solid #182431; + opacity: 0.6; -webkit-border-radius: 50%; -webkit-appearance: none; -webkit-user-select: none; @@ -69,8 +71,8 @@ body { font-size: 0.8rem; margin-left: 0px; margin-top: 0px; - margin-right: 4px; - margin-bottom: 9px; + margin-right: 10px; + margin-bottom: 6px; outline: none; padding: 0; position: relative; @@ -84,6 +86,7 @@ body { .note-checkbox:checked+span { text-decoration: line-through; + margin-left: 10px; color: #F88805; opacity: 0.4; } diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 2dc3e957de6a708b34c1a27c18251b4e575cf109..95a0da5c9131341200bf2747382c2bb9f01ec76f 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -1,4 +1,4 @@ -/* +/* @file * 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. @@ -17,48 +17,54 @@ var RICH_EDITOR = {}; RICH_EDITOR.editor = document.getElementById('editorjs'); -RICH_EDITOR.setHtml = function(contents) { - RICH_EDITOR.editor.innerHTML = contents.replace(/%20/g, '+'); -} +RICH_EDITOR.setHtml = function (contents) { + var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; + if (base64regex.test(contents)) { + RICH_EDITOR.editor.innerHTML = decodeURIComponent(escape(atob(contents))); + } else { + RICH_EDITOR.editor.innerHTML = contents; + } +}; -RICH_EDITOR.getHtml = function() { +RICH_EDITOR.getHtml = function () { return RICH_EDITOR.editor.innerHTML; } -RICH_EDITOR.undo = function() { +RICH_EDITOR.undo = function () { document.execCommand('undo', false, null); } -RICH_EDITOR.redo = function() { +RICH_EDITOR.redo = function () { document.execCommand('redo', false, null); } -RICH_EDITOR.setBold = function() { +RICH_EDITOR.setBold = function () { document.execCommand('bold'); } -RICH_EDITOR.setItalic = function() { +RICH_EDITOR.setItalic = function () { document.execCommand('italic', false, null); } -RICH_EDITOR.setSubscript = function() { +RICH_EDITOR.setSubscript = function () { document.execCommand('subscript', false, null); } -RICH_EDITOR.setSuperscript = function() { +RICH_EDITOR.setSuperscript = function () { document.execCommand('superscript', false, null); } -RICH_EDITOR.setStrikeThrough = function() { +RICH_EDITOR.setStrikeThrough = function () { document.execCommand('strikeThrough', false, null); } -RICH_EDITOR.setUnderline = function() { +RICH_EDITOR.setUnderline = function () { document.execCommand('underline', false, null); } RICH_EDITOR.getListStyle = function () { - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -67,15 +73,15 @@ RICH_EDITOR.getListStyle = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { + if (child.nodeName === 'OL') { console.info('insertOrderedList') document.execCommand('insertOrderedList', false, null); - return child.style["list-style"] + return child.style['list-style'] } - if (child.nodeName == "UL") { + if (child.nodeName === 'UL') { console.info('insertUnorderedList') document.execCommand('insertUnorderedList', false, null); - return child.style["list-style"] + return child.style['list-style'] } if (child.parentNode) { child = child.parentNode @@ -90,11 +96,12 @@ RICH_EDITOR.getListStyle = function () { RICH_EDITOR.setNumbers = function () { let listStyle = RICH_EDITOR.getListStyle() - if(listStyle == "decimal") { + if(listStyle === 'decimal') { return } document.execCommand('insertOrderedList', false, null); - var selection, type; + var selection; + var type; if (window.getSelection) { selection = getSelection(); } @@ -103,8 +110,8 @@ RICH_EDITOR.setNumbers = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { - child.style["list-style"] = "decimal"; + if (child.nodeName == 'OL') { + child.style['list-style'] = 'decimal'; break; } if (child.parentNode) { @@ -119,7 +126,7 @@ RICH_EDITOR.setNumbers = function () { RICH_EDITOR.setABC = function () { let listStyle = RICH_EDITOR.getListStyle() - if(listStyle == "lower-alpha") { + if(listStyle === 'lower-alpha') { return } document.execCommand('insertOrderedList', false, null); @@ -132,8 +139,8 @@ RICH_EDITOR.setABC = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "OL") { - child.style["list-style"] = "lower-alpha"; + if (child.nodeName === 'OL') { + child.style['list-style'] = 'lower-alpha'; break; } if (child.parentNode) { @@ -148,7 +155,7 @@ RICH_EDITOR.setABC = function () { RICH_EDITOR.setBullets = function () { let listStyle = RICH_EDITOR.getListStyle() - if(listStyle == "disc") { + if (listStyle === 'disc') { return } document.execCommand('insertUnorderedList', false, null); @@ -161,8 +168,8 @@ RICH_EDITOR.setBullets = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "UL") { - child.style["list-style"] = "disc"; + if (child.nodeName === 'UL') { + child.style['list-style'] = 'disc'; break; } if (child.parentNode) { @@ -177,7 +184,7 @@ RICH_EDITOR.setBullets = function () { RICH_EDITOR.setSquare = function () { let listStyle = RICH_EDITOR.getListStyle() - if(listStyle == "square") { + if (listStyle === 'square') { return } document.execCommand('insertUnorderedList', false, null); @@ -190,8 +197,8 @@ RICH_EDITOR.setSquare = function () { try { var child = range.commonAncestorContainer.parentNode; for (var i = 0; i < 10; i++) { - if (child.nodeName == "UL") { - child.style["list-style"] = "square"; + if (child.nodeName === 'UL') { + child.style['list-style'] = 'square'; break; } if (child.parentNode) { @@ -208,29 +215,29 @@ RICH_EDITOR.setTextColor = function (color) { document.execCommand('foreColor', false, color); } -RICH_EDITOR.setFontSize = function(fontSize){ - document.execCommand("fontSize", false, fontSize); +RICH_EDITOR.setFontSize = function (fontSize) { + document.execCommand('fontSize', false, fontSize); } RICH_EDITOR.execFontSize = function (size, unit) { - document.execCommand("fontSize", false, "7"); - var fontElements = window.getSelection().anchorNode.parentNode - fontElements.removeAttribute("size"); - fontElements.style.fontSize = size + 'px' + document.execCommand('fontSize', false, '7'); + var fontElements = window.getSelection().anchorNode.parentNode; + fontElements.removeAttribute('size'); + fontElements.style.fontSize = size + 'px'; }; var pad = 24 -RICH_EDITOR.setIndent = function() { +RICH_EDITOR.setIndent = function () { var parents = document.getElementById('editorjs') parents.removeAttribute('padding-left'); pad = pad + 24 parents.style.paddingLeft = pad + 'px' } -RICH_EDITOR.setOutdent = function() { +RICH_EDITOR.setOutdent = function () { var parents = document.getElementById('editorjs') parents.removeAttribute('padding-left'); - if (pad == 24) { + if (pad === 24) { parents.style.paddingLeft = 24 + 'px' } else { pad = pad - 24 @@ -238,41 +245,45 @@ RICH_EDITOR.setOutdent = function() { } } -RICH_EDITOR.setJustifyLeft = function() { +RICH_EDITOR.setJustifyLeft = function () { document.execCommand('justifyLeft', false, null); } -RICH_EDITOR.setJustifyCenter = function() { +RICH_EDITOR.setJustifyCenter = function () { document.execCommand('justifyCenter', false, null); } -RICH_EDITOR.setJustifyRight = function() { +RICH_EDITOR.setJustifyRight = function () { document.execCommand('justifyRight', false, null); } -RICH_EDITOR.insertImage = function(url) { - var html = '

picvision

'; +RICH_EDITOR.insertImage = function (url) { + var html = '

picvision

'; RICH_EDITOR.insertHTML(html); RICH_EDITOR.editor.scrollIntoView(false) } -RICH_EDITOR.insertHTML = function(html) { +RICH_EDITOR.insertHTML = function (html) { document.execCommand('insertHTML', false, html); } -RICH_EDITOR.setDone = function() { +RICH_EDITOR.setDone = function () { var html = '  '; document.execCommand('insertHTML', false, html); } -RICH_EDITOR.addTodo=function(e){ - KEY_ENTER=13; - if(e.which == KEY_ENTER){ - var node=RICH_EDITOR.getSelectedAnchorNode(); - if(node&&node.nodeName=="#text"){ - node=node.parentElement; +RICH_EDITOR.addTodo = function (e) { + var KEY_ENTER; + KEY_ENTER = 13; + if (e.which === KEY_ENTER) { + var node = RICH_EDITOR.getSelectedAnchorNode(); + if (node && node.nodeName === '#text') { + node = node.parentElement; } - if(node&&node.nodeName=="SPAN"&&node.previousElementSibling&&node.previousElementSibling.className=='note-checkbox'){ + if (node && node.nodeName === 'SPAN' && node.previousElementSibling + && node.previousElementSibling.className === 'note-checkbox') { RICH_EDITOR.setTodo(); e.preventDefault(); } @@ -280,21 +291,23 @@ RICH_EDITOR.addTodo=function(e){ } RICH_EDITOR.setTodo = function () { - var parent = document.getElementById('editorjs') - var isContentEmpty = parent.innerHTML.trim().length == 0 || parent.innerHTML == '
'; - var html = (isContentEmpty ? '' : '
') + ' '; + var parent = document.getElementById('editorjs'); + var isContentEmpty = parent.innerHTML.trim().length === 0 || parent.innerHTML === '
'; + var html = (isContentEmpty ? '' : '
') + + '' + + ' '; document.execCommand('insertHTML', false, html); } function onCheckChange(checkbox) { - if (checkbox.checked == true) { - checkbox.setAttribute("checked", "checked"); + if (checkbox.checked === true) { + checkbox.setAttribute('checked', 'checked'); } else { - checkbox.removeAttribute("checked"); + checkbox.removeAttribute('checked'); } } -RICH_EDITOR.restorerange = function(){ +RICH_EDITOR.restorerange = function () { var selection = window.getSelection(); selection.removeAllRanges(); var range = document.createRange(); @@ -303,9 +316,11 @@ RICH_EDITOR.restorerange = function(){ selection.addRange(range); } -//获取光标开始位置归属节点 -RICH_EDITOR.getSelectedAnchorNode=function(){ - var node,selection; +// 获取光标开始位置归属节点 + +RICH_EDITOR.getSelectedAnchorNode = function () { + var node; + var selection; if (window.getSelection) { selection = getSelection(); node = selection.anchorNode; @@ -313,36 +328,39 @@ RICH_EDITOR.getSelectedAnchorNode=function(){ if (!node && document.selection) { selection = document.selection var range = selection.getRangeAt ? selection.getRangeAt(0) : selection.createRange(); - node = range.commonAncestorContainer ? range.commonAncestorContainer : - range.parentElement ? range.parentElement() : range.item(0); + node = range.commonAncestorContainer ? range.commonAncestorContainer : range.parentElement + ? range.parentElement() : range.item(0); } return node; } -function get_html_content() { - console.log('get_html_content'); - var htmlString = RICH_EDITOR.getHtml() - var str = callBackToApp.callbackhtml(htmlString) - console.log('get_html_content end'); +var callBackToApp; +function getHtmlContent() { + console.log('getHtmlContent'); + var htmlString = RICH_EDITOR.getHtml(); + htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); + var str = callBackToApp.callbackhtml(htmlString); + console.log('getHtmlContent end'); } -function save_html_content() { - console.log('save_html_content'); - var htmlString = RICH_EDITOR.getHtml() - var str = callBackToApp.callbackhtmlSave(htmlString.replace(/\+/g, '%20')) - console.log('save_html_content end'); +function saveHtmlContent() { + console.log('saveHtmlContent'); + var htmlString = RICH_EDITOR.getHtml(); + htmlString = window.btoa(unescape(encodeURIComponent(htmlString))); + var str = callBackToApp.callbackhtmlSave(htmlString); + console.log('saveHtmlContent end'); } -function scheduled_save_content() { - console.info('scheduled_save_content') - var htmlString = RICH_EDITOR.getHtml() - var str = callBackToApp.callbackScheduledSave(htmlString) - console.info('scheduled_save_content end') +function scheduledSaveContent() { + console.info('scheduledSaveContent'); + var htmlString = RICH_EDITOR.getHtml(); + var str = callBackToApp.callbackScheduledSave(htmlString); + console.info('scheduledSaveContent end'); } -RICH_EDITOR.getFontSizes = function(){ - document.execCommand("fontSize", false, null); - var fontElements = window.getSelection().anchorNode.parentNode - var getSize = fontElements.style.fontSize - var str = callBackToApp.callbackGetSize(getSize) -} \ No newline at end of file +RICH_EDITOR.getFontSizes = function () { + document.execCommand('fontSize', false, null); + var fontElements = window.getSelection().anchorNode.parentNode; + var getSize = fontElements.style.fontSize; + var str = callBackToApp.callbackGetSize(getSize); +}; diff --git a/common/utils/src/main/ets/default/model/NoteBaseData.ets b/common/utils/src/main/ets/default/model/NoteBaseData.ets index b5a09b7fc31d5da9a9074fc50996983027b584cd..3c2de8f7e435db1e59151f12060b787e92f100ef 100644 --- a/common/utils/src/main/ets/default/model/NoteBaseData.ets +++ b/common/utils/src/main/ets/default/model/NoteBaseData.ets @@ -16,7 +16,7 @@ import NoteData from '../model/databaseModel/NoteData' export const circleColorArray: string[] = [ - "#e84026", // 深红 + "#f86d05", // 深红 "#ff7500", // 浅红 "#ffbf00", // 黄色 "#41ba41", // 绿色 @@ -27,7 +27,7 @@ export const circleColorArray: string[] = [ ] export const fontColorArray: string[] = [ - "#e84026", // 深红 + "#f86d05", // 深红 "#ffbf00", // 黄色 "#41ba41", // 绿色 "#00aaee", // 中蓝 @@ -37,7 +37,7 @@ export const fontColorArray: string[] = [ ] export const unSelectedNoteBgColorMap = { - "#e84026": "#eecfcc", + "#f86d05": "#fff8eceb", "#ff7500": "#f3d9c4", "#ffbf00": "#f3e8c4", "#41ba41": "#cde7d1", @@ -49,7 +49,7 @@ export const unSelectedNoteBgColorMap = { } export const selectedNoteBgColorMap = { - "#e84026": "#eec4b8", + "#f86d05": "#eec4b8", "#ff7500": "#f1d8c7", "#ffbf00": "#f3cdb1", "#41ba41": "#d1dabc", 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 78fd18ecdd340991a862a20f44bc196a142c5623..d88fbadefd5a4f9702fabcea814d6c172a2a75f0 100644 --- a/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets +++ b/common/utils/src/main/ets/default/model/databaseModel/SysDefData.ets @@ -99,7 +99,7 @@ export default { "id": 7, "name": "工作", "uuid": SysDefFolderUuid.Work, - "color": "#e84026", + "color": "#f86d05", "folder_type": FolderType.CusDef, "is_deleted": Delete.No, "created_time": 1641636508000, @@ -162,14 +162,14 @@ export default { "title": "蛋糕做法", "uuid": "note4_uuid", "folder_uuid": SysDefFolderUuid.Life, - "content_text": '
' + + "content_text": '
' + '' + - '  糖60g
' + + '糖60g
' + '' + - '  玉米油40g
' + - '
    1. 添加鸡蛋、盐、糖、蛋糕粉
' + - '    2. 加入玉米油、牛奶,烤箱预热15分钟
' + - '    3. 加入葡萄干、核桃仁,烤箱定时40分钟

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

', "content_img": "", "note_type": NoteType.CusDef, "is_top": Top.No, diff --git a/product/phone/src/main/ets/pages/NoteContentHome.ets b/product/phone/src/main/ets/pages/NoteContentHome.ets index 89a4853742ff94431491ebb3e76cc2f9b088e030..d12a18e7e3b30b5279bf2ca495530af7b4afb458 100644 --- a/product/phone/src/main/ets/pages/NoteContentHome.ets +++ b/product/phone/src/main/ets/pages/NoteContentHome.ets @@ -40,7 +40,7 @@ struct NoteContentHome { onBackPress():void{ LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) } aboutToAppear(): void{ diff --git a/product/tablet/src/main/ets/pages/NoteContentHome.ets b/product/tablet/src/main/ets/pages/NoteContentHome.ets index 2dc330564514435523e4b83b0fbe20b69ae7e874..861a478de1924427aad179e9701440caf97ac0d0 100644 --- a/product/tablet/src/main/ets/pages/NoteContentHome.ets +++ b/product/tablet/src/main/ets/pages/NoteContentHome.ets @@ -40,7 +40,7 @@ struct NoteContentHome { onBackPress():void{ LogUtil.info(this.TAG, "onBackPress") this.controllerShow.runJavaScript({ script: "RICH_EDITOR.setInputEnabled(false)" }) - this.controllerShow.runJavaScript({ script: "get_html_content()" }) + this.controllerShow.runJavaScript({ script: "getHtmlContent()" }) inputMethod.getInputMethodController().stopInput() }