!94 修复流转中出现白屏

Merge pull request !94 from tangyiqiang/master
This commit is contained in:
openharmony_ci 2022-08-23 09:54:48 +00:00 committed by Gitee
commit 7ea998890e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 19 additions and 5 deletions

View File

@ -106,9 +106,11 @@ export struct NoteContent {
this.editContentFlag = true
}
LogUtil.info(TAG, "finish loadurl")
this.controllerShow.runJavaScript({
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
})
if (this.selectedNoteData) {
this.controllerShow.runJavaScript({
script: "RICH_EDITOR.setHtml('" + this.selectedNoteData.content_text + "')"
})
}
})
.zoomAccess(false)
.height('70%')

View File

@ -299,7 +299,13 @@ export default {
LogUtil.info(TAG, "noteData.content_text is null or undefined")
return imgNameArray
}
let html = atob(noteData.content_text)
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
let html = ""
if (base64regex.test(noteData.content_text)) {
html = atob(noteData.content_text)
} else {
html = noteData.content_text
}
if (html == undefined || html == null || html == "") {
return imgNameArray
}

View File

@ -120,7 +120,13 @@ export default class MainAbility extends Ability {
if (html == undefined || html == null || html == "") {
return srcArray
}
let realHtml = atob(html)
let base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/
let realHtml = ""
if (base64regex.test(html)) {
realHtml = atob(html)
} else {
realHtml = html;
}
let imgReg = /<img[^>]+>/g
let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i
let imgArray = realHtml.match(imgReg)