@lblod/ember-rdfa-editor-lblod-plugins 16.3.0 → 17.0.0-dev.f473cdfb5868261b49cdae52ea2558970c082d01
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/afraid-tips-visit.md +5 -0
- package/.changeset/chilly-ravens-think.md +6 -0
- package/.changeset/hot-owls-laugh.md +5 -0
- package/.changeset/olive-pets-cheer.md +5 -0
- package/.changeset/smooth-fireants-doubt.md +5 -0
- package/.changeset/tall-carrots-ring.md +5 -0
- package/.changeset/wet-baboons-serve.md +5 -0
- package/.changeset/witty-suns-speak.md +5 -0
- package/.woodpecker/.release-commit.yml +18 -0
- package/.woodpecker/.release.yml +21 -0
- package/.woodpecker/.verify-pr.yml +30 -0
- package/CHANGELOG.md +20 -0
- package/Dockerfile +6 -4
- package/addon/commands/index.ts +1 -0
- package/addon/commands/replace-selection-and-select-node.ts +24 -0
- package/addon/components/article-structure-plugin/article-structure-card.hbs +2 -1
- package/addon/components/article-structure-plugin/article-structure-card.ts +2 -0
- package/addon/components/article-structure-plugin/structure-card.hbs +7 -6
- package/addon/components/article-structure-plugin/structure-card.ts +49 -35
- package/addon/components/au-native-input.hbs +1 -0
- package/addon/components/au-native-input.ts +2 -1
- package/addon/components/besluit-type-plugin/besluit-type-select.hbs +3 -2
- package/addon/components/besluit-type-plugin/besluit-type-select.ts +4 -0
- package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +5 -4
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +48 -20
- package/addon/components/citation-plugin/citation-card.hbs +4 -3
- package/addon/components/citation-plugin/citation-card.ts +9 -2
- package/addon/components/citation-plugin/citation-insert.hbs +2 -1
- package/addon/components/citation-plugin/citation-insert.ts +3 -0
- package/addon/components/citation-plugin/citations/article-list.hbs +2 -2
- package/addon/components/citation-plugin/citations/article-preview.hbs +3 -2
- package/addon/components/citation-plugin/citations/article-preview.ts +2 -0
- package/addon/components/citation-plugin/citations/legal-document-detail.hbs +19 -11
- package/addon/components/citation-plugin/citations/legal-document-detail.ts +18 -1
- package/addon/components/citation-plugin/citations/legal-document-list.hbs +2 -2
- package/addon/components/citation-plugin/citations/legal-document-preview.hbs +10 -9
- package/addon/components/citation-plugin/citations/legal-document-preview.ts +9 -0
- package/addon/components/citation-plugin/citations/search-modal.hbs +7 -8
- package/addon/components/citation-plugin/citations/search-modal.ts +3 -0
- package/addon/components/common/search/alert-load-error.gts +34 -0
- package/addon/components/common/search/alert-no-items.gts +18 -0
- package/addon/components/common/search/loading.hbs +4 -0
- package/addon/components/confidentiality-plugin/redact.gts +13 -0
- package/addon/components/decision-plugin/decision-plugin-card.hbs +4 -3
- package/addon/components/decision-plugin/decision-plugin-card.ts +3 -0
- package/addon/components/document-title-plugin/insert-title-card.hbs +8 -1
- package/addon/components/document-title-plugin/insert-title-card.ts +3 -0
- package/addon/components/generic-rdfa-variable/insert-menu.hbs +2 -1
- package/addon/components/generic-rdfa-variable/insert-menu.ts +3 -1
- package/addon/components/hover-tooltip.hbs +1 -0
- package/addon/components/import-snippet-plugin/card.hbs +1 -0
- package/addon/components/import-snippet-plugin/card.ts +7 -2
- package/addon/components/loading-alert.hbs +2 -1
- package/addon/components/loading-alert.ts +5 -2
- package/addon/components/pagination/pagination-view.gts +55 -0
- package/addon/components/roadsign-regulation-plugin/expanded-measure.hbs +28 -37
- package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +4 -13
- package/addon/components/roadsign-regulation-plugin/measure-template.hbs +1 -0
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +2 -1
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +3 -0
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.hbs +1 -0
- package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.hbs +9 -4
- package/addon/components/roadsign-regulation-plugin/roadsigns-pagination.ts +5 -0
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.hbs +7 -6
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +5 -0
- package/addon/components/snippet-plugin/search-modal.hbs +5 -6
- package/addon/components/snippet-plugin/snippet-insert-rdfa.hbs +7 -0
- package/addon/components/snippet-plugin/snippet-insert-rdfa.ts +78 -0
- package/addon/components/snippet-plugin/snippet-insert.hbs +3 -1
- package/addon/components/snippet-plugin/snippet-insert.ts +25 -4
- package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +4 -6
- package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +3 -3
- package/addon/components/snippet-plugin/snippet-list/snippet-list-view.hbs +3 -2
- package/addon/components/snippet-plugin/snippet-list-select-rdfa.hbs +8 -0
- package/addon/components/snippet-plugin/snippet-list-select-rdfa.ts +69 -0
- package/addon/components/snippet-plugin/snippet-list-select.hbs +2 -1
- package/addon/components/snippet-plugin/snippet-list-select.ts +2 -1
- package/addon/components/snippet-plugin/snippets/snippet-preview.hbs +1 -0
- package/addon/components/standard-template-plugin/card.hbs +2 -1
- package/addon/components/standard-template-plugin/card.ts +2 -0
- package/addon/components/standard-template-plugin/template-provider.hbs +1 -0
- package/addon/components/standard-template-plugin/template-provider.ts +10 -4
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +1 -0
- package/addon/components/table-of-contents-plugin/toolbar-button.hbs +1 -0
- package/addon/components/template-comments-plugin/edit-card.hbs +4 -3
- package/addon/components/template-comments-plugin/edit-card.ts +7 -0
- package/addon/components/template-comments-plugin/insert.hbs +2 -1
- package/addon/components/template-comments-plugin/insert.ts +3 -0
- package/addon/components/template-comments-plugin/template-comment.hbs +2 -1
- package/addon/components/template-comments-plugin/template-comment.ts +3 -0
- package/addon/components/validation-plugin/validation-card.hbs +1 -0
- package/addon/components/validation-plugin/validation-item.hbs +1 -0
- package/addon/components/validation-plugin/validation-item.ts +7 -4
- package/addon/components/variable-plugin/address/edit.hbs +1 -0
- package/addon/components/variable-plugin/address/edit.ts +5 -3
- package/addon/components/variable-plugin/address/insert-variable.hbs +1 -0
- package/addon/components/variable-plugin/address/insert.hbs +3 -2
- package/addon/components/variable-plugin/address/insert.ts +3 -0
- package/addon/components/variable-plugin/address/nodeview.hbs +4 -3
- package/addon/components/variable-plugin/address/nodeview.ts +9 -0
- package/addon/components/variable-plugin/address/utils.ts +28 -3
- package/addon/components/variable-plugin/codelist/edit.hbs +1 -0
- package/addon/components/variable-plugin/codelist/edit.ts +24 -7
- package/addon/components/variable-plugin/codelist/insert.hbs +1 -0
- package/addon/components/variable-plugin/codelist/insert.ts +52 -17
- package/addon/components/variable-plugin/date/date-time-picker.hbs +1 -0
- package/addon/components/variable-plugin/date/edit.hbs +27 -31
- package/addon/components/variable-plugin/date/edit.ts +47 -8
- package/addon/components/variable-plugin/date/help-modal.hbs +1 -0
- package/addon/components/variable-plugin/date/insert-variable.hbs +1 -0
- package/addon/components/variable-plugin/date/insert-variable.ts +36 -10
- package/addon/components/variable-plugin/date/insert.hbs +2 -1
- package/addon/components/variable-plugin/date/insert.ts +38 -10
- package/addon/components/variable-plugin/date/nodeview.hbs +4 -3
- package/addon/components/variable-plugin/date/nodeview.ts +11 -1
- package/addon/components/variable-plugin/insert-variable-card.hbs +1 -0
- package/addon/components/variable-plugin/insert-variable-card.ts +9 -1
- package/addon/components/variable-plugin/location/edit.hbs +1 -0
- package/addon/components/variable-plugin/location/edit.ts +1 -9
- package/addon/components/variable-plugin/location/insert.hbs +1 -0
- package/addon/components/variable-plugin/location/insert.ts +4 -7
- package/addon/components/variable-plugin/location/nodeview.hbs +19 -8
- package/addon/components/variable-plugin/location/nodeview.ts +37 -9
- package/addon/components/variable-plugin/number/insert.hbs +1 -0
- package/addon/components/variable-plugin/number/insert.ts +34 -10
- package/addon/components/variable-plugin/number/nodeview.hbs +7 -5
- package/addon/components/variable-plugin/number/nodeview.ts +32 -5
- package/addon/components/variable-plugin/text/insert.hbs +1 -0
- package/addon/components/variable-plugin/text/insert.ts +40 -12
- package/addon/components/variable-plugin/variable/nodeview.hbs +12 -8
- package/addon/components/variable-plugin/variable/nodeview.ts +16 -9
- package/addon/components/worship-plugin/administrative-unit-picker.hbs +16 -0
- package/addon/components/worship-plugin/administrative-unit-picker.ts +38 -0
- package/addon/components/worship-plugin/insert.hbs +18 -0
- package/addon/components/worship-plugin/insert.ts +41 -0
- package/addon/components/worship-plugin/list.hbs +46 -0
- package/addon/components/worship-plugin/search-modal.hbs +79 -0
- package/addon/components/worship-plugin/search-modal.ts +131 -0
- package/addon/components/worship-plugin/sortable-table-header.hbs +36 -0
- package/addon/components/worship-plugin/sortable-table-header.ts +45 -0
- package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +82 -15
- package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +2 -1
- package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +70 -2
- package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +1 -1
- package/addon/plugins/article-structure-plugin/commands/set-structure-start-number.ts +5 -14
- package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +1 -1
- package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +197 -105
- package/addon/plugins/article-structure-plugin/index.ts +16 -7
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +181 -71
- package/addon/plugins/article-structure-plugin/structures/article.ts +91 -98
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +89 -39
- package/addon/plugins/article-structure-plugin/structures/index.ts +12 -1
- package/addon/plugins/article-structure-plugin/structures/section.ts +88 -39
- package/addon/plugins/article-structure-plugin/structures/structure-header-number.ts +56 -0
- package/addon/plugins/article-structure-plugin/structures/structure-header-title.ts +38 -0
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +87 -73
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +81 -39
- package/addon/plugins/article-structure-plugin/structures/title.ts +91 -39
- package/addon/plugins/article-structure-plugin/utils/structure.ts +223 -127
- package/addon/plugins/citation-plugin/utils/cited-text.ts +38 -8
- package/addon/plugins/confidentiality-plugin/marks/redacted.ts +1 -1
- package/addon/plugins/document-title-plugin/nodes/document-title.ts +4 -3
- package/addon/plugins/roadsign-regulation-plugin/nodes.ts +4 -3
- package/addon/plugins/snippet-plugin/commands/index.ts +1 -0
- package/addon/plugins/snippet-plugin/commands/update-snippet-ids.ts +55 -0
- package/addon/plugins/snippet-plugin/index.ts +6 -1
- package/addon/plugins/snippet-plugin/utils/fetch-data.ts +1 -3
- package/addon/plugins/snippet-plugin/utils/rdfa-predicate.ts +33 -0
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +293 -81
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +3 -2
- package/addon/plugins/variable-plugin/utils/attribute-parsers.ts +19 -1
- package/addon/plugins/variable-plugin/utils/dom-constructors.ts +3 -3
- package/addon/plugins/variable-plugin/variables/address.ts +93 -26
- package/addon/plugins/variable-plugin/variables/codelist.ts +99 -50
- package/addon/plugins/variable-plugin/variables/date.ts +143 -53
- package/addon/plugins/variable-plugin/variables/location.ts +1 -0
- package/addon/plugins/variable-plugin/variables/number.ts +99 -52
- package/addon/plugins/variable-plugin/variables/text.ts +80 -28
- package/addon/plugins/worship-plugin/index.ts +9 -0
- package/addon/plugins/worship-plugin/utils/fetchAdministrativeUnits.ts +52 -0
- package/addon/plugins/worship-plugin/utils/fetchWorshipServices.ts +109 -0
- package/addon/plugins/worship-plugin/utils/insertWorshipService.ts +16 -0
- package/addon/utils/_private/find-insertion-range.ts +18 -5
- package/addon/utils/dom-utils.ts +4 -0
- package/addon/utils/namespace.ts +63 -13
- package/addon/utils/sparql-helpers.ts +8 -0
- package/app/components/{citation-plugin/helpers/alert-no-items.js → common/search/alert-load-error.js} +1 -1
- package/app/components/{snippet-plugin/helpers → common/search}/alert-no-items.js +1 -1
- package/app/components/{snippet-plugin/helpers/alert-load-error.js → common/search/loading.js} +1 -1
- package/app/components/{citation-plugin/helpers/alert-load-error.js → snippet-plugin/snippet-list-insert-rdfa.js} +1 -1
- package/app/components/snippet-plugin/snippet-list-select-rdfa.js +1 -0
- package/app/components/worship-plugin/administrative-unit-picker.js +1 -0
- package/app/components/worship-plugin/insert.js +1 -0
- package/app/components/worship-plugin/list.js +1 -0
- package/app/components/worship-plugin/search-modal.js +1 -0
- package/app/components/worship-plugin/sortable-table-header.js +1 -0
- package/app/styles/article-structure-plugin.scss +106 -3
- package/app/styles/citaten-plugin.scss +1 -1
- package/app/styles/snippet-plugin.scss +1 -1
- package/app/styles/worship-plugin.scss +19 -0
- package/declarations/addon/commands/index.d.ts +1 -0
- package/declarations/addon/commands/replace-selection-and-select-node.d.ts +3 -0
- package/{components → declarations/addon/components}/article-structure-plugin/article-structure-card.d.ts +1 -0
- package/{components → declarations/addon/components}/article-structure-plugin/structure-card.d.ts +5 -2
- package/{components → declarations/addon/components}/au-native-input.d.ts +2 -1
- package/{components → declarations/addon/components}/besluit-type-plugin/besluit-type-select.d.ts +1 -0
- package/{components → declarations/addon/components}/besluit-type-plugin/toolbar-dropdown.d.ts +4 -5
- package/{components → declarations/addon/components}/citation-plugin/citation-card.d.ts +3 -2
- package/{components → declarations/addon/components}/citation-plugin/citation-insert.d.ts +1 -0
- package/declarations/addon/components/citation-plugin/citations/article-list.d.ts +1 -0
- package/{components → declarations/addon/components}/citation-plugin/citations/article-preview.d.ts +2 -1
- package/{components → declarations/addon/components}/citation-plugin/citations/legal-document-detail.d.ts +8 -1
- package/declarations/addon/components/citation-plugin/citations/legal-document-list.d.ts +1 -0
- package/declarations/addon/components/citation-plugin/citations/legal-document-preview.d.ts +14 -0
- package/{components → declarations/addon/components}/citation-plugin/citations/search-modal.d.ts +1 -0
- package/declarations/addon/components/common/search/alert-load-error.d.ts +4 -0
- package/declarations/addon/components/common/search/alert-no-items.d.ts +4 -0
- package/declarations/addon/components/common/search/loading.d.ts +1 -0
- package/declarations/addon/components/confidentiality-plugin/redact.d.ts +4 -0
- package/declarations/addon/components/confidentiality-plugin/toolbar.d.ts +1 -0
- package/{components → declarations/addon/components}/decision-plugin/decision-plugin-card.d.ts +1 -0
- package/{components → declarations/addon/components}/document-title-plugin/insert-title-card.d.ts +1 -0
- package/{components → declarations/addon/components}/generic-rdfa-variable/insert-menu.d.ts +1 -0
- package/{components → declarations/addon/components}/import-snippet-plugin/card.d.ts +6 -5
- package/{components → declarations/addon/components}/loading-alert.d.ts +1 -0
- package/declarations/addon/components/pagination/pagination-view.d.ts +4 -0
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/expanded-measure.d.ts +2 -2
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +1 -0
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/roadsigns-pagination.d.ts +2 -0
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/roadsigns-table.d.ts +2 -0
- package/declarations/addon/components/snippet-plugin/snippet-insert-rdfa.d.ts +19 -0
- package/{components → declarations/addon/components}/snippet-plugin/snippet-insert.d.ts +3 -0
- package/declarations/addon/components/snippet-plugin/snippet-list-select-rdfa.d.ts +21 -0
- package/{components → declarations/addon/components}/snippet-plugin/snippet-list-select.d.ts +1 -0
- package/declarations/addon/components/snippet-plugin/snippets/snippet-list.d.ts +1 -0
- package/{components → declarations/addon/components}/standard-template-plugin/card.d.ts +1 -0
- package/declarations/addon/components/table-of-contents-plugin/ember-nodes/outline.d.ts +1 -0
- package/{components → declarations/addon/components}/template-comments-plugin/edit-card.d.ts +3 -0
- package/{components → declarations/addon/components}/template-comments-plugin/insert.d.ts +1 -0
- package/{components → declarations/addon/components}/template-comments-plugin/template-comment.d.ts +1 -0
- package/{components → declarations/addon/components}/validation-plugin/validation-item.d.ts +2 -2
- package/{components → declarations/addon/components}/variable-plugin/address/edit.d.ts +2 -2
- package/{components → declarations/addon/components}/variable-plugin/address/insert.d.ts +1 -0
- package/{components → declarations/addon/components}/variable-plugin/address/nodeview.d.ts +2 -0
- package/{components → declarations/addon/components}/variable-plugin/date/edit.d.ts +4 -2
- package/{components → declarations/addon/components}/variable-plugin/date/insert.d.ts +1 -0
- package/{components → declarations/addon/components}/variable-plugin/date/nodeview.d.ts +2 -0
- package/{components → declarations/addon/components}/variable-plugin/insert-variable-card.d.ts +9 -1
- package/{components → declarations/addon/components}/variable-plugin/location/edit.d.ts +0 -1
- package/declarations/addon/components/variable-plugin/location/nodeview.d.ts +11 -0
- package/{components → declarations/addon/components}/variable-plugin/number/nodeview.d.ts +4 -1
- package/{components → declarations/addon/components}/variable-plugin/text/insert.d.ts +1 -1
- package/declarations/addon/components/variable-plugin/utils/label-input.d.ts +1 -0
- package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +11 -0
- package/declarations/addon/components/worship-plugin/administrative-unit-picker.d.ts +12 -0
- package/declarations/addon/components/worship-plugin/insert.d.ts +17 -0
- package/declarations/addon/components/worship-plugin/list.d.ts +1 -0
- package/declarations/addon/components/worship-plugin/search-modal.d.ts +30 -0
- package/declarations/addon/components/worship-plugin/sortable-table-header.d.ts +16 -0
- package/declarations/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +3 -0
- package/declarations/addon/plugins/article-structure-plugin/commands/set-structure-start-number.d.ts +7 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/index.d.ts +15 -7
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/article-paragraph.d.ts +2 -0
- package/declarations/addon/plugins/article-structure-plugin/structures/article.d.ts +5 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/index.d.ts +4 -0
- package/declarations/addon/plugins/article-structure-plugin/structures/structure-header-number.d.ts +2 -0
- package/declarations/addon/plugins/article-structure-plugin/structures/structure-header-title.d.ts +2 -0
- package/declarations/addon/plugins/article-structure-plugin/structures/structure-header.d.ts +17 -0
- package/declarations/addon/plugins/article-structure-plugin/utils/structure.d.ts +42 -0
- package/declarations/addon/plugins/confidentiality-plugin/marks/redacted.d.ts +2 -0
- package/declarations/addon/plugins/snippet-plugin/commands/index.d.ts +1 -0
- package/declarations/addon/plugins/snippet-plugin/commands/update-snippet-ids.d.ts +8 -0
- package/{plugins → declarations/addon/plugins}/snippet-plugin/index.d.ts +2 -0
- package/declarations/addon/plugins/snippet-plugin/utils/rdfa-predicate.d.ts +5 -0
- package/{plugins → declarations/addon/plugins}/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/template-comments-plugin/node.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/utils/attribute-parsers.d.ts +3 -0
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/address.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/codelist.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/date.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/location.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/number.d.ts +1 -1
- package/{plugins → declarations/addon/plugins}/variable-plugin/variables/text.d.ts +1 -1
- package/declarations/addon/plugins/worship-plugin/index.d.ts +8 -0
- package/declarations/addon/plugins/worship-plugin/utils/fetchAdministrativeUnits.d.ts +7 -0
- package/declarations/addon/plugins/worship-plugin/utils/fetchWorshipServices.d.ts +23 -0
- package/declarations/addon/plugins/worship-plugin/utils/insertWorshipService.d.ts +3 -0
- package/declarations/addon/serializers/application.d.ts +3 -0
- package/{services → declarations/addon/services}/import-rdfa-snippet.d.ts +2 -0
- package/{utils → declarations/addon/utils}/_private/find-insertion-range.d.ts +7 -4
- package/declarations/addon/utils/dom-utils.d.ts +2 -0
- package/declarations/addon/utils/namespace.d.ts +21 -0
- package/{utils → declarations/addon/utils}/sparql-helpers.d.ts +4 -0
- package/package.json +54 -19
- package/pnpm-lock.yaml +17788 -0
- package/scripts/generate-type-declarations.sh +16 -0
- package/translations/en-US.yaml +27 -12
- package/translations/nl-BE.yaml +27 -12
- package/tsconfig.declarations.json +15 -0
- package/tsconfig.json +7 -57
- package/tsconfig.main.json +62 -0
- package/types/ember-intl.d.ts +15 -0
- package/types/graphy/memory.dataset.fast.d.ts +74 -0
- package/.woodpecker/.test.yml +0 -49
- package/addon/components/citation-plugin/helpers/alert-load-error.hbs +0 -21
- package/addon/components/citation-plugin/helpers/alert-no-items.hbs +0 -10
- package/addon/components/confidentiality-plugin/redact.hbs +0 -6
- package/addon/components/pagination/pagination-view.hbs +0 -39
- package/addon/components/snippet-plugin/helpers/alert-load-error.hbs +0 -22
- package/addon/components/snippet-plugin/helpers/alert-no-items.hbs +0 -8
- package/components/citation-plugin/citations/legal-document-preview.d.ts +0 -10
- package/components/variable-plugin/location/nodeview.d.ts +0 -12
- package/components/variable-plugin/variable/nodeview.d.ts +0 -11
- package/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +0 -3
- package/plugins/article-structure-plugin/commands/set-structure-start-number.d.ts +0 -4
- package/plugins/article-structure-plugin/structures/article.d.ts +0 -6
- package/plugins/article-structure-plugin/structures/structure-header.d.ts +0 -2
- package/plugins/article-structure-plugin/utils/structure.d.ts +0 -36
- package/plugins/confidentiality-plugin/marks/redacted.d.ts +0 -2
- package/utils/namespace.d.ts +0 -12
- package/{components → declarations/addon/components}/hover-tooltip.d.ts +0 -0
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/measure-template.d.ts +0 -0
- package/{components → declarations/addon/components}/roadsign-regulation-plugin/roadsigns-modal.d.ts +0 -0
- package/{components → declarations/addon/components}/snippet-plugin/search-modal.d.ts +0 -0
- package/{components → declarations/addon/components}/snippet-plugin/snippet-list/snippet-list-modal.d.ts +0 -0
- package/{components → declarations/addon/components}/snippet-plugin/snippet-list/snippet-list-view.d.ts +0 -0
- package/{components → declarations/addon/components}/snippet-plugin/snippets/snippet-preview.d.ts +0 -0
- package/{components → declarations/addon/components}/standard-template-plugin/template-provider.d.ts +0 -0
- package/{components → declarations/addon/components}/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +0 -0
- package/{components → declarations/addon/components}/table-of-contents-plugin/toolbar-button.d.ts +0 -0
- package/{components → declarations/addon/components}/validation-plugin/validation-card.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/address/insert-variable.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/address/utils.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/codelist/edit.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/codelist/insert.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/date/date-time-picker.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/date/help-modal.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/date/insert-variable.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/location/insert.d.ts +0 -0
- package/{components → declarations/addon/components}/variable-plugin/number/insert.d.ts +0 -0
- package/{helpers → declarations/addon/helpers}/capitalize.d.ts +0 -0
- package/{helpers → declarations/addon/helpers}/in-array.d.ts +0 -0
- package/{helpers → declarations/addon/helpers}/limit-text.d.ts +0 -0
- package/{helpers → declarations/addon/helpers}/pagination.d.ts +0 -0
- package/{models → declarations/addon/models}/instruction.d.ts +0 -0
- package/{models → declarations/addon/models}/measure.d.ts +0 -0
- package/{models → declarations/addon/models}/sign.d.ts +0 -0
- package/{models → declarations/addon/models}/template.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/index.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/insert-structure.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/move-selected-structure.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/remove-structure.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/unwrap-structure.d.ts +0 -0
- package/{plugins → declarations/addon/plugins}/article-structure-plugin/commands/wrap-structure-content.d.ts +1 -1
- /package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/chapter.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/section.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/subsection.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/article-structure-plugin/structures/title.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/article-structure-plugin/utils/romanize.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/besluit-type-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/besluit-type-plugin/utils/fetchBesluitTypes.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/article.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/cache.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/cited-text.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/legal-documents.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/process-match.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/public-decisions.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/types.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/utils.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/citation-plugin/utils/vlaamse-codex.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/confidentiality-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/commands/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/commands/insert-article-container.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/commands/insert-description.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/commands/insert-motivation.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/commands/insert-title.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/utils/get-title-for-decision.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/decision-plugin/utils/validation-rules.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/document-title-plugin/commands/insert-document-title.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/document-title-plugin/nodes/document-title.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/document-title-plugin/nodes/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/generic-rdfa-variable/commands/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/generic-rdfa-variable/commands/insert-generic-rdfa.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/roadsign-regulation-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/roadsign-regulation-plugin/nodes.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/roadsign-regulation-plugin/utils/constants.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/roadsign-regulation-plugin/utils/fetchData.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/roadsign-regulation-plugin/utils/includeInstructions.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/snippet-plugin/utils/fetch-data.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/standard-template-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/standard-template-plugin/utils/instantiate-uuids.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/standard-template-plugin/utils/nodes.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/table-of-contents-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/table-of-contents-plugin/nodes/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/table-of-contents-plugin/utils/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/template-comments-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/validation/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/validation/utils/transaction-complies-with-shapes.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/address-helpers.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/codelist-utils.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/constants.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/date-helpers.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/dom-constructors.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/fetch-data.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/utils/number-to-words.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/variable-plugin/variables/index.d.ts +0 -0
- /package/{services → declarations/addon/services}/roadsign-registry.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/changed-descendants.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/constants.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/dom-output-spec-helpers.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/find-insertion-contentmatch.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/find-insertion-pos-in-ancestor-of-type.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/memoize.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/option.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/strings.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/translation.d.ts +0 -0
- /package/{utils → declarations/addon/utils}/types.d.ts +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
4
|
+
import { action } from '@ember/object';
|
|
5
|
+
import { restartableTask, timeout } from 'ember-concurrency';
|
|
6
|
+
import { task as trackedTask } from 'ember-resources/util/ember-concurrency';
|
|
7
|
+
import { WorshipPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
8
|
+
import {
|
|
9
|
+
fetchWorshipServices,
|
|
10
|
+
SearchSort,
|
|
11
|
+
WorshipService,
|
|
12
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
13
|
+
import { AdministrativeUnit } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin';
|
|
14
|
+
|
|
15
|
+
interface Args {
|
|
16
|
+
config: WorshipPluginConfig;
|
|
17
|
+
open: boolean;
|
|
18
|
+
closeModal: () => void;
|
|
19
|
+
onInsert: (service: WorshipService) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class WorshipPluginSearchModalComponent extends Component<Args> {
|
|
23
|
+
// Filtering
|
|
24
|
+
@tracked sort: SearchSort = false;
|
|
25
|
+
@tracked inputSearchText: string | null = null;
|
|
26
|
+
// We're deliberately using the arg to set the initial value
|
|
27
|
+
// eslint-disable-next-line ember/no-tracked-properties-from-args
|
|
28
|
+
@tracked administrativeUnit: AdministrativeUnit | undefined =
|
|
29
|
+
this.args.config.defaultAdministrativeUnit;
|
|
30
|
+
|
|
31
|
+
// Display
|
|
32
|
+
@tracked error: unknown;
|
|
33
|
+
|
|
34
|
+
// Pagination
|
|
35
|
+
@tracked pageNumber = 0;
|
|
36
|
+
@tracked pageSize = 20;
|
|
37
|
+
@tracked totalCount = 0;
|
|
38
|
+
|
|
39
|
+
get config() {
|
|
40
|
+
return this.args.config;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get searchText() {
|
|
44
|
+
return this.inputSearchText;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@action
|
|
48
|
+
setInputSearchText(event: InputEvent) {
|
|
49
|
+
assert(
|
|
50
|
+
'inputSearchText must be bound to an input element',
|
|
51
|
+
event.target instanceof HTMLInputElement,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
this.inputSearchText = event.target.value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@action
|
|
58
|
+
setAdministrativeUnit(unit: AdministrativeUnit) {
|
|
59
|
+
this.administrativeUnit = unit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@action
|
|
63
|
+
async closeModal() {
|
|
64
|
+
await this.servicesResource.cancel();
|
|
65
|
+
this.args.closeModal();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
search = restartableTask(async () => {
|
|
69
|
+
await timeout(500);
|
|
70
|
+
|
|
71
|
+
const abortController = new AbortController();
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const queryResult = await fetchWorshipServices({
|
|
75
|
+
administrativeUnitURI: this.administrativeUnit?.uri,
|
|
76
|
+
config: this.args.config,
|
|
77
|
+
searchMeta: {
|
|
78
|
+
abortSignal: abortController.signal,
|
|
79
|
+
filter: {
|
|
80
|
+
label: this.inputSearchText ?? undefined,
|
|
81
|
+
},
|
|
82
|
+
sort: this.sort,
|
|
83
|
+
page: this.pageNumber,
|
|
84
|
+
pageSize: this.pageSize,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
this.error = undefined;
|
|
88
|
+
|
|
89
|
+
// Reset to first page if there are no results for this one e.g. when changing search
|
|
90
|
+
if (
|
|
91
|
+
this.pageNumber !== 0 &&
|
|
92
|
+
this.pageNumber * this.pageSize >= queryResult.totalCount
|
|
93
|
+
) {
|
|
94
|
+
this.pageNumber = 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return queryResult;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
this.error = error;
|
|
100
|
+
return {
|
|
101
|
+
results: [],
|
|
102
|
+
totalCount: 0,
|
|
103
|
+
};
|
|
104
|
+
} finally {
|
|
105
|
+
abortController.abort();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
servicesResource = trackedTask(this, this.search, () => [
|
|
110
|
+
this.inputSearchText,
|
|
111
|
+
this.administrativeUnit,
|
|
112
|
+
this.pageNumber,
|
|
113
|
+
this.pageSize,
|
|
114
|
+
this.sort,
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
@action
|
|
118
|
+
setSort(sort: SearchSort) {
|
|
119
|
+
this.sort = sort;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@action
|
|
123
|
+
previousPage() {
|
|
124
|
+
--this.pageNumber;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@action
|
|
128
|
+
nextPage() {
|
|
129
|
+
++this.pageNumber;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{{! @glint-nocheck: not typesafe yet }}
|
|
2
|
+
{{!-- Based on au-data-table-th-sortable from ember-appuniversum and using the same classes --}}
|
|
3
|
+
<span
|
|
4
|
+
class='au-c-data-table__header-title au-c-data-table__header-title--sortable
|
|
5
|
+
{{if this.order ' is-active'}}'
|
|
6
|
+
>
|
|
7
|
+
{{@label}}
|
|
8
|
+
{{#if (eq this.order 'DESC')}}
|
|
9
|
+
<button
|
|
10
|
+
type='button'
|
|
11
|
+
{{on 'click' this.changeSort}}
|
|
12
|
+
class='au-c-data-table__sort'
|
|
13
|
+
>
|
|
14
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.asc'}}</span>
|
|
15
|
+
<AuIcon @icon={{this.NavUpIcon}} />
|
|
16
|
+
</button>
|
|
17
|
+
{{else if (eq this.order 'ASC')}}
|
|
18
|
+
<button
|
|
19
|
+
type='button'
|
|
20
|
+
{{on 'click' this.changeSort}}
|
|
21
|
+
class='au-c-data-table__sort'
|
|
22
|
+
>
|
|
23
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.desc'}}</span>
|
|
24
|
+
<AuIcon @icon={{this.NavDownIcon}} />
|
|
25
|
+
</button>
|
|
26
|
+
{{else}}
|
|
27
|
+
<button
|
|
28
|
+
type='button'
|
|
29
|
+
{{on 'click' this.changeSort}}
|
|
30
|
+
class='au-c-data-table__sort'
|
|
31
|
+
>
|
|
32
|
+
<span class='au-u-hidden-visually'>{{t 'worship-plugin.modal.sort.sort'}}</span>
|
|
33
|
+
<AuIcon @icon={{this.NavUpDownIcon}} />
|
|
34
|
+
</button>
|
|
35
|
+
{{/if}}
|
|
36
|
+
</span>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { NavUpIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up';
|
|
4
|
+
import { NavDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-down';
|
|
5
|
+
import { NavUpDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up-down';
|
|
6
|
+
import {
|
|
7
|
+
SearchSort,
|
|
8
|
+
WorshipService,
|
|
9
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/worship-plugin/utils/fetchWorshipServices';
|
|
10
|
+
|
|
11
|
+
interface Args {
|
|
12
|
+
label: string;
|
|
13
|
+
field: keyof WorshipService;
|
|
14
|
+
sort: SearchSort;
|
|
15
|
+
setSort: (sort: SearchSort) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class SnippetInsertComponent extends Component<Args> {
|
|
19
|
+
NavUpIcon = NavUpIcon;
|
|
20
|
+
NavDownIcon = NavDownIcon;
|
|
21
|
+
NavUpDownIcon = NavUpDownIcon;
|
|
22
|
+
|
|
23
|
+
get order() {
|
|
24
|
+
if (this.args.sort) {
|
|
25
|
+
const [sortedField, order] = this.args.sort;
|
|
26
|
+
if (sortedField === this.args.field) {
|
|
27
|
+
return order;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@action changeSort() {
|
|
34
|
+
const order = this.order;
|
|
35
|
+
let newSort: SearchSort;
|
|
36
|
+
if (!order) {
|
|
37
|
+
newSort = [this.args.field, 'ASC'];
|
|
38
|
+
} else if (order === 'ASC') {
|
|
39
|
+
newSort = [this.args.field, 'DESC'];
|
|
40
|
+
} else {
|
|
41
|
+
newSort = false;
|
|
42
|
+
}
|
|
43
|
+
this.args.setSort(newSort);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,14 +1,69 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Command,
|
|
3
|
+
EditorState,
|
|
3
4
|
Fragment,
|
|
4
5
|
NodeSelection,
|
|
5
6
|
TextSelection,
|
|
7
|
+
Transaction,
|
|
6
8
|
} from '@lblod/ember-rdfa-editor';
|
|
9
|
+
import { getNodeByRdfaId } from '@lblod/ember-rdfa-editor/plugins/rdfa-info';
|
|
10
|
+
import { addProperty } from '@lblod/ember-rdfa-editor/commands';
|
|
11
|
+
import { isRdfaAttrs } from '@lblod/ember-rdfa-editor/core/schema';
|
|
12
|
+
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
7
13
|
import recalculateStructureNumbers from './recalculate-structure-numbers';
|
|
8
14
|
import { StructureSpec } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
|
|
9
15
|
import wrapStructureContent from './wrap-structure-content';
|
|
10
16
|
import IntlService from 'ember-intl/services/intl';
|
|
11
17
|
import { findInsertionRange } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/_private/find-insertion-range';
|
|
18
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
19
|
+
|
|
20
|
+
const addPropertyToContainer = ({
|
|
21
|
+
state,
|
|
22
|
+
transaction,
|
|
23
|
+
structureSpec,
|
|
24
|
+
insertionRange,
|
|
25
|
+
newResource,
|
|
26
|
+
}: {
|
|
27
|
+
state: EditorState;
|
|
28
|
+
transaction: Transaction;
|
|
29
|
+
structureSpec: StructureSpec;
|
|
30
|
+
insertionRange: Exclude<ReturnType<typeof findInsertionRange>, null>;
|
|
31
|
+
newResource: string;
|
|
32
|
+
}) => {
|
|
33
|
+
if (!insertionRange) {
|
|
34
|
+
return transaction;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const containerAttrs = insertionRange.containerNode.attrs;
|
|
38
|
+
|
|
39
|
+
if (!isRdfaAttrs(containerAttrs)) {
|
|
40
|
+
return transaction;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const incoming = containerAttrs.backlinks;
|
|
44
|
+
const subject = incoming?.find((backlink) =>
|
|
45
|
+
SAY('body').matches(backlink.predicate),
|
|
46
|
+
)?.subject;
|
|
47
|
+
|
|
48
|
+
if (!subject) {
|
|
49
|
+
return transaction;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const newState = state.apply(transaction);
|
|
53
|
+
addProperty({
|
|
54
|
+
resource: subject.value,
|
|
55
|
+
property: {
|
|
56
|
+
predicate: (structureSpec.relationshipPredicate ?? SAY('hasPart'))
|
|
57
|
+
.prefixed,
|
|
58
|
+
object: sayDataFactory.resourceNode(newResource),
|
|
59
|
+
},
|
|
60
|
+
transaction,
|
|
61
|
+
})(newState, (newTransaction) => {
|
|
62
|
+
transaction = newTransaction;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return transaction;
|
|
66
|
+
};
|
|
12
67
|
|
|
13
68
|
const insertStructure = (
|
|
14
69
|
structureSpec: StructureSpec,
|
|
@@ -31,28 +86,40 @@ const insertStructure = (
|
|
|
31
86
|
return false;
|
|
32
87
|
}
|
|
33
88
|
if (dispatch) {
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
89
|
+
const {
|
|
90
|
+
node: newStructureNode,
|
|
91
|
+
selectionConfig,
|
|
92
|
+
newResource,
|
|
93
|
+
} = structureSpec.constructor({ schema, intl, content, state });
|
|
94
|
+
let transaction = state.tr;
|
|
37
95
|
|
|
38
96
|
transaction.replaceWith(
|
|
39
97
|
insertionRange.from,
|
|
40
98
|
insertionRange.to,
|
|
41
99
|
newStructureNode,
|
|
42
100
|
);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
const target = getNodeByRdfaId(
|
|
102
|
+
state.apply(transaction),
|
|
103
|
+
selectionConfig.rdfaId,
|
|
104
|
+
);
|
|
105
|
+
if (target) {
|
|
106
|
+
const newSelection =
|
|
107
|
+
selectionConfig.type === 'node'
|
|
108
|
+
? NodeSelection.create(transaction.doc, target.pos)
|
|
109
|
+
: TextSelection.create(transaction.doc, target.pos + 1);
|
|
110
|
+
transaction.setSelection(newSelection);
|
|
111
|
+
}
|
|
112
|
+
|
|
54
113
|
transaction.scrollIntoView();
|
|
55
|
-
recalculateStructureNumbers(transaction, structureSpec);
|
|
114
|
+
recalculateStructureNumbers(transaction, schema, structureSpec);
|
|
115
|
+
transaction = addPropertyToContainer({
|
|
116
|
+
state,
|
|
117
|
+
transaction,
|
|
118
|
+
structureSpec,
|
|
119
|
+
insertionRange,
|
|
120
|
+
newResource,
|
|
121
|
+
});
|
|
122
|
+
|
|
56
123
|
dispatch(transaction);
|
|
57
124
|
}
|
|
58
125
|
return true;
|
|
@@ -15,6 +15,7 @@ import IntlService from 'ember-intl/services/intl';
|
|
|
15
15
|
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
16
16
|
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
17
17
|
import { getTranslationFunction } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/translation';
|
|
18
|
+
|
|
18
19
|
const moveSelectedStructure = (
|
|
19
20
|
options: ArticleStructurePluginOptions,
|
|
20
21
|
direction: 'up' | 'down',
|
|
@@ -77,7 +78,7 @@ const moveSelectedStructure = (
|
|
|
77
78
|
: TextSelection.create(transaction.doc, newSelectionPos);
|
|
78
79
|
transaction.setSelection(newSelection);
|
|
79
80
|
transaction.scrollIntoView();
|
|
80
|
-
recalculateStructureNumbers(transaction, currentStructureSpec);
|
|
81
|
+
recalculateStructureNumbers(transaction, schema, currentStructureSpec);
|
|
81
82
|
dispatch(transaction);
|
|
82
83
|
}
|
|
83
84
|
return true;
|
|
@@ -1,15 +1,69 @@
|
|
|
1
|
-
import { PNode, Transaction } from '@lblod/ember-rdfa-editor';
|
|
1
|
+
import { PNode, Schema, Transaction } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { findNodeByRdfaId } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
|
|
3
|
+
import { isRdfaAttrs } from '@lblod/ember-rdfa-editor/core/schema';
|
|
4
|
+
import type { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
5
|
+
import { ELI } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
2
6
|
import { StructureSpec } from '..';
|
|
3
7
|
|
|
8
|
+
type UpdateNumberProps = {
|
|
9
|
+
transaction: Transaction;
|
|
10
|
+
schema: Schema;
|
|
11
|
+
node: PNode;
|
|
12
|
+
number: string;
|
|
13
|
+
numberPredicate?: Resource;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function updateNumber({
|
|
17
|
+
transaction,
|
|
18
|
+
schema,
|
|
19
|
+
node,
|
|
20
|
+
number,
|
|
21
|
+
numberPredicate,
|
|
22
|
+
}: UpdateNumberProps) {
|
|
23
|
+
const { attrs } = node;
|
|
24
|
+
|
|
25
|
+
if (isRdfaAttrs(attrs) && attrs.rdfaNodeType === 'resource') {
|
|
26
|
+
const properties = attrs.properties;
|
|
27
|
+
const numberProp = properties.find((prop) =>
|
|
28
|
+
(numberPredicate ?? ELI('number')).matches(prop.predicate),
|
|
29
|
+
);
|
|
30
|
+
const numberRdfaId =
|
|
31
|
+
numberProp?.object.termType === 'LiteralNode' && numberProp.object.value;
|
|
32
|
+
const numberNode =
|
|
33
|
+
numberRdfaId && findNodeByRdfaId(transaction.doc, numberRdfaId);
|
|
34
|
+
|
|
35
|
+
if (numberNode) {
|
|
36
|
+
transaction.replaceWith(
|
|
37
|
+
numberNode.pos + 1,
|
|
38
|
+
numberNode.pos + numberNode.value.nodeSize - 1,
|
|
39
|
+
schema.text(number),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
4
45
|
export default function recalculateStructureNumbers(
|
|
5
46
|
transaction: Transaction,
|
|
47
|
+
schema: Schema,
|
|
6
48
|
...structureSpecs: StructureSpec[]
|
|
7
49
|
) {
|
|
8
50
|
const doc = transaction.doc;
|
|
9
51
|
const indices = new Array<number>(structureSpecs.length).fill(1);
|
|
52
|
+
|
|
10
53
|
const contexts: (PNode | null)[] = new Array<PNode | null>(
|
|
11
54
|
structureSpecs.length,
|
|
12
55
|
).fill(null);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Recording all calls to `updateNumber` in an array to run them all
|
|
59
|
+
* _after_ we've run all the `setNumber` calls.
|
|
60
|
+
*
|
|
61
|
+
* This is necessary because `updateNumber` calls can change positions of the nodes
|
|
62
|
+
* in the document, and the calls to `setNumber` are dependent on the correct position
|
|
63
|
+
* before the change.
|
|
64
|
+
*/
|
|
65
|
+
const updateNumberCalls: UpdateNumberProps[] = [];
|
|
66
|
+
|
|
13
67
|
doc.descendants((node, pos, parent) => {
|
|
14
68
|
structureSpecs.forEach((spec, i) => {
|
|
15
69
|
if (node.type.name === spec.name) {
|
|
@@ -24,10 +78,24 @@ export default function recalculateStructureNumbers(
|
|
|
24
78
|
indices[i] = startNumber;
|
|
25
79
|
}
|
|
26
80
|
|
|
27
|
-
spec.
|
|
81
|
+
spec.setNumber({ transaction, pos, number: indices[i] });
|
|
82
|
+
|
|
83
|
+
if ('convertNumber' in spec.numberConfig) {
|
|
84
|
+
updateNumberCalls.push({
|
|
85
|
+
transaction,
|
|
86
|
+
schema,
|
|
87
|
+
node,
|
|
88
|
+
number: spec.numberConfig.convertNumber(indices[i]),
|
|
89
|
+
numberPredicate: spec.numberConfig.numberPredicate,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
28
93
|
indices[i] += 1;
|
|
29
94
|
}
|
|
30
95
|
});
|
|
31
96
|
});
|
|
97
|
+
|
|
98
|
+
updateNumberCalls.forEach(updateNumber);
|
|
99
|
+
|
|
32
100
|
return transaction;
|
|
33
101
|
}
|
|
@@ -11,7 +11,7 @@ const removeStructure = (
|
|
|
11
11
|
const { pos, node } = structure;
|
|
12
12
|
const transaction = state.tr;
|
|
13
13
|
transaction.replace(pos, pos + node.nodeSize);
|
|
14
|
-
recalculateStructureNumbers(transaction, ...options);
|
|
14
|
+
recalculateStructureNumbers(transaction, state.schema, ...options);
|
|
15
15
|
dispatch(transaction);
|
|
16
16
|
}
|
|
17
17
|
return true;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import { Command } from '@lblod/ember-rdfa-editor';
|
|
1
|
+
import { Command, PNode } from '@lblod/ember-rdfa-editor';
|
|
2
2
|
|
|
3
|
-
import { findAncestorOfType } from '../utils/structure';
|
|
4
3
|
import type { ArticleStructurePluginOptions } from '..';
|
|
5
4
|
import recalculateStructureNumbers from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands/recalculate-structure-numbers';
|
|
6
5
|
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
7
6
|
|
|
8
7
|
const setStructureStartNumber = (
|
|
8
|
+
structure: { pos: number; node: PNode },
|
|
9
9
|
options: ArticleStructurePluginOptions,
|
|
10
10
|
startNumber: number | null,
|
|
11
11
|
): Command => {
|
|
12
12
|
return (state, dispatch) => {
|
|
13
|
-
const { selection, schema } = state;
|
|
14
|
-
|
|
15
|
-
const structureSpecs = options.map((type) => schema.nodes[type.name]);
|
|
16
|
-
const currentStructure = findAncestorOfType(selection, ...structureSpecs);
|
|
17
|
-
|
|
18
|
-
if (!currentStructure || currentStructure.pos === -1) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
13
|
const currentStructureSpec = unwrap(
|
|
23
|
-
options.find((spec) => spec.name ===
|
|
14
|
+
options.find((spec) => spec.name === structure.node.type.name),
|
|
24
15
|
);
|
|
25
16
|
|
|
26
17
|
if (dispatch) {
|
|
@@ -28,11 +19,11 @@ const setStructureStartNumber = (
|
|
|
28
19
|
|
|
29
20
|
currentStructureSpec.setStartNumber({
|
|
30
21
|
number: startNumber,
|
|
31
|
-
pos:
|
|
22
|
+
pos: structure.pos,
|
|
32
23
|
transaction,
|
|
33
24
|
});
|
|
34
25
|
|
|
35
|
-
recalculateStructureNumbers(transaction, ...options);
|
|
26
|
+
recalculateStructureNumbers(transaction, state.schema, ...options);
|
|
36
27
|
|
|
37
28
|
dispatch(transaction);
|
|
38
29
|
}
|
|
@@ -30,7 +30,7 @@ const unwrapStructure = (
|
|
|
30
30
|
if (dispatch) {
|
|
31
31
|
const transaction = state.tr;
|
|
32
32
|
transaction.replaceWith(pos, pos + node.nodeSize, contentToUnwrap);
|
|
33
|
-
recalculateStructureNumbers(transaction, ...options);
|
|
33
|
+
recalculateStructureNumbers(transaction, state.schema, ...options);
|
|
34
34
|
dispatch(transaction);
|
|
35
35
|
}
|
|
36
36
|
return true;
|