Fix:修复富文本模式下,搜索替换后换行会丢失的问题
This commit is contained in:
parent
ec7a8cdd43
commit
0075c44b29
@ -1,4 +1,4 @@
|
||||
import { bfsWalk, getTextFromHtml, isUndef } from '../utils/index'
|
||||
import { bfsWalk, getTextFromHtml, isUndef, replaceHtmlText } from '../utils/index'
|
||||
|
||||
// 搜索插件
|
||||
class Search {
|
||||
@ -152,9 +152,10 @@ class Search {
|
||||
getReplacedText(node, searchText, replaceText) {
|
||||
let { richText, text } = node.nodeData.data
|
||||
if (richText) {
|
||||
text = getTextFromHtml(text)
|
||||
return replaceHtmlText(text, searchText, replaceText)
|
||||
} else {
|
||||
return text.replaceAll(searchText, replaceText)
|
||||
}
|
||||
return text.replaceAll(searchText, replaceText)
|
||||
}
|
||||
|
||||
// 发送事件
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user