This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2023-10-21 09:52:20 +00:00
|
|
|
import {Extension} from '@tiptap/core'
|
2023-10-21 09:33:49 +00:00
|
|
|
import Suggestion from '@tiptap/suggestion'
|
|
|
|
|
2023-10-21 09:46:02 +00:00
|
|
|
// Copied and adjusted from https://github.com/ueberdosis/tiptap/tree/252acb32d27a0f9af14813eeed83d8a50059a43a/demos/src/Experiments/Commands/Vue
|
|
|
|
|
2023-10-21 09:33:49 +00:00
|
|
|
export default Extension.create({
|
2023-10-22 09:02:03 +00:00
|
|
|
name: 'slash-menu-commands',
|
2023-10-21 09:33:49 +00:00
|
|
|
|
2023-10-21 09:52:20 +00:00
|
|
|
addOptions() {
|
|
|
|
return {
|
|
|
|
suggestion: {
|
|
|
|
char: '/',
|
|
|
|
command: ({editor, range, props}) => {
|
|
|
|
props.command({editor, range})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
2023-10-21 09:33:49 +00:00
|
|
|
|
2023-10-21 09:52:20 +00:00
|
|
|
addProseMirrorPlugins() {
|
|
|
|
return [
|
|
|
|
Suggestion({
|
|
|
|
editor: this.editor,
|
|
|
|
...this.options.suggestion,
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
},
|
2023-10-21 09:33:49 +00:00
|
|
|
})
|