diff --git a/features/src/main/ets/components/FolderListComp.ets b/features/src/main/ets/components/FolderListComp.ets index 64264d9..013946d 100644 --- a/features/src/main/ets/components/FolderListComp.ets +++ b/features/src/main/ets/components/FolderListComp.ets @@ -29,6 +29,7 @@ import RdbStoreUtil from '@ohos/utils/src/main/ets/default/baseUtil/RdbStoreUtil import FolderUtil from '@ohos/utils/src/main/ets/default/baseUtil/FolderUtil' import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil' import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil' +import webview from '@ohos.web.webview'; // Folder list component @Component @@ -37,7 +38,7 @@ export struct FolderListComp { @Consume('SectionStatus') sectionStatus: number @Consume('ExpandStatus') expandStatus: boolean // 笔记本折叠展开状态 @StorageLink('breakPoint') breakPoints: string = 'lg' - controllerShow: WebviewController + controllerShow: webview.WebviewController = new webview.WebviewController(); TAG = "FolderListComp" @Consume('AsideWidth') asideWidth: number diff --git a/features/src/main/ets/components/NoteContent.ets b/features/src/main/ets/components/NoteContent.ets index b05cd2e..82a52ed 100644 --- a/features/src/main/ets/components/NoteContent.ets +++ b/features/src/main/ets/components/NoteContent.ets @@ -34,6 +34,7 @@ import OperationUtils from '@ohos/utils/src/main/ets/default/baseUtil/OperationU import router from '@system.router'; import inputMethod from '@ohos.inputMethod'; import { folderTextMap } from '@ohos/utils/src/main/ets/default/model/NoteBaseData' +import webview from '@ohos.web.webview'; const TAG = "NoteContent" @@ -46,7 +47,7 @@ export struct NoteContent { @Provide('Issave') issave: number = 0 @Provide('EditModel') editModel: boolean = false @StorageLink('dpi') dpi: number = 240 - controllerShow: WebviewController + controllerShow: webview.WebviewController = new webview.WebviewController(); private editContentFlag = false @StorageLink('ScrollTopPercent') scrollTopPercent: number = 0.0 diff --git a/features/src/main/ets/components/NoteContentComp.ets b/features/src/main/ets/components/NoteContentComp.ets index 2731c25..4bbc63f 100644 --- a/features/src/main/ets/components/NoteContentComp.ets +++ b/features/src/main/ets/components/NoteContentComp.ets @@ -36,6 +36,7 @@ import mediaquery from '@ohos.mediaquery' import inputMethod from '@ohos.inputMethod'; import { folderTextMap } from '@ohos/utils/src/main/ets/default/model/NoteBaseData' import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import webview from '@ohos.web.webview'; const TAG = "NoteContentComp" @@ -56,7 +57,7 @@ export struct NoteContentComp { @Consume('Issave') issave: number @Consume('Search') search: boolean @StorageLink('dpi') dpi: number = 240 - controllerShow: WebviewController + controllerShow: webview.WebviewController = new webview.WebviewController(); private editContentFlag = false @State uri1: string = "" private context = getContext(this) @@ -493,7 +494,7 @@ export struct ToolBarComp { @StorageLink('AllNoteArray') AllNoteArray: NoteData[] = AppStorage.Link('AllNoteArray') @Consume('EditModel') editModel: boolean @Consume('Issave') issave: number - controllerShow: WebviewController + controllerShow: webview.WebviewController = new webview.WebviewController(); private context = getContext(this) noteDataDeleteDialogCtl: CustomDialogController = new CustomDialogController({ builder: DeleteDialog({ onConfirm: this.onDeleteConfirm.bind(this) }), @@ -525,7 +526,11 @@ export struct ToolBarComp { } this.refreshFlag = (this.refreshFlag == 0 ? 1 : 0) this.selectedNoteData = NoteUtil.getFirstNoteData(AppStorage.Get('AllNoteArray'), this.selectedFolderData.uuid) - this.controllerShow.runJavaScript("RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text! + "')") + try { + this.controllerShow.runJavaScript("RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text! + "')"); + } catch (error) { + LogUtil.info(TAG, `setHtml error. code:${JSON.stringify(error.code)},message:${error.message}`); + } this.chooseNote = false // save continue data let continueNote: string = JSON.stringify(this.selectedNoteData.toNoteObject())