From 66ee14d6fb293f55fd1b5ab0d24f71fbc16c8e5f Mon Sep 17 00:00:00 2001 From: "@two-thousand-or-three-thousand" Date: Wed, 14 Dec 2022 17:21:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: @two-thousand-or-three-thousand --- .../src/main/resources/rawfile/editor.html | 27 +++++------ .../main/resources/rawfile/editor_style.css | 2 +- .../src/main/resources/rawfile/rich_editor.js | 45 +++++++++++-------- .../src/main/ets/components/NoteContent.ets | 5 ++- .../main/ets/components/NoteContentComp.ets | 2 +- .../components/NoteContentCompPortrait.ets | 4 +- 6 files changed, 49 insertions(+), 36 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/editor.html b/common/resources/src/main/resources/rawfile/editor.html index c0a36c3..74bfa98 100644 --- a/common/resources/src/main/resources/rawfile/editor.html +++ b/common/resources/src/main/resources/rawfile/editor.html @@ -4,19 +4,20 @@ "editorJs" - - + + + + + + +
-
+ + +
+
@@ -34,8 +35,8 @@
- + + + \ No newline at end of file diff --git a/common/resources/src/main/resources/rawfile/editor_style.css b/common/resources/src/main/resources/rawfile/editor_style.css index 008c4d4..47fbaf0 100644 --- a/common/resources/src/main/resources/rawfile/editor_style.css +++ b/common/resources/src/main/resources/rawfile/editor_style.css @@ -37,7 +37,7 @@ body { background-size: cover; color: #182431; opacity: 0.9; - font-size: 16vp; + font-size: 24px; overflow: scroll; user-select: none; } diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index c18920a..e920c79 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -428,6 +428,13 @@ RICH_EDITOR.insertImageHtml = function (contents) { selection.getRangeAt(0).insertNode(img); }; +document.getElementById('addToDo').addEventListener('click', (e) => { + console.info(`lsq: e is ${JSON.stringify(e)}`) + if (e.id !== 'editorjs') { + e.preventDefault() + } +}) + document.getElementById('addToDo').addEventListener('click', () => { callBackToApp.addToDo() }) @@ -442,12 +449,12 @@ document.getElementById('openAlbum').addEventListener('click', () => { function changeSizeToRk() { document.getElementById('editorjs').style.fontSize = '24px'; - document.getElementById('img1').style.fontSize = '40px'; - document.getElementById('img1').style.fontSize = '40px'; - document.getElementById('img2').style.fontSize = '40px'; - document.getElementById('img2').style.fontSize = '40px'; - document.getElementById('img3').style.fontSize = '40px'; - document.getElementById('img3').style.fontSize = '40px'; + document.getElementById('img1').style.width = '40px'; + document.getElementById('img1').style.height = '40px'; + document.getElementById('img2').style.width = '40px'; + document.getElementById('img2').style.height = '40px'; + document.getElementById('img3').style.width = '40px'; + document.getElementById('img3').style.height = '40px'; document.getElementById('lable1').style.fontSize = '20px'; document.getElementById('lable2').style.fontSize = '20px'; document.getElementById('lable3').style.fontSize = '20px'; @@ -455,12 +462,12 @@ function changeSizeToRk() { function changeSizeToPhone() { document.getElementById('editorjs').style.fontSize = '16px'; - document.getElementById('img1').style.fontSize = '24px'; - document.getElementById('img1').style.fontSize = '24px'; - document.getElementById('img2').style.fontSize = '24px'; - document.getElementById('img2').style.fontSize = '24px'; - document.getElementById('img3').style.fontSize = '24px'; - document.getElementById('img3').style.fontSize = '24px'; + document.getElementById('img1').style.width = '24px'; + document.getElementById('img1').style.height = '24px'; + document.getElementById('img2').style.width = '24px'; + document.getElementById('img2').style.height = '24px'; + document.getElementById('img3').style.width = '24px'; + document.getElementById('img3').style.height = '24px'; document.getElementById('lable1').style.fontSize = '12px'; document.getElementById('lable2').style.fontSize = '12px'; document.getElementById('lable3').style.fontSize = '12px'; @@ -468,12 +475,12 @@ function changeSizeToPhone() { function changeSizeToTablet() { document.getElementById('editorjs').style.fontSize = '16px'; - document.getElementById('img1').style.fontSize = '28px'; - document.getElementById('img1').style.fontSize = '28px'; - document.getElementById('img2').style.fontSize = '28px'; - document.getElementById('img2').style.fontSize = '28px'; - document.getElementById('img3').style.fontSize = '28px'; - document.getElementById('img3').style.fontSize = '28px'; + document.getElementById('img1').style.width = '28px'; + document.getElementById('img1').style.height = '28px'; + document.getElementById('img2').style.width = '28px'; + document.getElementById('img2').style.height = '28px'; + document.getElementById('img3').style.width = '28px'; + document.getElementById('img3').style.height = '28px'; document.getElementById('lable1').style.fontSize = '12px'; document.getElementById('lable2').style.fontSize = '12px'; document.getElementById('lable3').style.fontSize = '12px'; @@ -484,7 +491,7 @@ function hiddenButton() { } RICH_EDITOR.getFocus = function() { - return document.GetElementById('editorjs').focus(); + return document.getElementById('editorjs').focus(); } document.getElementById('editorjs').addEventListener('click', () => { diff --git a/features/src/main/ets/components/NoteContent.ets b/features/src/main/ets/components/NoteContent.ets index cb5f256..a231ce1 100644 --- a/features/src/main/ets/components/NoteContent.ets +++ b/features/src/main/ets/components/NoteContent.ets @@ -192,7 +192,7 @@ export struct NoteContent { .onPageEnd((e) => { if (this.dpi <= 240) { this.controllerShow.runJavaScript({ script: "changeSizeToRk()" }) - } else if (this.dpi >= 320 && this.dpi > 240) { + } else if (this.dpi <= 320 && this.dpi > 240) { this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" }) } else { this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" }) @@ -250,6 +250,8 @@ export struct NoteContent { } aboutToDisappear(): void { + NoteUtil.refreshAll() + AppStorage.Set("refreshCurrentNote",true) clearInterval(timeID) LogUtil.info(TAG, "aboutToDisappear") } @@ -287,6 +289,7 @@ export struct ToolBarComp { LogUtil.info(TAG, "zoom, clearInterval timeID : " + timeID) clearInterval(timeID) } + AppStorage.Set("refreshCurrentNote",true) router.back() NoteUtil.refreshAll() }) diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 5fee10b..aea3ed2 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -230,7 +230,7 @@ export struct NoteContentComp { .onPageEnd((e) => { if (this.dpi <= 240) { this.controllerShow.runJavaScript({ script: "changeSizeToRk()" }) - } else if (this.dpi >= 320 && this.dpi > 240) { + } else if (this.dpi <= 320 && this.dpi > 240) { this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" }) } else { this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" }) diff --git a/features/src/main/ets/components/NoteContentCompPortrait.ets b/features/src/main/ets/components/NoteContentCompPortrait.ets index 3a269ce..8e22365 100644 --- a/features/src/main/ets/components/NoteContentCompPortrait.ets +++ b/features/src/main/ets/components/NoteContentCompPortrait.ets @@ -243,7 +243,7 @@ export struct NoteContentCompPortrait { .onPageEnd((e) => { if (this.dpi <= 240) { this.controllerShow.runJavaScript({ script: "changeSizeToRk()" }) - } else if (this.dpi >= 320 && this.dpi > 240) { + } else if (this.dpi <= 320 && this.dpi > 240) { this.controllerShow.runJavaScript({ script: "changeSizeToPhone()" }) } else { this.controllerShow.runJavaScript({ script: "changeSizeToTablet()" }) @@ -301,6 +301,7 @@ export struct NoteContentCompPortrait { } aboutToDisappear(): void { + NoteUtil.refreshAll() clearInterval(time_id) LogUtil.info(TAG, "aboutToDisappear") } @@ -580,6 +581,7 @@ export struct DeleteNoteComp { let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) RdbStoreUtil.delete(predicates_note, null) + NoteUtil.refreshAll() routePage() } AppStorage.SetOrCreate('isUpdate', false) -- Gitee