Skip to content

Commit b945b79

Browse files
author
Sorita Heng
committed
Add Suggestions section and demo
1 parent c4680c9 commit b945b79

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<textarea id="trackchanges_suggestions">
2+
{{logofordemoshtml}}
3+
4+
<h2 style="text-align: center;">Welcome to the TinyMCE Suggested Edits demo with review permissions!</h2>
5+
6+
<p style="text-align: center;">In this demo, the user has a 'read' access to the Suggested Edits view. Try typing in the editor and then clicking the Review Changes button in the toolbar to see how it works!</p>
7+
8+
<p style="text-align: center;">Try setting the editor read-only mode to true to restrict editing permission.</p>
9+
10+
<h2>A simple table to play with</h2>
11+
12+
<table style="border-collapse: collapse; width: 100%;" border="1">
13+
<thead>
14+
<tr style="text-align: left;">
15+
<th>Product</th>
16+
<th>Cost</th>
17+
<th>Really?</th>
18+
</tr>
19+
</thead>
20+
<tbody>
21+
<tr>
22+
<td>TinyMCE Cloud</td>
23+
<td>Get started for free</td>
24+
<td><strong>Yes!</strong></td>
25+
</tr>
26+
<tr>
27+
<td>Plupload</td>
28+
<td>Free</td>
29+
<td><strong>Yes!</strong></td>
30+
</tr>
31+
</tbody>
32+
</table>
33+
34+
</textarea>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/** Fake user database */
2+
const userinfos = {
3+
adamhenderson: {
4+
uid: 'adamhenderson',
5+
name: 'Adam Henderson',
6+
avatar: `https://randomuser.me/api/portraits/men/1.jpg`,
7+
},
8+
michaelcook: {
9+
uid: 'michaelcook',
10+
name: 'Michael Cook',
11+
avatar: `https://randomuser.me/api/portraits/men/2.jpg`,
12+
},
13+
kalebwilson: {
14+
uid: 'kalebwilson',
15+
name: 'Kaleb Wilson',
16+
avatar: `https://randomuser.me/api/portraits/men/3.jpg`,
17+
},
18+
kyleeinstein: {
19+
uid: 'kyleeinstein',
20+
name: 'Kyle Einstein',
21+
avatar: `https://randomuser.me/api/portraits/men/4.jpg`,
22+
},
23+
};
24+
25+
const trackchanges_user_lookup = (uid) => new Promise((resolve, reject) =>
26+
setTimeout(() => userinfos[uid] ? resolve(userinfos[uid]) : reject(), 1000));
27+
28+
tinymce.init({
29+
selector: 'textarea#trackchanges_suggestions',
30+
height: 500,
31+
plugins: 'trackchanges',
32+
toolbar: 'trackchanges',
33+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
34+
trackchanges_uid: 'adamhenderson',
35+
trackchanges_access: 'suggest', //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
38+
});

modules/ROOT/pages/suggestededits.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ tinymce.init({
8080
});
8181
----
8282

83+
== Suggestions
84+
85+
The plugin also enables users to provide suggestions or feedback to edits before they are resolved. This feature is only available if xref:{plugincode}_access[`+suggestededits_access+`] is set to `admin` or `suggest`.
86+
87+
Example: Using Suggestions
88+
89+
liveDemo::suggestededits-suggestions[]
90+
8391
== Options
8492

8593
The following configuration options affect the behavior of the {pluginname} plugin.

modules/ROOT/partials/configuration/suggestededits-options.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ tinymce.init({
124124
The `{plugincode}_diff_classes` option configures the CSS classes applied to the change annotations in the {pluginname} view. This is useful to set custom styles and must be used in combination with the `{plugincode}_css_url` option.
125125

126126
[NOTE]
127-
The CSS class names must exist in the xref:{plugincode}_css_url[`+{plugincode}_css_url+`].
127+
The CSS class names must exist in the xref:{plugincode}_css_url[`+suggestededits_css_url+`].
128128

129129
*Type:* `+Object+`
130130

0 commit comments

Comments
 (0)