mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 11:09:01 +08:00
fix infinite loop on some RegExp
This commit is contained in:
parent
87995cb93c
commit
0476d35599
@ -67,8 +67,6 @@ export default class Search extends Extension {
|
||||
return
|
||||
}
|
||||
|
||||
const search = this.findRegExp
|
||||
|
||||
doc.descendants((node, pos) => {
|
||||
if (node.isText) {
|
||||
if (mergedTextNodes[index]) {
|
||||
@ -88,8 +86,12 @@ export default class Search extends Extension {
|
||||
})
|
||||
|
||||
mergedTextNodes.forEach(({ text, pos }) => {
|
||||
const search = this.findRegExp
|
||||
let m
|
||||
while (m = search.exec(text)) {
|
||||
if (m[0] === '') {
|
||||
break
|
||||
}
|
||||
this.results.push({
|
||||
from: pos + m.index,
|
||||
to: pos + m.index + m[0].length,
|
||||
|
Loading…
Reference in New Issue
Block a user