@lblod/ember-rdfa-editor-lblod-plugins 26.3.1 → 26.4.0-dev.ae426a2acd3ec657d4380017c754b70741a26e95
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/.changeset/pretty-bags-occur.md +5 -0
- package/.changeset/tough-queens-hide.md +5 -0
- package/CHANGELOG.md +16 -0
- package/README.md +4 -7
- package/addon/components/citation-plugin/citation-card.hbs +2 -3
- package/addon/components/citation-plugin/citation-insert.ts +27 -19
- package/addon/components/citation-plugin/citations/legal-document-detail.hbs +3 -1
- package/addon/components/location-plugin/edit.gts +1 -1
- package/addon/components/location-plugin/insert.gts +1 -1
- package/addon/components/location-plugin/map.gts +2 -2
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.hbs +3 -2
- package/addon/components/snippet-plugin/nodes/snippet.gts +4 -4
- package/addon/components/snippet-plugin/search-modal.ts +3 -3
- package/addon/components/snippet-plugin/snippet-insert-placeholder.gts +2 -2
- package/addon/components/snippet-plugin/snippet-insert-rdfa.gts +7 -7
- package/addon/components/snippet-plugin/snippet-insert.gts +2 -2
- package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +1 -1
- package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +7 -7
- package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +2 -2
- package/addon/components/snippet-plugin/snippet-list/snippet-list-view.ts +12 -12
- package/addon/components/snippet-plugin/snippet-list-select.gts +9 -9
- package/addon/components/table-of-contents-plugin/ember-nodes/outline.hbs +1 -1
- package/addon/components/variable-plugin/date/date-time-picker.ts +0 -1
- package/addon/plugins/citation-plugin/index.ts +45 -41
- package/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.ts +1 -2
- package/addon/plugins/snippet-plugin/index.ts +5 -6
- package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +5 -5
- package/addon/plugins/snippet-plugin/nodes/snippet.ts +6 -3
- package/addon/plugins/snippet-plugin/utils/fetch-data.ts +16 -17
- package/addon/plugins/snippet-plugin/utils/rdfa-predicate.ts +12 -13
- package/addon/utils/sparql-helpers.ts +10 -0
- package/addon/utils/translation.ts +2 -6
- package/declarations/addon/components/article-structure-plugin/article-structure-card.d.ts +1 -1
- package/declarations/addon/components/article-structure-plugin/structure-card.d.ts +3 -3
- package/declarations/addon/components/besluit-topic-plugin/besluit-topic-select.d.ts +1 -1
- package/declarations/addon/components/besluit-topic-plugin/besluit-topic-toolbar-dropdown.d.ts +3 -3
- package/declarations/addon/components/besluit-type-plugin/besluit-type-select.d.ts +1 -1
- package/declarations/addon/components/besluit-type-plugin/toolbar-dropdown.d.ts +4 -4
- package/declarations/addon/components/citation-plugin/citation-card.d.ts +2 -2
- package/declarations/addon/components/citation-plugin/citation-insert.d.ts +1 -1
- package/declarations/addon/components/citation-plugin/citations/article-preview.d.ts +1 -1
- package/declarations/addon/components/citation-plugin/citations/legal-document-detail.d.ts +7 -7
- package/declarations/addon/components/citation-plugin/citations/legal-document-preview.d.ts +4 -4
- package/declarations/addon/components/citation-plugin/citations/search-modal.d.ts +2 -2
- package/declarations/addon/components/common/search/alert-load-error.d.ts +0 -2
- package/declarations/addon/components/common/search/alert-no-items.d.ts +0 -2
- package/declarations/addon/components/common/sort/sortable-table-header.d.ts +3 -3
- package/declarations/addon/components/confidentiality-plugin/redact.d.ts +0 -2
- package/declarations/addon/components/document-title-plugin/insert-title-card.d.ts +1 -1
- package/declarations/addon/components/generic-rdfa-variable/insert-menu.d.ts +1 -1
- package/declarations/addon/components/lmb-plugin/insert.d.ts +1 -1
- package/declarations/addon/components/loading-alert.d.ts +1 -1
- package/declarations/addon/components/location-plugin/edit.d.ts +1 -1
- package/declarations/addon/components/lpdc-plugin/lpdc-insert.d.ts +1 -1
- package/declarations/addon/components/lpdc-plugin/lpdc-modal.d.ts +2 -2
- package/declarations/addon/components/pagination/pagination-view.d.ts +0 -2
- package/declarations/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +1 -1
- package/declarations/addon/components/roadsign-regulation-plugin/roadsigns-pagination.d.ts +2 -2
- package/declarations/addon/components/roadsign-regulation-plugin/roadsigns-table.d.ts +2 -2
- package/declarations/addon/components/snippet-plugin/search-modal.d.ts +1 -1
- package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-modal.d.ts +3 -3
- package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-view.d.ts +3 -3
- package/declarations/addon/components/snippet-plugin/snippet-list-select-rdfa.d.ts +0 -2
- package/declarations/addon/components/snippet-plugin/snippet-list-select.d.ts +2 -2
- package/declarations/addon/components/standard-template-plugin/card.d.ts +1 -1
- package/declarations/addon/components/template-comments-plugin/edit-card.d.ts +3 -3
- package/declarations/addon/components/template-comments-plugin/insert.d.ts +1 -1
- package/declarations/addon/components/template-comments-plugin/template-comment.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/address/edit.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/address/insert.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/date/date-time-picker.d.ts +0 -1
- package/declarations/addon/components/variable-plugin/date/edit.d.ts +2 -2
- package/declarations/addon/components/variable-plugin/date/insert.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/utils/label-input.d.ts +0 -2
- package/declarations/addon/components/worship-plugin/insert.d.ts +1 -1
- package/declarations/addon/helpers/capitalize.d.ts +1 -1
- package/declarations/addon/helpers/in-array.d.ts +1 -7
- package/declarations/addon/helpers/limit-text.d.ts +1 -1
- package/declarations/addon/models/sign.d.ts +1 -1
- package/declarations/addon/plugins/article-structure-plugin/commands/move-selected-structure.d.ts +1 -1
- package/declarations/addon/plugins/article-structure-plugin/utils/structure.d.ts +1 -1
- package/declarations/addon/plugins/citation-plugin/index.d.ts +5 -16
- package/declarations/addon/plugins/citation-plugin/utils/types.d.ts +3 -3
- package/declarations/addon/plugins/decision-plugin/commands/insert-description.d.ts +1 -1
- package/declarations/addon/plugins/decision-plugin/commands/insert-title.d.ts +1 -1
- package/declarations/addon/plugins/lpdc-plugin/api.d.ts +2 -2
- package/declarations/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.d.ts +1 -1
- package/declarations/addon/plugins/snippet-plugin/index.d.ts +4 -4
- package/declarations/addon/plugins/snippet-plugin/nodes/snippet.d.ts +1 -1
- package/declarations/addon/plugins/snippet-plugin/utils/fetch-data.d.ts +1 -1
- package/declarations/addon/plugins/snippet-plugin/utils/rdfa-predicate.d.ts +7 -4
- package/declarations/addon/services/import-rdfa-snippet.d.ts +0 -2
- package/declarations/addon/services/roadsign-registry.d.ts +5 -5
- package/declarations/addon/utils/sparql-helpers.d.ts +1 -0
- package/declarations/addon/utils/translation.d.ts +1 -1
- package/index.js +22 -0
- package/package.json +31 -48
- package/pnpm-lock.yaml +1703 -1589
- package/translations/appuniversum/en-us.yaml +0 -1
- package/translations/appuniversum/nl-be.yaml +0 -1
- package/translations/nl-BE.yaml +1 -1
- package/types/dummy/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 26.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#528](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/528) [`0a70aed`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/0a70aedf1d656d7bf85b0c528317f6bbcac62f37) Thanks [@piemonkey](https://github.com/piemonkey)! - Add support for Ember 5.4+
|
|
8
|
+
|
|
9
|
+
- [#528](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/528) [`b7f426f`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/b7f426f3bd174320ee2a4963d1f103d6ab60459f) Thanks [@piemonkey](https://github.com/piemonkey)! - Update test-app to use ember-source 5.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#525](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/525) [`f7eb06c`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f7eb06c3e134f2b044c6ee73f3652cefc2e7d286) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Convert snippet plugin to use uri instead of id
|
|
14
|
+
|
|
15
|
+
- [#528](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/528) [`7373171`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/73731715f3ebf2dc949ca361e80e935a85534a9b) Thanks [@piemonkey](https://github.com/piemonkey)! - Add support for ember-concurrency 4 and ember-power-select 8
|
|
16
|
+
|
|
17
|
+
- [#530](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/530) [`3bf983c`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/3bf983cc910dfe96a88a669f6da2861bf5891bc2) Thanks [@elpoelma](https://github.com/elpoelma)! - Move to builtin ember.js types
|
|
18
|
+
|
|
3
19
|
## 26.3.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -326,7 +326,6 @@ Make `this.citationPlugin` a tracked reference to the plugin created with the fu
|
|
|
326
326
|
import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
327
327
|
|
|
328
328
|
@tracked citationPlugin = citationPlugin({
|
|
329
|
-
type: 'nodes',
|
|
330
329
|
activeInNodeTypes(schema) {
|
|
331
330
|
return new Set([schema.nodes.motivering]);
|
|
332
331
|
},
|
|
@@ -335,10 +334,10 @@ Make `this.citationPlugin` a tracked reference to the plugin created with the fu
|
|
|
335
334
|
|
|
336
335
|
Configuration:
|
|
337
336
|
|
|
338
|
-
-
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
337
|
+
- You are expected to set one of two functions
|
|
338
|
+
* `activeInNode` function. It's a function which expects an instance of a prosemirror node and returns whether it should be active in that node.
|
|
339
|
+
* `activeInRanges` function. 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]]`.
|
|
340
|
+
* If no function is provided, the citation plugin will be activated document-wide, if both are provided, it will use the range function first and then narrow it down using the node functions given the ranges but this is not encouraged.
|
|
342
341
|
|
|
343
342
|
- regex: you can provide your custom regex to detect citations, if not the default one will be used
|
|
344
343
|
|
|
@@ -348,14 +347,12 @@ A common usecase is to have the plugin active in the entire document. Here's how
|
|
|
348
347
|
import { citationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
349
348
|
|
|
350
349
|
const configA = {
|
|
351
|
-
type: 'nodes',
|
|
352
350
|
activeInNode(node, state) {
|
|
353
351
|
return node.type === state.schema.nodes.doc;
|
|
354
352
|
},
|
|
355
353
|
};
|
|
356
354
|
|
|
357
355
|
const configB = {
|
|
358
|
-
type: 'ranges',
|
|
359
356
|
activeInRanges(state) {
|
|
360
357
|
// a node's nodeSize follows the Prosemirror definition
|
|
361
358
|
// a non-leaf node's size is the sum of its children's sizes + 2
|
|
@@ -78,10 +78,9 @@
|
|
|
78
78
|
</c.content>
|
|
79
79
|
<c.footer class='au-u-background-gray-100 au-u-padding-none'>
|
|
80
80
|
{{#if this.legalDocumentsResource.isRunning}}
|
|
81
|
-
<AuLoader
|
|
82
|
-
<span class='au-u-hidden-visually'>{{t
|
|
81
|
+
<AuLoader @hideMessage={{true}}>{{t
|
|
83
82
|
'citaten-plugin.alert.loading'
|
|
84
|
-
}}</
|
|
83
|
+
}}</AuLoader>
|
|
85
84
|
{{else}}
|
|
86
85
|
{{#if this.error}}
|
|
87
86
|
<Common::Search::AlertLoadError
|
|
@@ -64,35 +64,43 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
64
64
|
}
|
|
65
65
|
const { selection } = this.controller.mainEditorState;
|
|
66
66
|
const config = this.config;
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
if (config.type === 'ranges') {
|
|
67
|
+
if (config.activeInRanges) {
|
|
68
|
+
let activeInRange;
|
|
72
69
|
const ranges = config.activeInRanges(this.controller.mainEditorState);
|
|
73
70
|
for (const range of ranges) {
|
|
74
71
|
if (selection.from > range[0] && selection.from < range[1]) {
|
|
75
|
-
|
|
72
|
+
activeInRange = true;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
if (!activeInRange) return true;
|
|
76
|
+
}
|
|
77
|
+
let condition: ((node: PNode) => boolean) | undefined;
|
|
78
|
+
const { activeInNode, activeInNodeTypes } = config;
|
|
79
|
+
if (activeInNodeTypes && activeInNode) {
|
|
80
|
+
const nodeTypes = activeInNodeTypes(
|
|
81
|
+
this.controller.schema,
|
|
82
|
+
this.controller.mainEditorState,
|
|
83
|
+
);
|
|
84
|
+
condition = (node) =>
|
|
85
|
+
nodeTypes.has(node.type) &&
|
|
86
|
+
activeInNode(node, this.controller.mainEditorState);
|
|
87
|
+
} else if (activeInNodeTypes) {
|
|
88
|
+
const nodeTypes = activeInNodeTypes(
|
|
89
|
+
this.controller.schema,
|
|
90
|
+
this.controller.mainEditorState,
|
|
91
|
+
);
|
|
92
|
+
condition = (node) => nodeTypes.has(node.type);
|
|
93
|
+
} else if (activeInNode) {
|
|
94
|
+
condition = (node) => activeInNode(node, this.controller.mainEditorState);
|
|
95
|
+
}
|
|
91
96
|
|
|
97
|
+
if (condition) {
|
|
92
98
|
if (condition(this.controller.mainEditorState.doc)) {
|
|
93
99
|
return false;
|
|
94
100
|
}
|
|
95
101
|
return !findParentNode(condition)(selection);
|
|
102
|
+
} else {
|
|
103
|
+
return false;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
|
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
<div>
|
|
62
62
|
{{#if this.articleResource.isRunning}}
|
|
63
63
|
<div class='au-o-box'>
|
|
64
|
-
<AuLoader @
|
|
64
|
+
<AuLoader @hideMessage={{true}}>{{t
|
|
65
|
+
'common.search.loading'
|
|
66
|
+
}}</AuLoader>
|
|
65
67
|
<span class='au-u-hidden-visually'>{{t
|
|
66
68
|
'citaten-plugin.alert.loading'
|
|
67
69
|
}}</span>
|
|
@@ -6,7 +6,6 @@ import { trackedReset } from 'tracked-toolbox';
|
|
|
6
6
|
import { trackedTask } from 'reactiveweb/ember-concurrency';
|
|
7
7
|
import { service } from '@ember/service';
|
|
8
8
|
import { on } from '@ember/modifier';
|
|
9
|
-
import type { SafeString } from '@ember/template/-private/handlebars';
|
|
10
9
|
import not from 'ember-truth-helpers/helpers/not';
|
|
11
10
|
import eq from 'ember-truth-helpers/helpers/eq';
|
|
12
11
|
import IntlService from 'ember-intl/services/intl';
|
|
@@ -35,6 +34,7 @@ import {
|
|
|
35
34
|
import { type Point } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
|
|
36
35
|
import { type NodeContentsUtils } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node-contents';
|
|
37
36
|
import { type LocationType } from './map';
|
|
37
|
+
import { type SafeString } from '@ember/template';
|
|
38
38
|
|
|
39
39
|
interface Message {
|
|
40
40
|
skin: AuAlertSignature['Args']['skin'];
|
|
@@ -245,12 +245,12 @@ export default class LocationPluginInsertComponent extends Component<Signature>
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
if (toInsert) {
|
|
248
|
+
this.modalOpen = false;
|
|
248
249
|
replaceSelectionWithLocation(
|
|
249
250
|
this.controller,
|
|
250
251
|
toInsert,
|
|
251
252
|
this.args.config.subjectTypesToLinkTo,
|
|
252
253
|
);
|
|
253
|
-
this.modalOpen = false;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -283,7 +283,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
283
283
|
{{#each this.vertices as |vertex index|}}
|
|
284
284
|
<layers.marker
|
|
285
285
|
@location={{vertex}}
|
|
286
|
-
@onClick={{
|
|
286
|
+
@onClick={{fn this.onVertexClick index}}
|
|
287
287
|
as |marker|
|
|
288
288
|
>
|
|
289
289
|
{{#if (eq index 0)}}
|
|
@@ -300,7 +300,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
|
|
|
300
300
|
{{/if}}
|
|
301
301
|
{{#if (areaLocations @locationType @existingArea)}}
|
|
302
302
|
<layers.polygon
|
|
303
|
-
@locations={{
|
|
303
|
+
@locations={{areaLocations @locationType @existingArea}}
|
|
304
304
|
/>
|
|
305
305
|
{{/if}}
|
|
306
306
|
</MapWrapper>
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
{{#if @isLoading}}
|
|
22
22
|
<tr>
|
|
23
23
|
<td colspan='100%' class='is-loading-data'>
|
|
24
|
-
<AuLoader
|
|
25
|
-
|
|
24
|
+
<AuLoader>
|
|
25
|
+
{{t 'editor-plugins.utils.loading'}}
|
|
26
|
+
</AuLoader>
|
|
26
27
|
</td>
|
|
27
28
|
</tr>
|
|
28
29
|
{{else}}
|
|
@@ -32,7 +32,7 @@ import { recalculateNumbers } from '@lblod/ember-rdfa-editor-lblod-plugins/plugi
|
|
|
32
32
|
import { createSnippetPlaceholder } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/nodes/snippet-placeholder';
|
|
33
33
|
import { hasDecendant } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/has-descendant';
|
|
34
34
|
import SnippetPlaceholder from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/nodes/placeholder';
|
|
35
|
-
import {
|
|
35
|
+
import { getSnippetListUrisFromNode } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/utils/rdfa-predicate';
|
|
36
36
|
|
|
37
37
|
interface ButtonSig {
|
|
38
38
|
Args: {
|
|
@@ -129,7 +129,7 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
129
129
|
const node = createSnippetPlaceholder({
|
|
130
130
|
listProperties: {
|
|
131
131
|
placeholderId: this.node.attrs.placeholderId,
|
|
132
|
-
|
|
132
|
+
listUris: getSnippetListUrisFromNode(this.node),
|
|
133
133
|
names: this.node.attrs.snippetListNames,
|
|
134
134
|
importedResources: this.node.attrs.importedResources,
|
|
135
135
|
},
|
|
@@ -200,7 +200,7 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
200
200
|
title,
|
|
201
201
|
listProperties: {
|
|
202
202
|
placeholderId: this.node.attrs.placeholderId,
|
|
203
|
-
|
|
203
|
+
listUris: getSnippetListUrisFromNode(this.node),
|
|
204
204
|
names: this.node.attrs.snippetListNames,
|
|
205
205
|
importedResources: this.node.attrs.importedResources,
|
|
206
206
|
},
|
|
@@ -259,7 +259,7 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
259
259
|
@closeModal={{this.closeModal}}
|
|
260
260
|
@config={{this.node.attrs.config}}
|
|
261
261
|
@onInsert={{this.onInsert}}
|
|
262
|
-
@
|
|
262
|
+
@snippetListUris={{getSnippetListUrisFromNode this.node}}
|
|
263
263
|
@snippetListNames={{this.node.attrs.snippetListNames}}
|
|
264
264
|
/>
|
|
265
265
|
</template>
|
|
@@ -11,7 +11,7 @@ import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plug
|
|
|
11
11
|
|
|
12
12
|
interface Args {
|
|
13
13
|
config: SnippetPluginConfig;
|
|
14
|
-
|
|
14
|
+
snippetListUris: string[] | undefined;
|
|
15
15
|
snippetListNames: string[] | undefined;
|
|
16
16
|
closeModal: () => void;
|
|
17
17
|
open: boolean;
|
|
@@ -69,7 +69,7 @@ export default class SnippetPluginSearchModalComponent extends Component<Args> {
|
|
|
69
69
|
abortSignal: abortController.signal,
|
|
70
70
|
filter: {
|
|
71
71
|
name: this.inputSearchText ?? undefined,
|
|
72
|
-
|
|
72
|
+
snippetListUris: this.args.snippetListUris ?? undefined,
|
|
73
73
|
},
|
|
74
74
|
pagination: {
|
|
75
75
|
pageNumber: this.pageNumber,
|
|
@@ -92,7 +92,7 @@ export default class SnippetPluginSearchModalComponent extends Component<Args> {
|
|
|
92
92
|
this.inputSearchText,
|
|
93
93
|
this.pageNumber,
|
|
94
94
|
this.pageSize,
|
|
95
|
-
this.args.
|
|
95
|
+
this.args.snippetListUris,
|
|
96
96
|
]);
|
|
97
97
|
|
|
98
98
|
@action
|
|
@@ -64,7 +64,7 @@ export default class SnippetPluginSnippetInsertPlaceholder extends Component<Sig
|
|
|
64
64
|
@icon={{AddIcon}}
|
|
65
65
|
@iconAlignment='left'
|
|
66
66
|
@skin='link'
|
|
67
|
-
@disabled={{
|
|
67
|
+
@disabled={{not this.placeholderNode}}
|
|
68
68
|
{{on 'click' this.openModal}}
|
|
69
69
|
>
|
|
70
70
|
{{t 'snippet-plugin.insert.placeholder'}}
|
|
@@ -72,7 +72,7 @@ export default class SnippetPluginSnippetInsertPlaceholder extends Component<Sig
|
|
|
72
72
|
</li>
|
|
73
73
|
<SnippetListModal
|
|
74
74
|
@config={{@config}}
|
|
75
|
-
@
|
|
75
|
+
@snippetListUris={{empty}}
|
|
76
76
|
@allowMultipleSnippets={{false}}
|
|
77
77
|
@onSaveSnippetLists={{this.insertPlaceholder}}
|
|
78
78
|
@open={{this.isModalOpen}}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type SnippetPluginConfig,
|
|
8
8
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
9
9
|
import { findParentNodeClosestToPos } from '@curvenote/prosemirror-utils';
|
|
10
|
-
import {
|
|
10
|
+
import { getSnippetListUrisFromNode } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/utils/rdfa-predicate';
|
|
11
11
|
import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
|
|
12
12
|
import SnippetInsert from './snippet-insert';
|
|
13
13
|
|
|
@@ -22,11 +22,11 @@ interface Sig {
|
|
|
22
22
|
export default class SnippetInsertRdfaComponent extends Component<Sig> {
|
|
23
23
|
get listProperties(): SnippetListProperties | undefined {
|
|
24
24
|
const activeNode = this.args.node.value;
|
|
25
|
-
const
|
|
25
|
+
const listUris = getSnippetListUrisFromNode(activeNode);
|
|
26
26
|
|
|
27
|
-
if (
|
|
27
|
+
if (listUris.length > 0) {
|
|
28
28
|
return {
|
|
29
|
-
|
|
29
|
+
listUris,
|
|
30
30
|
placeholderId: activeNode.attrs.placeholderId,
|
|
31
31
|
names: activeNode.attrs.snippetListNames,
|
|
32
32
|
importedResources: activeNode.attrs.importedResources,
|
|
@@ -44,11 +44,11 @@ export default class SnippetInsertRdfaComponent extends Component<Sig> {
|
|
|
44
44
|
isResourceNode(node),
|
|
45
45
|
);
|
|
46
46
|
while (parentNode) {
|
|
47
|
-
const
|
|
47
|
+
const listUris = getSnippetListUrisFromNode(parentNode.node);
|
|
48
48
|
|
|
49
|
-
if (
|
|
49
|
+
if (listUris.length > 0) {
|
|
50
50
|
return {
|
|
51
|
-
|
|
51
|
+
listUris,
|
|
52
52
|
placeholderId: parentNode.node.attrs.placeholderId,
|
|
53
53
|
names: parentNode.node.attrs.snippetListNames,
|
|
54
54
|
importedResources: parentNode.node.attrs.importedResources,
|
|
@@ -31,7 +31,7 @@ export default class SnippetInsertComponent extends Component<Sig> {
|
|
|
31
31
|
return this.args.controller;
|
|
32
32
|
}
|
|
33
33
|
get disabled() {
|
|
34
|
-
return (this.args.listProperties?.
|
|
34
|
+
return (this.args.listProperties?.listUris.length ?? 0) === 0;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@action
|
|
@@ -88,7 +88,7 @@ export default class SnippetInsertComponent extends Component<Sig> {
|
|
|
88
88
|
@closeModal={{this.closeModal}}
|
|
89
89
|
@config={{@config}}
|
|
90
90
|
@onInsert={{this.onInsert}}
|
|
91
|
-
@
|
|
91
|
+
@snippetListUris={{@listProperties.listUris}}
|
|
92
92
|
@snippetListNames={{@listProperties.names}}
|
|
93
93
|
/>
|
|
94
94
|
</template>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
{{else}}
|
|
20
20
|
<SnippetPlugin::SnippetList::SnippetListView
|
|
21
21
|
@snippetLists={{this.snippetListResource.value}}
|
|
22
|
-
@
|
|
22
|
+
@snippetListUris={{this.snippetListUris}}
|
|
23
23
|
@listNameFilter={{this.nameFilterText}}
|
|
24
24
|
@sort={{this.sort}}
|
|
25
25
|
@onChange={{this.onChange}}
|
|
@@ -23,7 +23,7 @@ interface Signature {
|
|
|
23
23
|
lists: SnippetList[],
|
|
24
24
|
allowMultipleSnippets: boolean,
|
|
25
25
|
) => void;
|
|
26
|
-
|
|
26
|
+
snippetListUris: string[] | undefined;
|
|
27
27
|
closeModal: () => void;
|
|
28
28
|
open: boolean;
|
|
29
29
|
allowMultipleSnippets?: boolean;
|
|
@@ -40,8 +40,8 @@ export default class SnippetListModalComponent extends Component<Signature> {
|
|
|
40
40
|
// Display
|
|
41
41
|
@tracked error: unknown;
|
|
42
42
|
|
|
43
|
-
@trackedReset('args.
|
|
44
|
-
|
|
43
|
+
@trackedReset('args.snippetListUris')
|
|
44
|
+
snippetListUris: string[] = [...(this.args.snippetListUris ?? [])];
|
|
45
45
|
|
|
46
46
|
@localCopy('args.allowMultipleSnippets') allowMultipleSnippets = false;
|
|
47
47
|
|
|
@@ -63,7 +63,7 @@ export default class SnippetListModalComponent extends Component<Signature> {
|
|
|
63
63
|
@action
|
|
64
64
|
saveAndClose() {
|
|
65
65
|
const snippetLists = this.snippetListResource.value?.filter((snippetList) =>
|
|
66
|
-
this.
|
|
66
|
+
this.snippetListUris.includes(snippetList.uri),
|
|
67
67
|
);
|
|
68
68
|
this.args.onSaveSnippetLists(
|
|
69
69
|
snippetLists || [],
|
|
@@ -71,7 +71,7 @@ export default class SnippetListModalComponent extends Component<Signature> {
|
|
|
71
71
|
);
|
|
72
72
|
this.args.closeModal();
|
|
73
73
|
// Clear selection for next time
|
|
74
|
-
this.
|
|
74
|
+
this.snippetListUris = [];
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
snippetListSearch = restartableTask(async () => {
|
|
@@ -105,7 +105,7 @@ export default class SnippetListModalComponent extends Component<Signature> {
|
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
@action
|
|
108
|
-
onChange(
|
|
109
|
-
this.
|
|
108
|
+
onChange(snippetListUris: string[]) {
|
|
109
|
+
this.snippetListUris = snippetListUris;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
<td class='snippet-list-table-select-column'>
|
|
53
53
|
<AuCheckbox
|
|
54
54
|
id={{row.label}}
|
|
55
|
-
@onChange={{fn this.onChange row.
|
|
56
|
-
@checked={{in-array @
|
|
55
|
+
@onChange={{fn this.onChange row.uri}}
|
|
56
|
+
@checked={{in-array @snippetListUris row.uri}}
|
|
57
57
|
/>
|
|
58
58
|
</td>
|
|
59
59
|
<td>{{row.label}}</td>
|
|
@@ -4,26 +4,26 @@ import { SnippetList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snip
|
|
|
4
4
|
|
|
5
5
|
interface Args {
|
|
6
6
|
snippetLists: SnippetList[];
|
|
7
|
-
|
|
7
|
+
snippetListUris: string[];
|
|
8
8
|
listNameFilter: string | null;
|
|
9
9
|
isLoading: boolean;
|
|
10
|
-
onChange: (
|
|
10
|
+
onChange: (snippetListUris: string[]) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export default class SnippetListViewComponent extends Component<Args> {
|
|
14
14
|
@action
|
|
15
|
-
onChange(
|
|
15
|
+
onChange(snippetUri: string, isSelected: boolean) {
|
|
16
16
|
if (isSelected) {
|
|
17
|
-
const
|
|
17
|
+
const newSnippetListUris = [...this.args.snippetListUris, snippetUri];
|
|
18
18
|
|
|
19
|
-
return this.args.onChange(
|
|
19
|
+
return this.args.onChange(newSnippetListUris);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
(
|
|
22
|
+
const newSnippetListUris = this.args.snippetListUris.filter(
|
|
23
|
+
(uri) => uri !== snippetUri,
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
return this.args.onChange(
|
|
26
|
+
return this.args.onChange(newSnippetListUris);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@action
|
|
@@ -40,15 +40,15 @@ export default class SnippetListViewComponent extends Component<Args> {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const snippetListUri = snippetList.uri;
|
|
44
44
|
|
|
45
|
-
if (!
|
|
45
|
+
if (!snippetListUri) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const isSelected = this.args.
|
|
49
|
+
const isSelected = this.args.snippetListUris.includes(snippetListUri);
|
|
50
50
|
|
|
51
|
-
this.onChange(
|
|
51
|
+
this.onChange(snippetListUri, !isSelected);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
get snippetLists() {
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
type SnippetList,
|
|
17
17
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
getAssignedSnippetListsUrisFromProperties,
|
|
20
|
+
getSnippetListUrisProperties,
|
|
21
21
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/utils/rdfa-predicate';
|
|
22
22
|
import { updateSnippetPlaceholder } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/commands';
|
|
23
23
|
|
|
@@ -49,13 +49,13 @@ export default class SnippetListSelect extends Component<Signature> {
|
|
|
49
49
|
return isResourceNode(this.args.node.value);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
get
|
|
53
|
-
return
|
|
52
|
+
get snippetListUrisProperties(): OutgoingTriple[] {
|
|
53
|
+
return getSnippetListUrisProperties(this.args.node.value);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
get
|
|
57
|
-
return
|
|
58
|
-
this.
|
|
56
|
+
get snippetListUris(): string[] {
|
|
57
|
+
return getAssignedSnippetListsUrisFromProperties(
|
|
58
|
+
this.snippetListUrisProperties,
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -73,7 +73,7 @@ export default class SnippetListSelect extends Component<Signature> {
|
|
|
73
73
|
this.args.controller?.doCommand(
|
|
74
74
|
updateSnippetPlaceholder({
|
|
75
75
|
resource: this.currentResource,
|
|
76
|
-
oldSnippetProperties: this.
|
|
76
|
+
oldSnippetProperties: this.snippetListUrisProperties ?? [],
|
|
77
77
|
newSnippetLists: lists,
|
|
78
78
|
oldImportedResources: this.imported,
|
|
79
79
|
node: this.args.node,
|
|
@@ -99,7 +99,7 @@ export default class SnippetListSelect extends Component<Signature> {
|
|
|
99
99
|
|
|
100
100
|
<SnippetListModal
|
|
101
101
|
@config={{@config}}
|
|
102
|
-
@
|
|
102
|
+
@snippetListUris={{this.snippetListUris}}
|
|
103
103
|
@onSaveSnippetLists={{this.onSaveSnippetLists}}
|
|
104
104
|
@allowMultipleSnippets={{this.allowMultipleSnippets}}
|
|
105
105
|
@open={{this.showModal}}
|
|
@@ -34,7 +34,6 @@ export default class DateTimePickerComponent extends Component<Args> {
|
|
|
34
34
|
monthSelectLabel: this.intl.t('au-date-picker.month-select-label'),
|
|
35
35
|
yearSelectLabel: this.intl.t('au-date-picker.year-select-label'),
|
|
36
36
|
closeLabel: this.intl.t('au-date-picker.close-label'),
|
|
37
|
-
keyboardInstruction: this.intl.t('au-date-picker.keyboard-instruction'),
|
|
38
37
|
calendarHeading: this.intl.t('au-date-picker.calendar-heading'),
|
|
39
38
|
dayNames: getLocalizedDays(this.intl),
|
|
40
39
|
monthNames: getLocalizedMonths(this.intl),
|