added pasteRules to marks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Mark } from 'tiptap'
|
||||
import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
import { toggleMark, markInputRule, markPasteRule } from 'tiptap-commands'
|
||||
|
||||
export default class Bold extends Mark {
|
||||
|
||||
@@ -42,4 +42,10 @@ export default class Bold extends Mark {
|
||||
]
|
||||
}
|
||||
|
||||
pasteRules({ type }) {
|
||||
return [
|
||||
markPasteRule(/(?:\*\*|__)([^*_]+)(?:\*\*|__)/g, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Mark } from 'tiptap'
|
||||
import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
import { toggleMark, markInputRule, markPasteRule } from 'tiptap-commands'
|
||||
|
||||
export default class Code extends Mark {
|
||||
|
||||
@@ -32,4 +32,10 @@ export default class Code extends Mark {
|
||||
]
|
||||
}
|
||||
|
||||
pasteRules({ type }) {
|
||||
return [
|
||||
markPasteRule(/(?:`)([^`]+)(?:`)/g, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Mark } from 'tiptap'
|
||||
import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
import { toggleMark, markInputRule, markPasteRule } from 'tiptap-commands'
|
||||
|
||||
export default class Italic extends Mark {
|
||||
|
||||
@@ -34,4 +34,10 @@ export default class Italic extends Mark {
|
||||
]
|
||||
}
|
||||
|
||||
pasteRules({ type }) {
|
||||
return [
|
||||
markPasteRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)/g, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Mark } from 'tiptap'
|
||||
import { toggleMark, markInputRule } from 'tiptap-commands'
|
||||
import { toggleMark, markInputRule, markPasteRule } from 'tiptap-commands'
|
||||
|
||||
export default class Strike extends Mark {
|
||||
|
||||
@@ -44,4 +44,10 @@ export default class Strike extends Mark {
|
||||
]
|
||||
}
|
||||
|
||||
pasteRules({ type }) {
|
||||
return [
|
||||
markPasteRule(/~([^~]+)~/g, type),
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user