mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 21:35:53 +08:00
remove type from mentions
This commit is contained in:
parent
a60a851fc4
commit
5f740da53e
@ -7,7 +7,7 @@
|
|||||||
Mentions
|
Mentions
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
Yeah <span data-mention-type="user" data-mention-id="1">Philipp Kühn</span> and <span data-mention-type="user" data-mention-id="2">Hans Pagel</span>.
|
Yeah <span data-mention-id="1">Philipp Kühn</span> and <span data-mention-id="2">Hans Pagel</span>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -138,7 +138,6 @@ export default {
|
|||||||
this.insertMention({
|
this.insertMention({
|
||||||
pos: this.pos,
|
pos: this.pos,
|
||||||
attrs: {
|
attrs: {
|
||||||
type: 'user',
|
|
||||||
id: user.id,
|
id: user.id,
|
||||||
label: user.name,
|
label: user.name,
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,6 @@ export default class MentionNode extends Node {
|
|||||||
get schema() {
|
get schema() {
|
||||||
return {
|
return {
|
||||||
attrs: {
|
attrs: {
|
||||||
type: {},
|
|
||||||
id: {},
|
id: {},
|
||||||
label: {},
|
label: {},
|
||||||
},
|
},
|
||||||
@ -23,19 +22,17 @@ export default class MentionNode extends Node {
|
|||||||
'span',
|
'span',
|
||||||
{
|
{
|
||||||
class: 'mention',
|
class: 'mention',
|
||||||
'data-mention-type': node.attrs.type,
|
|
||||||
'data-mention-id': node.attrs.id,
|
'data-mention-id': node.attrs.id,
|
||||||
},
|
},
|
||||||
`@${node.attrs.label}`,
|
`@${node.attrs.label}`,
|
||||||
],
|
],
|
||||||
parseDOM: [
|
parseDOM: [
|
||||||
{
|
{
|
||||||
tag: 'span[data-mention-type][data-mention-id]',
|
tag: 'span[data-mention-id]',
|
||||||
getAttrs: dom => {
|
getAttrs: dom => {
|
||||||
const type = dom.getAttribute('data-mention-type')
|
|
||||||
const id = dom.getAttribute('data-mention-id')
|
const id = dom.getAttribute('data-mention-id')
|
||||||
const label = dom.innerText.split('@').join('')
|
const label = dom.innerText.split('@').join('')
|
||||||
return { type, id, label }
|
return { id, label }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user