From bf29f3b262faac86473e0978cee60474a73ffaf2 Mon Sep 17 00:00:00 2001 From: zwx1126739 Date: Sat, 11 May 2024 15:33:46 +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 --- features/src/main/ets/components/CusDialogComp.ets | 7 ++++++- features/src/main/ets/components/FolderListComp.ets | 13 +++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/features/src/main/ets/components/CusDialogComp.ets b/features/src/main/ets/components/CusDialogComp.ets index 1a04055..6617af8 100644 --- a/features/src/main/ets/components/CusDialogComp.ets +++ b/features/src/main/ets/components/CusDialogComp.ets @@ -749,7 +749,12 @@ export struct EditContentDialogPortrait { private fontSize: number aboutToAppear() { - this.confirm("javascript:RICH_EDITOR.getFontSizes()") + try { + this.confirm("javascript:RICH_EDITOR.getFontSizes()"); + LogUtil.info(TAG, `runJavaScript success.`); + } catch (error) { + LogUtil.error(TAG, `runJavaScript failed.code:${JSON.stringify(error.code)},message:${JSON.stringify(error.message)}`); + } } build() { diff --git a/features/src/main/ets/components/FolderListComp.ets b/features/src/main/ets/components/FolderListComp.ets index 0203355..5b25660 100644 --- a/features/src/main/ets/components/FolderListComp.ets +++ b/features/src/main/ets/components/FolderListComp.ets @@ -190,7 +190,7 @@ struct FolderItemComp { @Consume('PortraitModel') portraitModel: boolean controllerShow: WebviewController @State isLongPress: boolean = false - TAG = "FolderListComp" + TAG = "FolderItemComp" @StorageLink('isUpdate') isUpdate: boolean = false // Folder Edit Dialog folderEditDialogCtl: CustomDialogController = new CustomDialogController({ @@ -292,9 +292,14 @@ struct FolderItemComp { } // 刷新web界面 if (this.portraitModel == false) { - this.controllerShow.runJavaScript( - "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" - ) + try { + this.controllerShow.runJavaScript( + "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" + ) + LogUtil.info(this.TAG, `runJavaScript success.`); + } catch (error) { + LogUtil.error(this.TAG, `runJavaScript failed.code:${JSON.stringify(error.code)},message:${JSON.stringify(error.message)}`); + } } // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())