This commit is contained in:
Robert Schäfer 2019-04-16 01:05:51 +02:00
parent d87a0d5694
commit b21df879c6
2 changed files with 19 additions and 16 deletions

View File

@ -184,7 +184,7 @@ import {
Strike,
Underline,
Link,
History,
History
} from 'tiptap-extensions'
import Mention from './nodes/Mention.js'
@ -535,7 +535,7 @@ li > p {
.editor {
.mention-suggestion {
color: $color-primary
color: $color-primary;
}
&__floating-menu {
position: absolute;

View File

@ -4,22 +4,25 @@ import { Mention as TipTapMention } from 'tiptap-extensions'
export default class Mention extends TipTapMention {
get schema() {
const schema = super.schema
schema.attrs = {
const patchedSchema = super.schema
patchedSchema.attrs = {
url: {},
label: {},
},
schema.toDOM = node => [
'a',
{
class: this.options.mentionClass,
href: node.attrs.url,
},
`${this.options.matcher.char}${node.attrs.label}`
]
schema.parseDOM = [
label: {}
}
patchedSchema.toDOM = node => {
return [
'a',
{
class: this.options.mentionClass,
href: node.attrs.url
},
`${this.options.matcher.char}${node.attrs.label}`
]
}
patchedSchema.parseDOM = [
// this is not implemented
]
return schema
return patchedSchema
}
}