@lblod/ember-rdfa-editor-lblod-plugins 12.1.0 → 14.0.0

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.
Files changed (133) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +215 -164
  3. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +1 -8
  4. package/addon/components/citation-plugin/citation-card.hbs +7 -7
  5. package/addon/components/citation-plugin/citation-card.ts +21 -16
  6. package/addon/components/citation-plugin/citation-insert.hbs +1 -1
  7. package/addon/components/citation-plugin/citation-insert.ts +8 -8
  8. package/addon/components/citation-plugin/citations/article-preview.hbs +1 -1
  9. package/addon/components/citation-plugin/citations/article-preview.ts +13 -0
  10. package/addon/components/citation-plugin/citations/{decision-detail.hbs → legal-document-detail.hbs} +6 -6
  11. package/addon/components/citation-plugin/citations/{decision-detail.ts → legal-document-detail.ts} +6 -3
  12. package/addon/components/citation-plugin/citations/{decision-list.hbs → legal-document-list.hbs} +6 -6
  13. package/addon/components/citation-plugin/citations/{decision-preview.hbs → legal-document-preview.hbs} +5 -5
  14. package/addon/components/citation-plugin/citations/{decision-preview.ts → legal-document-preview.ts} +4 -4
  15. package/addon/components/citation-plugin/citations/search-modal.hbs +12 -12
  16. package/addon/components/citation-plugin/citations/search-modal.ts +22 -19
  17. package/addon/components/decision-plugin/decision-plugin-card.hbs +3 -3
  18. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +2 -2
  19. package/addon/components/standard-template-plugin/card.hbs +1 -1
  20. package/addon/components/standard-template-plugin/card.ts +5 -0
  21. package/addon/components/standard-template-plugin/template-provider.hbs +1 -2
  22. package/addon/components/standard-template-plugin/template-provider.ts +6 -14
  23. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -0
  24. package/addon/components/template-comments-plugin/template-comment.hbs +4 -4
  25. package/addon/components/template-comments-plugin/template-comment.ts +16 -0
  26. package/addon/components/variable-plugin/address/edit.hbs +13 -11
  27. package/addon/components/variable-plugin/address/edit.ts +88 -22
  28. package/addon/components/variable-plugin/address/insert-variable.ts +14 -1
  29. package/addon/components/variable-plugin/address/insert.ts +15 -1
  30. package/addon/components/variable-plugin/address/nodeview.hbs +1 -1
  31. package/addon/components/variable-plugin/address/nodeview.ts +23 -1
  32. package/addon/components/variable-plugin/codelist/insert.ts +10 -1
  33. package/addon/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.ts +1 -1
  34. package/addon/components/{rdfa-date-plugin/card.hbs → variable-plugin/date/edit.hbs} +3 -3
  35. package/addon/components/{rdfa-date-plugin/card.ts → variable-plugin/date/edit.ts} +10 -10
  36. package/addon/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.ts +2 -2
  37. package/addon/components/variable-plugin/date/insert-variable.hbs +9 -0
  38. package/addon/components/variable-plugin/date/insert-variable.ts +57 -0
  39. package/addon/components/variable-plugin/date/insert.hbs +9 -9
  40. package/addon/components/variable-plugin/date/insert.ts +13 -10
  41. package/addon/components/{rdfa-date-plugin/date.ts → variable-plugin/date/nodeview.ts} +20 -6
  42. package/addon/components/variable-plugin/location/insert.ts +11 -2
  43. package/addon/components/variable-plugin/number/insert.hbs +1 -1
  44. package/addon/components/variable-plugin/number/insert.ts +9 -1
  45. package/addon/components/variable-plugin/number/nodeview.hbs +1 -1
  46. package/addon/components/variable-plugin/number/nodeview.ts +17 -0
  47. package/addon/components/variable-plugin/text/insert.ts +14 -2
  48. package/addon/models/template.ts +6 -13
  49. package/addon/plugins/besluit-type-plugin/index.ts +1 -0
  50. package/addon/plugins/citation-plugin/index.ts +1 -1
  51. package/addon/plugins/citation-plugin/utils/legal-documents.ts +3 -3
  52. package/addon/plugins/citation-plugin/utils/public-decisions.ts +6 -4
  53. package/addon/plugins/citation-plugin/utils/types.ts +7 -3
  54. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +8 -13
  55. package/addon/plugins/table-of-contents-plugin/utils/index.ts +7 -4
  56. package/addon/plugins/template-comments-plugin/node.ts +12 -3
  57. package/addon/plugins/variable-plugin/utils/address-helpers.ts +13 -1
  58. package/addon/plugins/variable-plugin/variables/address.ts +15 -8
  59. package/addon/plugins/variable-plugin/variables/codelist.ts +4 -4
  60. package/addon/plugins/variable-plugin/variables/date.ts +200 -0
  61. package/addon/plugins/variable-plugin/variables/index.ts +1 -0
  62. package/addon/plugins/variable-plugin/variables/location.ts +4 -4
  63. package/addon/plugins/variable-plugin/variables/number.ts +11 -8
  64. package/addon/plugins/variable-plugin/variables/text.ts +4 -4
  65. package/addon/utils/translation.ts +19 -0
  66. package/app/components/citation-plugin/citations/{decision-list.js → legal-document-detail.js} +1 -1
  67. package/app/components/citation-plugin/citations/{decision-detail.js → legal-document-list.js} +1 -1
  68. package/app/components/citation-plugin/citations/{decision-preview.js → legal-document-preview.js} +1 -1
  69. package/app/components/{rdfa-date-plugin/card.js → variable-plugin/date/date-time-picker.js} +1 -1
  70. package/app/components/{rdfa-date-plugin/date.js → variable-plugin/date/edit.js} +1 -1
  71. package/app/components/{rdfa-date-plugin/insert.js → variable-plugin/date/help-modal.js} +1 -1
  72. package/app/components/{rdfa-date-plugin/date-time-picker.js → variable-plugin/date/insert-variable.js} +1 -1
  73. package/app/components/{rdfa-date-plugin/help-modal.js → variable-plugin/date/nodeview.js} +1 -1
  74. package/app/styles/besluit-plugin.scss +2 -2
  75. package/app/styles/date-plugin.scss +0 -20
  76. package/app/styles/snippet-plugin.scss +1 -1
  77. package/app/styles/template-comments-plugin.scss +4 -4
  78. package/app/styles/variable-plugin.scss +2 -2
  79. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +0 -2
  80. package/components/citation-plugin/citation-card.d.ts +7 -7
  81. package/components/citation-plugin/citation-insert.d.ts +2 -2
  82. package/components/citation-plugin/citations/article-preview.d.ts +9 -0
  83. package/components/citation-plugin/citations/{decision-detail.d.ts → legal-document-detail.d.ts} +2 -2
  84. package/components/citation-plugin/citations/{decision-preview.d.ts → legal-document-preview.d.ts} +2 -2
  85. package/components/citation-plugin/citations/search-modal.d.ts +10 -11
  86. package/components/standard-template-plugin/card.d.ts +3 -0
  87. package/components/standard-template-plugin/template-provider.d.ts +5 -7
  88. package/components/template-comments-plugin/template-comment.d.ts +6 -0
  89. package/components/variable-plugin/address/edit.d.ts +4 -2
  90. package/components/variable-plugin/address/insert-variable.d.ts +3 -0
  91. package/components/variable-plugin/address/insert.d.ts +3 -0
  92. package/components/variable-plugin/address/nodeview.d.ts +7 -0
  93. package/components/variable-plugin/codelist/insert.d.ts +1 -0
  94. package/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.d.ts +1 -1
  95. package/components/{rdfa-date-plugin/card.d.ts → variable-plugin/date/edit.d.ts} +3 -3
  96. package/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.d.ts +1 -1
  97. package/components/variable-plugin/date/insert-variable.d.ts +16 -0
  98. package/components/variable-plugin/date/insert.d.ts +4 -3
  99. package/components/{rdfa-date-plugin/date.d.ts → variable-plugin/date/nodeview.d.ts} +5 -1
  100. package/components/variable-plugin/location/insert.d.ts +1 -0
  101. package/components/variable-plugin/number/insert.d.ts +1 -0
  102. package/components/variable-plugin/number/nodeview.d.ts +5 -0
  103. package/components/variable-plugin/text/insert.d.ts +3 -0
  104. package/models/template.d.ts +1 -7
  105. package/package.json +7 -12
  106. package/plugins/besluit-type-plugin/index.d.ts +1 -0
  107. package/plugins/citation-plugin/utils/types.d.ts +5 -4
  108. package/plugins/table-of-contents-plugin/utils/index.d.ts +3 -2
  109. package/plugins/variable-plugin/utils/address-helpers.d.ts +2 -1
  110. package/plugins/{rdfa-date-plugin/nodes → variable-plugin/variables}/date.d.ts +10 -1
  111. package/plugins/variable-plugin/variables/index.d.ts +1 -0
  112. package/translations/en-US.yaml +13 -0
  113. package/translations/nl-BE.yaml +14 -0
  114. package/utils/translation.d.ts +3 -0
  115. package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
  116. package/addon/components/rdfa-date-plugin/insert.ts +0 -52
  117. package/addon/plugins/rdfa-date-plugin/index.ts +0 -28
  118. package/addon/plugins/rdfa-date-plugin/nodes/date.ts +0 -167
  119. package/addon/services/standard-template-plugin.ts +0 -55
  120. package/app/services/standard-template-plugin.js +0 -1
  121. package/components/rdfa-date-plugin/insert.d.ts +0 -16
  122. package/plugins/rdfa-date-plugin/index.d.ts +0 -15
  123. package/services/standard-template-plugin.d.ts +0 -20
  124. package/types/lblod/frontend-gelinkt-notuleren/models/account.d.ts +0 -10
  125. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid-classificatie-code.d.ts +0 -10
  126. package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid.d.ts +0 -12
  127. package/types/lblod/frontend-gelinkt-notuleren/models/gebruiker-model.d.ts +0 -18
  128. package/types/lblod/frontend-gelinkt-notuleren/services/current-session.d.ts +0 -30
  129. /package/addon/components/{rdfa-date-plugin → variable-plugin/date}/date-time-picker.hbs +0 -0
  130. /package/addon/components/{rdfa-date-plugin → variable-plugin/date}/help-modal.hbs +0 -0
  131. /package/addon/components/{rdfa-date-plugin/date.hbs → variable-plugin/date/nodeview.hbs} +0 -0
  132. /package/addon/plugins/{rdfa-date-plugin/utils.ts → variable-plugin/utils/date-helpers.ts} +0 -0
  133. /package/plugins/{rdfa-date-plugin/utils.d.ts → variable-plugin/utils/date-helpers.d.ts} +0 -0
package/README.md CHANGED
@@ -5,11 +5,11 @@ related to the LBLOD Project.
5
5
 
6
6
  ## Compatibility
7
7
 
8
- * Ember.js and ember data v3.28 or 4.x
9
- note: we smoke-test for 3.28 but develop on the latest 4.x minor. The 5.x range is currently untested and not officially supported, but we accept issues and PRs to do so.
8
+ - Ember.js and ember data v3.28 or 4.x
9
+ note: we smoke-test for 3.28 but develop on the latest 4.x minor. The 5.x range is currently untested and not officially supported, but we accept issues and PRs to do so.
10
10
 
11
- * Embroider or ember-auto-import v2
12
- * Node 18 or above
11
+ - Embroider or ember-auto-import v2
12
+ - Node 18 or above
13
13
 
14
14
  ## Installation
15
15
 
@@ -21,20 +21,20 @@ ember install ember-rdfa-editor-lblod-plugins
21
21
 
22
22
  This addon contains the following editor plugins:
23
23
 
24
- * [article-structure-plugin](#article-structure-plugin)
25
- * [besluit-type-plugin](#besluit-type-plugin)
26
- * [citaten-plugin](#citaten-plugin)
27
- * [decision-plugin](#decision-plugin)
28
- * [import-snippet-plugin](#import-snippet-plugin)
29
- * [rdfa-date-plugin](#rdfa-date-plugin)
30
- * [roadsign-regulation-plugin](#roadsign-regulation-plugin)
31
- * [standard-template-plugin](#standard-template-plugin)
32
- * [table-of-contents-plugin](#table-of-contents-plugin)
33
- * [variable-plugin](#variable-plugin)
34
- * [validation-plugin](#validation-plugin)
35
- * [template-comments-plugin](#template-comments-plugin)
24
+ - [article-structure-plugin](#article-structure-plugin)
25
+ - [besluit-type-plugin](#besluit-type-plugin)
26
+ - [citaten-plugin](#citaten-plugin)
27
+ - [decision-plugin](#decision-plugin)
28
+ - [import-snippet-plugin](#import-snippet-plugin)
29
+ - [roadsign-regulation-plugin](#roadsign-regulation-plugin)
30
+ - [standard-template-plugin](#standard-template-plugin)
31
+ - [table-of-contents-plugin](#table-of-contents-plugin)
32
+ - [variable-plugin](#variable-plugin)
33
+ - [validation-plugin](#validation-plugin)
34
+ - [template-comments-plugin](#template-comments-plugin)
36
35
 
37
36
  You can configure your editor like this:
37
+
38
38
  ```hbs
39
39
  <EditorContainer
40
40
  @editorOptions={{hash
@@ -54,7 +54,8 @@ You can configure your editor like this:
54
54
  @plugins={{this.plugins}}
55
55
  @schema={{this.schema}}
56
56
  @nodeViews={{this.nodeViews}}
57
- @rdfaEditorInit={{this.rdfaEditorInit}}/>
57
+ @rdfaEditorInit={{this.rdfaEditorInit}}
58
+ />
58
59
  </:default>
59
60
  <:aside>
60
61
  {...}
@@ -69,18 +70,22 @@ You will have 2 anchor points where to put your plugins: `top` for a toolbar, an
69
70
  Plugin which allows a user to insert different types of structures, like chapters, sections, articles etc.
70
71
 
71
72
  This plugin provides two widgets which can be added to the sidebar.
73
+
72
74
  ### The structure insertion widget
73
75
 
74
76
  This widget displays a series of buttons which allows the user to insert the configured widgets.
75
77
 
76
78
  You can add this widget to the sidebar using the following syntax:
79
+
77
80
  ```hbs
78
81
  <ArticleStructurePlugin::ArticleStructureCard
79
82
  @controller={{this.controller}}
80
83
  @options={{this.config.structures}}
81
84
  />
82
85
  ```
86
+
83
87
  The widgets accepts two properties:
88
+
84
89
  - `controller`: an instance of a `SayController` which the widgets uses two insert structures into a document
85
90
  - `options`: a list of structure configurations which are supported.
86
91
 
@@ -89,6 +94,7 @@ The widgets accepts two properties:
89
94
  This widget displays a context card in the sidebar when a structure is selected by the user. The card displays controls which allow users to move a structure around or remove it alltogether.
90
95
 
91
96
  You can add this widget to the sidebar using the following syntax:
97
+
92
98
  ```hbs
93
99
  <ArticleStructurePlugin::StructureCard
94
100
  @controller={{this.controller}}
@@ -99,6 +105,7 @@ You can add this widget to the sidebar using the following syntax:
99
105
  Just like the insertion widget, this widget also accepts the same two properties.
100
106
 
101
107
  ### Configuring the plugin
108
+
102
109
  Both widgets require an `options` property which allows you to configure which type of structures are supported, which is a list of `StructureSpec` objects.
103
110
 
104
111
  E.g. a regulatory statement document will typically have the following configuration of structures:
@@ -115,10 +122,11 @@ export const STRUCTURE_SPECS: ArticleStructurePluginOptions = [
115
122
  ```
116
123
 
117
124
  Each of these entries is a seperate `StructureSpec` object. The `StructureSpec` interface is defined as:
125
+
118
126
  ```js
119
127
  export type StructureSpec = {
120
128
  name: SpecName; // the name of the corresponding structure node-spec
121
- translations: { // the ember-intl translation keys which are to be used in the widgets
129
+ translations: { // the ember-intl translation keys which are to be used in the widgets
122
130
  insert: string;
123
131
  move?: {
124
132
  up?: string;
@@ -184,6 +192,7 @@ const STRUCTURE_NODES = {
184
192
  ```
185
193
 
186
194
  You can import these using:
195
+
187
196
  ```js
188
197
  import {
189
198
  STRUCTURE_NODES,
@@ -191,20 +200,23 @@ import {
191
200
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/structures';
192
201
  ```
193
202
 
194
-
195
203
  Additional examples can be found in the two controllers (besluit-sample and regulatory-statement-sample) of the dummy-app contained in this repository.
196
204
 
197
-
198
205
  ## besluit-type-plugin
199
206
 
200
207
  Plugin which allows a user to change the type of a [besluit](https://data.vlaanderen.be/ns/besluit#Besluit).
201
208
 
202
209
  This plugin needs to be added to the toolbar as a dropdown with the following syntax:
210
+
203
211
  ```hbs
204
- <BesluitTypePlugin::ToolbarDropdown @controller={{this.controller}} @options={{this.config.besluitType}}/>
212
+ <BesluitTypePlugin::ToolbarDropdown
213
+ @controller={{this.controller}}
214
+ @options={{this.config.besluitType}}
215
+ />
205
216
  ```
206
217
 
207
218
  You need to specify the endpoint from which the plugin will fetch the types in the config object
219
+
208
220
  ```js
209
221
  {
210
222
  endpoint: 'https://centrale-vindplaats.lblod.info/sparql',
@@ -215,13 +227,13 @@ You need to specify the endpoint from which the plugin will fetch the types in t
215
227
 
216
228
  This plugin provides some warnings to the user if the validation for a besluit fails, it need to be used with the validation plugin as it exports some validation rules for it.
217
229
  In order to use it you will need to add its card to the sidebar like
230
+
218
231
  ```hbs
219
- <DecisionPlugin::DecisionPluginCard
220
- @controller={{this.controller}}
221
- />
232
+ <DecisionPlugin::DecisionPluginCard @controller={{this.controller}} />
222
233
  ```
223
234
 
224
235
  and then import the rule and add it to the config of your validation plugin like
236
+
225
237
  ```js
226
238
  import { atLeastOneArticleContainer } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/decision-plugin/utils/validation-rules';
227
239
  ...
@@ -231,6 +243,7 @@ import { atLeastOneArticleContainer } from '@lblod/ember-rdfa-editor-lblod-plugi
231
243
  ]
232
244
  })
233
245
  ```
246
+
234
247
  With these changes you will see a warning if the decision is missing a title, a motivation block or an article block.
235
248
 
236
249
  ## citaten-plugin
@@ -238,36 +251,40 @@ With these changes you will see a warning if the decision is missing a title, a
238
251
  Plugin which allows a user to insert references to a legal resource or legal expression into the document.
239
252
 
240
253
  This plugin provides a card that shows up when using certain keywords. This needs to be added to the sidebar of the editor like
254
+
241
255
  ```hbs
242
- <CitationPlugin::CitationCard
243
- @controller={{this.controller}}
244
- @plugin={{this.citationPlugin}}
245
- @config={{this.config.citation}}
246
- />
256
+ <CitationPlugin::CitationCard
257
+ @controller={{this.controller}}
258
+ @plugin={{this.citationPlugin}}
259
+ @config={{this.config.citation}}
260
+ />
247
261
  ```
248
262
 
249
263
  Same goes for the `CitationInsert` component, with which you can directly insert a citation
264
+
250
265
  ```hbs
251
- <CitationPlugin::CitationInsert
252
- @controller={{this.controller}}
253
- @config={{this.config.citation}}
254
- />
266
+ <CitationPlugin::CitationInsert
267
+ @controller={{this.controller}}
268
+ @config={{this.config.citation}}
269
+ />
255
270
  ```
256
271
 
257
272
  You need to specify the endpoints for the plugin in the config object
273
+
258
274
  ```js
259
275
  const citationPluginConfig = {
260
276
  endpoint: 'https://codex.opendata.api.vlaanderen.be:8888/sparql',
261
- decisionsEndpoint: 'https://publicatie.gelinkt-notuleren.vlaanderen.be/sparql',
262
- defaultDecisionsGovernmentName: 'Edegem'
263
- }
277
+ decisionsEndpoint:
278
+ 'https://publicatie.gelinkt-notuleren.vlaanderen.be/sparql',
279
+ defaultDecisionsGovernmentName: 'Edegem',
280
+ };
264
281
  ```
265
282
 
266
283
  The `decisionsEndpoint` is optional, and is required if you want to display decisions from the Publicatie.
267
284
  The `defaultDecisionsGovernmentName` is also optional, and is used to filter the decisions from the Publicatie by government name, the government name for the filter can be changed by the user during the search.
268
285
 
269
-
270
286
  Make `this.citationPlugin` a tracked reference to the plugin created with the function exported from the package and the wished configuration
287
+
271
288
  ```js
272
289
  import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
273
290
 
@@ -280,55 +297,56 @@ Make `this.citationPlugin` a tracked reference to the plugin created with the fu
280
297
  ```
281
298
 
282
299
  Configuration:
283
- - type: it can be 'nodes' or 'ranges' if nodes is selected you are expected to pass the `activeInNodeTypes` function, otherwise you should pass the `activeInRanges` function
284
- - activeInNodeTypes: it's a function that gets the prosemirror schema and the state of the actual instance of the editor and returns a `Set` of nodetypes where the plugin should be active
285
- - activeInRanges: it's a function that gets the state of the actual instance of the editor and returns an array of ranges for the plugin to be active in, for example `[[0,50], [70,100]]`
286
- - regex: you can provide your custom regex to detect citations, if not the default one will be used
287
300
 
301
+ - type: it can be 'nodes' or 'ranges' if nodes is selected you are expected to pass the `activeInNodeTypes` function, otherwise you should pass the `activeInRanges` function
302
+ - activeInNodeTypes: it's a function that gets the prosemirror schema and the state of the actual instance of the editor and returns a `Set` of nodetypes where the plugin should be active
303
+ - activeInRanges: it's a function that gets the state of the actual instance of the editor and returns an array of ranges for the plugin to be active in, for example `[[0,50], [70,100]]`
304
+ - regex: you can provide your custom regex to detect citations, if not the default one will be used
288
305
 
289
306
  A common usecase is to have the plugin active in the entire document. Here's how to do that using each configuration type:
290
307
 
291
308
  ```js
292
- import { citationPlugin } from "@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin";
309
+ import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
293
310
 
294
311
  const configA = {
295
- type: "nodes",
296
- activeInNodeTypes(schema) {
297
- // the root node of the document should always have the doc type
298
- return new Set([schema.nodes.doc]);
299
- }
300
- };
301
-
312
+ type: 'nodes',
313
+ activeInNodeTypes(schema) {
314
+ // the root node of the document should always have the doc type
315
+ return new Set([schema.nodes.doc]);
316
+ },
317
+ };
318
+
302
319
  const configB = {
303
- type: "ranges",
320
+ type: 'ranges',
304
321
  activeInRanges(state) {
305
322
  // a node's nodeSize follows the Prosemirror definition
306
323
  // a non-leaf node's size is the sum of its children's sizes + 2
307
324
  // so to get the last valid position "inside" a node, you need to subtract two from its nodeSize
308
- // ref: https://prosemirror.net/docs/ref/#model.Node.nodeSize
325
+ // ref: https://prosemirror.net/docs/ref/#model.Node.nodeSize
309
326
  return [[0, state.doc.nodeSize - 2]];
310
- }
327
+ },
311
328
  };
312
329
  ```
330
+
313
331
  ### Using the plugin
314
332
 
315
333
  If used with the example configuration provided this plugin can be triggered by typing one of the following in the correct RDFa context (
316
334
  the [besluit:motivering](http://data.vlaanderen.be/ns/besluit#motivering) of
317
335
  a [besluit:Besluit](https://data.vlaanderen.be/ns/besluit#Besluit)).These will make `CitationCard` visible with the typed search terms.
318
336
 
319
- * [specification]**decreet** [words to search for] *(e.g. "gemeentedecreet wijziging")*
320
- * **omzendbrief** [words to search for]
321
- * **verdrag** [words to search for]
322
- * **grondwetswijziging** [words to search for]
323
- * **samenwerkingsakkoord** [words to search for]
324
- * [specification]**wetboek** [words to search for]
325
- * **protocol** [words to search for]
326
- * **besluit van de vlaamse regering** [words to search for]
327
- * **gecoordineerde wetten** [words to search for]
328
- * [specification]**wet** [words to search for] *(e.g. "kieswet wijziging", or "grondwet")*
329
- * **koninklijk besluit** [words to search for]
330
- * **ministerieel besluit** [words to search for]
331
- * **genummerd besluit** [words to search for]
337
+ - [specification]**decreet** [words to search for] _(e.g. "gemeentedecreet wijziging")_
338
+ - **omzendbrief** [words to search for]
339
+ - **verdrag** [words to search for]
340
+ - **grondwetswijziging** [words to search for]
341
+ - **samenwerkingsakkoord** [words to search for]
342
+ - [specification]**wetboek** [words to search for]
343
+ - **protocol** [words to search for]
344
+ - **besluit van de vlaamse regering** [words to search for]
345
+ - **gecoordineerde wetten** [words to search for]
346
+ - [specification]**wet** [words to search for] _(e.g. "kieswet wijziging", or "grondwet")_
347
+ - **koninklijk besluit** [words to search for]
348
+ - **ministerieel besluit** [words to search for]
349
+ - **genummerd besluit** [words to search for]
332
350
 
333
351
  You can also add a reference manually by clicking on the `Insert` > `Insert reference` item in the Insert menu located on the top right of the editor (this is the `CitationInsert` component). This will open the advanced search window. **Note** that this will only be
334
352
  avaliable in the proper context (see above in this section).
@@ -338,8 +356,9 @@ avaliable in the proper context (see above in this section).
338
356
  Plugin allowing importing of external RDFA snippets and inserting it in the document.
339
357
 
340
358
  The plugin has a card that needs to be added to the sidebar:
359
+
341
360
  ```hbs
342
- <ImportSnippetPlugin::Card @controller={{this.controller}}/>
361
+ <ImportSnippetPlugin::Card @controller={{this.controller}} />
343
362
  ```
344
363
 
345
364
  ### Using the plugin
@@ -350,11 +369,10 @@ manner:
350
369
  ```js
351
370
  import { inject as service } from '@ember/service';
352
371
 
353
-
354
372
  // An entry point to download the resouce (e.g a route) in your host app.
355
373
  // (...)
356
374
 
357
- let downloadData = { source: 'http://remote/resource.html' }
375
+ let downloadData = { source: 'http://remote/resource.html' };
358
376
  await this.importRdfaSnippet.downloadSnippet(downloadData);
359
377
  ```
360
378
 
@@ -364,59 +382,6 @@ application (https://github.com/lblod/frontend-gelinkt-notuleren).
364
382
  When opening a new document, users will get the option to either include the snippet data in the document or as an
365
383
  attachment.
366
384
 
367
- ## rdfa-date-plugin
368
-
369
- Plugin to insert and modify semantic dates and timestamps in an editor document.
370
-
371
- This plugin provides a card to modify dates that needs to be added to the editor sidebar like
372
-
373
- ```hbs
374
- <RdfaDatePlugin::Card
375
- @controller={{this.controller}}
376
- @options={{this.config.date}}/>
377
- ```
378
-
379
- And an insert button to insert new dates that needs to be added to the insert part of the sidebar:
380
- ```hbs
381
- <RdfaDatePlugin::Insert
382
- @controller={{this.controller}}
383
- @options={{this.config.date}}
384
- />
385
- ```
386
-
387
- You will also need to add a configuration like the following:
388
- ```js
389
- date: date({
390
- placeholder: {
391
- insertDate: this.intl.t('date-plugin.insert.date'),
392
- insertDateTime: this.intl.t('date-plugin.insert.datetime'),
393
- },
394
- formats: [
395
- {
396
- label: 'Short Date',
397
- key: 'short',
398
- dateFormat: 'dd/MM/yy',
399
- dateTimeFormat: 'dd/MM/yy HH:mm',
400
- },
401
- {
402
- label: 'Long Date',
403
- key: 'long',
404
- dateFormat: 'EEEE dd MMMM yyyy',
405
- dateTimeFormat: 'PPPPp',
406
- },
407
- ],
408
- allowCustomFormat: true,
409
- }),
410
- ```
411
- - `formats`: specify default formats to show for selection in the date card.
412
- - `label` (optional): The label shown to the user on the card. If not provided, the format is used instead e.g.: `dd/MM/yyyy`
413
- - `key`: A **unique** identifier used for identification in the internal code.
414
- - `dateFormat`: The date format used when this is selected.
415
- - `dateTimeFormat`: The datetime format to use when this is selected. Used when the user selects "Include time".
416
- - `allowCustomFormat`: true/false, determines if the option to insert a fully custom format is available.
417
-
418
- The syntax of formats can be found at [date-fns](https://date-fns.org/v2.29.3/docs/format).
419
-
420
385
  ## roadsign-regulation-plugin
421
386
 
422
387
  A plugin that fetches data from the mow regulation and roadsign registry and allows users to insert roadsign regulations
@@ -425,19 +390,21 @@ inside an editor document.
425
390
  This plugin provides a card that needs to be added to the editor sidebar like:
426
391
 
427
392
  ```hbs
428
- <RoadsignRegulationPlugin::RoadsignRegulationCard
429
- @controller={{this.controller}}
430
- @options={{this.config.roadsignRegulation}}
431
- />
393
+ <RoadsignRegulationPlugin::RoadsignRegulationCard
394
+ @controller={{this.controller}}
395
+ @options={{this.config.roadsignRegulation}}
396
+ />
432
397
  ```
433
398
 
434
399
  You will need to set the following configuration in the config object
400
+
435
401
  ```js
436
402
  {
437
403
  endpoint: 'https://dev.roadsigns.lblod.info/sparql',
438
404
  imageBaseUrl: 'https://register.mobiliteit.vlaanderen.be/',
439
405
  }
440
406
  ```
407
+
441
408
  The `endpoint` from where the plugin will fetch the roadsigns, and the `imageBaseUrl` is a fallback for the images that don't have a baseUrl specified. This won't be used if your data is correctly constructed.
442
409
 
443
410
  ## standard-template-plugin
@@ -447,19 +414,20 @@ selected text, a dropdown will appear in the toolbar of the editor that lets you
447
414
  context at the location of the cursor.
448
415
 
449
416
  In order to use this plugin you will need to add its card:
417
+
450
418
  ```hbs
451
- <StandardTemplatePlugin::Card @controller={{this.controller}}/>
419
+ <StandardTemplatePlugin::Card @controller={{this.controller}} />
452
420
  ```
453
421
 
454
422
  ### Template resource used by the plugin
455
423
 
456
424
  When creating a template in your database, the following properties are used by the plugin:
457
425
 
458
- * the title of the template (`title`)
459
- * its HTML content (`content`)
460
- * the words of the document the template should match on (`matches`)
461
- * the contexts in which it should be active (`contexts`)
462
- * the contexts in which it should not be active (`disabled-in-contexts`)
426
+ - the title of the template (`title`)
427
+ - its HTML content (`content`)
428
+ - the words of the document the template should match on (`matches`)
429
+ - the contexts in which it should be active (`contexts`)
430
+ - the contexts in which it should not be active (`disabled-in-contexts`)
463
431
 
464
432
  ### Using the plugin
465
433
 
@@ -473,17 +441,19 @@ menu. This attribute can be set on an element in the content of the editor or pr
473
441
 
474
442
  Plugin implementing an auto-refreshing table of contents using an ember-rdfa-editor inline component.
475
443
 
476
- In order to enable the plugin you need to add the table of contents button to the toolbar and the table of contents node view to the list of editor node views.
444
+ In order to enable the plugin you need to add the table of contents button to the toolbar and the table of contents node view to the list of editor node views.
445
+
477
446
  ```hbs
478
- <TableOfContentsPlugin::ToolbarButton @controller={{this.editor}}/>
447
+ <TableOfContentsPlugin::ToolbarButton @controller={{this.editor}} />
479
448
  ```
480
449
 
481
450
  ```js
482
451
  tableOfContentsView(this.config.tableOfContents)(controller),
483
452
  ```
484
453
 
485
- You also need to allow this node as content by adding it to the doc node of the schema. It is *not* part of the block group.
486
- ``` js
454
+ You also need to allow this node as content by adding it to the doc node of the schema. It is _not_ part of the block group.
455
+
456
+ ```js
487
457
  // example to allow the table of contents at the top and any blocks underneath
488
458
  doc: docWithConfig({
489
459
  content: 'table-of-contents? block+'
@@ -506,15 +476,17 @@ For very custom setups, the plugin might be unable to find your scrollContainer
506
476
  },
507
477
  ```
508
478
 
509
- `nodeHierarchy` is a list of *regex* strings to specify the node structure of the document. Note that this means the order of the words does not matter. The example shows this for article structures.
510
- The *first string* selects the main nodes in the document that define the structure.
479
+ `nodeHierarchy` is a list of _regex_ strings to specify the node structure of the document. Note that this means the order of the words does not matter. The example shows this for article structures.
480
+ The _first string_ selects the main nodes in the document that define the structure.
511
481
  The strings afterwards are the sub-nodes inside main nodes that should be used to find the actual content to display in the table of contents, if the main node does not contain the content directly. In the example a title will have a `structure_header` that contains the actual text of the title.
512
482
  In the case that `structure_header` contains a node `actual_title_text` that should be used as content, you'd have to add a third regex string that matches `actual_title_text`.
513
483
 
514
484
  ### Internationalization of the table of contents
485
+
515
486
  The dynamic version of the table of contents is internationalized based on the current document language and using the `ember-intl` service.
516
- The static (serialized) version of the table of contents can also be internationalized based on the current document language. For this to work correctly, the `emberApplication` prosemirror-plugin should be present.
487
+ The static (serialized) version of the table of contents can also be internationalized based on the current document language. For this to work correctly, the `emberApplication` prosemirror-plugin should be present.
517
488
  You can add this plugin as follows to the controller/component in which the editor is initialized:
489
+
518
490
  ```js
519
491
  import { getOwner } from '@ember/application';
520
492
  import { emberApplication } from '@lblod/ember-rdfa-editor/plugins/ember-application';
@@ -526,14 +498,15 @@ plugins = [
526
498
  ];
527
499
  ...
528
500
  ```
501
+
529
502
  As an example, the `emberApplication` plugin has been added to the regulatory-statement route of the dummy app included in this addon.
530
503
 
531
504
  The table of contents node needs this plugin to be able to translate the serialized version properly. If the plugin is not present, a default (dutch) version of the table of contents will be generated.
532
505
 
533
-
534
506
  ## variable-plugin
535
507
 
536
508
  Editor plugin which provides node-specs and components which allow you to insert and edit different types of variables in a document. The plugin provides the following variable types:
509
+
537
510
  - text variable
538
511
  - number variable
539
512
  - date variable
@@ -544,6 +517,7 @@ Editor plugin which provides node-specs and components which allow you to insert
544
517
  Additional variable types can be added in the consuming application or addon.
545
518
 
546
519
  For each of these variable types, a node-spec and node-view are defined. You can import them like this:
520
+
547
521
  ```js
548
522
  import {
549
523
  codelist,
@@ -555,17 +529,20 @@ import {
555
529
  text_variable,
556
530
  textVariableView,
557
531
  address,
558
- addressView
532
+ addressView,
533
+ date,
534
+ dateView,
559
535
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
560
536
  ```
561
537
 
562
- The date-variable node-spec and node-view are defined in the `rdfa-date-plugin`.
563
-
564
538
  For each of the variable-types you want to include in your editor instance, you should add the corresponding node-spec to your schema and the node-view to the `nodeViews` editor argument.
565
539
 
540
+ Both the `date` node-spec and `dateView` nodeview are functions which expect a `DateOptions` object, more information on how to define such a `DateOptions` object can be found in the section on the [date-edit component](#the-date-variable)
541
+
566
542
  ### Inserting variables into a document
567
543
 
568
544
  This addon includes an insert-component for each of these variable types:
545
+
569
546
  - `variable-plugin/text/insert`
570
547
  - `variable-plugin/number/insert`
571
548
  - `variable-plugin/date/insert`
@@ -576,34 +553,41 @@ This addon includes an insert-component for each of these variable types:
576
553
  Each of these components presents a custom UI which allows a user to insert a variable of the corresponding type in a document.
577
554
 
578
555
  These insert-components can be used on their own, but can also be used in combination with the `variable-plugin/insert-variable-card` component. The responsibility of this component is two-fold:
556
+
579
557
  - It allows a user to select a variable type.
580
558
  - The correct insert component corresponding to the user-selected variable type is shown.
581
559
 
582
560
  The `variable-plugin/insert-variable-card` can be easily configured: it expects two arguments:
561
+
583
562
  - `controller`: An instance of the `SayController` class
584
563
  - `variableTypes`: A list of `VariableConfig` objects. With each `VariableConfig` containing:
585
564
  - the `label` which should be displayed in the variable-select dropdown
586
- - the `path` to the insert-variable component
565
+ - the `path` to the insert-variable component
587
566
  - _optionally_ an `options` argument object which should be passed to the insert-variable component.
588
- * The `VariableConfig` type is defined as follows:
589
- ```js
590
- type VariableConfig = {
591
- label: string;
592
- component: {
593
- path: string;
594
- options?: unknown;
595
- };
596
- };
597
- ```
567
+
568
+ * The `VariableConfig` type is defined as follows:
569
+
570
+ ```js
571
+ type VariableConfig = {
572
+ label: string;
573
+ component: {
574
+ path: string;
575
+ options?: unknown;
576
+ };
577
+ };
578
+ ```
598
579
 
599
580
  #### An example
581
+
600
582
  To allows users to insert variables into a document, add the following to the editor sidebar in your template:
583
+
601
584
  ```hbs
602
585
  <VariablePlugin::InsertVariableCard
603
586
  @controller={{this.controller}}
604
587
  @variableTypes={{this.variableTypes}}
605
588
  />
606
589
  ```
590
+
607
591
  `this.controller` is an instance of `SayController` and `this.variableTypes` is the list of `VariableConfig` objects which should be defined in your controller/component class:
608
592
 
609
593
  ```js
@@ -659,27 +643,76 @@ As you can see, both the `location` and `codelist` insert-components require an
659
643
  Aside from the endpoint, the `codelist` insert-component may optionally expect a publisher argument which it will use to limit the codelist fetch to a specific publisher.
660
644
 
661
645
  ### Editing variables in a document
646
+
662
647
  Each of the variables provided by this addon have a different editing experiences and use different components:
663
648
 
664
649
  #### The text variable
650
+
665
651
  Editing a text variable requires no extra components aside from its node-spec and node-view. A user can just type into the text variable directly.
666
652
 
667
653
  #### The number variable
654
+
668
655
  Editing a number variable can be done in its nodeview directly. When a user clicks on a number variable in a document, it opens a popup allow you to fill in a number.
669
656
 
670
657
  #### The date variable
671
- The edit component for the date variable can be found in the [rdfa-date-plugin section](#rdfa-date-plugin)
658
+
659
+ This addon provides a seperate edit component which allows users to fill in date variables in a document.
660
+ This component can be added to the sidebar of an editor instance in a template as follows:
661
+
662
+ ```hbs
663
+ <RdfaDatePlugin::Card
664
+ @controller={{this.controller}}
665
+ @options={{this.dateOptions}}
666
+ />
667
+ ```
668
+
669
+ Where `this.dateOptions` is a `DateOptions` object used to configure the edit component. It can be defined as e.g.:
670
+
671
+ ```js
672
+ get dateOptions(){
673
+ return {
674
+ formats: [
675
+ {
676
+ label: 'Short Date',
677
+ key: 'short',
678
+ dateFormat: 'dd/MM/yy',
679
+ dateTimeFormat: 'dd/MM/yy HH:mm',
680
+ },
681
+ {
682
+ label: 'Long Date',
683
+ key: 'long',
684
+ dateFormat: 'EEEE dd MMMM yyyy',
685
+ dateTimeFormat: 'PPPPp',
686
+ },
687
+ ],
688
+ allowCustomFormat: true,
689
+ }
690
+ }
691
+ ```
692
+
693
+ - `formats`: specify default formats to show for selection in the date card.
694
+ - `label` (optional): The label shown to the user on the card. If not provided, the format is used instead e.g.: `dd/MM/yyyy`
695
+ - `key`: A **unique** identifier used for identification in the internal code.
696
+ - `dateFormat`: The date format used when this is selected.
697
+ - `dateTimeFormat`: The datetime format to use when this is selected. Used when the user selects "Include time".
698
+ - `allowCustomFormat`: true/false, determines if the option to insert a fully custom format is available.
699
+
700
+ The syntax of formats can be found at [date-fns](https://date-fns.org/v2.29.3/docs/format).
672
701
 
673
702
  #### The location variable
703
+
674
704
  This addon provides a seperate edit component which allows users to fill in location variables in a document.
675
705
  This component can be added to the sidebar of an editor instance in a template as follows:
706
+
676
707
  ```hbs
677
- <VariablePlugin::Location::Edit
678
- @controller={{this.controller}}
708
+ <VariablePlugin::Location::Edit
709
+ @controller={{this.controller}}
679
710
  @options={{this.locationEditOptions}}
680
711
  />
681
712
  ```
713
+
682
714
  Where `this.locationEditOptions` is a `LocationEditOptions` object used to configure the edit component. It can be defined as e.g.:
715
+
683
716
  ```js
684
717
  get locationEditOptions() {
685
718
  return {
@@ -693,15 +726,19 @@ get locationEditOptions() {
693
726
  ```
694
727
 
695
728
  #### The codelist variable
729
+
696
730
  This addon provides a seperate edit component which allows users to fill in codelist variables in a document.
697
731
  This component can be added to the sidebar of an editor instance in a template as follows:
732
+
698
733
  ```hbs
699
- <VariablePlugin::Codelist::Edit
700
- @controller={{this.controller}}
734
+ <VariablePlugin::Codelist::Edit
735
+ @controller={{this.controller}}
701
736
  @options={{this.codelistEditOptions}}
702
737
  />
703
738
  ```
739
+
704
740
  Where `this.codelistEditOptions` is a `CodelistEditOptions` object used to configure the edit component. It can be defined as e.g.:
741
+
705
742
  ```js
706
743
  get codelistEditOptions() {
707
744
  return {
@@ -711,20 +748,26 @@ get codelistEditOptions() {
711
748
  ```
712
749
 
713
750
  #### The address variable
751
+
714
752
  This addon provides a seperate edit component which allows users to search for an address and update the select address variable. Additionally, they can also choose whether to include the housenumber of an address.
715
753
  You can add this edit-component to a template as follows:
754
+
716
755
  ```hbs
717
- <VariablePlugin::Address::Edit @controller={{this.controller}} @defaultMuncipality='Antwerpen'/>
756
+ <VariablePlugin::Address::Edit
757
+ @controller={{this.controller}}
758
+ @defaultMuncipality='Antwerpen'
759
+ />
718
760
  ```
719
761
 
720
762
  The edit card can be configured with two arguments:
763
+
721
764
  - An instance of a `SayController` (required)
722
765
  - A `defaultMuncipality` which should be used as the default value of the `muncipality` field in the edit-card (optional)
723
766
 
724
-
725
767
  You can also add an insert component meant for use outside of `insert-variable-card` by using the `variable-plugin/address/insert` component. This has no label-input and will show a default label.
768
+
726
769
  ```hbs
727
- <VariablePlugin::Address::Insert @controller={{this.controller}}/>
770
+ <VariablePlugin::Address::Insert @controller={{this.controller}} />
728
771
  ```
729
772
 
730
773
  ## validation-plugin
@@ -732,18 +775,22 @@ You can also add an insert component meant for use outside of `insert-variable-c
732
775
  see [the plugin docs](addon/plugins/validation/README.md)
733
776
 
734
777
  ## template-comments-plugin
778
+
735
779
  A plugin to insert a template comment anywhere in the document.
736
780
  This is meant as a block of text for extra information to provide to a created template. It has
737
781
  the attribute `ext:TemplateComment`. This can (and should) be filtered out when publishing the document, as it is only meant as extra information while filling in a template.
738
782
  It supports basic text with indenting, list items and marks.
739
783
 
740
784
  Add it to editor by adding `templateComment` to your schema and
785
+
741
786
  ```js
742
787
  templateComment: templateCommentView(controller),
743
788
  ```
789
+
744
790
  as a nodeview.
745
791
 
746
792
  Import with:
793
+
747
794
  ```js
748
795
  import {
749
796
  templateComment,
@@ -751,26 +798,30 @@ import {
751
798
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/template-comments-plugin';
752
799
  ```
753
800
 
754
-
755
801
  Button to insert a template comment is added with
802
+
756
803
  ```hbs
757
- <TemplateCommentsPlugin::Insert @controller={{this.controller}}/>
804
+ <TemplateCommentsPlugin::Insert @controller={{this.controller}} />
758
805
  ```
759
806
 
760
807
  Buttons to remove and move it when selected can be shown with
808
+
761
809
  ```hbs
762
- <TemplateCommentsPlugin::EditCard @controller={{this.controller}}/>
810
+ <TemplateCommentsPlugin::EditCard @controller={{this.controller}} />
763
811
  ```
764
812
 
765
813
  Template comments have a specific style that can be imported in the stylesheet with
814
+
766
815
  ```css
767
816
  @import 'template-comments-plugin';
768
817
  ```
818
+
769
819
  ## Contributing
770
820
 
771
821
  See the [Contributing](CONTRIBUTING.md) guide for details.
772
822
 
773
823
  ## Releasing
824
+
774
825
  See the [Release](RELEASE.md) guide.
775
826
 
776
827
  ## License