@lblod/ember-rdfa-editor-lblod-plugins 9.1.1 → 11.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 (156) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/README.md +213 -150
  3. package/addon/components/import-snippet-plugin/card.hbs +11 -5
  4. package/addon/components/rdfa-date-plugin/help-modal.hbs +12 -0
  5. package/addon/components/roadsign-regulation-plugin/expanded-measure.hbs +40 -10
  6. package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +1 -0
  7. package/addon/components/roadsign-regulation-plugin/measure-template.ts +6 -12
  8. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +1 -1
  9. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.hbs +5 -5
  10. package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.hbs +4 -4
  11. package/addon/components/roadsign-regulation-plugin/roadsigns-table.hbs +25 -9
  12. package/addon/components/snippet-plugin/search-modal.ts +4 -0
  13. package/addon/components/snippet-plugin/snippet-insert.hbs +1 -0
  14. package/addon/components/snippet-plugin/snippet-insert.ts +14 -11
  15. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +80 -0
  16. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +98 -0
  17. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +29 -0
  18. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.ts +28 -0
  19. package/addon/components/snippet-plugin/snippet-list-select.hbs +16 -0
  20. package/addon/components/snippet-plugin/snippet-list-select.ts +27 -0
  21. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +1 -1
  22. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +16 -55
  23. package/addon/components/template-comments-plugin/edit-card.hbs +7 -9
  24. package/addon/components/template-comments-plugin/template-comment.hbs +2 -2
  25. package/addon/components/template-comments-plugin/template-comment.ts +0 -36
  26. package/addon/components/variable-plugin/address/edit.hbs +35 -0
  27. package/addon/components/variable-plugin/address/edit.ts +96 -0
  28. package/addon/components/variable-plugin/address/insert.hbs +9 -0
  29. package/addon/components/variable-plugin/address/insert.ts +37 -0
  30. package/addon/components/variable-plugin/address/nodeview.hbs +19 -0
  31. package/addon/components/variable-plugin/address/nodeview.ts +31 -0
  32. package/addon/components/variable-plugin/{template-variable-card.hbs → codelist/edit.hbs} +14 -12
  33. package/addon/components/variable-plugin/codelist/edit.ts +94 -0
  34. package/addon/components/variable-plugin/codelist/insert.hbs +22 -0
  35. package/addon/components/variable-plugin/codelist/insert.ts +84 -0
  36. package/addon/components/variable-plugin/date/insert.hbs +9 -0
  37. package/addon/components/variable-plugin/date/insert.ts +45 -0
  38. package/addon/components/variable-plugin/insert-variable-card.hbs +7 -40
  39. package/addon/components/variable-plugin/insert-variable-card.ts +18 -166
  40. package/addon/components/variable-plugin/location/edit.hbs +40 -0
  41. package/addon/components/variable-plugin/location/edit.ts +122 -0
  42. package/addon/components/variable-plugin/location/insert.hbs +9 -0
  43. package/addon/components/variable-plugin/location/insert.ts +65 -0
  44. package/addon/components/variable-plugin/{number-settings.hbs → number/insert.hbs} +20 -9
  45. package/addon/components/variable-plugin/number/insert.ts +88 -0
  46. package/addon/components/{variable-number/number.hbs → variable-plugin/number/nodeview.hbs} +2 -2
  47. package/addon/components/{variable-number/number.ts → variable-plugin/number/nodeview.ts} +3 -7
  48. package/addon/components/variable-plugin/text/insert.hbs +9 -0
  49. package/addon/components/variable-plugin/text/insert.ts +49 -0
  50. package/addon/components/variable-plugin/utils/label-input.hbs +11 -0
  51. package/addon/components/variable-plugin/{variable.ts → variable/nodeview.ts} +1 -1
  52. package/addon/helpers/in-array.ts +13 -0
  53. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +1 -1
  54. package/addon/plugins/rdfa-date-plugin/nodes/date.ts +48 -51
  55. package/addon/plugins/snippet-plugin/index.ts +20 -0
  56. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +127 -11
  57. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +23 -17
  58. package/addon/plugins/table-of-contents-plugin/utils/index.ts +1 -1
  59. package/addon/plugins/template-comments-plugin/index.ts +1 -5
  60. package/addon/plugins/template-comments-plugin/node.ts +3 -16
  61. package/addon/plugins/variable-plugin/utils/address-helpers.ts +112 -0
  62. package/addon/plugins/variable-plugin/utils/attribute-parsers.ts +31 -0
  63. package/addon/plugins/variable-plugin/utils/codelist-utils.ts +56 -0
  64. package/addon/plugins/variable-plugin/utils/constants.ts +0 -120
  65. package/addon/plugins/variable-plugin/utils/dom-constructors.ts +66 -0
  66. package/addon/plugins/variable-plugin/utils/fetch-data.ts +2 -2
  67. package/addon/plugins/variable-plugin/variables/address.ts +322 -0
  68. package/addon/plugins/variable-plugin/variables/codelist.ts +120 -0
  69. package/addon/plugins/variable-plugin/variables/index.ts +5 -0
  70. package/addon/plugins/variable-plugin/variables/location.ts +98 -0
  71. package/addon/plugins/variable-plugin/variables/number.ts +145 -0
  72. package/addon/plugins/variable-plugin/variables/text.ts +90 -0
  73. package/addon/utils/constants.ts +7 -0
  74. package/addon/utils/dom-output-spec-helpers.ts +8 -0
  75. package/addon/utils/namespace.ts +11 -0
  76. package/app/components/snippet-plugin/snippet-list/snippet-list-modal.js +1 -0
  77. package/app/components/{variable-plugin/template-variable-card.js → snippet-plugin/snippet-list/snippet-list-view.js} +1 -1
  78. package/app/components/snippet-plugin/snippet-list-select.js +1 -0
  79. package/app/components/variable-plugin/{variable.js → address/edit.js} +1 -1
  80. package/app/components/variable-plugin/{number-settings.js → address/insert.js} +1 -1
  81. package/app/components/variable-plugin/address/nodeview.js +1 -0
  82. package/app/components/variable-plugin/codelist/edit.js +1 -0
  83. package/app/components/variable-plugin/codelist/insert.js +1 -0
  84. package/app/components/{address-plugin → variable-plugin/date}/insert.js +1 -1
  85. package/app/components/variable-plugin/location/edit.js +1 -0
  86. package/app/components/variable-plugin/location/insert.js +1 -0
  87. package/app/components/variable-plugin/number/insert.js +1 -0
  88. package/app/components/variable-plugin/number/nodeview.js +1 -0
  89. package/app/components/{variable-number/number.js → variable-plugin/text/insert.js} +1 -1
  90. package/app/components/variable-plugin/utils/label-input.js +1 -0
  91. package/app/components/variable-plugin/variable/nodeview.js +1 -0
  92. package/app/helpers/in-array.js +4 -0
  93. package/app/styles/snippet-plugin.scss +18 -1
  94. package/components/roadsign-regulation-plugin/expanded-measure.d.ts +1 -0
  95. package/components/roadsign-regulation-plugin/measure-template.d.ts +2 -4
  96. package/components/snippet-plugin/search-modal.d.ts +1 -0
  97. package/components/snippet-plugin/snippet-insert.d.ts +3 -1
  98. package/components/snippet-plugin/snippet-list/snippet-list-modal.d.ts +23 -0
  99. package/components/snippet-plugin/snippet-list/snippet-list-view.d.ts +10 -0
  100. package/components/snippet-plugin/snippet-list-select.d.ts +14 -0
  101. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +5 -12
  102. package/components/template-comments-plugin/template-comment.d.ts +0 -8
  103. package/components/variable-plugin/address/edit.d.ts +23 -0
  104. package/components/variable-plugin/address/insert.d.ts +11 -0
  105. package/components/variable-plugin/address/nodeview.d.ts +14 -0
  106. package/components/variable-plugin/codelist/edit.d.ts +27 -0
  107. package/components/variable-plugin/codelist/insert.d.ts +26 -0
  108. package/components/variable-plugin/date/insert.d.ts +13 -0
  109. package/components/variable-plugin/insert-variable-card.d.ts +10 -34
  110. package/components/variable-plugin/location/edit.d.ts +31 -0
  111. package/components/variable-plugin/location/insert.d.ts +20 -0
  112. package/components/variable-plugin/number/insert.d.ts +20 -0
  113. package/components/{variable-number/number.d.ts → variable-plugin/number/nodeview.d.ts} +1 -1
  114. package/components/variable-plugin/text/insert.d.ts +13 -0
  115. package/components/variable-plugin/{variable.d.ts → variable/nodeview.d.ts} +1 -1
  116. package/helpers/in-array.d.ts +9 -0
  117. package/package.json +5 -5
  118. package/plugins/snippet-plugin/index.d.ts +11 -0
  119. package/plugins/snippet-plugin/utils/fetch-data.d.ts +10 -1
  120. package/plugins/table-of-contents-plugin/utils/index.d.ts +1 -1
  121. package/plugins/template-comments-plugin/index.d.ts +1 -1
  122. package/plugins/template-comments-plugin/node.d.ts +0 -4
  123. package/plugins/variable-plugin/utils/address-helpers.d.ts +4 -0
  124. package/plugins/variable-plugin/utils/attribute-parsers.d.ts +5 -0
  125. package/plugins/variable-plugin/utils/codelist-utils.d.ts +6 -0
  126. package/plugins/variable-plugin/utils/constants.d.ts +0 -19
  127. package/plugins/variable-plugin/utils/dom-constructors.d.ts +24 -0
  128. package/plugins/variable-plugin/utils/fetch-data.d.ts +1 -1
  129. package/plugins/variable-plugin/variables/address.d.ts +23 -0
  130. package/plugins/variable-plugin/variables/codelist.d.ts +2 -0
  131. package/plugins/variable-plugin/variables/index.d.ts +5 -0
  132. package/plugins/variable-plugin/variables/location.d.ts +2 -0
  133. package/plugins/variable-plugin/variables/text.d.ts +2 -0
  134. package/translations/en-US.yaml +74 -2
  135. package/translations/nl-BE.yaml +73 -1
  136. package/types/global.d.ts +10 -0
  137. package/utils/constants.d.ts +3 -0
  138. package/utils/dom-output-spec-helpers.d.ts +2 -0
  139. package/utils/namespace.d.ts +1 -0
  140. package/addon/components/address-plugin/insert.hbs +0 -47
  141. package/addon/components/address-plugin/insert.ts +0 -100
  142. package/addon/components/address-plugin/types.ts +0 -26
  143. package/addon/components/address-plugin/utils.ts +0 -59
  144. package/addon/components/variable-plugin/template-variable-card.ts +0 -163
  145. package/addon/plugins/variable-plugin/index.ts +0 -5
  146. package/addon/plugins/variable-plugin/nodes.ts +0 -264
  147. package/addon/plugins/variable-plugin/number.ts +0 -50
  148. package/app/components/variable-plugin/variable-edit-modal.js +0 -1
  149. package/components/address-plugin/insert.d.ts +0 -21
  150. package/components/address-plugin/types.d.ts +0 -25
  151. package/components/address-plugin/utils.d.ts +0 -9
  152. package/components/variable-plugin/template-variable-card.d.ts +0 -29
  153. package/plugins/variable-plugin/index.d.ts +0 -5
  154. package/plugins/variable-plugin/nodes.d.ts +0 -37
  155. /package/addon/components/variable-plugin/{variable.hbs → variable/nodeview.hbs} +0 -0
  156. /package/plugins/variable-plugin/{number.d.ts → variables/number.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [11.0.0] - 2023-08-22
11
+
12
+ ### Added
13
+ - GN-4261: addition of an address variable
14
+ - GN-4262: addition of WGS84 coordinates to address variables
15
+ - Introduce internationalization in the table of contents node based on the document language.
16
+ - The whole table of contents node (include its entries) is now exported in its `serialize` method without the need of an `entries` attribute.
17
+ - GN-4461: update readme to specify needed imports for template comment
18
+
19
+ ### Changed
20
+ - Use one-way-binding in variable label input
21
+ - Use one-way-binding in number variable inputs
22
+ - Manage snippet list connection with template
23
+
24
+ ### Fixed
25
+ - GN-4404: ensure number-variable placeholders are consistent
26
+
27
+ ### Breaking
28
+ - Removal of old address-plugin
29
+ - Removal of the `entries` attribute from the table-of-contents prosemirror node. The node can now generate it's own outline in its `serialize` method.
30
+ ### Dependencies
31
+ - Bumps `@codemirror/view` from 6.12.0 to 6.16.0
32
+
33
+ ## [10.0.0] - 2023-08-08
34
+ ### Changed
35
+ - remove unused code from template comment component
36
+ - remove allowedTypes from indentation menu
37
+ - allow normal type of paragraphs (=can have italic mark) in template comments
38
+ ### Dependencies
39
+ - Bumps `@embroider/test-setup` from 1.8.3 to 3.0.1
40
+ - Bumps `@types/ember__application` from 4.0.4 to 4.0.6
41
+ - Bumps `webpack` from 5.76.0 to 5.88.2
42
+ - Bumps `@types/ember__component` from 4.0.11 to 4.0.14
43
+ ### Fixed
44
+ - Allow `block*` content in `article_paragraph`
45
+ - Move buttons for template comments are blue
46
+ - problems with lists in template comments
47
+ - GN-4451: fix roadsign plugin no longer showing rendered templates in modal (merge hotfix v8.4.3)
48
+ - Snippet insertion inserts first node correctly
49
+ - Enable no-bare-strings rule and update translations where needed
50
+
51
+ ### Added
52
+ - Addition of `variable` group to each variable node-spec.
53
+
54
+ ### Breaking
55
+ #### Major rework of variable plugin
56
+ - Removal of generic `variable` node-spec. This node-spec is now replaced by domain-specific `text_variable`, `number`, `date`, `location` and `codelist` node-specs. These new node-specs each have their corresponding node-view.
57
+ - Rework of the `insert-variable-card` component: this component is only a wrapper which lets you select a variable type. It then shows the insert component corresponding to that variable type. You can configure the `insert-variable-card` with a list of variable types and their corresponding insert component. Each variable type (text, number, date, codelist and location) now has a seperate insert component defined.
58
+ - Removal of the `template-variable-card` component. This component has been replaced by two edit components for both the `location` and `codelist` variables.
59
+ - Removal of `DEFAULT_VARIABLE_TYPES`. The insertion of the variable types are now handled by the insert components of the different variable types.
60
+
10
61
  ## [9.1.1] - 2023-08-02
11
62
  ### Fixed
12
63
  - GN-4446: fix email-address formatting in error components
@@ -15,6 +66,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
66
  - Bumps `@types/rdf-validate-shacl` from 0.4.0 to 0.4.2
16
67
  - Bumps `@types/ember__polyfills` from 4.0.1 to 4.0.2
17
68
 
69
+ ## [8.4.3] - 2023-08-07
70
+
71
+ ### Fixed
72
+ - GN-4451: fix roadsign plugin no longer showing rendered templates in modal
73
+
74
+ ## [8.4.2] - 2023-08-02
75
+ ### Fixed
76
+ - GN-4446: fix email-address formatting in error components
77
+
18
78
  ## [9.1.0] - 2023-07-29
19
79
 
20
80
  ### Added
@@ -615,7 +675,7 @@ add onclick handler to pencil icon in variable plugin
615
675
 
616
676
  # Changelog
617
677
 
618
- [unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.1...HEAD
678
+ [unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v11.0.0...HEAD
619
679
  [8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.0.0...v8.0.1
620
680
  [8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.1.0...v8.0.0
621
681
  [7.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.0.0...v7.1.0
@@ -631,11 +691,15 @@ add onclick handler to pencil icon in variable plugin
631
691
  [3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
632
692
  [2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
633
693
  [2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
694
+ [11.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v10.0.0...v11.0.0
695
+ [10.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.1...v10.0.0
634
696
  [9.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.0...v9.1.1
635
697
  [9.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.2...v9.1.0
636
698
  [9.0.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.1...v9.0.2
637
699
  [9.0.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.0...v9.0.1
638
700
  [9.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.1...v9.0.0
701
+ [8.4.3]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.2...v8.4.3
702
+ [8.4.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.1...v8.4.2
639
703
  [8.4.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.0...v8.4.1
640
704
  [8.4.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.3.0...v8.4.0
641
705
  [8.3.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.2.2...v8.3.0
package/README.md CHANGED
@@ -24,14 +24,12 @@ This addon contains the following editor plugins:
24
24
  * [citaten-plugin](#citaten-plugin)
25
25
  * [decision-plugin](#decision-plugin)
26
26
  * [import-snippet-plugin](#import-snippet-plugin)
27
- * [insert-variable-plugin](#insert-variable-plugin)
28
27
  * [rdfa-date-plugin](#rdfa-date-plugin)
29
28
  * [roadsign-regulation-plugin](#roadsign-regulation-plugin)
30
29
  * [standard-template-plugin](#standard-template-plugin)
31
30
  * [table-of-contents-plugin](#table-of-contents-plugin)
32
- * [template-variable-plugin](#template-variable-plugin)
31
+ * [variable-plugin](#variable-plugin)
33
32
  * [validation-plugin](#validation-plugin)
34
- * [address-plugin](#address-plugin)
35
33
  * [template-comments-plugin](#template-comments-plugin)
36
34
 
37
35
  You can configure your editor like this:
@@ -204,7 +202,7 @@ This plugin needs to be added to the toolbar as a dropdown with the following sy
204
202
  <BesluitTypePlugin::ToolbarDropdown @controller={{this.controller}} @options={{this.config.besluitType}}/>
205
203
  ```
206
204
 
207
- You can need to specify the endpoint from which the plugin will fetch the types
205
+ You need to specify the endpoint from which the plugin will fetch the types in the config object
208
206
  ```js
209
207
  {
210
208
  endpoint: 'https://centrale-vindplaats.lblod.info/sparql',
@@ -262,7 +260,7 @@ Same goes for the `CitationInsert` component
262
260
  ```
263
261
 
264
262
 
265
- Being this.citationPlugin a tracked reference to the plugin created with the function exported from the package and the wished configuration
263
+ Make `this.citationPlugin` a tracked reference to the plugin created with the function exported from the package and the wished configuration
266
264
  ```js
267
265
  import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
268
266
 
@@ -360,113 +358,6 @@ application (https://github.com/lblod/frontend-gelinkt-notuleren).
360
358
  When opening a new document, users will get the option to either include the snippet data in the document or as an
361
359
  attachment.
362
360
 
363
- ## insert-variable-plugin
364
-
365
- Plugin which allows users to insert variable placeholders into a document.
366
-
367
- The plugin provides a card that needs to be attached to the editor sidebar like
368
- ```hbs
369
- <VariablePlugin::InsertVariableCard
370
- @controller={{this.controller}}
371
- @options={{this.config.variable}}
372
- />
373
- ```
374
-
375
- ### Configuring the plugin
376
-
377
- The plugin can be configured through the following optional attributes that can be added as a json to the options attribute of the card:
378
-
379
- - `publisher`: the URI of a specific codelist publisher which you can use if you want to filter the codelists by its
380
- publisher.
381
- - `defaultEndpoint`: The default endpoint where the codelists are fetched, this is also the variable that gets passed to
382
- the fetchSubtypes and template function
383
- - `variableTypes`: a custom list of variable types you want the plugin to use. This list can contain the following
384
- default variable types: `text`, `number`,`date`,`location` and `codelist`. Additionally this list can also contain
385
- custom variable types, configured by the following three sub-attributes:
386
- * `label`: the label of the custom variable type
387
- * `fetchSubTypes` (optional): a function which returns a list of possible variable values. The function takes two
388
- optional arguments: an `endpoint` and a `publisher`.
389
- * `constructor`: function which returns a prosemirror node to be inserted, the function takes three arguments, the prosemirror `schema`, the `endpoint` and the `selectedSubtype` if you are using subtypes.
390
-
391
- #### Example
392
-
393
- ```js
394
- {
395
-
396
- publisher: 'http://data.lblod.info/id/bestuurseenheden/141d9d6b-54af-4d17-b313-8d1c30bc3f5b',
397
- defaultEndpoint
398
- :
399
- 'https://dev.roadsigns.lblod.info/sparql',
400
- variableTypes
401
- :
402
- [
403
- 'text',
404
- 'number',
405
- 'date',
406
- 'location',
407
- 'codelist',
408
- {
409
- label: 'Simple Variable',
410
- constructor: (schema) => {
411
- const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
412
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
413
- return schema.node(
414
- 'variable',
415
- {
416
- mappingResource: mappingURI,
417
- variableInstance,
418
- type: 'Simple Variable',
419
- },
420
- schema.node('placeholder', { placeholderText: 'text' })
421
- );
422
- },
423
- },
424
- {
425
- label: 'Complex Variable',
426
- fetchSubtypes: async (endpoint, publisher) => {
427
- const subtypes = [
428
- {
429
- uri: '1',
430
- label: '1',
431
- },
432
- {
433
- uri: '2',
434
- label: '2',
435
- },
436
- {
437
- uri: '3',
438
- label: '3',
439
- },
440
- ];
441
- return subtypes;
442
- },
443
- constructor: (schema, endpoint, selectedSubtype) => {
444
- const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
445
- const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
446
- return schema.node(
447
- 'variable',
448
- {
449
- type: 'Complex Variable',
450
- mappingResource: mappingURI,
451
- subTypeResource: selectedSubtype?.uri,
452
- variableInstance,
453
- source: endpoint,
454
- },
455
- schema.node('placeholder', {
456
- placeholderText: selectedSubtype?.label ?? '',
457
- })
458
- );
459
- }
460
- },
461
- ],
462
- }
463
- ```
464
-
465
- ### Using the plugin
466
-
467
- When the insert-variable-plugin is enabled, users will have the option to insert a variable into a document through a
468
- card which pops up in the sidebar of the editor.
469
-
470
361
  ## rdfa-date-plugin
471
362
 
472
363
  Plugin to insert and modify semantic dates and timestamps in an editor document.
@@ -479,7 +370,7 @@ This plugin provides a card to modify dates that needs to be added to the editor
479
370
  @options={{this.config.date}}/>
480
371
  ```
481
372
 
482
- And a insert button to insert new dates that needs to be added to the insert part of the sidebar:
373
+ And an insert button to insert new dates that needs to be added to the insert part of the sidebar:
483
374
  ```hbs
484
375
  <RdfaDatePlugin::Insert
485
376
  @controller={{this.controller}}
@@ -505,17 +396,20 @@ inside an editor document.
505
396
  This plugin provides a card that needs to be added to the editor sidebar like:
506
397
 
507
398
  ```hbs
508
- <RoadsignRegulationPlugin::RoadsignRegulationCard @controller={{this.controller}}/>
399
+ <RoadsignRegulationPlugin::RoadsignRegulationCard
400
+ @controller={{this.controller}}
401
+ @options={{this.config.roadsignRegulation}}
402
+ />
509
403
  ```
510
404
 
511
- You will need to set the following configuration
405
+ You will need to set the following configuration in the config object
512
406
  ```js
513
407
  {
514
408
  endpoint: 'https://dev.roadsigns.lblod.info/sparql',
515
409
  imageBaseUrl: 'https://register.mobiliteit.vlaanderen.be/',
516
410
  }
517
411
  ```
518
- 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, probably you won't need it if your data is correctly constructed
412
+ 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, probably you won't need it if your data is correctly constructed.
519
413
 
520
414
  ## standard-template-plugin
521
415
 
@@ -555,7 +449,7 @@ In order to enable the plugin you need to add the table of contents button to th
555
449
  <TableOfContentsPlugin::ToolbarButton @controller={{this.editor}}/>
556
450
  ```
557
451
 
558
- ```
452
+ ```js
559
453
  tableOfContentsView(this.config.tableOfContents)(controller),
560
454
  ```
561
455
  ### Configuring the plugin with a custom config
@@ -574,68 +468,232 @@ For very custom setups, the plugin might be unable to find your scrollContainer
574
468
  },
575
469
  ```
576
470
 
471
+ ### Internationalization of the table of contents
472
+ The dynamic version of the table of contents is internationalized based on the current document language and using the `ember-intl` service.
473
+ 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.
474
+ You can add this plugin as follows to the controller/component in which the editor is initialized:
475
+ ```js
476
+ import { getOwner } from '@ember/application';
477
+ import { emberApplication } from '@lblod/ember-rdfa-editor/plugins/ember-application';
478
+ ...
479
+ plugins = [
480
+ ...
481
+ emberApplication(getOwner(this));
482
+ ...
483
+ ];
484
+ ...
485
+ ```
486
+ As an example, the `emberApplication` plugin has been added to the regulatory-statement route of the dummy app included in this addon.
487
+
488
+ 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.
577
489
 
578
- ## template-variable-plugin
579
490
 
580
- Editor plugin which allows you to interact with placeholders created by the insert-variable-plugin.
491
+ ## variable-plugin
581
492
 
582
- For enabling it, you need to add the card provided by the plugin to the editor sidebar
583
- ```hbs
584
- <VariablePlugin::TemplateVariableCard @controller={{this.controller}} @options={{this.config.templateVariable}}/>
585
- ```
493
+ 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:
494
+ - text variable
495
+ - number variable
496
+ - date variable
497
+ - codelist
498
+ - location
499
+ - address
586
500
 
587
- You will also need to add the variable node to the list of nodes of your prosemirror schema and the variable view to the list of nodeviews like `variable: variableView(controller)` imported from:
501
+ Additional variable types can be added in the consuming application or addon.
588
502
 
503
+ For each of these variable types, a node-spec and node-view are defined. You can import them like this:
589
504
  ```js
590
505
  import {
591
- variable,
592
- variableView,
593
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/nodes';
506
+ codelist,
507
+ codelistView,
508
+ location,
509
+ locationView,
510
+ number,
511
+ numberView,
512
+ text_variable,
513
+ textVariableView,
514
+ address,
515
+ addressView
516
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
517
+ ```
518
+
519
+ The date-variable node-spec and node-view are defined in the `rdfa-date-plugin`.
520
+
521
+ 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.
522
+
523
+ ### Inserting variables into a document
524
+
525
+ This addon includes an insert-component for each of these variable types:
526
+ - `variable-plugin/text/insert`
527
+ - `variable-plugin/number/insert`
528
+ - `variable-plugin/date/insert`
529
+ - `variable-plugin/location/insert`
530
+ - `variable-plugin/codelist/insert`
531
+ - `variable-plugin/address/insert`
532
+
533
+ Each of these components presents a custom UI which allows a user to insert a variable of the corresponding type in a document.
534
+
535
+ 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:
536
+ - It allows a user to select a variable type.
537
+ - The correct insert component corresponding to the user-selected variable type is shown.
538
+
539
+ The `variable-plugin/insert-variable-card` can be easily configured: it expects two arguments:
540
+ - `controller`: An instance of the `SayController` class
541
+ - `variableTypes`: A list of `VariableConfig` objects. With each `VariableConfig` containing:
542
+ - the `label` which should be displayed in the variable-select dropdown
543
+ - the `path` to the insert-variable component
544
+ - _optionally_ an `options` argument object which should be passed to the insert-variable component.
545
+ * The `VariableConfig` type is defined as follows:
546
+ ```js
547
+ type VariableConfig = {
548
+ label: string;
549
+ component: {
550
+ path: string;
551
+ options?: unknown;
552
+ };
553
+ };
554
+ ```
594
555
 
556
+ #### An example
557
+ To allows users to insert variables into a document, add the following to the editor sidebar in your template:
558
+ ```hbs
559
+ <VariablePlugin::InsertVariableCard
560
+ @controller={{this.controller}}
561
+ @variableTypes={{this.variableTypes}}
562
+ />
595
563
  ```
596
-
597
- ### Configuring the plugin
598
-
599
-
600
- You can configure the card with the following attributes:
564
+ `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:
601
565
 
602
566
  ```js
603
- {
604
- endpoint: 'https://dev.roadsigns.lblod.info/sparql', // the fallback endpoint which should be used for codelists which do not have a `dct:source` property.
605
- zonalLocationCodelistUri:
606
- 'http://lblod.data.gift/concept-schemes/62331E6900730AE7B99DF7EF',
607
- nonZonalLocationCodelistUri:
608
- 'http://lblod.data.gift/concept-schemes/62331FDD00730AE7B99DF7F2',
567
+ get variableTypes() {
568
+ return [
569
+ {
570
+ label: 'text',
571
+ component: {
572
+ path: 'variable-plugin/text/insert',
573
+ },
574
+ },
575
+ {
576
+ label: 'number',
577
+ component: {
578
+ path: 'variable-plugin/number/insert',
579
+ },
580
+ },
581
+ {
582
+ label: 'date',
583
+ component: {
584
+ path: 'variable-plugin/date/insert',
585
+ },
586
+ },
587
+ {
588
+ label: 'location',
589
+ component: {
590
+ path: 'variable-plugin/location/insert',
591
+ options: {
592
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql',
593
+ },
594
+ },
595
+ },
596
+ {
597
+ label: 'codelist',
598
+ component: {
599
+ path: 'variable-plugin/codelist/insert',
600
+ options: {
601
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql',
602
+ },
603
+ },
604
+ },
605
+ ];
609
606
  }
610
607
  ```
611
- The most important attributes are `zonalLocationCodelistUri` and `nonZonalLocationCodelistUri` that are the uri that the location codelists have on your backend.
612
608
 
613
- ## validation-plugin
609
+ As you can see, both the `location` and `codelist` insert-components require an endpoint to be provided. They will use it to fetch the codelists/locations.
610
+ 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.
614
611
 
615
- see [the plugin docs](addon/plugins/validation/README.md)
612
+ ### Editing variables in a document
613
+ Each of the variables provided by this addon have a different editing experiences and use different components:
616
614
 
617
- ## address-plugin
615
+ #### The text variable
616
+ 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.
618
617
 
619
- Editor plugin which allows you to insert address based on information from
618
+ #### The number variable
619
+ 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.
620
620
 
621
- - https://basisregisters.vlaanderen.be/api/v1/adressen
622
- - https://geo.api.vlaanderen.be/geolocation/v4/Location
621
+ #### The date variable
622
+ The edit component for the date variable can be found in the [rdfa-date-plugin section](#rdfa-date-plugin)
623
623
 
624
- For enabling it, you need to add the card provided by the plugin to the editor sidebar
624
+ #### The location variable
625
+ This addon provides a seperate edit component which allows users to fill in location variables in a document.
626
+ This component can be added to the sidebar of an editor instance in a template as follows:
627
+ ```hbs
628
+ <VariablePlugin::Location::Edit
629
+ @controller={{this.controller}}
630
+ @options={{this.locationEditOptions}}
631
+ />
632
+ ```
633
+ Where `this.locationEditOptions` is a `LocationEditOptions` object used to configure the edit component. It can be defined as e.g.:
634
+ ```js
635
+ get locationEditOptions() {
636
+ return {
637
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql', //the fallback endpoint the edit component should use to fetch location values if the location variable has no `source` attribute
638
+ zonalLocationCodelistUri:
639
+ 'http://lblod.data.gift/concept-schemes/62331E6900730AE7B99DF7EF', //the uri the edit component should search for if the location variable is included in a zonal traffic measure
640
+ nonZonalLocationCodelistUri:
641
+ 'http://lblod.data.gift/concept-schemes/62331FDD00730AE7B99DF7F2', // the uri the edit component should search for if the location variable is included in a non-zonal traffic measure
642
+ };
643
+ }
644
+ ```
625
645
 
646
+ #### The codelist variable
647
+ This addon provides a seperate edit component which allows users to fill in codelist variables in a document.
648
+ This component can be added to the sidebar of an editor instance in a template as follows:
626
649
  ```hbs
627
- <AddressPlugin::Insert @controller={{this.controller}} />
650
+ <VariablePlugin::Codelist::Edit
651
+ @controller={{this.controller}}
652
+ @options={{this.codelistEditOptions}}
653
+ />
654
+ ```
655
+ Where `this.codelistEditOptions` is a `CodelistEditOptions` object used to configure the edit component. It can be defined as e.g.:
656
+ ```js
657
+ get codelistEditOptions() {
658
+ return {
659
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql', //the fallback endpoint the edit component should use to fetch codelist values if the codelist variable has no `source` attribute
660
+ };
661
+ }
628
662
  ```
629
663
 
664
+ #### The address variable
665
+ 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.
666
+ You can add this edit-component to a template as follows:
667
+ ```hbs
668
+ <VariablePlugin::Address::Edit @controller={{this.controller}}/>
669
+ ```
670
+
671
+ ## validation-plugin
672
+
673
+ see [the plugin docs](addon/plugins/validation/README.md)
674
+
630
675
  ## template-comments-plugin
631
676
  A plugin to insert a template comment anywhere in the document.
632
677
  This is meant as a block of text for extra information to provide to a created template. It has
633
678
  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.
634
- It supports basic text with indenting, list items and the marks strong (bold), strikethrough and underline. Italic is not possible as the text is italic by default.
679
+ It supports basic text with indenting, list items and marks.
635
680
 
636
- Add it to editor by adding `...templateCommentNodes` to your schema and `templateComment: templateCommentView(controller)` as a nodeview.
681
+ Add it to editor by adding `templateComment` to your schema and
682
+ ```js
683
+ templateComment: templateCommentView(controller),
684
+ ```
685
+ as a nodeview.
637
686
 
638
- Logic to insert a template comment is added with
687
+ Import with:
688
+ ```js
689
+ import {
690
+ templateComment,
691
+ templateCommentView,
692
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/template-comments-plugin';
693
+ ```
694
+
695
+
696
+ Button to insert a template comment is added with
639
697
  ```hbs
640
698
  <TemplateCommentsPlugin::Insert @controller={{this.controller}}/>
641
699
  ```
@@ -644,6 +702,11 @@ Buttons to remove and move it when selected can be shown with
644
702
  ```hbs
645
703
  <TemplateCommentsPlugin::EditCard @controller={{this.controller}}/>
646
704
  ```
705
+
706
+ Template comments have a specific style that can be imported in the stylesheet with
707
+ ```css
708
+ @import 'template-comments-plugin';
709
+ ```
647
710
  ## Contributing
648
711
 
649
712
  See the [Contributing](CONTRIBUTING.md) guide for details.
@@ -2,16 +2,22 @@
2
2
  <AuCard @flex={{true}} @divided={{true}} @expandable={{true}} @shadow={{true}} @isOpenInitially={{true}} @size="small" as |c|>
3
3
  <c.header>
4
4
  <AuHeading @level="3" @skin="6">
5
- Document importeren
5
+ {{t "editor-plugins.import-snippet.card.title"}}
6
6
  </AuHeading>
7
7
  </c.header>
8
8
  <c.content>
9
- <p class="u-spacer--tiny">Er is een <a href="{{snippet.source}}" target="_blank" rel="noopener noreferrer">document</a> beschikbaar</p>
10
- <p><strong>Wenst u dit document in te voegen?</strong></p>
9
+ <p class="u-spacer--tiny">
10
+ {{t "editor-plugins.import-snippet.card.body.document-available" htmlSafe=true source=snippet.source}}
11
+ </p>
12
+ <p><strong>{{t "editor-plugins.import-snippet.card.body.confirmation"}}</strong></p>
11
13
  {{#if this.besluitNode}}
12
- <AuButton {{on "click" (fn this.insert snippet 'attachment')}} >Bijlage invoegen</AuButton>
14
+ <AuButton {{on "click" (fn this.insert snippet 'attachment')}}>
15
+ {{t "editor-plugins.import-snippet.card.body.insert-attachment"}}
16
+ </AuButton>
13
17
  {{/if}}
14
- <AuButton {{on "click" (fn this.insert snippet)}} >Document invoegen</AuButton>
18
+ <AuButton {{on "click" (fn this.insert snippet)}}>
19
+ {{t "editor-plugins.import-snippet.card.body.insert-document"}}
20
+ </AuButton>
15
21
  </c.content>
16
22
  </AuCard>
17
23
  {{/each}}
@@ -19,31 +19,37 @@
19
19
  <:body>
20
20
  <tr>
21
21
  <td>{{t 'date-plugin.help.short-weekday-title'}}</td>
22
+ {{!-- template-lint-disable no-bare-strings --}}
22
23
  <td>E</td>
23
24
  <td>{{this.formatExample 'E'}}</td>
24
25
  </tr>
25
26
  <tr>
26
27
  <td>{{t 'date-plugin.help.long-weekday-title'}}</td>
28
+ {{!-- template-lint-disable no-bare-strings --}}
27
29
  <td>EEEE</td>
28
30
  <td>{{this.formatExample 'EEEE'}}</td>
29
31
  </tr>
30
32
  <tr>
31
33
  <td>{{t 'date-plugin.help.month-day'}}</td>
34
+ {{!-- template-lint-disable no-bare-strings --}}
32
35
  <td>dd</td>
33
36
  <td>{{this.formatExample 'dd'}}</td>
34
37
  </tr>
35
38
  <tr>
36
39
  <td>{{t 'date-plugin.help.short-month'}}</td>
40
+ {{!-- template-lint-disable no-bare-strings --}}
37
41
  <td>MM</td>
38
42
  <td>{{this.formatExample 'MM'}}</td>
39
43
  </tr>
40
44
  <tr>
41
45
  <td>{{t 'date-plugin.help.long-month-title'}}</td>
46
+ {{!-- template-lint-disable no-bare-strings --}}
42
47
  <td>MMMM</td>
43
48
  <td>{{this.formatExample 'MMMM'}}</td>
44
49
  </tr>
45
50
  <tr>
46
51
  <td>{{t 'date-plugin.help.long-year'}}</td>
52
+ {{!-- template-lint-disable no-bare-strings --}}
47
53
  <td>yyyy</td>
48
54
  <td>{{this.formatExample 'yyyy'}}</td>
49
55
  </tr>
@@ -61,26 +67,32 @@
61
67
  </:header>
62
68
  <:body>
63
69
  <tr>
70
+ {{!-- template-lint-disable no-bare-strings --}}
64
71
  <td>EEEE dd MMMM yyyy</td>
65
72
  <td>{{this.formatExample 'EEEE dd MMMM yyyy'}}</td>
66
73
  </tr>
67
74
  <tr>
75
+ {{!-- template-lint-disable no-bare-strings --}}
68
76
  <td>dd/MM/yy</td>
69
77
  <td>{{this.formatExample 'dd/MM/yy'}}</td>
70
78
  </tr>
71
79
  <tr>
80
+ {{!-- template-lint-disable no-bare-strings --}}
72
81
  <td>dd/M/yyyy</td>
73
82
  <td>{{this.formatExample 'dd/M/yyyy'}}</td>
74
83
  </tr>
75
84
  <tr>
85
+ {{!-- template-lint-disable no-bare-strings --}}
76
86
  <td>dd/MM/yy hh:mm:ss</td>
77
87
  <td>{{this.formatExample 'dd/MM/yy hh:mm:ss'}}</td>
78
88
  </tr>
79
89
  <tr>
90
+ {{!-- template-lint-disable no-bare-strings --}}
80
91
  <td>'Vandaag is' dd/MM/yy BBBB</td>
81
92
  <td>{{this.formatExample "'Vandaag is' dd/MM/yy BBBB"}}</td>
82
93
  </tr>
83
94
  <tr>
95
+ {{!-- template-lint-disable no-bare-strings --}}
84
96
  <td>PPPPpppp</td>
85
97
  <td>{{this.formatExample 'PPPPpppp'}}</td>
86
98
  </tr>