@lblod/ember-rdfa-editor-lblod-plugins 17.1.0 → 17.1.1-dev.4dfeb71979c54e1971e5f5e97077495da1afb6e9

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 (154) hide show
  1. package/.changeset/afraid-tips-visit.md +5 -0
  2. package/.changeset/chilly-ravens-think.md +6 -0
  3. package/.changeset/great-lions-behave.md +17 -0
  4. package/.changeset/hot-owls-laugh.md +5 -0
  5. package/.changeset/loud-coins-bathe.md +5 -0
  6. package/.changeset/olive-pets-cheer.md +5 -0
  7. package/.changeset/smooth-fireants-doubt.md +5 -0
  8. package/.changeset/strange-ways-dance.md +5 -0
  9. package/.changeset/tall-carrots-ring.md +5 -0
  10. package/.changeset/wet-baboons-serve.md +5 -0
  11. package/.changeset/witty-suns-speak.md +5 -0
  12. package/.woodpecker/.release-commit.yml +18 -0
  13. package/.woodpecker/.release.yml +21 -0
  14. package/.woodpecker/.verify-pr.yml +30 -0
  15. package/CHANGELOG.md +8 -0
  16. package/Dockerfile +6 -4
  17. package/addon/commands/index.ts +1 -0
  18. package/addon/commands/replace-selection-and-select-node.ts +24 -0
  19. package/addon/components/article-structure-plugin/structure-card.hbs +35 -33
  20. package/addon/components/article-structure-plugin/structure-card.ts +44 -36
  21. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +40 -20
  22. package/addon/components/citation-plugin/citation-card.ts +6 -2
  23. package/addon/components/citation-plugin/citations/search-modal.ts +10 -9
  24. package/addon/components/import-snippet-plugin/card.ts +7 -2
  25. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +13 -5
  26. package/addon/components/snippet-plugin/snippet-insert-rdfa.hbs +7 -0
  27. package/addon/components/snippet-plugin/snippet-insert-rdfa.ts +78 -0
  28. package/addon/components/snippet-plugin/snippet-insert.hbs +1 -0
  29. package/addon/components/snippet-plugin/snippet-insert.ts +22 -4
  30. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +3 -3
  31. package/addon/components/snippet-plugin/snippet-list/snippet-list-view.ts +13 -1
  32. package/addon/components/snippet-plugin/snippet-list-select-rdfa.hbs +8 -0
  33. package/addon/components/snippet-plugin/snippet-list-select-rdfa.ts +69 -0
  34. package/addon/components/standard-template-plugin/template-provider.ts +10 -4
  35. package/addon/components/variable-plugin/address/nodeview.hbs +2 -2
  36. package/addon/components/variable-plugin/address/nodeview.ts +6 -0
  37. package/addon/components/variable-plugin/address/utils.ts +28 -3
  38. package/addon/components/variable-plugin/codelist/edit.ts +24 -7
  39. package/addon/components/variable-plugin/codelist/insert.ts +52 -17
  40. package/addon/components/variable-plugin/date/date-time-picker.ts +10 -9
  41. package/addon/components/variable-plugin/date/edit.ts +43 -8
  42. package/addon/components/variable-plugin/date/insert-variable.ts +36 -10
  43. package/addon/components/variable-plugin/date/insert.ts +35 -10
  44. package/addon/components/variable-plugin/date/nodeview.hbs +2 -2
  45. package/addon/components/variable-plugin/date/nodeview.ts +8 -1
  46. package/addon/components/variable-plugin/insert-variable-card.ts +8 -1
  47. package/addon/components/variable-plugin/location/edit.ts +1 -9
  48. package/addon/components/variable-plugin/location/insert.ts +4 -7
  49. package/addon/components/variable-plugin/location/nodeview.hbs +18 -8
  50. package/addon/components/variable-plugin/location/nodeview.ts +37 -9
  51. package/addon/components/variable-plugin/number/insert.ts +34 -10
  52. package/addon/components/variable-plugin/number/nodeview.hbs +2 -2
  53. package/addon/components/variable-plugin/number/nodeview.ts +30 -5
  54. package/addon/components/variable-plugin/text/insert.ts +40 -12
  55. package/addon/components/variable-plugin/variable/nodeview.hbs +5 -2
  56. package/addon/components/variable-plugin/variable/nodeview.ts +13 -9
  57. package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +92 -16
  58. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +2 -1
  59. package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +71 -3
  60. package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +1 -1
  61. package/addon/plugins/article-structure-plugin/commands/set-structure-start-number.ts +8 -14
  62. package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +1 -1
  63. package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +197 -105
  64. package/addon/plugins/article-structure-plugin/index.ts +18 -9
  65. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +181 -71
  66. package/addon/plugins/article-structure-plugin/structures/article.ts +91 -98
  67. package/addon/plugins/article-structure-plugin/structures/chapter.ts +89 -39
  68. package/addon/plugins/article-structure-plugin/structures/index.ts +12 -1
  69. package/addon/plugins/article-structure-plugin/structures/section.ts +88 -39
  70. package/addon/plugins/article-structure-plugin/structures/structure-header-number.ts +56 -0
  71. package/addon/plugins/article-structure-plugin/structures/structure-header-title.ts +38 -0
  72. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +87 -73
  73. package/addon/plugins/article-structure-plugin/structures/subsection.ts +81 -39
  74. package/addon/plugins/article-structure-plugin/structures/title.ts +91 -39
  75. package/addon/plugins/article-structure-plugin/utils/structure.ts +224 -128
  76. package/addon/plugins/citation-plugin/utils/cited-text.ts +38 -8
  77. package/addon/plugins/confidentiality-plugin/marks/redacted.ts +1 -1
  78. package/addon/plugins/document-title-plugin/nodes/document-title.ts +4 -3
  79. package/addon/plugins/roadsign-regulation-plugin/nodes.ts +4 -3
  80. package/addon/plugins/snippet-plugin/commands/index.ts +1 -0
  81. package/addon/plugins/snippet-plugin/commands/update-snippet-ids.ts +55 -0
  82. package/addon/plugins/snippet-plugin/index.ts +6 -1
  83. package/addon/plugins/snippet-plugin/utils/rdfa-predicate.ts +33 -0
  84. package/addon/plugins/standard-template-plugin/utils/nodes.ts +249 -156
  85. package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +3 -2
  86. package/addon/plugins/variable-plugin/utils/attribute-parsers.ts +19 -1
  87. package/addon/plugins/variable-plugin/variables/address.ts +93 -26
  88. package/addon/plugins/variable-plugin/variables/codelist.ts +99 -50
  89. package/addon/plugins/variable-plugin/variables/date.ts +138 -51
  90. package/addon/plugins/variable-plugin/variables/location.ts +2 -0
  91. package/addon/plugins/variable-plugin/variables/number.ts +99 -52
  92. package/addon/plugins/variable-plugin/variables/text.ts +80 -28
  93. package/addon/utils/_private/find-insertion-range.ts +18 -5
  94. package/addon/utils/dom-utils.ts +4 -0
  95. package/addon/utils/namespace.ts +63 -13
  96. package/app/components/snippet-plugin/snippet-list-insert-rdfa.js +1 -0
  97. package/app/components/snippet-plugin/snippet-list-select-rdfa.js +1 -0
  98. package/app/styles/article-structure-plugin.scss +106 -3
  99. package/declarations/addon/commands/index.d.ts +1 -0
  100. package/declarations/addon/commands/replace-selection-and-select-node.d.ts +3 -0
  101. package/declarations/addon/components/article-structure-plugin/structure-card.d.ts +2 -2
  102. package/declarations/addon/components/besluit-type-plugin/toolbar-dropdown.d.ts +0 -5
  103. package/declarations/addon/components/citation-plugin/citation-card.d.ts +2 -2
  104. package/declarations/addon/components/citation-plugin/citations/article-preview.d.ts +1 -1
  105. package/declarations/addon/components/citation-plugin/citations/search-modal.d.ts +1 -0
  106. package/declarations/addon/components/common/search/alert-load-error.d.ts +1 -1
  107. package/declarations/addon/components/common/search/alert-no-items.d.ts +1 -1
  108. package/declarations/addon/components/confidentiality-plugin/redact.d.ts +1 -1
  109. package/declarations/addon/components/import-snippet-plugin/card.d.ts +6 -5
  110. package/declarations/addon/components/pagination/pagination-view.d.ts +1 -1
  111. package/declarations/addon/components/snippet-plugin/snippet-insert-rdfa.d.ts +19 -0
  112. package/declarations/addon/components/snippet-plugin/snippet-insert.d.ts +2 -0
  113. package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-view.d.ts +1 -1
  114. package/declarations/addon/components/snippet-plugin/snippet-list-select-rdfa.d.ts +21 -0
  115. package/declarations/addon/components/variable-plugin/address/edit.d.ts +1 -1
  116. package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +1 -0
  117. package/declarations/addon/components/variable-plugin/date/date-time-picker.d.ts +1 -0
  118. package/declarations/addon/components/variable-plugin/date/edit.d.ts +2 -2
  119. package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +1 -0
  120. package/declarations/addon/components/variable-plugin/insert-variable-card.d.ts +8 -1
  121. package/declarations/addon/components/variable-plugin/location/edit.d.ts +0 -1
  122. package/declarations/addon/components/variable-plugin/location/nodeview.d.ts +8 -9
  123. package/declarations/addon/components/variable-plugin/number/nodeview.d.ts +3 -1
  124. package/declarations/addon/components/variable-plugin/text/insert.d.ts +1 -1
  125. package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +5 -6
  126. package/declarations/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +2 -2
  127. package/declarations/addon/plugins/article-structure-plugin/commands/set-structure-start-number.d.ts +5 -2
  128. package/declarations/addon/plugins/article-structure-plugin/commands/wrap-structure-content.d.ts +1 -1
  129. package/declarations/addon/plugins/article-structure-plugin/index.d.ts +17 -9
  130. package/declarations/addon/plugins/article-structure-plugin/structures/article-paragraph.d.ts +2 -0
  131. package/declarations/addon/plugins/article-structure-plugin/structures/article.d.ts +3 -4
  132. package/declarations/addon/plugins/article-structure-plugin/structures/index.d.ts +4 -0
  133. package/declarations/addon/plugins/article-structure-plugin/structures/structure-header-number.d.ts +2 -0
  134. package/declarations/addon/plugins/article-structure-plugin/structures/structure-header-title.d.ts +2 -0
  135. package/declarations/addon/plugins/article-structure-plugin/structures/structure-header.d.ts +16 -1
  136. package/declarations/addon/plugins/article-structure-plugin/utils/structure.d.ts +25 -13
  137. package/declarations/addon/plugins/confidentiality-plugin/marks/redacted.d.ts +1 -1
  138. package/declarations/addon/plugins/snippet-plugin/commands/index.d.ts +1 -0
  139. package/declarations/addon/plugins/snippet-plugin/commands/update-snippet-ids.d.ts +8 -0
  140. package/declarations/addon/plugins/snippet-plugin/index.d.ts +2 -0
  141. package/declarations/addon/plugins/snippet-plugin/utils/rdfa-predicate.d.ts +5 -0
  142. package/declarations/addon/plugins/standard-template-plugin/index.d.ts +8 -8
  143. package/declarations/addon/plugins/standard-template-plugin/utils/nodes.d.ts +9 -8
  144. package/declarations/addon/plugins/variable-plugin/utils/attribute-parsers.d.ts +3 -0
  145. package/declarations/addon/utils/_private/find-insertion-range.d.ts +7 -4
  146. package/declarations/addon/utils/dom-utils.d.ts +2 -0
  147. package/declarations/addon/utils/namespace.d.ts +11 -2
  148. package/package.json +15 -8
  149. package/pnpm-lock.yaml +17788 -0
  150. package/translations/appuniversum/en-us.yaml +11 -0
  151. package/translations/appuniversum/nl-be.yaml +11 -0
  152. package/tsconfig.main.json +0 -3
  153. package/types/graphy/memory.dataset.fast.d.ts +74 -0
  154. package/.woodpecker/.test.yml +0 -50
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': patch
3
+ ---
4
+
5
+ Remove `@import "ember-appuniversum"` statements from plugin sass modules in order to prevent style overrding.
@@ -0,0 +1,6 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ - Addition of the `say-template-comment` class to the static version of template comments.
6
+ - Addition of some extra styles to the `say-template-comment` class.
@@ -0,0 +1,17 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": major
3
+ ---
4
+
5
+ ### RDFa aware editing
6
+
7
+ This release adapts plugins
8
+ to [RDFa (RDF in Attributes)](https://github.com/lblod/ember-rdfa-editor/blob/9c32a9dea0da13df4092c39d9a092ba0803a3f42/README.md#experimental-a-new-approach-to-handle-rdfa-in-documents)
9
+ aware editing, based on the changes in `ember-rdfa-editor`
10
+ version [9.6.0](https://github.com/lblod/ember-rdfa-editor/releases/tag/v9.6.0)
11
+
12
+ #### N.B. This release is not compatible with `ember-rdfa-editor` configurations that don't use ` rdfaAware` features, see [editor documentation](https://github.com/lblod/ember-rdfa-editor/blob/9c32a9dea0da13df4092c39d9a092ba0803a3f42/README.md#experimental-a-new-approach-to-handle-rdfa-in-documents) for more.
13
+
14
+ #### Changes
15
+
16
+ * Plugins now use RDFa aware specs when rendering to HTML, and they also expect RDFa aware specs when parsing from HTML.
17
+ * Introduces RDFa aware version of `snippet-plugin`, that allows to record allowed snippet list IDs on a resource node level in the document.
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': patch
3
+ ---
4
+
5
+ GN-4650: Fix behavior of "Insert snippet" button
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": patch
3
+ ---
4
+
5
+ article-structure-plugin: Make `setStartNumber` and `getStartNumber` properties optional
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ GN-4650: Snippet selection placeholder in template
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': minor
3
+ ---
4
+
5
+ Add helper function to help with locale selection and add translation note to readme
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": patch
3
+ ---
4
+
5
+ GN-4818: Add missing translations for date picker
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': patch
3
+ ---
4
+
5
+ Fix template-comment padding
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": minor
3
+ ---
4
+
5
+ Ensure that variables are node-selected/focused after insertion
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": patch
3
+ ---
4
+
5
+ Allow to insert structure even if insertion range does not have RDFA attributes.
@@ -0,0 +1,18 @@
1
+ steps:
2
+ install:
3
+ image: node:20-slim
4
+ commands:
5
+ - corepack enable
6
+ - pnpm i --frozen-lockfile
7
+ version:
8
+ image: node:20-slim
9
+ commands:
10
+ - npm version --no-git-tag-version $(npm pkg get version | sed 's/"//g')-dev.${CI_COMMIT_SHA}
11
+ release:
12
+ image: plugins/npm
13
+ settings:
14
+ token:
15
+ from_secret: npm_access_token
16
+ tag: dev
17
+ when:
18
+ - event: push
@@ -0,0 +1,21 @@
1
+ steps:
2
+ install:
3
+ image: node:20-slim
4
+ commands:
5
+ - corepack enable
6
+ - pnpm i --frozen-lockfile
7
+ release:
8
+ image: plugins/npm
9
+ settings:
10
+ token:
11
+ from_secret: npm_access_token
12
+ push-tagged-build:
13
+ image: plugins/docker
14
+ settings:
15
+ repo: lblod/ember-rdfa-editor-lblod-plugins
16
+ tags: '${CI_COMMIT_TAG##v}'
17
+ purge: true
18
+ secrets: [docker_username, docker_password]
19
+ when:
20
+ event: tag
21
+ ref: refs/tags/v*
@@ -0,0 +1,30 @@
1
+ steps:
2
+ install:
3
+ image: node:20-slim
4
+ commands:
5
+ - corepack enable
6
+ - pnpm i --frozen-lockfile
7
+ lint-js:
8
+ image: node:20-slim
9
+ group: lint
10
+ commands:
11
+ - corepack enable
12
+ - pnpm lint:js
13
+ lint-hbs:
14
+ image: node:20-slim
15
+ group: lint
16
+ commands:
17
+ - corepack enable
18
+ - pnpm lint:hbs
19
+ test:
20
+ image: danlynn/ember-cli:4.12.1
21
+ commands:
22
+ - corepack enable
23
+ - pnpm test:ember
24
+ precompile:
25
+ image: node:20-slim
26
+ commands:
27
+ - corepack enable
28
+ - pnpm prepack
29
+ when:
30
+ - evaluate: 'CI_PIPELINE_EVENT == "pull_request" && not (CI_COMMIT_PULL_REQUEST_LABELS contains "dependabot")'
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 17.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#415](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/415) [`dff79133f9072cb1a817ed73588ffe8dea315479`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/dff79133f9072cb1a817ed73588ffe8dea315479) Thanks [@elpoelma](https://github.com/elpoelma)! - When passing a `content` argument to the `insertStructure` command, do not run the `wrapStructureContent` command
8
+
9
+ - [#416](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/416) [`4b40cafe3aee7846e44f0a5be7c5330ced28736e`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/4b40cafe3aee7846e44f0a5be7c5330ced28736e) Thanks [@dkozickis](https://github.com/dkozickis)! - GN-4816: Fix selecting snippet list when pressing on a checkbox
10
+
3
11
  ## 17.1.0
4
12
 
5
13
  ### Minor Changes
package/Dockerfile CHANGED
@@ -1,12 +1,14 @@
1
- FROM madnificent/ember:4.12.1-node_18 as builder
1
+ FROM node:20-slim AS builder
2
2
 
3
3
  LABEL maintainer="info@redpencil.io"
4
4
 
5
+ RUN corepack enable
6
+ RUN corepack prepare pnpm@latest-8 --activate
5
7
  WORKDIR /app
6
- COPY package.json package-lock.json ./
7
- RUN npm ci
8
+ COPY package.json pnpm-lock.yaml ./
9
+ RUN pnpm i --frozen-lockfile
8
10
  COPY . .
9
- RUN ember build -prod
11
+ RUN pnpm build
10
12
 
11
13
  FROM semtech/static-file-service:0.2.0
12
14
  COPY --from=builder /app/dist /data
@@ -0,0 +1 @@
1
+ export { default as replaceSelectionWithAndSelectNode } from './replace-selection-and-select-node';
@@ -0,0 +1,24 @@
1
+ import { Command, NodeSelection, PNode } from '@lblod/ember-rdfa-editor';
2
+
3
+ const replaceSelectionWithAndSelectNode = (node: PNode): Command => {
4
+ return (state, dispatch) => {
5
+ if (!node.type.spec.selectable) {
6
+ return false;
7
+ }
8
+
9
+ if (dispatch) {
10
+ const tr = state.tr;
11
+ tr.replaceSelectionWith(node);
12
+ if (tr.selection.$anchor.nodeBefore) {
13
+ const resolvedPos = tr.doc.resolve(
14
+ tr.selection.anchor - tr.selection.$anchor.nodeBefore?.nodeSize,
15
+ );
16
+ tr.setSelection(new NodeSelection(resolvedPos));
17
+ }
18
+ dispatch(tr);
19
+ }
20
+ return true;
21
+ };
22
+ };
23
+
24
+ export default replaceSelectionWithAndSelectNode;
@@ -80,39 +80,41 @@
80
80
 
81
81
  </AuButtonGroup>
82
82
  </Item>
83
- <Item class="au-u-padding-left-small">
84
- <AuFormRow>
85
- {{#let (unique-id) as |id|}}
86
- <AuLabel for={{id}}>
87
- {{t 'article-structure-plugin.start-number.start-number'}}
88
- </AuLabel>
89
- <AuInput
90
- id={{id}}
91
- value={{this.startNumberInputValue}}
92
- {{on "change" this.onStartNumberChange}}
93
- placeholder={{t 'article-structure-plugin.start-number.start-number'}}
94
- type="number"
95
- min="1"
96
- />
97
- {{/let}}
98
- </AuFormRow>
99
- <AuButton
100
- @iconAlignment="left"
101
- class="au-u-margin-top-tiny"
102
- {{on 'click' this.setStructureStartNumber}}
103
- >
104
- {{t 'article-structure-plugin.start-number.set'}}
105
- </AuButton>
106
- <AuButton
107
- @iconAlignment="left"
108
- @skin="secondary"
109
- @disabled={{not this.structureStartNumber}}
110
- class="au-u-margin-top-tiny"
111
- {{on 'click' this.resetStructureStartNumber}}
112
- >
113
- {{t 'article-structure-plugin.start-number.reset'}}
114
- </AuButton>
115
- </Item>
83
+ {{#if this.currentStructureType.getStartNumber}}
84
+ <Item class="au-u-padding-left-small">
85
+ <AuFormRow>
86
+ {{#let (unique-id) as |id|}}
87
+ <AuLabel for={{id}}>
88
+ {{t 'article-structure-plugin.start-number.start-number'}}
89
+ </AuLabel>
90
+ <AuInput
91
+ id={{id}}
92
+ value={{this.startNumberInputValue}}
93
+ {{on "change" this.onStartNumberChange}}
94
+ placeholder={{t 'article-structure-plugin.start-number.start-number'}}
95
+ type="number"
96
+ min="1"
97
+ />
98
+ {{/let}}
99
+ </AuFormRow>
100
+ <AuButton
101
+ @iconAlignment="left"
102
+ class="au-u-margin-top-tiny"
103
+ {{on 'click' this.setStructureStartNumber}}
104
+ >
105
+ {{t 'article-structure-plugin.start-number.set'}}
106
+ </AuButton>
107
+ <AuButton
108
+ @iconAlignment="left"
109
+ @skin="secondary"
110
+ @disabled={{not this.structureStartNumber}}
111
+ class="au-u-margin-top-tiny"
112
+ {{on 'click' this.resetStructureStartNumber}}
113
+ >
114
+ {{t 'article-structure-plugin.start-number.reset'}}
115
+ </AuButton>
116
+ </Item>
117
+ {{/if}}
116
118
  </AuList>
117
119
  </c.content>
118
120
  </AuCard>
@@ -42,11 +42,45 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
42
42
  this.controller.focus();
43
43
  }
44
44
 
45
+ @action
46
+ removeStructure(withContent: boolean) {
47
+ if (this.structure && this.currentStructureType) {
48
+ if (withContent || this.currentStructureType.noUnwrap) {
49
+ this.controller.doCommand(
50
+ removeStructure(this.structure, this.structureTypes),
51
+ { view: this.controller.mainEditorView },
52
+ );
53
+ } else {
54
+ this.controller.doCommand(
55
+ unwrapStructure(
56
+ {
57
+ ...this.structure,
58
+ type: this.currentStructureType,
59
+ },
60
+ this.structureTypes,
61
+ ),
62
+ { view: this.controller.mainEditorView },
63
+ );
64
+ }
65
+ }
66
+ this.controller.focus();
67
+ }
68
+
69
+ @action
70
+ setRemoveStructureContent(value: boolean) {
71
+ this.removeStructureContent = value;
72
+ }
73
+
45
74
  @action
46
75
  setStructureStartNumber() {
47
- if (this.startNumber) {
76
+ if (this.startNumber && this.structure && this.currentStructureType) {
48
77
  this.controller.doCommand(
49
- setStructureStartNumber(this.structureTypes, this.startNumber),
78
+ setStructureStartNumber(
79
+ this.structure,
80
+ this.structureTypes,
81
+ this.startNumber,
82
+ ),
83
+ { view: this.controller.mainEditorView },
50
84
  );
51
85
 
52
86
  this.startNumber = null;
@@ -55,11 +89,14 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
55
89
 
56
90
  @action
57
91
  resetStructureStartNumber() {
58
- this.controller.doCommand(
59
- setStructureStartNumber(this.structureTypes, null),
60
- );
92
+ if (this.structure) {
93
+ this.controller.doCommand(
94
+ setStructureStartNumber(this.structure, this.structureTypes, null),
95
+ { view: this.controller.mainEditorView },
96
+ );
61
97
 
62
- this.startNumber = null;
98
+ this.startNumber = null;
99
+ }
63
100
  }
64
101
 
65
102
  get structureNumber() {
@@ -74,7 +111,7 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
74
111
  }
75
112
 
76
113
  get structureStartNumber() {
77
- if (this.structure && this.currentStructureType) {
114
+ if (this.structure && this.currentStructureType?.getStartNumber) {
78
115
  return this.currentStructureType.getStartNumber({
79
116
  pos: this.structure.pos,
80
117
  transaction: this.controller.mainEditorState.tr,
@@ -93,35 +130,6 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
93
130
  this.startNumber = parseInt(target.value);
94
131
  };
95
132
 
96
- @action
97
- removeStructure(withContent: boolean) {
98
- if (this.structure && this.currentStructureType) {
99
- if (withContent || this.currentStructureType.noUnwrap) {
100
- this.controller.doCommand(
101
- removeStructure(this.structure, this.structureTypes),
102
- { view: this.controller.mainEditorView },
103
- );
104
- } else {
105
- this.controller.doCommand(
106
- unwrapStructure(
107
- {
108
- ...this.structure,
109
- type: this.currentStructureType,
110
- },
111
- this.structureTypes,
112
- ),
113
- { view: this.controller.mainEditorView },
114
- );
115
- }
116
- }
117
- this.controller.focus();
118
- }
119
-
120
- @action
121
- setRemoveStructureContent(value: boolean) {
122
- this.removeStructureContent = value;
123
- }
124
-
125
133
  get structureTypes() {
126
134
  return this.args.options;
127
135
  }
@@ -1,13 +1,10 @@
1
1
  import { tracked } from '@glimmer/tracking';
2
2
  import Component from '@glimmer/component';
3
3
  import { action } from '@ember/object';
4
- import {
5
- addType,
6
- removeType,
7
- } from '@lblod/ember-rdfa-editor/commands/type-commands';
4
+ import { addProperty, removeProperty } from '@lblod/ember-rdfa-editor/commands';
8
5
  import { SayController } from '@lblod/ember-rdfa-editor';
6
+ import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
9
7
  import { ResolvedPNode } from '@lblod/ember-rdfa-editor/plugins/datastore';
10
- import { getRdfaAttribute } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
11
8
  import fetchBesluitTypes, {
12
9
  BesluitType,
13
10
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
@@ -15,17 +12,13 @@ import { findAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugi
15
12
  import { trackedFunction } from 'ember-resources/util/function';
16
13
  import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
17
14
  import { BesluitTypePluginOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin';
15
+ import { RDF } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
16
+ import { getOutgoingTripleList } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
18
17
  import { AlertTriangleIcon } from '@appuniversum/ember-appuniversum/components/icons/alert-triangle';
19
18
  import { CrossIcon } from '@appuniversum/ember-appuniversum/components/icons/cross';
20
19
  import { MailIcon } from '@appuniversum/ember-appuniversum/components/icons/mail';
21
20
  import { CircleXIcon } from '@appuniversum/ember-appuniversum/components/icons/circle-x';
22
21
 
23
- declare module 'ember__owner' {
24
- export default interface Owner {
25
- resolveRegistration(name: string): unknown;
26
- }
27
- }
28
-
29
22
  type Args = {
30
23
  controller: SayController;
31
24
  options: BesluitTypePluginOptions;
@@ -91,7 +84,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
91
84
  get currentBesluitURI() {
92
85
  if (this.currentBesluitRange) {
93
86
  const node = unwrap(this.doc.nodeAt(this.currentBesluitRange.from));
94
- return getRdfaAttribute(node, 'resource').pop();
87
+ return node.attrs['subject'] as string | undefined;
95
88
  }
96
89
  return;
97
90
  }
@@ -109,11 +102,21 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
109
102
  this.controller.mainEditorState.selection,
110
103
  this.controller.schema.nodes['besluit'],
111
104
  );
112
- const besluitTypeof = besluit?.node.attrs.typeof as string;
113
- const besluitTypesUris = besluitTypeof.split(' ');
114
- const besluitTypeRelevant = besluitTypesUris.find((type) =>
115
- type.includes('https://data.vlaanderen.be/id/concept/BesluitType/'),
116
- );
105
+ if (!besluit) {
106
+ console.warn(
107
+ `We have a besluit URI (${this.currentBesluitURI}), but can't find a besluit ancestor`,
108
+ );
109
+ return;
110
+ }
111
+ const besluitTypes = getOutgoingTripleList(besluit.node.attrs, RDF('type'));
112
+ const besluitTypeRelevant = besluitTypes.find(
113
+ (type) =>
114
+ type.object.termType === 'NamedNode' &&
115
+ type.object.value.includes(
116
+ 'https://data.vlaanderen.be/id/concept/BesluitType/',
117
+ ),
118
+ )?.object.value;
119
+
117
120
  if (besluitTypeRelevant) {
118
121
  this.previousBesluitType = besluitTypeRelevant;
119
122
  const besluitType = this.findBesluitTypeByURI(besluitTypeRelevant);
@@ -205,16 +208,33 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
205
208
  }
206
209
 
207
210
  insert() {
208
- if (this.besluitType && this.currentBesluitRange) {
211
+ const resource =
212
+ (this.currentBesluitRange &&
213
+ 'node' in this.currentBesluitRange &&
214
+ (this.currentBesluitRange.node.attrs.subject as string)) ||
215
+ undefined;
216
+ if (this.besluitType && resource) {
209
217
  this.cardExpanded = false;
210
218
  if (this.previousBesluitType) {
211
219
  this.controller.doCommand(
212
- removeType(this.currentBesluitRange.from, this.previousBesluitType),
220
+ removeProperty({
221
+ resource,
222
+ property: {
223
+ predicate: RDF('type').full,
224
+ object: sayDataFactory.namedNode(this.previousBesluitType),
225
+ },
226
+ }),
213
227
  { view: this.controller.mainEditorView },
214
228
  );
215
229
  }
216
230
  this.controller.doCommand(
217
- addType(this.currentBesluitRange.from, this.besluitType.uri),
231
+ addProperty({
232
+ resource,
233
+ property: {
234
+ predicate: RDF('type').full,
235
+ object: sayDataFactory.namedNode(this.besluitType.uri),
236
+ },
237
+ }),
218
238
  { view: this.controller.mainEditorView },
219
239
  );
220
240
  }
@@ -14,7 +14,11 @@ import {
14
14
  CitationPlugin,
15
15
  CitationPluginEmberComponentConfig,
16
16
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
17
- import { SayController, Transaction } from '@lblod/ember-rdfa-editor';
17
+ import {
18
+ DecorationSet,
19
+ SayController,
20
+ Transaction,
21
+ } from '@lblod/ember-rdfa-editor';
18
22
  import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
19
23
  import {
20
24
  LEGISLATION_TYPE_CONCEPTS,
@@ -80,7 +84,7 @@ export default class CitationCardComponent extends Component<Args> {
80
84
  return this.args.config;
81
85
  }
82
86
 
83
- get decorations() {
87
+ get decorations(): DecorationSet | undefined {
84
88
  return this.plugin.getState(this.controller.mainEditorState)?.highlights;
85
89
  }
86
90
 
@@ -78,18 +78,19 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
78
78
 
79
79
  get datePickerLocalization() {
80
80
  return {
81
- buttonLabel: this.intl.t('auDatePicker.buttonLabel'),
82
- selectedDateMessage: this.intl.t('auDatePicker.selectedDateMessage'),
83
- prevMonthLabel: this.intl.t('auDatePicker.prevMonthLabel'),
84
- nextMonthLabel: this.intl.t('auDatePicker.nextMonthLabel'),
85
- monthSelectLabel: this.intl.t('auDatePicker.monthSelectLabel'),
86
- yearSelectLabel: this.intl.t('auDatePicker.yearSelectLabel'),
87
- closeLabel: this.intl.t('auDatePicker.closeLabel'),
88
- keyboardInstruction: this.intl.t('auDatePicker.keyboardInstruction'),
89
- calendarHeading: this.intl.t('auDatePicker.calendarHeading'),
81
+ buttonLabel: this.intl.t('au-date-picker.button-label'),
82
+ selectedDateMessage: this.intl.t('au-date-picker.selected-date-message'),
83
+ prevMonthLabel: this.intl.t('au-date-picker.prev-month-label'),
84
+ nextMonthLabel: this.intl.t('au-date-picker.next-month-label'),
85
+ monthSelectLabel: this.intl.t('au-date-picker.month-select-label'),
86
+ yearSelectLabel: this.intl.t('au-date-picker.year-select-label'),
87
+ closeLabel: this.intl.t('au-date-picker.close-label'),
88
+ keyboardInstruction: this.intl.t('au-date-picker.keyboard-instruction'),
89
+ calendarHeading: this.intl.t('au-date-picker.calendar-heading'),
90
90
  dayNames: getLocalizedDays(this.intl),
91
91
  monthNames: getLocalizedMonths(this.intl),
92
92
  monthNamesShort: getLocalizedMonths(this.intl, 'short'),
93
+ placeholder: this.intl.t('au-date-picker.placeholder'),
93
94
  };
94
95
  }
95
96
 
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
2
2
  import { service } from '@ember/service';
3
3
  import { action } from '@ember/object';
4
4
  import { ProseParser } from '@lblod/ember-rdfa-editor';
5
- import { SayController } from '@lblod/ember-rdfa-editor';
5
+ import { SayController } from '@lblod/ember-rdfa-editor/index';
6
6
  import ImportRdfaSnippet from '@lblod/ember-rdfa-editor-lblod-plugins/services/import-rdfa-snippet';
7
7
  import { RdfaSnippet } from '@lblod/ember-rdfa-editor-lblod-plugins/services/import-rdfa-snippet';
8
8
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
@@ -10,6 +10,11 @@ import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
10
10
  type Args = {
11
11
  controller: SayController;
12
12
  };
13
+
14
+ type InsertRange = {
15
+ from: number;
16
+ to: number;
17
+ };
13
18
  export default class ImportSnippetPluginCard extends Component<Args> {
14
19
  @service declare importRdfaSnippet: ImportRdfaSnippet;
15
20
 
@@ -21,7 +26,7 @@ export default class ImportSnippetPluginCard extends Component<Args> {
21
26
  return this.importRdfaSnippet.snippetsForType('roadsign');
22
27
  }
23
28
 
24
- get insertRange() {
29
+ get insertRange(): InsertRange {
25
30
  const { selection } = this.controller.mainEditorState;
26
31
  const besluit = findParentNodeOfType(this.controller.schema.nodes.besluit)(
27
32
  selection,
@@ -4,6 +4,8 @@ import Component from '@glimmer/component';
4
4
  import { tracked } from '@glimmer/tracking';
5
5
  import { SayController } from '@lblod/ember-rdfa-editor';
6
6
  import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
7
+ import { OutgoingTriple } from '@lblod/ember-rdfa-editor/core/rdfa-processor';
8
+ import { RDF } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
7
9
 
8
10
  /**
9
11
  * Card displaying a hint of the Date plugin
@@ -54,12 +56,18 @@ export default class RoadsignRegulationCard extends Component<Args> {
54
56
  const selection = this.controller.mainEditorState.selection;
55
57
  const besluitNode = findParentNode((node) => {
56
58
  if (node.type === this.schema.nodes['besluit']) {
57
- const rdfTypes = (node.attrs['typeof'] as string | undefined)?.split(
58
- ' ',
59
+ const properties = node.attrs.properties as OutgoingTriple[];
60
+ const decisionHasAcceptedType = Boolean(
61
+ properties.find((property) => {
62
+ const { predicate, object } = property;
63
+ return (
64
+ RDF('type').matches(predicate) &&
65
+ object.termType === 'NamedNode' &&
66
+ acceptedTypes.includes(object.value)
67
+ );
68
+ }),
59
69
  );
60
- if (rdfTypes?.some((t) => acceptedTypes.includes(t))) {
61
- return true;
62
- }
70
+ return decisionHasAcceptedType;
63
71
  }
64
72
  return false;
65
73
  })(selection);
@@ -0,0 +1,7 @@
1
+ {{! @glint-nocheck: not typesafe yet }}
2
+ <SnippetPlugin::SnippetInsert
3
+ @config={{this.config}}
4
+ @controller={{this.controller}}
5
+ @assignedSnippetListsIds={{this.assignedSnippetListsIds}}
6
+ @disabled={{not this.showInsert}}
7
+ />