From e465e59afe67698c87b4f45e18734443809768be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 25 Jul 2023 12:27:21 +0200 Subject: [PATCH] Fix missing 'data-mention-id' on 'a' tag in webapp --- webapp/components/Editor/Editor.vue | 6 ++++-- webapp/components/Editor/nodes/Mention.js | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index d145e220a..6f6f9ed4f 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -240,8 +240,10 @@ export default { selectItem(item) { const typeAttrs = { mention: { - id: item.id, - dataMentionId: item.dataMentionId ?? item.id, + id: { hrefId: item.id, dataMentionId: item.dataMentionId ?? item.id }, + // this solution would better, but "dataMentionId" is then undefined in "webapp/components/Editor/nodes/Mention.js" > "toDOM" + // id: item.id, + // dataMentionId: item.dataMentionId ?? item.id, label: item.slug, }, hashtag: { diff --git a/webapp/components/Editor/nodes/Mention.js b/webapp/components/Editor/nodes/Mention.js index 696667742..3742233a6 100644 --- a/webapp/components/Editor/nodes/Mention.js +++ b/webapp/components/Editor/nodes/Mention.js @@ -13,8 +13,12 @@ export default class Mention extends TipTapMention { 'a', { class: this.options.mentionClass, - href: `/profile/${node.attrs.id}`, - 'data-mention-id': node.attrs.dataMentionId, + href: `/profile/${node.attrs.id.hrefId}`, + 'data-mention-id': + node.attrs.id.dataMentionId !== undefined ? node.attrs.id.dataMentionId : 'undefined', + // better solution that doesn't work, see "webapp/components/Editor/Editor.vue" > "selectItem" + // href: `/profile/${node.attrs.id}`, + // 'data-mention-id': node.attrs.dataMentionId, // "dataMentionId" is undefined target: '_blank', }, `${this.options.matcher.char}${node.attrs.label} `,