add basic inputrules and pasterules

This commit is contained in:
Philipp Kühn
2020-04-02 08:53:59 +02:00
parent b85df2b4c1
commit 28d5ae094b
10 changed files with 209 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { Mark } from '@tiptap/core'
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'
import { toggleMark } from 'prosemirror-commands'
import { MarkSpec } from 'prosemirror-model'
@@ -44,4 +44,16 @@ export default class Bold extends Mark {
}
}
inputRules() {
return [
markInputRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, this.schemaType),
]
}
pasteRules() {
return [
markPasteRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)/g, this.schemaType),
]
}
}