Skip to content

Commit

Permalink
BREAKING CHANGE: data-mention is not used to parse a mention id or la…
Browse files Browse the repository at this point in the history
…bel anymore
  • Loading branch information
philippkuehn committed Jun 14, 2021
1 parent 299580a commit c64761a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/demos/Examples/Community/React/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default () => {
],
content: `
<p>
What do you all think about the new <span data-mention="Winona Ryder"></span> movie?
What do you all think about the new <span data-mention data-id="Winona Ryder"></span> movie?
</p>
`,
})
Expand Down
2 changes: 1 addition & 1 deletion docs/src/demos/Examples/Community/Vue/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default {
],
content: `
<p>
What do you all think about the new <span data-mention="Winona Ryder"></span> movie?
What do you all think about the new <span data-mention data-id="Winona Ryder"></span> movie?
</p>
`,
})
Expand Down
6 changes: 3 additions & 3 deletions docs/src/demos/Nodes/Mention/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export default {
],
content: `
<p>Hi everyone! Don’t forget the daily stand up at 8 AM.</p>
<p><span data-mention="Jennifer Grey"></span> Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
<p><span data-mention="Winona Ryder"></span> <span data-mention="Axl Rose"></span> Let’s go through your most important points quickly.</p>
<p>I have a meeting with <span data-mention="Christina Applegate"></span> and don’t want to come late.</p>
<p><span data-mention data-id="Jennifer Grey"></span> Would you mind to share what you’ve been working on lately? We fear not much happened since Dirty Dancing.
<p><span data-mention data-id="Winona Ryder"></span> <span data-mention data-id="Axl Rose"></span> Let’s go through your most important points quickly.</p>
<p>I have a meeting with <span data-mention data-id="Christina Applegate"></span> and don’t want to come late.</p>
<p>– Thanks, your big boss</p>
`,
})
Expand Down
4 changes: 2 additions & 2 deletions packages/extension-mention/src/mention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Mention = Node.create<MentionOptions>({
default: null,
parseHTML: element => {
return {
id: element.getAttribute('data-mention'),
id: element.getAttribute('data-id'),
}
},
renderHTML: attributes => {
Expand All @@ -58,7 +58,7 @@ export const Mention = Node.create<MentionOptions>({
}

return {
'data-mention': attributes.id,
'data-id': attributes.id,
}
},
},
Expand Down

1 comment on commit c64761a

@shadow-light
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does the parser identify mention nodes now? As it still looks for span[data-mention] in parseHTML() but that attribute is no longer added when mention nodes are created. So the extension doesn't appear to be working anymore. The demo still works though because data-mention has been manually added.

Please sign in to comment.