@lblod/ember-rdfa-editor-lblod-plugins 16.4.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 +14 -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 +3 -2
- 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-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 +17 -9
- package/addon/components/citation-plugin/citations/legal-document-detail.ts +18 -1
- 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 +3 -2
- 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/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 +1 -0
- 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 +1 -0
- 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 +1 -0
- package/addon/components/worship-plugin/insert.hbs +2 -1
- package/addon/components/worship-plugin/insert.ts +3 -0
- package/addon/components/worship-plugin/search-modal.hbs +1 -0
- package/addon/components/worship-plugin/search-modal.ts +2 -0
- package/addon/components/worship-plugin/sortable-table-header.hbs +4 -3
- package/addon/components/worship-plugin/sortable-table-header.ts +7 -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/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/utils/_private/find-insertion-range.ts +18 -5
- package/addon/utils/dom-utils.ts +4 -0
- package/addon/utils/namespace.ts +63 -13
- package/app/components/snippet-plugin/snippet-list-insert-rdfa.js +1 -0
- package/app/components/snippet-plugin/snippet-list-select-rdfa.js +1 -0
- package/app/styles/article-structure-plugin.scss +106 -3
- 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/{components → declarations/addon/components}/worship-plugin/insert.d.ts +1 -0
- package/declarations/addon/components/worship-plugin/list.d.ts +1 -0
- package/{components → declarations/addon/components}/worship-plugin/sortable-table-header.d.ts +3 -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/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/package.json +54 -19
- package/pnpm-lock.yaml +17788 -0
- package/scripts/generate-type-declarations.sh +16 -0
- 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/common/search/alert-load-error.hbs +0 -23
- package/addon/components/common/search/alert-no-items.hbs +0 -9
- package/addon/components/confidentiality-plugin/redact.hbs +0 -6
- package/addon/components/pagination/pagination-view.hbs +0 -39
- 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/{components → declarations/addon/components}/worship-plugin/administrative-unit-picker.d.ts +0 -0
- package/{components → declarations/addon/components}/worship-plugin/search-modal.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/{plugins → declarations/addon/plugins}/worship-plugin/index.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/worship-plugin/utils/fetchAdministrativeUnits.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/worship-plugin/utils/fetchWorshipServices.d.ts +0 -0
- /package/{plugins → declarations/addon/plugins}/worship-plugin/utils/insertWorshipService.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}/sparql-helpers.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
|
@@ -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;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import IntlService from 'ember-intl/services/intl';
|
|
1
2
|
import {
|
|
2
3
|
Command,
|
|
4
|
+
Fragment,
|
|
3
5
|
NodeSelection,
|
|
4
6
|
NodeType,
|
|
5
7
|
PNode,
|
|
@@ -7,8 +9,14 @@ import {
|
|
|
7
9
|
Selection,
|
|
8
10
|
TextSelection,
|
|
9
11
|
} from '@lblod/ember-rdfa-editor';
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
+
import { getNodeByRdfaId } from '@lblod/ember-rdfa-editor/plugins/rdfa-info';
|
|
13
|
+
import { addProperty, removeProperty } from '@lblod/ember-rdfa-editor/commands';
|
|
14
|
+
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
15
|
+
import {
|
|
16
|
+
SpecConstructorResult,
|
|
17
|
+
StructureSpec,
|
|
18
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
|
|
19
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
12
20
|
import recalculateStructureNumbers from './recalculate-structure-numbers';
|
|
13
21
|
|
|
14
22
|
const wrapStructureContent = (
|
|
@@ -20,7 +28,7 @@ const wrapStructureContent = (
|
|
|
20
28
|
return false;
|
|
21
29
|
}
|
|
22
30
|
const { selection, schema } = state;
|
|
23
|
-
const container = findInsertionContainer(
|
|
31
|
+
const [container, resourceHierarchy] = findInsertionContainer(
|
|
24
32
|
selection,
|
|
25
33
|
schema.nodes[structureSpec.name],
|
|
26
34
|
schema,
|
|
@@ -29,136 +37,220 @@ const wrapStructureContent = (
|
|
|
29
37
|
return false;
|
|
30
38
|
}
|
|
31
39
|
const contentToWrap = container.node;
|
|
32
|
-
let result:
|
|
33
|
-
node: PNode;
|
|
34
|
-
selectionConfig: {
|
|
35
|
-
relativePos: number;
|
|
36
|
-
type: 'node' | 'text';
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
try {
|
|
40
|
-
result = structureSpec.constructor({
|
|
41
|
-
schema,
|
|
42
|
-
content: contentToWrap,
|
|
43
|
-
intl,
|
|
44
|
-
state,
|
|
45
|
-
});
|
|
46
|
-
} catch (e) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const { node: wrappingNode, selectionConfig } = result;
|
|
40
|
+
let result: SpecConstructorResult;
|
|
50
41
|
if (dispatch) {
|
|
51
|
-
|
|
42
|
+
try {
|
|
43
|
+
result = structureSpec.constructor({
|
|
44
|
+
schema,
|
|
45
|
+
content: contentToWrap,
|
|
46
|
+
intl,
|
|
47
|
+
state,
|
|
48
|
+
});
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const { node: wrappingNode, selectionConfig, newResource } = result;
|
|
53
|
+
let transaction = state.tr;
|
|
52
54
|
transaction.replaceWith(container.from, container.to, wrappingNode);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
|
|
55
|
+
|
|
56
|
+
const target = getNodeByRdfaId(
|
|
57
|
+
state.apply(transaction),
|
|
58
|
+
selectionConfig.rdfaId,
|
|
59
|
+
);
|
|
60
|
+
if (target) {
|
|
61
|
+
const newSelection =
|
|
62
|
+
selectionConfig.type === 'node'
|
|
63
|
+
? NodeSelection.create(transaction.doc, target.pos)
|
|
64
|
+
: TextSelection.create(transaction.doc, target.pos + 1);
|
|
65
|
+
transaction.setSelection(newSelection);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
transaction.scrollIntoView();
|
|
65
|
-
recalculateStructureNumbers(transaction, structureSpec);
|
|
69
|
+
recalculateStructureNumbers(transaction, schema, structureSpec);
|
|
70
|
+
|
|
71
|
+
const { toCreate, toRemove } = findUpdatedRelationships({
|
|
72
|
+
contentToWrap,
|
|
73
|
+
resourceHierarchy,
|
|
74
|
+
newResource,
|
|
75
|
+
});
|
|
76
|
+
let newState = state;
|
|
77
|
+
toCreate.forEach(([outer, inner]) => {
|
|
78
|
+
newState = state.apply(transaction);
|
|
79
|
+
addProperty({
|
|
80
|
+
resource: outer,
|
|
81
|
+
property: {
|
|
82
|
+
predicate: (structureSpec.relationshipPredicate ?? SAY('hasPart'))
|
|
83
|
+
.prefixed,
|
|
84
|
+
object: sayDataFactory.resourceNode(inner),
|
|
85
|
+
},
|
|
86
|
+
transaction,
|
|
87
|
+
})(newState, (newTransaction) => {
|
|
88
|
+
transaction = newTransaction;
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
toRemove.forEach(([outer, inner]) => {
|
|
92
|
+
newState = state.apply(transaction);
|
|
93
|
+
removeProperty({
|
|
94
|
+
resource: outer,
|
|
95
|
+
property: {
|
|
96
|
+
predicate: (structureSpec.relationshipPredicate ?? SAY('hasPart'))
|
|
97
|
+
.prefixed,
|
|
98
|
+
object: sayDataFactory.resourceNode(inner),
|
|
99
|
+
},
|
|
100
|
+
transaction,
|
|
101
|
+
})(newState, (newTransaction) => {
|
|
102
|
+
transaction = newTransaction;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
66
106
|
dispatch(transaction);
|
|
67
107
|
}
|
|
68
108
|
return true;
|
|
69
109
|
};
|
|
70
110
|
};
|
|
71
111
|
|
|
112
|
+
type ContainerNode = { node: PNode | Fragment; from: number; to: number };
|
|
72
113
|
function findInsertionContainer(
|
|
73
114
|
selection: Selection,
|
|
74
115
|
nodeType: NodeType,
|
|
75
116
|
schema: Schema,
|
|
76
|
-
) {
|
|
117
|
+
): [ContainerNode | null, string[]] {
|
|
77
118
|
const { $from } = selection;
|
|
119
|
+
let container: ContainerNode | null = null;
|
|
120
|
+
const resourceHierarchy: string[] = [];
|
|
121
|
+
// Loop from current depth to top looking for a container and subject URIs
|
|
78
122
|
for (let currentDepth = $from.depth; currentDepth >= 0; currentDepth--) {
|
|
79
123
|
const currentAncestor = $from.node(currentDepth);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
currentAncestor.canReplaceWith(0, currentAncestor.childCount, nodeType)
|
|
85
|
-
) {
|
|
86
|
-
return {
|
|
87
|
-
node: currentAncestor.content,
|
|
88
|
-
from: pos + 1,
|
|
89
|
-
to: pos + currentAncestor.nodeSize - 1,
|
|
90
|
-
};
|
|
124
|
+
const subject = currentAncestor.attrs?.subject as string | undefined;
|
|
125
|
+
if (subject) {
|
|
126
|
+
resourceHierarchy.unshift(subject);
|
|
91
127
|
}
|
|
128
|
+
if (!container) {
|
|
129
|
+
const pos = currentDepth > 0 ? $from.before(currentDepth) : -1;
|
|
92
130
|
|
|
93
|
-
|
|
94
|
-
|
|
131
|
+
// Simple like for like replacement from 0th index
|
|
132
|
+
if (
|
|
133
|
+
currentAncestor.canReplaceWith(0, currentAncestor.childCount, nodeType)
|
|
134
|
+
) {
|
|
135
|
+
container = {
|
|
136
|
+
node: currentAncestor.content,
|
|
137
|
+
from: pos + 1,
|
|
138
|
+
to: pos + currentAncestor.nodeSize - 1,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
95
141
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
142
|
+
const currentAncestorParent = $from.node(currentDepth - 1);
|
|
143
|
+
const currentAncestorIndexInParent = $from.index(currentDepth - 1);
|
|
99
144
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
145
|
+
if (!currentAncestorParent) {
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Sometimes we might not be able to replace from 0th index, but we can try to go one
|
|
150
|
+
// level up and attempt to replace `currentAncestor` as a child of its parent
|
|
151
|
+
if (
|
|
152
|
+
currentAncestorParent.canReplaceWith(
|
|
153
|
+
currentAncestorIndexInParent,
|
|
154
|
+
currentAncestorIndexInParent + 1,
|
|
155
|
+
nodeType,
|
|
156
|
+
)
|
|
157
|
+
) {
|
|
158
|
+
container = {
|
|
159
|
+
node: currentAncestor,
|
|
160
|
+
from: pos,
|
|
161
|
+
to: pos + currentAncestor.nodeSize - 1,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Special case when we reach `doc` node, but cannot replace the content.
|
|
167
|
+
* e.g. we reached doc, and it contains "document_title article article",
|
|
168
|
+
* we might not be able to wrap single `article`, depending on the `content` definition,
|
|
169
|
+
* of the `doc`. We try to find sibling nodes of same type and try
|
|
170
|
+
* to wrap them all together, that includes the content that might be between them.
|
|
171
|
+
*/
|
|
172
|
+
if (currentAncestorParent.type.spec === schema.nodes.doc.spec) {
|
|
173
|
+
const doc = currentAncestorParent;
|
|
115
174
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let firstOfTypePosition: null | number = null;
|
|
127
|
-
let lastOfTypePosition: null | number = null;
|
|
128
|
-
|
|
129
|
-
currentAncestorParent.forEach((node, pos) => {
|
|
130
|
-
if (node.type === currentAncestor.type) {
|
|
131
|
-
if (!firstOfTypePosition) {
|
|
132
|
-
firstOfTypePosition = pos;
|
|
175
|
+
let firstOfTypePosition: null | number = null;
|
|
176
|
+
let lastOfTypePosition: null | number = null;
|
|
177
|
+
|
|
178
|
+
currentAncestorParent.forEach((node, pos) => {
|
|
179
|
+
if (node.type === currentAncestor.type) {
|
|
180
|
+
if (!firstOfTypePosition) {
|
|
181
|
+
firstOfTypePosition = pos;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
lastOfTypePosition = pos;
|
|
133
185
|
}
|
|
186
|
+
});
|
|
134
187
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
188
|
+
if (firstOfTypePosition !== null && lastOfTypePosition !== null) {
|
|
189
|
+
const from = firstOfTypePosition;
|
|
190
|
+
const to = doc.resolve(lastOfTypePosition).end();
|
|
138
191
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
from,
|
|
155
|
-
to,
|
|
156
|
-
};
|
|
192
|
+
const node = doc.cut(from, to).content;
|
|
193
|
+
|
|
194
|
+
if (
|
|
195
|
+
currentAncestorParent.canReplaceWith(
|
|
196
|
+
doc.resolve(from).index(),
|
|
197
|
+
doc.resolve(to).index(),
|
|
198
|
+
nodeType,
|
|
199
|
+
)
|
|
200
|
+
) {
|
|
201
|
+
container = {
|
|
202
|
+
node,
|
|
203
|
+
from,
|
|
204
|
+
to,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
157
207
|
}
|
|
158
208
|
}
|
|
159
209
|
}
|
|
160
210
|
}
|
|
161
|
-
return
|
|
211
|
+
return [container, resourceHierarchy];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function findUpdatedRelationships({
|
|
215
|
+
contentToWrap,
|
|
216
|
+
newResource,
|
|
217
|
+
resourceHierarchy,
|
|
218
|
+
}: {
|
|
219
|
+
contentToWrap: PNode | Fragment;
|
|
220
|
+
newResource: string;
|
|
221
|
+
resourceHierarchy: string[];
|
|
222
|
+
}): { toCreate: [string, string][]; toRemove: [string, string][] } {
|
|
223
|
+
const wrappedResource = (
|
|
224
|
+
'attrs' in contentToWrap
|
|
225
|
+
? contentToWrap.attrs
|
|
226
|
+
: contentToWrap.firstChild?.attrs
|
|
227
|
+
)?.subject as string;
|
|
228
|
+
|
|
229
|
+
const toCreate: [string, string][] = [];
|
|
230
|
+
const toRemove: [string, string][] = [];
|
|
231
|
+
if (resourceHierarchy.length === 0) {
|
|
232
|
+
// There are no existing resources, so no relationships
|
|
233
|
+
} else if (!wrappedResource) {
|
|
234
|
+
// There's no resource inside the new resource, so the only potential relationship is with the
|
|
235
|
+
// inner resource of the existing hierarchy
|
|
236
|
+
toCreate.push([
|
|
237
|
+
resourceHierarchy[resourceHierarchy.length - 1],
|
|
238
|
+
newResource,
|
|
239
|
+
]);
|
|
240
|
+
} else {
|
|
241
|
+
// There is a resource wrapped by our new one
|
|
242
|
+
toCreate.push([newResource, wrappedResource]);
|
|
243
|
+
// Now check if that resource was inside another, so we undo that relationship and put our new
|
|
244
|
+
// resource in the middle
|
|
245
|
+
const wrappedIndex = resourceHierarchy.indexOf(wrappedResource);
|
|
246
|
+
const resourceBeforeWrapped = resourceHierarchy[wrappedIndex - 1];
|
|
247
|
+
if (resourceBeforeWrapped) {
|
|
248
|
+
toRemove.push([resourceBeforeWrapped, wrappedResource]);
|
|
249
|
+
toCreate.push([resourceBeforeWrapped, newResource]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return { toCreate, toRemove };
|
|
162
254
|
}
|
|
163
255
|
|
|
164
256
|
export default wrapStructureContent;
|
|
@@ -6,9 +6,19 @@ import {
|
|
|
6
6
|
Transaction,
|
|
7
7
|
} from '@lblod/ember-rdfa-editor';
|
|
8
8
|
import IntlService from 'ember-intl/services/intl';
|
|
9
|
+
import type { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
9
10
|
|
|
10
11
|
export type SpecName = string;
|
|
11
12
|
|
|
13
|
+
export type SpecConstructorResult = {
|
|
14
|
+
node: PNode;
|
|
15
|
+
selectionConfig: {
|
|
16
|
+
rdfaId: string;
|
|
17
|
+
type: 'node' | 'text';
|
|
18
|
+
};
|
|
19
|
+
newResource: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
12
22
|
export type StructureSpec = {
|
|
13
23
|
name: SpecName;
|
|
14
24
|
translations: {
|
|
@@ -26,14 +36,12 @@ export type StructureSpec = {
|
|
|
26
36
|
intl?: IntlService;
|
|
27
37
|
content?: PNode | Fragment;
|
|
28
38
|
state?: EditorState;
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
type: 'node' | 'text';
|
|
34
|
-
};
|
|
39
|
+
}) => SpecConstructorResult;
|
|
40
|
+
numberConfig: {
|
|
41
|
+
numberPredicate?: Resource;
|
|
42
|
+
convertNumber: (number: number) => string;
|
|
35
43
|
};
|
|
36
|
-
|
|
44
|
+
setNumber: (args: {
|
|
37
45
|
number: number;
|
|
38
46
|
pos: number;
|
|
39
47
|
transaction: Transaction;
|
|
@@ -52,6 +60,7 @@ export type StructureSpec = {
|
|
|
52
60
|
continuous: boolean;
|
|
53
61
|
limitTo?: string;
|
|
54
62
|
noUnwrap?: boolean;
|
|
63
|
+
relationshipPredicate?: Resource;
|
|
55
64
|
};
|
|
56
65
|
|
|
57
66
|
export type ArticleStructurePluginOptions = StructureSpec[];
|