@lblod/ember-rdfa-editor-lblod-plugins 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/README.md +311 -14
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -1,37 +1,334 @@
1
- ember-rdfa-editor-lblod-plugins
2
- ==============================================================================
1
+ # ember-rdfa-editor-lblod-plugins
3
2
 
4
- [Short description of the addon.]
5
3
 
4
+ Ember v2 addon which bundles a collection of [ember-rdfa-editor](https://github.com/lblod/ember-rdfa-editor) plugins related to the LBLOD Project.
5
+
6
+
7
+ ## Compatibility
6
8
 
7
- Compatibility
8
- ------------------------------------------------------------------------------
9
9
 
10
10
  * Ember.js v3.28 or above
11
11
  * Embroider or ember-auto-import v2
12
12
 
13
13
 
14
- Installation
15
- ------------------------------------------------------------------------------
14
+ ## Installation
15
+
16
16
 
17
17
  ```
18
18
  ember install ember-rdfa-editor-lblod-plugins
19
19
  ```
20
20
 
21
21
 
22
- Usage
23
- ------------------------------------------------------------------------------
22
+ ## General addon information
23
+
24
+
25
+ This addon contains the following editor plugins:
26
+ * besluit-type-plugin
27
+ * citaten-plugin
28
+ * generate-template-plugin
29
+ * import-snippet-plugin
30
+ * insert-variable-plugin
31
+ * rdfa-date-plugin
32
+ * roadsign-regulation-plugin
33
+ * standard-template-plugin
34
+ * table-of-contents-plugin
35
+ * template-variable-plugin
36
+
37
+ An array of plugin configurations can be passed to an instance of the ember-rdfa-editor in order to enable them.
38
+ This is typically done in the following manner:
39
+ ```hbs
40
+ <Rdfa::RdfaEditor
41
+ class="au-c-rdfa-editor"
42
+ @profile={{@profile}}
43
+ @rdfaEditorInit={{this.rdfaEditorInit}}
44
+ @editorOptions={{this.editorOptions}}
45
+ @toolbarOptions={{this.toolbarOptions}}
46
+ @plugins={{this.plugins}}
47
+ />
48
+ ```
49
+ Where `this.plugins` is an array of plugin configurations found in the backing class of the template shown above.
50
+
51
+ ## besluit-type-plugin
52
+
53
+ Plugin which allows a user to change the type of a [besluit](https://data.vlaanderen.be/ns/besluit#Besluit).
54
+
55
+ This plugin can be configured in the following manner:
56
+
57
+ ```js
58
+ this.plugins = ["besluit"];
59
+ ```
60
+ ## citaten-plugin
61
+ Plugin which allows a user to insert references to a legal resource or legal expression into the document.
62
+
63
+ This plugin can be configured in the following manner:
64
+
65
+ ```js
66
+ this.plugins = ["citaten"];
67
+ ```
68
+
69
+ ### Using the plugin
70
+ 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
+
72
+ * [specification]**decreet** [words to search for] *(e.g. "gemeentedecreet wijziging")*
73
+ * **omzendbrief** [words to search for]
74
+ * **verdrag** [words to search for]
75
+ * **grondwetswijziging** [words to search for]
76
+ * **samenwerkingsakkoord** [words to search for]
77
+ * [specification]**wetboek** [words to search for]
78
+ * **protocol** [words to search for]
79
+ * **besluit van de vlaamse regering** [words to search for]
80
+ * **gecoordineerde wetten** [words to search for]
81
+ * [specification]**wet** [words to search for] *(e.g. "kieswet wijziging", or "grondwet")*
82
+ * **koninklijk besluit** [words to search for]
83
+ * **ministerieel besluit** [words to search for]
84
+ * **genummerd besluit** [words to search for]
85
+
86
+ 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
+
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
+ ## import-snippet-plugin
106
+ Plugin allowing importing of external RDFA snippets and inserting it in the document.
107
+
108
+ This plugin can be configured in the following manner:
109
+
110
+ ```js
111
+ this.plugins = ["import-snippet"];
112
+ ```
113
+
114
+ ### Using the plugin
115
+
116
+ This plugin provides an Ember service, `import-rdfa-snippet` which allows you to download rdfa snippets in the following manner:
117
+
118
+ ```js
119
+ import { inject as service } from '@ember/service';
120
+
121
+
122
+ // An entry point to download the resouce (e.g a route) in your host app.
123
+ // (...)
124
+
125
+ let downloadData = { source: 'http://remote/resource.html' }
126
+ await this.importRdfaSnippet.downloadSnippet(downloadData);
127
+ ```
128
+
129
+ After having downloaded a snippet, a user can use the plugin in the Gelinkt Notuleren application (https://github.com/lblod/frontend-gelinkt-notuleren).
130
+
131
+ When opening a new document, users will get the option to either include the snippet data in the document or as an attachment.
132
+
133
+ ## insert-variable-plugin
134
+ Plugin which allows users to insert variable placeholders into a document.
135
+
136
+ ### Configuring the plugin
137
+
138
+ The plugin can be configured through the following optional attributes:
139
+ - `publisher`: the URI of a specific codelist publisher which you can use if you want to filter the codelists by its publisher.
140
+ - `defaultEndpoint`: The default endpoint where the codelists are fetched, this is also the variable that gets passed to the fetchSubtypes and template function
141
+ - `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
+ * `label`: the label of the custom variable type
143
+ * `fetchSubTypes` (optional): a function which returns a list of possible variable values. The function takes two optional arguments: an `endpoint` and a `publisher`.
144
+ * `template`: function which returns an html template which should be resolved and inserted when inserting a variable of the custom variable type. The function takes two arguments: an `endpoint` and a `selectedVariableValue`.
145
+
146
+ #### Example
147
+
148
+ ```js
149
+ {
150
+ name:'insert-variable',
151
+ options: {
152
+ publisher: 'http://data.lblod.info/id/bestuurseenheden/141d9d6b-54af-4d17-b313-8d1c30bc3f5b',
153
+ defaultEndpoint: 'https://dev.roadsigns.lblod.info/sparql',
154
+ variableTypes: [
155
+ 'text',
156
+ 'number',
157
+ 'date',
158
+ 'location',
159
+ 'codelist',
160
+ {
161
+ label: 'Simple Variable',
162
+ template: `
163
+ <span property="ext:content" datatype="ext:myNewType">
164
+ <span class="mark-highlight-manual">\${Simple variable}</span>
165
+ </span>
166
+ `,
167
+ },
168
+ {
169
+ label: 'Complex Variable',
170
+ fetchSubtypes: async (endpoint, publisher) => {
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
+ `,
195
+ },
196
+ ],
197
+ }
198
+ }
199
+ ```
200
+ ### Using the plugin
201
+
202
+ When the insert-variable-plugin is enabled, users will have the option to insert a variable into a document through a card which pops up in the sidebar of the editor.
203
+
204
+
205
+ ## rdfa-date-plugin
206
+ Plugin to insert and modify semantic dates and timestamps in an editor document.
207
+
208
+ This plugin can be configured in the following manner:
209
+
210
+ ```js
211
+ this.plugins = ["rdfa-date"];
212
+ ```
213
+
214
+
215
+
216
+ ## roadsign-regulation-plugin
217
+ A plugin that fetches data from the mow regulation and roadsign registry and allows users to insert roadsign regulations inside an editor document.
218
+
219
+ This plugin can be configured in the following manner:
220
+
221
+ ```js
222
+ this.plugins = ["roadsign-regulation"];
223
+ ```
224
+
225
+ 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`.
226
+
227
+ ## standard-template-plugin
228
+ 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
+
230
+ This plugin can be configured in the following manner:
231
+
232
+ ```js
233
+ this.plugins = ["standard-template"];
234
+ ```
235
+
236
+ ### Template resource used by the plugin
237
+
238
+ When creating a template in your database, the following properties are used by the plugin:
239
+
240
+ * the title of the template (`title`)
241
+ * its HTML content (`content`)
242
+ * the words of the document the template should match on (`matches`)
243
+ * the contexts in which it should be active (`contexts`)
244
+ * the contexts in which it should not be active (`disabled-in-contexts`)
245
+
246
+ ### Using the plugin
247
+
248
+
249
+ 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
+
251
+ ## table-of-contents-plugin
24
252
 
25
- [Longer description of how to use the addon in apps.]
253
+ Plugin implementing an auto-refreshing table of contents using an ember-rdfa-editor inline component.
26
254
 
255
+ In order to enable the plugin you need to add `table-of-contents` to the list of plugins passed to the rdfa-editor. You can configure the plugin with a custom table of contents configuration.
256
+ ### Configuring the plugin with a custom config
257
+
258
+ ```js
259
+ this.plugins = [
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
+ ]
275
+ ```
276
+
277
+ You can insert an instance of a table of contents using the `insert-component` command:
278
+
279
+ ```js
280
+ controller.executeCommand(
281
+ 'insert-component',
282
+ 'table-of-contents-plugin/inline-components/table-of-contents',
283
+ {
284
+ config: [
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
+ );
300
+ ```
301
+ ## template-variable-plugin
302
+
303
+ Editor plugin which allows you to interact with placeholders created by the insert-variable-plugin.
304
+
305
+ ### Configuring the plugin
306
+
307
+ You can enable the plugin by adding it to the list of plugins:
308
+
309
+ ```js
310
+ this.plugins = ['template-variable'];
311
+ ```
312
+
313
+ Additionally, you can configure the plugin in your `environment.js` file:
314
+
315
+ ```js
316
+ templateVariablePlugin: {
317
+ endpoint: 'https://dev.roadsigns.lblod.info/sparql', // the fallback endpoint which should be used for codelists which do not have a `dct:source` property.
318
+ zonalLocationCodelistUri:
319
+ 'http://lblod.data.gift/concept-schemes/62331E6900730AE7B99DF7EF',
320
+ nonZonalLocationCodelistUri:
321
+ 'http://lblod.data.gift/concept-schemes/62331FDD00730AE7B99DF7F2',
322
+ },
323
+ ```
324
+
325
+ ## Contributing
27
326
 
28
- Contributing
29
- ------------------------------------------------------------------------------
30
327
 
31
328
  See the [Contributing](CONTRIBUTING.md) guide for details.
32
329
 
33
330
 
34
- License
35
- ------------------------------------------------------------------------------
331
+ ## License
332
+
36
333
 
37
334
  This project is licensed under the [MIT License](LICENSE.md).
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
- "ember-addon"
6
+ "ember-addon",
7
+ "ember-rdfa-editor"
7
8
  ],
8
9
  "repository": "",
9
10
  "license": "MIT",