Skip to content

Commit 85b8ac5

Browse files
Apply suggestions from code review
Co-authored-by: Andrew Herron <andrew.herron@tiny.cloud>
1 parent 43dc3a3 commit 85b8ac5

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

modules/ROOT/partials/configuration/suggestededits_content.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
== `suggestededits_content`
33
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.
44

5-
When set to `'html'`, the editor loads the initial content from the HTML in the textarea or the `content` property. In this case, if a model is provided, it will need to match the content in the editor for the plugin to work correctly
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.
66

7-
When set to `'model'`, the editor loads the initial content from the `suggestededits_model` option. In this case, the content in the editor will be overwritten with the content from the model. This would allow you to only require the model for document tracking, though it is still recommended to save the content in the editor externally.
7+
If a model is not provided the plugin will generate a new one from the initial content of the editor.
88

9-
In either case, if a model is not provided, the plugin will generate a new model from the current content of the editor, whether it is empty or not.
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 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.
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).
1012

1113
*Type:* `+String+`
1214

modules/ROOT/partials/configuration/suggestededits_model.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[[suggestededits_model]]
22
== `suggestededits_model`
33

4-
The `{plugincode}_model` option sets the initial model of the document to begin tracking changes. It takes as input an object representing the document, containing all edits made to the document up to that point. This model should be saved externally alongside the document, and loaded into the editor each time the document is opened. This will ensure that both the document and the model are in sync, and that the plugin can track edits correctly.
4+
The {pluginname} model is a JSON object representing the full 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. If the model and content are out of sync, the difference between them will be applied as a suggested edit by the current user.
55

6-
If the model is not provided in the editor configuration, the plugin will create a new model from the current content of the editor. This model can be retrieved from the editor at any time using the xref:#get_model[`getModel` API].
6+
The `{plugincode}_model` option sets the initial model for an editor load. How this model is used depends on the `{plugincode}_content` setting.
7+
8+
The model can be stored using the xref:#get_model[`getModel` API]. If the model is not provided the {pluginname} plugin will create a new model from the initial content of the editor, assuming all prior changes have been accepted.
79

810
*Type:* `+Object+`
911

modules/ROOT/partials/events/suggestededits-events.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The following events are provided by the xref:{plugincode}.adoc[{pluginname} plu
33
[cols="1,1,2",options="header"]
44
|===
55
|Name |Data |Description
6-
|suggestededitsBeginReview |N/A |Fired when the Suggested Edits view opens.
7-
|suggestededitsReviewComplete |N/A |Fired when a review in the Suggested Edits view is completed.
8-
|suggestededitsReviewCancelled |N/A |Fired when a review in the Suggested Edits view is cancelled.
6+
|suggestededitsBeginReview. |N/A |The Suggested Edits view has opened.
7+
|suggestededitsReviewComplete |N/A |A review in the Suggested Edits view has been completed.
8+
|suggestededitsReviewCancelled |N/A |A review in the Suggested Edits view was cancelled.
99
|===

modules/ROOT/partials/plugin-apis/suggestededits-apis.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
|===
33
|Name |Arguments |Description
44

5-
|getModel |N/A |Return an object representing the document model used to store data of the suggested edits.
5+
|getModel |N/A |Returns a JSON object representing the document model and all suggested edits.
66
|setModel | `+Object+` | Set the current model of the document.
77
//|resetModel |N/A |Reset the document to its original state.
8-
|hasChanges |N/A |Return a boolean value indicating whether the document contains edits to be reviewed.
8+
|hasChanges |N/A |Return a boolean value indicating whether the document contains suggested edits.
99
|===
1010

1111
.Examples

modules/ROOT/partials/toolbar-button-ids/suggestededits-toolbar-buttons.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
|Toolbar button identifier |Description
44

55
|`+suggestededits+` |Open the Review edits view.
6-
|`+suggestededits-label+` |Opens the Review edits view.
6+
|`+suggestededits-label+` |Opens the Review edits view (this button uses text instead of an icon).
77
|===

0 commit comments

Comments
 (0)