fix: allow to re-apply current mark for input rules and paste rules, fix #2003

This commit is contained in:
Philipp Kühn 2021-10-10 22:23:32 +02:00
parent 3a7e202e71
commit 3958bf1c22
2 changed files with 4 additions and 6 deletions

View File

@ -39,11 +39,10 @@ export default function markInputRule(config: {
const excludedMarks = getMarksBetween(range.from, range.to, state)
.filter(item => {
// TODO: PR to add excluded to MarkType
// @ts-ignore
const { excluded } = item.mark.type
const excluded = item.mark.type.excluded as MarkType[]
return excluded.find((type: MarkType) => type.name === config.type.name)
return excluded.find(type => type === config.type && type !== item.mark.type)
})
.filter(item => item.to > textStart)

View File

@ -39,11 +39,10 @@ export default function markPasteRule(config: {
const excludedMarks = getMarksBetween(range.from, range.to, state)
.filter(item => {
// TODO: PR to add excluded to MarkType
// @ts-ignore
const { excluded } = item.mark.type
const excluded = item.mark.type.excluded as MarkType[]
return excluded.find((type: MarkType) => type.name === config.type.name)
return excluded.find(type => type === config.type && type !== item.mark.type)
})
.filter(item => item.to > textStart)