diff options
-rw-r--r-- | index.html | 1 | ||||
-rw-r--r-- | src/EditorFactory.js | 20 | ||||
-rw-r--r-- | src/extensions/Mention.vue | 2 | ||||
-rw-r--r-- | src/extensions/RichText.js | 6 | ||||
-rw-r--r-- | src/tests/fixtures/basic.md | 2 |
5 files changed, 21 insertions, 10 deletions
diff --git a/index.html b/index.html index 508eed98a..48fa56975 100644 --- a/index.html +++ b/index.html @@ -16,6 +16,7 @@ } OC = { webroot: '/OC_WEBROOT', + config: {}, isUserAdmin() { return true } diff --git a/src/EditorFactory.js b/src/EditorFactory.js index b76b18b97..7fa3b8499 100644 --- a/src/EditorFactory.js +++ b/src/EditorFactory.js @@ -63,7 +63,17 @@ const createEditor = ({ content, onCreate, onUpdate, extensions, enableRichEditi richEditingExtensions = [ Markdown, RichText.configure({ - extensions: [EditableTable], + extensions: [ + EditableTable, + Mention.configure({ + HTMLAttributes: { + class: 'mention', + }, + suggestion: MentionSuggestion({ + session, + }), + }), + ], }), Emoji.configure({ suggestion: { @@ -116,14 +126,6 @@ const createEditor = ({ content, onCreate, onUpdate, extensions, enableRichEditi }, }, }), - Mention.configure({ - HTMLAttributes: { - class: 'mention', - }, - suggestion: MentionSuggestion({ - session, - }), - }), Placeholder.configure({ emptyNodeClass: 'is-empty', placeholder: t('text', 'Add notes, lists or links …'), diff --git a/src/extensions/Mention.vue b/src/extensions/Mention.vue index 86d10abd3..2a27a8e68 100644 --- a/src/extensions/Mention.vue +++ b/src/extensions/Mention.vue @@ -38,7 +38,7 @@ export default { }, computed: { isCurrentUser() { - return this.node.attrs.id === getCurrentUser().uid + return this.node.attrs.id === getCurrentUser()?.uid }, }, } diff --git a/src/extensions/RichText.js b/src/extensions/RichText.js index 4a7a902eb..9d65be624 100644 --- a/src/extensions/RichText.js +++ b/src/extensions/RichText.js @@ -43,6 +43,7 @@ import BulletList from './../nodes/BulletList.js' import TaskList from './../nodes/TaskList.js' import TaskItem from './../nodes/TaskItem.js' import Callout from './../nodes/Callouts.js' +import Mention from './../extensions/Mention.js' /* eslint-enable import/no-named-as-default */ import { Strong, Italic, Strike, Link, Underline } from './../marks/index.js' @@ -91,6 +92,11 @@ export default Extension.create({ Dropcursor, KeepSyntax, FrontMatter, + Mention.configure({ + HTMLAttributes: { + class: 'mention', + }, + }), ] if (this.options.link !== false) { defaultExtensions.push(Link.configure({ diff --git a/src/tests/fixtures/basic.md b/src/tests/fixtures/basic.md index cf0fcfdf1..b70779e9d 100644 --- a/src/tests/fixtures/basic.md +++ b/src/tests/fixtures/basic.md @@ -9,3 +9,5 @@ |table| heading| row| | --- | --- | --- | |first| body| row| + +@[user](mention://user/user) |