add basic inputrules and pasterules
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -36,4 +36,18 @@ export default class Italic extends Mark {
|
||||
}
|
||||
}
|
||||
|
||||
inputRules() {
|
||||
return [
|
||||
markInputRule(/(?:^|[^_])(_([^_]+)_)$/, this.schemaType),
|
||||
// markInputRule(/(?:^|[^*])(\*([^*]+)\*)$/, this.schemaType),
|
||||
]
|
||||
}
|
||||
|
||||
pasteRules() {
|
||||
return [
|
||||
markPasteRule(/_([^_]+)_/g, this.schemaType),
|
||||
// markPasteRule(/\*([^*]+)\*/g, this.schemaType),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user