mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 19:29:02 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const search = this.findRegExp
|
|
||||||
|
|
||||||
doc.descendants((node, pos) => {
|
doc.descendants((node, pos) => {
|
||||||
if (node.isText) {
|
if (node.isText) {
|
||||||
if (mergedTextNodes[index]) {
|
if (mergedTextNodes[index]) {
|
||||||
@ -88,8 +86,12 @@ export default class Search extends Extension {
|
|||||||
})
|
})
|
||||||
|
|
||||||
mergedTextNodes.forEach(({ text, pos }) => {
|
mergedTextNodes.forEach(({ text, pos }) => {
|
||||||
|
const search = this.findRegExp
|
||||||
let m
|
let m
|
||||||
while (m = search.exec(text)) {
|
while (m = search.exec(text)) {
|
||||||
|
if (m[0] === '') {
|
||||||
|
break
|
||||||
|
}
|
||||||
this.results.push({
|
this.results.push({
|
||||||
from: pos + m.index,
|
from: pos + m.index,
|
||||||
to: pos + m.index + m[0].length,
|
to: pos + m.index + m[0].length,
|
||||||
|
Loading…
Reference in New Issue
Block a user