Skip to content

Commit 7bdb429

Browse files
committed
DOC-3246: Update tinycomments_mentions_enabled to include user_id and fetch_users
1 parent 2f64681 commit 7bdb429

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

modules/ROOT/partials/configuration/tinycomments_mentions_enabled.adoc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@ The {pluginname} plugin offers the `+tinycomments_mentions_enabled+` option to c
1313

1414
[source,js]
1515
----
16+
const userDirectory = {
17+
'johnsmith': { id: 'johnsmith', name: 'John Smith' },
18+
};
19+
1620
tinymce.init({
1721
selector: 'textarea', // change this value according to your html
1822
plugins: 'tinycomments mentions',
1923
toolbar: 'addcomment showcomments',
2024
tinycomments_mentions_enabled: true,
2125
tinycomments_mode: 'embedded',
22-
tinycomments_author: 'johnsmith',
23-
tinycomments_author_name: 'John Smith',
26+
user_id: 'johnsmith',
27+
fetch_users: (userIds) => {
28+
const results = userIds.map((id) => {
29+
const user = Object.values(userDirectory).find((user) => user.id === id);
30+
if (user) {
31+
return user;
32+
} else {
33+
throw new Error(`User ${id} not found`);
34+
}
35+
});
36+
return Promise.resolve(results);
37+
},
2438
mentions_fetch,
2539
mentions_menu_complete,
2640
mentions_menu_hover,

0 commit comments

Comments
 (0)