Changes for page MentionsMacro

Last modified by Nawan Pangestu on 2026/03/31 20:19

From version 1.1
edited by Nawan Pangestu
on 2025/12/30 23:55
Change comment: Install extension [org.xwiki.platform:xwiki-platform-mentions-ui/17.10.1]
To version 2.1
edited by Nawan Pangestu
on 2026/03/31 20:19
Change comment: Install extension [org.xwiki.platform:xwiki-platform-mentions-ui/18.2.0]

Summary

Details

XWiki.JavaScriptExtension[0]
Code
... ... @@ -62,8 +62,10 @@
62 62   ckeditorPromise.then(ckeditor => {
63 63   function getUserMentionsConfig(editor) {
64 64   return {
65 - feed: function (opts, callback) {
66 - search(opts.query, callback);
65 + dataCallback: function (options, callback) {
66 + // Remove the marker prefix and replace non-breaking space.
67 + const text = options.query.substring(1).replaceAll('\u00A0', ' ');
68 + search(text, callback);
67 67   },
68 68   marker: '@',
69 69   minChars: 0,
... ... @@ -105,13 +105,8 @@
105 105   });
106 106  
107 107   function maybeEnableUserMentions(editor) {
108 - return waitForEditorReady(editor).then((editor) => {
109 - // Check if the Mentions plugin is enabled for the given editor instance.
110 - // TODO: Add support for disabling the user mentions for a particular editor instance (without disabling all
111 - // types of mentions).
112 - if (editor.plugins.mentions) {
113 - editor.plugins.mentions.instances.push(new ckeditor.plugins.mentions(editor, getUserMentionsConfig(editor)));
114 - }
110 + return waitForEditorReady(editor).then(editor => {
111 + new CKEDITOR.plugins.AdvancedAutoComplete(editor, getUserMentionsConfig(editor));
115 115   return editor;
116 116   });
117 117   }
XWiki.StyleSheetExtension[0]
Code
... ... @@ -1,11 +1,17 @@
1 1  .xwiki-mention {
2 - background-color: $services.mentions.mentionsColor;
2 + --mentions-color: $services.mentions.mentionsColor;
3 + --mentions-self-color: $services.mentions.selfMentionsForeground;
4 + --mentions-self-bg: $services.mentions.selfMentionsColor;
5 + background-color: var(--mentions-color);
3 3   border-radius: 10px;
4 - padding: 2px 5px 2px 5px;
7 + padding: 1px 5px 1px 5px;
8 + border: 1px solid var(--dropdown-divider-bg);
5 5  }
6 6  
7 7  .xwiki-mention.user.self {
8 - background-color: $services.mentions.selfMentionsColor;
12 + background-color: var(--mentions-self-bg);
13 + color: var(--mentions-self-color);
14 + border: 0;
9 9  }
10 10  
11 11  .xwiki-mention.removed {