@lblod/ember-rdfa-editor-lblod-plugins 2.1.2 → 4.0.1
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/.woodpecker/.release.yml +1 -1
- package/.woodpecker/.test-scenarios.yml +17 -0
- package/.woodpecker/.test.yml +5 -5
- package/CHANGELOG.md +61 -1
- package/README.md +184 -141
- package/addon/components/article-structure-plugin/article-structure-card.hbs +1 -3
- package/addon/components/article-structure-plugin/article-structure-card.ts +14 -8
- package/addon/components/article-structure-plugin/structure-card.hbs +9 -4
- package/addon/components/article-structure-plugin/structure-card.ts +19 -15
- package/addon/components/besluit-plugin/besluit-plugin-card.ts +8 -4
- package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -2
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +12 -10
- package/addon/components/citation-plugin/citation-card.hbs +4 -0
- package/addon/components/citation-plugin/citation-card.ts +42 -33
- package/addon/components/citation-plugin/citation-insert.ts +32 -37
- package/addon/components/import-snippet-plugin/card.ts +9 -6
- package/addon/components/rdfa-date-plugin/card.ts +16 -20
- package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
- package/addon/components/rdfa-date-plugin/insert.ts +12 -20
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +3 -3
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +5 -4
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +1 -1
- package/addon/components/standard-template-plugin/card.ts +2 -2
- package/addon/components/standard-template-plugin/template-provider.ts +6 -5
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -1
- package/addon/components/table-of-contents-plugin/toolbar-button.ts +45 -8
- package/addon/components/variable-plugin/insert-variable-card.hbs +23 -9
- package/addon/components/variable-plugin/insert-variable-card.ts +19 -14
- package/addon/components/variable-plugin/template-variable-card.hbs +1 -1
- package/addon/components/variable-plugin/template-variable-card.ts +10 -7
- package/addon/components/variable-plugin/variable.hbs +8 -3
- package/addon/models/instruction.ts +1 -1
- package/addon/models/measure.ts +1 -1
- package/addon/models/sign.ts +1 -1
- package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +1 -1
- package/addon/plugins/article-structure-plugin/index.ts +2 -32
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +17 -8
- package/addon/plugins/article-structure-plugin/structures/article.ts +7 -3
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +7 -2
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/title.ts +1 -1
- package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +3 -6
- package/addon/plugins/citation-plugin/index.ts +17 -55
- package/addon/plugins/citation-plugin/utils/cited-text.ts +5 -4
- package/addon/plugins/rdfa-date-plugin/index.ts +5 -28
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +1 -6
- package/addon/plugins/standard-template-plugin/index.ts +0 -6
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +1 -1
- package/addon/plugins/table-of-contents-plugin/index.ts +0 -7
- package/addon/plugins/variable-plugin/utils/constants.ts +1 -0
- package/addon/services/roadsign-registry.ts +1 -1
- package/app/styles/article-structure-plugin.scss +7 -0
- package/app/styles/besluit-plugin.scss +4 -0
- package/app/styles/variable-plugin.scss +1 -1
- package/components/article-structure-plugin/article-structure-card.d.ts +4 -5
- package/components/article-structure-plugin/structure-card.d.ts +4 -6
- package/components/besluit-plugin/besluit-plugin-card.d.ts +3 -3
- package/components/besluit-type-plugin/toolbar-dropdown.d.ts +3 -3
- package/components/citation-plugin/citation-card.d.ts +7 -8
- package/components/citation-plugin/citation-insert.d.ts +5 -10
- package/components/import-snippet-plugin/card.d.ts +3 -3
- package/components/rdfa-date-plugin/card.d.ts +6 -11
- package/components/rdfa-date-plugin/insert.d.ts +6 -12
- package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +3 -3
- package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -2
- package/components/standard-template-plugin/card.d.ts +3 -3
- package/components/standard-template-plugin/template-provider.d.ts +3 -3
- package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
- package/components/table-of-contents-plugin/toolbar-button.d.ts +3 -3
- package/components/variable-plugin/insert-variable-card.d.ts +7 -8
- package/components/variable-plugin/template-variable-card.d.ts +3 -3
- package/package.json +26 -29
- package/plugins/article-structure-plugin/index.d.ts +2 -3
- package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +3 -3
- package/plugins/citation-plugin/index.d.ts +2 -12
- package/plugins/rdfa-date-plugin/index.d.ts +5 -5
- package/plugins/rdfa-date-plugin/nodes/date.d.ts +1 -6
- package/plugins/standard-template-plugin/index.d.ts +0 -2
- package/plugins/table-of-contents-plugin/index.d.ts +0 -2
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
- package/plugins/variable-plugin/nodes.d.ts +1 -1
- package/translations/en-US.yaml +63 -61
- package/translations/nl-BE.yaml +65 -59
- package/addon/components/variable-plugin/variable.ts +0 -262
- package/addon/plugins/besluit-plugin/index.ts +0 -6
- package/addon/plugins/besluit-type-plugin/index.ts +0 -6
- package/addon/plugins/citation-plugin/marks/citation.ts +0 -27
- package/addon/plugins/import-snippet-plugin.ts +0 -6
- package/addon/plugins/rdfa-date-plugin/nodes/index.ts +0 -1
- package/addon/plugins/roadsign-regulation-plugin/index.ts +0 -6
- package/addon/plugins/variable-plugin/index.ts +0 -16
- package/components/variable-plugin/variable.d.ts +0 -43
- package/plugins/besluit-plugin/index.d.ts +0 -2
- package/plugins/besluit-type-plugin/index.d.ts +0 -2
- package/plugins/citation-plugin/marks/citation.d.ts +0 -2
- package/plugins/import-snippet-plugin.d.ts +0 -2
- package/plugins/rdfa-date-plugin/nodes/index.d.ts +0 -1
- package/plugins/roadsign-regulation-plugin/index.d.ts +0 -2
- package/plugins/variable-plugin/index.d.ts +0 -3
package/.woodpecker/.release.yml
CHANGED
package/.woodpecker/.test.yml
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
pipeline:
|
|
3
3
|
install:
|
|
4
|
-
image: danlynn/ember-cli:4.
|
|
4
|
+
image: danlynn/ember-cli:4.8.0
|
|
5
5
|
commands:
|
|
6
6
|
- npm ci
|
|
7
7
|
lint-js:
|
|
8
|
-
image: danlynn/ember-cli:4.
|
|
8
|
+
image: danlynn/ember-cli:4.8.0
|
|
9
9
|
group: lint
|
|
10
10
|
commands:
|
|
11
11
|
- npm run lint:js
|
|
12
12
|
lint-hbs:
|
|
13
|
-
image: danlynn/ember-cli:4.
|
|
13
|
+
image: danlynn/ember-cli:4.8.0
|
|
14
14
|
group: lint
|
|
15
15
|
commands:
|
|
16
16
|
- npm run lint:hbs
|
|
17
17
|
test:
|
|
18
|
-
image: danlynn/ember-cli:4.
|
|
18
|
+
image: danlynn/ember-cli:4.8.0
|
|
19
19
|
commands:
|
|
20
|
-
- npm run test:ember
|
|
20
|
+
- npm run test:ember
|
|
21
21
|
when:
|
|
22
22
|
event:
|
|
23
23
|
- pull_request
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.0.1] - 2023-03-27
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
- bump `ember-rdfa-editor` to v3.4.1
|
|
14
|
+
|
|
15
|
+
## [4.0.0] - 2023-03-27
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Ensure citation suggestions are only updated when search-text or document-legislation-type updates.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Feature: make citation use the new link node
|
|
22
|
+
- BREAKING: citation mark has been removed
|
|
23
|
+
- Table of contents now is able to be inserted in the corresponding place instead of always being inserted at position 0
|
|
24
|
+
- Change paragraph symbol to §
|
|
25
|
+
- Update schema on dummy page to make articles insertable in empty document
|
|
26
|
+
- Add padding to structure card
|
|
27
|
+
- Placeholder text when inserting date
|
|
28
|
+
|
|
29
|
+
### Removed:
|
|
30
|
+
- Removal of prosemirror-plugin dependency of `CitationPlugin::CitationInsert` component.
|
|
31
|
+
|
|
32
|
+
## [3.1.0] - 2023-03-02
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Article paragraph numbering is no longer continuous
|
|
36
|
+
- Fixed white-space issue in variables
|
|
37
|
+
### Changed
|
|
38
|
+
- Use `AuModalContainer` component instead of #ember-appuniversum-wormhole element in dummy app
|
|
39
|
+
- Improved documentation of the plugins
|
|
40
|
+
|
|
41
|
+
### Dependencies
|
|
42
|
+
- bump `ember-rdfa-editor` to v3.3.0
|
|
43
|
+
- bump `ember-rdfa-editor` to v3.4.0
|
|
44
|
+
|
|
45
|
+
## [3.0.0] - 2023-02-27
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- Feature/allow paragraphs inside article paragraphs
|
|
49
|
+
- Set selectable on false for structure-headers
|
|
50
|
+
- BREAKING: the argument structure of plugin components has changed. `widgetArgs` is no longer in use, it's properties are now direct properties of the component `args`.
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- Added a new option to the structures to not support unwrap and made the article paragraphs the first structure to use this option
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- fix translation warnings
|
|
57
|
+
|
|
58
|
+
### Removed
|
|
59
|
+
- Remove insert date and time as it's no longer needed
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
- Bumps `ember-power-select` to 6.0.1
|
|
63
|
+
- Bumps `ember-source` to 4.8.4
|
|
64
|
+
- Bumps `@lblod/ember-rdfa-editor` to 3.2.0
|
|
65
|
+
|
|
10
66
|
## [2.1.2] - 2023-02-15
|
|
11
67
|
|
|
12
68
|
### Fixed
|
|
@@ -323,6 +379,10 @@ add onclick handler to pencil icon in variable plugin
|
|
|
323
379
|
|
|
324
380
|
# Changelog
|
|
325
381
|
|
|
326
|
-
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/
|
|
382
|
+
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v4.0.1...HEAD
|
|
383
|
+
[4.0.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v4.0.0...v4.0.1
|
|
384
|
+
[4.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v3.1.0...v4.0.0
|
|
385
|
+
[3.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v3.0.0...v3.1.0
|
|
386
|
+
[3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
|
|
327
387
|
[2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
|
|
328
388
|
[2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Ember v2 addon which bundles a collection of [ember-rdfa-editor](https://github.
|
|
|
9
9
|
|
|
10
10
|
* Ember.js v3.28 or above
|
|
11
11
|
* Embroider or ember-auto-import v2
|
|
12
|
+
* Node 18 or above
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
@@ -25,7 +26,6 @@ ember install ember-rdfa-editor-lblod-plugins
|
|
|
25
26
|
This addon contains the following editor plugins:
|
|
26
27
|
* besluit-type-plugin
|
|
27
28
|
* citaten-plugin
|
|
28
|
-
* generate-template-plugin
|
|
29
29
|
* import-snippet-plugin
|
|
30
30
|
* insert-variable-plugin
|
|
31
31
|
* rdfa-date-plugin
|
|
@@ -34,40 +34,75 @@ This addon contains the following editor plugins:
|
|
|
34
34
|
* table-of-contents-plugin
|
|
35
35
|
* template-variable-plugin
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
This is typically done in the following manner:
|
|
37
|
+
You can configure your editor like this:
|
|
39
38
|
```hbs
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
<EditorContainer
|
|
40
|
+
@editorOptions={{hash
|
|
41
|
+
showRdfa='true'
|
|
42
|
+
showRdfaHighlight='true'
|
|
43
|
+
showRdfaHover='true'
|
|
44
|
+
showPaper='true'
|
|
45
|
+
showToolbarBottom=null
|
|
46
|
+
}}
|
|
47
|
+
@showRdfaBlocks={{this.controller.showRdfaBlocks}}
|
|
48
|
+
>
|
|
49
|
+
<:top>
|
|
50
|
+
{...}
|
|
51
|
+
</:top>
|
|
52
|
+
<:default>
|
|
53
|
+
<Editor
|
|
46
54
|
@plugins={{this.plugins}}
|
|
47
|
-
|
|
55
|
+
@schema={{this.schema}}
|
|
56
|
+
@nodeViews={{this.nodeViews}}
|
|
57
|
+
@rdfaEditorInit={{this.rdfaEditorInit}}/>
|
|
58
|
+
</:default>
|
|
59
|
+
<:aside>
|
|
60
|
+
{...}
|
|
61
|
+
</:aside>
|
|
62
|
+
</EditorContainer>
|
|
48
63
|
```
|
|
49
|
-
|
|
64
|
+
You will have 2 anchor points where to put your plugins: `top` for a toolbar, and `aside` for plugin cards.
|
|
65
|
+
|
|
50
66
|
|
|
51
67
|
## besluit-type-plugin
|
|
52
68
|
|
|
53
69
|
Plugin which allows a user to change the type of a [besluit](https://data.vlaanderen.be/ns/besluit#Besluit).
|
|
54
70
|
|
|
55
|
-
This plugin
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.plugins = ["besluit"];
|
|
71
|
+
This plugin needs to be added to the toolbar as a dropdown with the following syntax:
|
|
72
|
+
```hbs
|
|
73
|
+
<BesluitTypePlugin::ToolbarDropdown @controller={{this.controller}}/>
|
|
59
74
|
```
|
|
75
|
+
|
|
60
76
|
## citaten-plugin
|
|
61
77
|
Plugin which allows a user to insert references to a legal resource or legal expression into the document.
|
|
62
78
|
|
|
63
|
-
This plugin
|
|
64
|
-
|
|
79
|
+
This plugin provides a card that needs to be added to the sidebar of the editor like
|
|
80
|
+
```hbs
|
|
81
|
+
<CitationPlugin::CitationCard
|
|
82
|
+
@controller={{this.controller}}
|
|
83
|
+
@plugin={{this.citationPlugin}}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
Being this.citationPlugin a tracked reference to the plugin created with the function exported from the package and the wished configuration
|
|
65
87
|
```js
|
|
66
|
-
|
|
88
|
+
import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
89
|
+
|
|
90
|
+
@tracked citationPlugin = citationPlugin({
|
|
91
|
+
type: 'nodes',
|
|
92
|
+
activeInNodeTypes(schema) {
|
|
93
|
+
return new Set([schema.nodes.motivering]);
|
|
94
|
+
},
|
|
95
|
+
});
|
|
67
96
|
```
|
|
68
97
|
|
|
98
|
+
Configuration:
|
|
99
|
+
- 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
|
|
100
|
+
- 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
|
|
101
|
+
- 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]]`
|
|
102
|
+
- regex: you can provide your custom regex to detect citations, if not the default one will be used
|
|
103
|
+
|
|
69
104
|
### Using the plugin
|
|
70
|
-
|
|
105
|
+
If used with the example configuration provided this plugin can be triggered by typing one of the following in the correct RDFa context (the [besluit:motivering](http://data.vlaanderen.be/ns/besluit#motivering) of a [besluit:Besluit](https://data.vlaanderen.be/ns/besluit#Besluit)).
|
|
71
106
|
|
|
72
107
|
* [specification]**decreet** [words to search for] *(e.g. "gemeentedecreet wijziging")*
|
|
73
108
|
* **omzendbrief** [words to search for]
|
|
@@ -85,30 +120,12 @@ This plugin can be triggered by typing one of the following in the correct RDFa
|
|
|
85
120
|
|
|
86
121
|
You should be able to 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 will open the advanced search window. **Note** that this will only be avaliable in the proper context (see above in this section).
|
|
87
122
|
|
|
88
|
-
## generate-template-plugin
|
|
89
|
-
Plugin which provides an editor command which replaces resource URIs in a document by a generic template URI containing `${generateUuid()}`. This allows for the generation of template documents. Template documents can be used by other applications, these other applications can create an instance of a template by replacing the `${generateUuid()}` keywords by real URIs.
|
|
90
|
-
|
|
91
|
-
This plugin can be configured in the following manner:
|
|
92
|
-
|
|
93
|
-
```js
|
|
94
|
-
this.plugins = ["generate-template"];
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
The command can be used by executing:
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
controller.executeCommand('generateTemplate', controller);
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Where `controller` is an editor-controller.
|
|
104
|
-
|
|
105
123
|
## import-snippet-plugin
|
|
106
124
|
Plugin allowing importing of external RDFA snippets and inserting it in the document.
|
|
107
125
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.plugins = ["import-snippet"];
|
|
126
|
+
The plugin has a card that needs to be added to the sidebar:
|
|
127
|
+
```hbs
|
|
128
|
+
<ImportSnippetPlugin::Card @controller={{this.controller}}/>
|
|
112
129
|
```
|
|
113
130
|
|
|
114
131
|
### Using the plugin
|
|
@@ -133,68 +150,90 @@ When opening a new document, users will get the option to either include the sni
|
|
|
133
150
|
## insert-variable-plugin
|
|
134
151
|
Plugin which allows users to insert variable placeholders into a document.
|
|
135
152
|
|
|
153
|
+
The plugin provides a card that needs to be attached to the editor sidebar like
|
|
154
|
+
```hbs
|
|
155
|
+
<VariablePlugin::InsertVariableCard
|
|
156
|
+
@controller={{this.controller}}
|
|
157
|
+
@options={{this.config.variable}}
|
|
158
|
+
/>
|
|
159
|
+
```
|
|
160
|
+
|
|
136
161
|
### Configuring the plugin
|
|
137
162
|
|
|
138
|
-
The plugin can be configured through the following optional attributes:
|
|
163
|
+
The plugin can be configured through the following optional attributes that can be added as a json to the options attribute of the card:
|
|
139
164
|
- `publisher`: the URI of a specific codelist publisher which you can use if you want to filter the codelists by its publisher.
|
|
140
165
|
- `defaultEndpoint`: The default endpoint where the codelists are fetched, this is also the variable that gets passed to the fetchSubtypes and template function
|
|
141
166
|
- `variableTypes`: a custom list of variable types you want the plugin to use. This list can contain the following default variable types: `text`, `number`,`date`,`location` and `codelist`. Additionally this list can also contain custom variable types, configured by the following three sub-attributes:
|
|
142
167
|
* `label`: the label of the custom variable type
|
|
143
168
|
* `fetchSubTypes` (optional): a function which returns a list of possible variable values. The function takes two optional arguments: an `endpoint` and a `publisher`.
|
|
144
|
-
* `
|
|
169
|
+
* `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.
|
|
145
170
|
|
|
146
171
|
#### Example
|
|
147
172
|
|
|
148
173
|
```js
|
|
149
174
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
175
|
+
publisher: 'http://data.lblod.info/id/bestuurseenheden/141d9d6b-54af-4d17-b313-8d1c30bc3f5b',
|
|
176
|
+
defaultEndpoint: 'https://dev.roadsigns.lblod.info/sparql',
|
|
177
|
+
variableTypes: [
|
|
178
|
+
'text',
|
|
179
|
+
'number',
|
|
180
|
+
'date',
|
|
181
|
+
'location',
|
|
182
|
+
'codelist',
|
|
183
|
+
{
|
|
184
|
+
label: 'Simple Variable',
|
|
185
|
+
constructor: (schema) => {
|
|
186
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
187
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
188
|
+
return schema.node(
|
|
189
|
+
'variable',
|
|
160
190
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<span class="mark-highlight-manual">\${Simple variable}</span>
|
|
165
|
-
</span>
|
|
166
|
-
`,
|
|
191
|
+
mappingResource: mappingURI,
|
|
192
|
+
variableInstance,
|
|
193
|
+
type: 'Simple Variable',
|
|
167
194
|
},
|
|
195
|
+
schema.node('placeholder', { placeholderText: 'text' })
|
|
196
|
+
);
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: 'Complex Variable',
|
|
201
|
+
fetchSubtypes: async (endpoint, publisher) => {
|
|
202
|
+
const subtypes = [
|
|
168
203
|
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const codelists = [
|
|
172
|
-
{
|
|
173
|
-
uri: '1',
|
|
174
|
-
label: '1',
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
uri: '2',
|
|
178
|
-
label: '2',
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
uri: '3',
|
|
182
|
-
label: '3',
|
|
183
|
-
},
|
|
184
|
-
];
|
|
185
|
-
return codelists;
|
|
186
|
-
},
|
|
187
|
-
template: (endpoint, selectedCodelist) => `
|
|
188
|
-
<span property="ext:codelist" resource="${selectedCodelist.uri}"></span>
|
|
189
|
-
<span property="dct:type" content="location"></span>
|
|
190
|
-
<span property="dct:source" resource="${endpoint}"></span>
|
|
191
|
-
<span property="ext:content" datatype="xsd:date">
|
|
192
|
-
<span class="mark-highlight-manual">\${${selectedCodelist.label}}</span>
|
|
193
|
-
</span>
|
|
194
|
-
`,
|
|
204
|
+
uri: '1',
|
|
205
|
+
label: '1',
|
|
195
206
|
},
|
|
196
|
-
|
|
197
|
-
|
|
207
|
+
{
|
|
208
|
+
uri: '2',
|
|
209
|
+
label: '2',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
uri: '3',
|
|
213
|
+
label: '3',
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
return subtypes;
|
|
217
|
+
},
|
|
218
|
+
constructor: (schema, endpoint, selectedSubtype) => {
|
|
219
|
+
const mappingURI = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
220
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
221
|
+
return schema.node(
|
|
222
|
+
'variable',
|
|
223
|
+
{
|
|
224
|
+
type: 'Complex Variable',
|
|
225
|
+
mappingResource: mappingURI,
|
|
226
|
+
subTypeResource: selectedSubtype?.uri,
|
|
227
|
+
variableInstance,
|
|
228
|
+
source: endpoint,
|
|
229
|
+
},
|
|
230
|
+
schema.node('placeholder', {
|
|
231
|
+
placeholderText: selectedSubtype?.label ?? '',
|
|
232
|
+
})
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
],
|
|
198
237
|
}
|
|
199
238
|
```
|
|
200
239
|
### Using the plugin
|
|
@@ -205,21 +244,39 @@ When the insert-variable-plugin is enabled, users will have the option to insert
|
|
|
205
244
|
## rdfa-date-plugin
|
|
206
245
|
Plugin to insert and modify semantic dates and timestamps in an editor document.
|
|
207
246
|
|
|
208
|
-
This plugin
|
|
247
|
+
This plugin provides a card to modify dates that needs to be added to the editor sidebar like
|
|
209
248
|
|
|
210
|
-
```
|
|
211
|
-
|
|
249
|
+
```hbs
|
|
250
|
+
<RdfaDatePlugin::Card
|
|
251
|
+
@controller={{this.controller}}
|
|
252
|
+
@options={{this.config.date}}/>
|
|
212
253
|
```
|
|
213
254
|
|
|
255
|
+
And a insert button to insert new dates that needs to be added to the insert part of the sidebar:
|
|
256
|
+
```hbs
|
|
257
|
+
<RdfaDatePlugin::Insert
|
|
258
|
+
@controller={{this.controller}}
|
|
259
|
+
@options={{this.config.date}}
|
|
260
|
+
/>
|
|
261
|
+
```
|
|
214
262
|
|
|
263
|
+
You will also need to add the date node with the following configuration (being the insertDate and insertDateTime the placeholder strings):
|
|
264
|
+
```js
|
|
265
|
+
date: date({
|
|
266
|
+
placeholder: {
|
|
267
|
+
insertDate: this.intl.t('date-plugin.insert.date'),
|
|
268
|
+
insertDateTime: this.intl.t('date-plugin.insert.datetime'),
|
|
269
|
+
},
|
|
270
|
+
}),
|
|
271
|
+
```
|
|
215
272
|
|
|
216
273
|
## roadsign-regulation-plugin
|
|
217
274
|
A plugin that fetches data from the mow regulation and roadsign registry and allows users to insert roadsign regulations inside an editor document.
|
|
218
275
|
|
|
219
|
-
This plugin
|
|
276
|
+
This plugin provides a card that needs to be added to the editor sidebar like:
|
|
220
277
|
|
|
221
|
-
```
|
|
222
|
-
this.
|
|
278
|
+
```hbs
|
|
279
|
+
<RoadsignRegulationPlugin::RoadsignRegulationCard @controller={{this.controller}}/>
|
|
223
280
|
```
|
|
224
281
|
|
|
225
282
|
The default endpoint the plugin will query is https://roadsigns.lblod.info/sparql . This can be overwritten by setting `roadsignRegulationPlugin.endpoint` in your `config/environment.js`.
|
|
@@ -227,10 +284,9 @@ The default endpoint the plugin will query is https://roadsigns.lblod.info/sparq
|
|
|
227
284
|
## standard-template-plugin
|
|
228
285
|
Plugin which allows users to insert standard templates in the editor. Depending on the position of the cursor or selected text, a dropdown will appear in the toolbar of the editor that lets you insert a template for the proper context at the location of the cursor.
|
|
229
286
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.plugins = ["standard-template"];
|
|
287
|
+
In order to use this plugin you will need to add its card:
|
|
288
|
+
```hbs
|
|
289
|
+
<StandardTemplatePlugin::Card @controller={{this.controller}}/>
|
|
234
290
|
```
|
|
235
291
|
|
|
236
292
|
### Template resource used by the plugin
|
|
@@ -245,72 +301,59 @@ When creating a template in your database, the following properties are used by
|
|
|
245
301
|
|
|
246
302
|
### Using the plugin
|
|
247
303
|
|
|
248
|
-
|
|
249
304
|
The plugin will search for RDFa contexts in the content of the editor and the editor itself. Based on the contexts, the plugin will show possible templates to be added at the location of the cursor. E.g. if an element in the editor has the `typeof="besluit:BehandelingVanAgendapunt"` attribute, the plugin will show the templates related to [`besluit:BehandelingVanAgendapunt`](http://data.vlaanderen.be/ns/besluit#BehandelingVanAgendapunt) in the dropdown menu. This attribute can be set on an element in the content of the editor or predefined in the editor itself.
|
|
250
305
|
|
|
251
306
|
## table-of-contents-plugin
|
|
252
307
|
|
|
253
308
|
Plugin implementing an auto-refreshing table of contents using an ember-rdfa-editor inline component.
|
|
254
309
|
|
|
255
|
-
In order to enable the plugin you need to add
|
|
256
|
-
|
|
310
|
+
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.
|
|
311
|
+
```hbs
|
|
312
|
+
<TableOfContentsPlugin::ToolbarButton @controller={{this.editor}}/>
|
|
313
|
+
```
|
|
257
314
|
|
|
258
|
-
```
|
|
259
|
-
this.
|
|
260
|
-
{ name: 'table-of-contents',
|
|
261
|
-
options: {
|
|
262
|
-
config: {
|
|
263
|
-
sectionPredicate: 'https://say.data.gift/ns/hasPart',
|
|
264
|
-
value: {
|
|
265
|
-
predicate: 'https://say.data.gift/ns/heading',
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
sectionPredicate: 'https://say.data.gift/ns/hasParagraph',
|
|
270
|
-
value: '§',
|
|
271
|
-
},
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
]
|
|
315
|
+
```
|
|
316
|
+
tableOfContentsView(this.config.tableOfContents)(controller),
|
|
275
317
|
```
|
|
276
318
|
|
|
277
|
-
|
|
319
|
+
|
|
320
|
+
### Configuring the plugin with a custom config
|
|
321
|
+
|
|
322
|
+
You can configure the nodeview with the hiearchy of the nodes
|
|
278
323
|
|
|
279
324
|
```js
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
sectionPredicate: 'https://say.data.gift/ns/hasPart',
|
|
287
|
-
value: {
|
|
288
|
-
predicate: 'https://say.data.gift/ns/heading',
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
sectionPredicate: 'https://say.data.gift/ns/hasParagraph',
|
|
293
|
-
value: '§',
|
|
294
|
-
},
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
{},
|
|
298
|
-
false
|
|
299
|
-
);
|
|
325
|
+
{
|
|
326
|
+
nodeHierarchy: [
|
|
327
|
+
'title|chapter|section|subsection|article',
|
|
328
|
+
'structure_header|article_header',
|
|
329
|
+
],
|
|
330
|
+
},
|
|
300
331
|
```
|
|
332
|
+
|
|
333
|
+
|
|
301
334
|
## template-variable-plugin
|
|
302
335
|
|
|
303
336
|
Editor plugin which allows you to interact with placeholders created by the insert-variable-plugin.
|
|
304
337
|
|
|
305
|
-
|
|
338
|
+
For enabling it, you need to add the card provided by the plugin to the editor sidebar
|
|
339
|
+
```hbs
|
|
340
|
+
<VariablePlugin::TemplateVariableCard @controller={{this.controller}}/>
|
|
341
|
+
```
|
|
306
342
|
|
|
307
|
-
You
|
|
343
|
+
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:
|
|
308
344
|
|
|
309
345
|
```js
|
|
310
|
-
|
|
346
|
+
import {
|
|
347
|
+
variable,
|
|
348
|
+
variableView,
|
|
349
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/nodes';
|
|
350
|
+
|
|
311
351
|
```
|
|
312
352
|
|
|
313
|
-
|
|
353
|
+
### Configuring the plugin
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
You can configure the plugin in your `environment.js` file:
|
|
314
357
|
|
|
315
358
|
```js
|
|
316
359
|
templateVariablePlugin: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { ProseController } from '@lblod/ember-rdfa-editor';
|
|
4
3
|
import IntlService from 'ember-intl/services/intl';
|
|
5
4
|
import {
|
|
6
5
|
ArticleStructurePluginOptions,
|
|
@@ -8,26 +7,33 @@ import {
|
|
|
8
7
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
|
|
9
8
|
import { action } from '@ember/object';
|
|
10
9
|
import { insertStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands';
|
|
10
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
11
11
|
|
|
12
12
|
type Args = {
|
|
13
|
-
controller:
|
|
14
|
-
|
|
15
|
-
options: ArticleStructurePluginOptions;
|
|
16
|
-
};
|
|
13
|
+
controller: SayController;
|
|
14
|
+
options: ArticleStructurePluginOptions;
|
|
17
15
|
};
|
|
18
16
|
export default class EditorPluginsArticleStructureCardComponent extends Component<Args> {
|
|
19
17
|
@service declare intl: IntlService;
|
|
20
18
|
|
|
21
19
|
get structureTypes() {
|
|
22
|
-
return this.args.
|
|
20
|
+
return this.args.options;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get controller() {
|
|
24
|
+
return this.args.controller;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
@action
|
|
26
28
|
insertStructure(spec: StructureSpec) {
|
|
27
|
-
this.args.controller.doCommand(insertStructure(spec, this.intl)
|
|
29
|
+
this.args.controller.doCommand(insertStructure(spec, this.intl), {
|
|
30
|
+
view: this.controller.mainEditorView,
|
|
31
|
+
});
|
|
28
32
|
this.args.controller.focus();
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
canInsertStructure = (spec: StructureSpec) =>
|
|
32
|
-
this.args.controller.checkCommand(insertStructure(spec, this.intl)
|
|
36
|
+
this.args.controller.checkCommand(insertStructure(spec, this.intl), {
|
|
37
|
+
view: this.controller.mainEditorView,
|
|
38
|
+
});
|
|
33
39
|
}
|
|
@@ -26,10 +26,15 @@
|
|
|
26
26
|
</AuButton>
|
|
27
27
|
</Item>
|
|
28
28
|
<Item>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
{{#unless this.currentStructureType.noUnwrap}}
|
|
30
|
+
<div class="au-u-padding-tiny">
|
|
31
|
+
<AuToggleSwitch
|
|
32
|
+
@label={{t "article-structure-plugin.remove.content"}}
|
|
33
|
+
@checked={{this.removeStructureContent}}
|
|
34
|
+
@onChange={{this.setRemoveStructureContent}}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
{{/unless}}
|
|
33
38
|
<AuButton
|
|
34
39
|
@icon="bin"
|
|
35
40
|
@iconAlignment="left"
|