Skip to content

Commit e93c427

Browse files
committed
TINY-12258: Add documentation for new suggestededits_auto_approve option
1 parent 2bdf05e commit e93c427

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<textarea id="suggestededits-auto-approve" suggestededits-model='{"history":{"2":[{"id":1,"uid":"james-wilson","timestamp":1752576936000,"feedback":"Nice improvement!"}]},"version":1,"contents":[{"type":"p","children":[{"type":"img","attrs":{"style":"display: block; margin-left: auto; margin-right: auto;","title":"Tiny Logo","src":"https://www.tiny.cloud/docs/images/logos/android-chrome-256x256.png","alt":"TinyMCE Logo","width":"128","height":"128"}}]},{"type":"h2","attrs":{"style":"text-align: center;"},"children":[{"text":"Welcome to the TinyMCE Suggested Edits "},{"text":"interactive ","opData":{"id":1,"type":"insert","uid":"alex-thompson","timestamp":1752015064000}},{"text":"demo!"}]},{"type":"p","attrs":{"style":"text-align: center;"},"children":[{"text":"Try out the Suggested Edits feature"},{"text":": type in the editor, apply formatting or delete some content. T","opData":{"id":2,"type":"insert","uid":"alex-thompson","timestamp":1752415064000}},{"text":" by typing in the editor and t","opData":{"id":2,"type":"remove","uid":"alex-thompson","timestamp":1752415064000}},{"text":"hen"},{"text":",","opData":{"id":3,"type":"insert","uid":"alex-thompson","timestamp":1752515064000}},{"text":" click"},{"text":"ing","opData":{"id":4,"type":"remove","uid":"alex-thompson","timestamp":1752515064000}},{"text":" the Review Changes button in the toolbar"},{"text":" to see your changes","opData":{"id":5,"type":"insert","uid":"kai-nakamura","timestamp":1752615064000}},{"text":"."}]},{"type":"p","attrs":{"style":"text-align: center;"},"children":[{"text":"And visit the "},{"text":"pricing page","opData":{"id":6,"type":"modify","uid":"kai-nakamura","timestamp":1752615064000},"format":[{"type":"a","attrs":{"href":"https://www.tiny.cloud/pricing"}}],"oldFormat":[{"type":"a","attrs":{"href":"https://www.tiny.cloud/pricing"}},"em"]},{"text":" to learn more about our Premium plugins."}]},{"type":"h2","children":[{"text":"A simple table to play with"}]},{"type":"table","attrs":{"style":"border-collapse: collapse; width: 100%;","border":"1"},"children":[{"type":"thead","children":[{"type":"tr","attrs":{"style":"text-align: left;"},"children":[{"type":"th","children":[{"text":"Product"}]},{"type":"th","children":[{"text":"Cost"}]},{"type":"th","children":[{"text":"Really?"}]}]}]},{"type":"tbody","children":[{"type":"tr","children":[{"type":"td","children":[{"text":"TinyMCE Cloud"}]},{"type":"td","children":[{"text":"Get started for free"}]},{"type":"td","children":[{"text":"Yes!","format":["strong"]}]}]},{"type":"tr","children":[{"type":"td","children":[{"text":"Plupload"}]},{"type":"td","children":[{"text":"Free"}]},{"type":"td","children":[{"text":"Yes!","format":["strong"]}]}]}]}]},{"type":"h2","opData":{"id":7,"type":"insert","uid":"mia-andersson","timestamp":1752576331000},"children":[{"text":"Found a bug?"}]},{"type":"p","children":[{"text":" ","opData":{"id":7,"type":"remove","uid":"mia-andersson","timestamp":1752576331000}},{"text":"If you believe you have found a bug please create an issue on the ","opData":{"id":7,"type":"insert","uid":"mia-andersson","timestamp":1752576331000}},{"text":"GitHub repo","opData":{"id":7,"type":"insert","uid":"mia-andersson","timestamp":1752576331000},"format":[{"type":"a","attrs":{"href":"https://github.com/tinymce/tinymce/issues"}}]},{"text":" to report it to the developers.","opData":{"id":7,"type":"insert","uid":"mia-andersson","timestamp":1752576331000}}]},{"type":"h2","children":[{"text":"Finally…"}]},{"type":"p","children":[{"text":"Don’t forget to check out "},{"text":"Plupload","format":[{"type":"a","attrs":{"href":"http://www.plupload.com","target":"_blank","rel":"noopener"}}]},{"text":", the upload solution featuring HTML5 upload support."}]},{"type":"p","children":[{"text":"Thanks for supporting TinyMCE. We hope it helps you and your users create great content."}]},{"type":"p","children":[{"text":"All the best from the TinyMCE team."}]}]}'>
2+
{{logofordemoshtml}}
3+
4+
<h2 style="text-align: center;">Welcome to the TinyMCE Suggested Edits interactive demo!</h2>
5+
6+
<p style="text-align: center;">Try out the Suggested Edits feature: type in the editor, apply formatting or delete some content. Then, click the Review Changes button in the toolbar to see your changes.</p>
7+
8+
<p style="text-align: center;">And visit the <a href="https://www.tiny.cloud/pricing">pricing page</a> to learn more about our Premium plugins.</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+
<h2>Found a bug?</h2>
35+
36+
<p>If you believe you have found a bug please create an issue on the <a href="https://github.com/tinymce/tinymce/issues">GitHub repo</a> to report it to the developers.</p>
37+
38+
<h2>Finally…</h2>
39+
40+
<p>Don't forget to check out <a href="http://www.plupload.com" target="_blank" rel="noopener">Plupload</a>, the upload solution featuring HTML5 upload support.</p>
41+
<p>Thanks for supporting TinyMCE. We hope it helps you and your users create great content.</p>
42+
<p>All the best from the TinyMCE team.</p>
43+
44+
</textarea>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const API_URL = 'https://demouserdirectory.tiny.cloud/v1/users';
2+
3+
const tinymceElement = document.querySelector('textarea#suggestededits-auto-approve');
4+
const model = JSON.parse(tinymceElement.getAttribute('suggestededits-model'));
5+
6+
tinymce.init({
7+
selector: 'textarea#suggestededits-auto-approve',
8+
height: 500,
9+
plugins: 'suggestededits advlist anchor autolink code charmap emoticons fullscreen help image link lists media preview searchreplace table',
10+
toolbar: 'undo redo | suggestededits | styles fontsizeinput | bold italic | align bullist numlist | table link image | code',
11+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
12+
13+
suggestededits_model: model,
14+
suggestededits_access: 'full',
15+
suggestededits_content: 'html',
16+
suggestededits_auto_approve: true,
17+
18+
user_id: 'kai-nakamura',
19+
fetch_users: (userIds) => Promise.all(userIds
20+
.map((userId) =>
21+
fetch(`${API_URL}/${userId}`)
22+
.then((response) => response.json())
23+
.catch(() => ({ id: userId })))),
24+
});

modules/ROOT/pages/suggestededits.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ include::partial$configuration/suggestededits_content.adoc[leveloffset=+1]
123123

124124
include::partial$configuration/suggestededits_access.adoc[leveloffset=+1]
125125

126+
include::partial$configuration/suggestededits_auto_approve.adoc[leveloffset=+1]
127+
126128
include::partial$configuration/user_id.adoc[leveloffset=+1]
127129

128130
include::partial$configuration/fetch_users.adoc[leveloffset=+1]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[[suggestededits_auto_approve]]
2+
== `suggestededits_auto_approve`
3+
4+
The `suggestededits_auto_approve` option controls whether edits made during the session by the current user are automatically approved without requiring manual review. With this option enabled any edits by the current user, as set by the xref:#user_id[`+user_id+` option], as well as any previous suggestions made by the current user, will be instantly applied, bypassing the review process. This is useful for scenarios where reviews aren't necessary, such as when creating an initial draft or when the user is a trusted editor.
5+
6+
When set to:
7+
8+
* `false`: All edits require manual approval before being applied.
9+
* `true`: All new edits are automatically approved and applied.
10+
11+
12+
*Type:* `+Boolean+`
13+
14+
*Default Value*: `false`
15+
16+
.Example: `suggestededits_auto_approve: true`
17+
[source,javascript]
18+
----
19+
tinymce.init({
20+
selector: 'textarea#suggestededits', // Change this value according to your HTML
21+
plugins: 'suggestededits',
22+
toolbar: 'suggestededits',
23+
suggestededits_auto_approve: true, // Change this value to auto-approve suggested edits
24+
});
25+
----
26+
27+
liveDemo::suggestededits-auto-approve[]

0 commit comments

Comments
 (0)