Skip to content

Commit 92a6b0a

Browse files
author
Sorita Heng
committed
Update suggestededits_access demo
1 parent e978936 commit 92a6b0a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

modules/ROOT/examples/live-demos/suggestededits-access/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<textarea id="trackchanges_access">
1+
<textarea id="suggested_edits_access">
22
{{logofordemoshtml}}
33

44
<h2 style="text-align: center;">Welcome to the TinyMCE Suggested Edits demo with review permissions!</h2>

modules/ROOT/examples/live-demos/suggestededits-access/index.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,25 @@ const userinfos = {
2222
},
2323
};
2424

25-
const trackchanges_user_lookup = (uid) => new Promise((resolve, reject) =>
26-
setTimeout(() => userinfos[uid] ? resolve(userinfos[uid]) : reject(), 1000));
25+
const fetch_users = (ids) => {
26+
return new Promise((resolve, reject) => {
27+
const users = ids.map(id => userDb[id]);
28+
if (users.length > 0) {
29+
resolve(users);
30+
} else {
31+
reject(new Error('No users found'));
32+
}
33+
});
34+
}
2735

2836
tinymce.init({
29-
selector: 'textarea#trackchanges_access',
37+
selector: 'textarea#suggested_edits_access',
3038
height: 500,
31-
plugins: 'trackchanges',
32-
toolbar: 'trackchanges',
39+
plugins: 'suggestededits',
40+
toolbar: 'suggestededits',
3341
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
34-
trackchanges_uid: 'adamhenderson',
35-
trackchanges_access: 'read', //change this value to set permission to the Suggested Edits view
36-
readonly: false, //set to true to restrict a user's editing permission
37-
trackchanges_user_lookup
42+
user_id: 'adamhenderson',
43+
fetch_users,
44+
suggestededits_access: 'read', //Change this value to set the user's permission to the Suggested Edits view
45+
readonly: false, //Set to true to restrict a user's editing permission
3846
});

0 commit comments

Comments
 (0)