@lblod/ember-rdfa-editor-lblod-plugins 9.1.0 → 10.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.
- package/CHANGELOG.md +50 -1
- package/README.md +159 -131
- package/addon/components/citation-plugin/helpers/alert-load-error.hbs +2 -2
- package/addon/components/import-snippet-plugin/card.hbs +11 -5
- package/addon/components/rdfa-date-plugin/help-modal.hbs +12 -0
- package/addon/components/roadsign-regulation-plugin/expanded-measure.hbs +40 -10
- package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +1 -0
- package/addon/components/roadsign-regulation-plugin/measure-template.ts +6 -12
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +1 -1
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.hbs +5 -5
- package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.hbs +4 -4
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.hbs +25 -9
- package/addon/components/snippet-plugin/helpers/alert-load-error.hbs +2 -2
- package/addon/components/snippet-plugin/snippet-insert.ts +13 -11
- package/addon/components/template-comments-plugin/edit-card.hbs +7 -9
- package/addon/components/template-comments-plugin/template-comment.hbs +2 -2
- package/addon/components/template-comments-plugin/template-comment.ts +0 -36
- package/addon/components/variable-plugin/{template-variable-card.hbs → codelist/edit.hbs} +14 -12
- package/addon/components/variable-plugin/codelist/edit.ts +94 -0
- package/addon/components/variable-plugin/codelist/insert.hbs +22 -0
- package/addon/components/variable-plugin/codelist/insert.ts +84 -0
- package/addon/components/variable-plugin/date/insert.hbs +9 -0
- package/addon/components/variable-plugin/date/insert.ts +45 -0
- package/addon/components/variable-plugin/insert-variable-card.hbs +7 -40
- package/addon/components/variable-plugin/insert-variable-card.ts +18 -166
- package/addon/components/variable-plugin/location/edit.hbs +40 -0
- package/addon/components/variable-plugin/location/edit.ts +122 -0
- package/addon/components/variable-plugin/location/insert.hbs +9 -0
- package/addon/components/variable-plugin/location/insert.ts +65 -0
- package/addon/components/variable-plugin/{number-settings.hbs → number/insert.hbs} +14 -5
- package/addon/components/variable-plugin/number/insert.ts +78 -0
- package/addon/components/{variable-number/number.ts → variable-plugin/number/nodeview.ts} +3 -7
- package/addon/components/variable-plugin/text/insert.hbs +9 -0
- package/addon/components/variable-plugin/text/insert.ts +49 -0
- package/addon/components/variable-plugin/utils/label-input.hbs +11 -0
- package/addon/components/variable-plugin/{variable.ts → variable/nodeview.ts} +1 -1
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +1 -1
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +48 -51
- package/addon/plugins/snippet-plugin/utils/fetch-data.ts +10 -2
- package/addon/plugins/template-comments-plugin/index.ts +1 -5
- package/addon/plugins/template-comments-plugin/node.ts +3 -16
- package/addon/plugins/variable-plugin/utils/attribute-parsers.ts +31 -0
- package/addon/plugins/variable-plugin/utils/codelist-utils.ts +56 -0
- package/addon/plugins/variable-plugin/utils/constants.ts +0 -120
- package/addon/plugins/variable-plugin/utils/dom-constructors.ts +66 -0
- package/addon/plugins/variable-plugin/utils/fetch-data.ts +2 -2
- package/addon/plugins/variable-plugin/variables/codelist.ts +120 -0
- package/addon/plugins/variable-plugin/variables/index.ts +4 -0
- package/addon/plugins/variable-plugin/variables/location.ts +98 -0
- package/addon/plugins/variable-plugin/variables/number.ts +145 -0
- package/addon/plugins/variable-plugin/variables/text.ts +90 -0
- package/addon/utils/dom-output-spec-helpers.ts +8 -0
- package/app/components/variable-plugin/{number-settings.js → codelist/edit.js} +1 -1
- package/app/components/variable-plugin/{variable-edit-modal.js → codelist/insert.js} +1 -1
- package/app/components/{variable-number/number.js → variable-plugin/date/insert.js} +1 -1
- package/app/components/variable-plugin/location/edit.js +1 -0
- package/app/components/variable-plugin/location/insert.js +1 -0
- package/app/components/variable-plugin/number/insert.js +1 -0
- package/app/components/variable-plugin/number/nodeview.js +1 -0
- package/app/components/variable-plugin/{variable.js → text/insert.js} +1 -1
- package/app/components/variable-plugin/utils/label-input.js +1 -0
- package/app/components/variable-plugin/variable/nodeview.js +1 -0
- package/app/styles/snippet-plugin.scss +7 -1
- package/components/roadsign-regulation-plugin/expanded-measure.d.ts +1 -0
- package/components/roadsign-regulation-plugin/measure-template.d.ts +2 -4
- package/components/snippet-plugin/snippet-insert.d.ts +2 -1
- package/components/template-comments-plugin/template-comment.d.ts +0 -8
- package/components/variable-plugin/codelist/edit.d.ts +27 -0
- package/components/variable-plugin/codelist/insert.d.ts +26 -0
- package/components/variable-plugin/date/insert.d.ts +13 -0
- package/components/variable-plugin/insert-variable-card.d.ts +10 -34
- package/components/variable-plugin/location/edit.d.ts +31 -0
- package/components/variable-plugin/location/insert.d.ts +20 -0
- package/components/variable-plugin/number/insert.d.ts +18 -0
- package/components/{variable-number/number.d.ts → variable-plugin/number/nodeview.d.ts} +1 -1
- package/components/variable-plugin/text/insert.d.ts +13 -0
- package/components/variable-plugin/{variable.d.ts → variable/nodeview.d.ts} +1 -1
- package/package.json +2 -2
- package/plugins/template-comments-plugin/index.d.ts +1 -1
- package/plugins/template-comments-plugin/node.d.ts +0 -4
- package/plugins/variable-plugin/utils/attribute-parsers.d.ts +5 -0
- package/plugins/variable-plugin/utils/codelist-utils.d.ts +6 -0
- package/plugins/variable-plugin/utils/constants.d.ts +0 -19
- package/plugins/variable-plugin/utils/dom-constructors.d.ts +24 -0
- package/plugins/variable-plugin/utils/fetch-data.d.ts +1 -1
- package/plugins/variable-plugin/variables/codelist.d.ts +2 -0
- package/plugins/variable-plugin/variables/index.d.ts +4 -0
- package/plugins/variable-plugin/variables/location.d.ts +2 -0
- package/plugins/variable-plugin/variables/text.d.ts +4 -0
- package/translations/en-US.yaml +46 -0
- package/translations/nl-BE.yaml +46 -0
- package/types/global.d.ts +3 -0
- package/utils/dom-output-spec-helpers.d.ts +2 -0
- package/addon/components/variable-plugin/template-variable-card.ts +0 -163
- package/addon/plugins/variable-plugin/index.ts +0 -5
- package/addon/plugins/variable-plugin/nodes.ts +0 -264
- package/addon/plugins/variable-plugin/number.ts +0 -50
- package/app/components/variable-plugin/template-variable-card.js +0 -1
- package/components/variable-plugin/template-variable-card.d.ts +0 -29
- package/plugins/variable-plugin/index.d.ts +0 -5
- package/plugins/variable-plugin/nodes.d.ts +0 -37
- /package/addon/components/{variable-number/number.hbs → variable-plugin/number/nodeview.hbs} +0 -0
- /package/addon/components/variable-plugin/{variable.hbs → variable/nodeview.hbs} +0 -0
- /package/plugins/variable-plugin/{number.d.ts → variables/number.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [10.0.0] - 2023-08-08
|
|
11
|
+
### Changed
|
|
12
|
+
- remove unused code from template comment component
|
|
13
|
+
- remove allowedTypes from indentation menu
|
|
14
|
+
- allow normal type of paragraphs (=can have italic mark) in template comments
|
|
15
|
+
### Dependencies
|
|
16
|
+
- Bumps `@embroider/test-setup` from 1.8.3 to 3.0.1
|
|
17
|
+
- Bumps `@types/ember__application` from 4.0.4 to 4.0.6
|
|
18
|
+
- Bumps `webpack` from 5.76.0 to 5.88.2
|
|
19
|
+
- Bumps `@types/ember__component` from 4.0.11 to 4.0.14
|
|
20
|
+
### Fixed
|
|
21
|
+
- Allow `block*` content in `article_paragraph`
|
|
22
|
+
- Move buttons for template comments are blue
|
|
23
|
+
- problems with lists in template comments
|
|
24
|
+
- GN-4451: fix roadsign plugin no longer showing rendered templates in modal (merge hotfix v8.4.3)
|
|
25
|
+
- Snippet insertion inserts first node correctly
|
|
26
|
+
- Enable no-bare-strings rule and update translations where needed
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- Addition of `variable` group to each variable node-spec.
|
|
30
|
+
|
|
31
|
+
### Breaking
|
|
32
|
+
#### Major rework of variable plugin
|
|
33
|
+
- 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.
|
|
34
|
+
- 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.
|
|
35
|
+
- Removal of the `template-variable-card` component. This component has been replaced by two edit components for both the `location` and `codelist` variables.
|
|
36
|
+
- Removal of `DEFAULT_VARIABLE_TYPES`. The insertion of the variable types are now handled by the insert components of the different variable types.
|
|
37
|
+
|
|
38
|
+
## [9.1.1] - 2023-08-02
|
|
39
|
+
### Fixed
|
|
40
|
+
- GN-4446: fix email-address formatting in error components
|
|
41
|
+
### Dependencies
|
|
42
|
+
- Bumps `@types/uuid` from 9.0.0 to 9.0.2
|
|
43
|
+
- Bumps `@types/rdf-validate-shacl` from 0.4.0 to 0.4.2
|
|
44
|
+
- Bumps `@types/ember__polyfills` from 4.0.1 to 4.0.2
|
|
45
|
+
|
|
46
|
+
## [8.4.3] - 2023-08-07
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
- GN-4451: fix roadsign plugin no longer showing rendered templates in modal
|
|
50
|
+
|
|
51
|
+
## [8.4.2] - 2023-08-02
|
|
52
|
+
### Fixed
|
|
53
|
+
- GN-4446: fix email-address formatting in error components
|
|
54
|
+
|
|
10
55
|
## [9.1.0] - 2023-07-29
|
|
11
56
|
|
|
12
57
|
### Added
|
|
@@ -607,7 +652,7 @@ add onclick handler to pencil icon in variable plugin
|
|
|
607
652
|
|
|
608
653
|
# Changelog
|
|
609
654
|
|
|
610
|
-
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/
|
|
655
|
+
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v10.0.0...HEAD
|
|
611
656
|
[8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.0.0...v8.0.1
|
|
612
657
|
[8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.1.0...v8.0.0
|
|
613
658
|
[7.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.0.0...v7.1.0
|
|
@@ -623,10 +668,14 @@ add onclick handler to pencil icon in variable plugin
|
|
|
623
668
|
[3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
|
|
624
669
|
[2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
|
|
625
670
|
[2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
|
|
671
|
+
[10.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.1...v10.0.0
|
|
672
|
+
[9.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.0...v9.1.1
|
|
626
673
|
[9.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.2...v9.1.0
|
|
627
674
|
[9.0.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.1...v9.0.2
|
|
628
675
|
[9.0.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.0...v9.0.1
|
|
629
676
|
[9.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.1...v9.0.0
|
|
677
|
+
[8.4.3]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.2...v8.4.3
|
|
678
|
+
[8.4.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.1...v8.4.2
|
|
630
679
|
[8.4.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.0...v8.4.1
|
|
631
680
|
[8.4.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.3.0...v8.4.0
|
|
632
681
|
[8.3.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.2.2...v8.3.0
|
package/README.md
CHANGED
|
@@ -24,12 +24,11 @@ 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
|
-
* [
|
|
31
|
+
* [variable-plugin](#variable-plugin)
|
|
33
32
|
* [validation-plugin](#validation-plugin)
|
|
34
33
|
* [address-plugin](#address-plugin)
|
|
35
34
|
* [template-comments-plugin](#template-comments-plugin)
|
|
@@ -360,113 +359,6 @@ application (https://github.com/lblod/frontend-gelinkt-notuleren).
|
|
|
360
359
|
When opening a new document, users will get the option to either include the snippet data in the document or as an
|
|
361
360
|
attachment.
|
|
362
361
|
|
|
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
362
|
## rdfa-date-plugin
|
|
471
363
|
|
|
472
364
|
Plugin to insert and modify semantic dates and timestamps in an editor document.
|
|
@@ -574,41 +466,174 @@ For very custom setups, the plugin might be unable to find your scrollContainer
|
|
|
574
466
|
},
|
|
575
467
|
```
|
|
576
468
|
|
|
469
|
+
## variable-plugin
|
|
577
470
|
|
|
578
|
-
|
|
471
|
+
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:
|
|
472
|
+
- text variable
|
|
473
|
+
- number variable
|
|
474
|
+
- date variable
|
|
475
|
+
- codelist
|
|
476
|
+
- location
|
|
579
477
|
|
|
580
|
-
|
|
478
|
+
Additional variable types can be added in the consuming application or addon.
|
|
581
479
|
|
|
582
|
-
For
|
|
480
|
+
For each of these variable types, a node-spec and node-view are defined. You can import them like this:
|
|
481
|
+
```js
|
|
482
|
+
import {
|
|
483
|
+
codelist,
|
|
484
|
+
codelistView,
|
|
485
|
+
location,
|
|
486
|
+
locationView,
|
|
487
|
+
number,
|
|
488
|
+
numberView,
|
|
489
|
+
text_variable,
|
|
490
|
+
textVariableView,
|
|
491
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
The date-variable node-spec and node-view are defined in the `rdfa-date-plugin`.
|
|
495
|
+
|
|
496
|
+
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.
|
|
497
|
+
|
|
498
|
+
### Inserting variables into a document
|
|
499
|
+
|
|
500
|
+
This addon includes an insert-component for each of these variable types:
|
|
501
|
+
- `variable-plugin/text/insert`
|
|
502
|
+
- `variable-plugin/number/insert`
|
|
503
|
+
- `variable-plugin/date/insert`
|
|
504
|
+
- `variable-plugin/location/insert`
|
|
505
|
+
- `variable-plugin/codelist/insert`
|
|
506
|
+
|
|
507
|
+
Each of these components presents a custom UI which allows a user to insert a variable of the corresponding type in a document.
|
|
508
|
+
|
|
509
|
+
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:
|
|
510
|
+
- It allows a user to select a variable type.
|
|
511
|
+
- The correct insert component corresponding to the user-selected variable type is shown.
|
|
512
|
+
|
|
513
|
+
The `variable-plugin/insert-variable-card` can be easily configured: it expects two arguments:
|
|
514
|
+
- `controller`: An instance of the `SayController` class
|
|
515
|
+
- `variableTypes`: A list of `VariableConfig` objects. With each `VariableConfig` containing:
|
|
516
|
+
- the `label` which should be displayed in the variable-select dropdown
|
|
517
|
+
- the `path` to the insert-variable component
|
|
518
|
+
- _optionally_ an `options` argument object which should be passed to the insert-variable component.
|
|
519
|
+
* The `VariableConfig` type is defined as follows:
|
|
520
|
+
```js
|
|
521
|
+
type VariableConfig = {
|
|
522
|
+
label: string;
|
|
523
|
+
component: {
|
|
524
|
+
path: string;
|
|
525
|
+
options?: unknown;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### An example
|
|
531
|
+
To allows users to insert variables into a document, add the following to the editor sidebar in your template:
|
|
583
532
|
```hbs
|
|
584
|
-
|
|
533
|
+
<VariablePlugin::InsertVariableCard
|
|
534
|
+
@controller={{this.controller}}
|
|
535
|
+
@variableTypes={{this.variableTypes}}
|
|
536
|
+
/>
|
|
585
537
|
```
|
|
586
|
-
|
|
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:
|
|
538
|
+
`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:
|
|
588
539
|
|
|
589
540
|
```js
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
541
|
+
get variableTypes() {
|
|
542
|
+
return [
|
|
543
|
+
{
|
|
544
|
+
label: 'text',
|
|
545
|
+
component: {
|
|
546
|
+
path: 'variable-plugin/text/insert',
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
label: 'number',
|
|
551
|
+
component: {
|
|
552
|
+
path: 'variable-plugin/number/insert',
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
label: 'date',
|
|
557
|
+
component: {
|
|
558
|
+
path: 'variable-plugin/date/insert',
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
label: 'location',
|
|
563
|
+
component: {
|
|
564
|
+
path: 'variable-plugin/location/insert',
|
|
565
|
+
options: {
|
|
566
|
+
endpoint: 'https://dev.roadsigns.lblod.info/sparql',
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
label: 'codelist',
|
|
572
|
+
component: {
|
|
573
|
+
path: 'variable-plugin/codelist/insert',
|
|
574
|
+
options: {
|
|
575
|
+
endpoint: 'https://dev.roadsigns.lblod.info/sparql',
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
];
|
|
580
|
+
}
|
|
595
581
|
```
|
|
596
582
|
|
|
597
|
-
|
|
583
|
+
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.
|
|
584
|
+
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.
|
|
598
585
|
|
|
586
|
+
### Editing variables in a document
|
|
587
|
+
Each of the variables provided by this addon have a different editing experiences and use different components:
|
|
599
588
|
|
|
600
|
-
|
|
589
|
+
#### The text variable
|
|
590
|
+
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.
|
|
601
591
|
|
|
592
|
+
#### The number variable
|
|
593
|
+
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.
|
|
594
|
+
|
|
595
|
+
#### The date variable
|
|
596
|
+
The edit component for the date variable can be found in the [rdfa-date-plugin section](#rdfa-date-plugin)
|
|
597
|
+
|
|
598
|
+
#### The location variable
|
|
599
|
+
This addon provides a seperate edit component which allows users to fill in location variables in a document.
|
|
600
|
+
This component can be added to the sidebar of an editor instance in a template as follows:
|
|
601
|
+
```hbs
|
|
602
|
+
<VariablePlugin::Location::Edit
|
|
603
|
+
@controller={{this.controller}}
|
|
604
|
+
@options={{this.locationEditOptions}}
|
|
605
|
+
/>
|
|
606
|
+
```
|
|
607
|
+
Where `this.locationEditOptions` is a `LocationEditOptions` object used to configure the edit component. It can be defined as e.g.:
|
|
602
608
|
```js
|
|
603
|
-
{
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
+
get locationEditOptions() {
|
|
610
|
+
return {
|
|
611
|
+
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
|
|
612
|
+
zonalLocationCodelistUri:
|
|
613
|
+
'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
|
|
614
|
+
nonZonalLocationCodelistUri:
|
|
615
|
+
'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
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
#### The codelist variable
|
|
621
|
+
This addon provides a seperate edit component which allows users to fill in codelist variables in a document.
|
|
622
|
+
This component can be added to the sidebar of an editor instance in a template as follows:
|
|
623
|
+
```hbs
|
|
624
|
+
<VariablePlugin::Codelist::Edit
|
|
625
|
+
@controller={{this.controller}}
|
|
626
|
+
@options={{this.codelistEditOptions}}
|
|
627
|
+
/>
|
|
628
|
+
```
|
|
629
|
+
Where `this.codelistEditOptions` is a `CodelistEditOptions` object used to configure the edit component. It can be defined as e.g.:
|
|
630
|
+
```js
|
|
631
|
+
get codelistEditOptions() {
|
|
632
|
+
return {
|
|
633
|
+
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
|
|
634
|
+
};
|
|
609
635
|
}
|
|
610
636
|
```
|
|
611
|
-
The most important attributes are `zonalLocationCodelistUri` and `nonZonalLocationCodelistUri` that are the uri that the location codelists have on your backend.
|
|
612
637
|
|
|
613
638
|
## validation-plugin
|
|
614
639
|
|
|
@@ -631,9 +656,9 @@ For enabling it, you need to add the card provided by the plugin to the editor s
|
|
|
631
656
|
A plugin to insert a template comment anywhere in the document.
|
|
632
657
|
This is meant as a block of text for extra information to provide to a created template. It has
|
|
633
658
|
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
|
|
659
|
+
It supports basic text with indenting, list items and the marks.
|
|
635
660
|
|
|
636
|
-
Add it to editor by adding
|
|
661
|
+
Add it to editor by adding `templateComment` to your schema and `templateComment: templateCommentView(controller)` as a nodeview.
|
|
637
662
|
|
|
638
663
|
Logic to insert a template comment is added with
|
|
639
664
|
```hbs
|
|
@@ -648,6 +673,9 @@ Buttons to remove and move it when selected can be shown with
|
|
|
648
673
|
|
|
649
674
|
See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
650
675
|
|
|
676
|
+
## Releasing
|
|
677
|
+
See the [Release](RELEASE.md) guide.
|
|
678
|
+
|
|
651
679
|
## License
|
|
652
680
|
|
|
653
681
|
This project is licensed under the [MIT License](LICENSE.md).
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<p>
|
|
11
11
|
{{t "citaten-plugin.alert.error-outro"}}
|
|
12
12
|
<AuLinkExternal
|
|
13
|
-
href="mailto:
|
|
13
|
+
href="mailto:gelinktnotuleren@vlaanderen.be"
|
|
14
14
|
@icon="mail"
|
|
15
15
|
@iconAlignment="left">
|
|
16
16
|
{{!-- template-lint-disable no-bare-strings --}}
|
|
17
|
-
|
|
17
|
+
gelinktnotuleren@vlaanderen.be
|
|
18
18
|
</AuLinkExternal>.
|
|
19
19
|
</p>
|
|
20
20
|
</AuAlert>
|
|
@@ -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
|
-
|
|
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">
|
|
10
|
-
|
|
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')}}
|
|
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)}}
|
|
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>
|
|
@@ -1,43 +1,73 @@
|
|
|
1
1
|
<tr class="au-c-data-table__detail">
|
|
2
2
|
<td colspan="5" class="au-o-flow au-o-flow--small">
|
|
3
|
-
<AuHeading @level="6" @skin="6">
|
|
3
|
+
<AuHeading @level="6" @skin="6">
|
|
4
|
+
{{t "editor-plugins.roadsign-regulation.expanded-measure.insert-measure"}}
|
|
5
|
+
</AuHeading>
|
|
4
6
|
<p>
|
|
5
7
|
<AuPill>
|
|
6
|
-
<RoadsignRegulationPlugin::MeasureTemplate
|
|
8
|
+
<RoadsignRegulationPlugin::MeasureTemplate
|
|
9
|
+
@measure={{@measure.uri}}
|
|
10
|
+
@template={{@measure.template}}
|
|
11
|
+
@endpoint={{@endpoint}}
|
|
12
|
+
/>
|
|
7
13
|
</AuPill>
|
|
8
14
|
</p>
|
|
9
15
|
{{#if this.isPotentiallyZonal}}
|
|
10
|
-
<AuHeading @level="6" @skin="6">
|
|
16
|
+
<AuHeading @level="6" @skin="6">
|
|
17
|
+
{{t "editor-plugins.roadsign-regulation.expanded-measure.select-zonality.label"}}
|
|
18
|
+
</AuHeading>
|
|
11
19
|
<div class="au-c-form">
|
|
12
20
|
<ul>
|
|
13
21
|
<li>
|
|
14
|
-
<AuControlRadio
|
|
22
|
+
<AuControlRadio
|
|
23
|
+
@label={{t "editor-plugins.roadsign-regulation.expanded-measure.select-zonality.zonal"}}
|
|
24
|
+
@name="zonal"
|
|
25
|
+
@value={{this.ZONAL_URI}}
|
|
26
|
+
@identifier="zonal"
|
|
27
|
+
{{on 'change' this.changeZonality}}/>
|
|
15
28
|
</li>
|
|
16
29
|
<li>
|
|
17
|
-
<AuControlRadio
|
|
30
|
+
<AuControlRadio
|
|
31
|
+
@label={{t "editor-plugins.roadsign-regulation.expanded-measure.select-zonality.non-zonal"}}
|
|
32
|
+
@name="zonal"
|
|
33
|
+
@value={{this.NON_ZONAL_URI}}
|
|
34
|
+
@identifier="non-zonal"
|
|
35
|
+
{{on 'change' this.changeZonality}} />
|
|
18
36
|
</li>
|
|
19
37
|
</ul>
|
|
20
38
|
</div>
|
|
21
39
|
{{/if}}
|
|
22
40
|
{{#if @measure.temporal}}
|
|
23
|
-
<AuHeading @level="6" @skin="6">
|
|
41
|
+
<AuHeading @level="6" @skin="6">
|
|
42
|
+
{{t "editor-plugins.roadsign-regulation.expanded-measure.varying-signalisation.label"}}
|
|
43
|
+
</AuHeading>
|
|
24
44
|
<div class="au-c-form">
|
|
25
45
|
<ul>
|
|
26
46
|
<li>
|
|
27
|
-
<AuControlRadio
|
|
47
|
+
<AuControlRadio
|
|
48
|
+
@label={{t "editor-plugins.roadsign-regulation.expanded-measure.varying-signalisation.varying"}}
|
|
49
|
+
@name="temporal"
|
|
50
|
+
@value={{true}}
|
|
51
|
+
@identifier="true"
|
|
52
|
+
{{on 'change' this.changeTemporality}} />
|
|
28
53
|
</li>
|
|
29
54
|
<li>
|
|
30
|
-
<AuControlRadio
|
|
55
|
+
<AuControlRadio
|
|
56
|
+
@label={{t "editor-plugins.roadsign-regulation.expanded-measure.varying-signalisation.non-varying"}}
|
|
57
|
+
@name="temporal"
|
|
58
|
+
@value={{false}}
|
|
59
|
+
@identifier="false"
|
|
60
|
+
{{on 'change' this.changeTemporality}} />
|
|
31
61
|
</li>
|
|
32
62
|
</ul>
|
|
33
63
|
</div>
|
|
34
64
|
{{/if}}
|
|
35
65
|
<AuButtonGroup>
|
|
36
66
|
<AuButton {{on 'click' this.insert}} @disabled={{this.insertButtonDisabled}}>
|
|
37
|
-
|
|
67
|
+
{{t "editor-plugins.utils.insert"}}
|
|
38
68
|
</AuButton>
|
|
39
69
|
<AuButton @skin="secondary" {{on "click" this.unselectRow }}>
|
|
40
|
-
|
|
70
|
+
{{t "editor-plugins.utils.cancel"}}
|
|
41
71
|
</AuButton>
|
|
42
72
|
</AuButtonGroup>
|
|
43
73
|
</td>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { task } from 'ember-concurrency';
|
|
4
|
-
import { tracked } from '@glimmer/tracking';
|
|
5
3
|
import includeInstructions from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/includeInstructions';
|
|
6
4
|
import RoadsignRegistryService from '@lblod/ember-rdfa-editor-lblod-plugins/services/roadsign-registry';
|
|
5
|
+
import { trackedFunction } from 'ember-resources/util/function';
|
|
7
6
|
|
|
8
7
|
type Args = {
|
|
9
8
|
template: string;
|
|
@@ -13,27 +12,22 @@ type Args = {
|
|
|
13
12
|
};
|
|
14
13
|
export default class MeasureTemplateComponent extends Component<Args> {
|
|
15
14
|
@service declare roadsignRegistry: RoadsignRegistryService;
|
|
16
|
-
@tracked template = '';
|
|
17
|
-
endpoint: string;
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.template = this.args.template;
|
|
22
|
-
void this.fetchData.perform();
|
|
23
|
-
this.endpoint = this.args.endpoint;
|
|
16
|
+
get template() {
|
|
17
|
+
return this.instructionData.value ?? '';
|
|
24
18
|
}
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
instructionData = trackedFunction(this, async () => {
|
|
27
21
|
const instructions =
|
|
28
22
|
await this.roadsignRegistry.getInstructionsForMeasure.perform(
|
|
29
23
|
this.args.measure,
|
|
30
|
-
this.endpoint,
|
|
24
|
+
this.args.endpoint,
|
|
31
25
|
);
|
|
32
26
|
const template = includeInstructions(
|
|
33
27
|
this.args.template,
|
|
34
28
|
instructions,
|
|
35
29
|
this.args.annotated,
|
|
36
30
|
);
|
|
37
|
-
|
|
31
|
+
return template;
|
|
38
32
|
});
|
|
39
33
|
}
|