From 96fa197335f5cf40beb1b6bd61a648a01dcd9cbb Mon Sep 17 00:00:00 2001 From: zhanghong Date: Fri, 20 Dec 2024 16:38:11 +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: zhanghong --- .../src/main/ets/components/NoteContentComp.ets | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 9b8e539..978c3dc 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -808,12 +808,18 @@ export struct ToolBarComp { // update note to db let predicates_note = RdbStoreUtil.getRdbPredicates(TableName.NoteTable) predicates_note.equalTo(NoteTableColumn.Uuid, this.selectedNoteData.uuid) - RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null) + RdbStoreUtil.update(this.selectedNoteData.toNoteObject(), predicates_note, null); if (this.selectedFolderData.uuid === SysDefFolderUuid.MyFavorites) { - this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), SysDefFolderUuid.MyFavorites)!; - this.controllerShow.runJavaScript( - "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" - ) + this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray')!, SysDefFolderUuid.MyFavorites)!; + try { + this.controllerShow.runJavaScript( + "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')" + ); + LogUtil.info(TAG,`setHtml success`); + } catch (error) { + LogUtil.error(TAG, `setHtml failed.code:${JSON.stringify(error.code)}, + message:${JSON.stringify(error.message)}`); + } // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject()) AppStorage.SetOrCreate('ContinueNote', continueNote) -- Gitee