dbf-mirador-annotation-editor 1.4.2 → 1.5.0-testing2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,7 @@ lot of technical and functional modifications (including migration from PaperJS
37
37
  * [Persisting Annotations](#persisting-annotations)
38
38
  * [Configuration](#configuration-)
39
39
  * [External annotation templates](#external-annotation-templates)
40
+ * [Restricting selectable templates](#restricting-selectable-templates)
40
41
  * [Technical aspects from the original plugin](#technical-aspects-from-the-original-plugin)
41
42
  * [Contribute](#contribute)
42
43
  * [Contributor](#contributor)
@@ -68,6 +69,11 @@ You need also to use the latest version of Mirador 4.
68
69
  "mirador": "npm:dbf-mirador@4.2.3"
69
70
  ```
70
71
 
72
+ The built-in POI template's description field is a CKEditor 5 rich-text editor, so your host app
73
+ must also provide `ckeditor5` (`~47.6.1`) and `@ckeditor/ckeditor5-react` (`~11.0.1`) -
74
+ peerDependencies, not bundled, so if your app already loads CKEditor 5 elsewhere (e.g. via
75
+ `@_sh/strapi-plugin-ckeditor`) this reuses that single instance rather than loading a second copy.
76
+
71
77
  [Mirador 4 integration example](https://github.com/ProjectMirador/mirador-integration)
72
78
 
73
79
 
@@ -125,6 +131,7 @@ See `demo/src/index.js` for a full configuration sample.
125
131
  readonly: false, // If true, no annotation creation, edit, deleting is allowed
126
132
  tagsSuggestions: ['Mirador', 'Awesome', 'Viewer', 'IIIF', 'Template'], // Tags suggestions for autocompletion
127
133
  externalTemplates: [], // Externally-registered annotation templates - see "External annotation templates" below
134
+ enabledTemplateTypes: [], // Restrict the picker to these template ids - see "Restricting selectable templates" below
128
135
  };
129
136
  ```
130
137
 
@@ -177,6 +184,30 @@ example (a minimal whole-canvas star-rating template) and
177
184
  `src/annotationForm/templates/registry.jsx`'s `TEMPLATE_REGISTRY` JSDoc for the full contract
178
185
  reference.
179
186
 
187
+ ### Restricting selectable templates
188
+
189
+ `config.annotation.enabledTemplateTypes`: an array of template ids (built-in `TEMPLATE.*` values
190
+ and/or your own `externalTemplates` ids) - when set, the picker offers only these, instead of
191
+ every selectable entry. Useful for an embed dedicated to a single annotation type, e.g. the
192
+ Strapi maps plugin sets it to `['poi']` so staff editing a map's points of interest are never
193
+ offered note/tag/expert-mode.
194
+
195
+ ```js
196
+ let annotationConfig = {
197
+ // ... your other options ...
198
+ enabledTemplateTypes: ['poi'],
199
+ };
200
+ ```
201
+
202
+ When this narrows things down to exactly one enabled (and media-compatible) template, a *new*
203
+ annotation opens that template directly instead of showing a one-card picker - the same
204
+ auto-open behavior `defaultForm` already gives you, but without needing to also set it. Leaving
205
+ this unset (or empty) offers every selectable template, unchanged from today's default.
206
+
207
+ This only restricts the picker: an *existing* annotation saved with a template id outside the
208
+ list still opens for editing, the same way a `selectable: false` entry (e.g. the legacy text
209
+ comment type) already does.
210
+
180
211
  ## Technical aspects from the original plugin
181
212
 
182
213
  - Mirador 4 support