feat: Added ckeditor Mention to <a> converter

pull/7619/head
Ruslan Semak 8 months ago
parent ddabfc9817
commit 2497096ff4

@ -83,11 +83,11 @@ export default {
} }
}) })
const feed = resp.data.pages.list.map(({title}) => { const feed = resp.data.pages.list.map((page) => {
return { return {
id: `@${title}`, id: '@' + page.title,
link: 'https://example.com', text: page.title,
userId: 1 link: page.path
} }
}) })
@ -137,8 +137,7 @@ export default {
// In order to create a proper object, use the toMentionAttribute helper method: // In order to create a proper object, use the toMentionAttribute helper method:
const mentionAttribute = this.editor.plugins.get('Mention').toMentionAttribute(viewItem, { const mentionAttribute = this.editor.plugins.get('Mention').toMentionAttribute(viewItem, {
// Add any other properties that you need. // Add any other properties that you need.
link: viewItem.getAttribute('href'), link: viewItem.getAttribute('href')
userId: viewItem.getAttribute('data-user-id')
}) })
return mentionAttribute return mentionAttribute
@ -157,9 +156,8 @@ export default {
} }
return writer.createAttributeElement('a', { return writer.createAttributeElement('a', {
class: 'mention', class: 'is-internal-link is-valid-page',
'data-mention': modelAttributeValue.id, 'data-mention': modelAttributeValue.id,
'data-user-id': modelAttributeValue.userId,
'href': modelAttributeValue.link 'href': modelAttributeValue.link
}, { }, {
// Make mention attribute to be wrapped by other attribute elements. // Make mention attribute to be wrapped by other attribute elements.

Loading…
Cancel
Save