mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 02:59:01 +08:00
check for allowed marks in pasteRule, fix #643
This commit is contained in:
parent
15eb791b31
commit
1ee114be5d
@ -3,7 +3,7 @@ import { Slice, Fragment } from 'prosemirror-model'
|
||||
|
||||
export default function (regexp, type, getAttrs) {
|
||||
|
||||
const handler = fragment => {
|
||||
const handler = (fragment, parent) => {
|
||||
const nodes = []
|
||||
|
||||
fragment.forEach(child => {
|
||||
@ -16,7 +16,7 @@ export default function (regexp, type, getAttrs) {
|
||||
|
||||
// eslint-disable-next-line
|
||||
while (!isLink && (match = regexp.exec(text)) !== null) {
|
||||
if (match[1]) {
|
||||
if (parent.type.allowsMarkType(type) && match[1]) {
|
||||
const start = match.index
|
||||
const end = start + match[0].length
|
||||
const textStart = start + match[0].indexOf(match[1])
|
||||
@ -43,7 +43,7 @@ export default function (regexp, type, getAttrs) {
|
||||
nodes.push(child.cut(pos))
|
||||
}
|
||||
} else {
|
||||
nodes.push(child.copy(handler(child.content)))
|
||||
nodes.push(child.copy(handler(child.content, child)))
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user