|
1 | | -[[suggestededits_model]] |
2 | | -== `suggestededits_model` |
3 | | - |
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. |
5 | | - |
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]. |
7 | | -//*Type:* xref:#trackeddocument[TrackedDocument] `+Object+` |
8 | | - |
9 | | -=== Example: using `{plugincode}_model` |
10 | | - |
11 | | -// Add a working and tested configuration. |
12 | | -[source,js] |
13 | | ----- |
14 | | -tinymce.init({ |
15 | | - selector: 'textarea', // Change this value according to your HTML |
16 | | - plugins: 'suggestededits', |
17 | | - toolbar: 'suggestededits', |
18 | | - suggestededits_uid: 'unique-identifier', // replace this with a unique string to identify the user |
19 | | - suggestededits_model // Model representing the document with up to date edits |
20 | | -}); |
21 | | ----- |
22 | | - |
23 | | -[[suggestededits_access]] |
24 | | -== `suggestededits_access` |
25 | | - |
26 | | -To configure a user's permission to edit the document and review changes, the `{plugincode}_access` option can be set alongside the editor mode. |
27 | | - |
28 | | -*Type:* `+String+` |
29 | | - |
30 | | -*Possible Values*: `'full'`, `'suggest'`, `'read'`, `'none'` |
31 | | - |
32 | | -*Default Value*: `'full'` |
33 | | - |
34 | | -The possible values set the access level of the review permissions as follows: |
35 | | - |
36 | | -[cols="20%,80%"] |
37 | | -|=== |
38 | | -|Value | Review Permission |
39 | | - |
40 | | -|`+'full'+` |
41 | | -|Access to the {pluginname} view, with permission to accept, reject, or add suggestions to changes. |
42 | | - |
43 | | -|`+'suggest'+` |
44 | | -|Access to the {pluginname} view, with permission to add suggestions to changes. |
45 | | - |
46 | | -|`+'read'+` |
47 | | -|Readonly access to the {pluginname} view. |
48 | | - |
49 | | -|`+'none'+` |
50 | | -|No access to the {pluginname} view. |
51 | | -|=== |
52 | | - |
53 | | -[NOTE] |
54 | | -The `{plugincode}_access` option can be used in combination with the editor's read-only mode to restrict a user’s editing permission. |
55 | | - |
56 | | -.Example |
57 | | -[source,javascript] |
58 | | ----- |
59 | | -tinymce.init({ |
60 | | - selector: 'textarea', // Change this value according to your HTML |
61 | | - plugins: 'suggestededits', |
62 | | - toolbar: 'suggestededits', |
63 | | - suggestededits_uid: 'unique-identifier', // replace this with a unique string to identify the user |
64 | | - suggestededits_access: 'full' //change this value to set permission to the Suggested Edits view |
65 | | - readonly: false //set to true to restrict a user's editing permission |
66 | | -}); |
67 | | ----- |
68 | | - |
69 | | -liveDemo::suggestededits-access[] |
70 | | - |
71 | | -[[suggestededits_content]] |
72 | | -== `suggestededits_content` |
73 | | -The `{plugincode}_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. |
74 | | - |
75 | | -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 |
76 | | - |
77 | | -When set to `'model'`, the editor loads the initial content from the `{plugincode}_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. |
78 | | - |
79 | | -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. |
80 | | - |
81 | | -*Type:* `+String+` |
82 | | - |
83 | | -*Possible Values*: `'html'`, `'model'` |
84 | | - |
85 | | -*Default value:* `'html'` |
86 | | - |
87 | | -=== Example: using `{plugincode}_content` |
88 | | - |
89 | | -// Add a working and tested configuration. |
90 | | -[source,js] |
91 | | ----- |
92 | | -tinymce.init({ |
93 | | - selector: 'textarea', // Change this value according to your HTML |
94 | | - plugins: 'suggestededits', |
95 | | - toolbar: 'suggestededits', |
96 | | - suggestededits_uid: 'unique-identifier', // replace this with a unique string to identify the user |
97 | | - suggestededits_model, |
98 | | - suggestededits_content: 'model' // change this value to set the content source |
99 | | -}); |
100 | | ----- |
| 1 | +include::partial$configuration/userlookup_userid.adoc[] |
| 2 | +include::partial$configuration/userlookup_fetch.adoc[] |
| 3 | +include::partial$configuration/suggestededits_model.adoc[] |
| 4 | +include::partial$configuration/suggestededits_content.adoc[] |
| 5 | +include::partial$configuration/suggestededits_access.adoc[] |
0 commit comments