1+ /** Fake user database */
2+ const userDb = {
3+ adamhenderson : {
4+ id : 'adamhenderson' ,
5+ name : 'Adam Henderson' ,
6+ avatar : `https://randomuser.me/api/portraits/men/1.jpg` ,
7+ } ,
8+ michaelcook : {
9+ id : 'michaelcook' ,
10+ name : 'Michael Cook' ,
11+ avatar : `https://randomuser.me/api/portraits/men/2.jpg` ,
12+ } ,
13+ kalebwilson : {
14+ id : 'kalebwilson' ,
15+ name : 'Kaleb Wilson' ,
16+ avatar : `https://randomuser.me/api/portraits/men/3.jpg` ,
17+ } ,
18+ kyleeinstein : {
19+ id : 'kyleeinstein' ,
20+ name : 'Kyle Einstein' ,
21+ avatar : `https://randomuser.me/api/portraits/men/4.jpg` ,
22+ } ,
23+ } ;
24+
25+ const suggestededits_model = null ; //Replace with the object returned by the plugin's getModel API, or null if there is no model.
26+
27+ const fetch_users = ( ids ) => {
28+ return new Promise ( ( resolve , reject ) => {
29+ const users = ids . map ( id => userDb [ id ] ) ;
30+ if ( users . length > 0 ) {
31+ resolve ( users ) ;
32+ } else {
33+ reject ( new Error ( 'No users found' ) ) ;
34+ }
35+ } ) ;
36+ }
137
238tinymce . init ( {
3- selector : 'textarea#trackchanges' ,
4- height : 500 ,
5- plugins : 'trackchanges' ,
6- toolbar : 'trackchanges' ,
7- content_style : 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }' ,
8- trackchanges_uid : 'adamhenderson' ,
9- } ) ;
39+ selector : 'textarea#suggested-edits' ,
40+ height : 500 ,
41+ plugins : 'suggestededits' ,
42+ toolbar : 'suggestededits' ,
43+ content_style : 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }' ,
44+ suggestededits_model, // If there is no model, the plugin will generate a default model based on the editor content.
45+ user_id : 'michaelcook' ,
46+ fetch_users,
47+ } ) ;
48+
0 commit comments