!296 修复备忘录jscrash

Merge pull request !296 from 张宏/note
This commit is contained in:
openharmony_ci 2024-10-21 07:10:44 +00:00 committed by Gitee
commit d5a52cc28d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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())