Änderungen von Dokument MentionsMacro
Zuletzt geändert von xwikiadmin am 2024/06/24 14:17
Von Version 8.1
bearbeitet von xwikiadmin
am 2024/06/24 14:17
am 2024/06/24 14:17
Änderungskommentar:
Install extension [org.xwiki.platform:xwiki-platform-mentions-ui/16.4.0]
Auf Version 5.1
bearbeitet von xwikiadmin
am 2023/04/25 10:46
am 2023/04/25 10:46
Änderungskommentar:
Install extension [org.xwiki.platform:xwiki-platform-mentions-ui/14.10.8]
Zusammenfassung
-
Objekte (2 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -97,35 +97,19 @@ 97 97 }; 98 98 } 99 99 100 - // Enable the user mentions for the CKEditor instances that have been already created. 101 - Object.values(ckeditor.instances).forEach(maybeEnableUserMentions); 102 - // Enable the user mentions for the CKEditor instances that are going to be created from now on. 103 - ckeditor.on('instanceCreated', (event) => { 104 - maybeEnableUserMentions(event.editor); 105 - }); 106 - 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 - } 115 - return editor; 116 - }); 100 + function updateConfig(editor) { 101 + editor.config.mentions = editor.config.mentions || []; 102 + editor.config.mentions.push(getUserMentionsConfig(editor)); 117 117 } 118 118 119 - function waitForEditorReady(editor) { 120 - return new Promise((resolve, reject) => { 121 - if (editor.status === 'ready') { 122 - resolve(editor); 123 - } else { 124 - editor.once('instanceReady', (event) => { 125 - resolve(event.editor); 126 - }); 127 - } 105 + ckeditor.on('instanceCreated', function(event) { 106 + // The editor instance was created but it not yet initialized. Unfortunately the configuration object passed when 107 + // the instance was created has not been merged with the global configuration yet. 108 + event.editor.once('configLoaded', function(event) { 109 + // The editor configuration has been loaded (the instance configuration has been merged with the global 110 + // configuration) but the editor has not been fully initialized yet so we can modify the configuration. 111 + updateConfig(event.editor); 128 128 }); 129 - } 113 + }); 130 130 }); 131 131 });
- XWiki.StyleSheetExtension[0]
-
- Code
-
... ... @@ -1,6 +1,6 @@ 1 1 .xwiki-mention { 2 2 background-color: $services.mentions.mentionsColor; 3 - border-radius: 10px;3 + border-radius: 8px; 4 4 padding: 2px 5px 2px 5px; 5 5 } 6 6