Skip to content

Commit

Permalink
fix: allow to re-apply current mark for input rules and paste rules, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Oct 10, 2021
1 parent 3a7e202 commit 3958bf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/inputRules/markInputRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/pasteRules/markPasteRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 3958bf1

Please sign in to comment.