mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-16 03:39:00 +08:00
fix inline code input rule
This commit is contained in:
parent
43c29770d8
commit
2081aa75a7
@ -24,9 +24,7 @@ export default function (regexp, markType, getAttrs) {
|
|||||||
|
|
||||||
if (match[m]) {
|
if (match[m]) {
|
||||||
const matchStart = start + match[0].indexOf(match[m - 1])
|
const matchStart = start + match[0].indexOf(match[m - 1])
|
||||||
// matchEnd index is -1 because the last matching char is not yet member of transaction
|
const matchEnd = matchStart + match[m - 1].length
|
||||||
// and actually never will be because it triggered the inputrule and vanishes ;)
|
|
||||||
const matchEnd = matchStart + match[m - 1].length - 1
|
|
||||||
const textStart = matchStart + match[m - 1].lastIndexOf(match[m])
|
const textStart = matchStart + match[m - 1].lastIndexOf(match[m])
|
||||||
const textEnd = textStart + match[m].length
|
const textEnd = textStart + match[m].length
|
||||||
|
|
||||||
@ -52,7 +50,7 @@ export default function (regexp, markType, getAttrs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tr.addMark(markStart, markEnd, markType.create(attrs))
|
tr.addMark(markStart, markEnd, markType.create(attrs))
|
||||||
tr.removeStoredMark(markType) // Do not continue with mark.
|
tr.removeStoredMark(markType)
|
||||||
return tr
|
return tr
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user