diff --git a/common/component/src/main/ets/components/CusDialogComp.ets b/common/component/src/main/ets/components/CusDialogComp.ets index 8d7b16e..cc1e779 100644 --- a/common/component/src/main/ets/components/CusDialogComp.ets +++ b/common/component/src/main/ets/components/CusDialogComp.ets @@ -365,15 +365,18 @@ export struct NoteDataMoveDialog { } } +let inSetValue = AppStorage.Link('inSetValue') @CustomDialog export struct EditContentDialog { editContentDialogCtl: CustomDialogController confirm: (excuteJs: string) => void @State selectFontColor: string = fontColorArray[0] - @State inSetValue: number = 20 + @StorageLink("inSetValue") inSetValue: number = 4 private circleColor: string private fontSize: number - + aboutToAppear(){ + this.confirm("javascript:RICH_EDITOR.getFontSizes()") + } build() { Row() { Column() { @@ -599,7 +602,7 @@ export struct EditContentDialog { .showSteps(false) .showTips(false) .onChange((value: number, mode: SliderChangeMode) => { - this.inSetValue = value + AppStorage.Set('inSetValue', value) this.fontSize = value + 12 this.confirm("javascript:RICH_EDITOR.execFontSize('" + this.fontSize + "')") LogUtil.info(TAG, 'value:' + value + 'mode:' + mode.toString()) diff --git a/common/component/src/main/ets/components/NoteContentComp.ets b/common/component/src/main/ets/components/NoteContentComp.ets index 5ebb9da..c2286a1 100644 --- a/common/component/src/main/ets/components/NoteContentComp.ets +++ b/common/component/src/main/ets/components/NoteContentComp.ets @@ -34,6 +34,7 @@ const TAG = "NoteContentComp" var timeId : number // Note content component +let inSetValue = AppStorage.Link('inSetValue') @Component export struct NoteContentComp { @Consume('SelectedNoteData') selectedNoteData: NoteData @@ -100,8 +101,13 @@ export struct NoteContentComp { let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) LogUtil.info(TAG, 'callbackScheduledSave, set continue note success') - } + }, + callbackGetSize: (size) => { + if(size) { + AppStorage.Set('inSetValue', parseInt(size.slice(0,-2)) - 12) + } + } } build() { @@ -125,7 +131,7 @@ export struct NoteContentComp { this.controllerShow.registerJavaScriptProxy({ object: this.noteContent, name: "callBackToApp", // html--> name.method - methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave"], + methodList: ["callbackhtml", "callbackhtmlSave", "callbackScheduledSave", "callbackGetSize"], }) LogUtil.info(TAG, "finish register") this.controllerShow.refresh() @@ -268,11 +274,11 @@ export struct NoteContentOverViewComp { .fontSize(12) .padding({ top: 4, bottom: 4 }) .fontColor($r("app.color.modified_time_font_color")) - .margin({ left: 12 }) + .margin({ left: 12 }) Row() { Text(FolderUtil.getFolderText(FolderUtil.getFolderData(AppStorage.Get('AllFolderArray'), this.selectedNoteData.folder_uuid))) .fontSize(12) - .fontColor($r("app.color.list_modified_time_font_color")) + .fontColor($r("app.color.list_modified_time_font_color")) Image($r('app.media.triangle')) .width(6) .height(12) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index dbc3d7c..f093018 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -327,4 +327,11 @@ function scheduled_save_content() { var htmlString = RICH_EDITOR.getHtml() var str = callBackToApp.callbackScheduledSave(htmlString) console.info('scheduled_save_content 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