File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
modules/ROOT/partials/plugin-apis Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,13 @@ The `mentionedUids` array captures any string following the `@` symbol without v
128128
129129[source,js]
130130----
131+ // Fake database of users
132+ const users = {
133+ "user1": "John Doe",
134+ "user2": "Jane Doe",
135+ "user3": "Alice Doe",
136+ };
137+
131138const comments = tinymce.activeEditor.plugins.tinycomments;
132139
133140console.log(comments.getEventLog());
@@ -137,6 +144,10 @@ console.log(comments.getEventLog(
137144
138145const eventLog = comments.getEventLog();
139146const events = eventLog.events;
147+ // Ensure that the mentioned users are valid users in the database
148+ events.forEach((event) => {
149+ event.mentionedUids = event.mentionedUids ? event.mentionedUids.filter((uid) => users[uid]) : undefined;
150+ });
140151const mentionedUsers = events.flatMap(({ mentionedUids }) => mentionedUids || []);
141152console.log(mentionedUsers);
142153
You can’t perform that action at this time.
0 commit comments