You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The {pluginname} plugin keeps track of every suggested edit made to the document by the current user, as the edits are made, and stores this metadata in an internal model of the document. These suggestions can then be reviewed in the `'suggestededits'` xref:custom-view.adoc[editor view], where each edit is highlighted in the document, and where you can accept, reject, or provide feedback. The `'suggestededits'` view is accessible via either the `suggestededits` toolbar button or menu button within the `View` menu. These edits, and any feedback provided, are stored in the model provided by the plugin xref:#get_model[`+get_model()+` API].
22
+
The {pluginname} plugin keeps track of every suggested edit made to the document by the current user, as the edits are made, and stores this metadata in an internal model of the document. These suggestions can then be reviewed in the `'suggestededits'` xref:custom-view.adoc[editor view], where each edit is highlighted in the document, and where you can accept, reject, or provide feedback. The `'suggestededits'` view is accessible via either the `suggestededits` toolbar button or menu button within the `View` menu.
23
23
24
-
[IMPORTANT]
25
-
This model should be saved externally alongside the document, and loaded into the editor with the xref:#suggestededits_model[`+suggestededits_model+`] option. This ensures that both the document and the model are in sync, and that every user's contributions are tracked correctly.
24
+
== The model
25
+
26
+
The {pluginname} model is a JSON object representing the document along with all unreviewed edits. The model should be kept in sync with the editor content and loaded into the editor each time the document is opened.
27
+
28
+
The model should be retrieved from the plugin using the xref:#get_model[`+getModel+`] API, then saved externally alongside the document, and loaded into the editor with the xref:#suggestededits_model[`+suggestededits_model+`] option each time the document is opened. This ensures that both the document and the model are in sync, and that every user's contributions are tracked correctly. If the model and content are out of sync, the difference between them will be applied as a suggested edit by the current user. If a model is not provided in the editor configuration or is set to `+undefined+`, the plugin will generate a new model from the initial content.
29
+
30
+
When the xref:#suggestededits_content[`+suggestededits_content+`] option is set to `'model'`, only the model is required, so keeping a synchronised document is not necessary. This also means that there will be no accidental suggestions caused by the editor content being out of sync with the model.
26
31
27
32
== Reviewing edits
28
33
@@ -55,9 +60,9 @@ Each suggested edit is listed as a card in the sidebar and color coded by the ty
55
60
* Revert: Reverts the current "Accept" or "Reject" resolution on the suggestion.
56
61
* Provide feedback: Opens a text area for you to provide feedback on the suggestion.
57
62
58
-
Any feedback will be stored in the model and displayed underneath the card details and in chronological order. This feedback thread can be used to discuss the suggestion with the author or other reviewers. The feedback author can edit or delete their own feedback.
63
+
Feedback is shown in chronological order beneath the card details, when the card is selected. Feedback threads allows users to discuss suggestions before resolving them. The feedback author can edit or delete their own feedback, with the appropriate permissions in the xref:#suggestededits_access[`+suggestededits_access+`] option.
59
64
60
-
At the top of the sidebar, there is also a dropdown menu to apply review actions in bulk to all suggested edits:
65
+
At the top of the sidebar, there is a dropdown menu to apply review actions in bulk to all suggested edits:
61
66
62
67
* Accept all.
63
68
* Reject all.
@@ -108,14 +113,6 @@ This configuration adds {pluginname} to the editor toolbar, enabling access to t
108
113
109
114
== Options
110
115
111
-
The {pluginname} plugin requires a model for storing suggestions. If a model is not provided in the editor configuration or is set to `+undefined+`, the plugin generates a new model. This model contains all current suggested edits. To maintain continuity across sessions, the current model for the document should always be supplied unless initializing a new document. The model can be retrieved from the editor at any time using the xref:#get_model[getModel API], and should be saved externally alongside the document.
112
-
113
-
Both the xref:#user_id[`+user_id+`] and xref:#fetch_users[`+fetch_users+`] options are required to configure the xref:userlookup.adoc[User Lookup API]. This API is used in the {pluginname} plugin to provide user information for each user who has made a change, allowing other users to see who made which suggestion.
114
-
115
-
* The current user ID should be set with the xref:#user_id[`+user_id+` option]. The user ID should be a unique string that identifies the user, such as a username or an email address.
116
-
117
-
* The xref:#fetch_users[`+fetch_users+` option] is required to provide the name and avatar for each user who has made a change, to then appear in the review. This option can be configured to retrieve this information from a backend service, as it provides an array of user IDs and expects a promise of an array, containing the appropriate data for the requested user IDs.
118
-
119
116
The following configuration options affect the behavior of the {pluginname} plugin.
Both the xref:#user_id[`+user_id+`] and xref:#fetch_users[`+fetch_users+`] options are required to configure the xref:userlookup.adoc[User Lookup API]. This API is used in the {pluginname} plugin to provide user information for each user who has made a change, allowing other users to see who made which suggestion.
129
+
130
+
* The current user ID should be set with the xref:#user_id[`+user_id+`] option. The user ID should be a unique string that identifies the user, such as a username or an email address.
131
+
* The xref:#fetch_users[`+fetch_users+`] option is required to provide the name and avatar for users who have made suggestions. This option can be configured to fetch data from a backend service. The `+fetch_users+` function is given an array of user IDs and should return a promise, which resolves to an array containing data for the requested user IDs.
To configure a user's permission to edit the document and review changes, the `{plugincode}_access` option can be set alongside the editor mode.
4
+
The `suggestededits_access` option determines the level of access a user has to the {pluginname} view. This setting is crucial for controlling who can accept or reject suggestions, add feedback, or view the document in read-only mode. When used in conjunction with the `readonly` option, it allows for fine-grained control over user permissions.
5
+
6
+
When set to:
7
+
8
+
* `'full'`: The user has full access to the {pluginname} view, with permission to accept or reject suggestions.
9
+
* `'feedback'`: The user has access to the {pluginname} view, with permission to add feedback to suggestions.
10
+
* `'read'`: The user has read-only access to the {pluginname} view.
11
+
* `'none'`: The user has no access to the {pluginname} view.
The `suggestededits_content` option determines where the initial content of the document is loaded from. With this option, you can set the content to be loaded from either the editor or the model, allowing you to control the source of truth for the document.
4
3
5
-
In a `'html'`-first approach, the editor loads content normally and the {pluginname} plugin provides augmentation. The integrator is responsible for saving the model at the same time as the editor content and providing it on the next load using the `suggestededits_model` option. This allows {pluginname} to be integrated quickly into a CMS by adding the model as an additional hidden field alongside the editor content.
4
+
The `suggestededits_content` option controls whether the content is loaded from the editor or the `suggestededits_model` model, allowing you to define the source of truth for the document. In either case, if a model is not provided, the plugin will generate a new model from the initial editor content.
6
5
7
-
If a model is not provided the plugin will generate a new one from the initial content of the editor.
6
+
When set to:
8
7
9
-
When `suggestededits_content` is set to `'model'`, the plugin bypasses the editor's content load procedures and instead uses the `suggestededits_model` option to generate the initial content. This would allow an integrator to only require the model for document tracking, and treat the editor content as simply a rendering of it.
8
+
* `'html'`: the editor loads content normally, and the plugin synchronises the model with the content. This simplifies the configuration of {pluginname} in an existing integration, by attaching the {pluginname} model as an additional field alongside the editor content.
9
+
* `'model'`: the editor uses the `suggestededits_model` option to generate the initial content, ignoring any pre-existing content in the editor. With this configuration, you only need to store and provide the model, simplifying the integration of the {pluginname} plugin.
10
10
11
-
If a model is not provided, the plugin will allow the editor to load content normally and generate a new model from there (the same way `html` works).
11
+
NOTE: The integrator is responsible for saving the model and providing it on the next load using the `suggestededits_model` option.
12
12
13
13
*Type:* `+String+`
14
14
15
15
*Possible Values*: `'html'`, `'model'`
16
16
17
17
*Default value:* `'html'`
18
18
19
-
=== Example: using `suggestededits_content`
20
-
19
+
.Example: using `suggestededits_content`
21
20
[source,js]
22
21
----
23
22
tinymce.init({
24
23
selector: 'textarea', // Change this value according to your HTML
25
24
plugins: 'suggestededits',
26
25
toolbar: 'suggestededits',
27
-
user_id: 'unique-identifier', // Replace this with a unique string to identify the user
28
-
fetch_users, // Function to fetch users for the user lookup API
29
26
suggestededits_model, // Load the saved model into the editor
30
-
suggestededits_content: 'model' // Only set this if you want to load the initial content from the model
27
+
suggestededits_content: 'model' // Set to 'model' if you want to load the initial content from the `suggestededits_model` option
0 commit comments