From c0503b2a46a30bb52e0eac9ca71359f9e4ee395b Mon Sep 17 00:00:00 2001 From: zwx1126739 Date: Fri, 6 Sep 2024 10:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=87=E5=BF=98=E5=BD=95js?= =?UTF-8?q?crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zwx1126739 --- .../src/main/ets/components/NoteListComp.ets | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/features/src/main/ets/components/NoteListComp.ets b/features/src/main/ets/components/NoteListComp.ets index 7713621..0095c1d 100644 --- a/features/src/main/ets/components/NoteListComp.ets +++ b/features/src/main/ets/components/NoteListComp.ets @@ -451,12 +451,18 @@ export struct NoteItemComp { LogUtil.info(TAG, "NoteItemComp, set continue note success") } if (this.portraitModel == false) { - this.controllerShow.runJavaScript( - "RICH_EDITOR.setHtml('" + this.selectedNoteData?.content_text + "')" - ) - this.controllerShow.runJavaScript( - "RICH_EDITOR.cancelSelection()" - ) + try { + this.controllerShow.runJavaScript( + "RICH_EDITOR.setHtml('" + this.selectedNoteData?.content_text + "')" + ) + this.controllerShow.runJavaScript( + "RICH_EDITOR.cancelSelection()" + ) + LogUtil.info(TAG, `runJavaScript setHtml and cancelSelection success`); + } catch (error) { + LogUtil.error(TAG, `runJavaScript setHtml and cancelSelection failed. + code:${JSON.stringify(error.code)},message:${JSON.stringify(error.message)}`); + } } if (this.portraitModel == true) { AppStorage.SetOrCreate('NewNote', this.selectedNoteData) -- Gitee