@lblod/ember-rdfa-editor-lblod-plugins 0.4.1 → 1.0.0-alpha.2
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/CHANGELOG.md +46 -0
- package/addon/components/article-structure-plugin/article-structure-card.hbs +10 -0
- package/addon/components/article-structure-plugin/article-structure-card.ts +33 -0
- package/addon/components/article-structure-plugin/structure-card.hbs +46 -0
- package/addon/components/article-structure-plugin/structure-card.ts +124 -0
- package/addon/components/au-native-input.hbs +30 -0
- package/addon/components/au-native-input.ts +47 -0
- package/addon/components/besluit-plugin/besluit-context-card.hbs +44 -0
- package/addon/components/besluit-plugin/besluit-context-card.ts +138 -0
- package/addon/components/besluit-plugin/besluit-plugin-card.hbs +20 -0
- package/addon/components/besluit-plugin/besluit-plugin-card.ts +40 -0
- package/addon/components/besluit-type-plugin/{besluit-type-select.js → besluit-type-select.ts} +8 -4
- package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -0
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +218 -0
- package/addon/components/citation-plugin/citation-card.hbs +118 -0
- package/addon/components/citation-plugin/citation-card.ts +230 -0
- package/addon/components/citation-plugin/citation-insert.hbs +20 -0
- package/addon/components/citation-plugin/citation-insert.ts +102 -0
- package/addon/components/{citaten-plugin → citation-plugin}/citations/article-list.hbs +2 -2
- package/addon/components/{citaten-plugin → citation-plugin}/citations/article-preview.hbs +0 -0
- package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-detail.hbs +9 -6
- package/addon/components/{citaten-plugin/citations/decision-detail.js → citation-plugin/citations/decision-detail.ts} +30 -31
- package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-list.hbs +2 -2
- package/addon/components/{citaten-plugin → citation-plugin}/citations/decision-preview.hbs +0 -0
- package/addon/components/citation-plugin/citations/search-modal.hbs +254 -0
- package/addon/components/{citaten-plugin/citations/search-modal.js → citation-plugin/citations/search-modal.ts} +117 -90
- package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.hbs +0 -0
- package/addon/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.hbs +0 -0
- package/addon/components/import-snippet-plugin/card.ts +119 -0
- package/addon/components/insert-variable-plugin/insert-variable-card.hbs +2 -1
- package/addon/components/insert-variable-plugin/insert-variable-card.ts +134 -0
- package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-card.hbs → card.hbs} +3 -1
- package/addon/components/rdfa-date-plugin/card.ts +72 -0
- package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.hbs → date-time-picker.hbs} +0 -0
- package/addon/components/rdfa-date-plugin/{rdfa-date-time-picker.js → date-time-picker.ts} +26 -12
- package/addon/components/rdfa-date-plugin/{rdfa-date-plugin-insert.hbs → insert.hbs} +0 -0
- package/addon/components/rdfa-date-plugin/insert.ts +45 -0
- package/addon/components/roadsign-regulation-plugin/expanded-measure.ts +58 -0
- package/addon/components/roadsign-regulation-plugin/measure-template.ts +35 -0
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.hbs +2 -2
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +60 -0
- package/addon/components/roadsign-regulation-plugin/{roadsigns-modal.js → roadsigns-modal.ts} +103 -66
- package/addon/components/roadsign-regulation-plugin/{roadsigns-pagination.js → roadsigns-pagination.ts} +7 -3
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +32 -0
- package/addon/components/standard-template-plugin/{template-card.hbs → card.hbs} +0 -0
- package/addon/components/standard-template-plugin/card.ts +11 -0
- package/addon/components/standard-template-plugin/template-provider.hbs +3 -1
- package/addon/components/standard-template-plugin/template-provider.ts +75 -0
- package/addon/components/table-of-contents-plugin/card.hbs +12 -1
- package/addon/components/table-of-contents-plugin/card.ts +60 -0
- package/addon/components/table-of-contents-plugin/{inline-components → ember-nodes}/outline.hbs +2 -2
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +9 -0
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +95 -0
- package/addon/components/template-variable-plugin/template-variable-card.hbs +2 -1
- package/addon/components/template-variable-plugin/template-variable-card.ts +227 -0
- package/addon/helpers/{limit-text.js → limit-text.ts} +2 -2
- package/addon/models/instruction.ts +18 -0
- package/addon/models/measure.ts +38 -0
- package/addon/models/sign.ts +36 -0
- package/addon/models/template.ts +14 -0
- package/addon/plugins/article-structure-plugin/commands/index.ts +6 -0
- package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +80 -0
- package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +130 -0
- package/addon/plugins/article-structure-plugin/commands/recalculate-structure-numbers.ts +26 -0
- package/addon/plugins/article-structure-plugin/commands/remove-structure.ts +21 -0
- package/addon/plugins/article-structure-plugin/commands/unwrap-structure.ts +40 -0
- package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +66 -0
- package/addon/plugins/article-structure-plugin/constants.ts +11 -0
- package/addon/plugins/article-structure-plugin/index.ts +70 -0
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +94 -0
- package/addon/plugins/article-structure-plugin/structures/article.ts +129 -0
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +83 -0
- package/addon/plugins/article-structure-plugin/structures/index.ts +33 -0
- package/addon/plugins/article-structure-plugin/structures/section.ts +82 -0
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +65 -0
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +83 -0
- package/addon/plugins/article-structure-plugin/structures/title.ts +83 -0
- package/addon/plugins/article-structure-plugin/utils/namespace.ts +25 -0
- package/addon/plugins/article-structure-plugin/utils/structure.ts +162 -0
- package/addon/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.ts +30 -0
- package/addon/plugins/besluit-plugin/commands/index.ts +4 -0
- package/addon/plugins/besluit-plugin/commands/insert-article.ts +70 -0
- package/addon/plugins/besluit-plugin/commands/insert-title.ts +67 -0
- package/addon/plugins/besluit-plugin/commands/move-article.ts +69 -0
- package/addon/plugins/besluit-plugin/commands/recalculate-article-numbers.ts +44 -0
- package/addon/plugins/besluit-plugin/index.ts +11 -0
- package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +35 -0
- package/addon/plugins/besluit-type-plugin/index.ts +6 -0
- package/addon/{utils/fetchBesluitTypes.js → plugins/besluit-type-plugin/utils/fetchBesluitTypes.ts} +35 -16
- package/addon/plugins/citation-plugin/index.ts +216 -0
- package/addon/plugins/citation-plugin/marks/citation.ts +27 -0
- package/addon/plugins/citation-plugin/utils/cited-text.ts +17 -0
- package/addon/{utils/legislation-types.js → plugins/citation-plugin/utils/legislation-types.ts} +17 -3
- package/addon/plugins/citation-plugin/utils/process-match.ts +132 -0
- package/addon/{utils/vlaamse-codex.js → plugins/citation-plugin/utils/vlaamse-codex.ts} +160 -41
- package/addon/plugins/import-snippet-plugin.ts +6 -0
- package/addon/plugins/insert-variable-plugin/index.ts +11 -0
- package/addon/{utils/variable-plugins/default-variable-types.js → plugins/insert-variable-plugin/utils/constants.ts} +18 -7
- package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +41 -0
- package/addon/plugins/rdfa-date-plugin/commands/index.ts +1 -0
- package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +48 -0
- package/addon/plugins/rdfa-date-plugin/index.ts +11 -0
- package/addon/plugins/roadsign-regulation-plugin/index.ts +6 -0
- package/addon/plugins/roadsign-regulation-plugin/utils/constants.ts +8 -0
- package/addon/{utils/roadsign-regulation-plugin/fetchData.js → plugins/roadsign-regulation-plugin/utils/fetchData.ts} +20 -3
- package/addon/plugins/roadsign-regulation-plugin/utils/includeInstructions.ts +16 -0
- package/addon/plugins/standard-template-plugin/index.ts +6 -0
- package/addon/plugins/standard-template-plugin/utils/instantiate-uuids.ts +48 -0
- package/addon/plugins/table-of-contents-plugin/index.ts +14 -0
- package/addon/plugins/table-of-contents-plugin/nodes/index.ts +1 -0
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +53 -0
- package/addon/plugins/table-of-contents-plugin/utils/constants.ts +17 -0
- package/addon/plugins/template-variable-plugin/index.ts +6 -0
- package/addon/plugins/template-variable-plugin/utils/constants.ts +2 -0
- package/addon/plugins/template-variable-plugin/utils/fetch-data.ts +62 -0
- package/addon/services/{import-rdfa-snippet.js → import-rdfa-snippet.ts} +48 -36
- package/addon/services/roadsign-registry.ts +288 -0
- package/addon/services/{standard-template-plugin.js → standard-template-plugin.ts} +17 -11
- package/addon/utils/memoize.ts +8 -0
- package/addon/utils/option.ts +58 -0
- package/addon/utils/sparql-helpers.ts +27 -0
- package/app/components/article-structure-plugin/article-structure-card.js +1 -0
- package/app/components/article-structure-plugin/structure-card.js +1 -0
- package/app/components/{citaten-plugin/citaat-card.js → au-native-input.js} +1 -1
- package/app/components/{citaten-plugin/citations/article-list.js → besluit-plugin/besluit-context-card.js} +1 -1
- package/app/components/besluit-plugin/besluit-plugin-card.js +1 -0
- package/app/components/{citaten-plugin/citations/modal.js → citation-plugin/citation-card.js} +1 -1
- package/app/components/citation-plugin/citation-insert.js +1 -0
- package/app/components/{citaten-plugin/citations/decision-list.js → citation-plugin/citations/article-list.js} +1 -1
- package/app/components/{citaten-plugin → citation-plugin}/citations/article-preview.js +1 -1
- package/app/components/{citaten-plugin → citation-plugin}/citations/decision-detail.js +1 -1
- package/app/components/citation-plugin/citations/decision-list.js +1 -0
- package/app/components/{citaten-plugin → citation-plugin}/citations/decision-preview.js +1 -1
- package/app/components/citation-plugin/citations/modal.js +1 -0
- package/app/components/{citaten-plugin → citation-plugin}/citations/search-modal.js +1 -1
- package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-load-error.js +1 -1
- package/app/components/{citaten-plugin → citation-plugin}/helpers/alert-no-items.js +1 -1
- package/app/components/{citaten-plugin/citaat-insert.js → rdfa-date-plugin/card.js} +1 -1
- package/app/components/rdfa-date-plugin/date-time-picker.js +1 -0
- package/app/components/rdfa-date-plugin/insert.js +1 -0
- package/app/components/standard-template-plugin/card.js +1 -0
- package/app/components/table-of-contents-plugin/ember-nodes/outline.js +1 -0
- package/app/components/table-of-contents-plugin/ember-nodes/table-of-contents.js +1 -0
- package/app/styles/citaten-plugin.scss +1 -1
- package/components/article-structure-plugin/article-structure-card.d.ts +17 -0
- package/components/article-structure-plugin/structure-card.d.ts +32 -0
- package/components/au-native-input.d.ts +20 -0
- package/components/besluit-plugin/besluit-context-card.d.ts +24 -0
- package/components/besluit-plugin/besluit-plugin-card.d.ts +14 -0
- package/components/besluit-type-plugin/besluit-type-select.d.ts +11 -0
- package/components/besluit-type-plugin/toolbar-dropdown.d.ts +46 -0
- package/components/citation-plugin/citation-card.d.ts +51 -0
- package/components/citation-plugin/citation-insert.d.ts +24 -0
- package/components/citation-plugin/citations/decision-detail.d.ts +26 -0
- package/components/citation-plugin/citations/search-modal.d.ts +67 -0
- package/components/import-snippet-plugin/card.d.ts +19 -0
- package/components/insert-variable-plugin/insert-variable-card.d.ts +31 -0
- package/components/rdfa-date-plugin/card.d.ts +20 -0
- package/components/rdfa-date-plugin/date-time-picker.d.ts +32 -0
- package/components/rdfa-date-plugin/insert.d.ts +12 -0
- package/components/roadsign-regulation-plugin/expanded-measure.d.ts +20 -0
- package/components/roadsign-regulation-plugin/measure-template.d.ts +14 -0
- package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +12 -0
- package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +57 -0
- package/components/roadsign-regulation-plugin/roadsigns-pagination.d.ts +19 -0
- package/components/roadsign-regulation-plugin/roadsigns-table.d.ts +9 -0
- package/components/standard-template-plugin/card.d.ts +9 -0
- package/components/standard-template-plugin/template-provider.d.ts +17 -0
- package/components/table-of-contents-plugin/card.d.ts +20 -0
- package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +22 -0
- package/components/template-variable-plugin/template-variable-card.d.ts +27 -0
- package/helpers/limit-text.d.ts +8 -0
- package/index.js +5 -0
- package/models/instruction.d.ts +8 -0
- package/models/measure.d.ts +14 -0
- package/models/sign.d.ts +12 -0
- package/models/template.d.ts +13 -0
- package/package.json +29 -8
- package/plugins/article-structure-plugin/commands/index.d.ts +6 -0
- package/plugins/article-structure-plugin/commands/insert-structure.d.ts +5 -0
- package/plugins/article-structure-plugin/commands/move-selected-structure.d.ts +10 -0
- package/plugins/article-structure-plugin/commands/recalculate-structure-numbers.d.ts +3 -0
- package/plugins/article-structure-plugin/commands/remove-structure.d.ts +7 -0
- package/plugins/article-structure-plugin/commands/unwrap-structure.d.ts +8 -0
- package/plugins/article-structure-plugin/commands/wrap-structure-content.d.ts +8 -0
- package/plugins/article-structure-plugin/constants.d.ts +5 -0
- package/plugins/article-structure-plugin/index.d.ts +41 -0
- package/plugins/article-structure-plugin/structures/article-paragraph.d.ts +4 -0
- package/plugins/article-structure-plugin/structures/article.d.ts +6 -0
- package/plugins/article-structure-plugin/structures/chapter.d.ts +4 -0
- package/plugins/article-structure-plugin/structures/index.d.ts +17 -0
- package/plugins/article-structure-plugin/structures/section.d.ts +4 -0
- package/plugins/article-structure-plugin/structures/structure-header.d.ts +2 -0
- package/plugins/article-structure-plugin/structures/subsection.d.ts +4 -0
- package/plugins/article-structure-plugin/structures/title.d.ts +4 -0
- package/plugins/article-structure-plugin/utils/namespace.d.ts +6 -0
- package/plugins/article-structure-plugin/utils/structure.d.ts +20 -0
- package/plugins/besluit-plugin/commands/get-article-nodes-for-besluit.d.ts +5 -0
- package/plugins/besluit-plugin/commands/index.d.ts +4 -0
- package/plugins/besluit-plugin/commands/insert-article.d.ts +3 -0
- package/plugins/besluit-plugin/commands/insert-title.d.ts +2 -0
- package/plugins/besluit-plugin/commands/move-article.d.ts +2 -0
- package/plugins/besluit-plugin/commands/recalculate-article-numbers.d.ts +2 -0
- package/plugins/besluit-plugin/index.d.ts +3 -0
- package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +10 -0
- package/plugins/besluit-type-plugin/index.d.ts +2 -0
- package/plugins/besluit-type-plugin/utils/fetchBesluitTypes.d.ts +12 -0
- package/plugins/citation-plugin/index.d.ts +31 -0
- package/plugins/citation-plugin/marks/citation.d.ts +2 -0
- package/plugins/citation-plugin/utils/cited-text.d.ts +3 -0
- package/plugins/citation-plugin/utils/legislation-types.d.ts +24 -0
- package/plugins/citation-plugin/utils/process-match.d.ts +23 -0
- package/plugins/citation-plugin/utils/vlaamse-codex.d.ts +56 -0
- package/plugins/import-snippet-plugin.d.ts +2 -0
- package/plugins/insert-variable-plugin/index.d.ts +2 -0
- package/plugins/insert-variable-plugin/utils/constants.d.ts +7 -0
- package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +5 -0
- package/plugins/rdfa-date-plugin/commands/index.d.ts +1 -0
- package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +2 -0
- package/plugins/rdfa-date-plugin/index.d.ts +3 -0
- package/plugins/roadsign-regulation-plugin/index.d.ts +2 -0
- package/plugins/roadsign-regulation-plugin/utils/constants.d.ts +3 -0
- package/plugins/roadsign-regulation-plugin/utils/fetchData.d.ts +8 -0
- package/plugins/roadsign-regulation-plugin/utils/includeInstructions.d.ts +2 -0
- package/plugins/standard-template-plugin/index.d.ts +2 -0
- package/plugins/standard-template-plugin/utils/instantiate-uuids.d.ts +15 -0
- package/plugins/table-of-contents-plugin/index.d.ts +3 -0
- package/plugins/table-of-contents-plugin/nodes/index.d.ts +1 -0
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -0
- package/plugins/table-of-contents-plugin/utils/constants.d.ts +7 -0
- package/plugins/template-variable-plugin/index.d.ts +2 -0
- package/plugins/template-variable-plugin/utils/constants.d.ts +1 -0
- package/plugins/template-variable-plugin/utils/fetch-data.d.ts +9 -0
- package/services/import-rdfa-snippet.d.ts +99 -0
- package/services/roadsign-registry.d.ts +42 -0
- package/services/standard-template-plugin.d.ts +21 -0
- package/translations/en-US.yaml +64 -1
- package/translations/nl-BE.yaml +66 -3
- package/tsconfig.json +34 -9
- package/types/config/environment.d.ts +22 -0
- package/types/ember-mu-transform-helpers/transforms/string-set.d.ts +14 -0
- package/types/lblod/frontend-gelinkt-notuleren/models/account.d.ts +10 -0
- package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid-classificatie-code.d.ts +10 -0
- package/types/lblod/frontend-gelinkt-notuleren/models/bestuurseenheid.d.ts +12 -0
- package/types/lblod/frontend-gelinkt-notuleren/models/gebruiker-model.d.ts +18 -0
- package/types/lblod/frontend-gelinkt-notuleren/services/current-session.d.ts +30 -0
- package/types/lblod/marawa/dom-helpers.d.ts +4 -0
- package/types/lblod/marawa/ember-object-mock.d.ts +3 -0
- package/types/lblod/marawa/node-walker.d.ts +18 -0
- package/types/lblod/marawa/range-helpers.d.ts +10 -0
- package/types/lblod/marawa/rdfa-attributes.d.ts +25 -0
- package/types/lblod/marawa/rdfa-block.d.ts +22 -0
- package/types/lblod/marawa/rdfa-context-scanner.d.ts +13 -0
- package/types/lblod/marawa/rdfa-helpers.d.ts +22 -0
- package/types/lblod/marawa/rich-node.d.ts +50 -0
- package/types/lblod/marawa/triple.d.ts +16 -0
- package/utils/memoize.d.ts +1 -0
- package/utils/option.d.ts +14 -0
- package/utils/sparql-helpers.d.ts +7 -0
- package/addon/commands/generate-template-command.js +0 -35
- package/addon/commands/insert-and-collapse.js +0 -32
- package/addon/commands/modify-date-command.js +0 -42
- package/addon/components/besluit-type-plugin/toolbar-dropdown.js +0 -188
- package/addon/components/citaten-plugin/citaat-card.hbs +0 -76
- package/addon/components/citaten-plugin/citaat-card.js +0 -286
- package/addon/components/citaten-plugin/citaat-insert.hbs +0 -20
- package/addon/components/citaten-plugin/citaat-insert.js +0 -68
- package/addon/components/citaten-plugin/citations/search-modal.hbs +0 -175
- package/addon/components/import-snippet-plugin/card.js +0 -95
- package/addon/components/insert-variable-plugin/insert-variable-card.js +0 -125
- package/addon/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -71
- package/addon/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -24
- package/addon/components/roadsign-regulation-plugin/expanded-measure.js +0 -38
- package/addon/components/roadsign-regulation-plugin/measure-template.js +0 -30
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.js +0 -101
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.js +0 -24
- package/addon/components/standard-template-plugin/template-card.js +0 -7
- package/addon/components/standard-template-plugin/template-provider.js +0 -75
- package/addon/components/table-of-contents-plugin/card.js +0 -53
- package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.hbs +0 -9
- package/addon/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -100
- package/addon/components/template-variable-plugin/template-variable-card.js +0 -230
- package/addon/constants.js +0 -24
- package/addon/initializers/plugin-initializer.js +0 -75
- package/addon/inline-components/table-of-contents.js +0 -43
- package/addon/marks/citaten-mark.js +0 -32
- package/addon/models/instruction.js +0 -19
- package/addon/models/measure.js +0 -46
- package/addon/models/sign.js +0 -37
- package/addon/models/template.js +0 -9
- package/addon/plugins/besluit-type-plugin.js +0 -16
- package/addon/plugins/citaten-plugin.js +0 -22
- package/addon/plugins/generate-template-plugin.js +0 -16
- package/addon/plugins/import-snippet-plugin.js +0 -16
- package/addon/plugins/insert-variable-plugin.js +0 -19
- package/addon/plugins/rdfa-date-plugin.js +0 -26
- package/addon/plugins/roadsign-regulation-plugin.js +0 -24
- package/addon/plugins/standard-template-plugin.js +0 -33
- package/addon/plugins/table-of-contents-plugin.js +0 -27
- package/addon/plugins/template-variable-plugin.js +0 -21
- package/addon/services/roadsign-registry.js +0 -240
- package/addon/utils/generate-template-plugin/default-resources.js +0 -9
- package/addon/utils/instantiate-uuids.js +0 -34
- package/addon/utils/memoize.js +0 -8
- package/addon/utils/processMatch.js +0 -80
- package/addon/utils/roadsign-regulation-plugin/includeInstructions.js +0 -10
- package/addon/utils/variable-plugins/fetch-data.js +0 -98
- package/app/components/rdfa-date-plugin/rdfa-date-plugin-card.js +0 -1
- package/app/components/rdfa-date-plugin/rdfa-date-plugin-insert.js +0 -1
- package/app/components/rdfa-date-plugin/rdfa-date-time-picker.js +0 -1
- package/app/components/standard-template-plugin/template-card.js +0 -1
- package/app/components/table-of-contents-plugin/inline-components/outline.js +0 -1
- package/app/components/table-of-contents-plugin/inline-components/table-of-contents.js +0 -1
- package/app/initializers/plugin-initializer.js +0 -4
- package/types/dummy/index.d.ts +0 -1
- package/types/ember-data/types/registries/model.d.ts +0 -6
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
2
|
+
import { StructureSpec } from '..';
|
|
3
|
+
import {
|
|
4
|
+
constructStructureBodyNodeSpec,
|
|
5
|
+
constructStructureNodeSpec,
|
|
6
|
+
romanize,
|
|
7
|
+
} from '../utils/structure';
|
|
8
|
+
import { v4 as uuid } from 'uuid';
|
|
9
|
+
import { SAY } from '../constants';
|
|
10
|
+
|
|
11
|
+
const PLACEHOLDERS = {
|
|
12
|
+
title: 'article-structure-plugin.placeholder.chapter.heading',
|
|
13
|
+
body: 'article-structure-plugin.placeholder.chapter.body',
|
|
14
|
+
};
|
|
15
|
+
export const chapterSpec: StructureSpec = {
|
|
16
|
+
name: 'chapter',
|
|
17
|
+
context: ['doc', 'block', 'title_body'],
|
|
18
|
+
continuous: false,
|
|
19
|
+
translations: {
|
|
20
|
+
insert: 'article-structure-plugin.insert.chapter',
|
|
21
|
+
move: {
|
|
22
|
+
up: 'article-structure-plugin.moveUp.chapter',
|
|
23
|
+
down: 'article-structure-plugin.moveDown.chapter',
|
|
24
|
+
},
|
|
25
|
+
remove: 'article-structure-plugin.remove.chapter',
|
|
26
|
+
},
|
|
27
|
+
constructor: ({ schema, number, content, intl }) => {
|
|
28
|
+
const numberConverted = romanize(number ?? 1);
|
|
29
|
+
const node = schema.node(
|
|
30
|
+
`chapter`,
|
|
31
|
+
{ resource: `http://data.lblod.info/chapters/${uuid()}` },
|
|
32
|
+
[
|
|
33
|
+
schema.node(
|
|
34
|
+
'structure_header',
|
|
35
|
+
{ level: 4, number: numberConverted },
|
|
36
|
+
schema.node('placeholder', {
|
|
37
|
+
placeholderText: intl?.t(PLACEHOLDERS.title),
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
|
+
schema.node(
|
|
41
|
+
`chapter_body`,
|
|
42
|
+
{},
|
|
43
|
+
content ??
|
|
44
|
+
schema.node(
|
|
45
|
+
'paragraph',
|
|
46
|
+
{},
|
|
47
|
+
schema.node('placeholder', {
|
|
48
|
+
placeholderText: intl?.t(PLACEHOLDERS.body),
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
),
|
|
52
|
+
]
|
|
53
|
+
);
|
|
54
|
+
const selectionConfig: {
|
|
55
|
+
relativePos: number;
|
|
56
|
+
type: 'text' | 'node';
|
|
57
|
+
} = content
|
|
58
|
+
? { relativePos: 5, type: 'text' }
|
|
59
|
+
: { relativePos: 6, type: 'node' };
|
|
60
|
+
return {
|
|
61
|
+
node,
|
|
62
|
+
selectionConfig,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
updateNumber: ({ number, pos, transaction }) => {
|
|
66
|
+
const numberConverted = romanize(number);
|
|
67
|
+
return transaction.setNodeAttribute(pos + 1, 'number', numberConverted);
|
|
68
|
+
},
|
|
69
|
+
content: ({ pos, state }) => {
|
|
70
|
+
const node = unwrap(state.doc.nodeAt(pos));
|
|
71
|
+
return node.child(1).content;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const chapter = constructStructureNodeSpec({
|
|
76
|
+
type: SAY('Chapter'),
|
|
77
|
+
content: 'structure_header chapter_body',
|
|
78
|
+
group: 'block',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const chapter_body = constructStructureBodyNodeSpec({
|
|
82
|
+
content: '(section|paragraph)+|(article|paragraph)+',
|
|
83
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ArticleStructurePluginOptions } from '..';
|
|
2
|
+
import { article, articleSpec, article_body, article_header } from './article';
|
|
3
|
+
import { articleParagraphSpec, article_paragraph } from './article-paragraph';
|
|
4
|
+
import { chapterSpec, chapter, chapter_body } from './chapter';
|
|
5
|
+
import { titleSpec, title, title_body } from './title';
|
|
6
|
+
import { sectionSpec, section, section_body } from './section';
|
|
7
|
+
import { structure_header } from './structure-header';
|
|
8
|
+
import { subsectionSpec, subsection, subsection_body } from './subsection';
|
|
9
|
+
|
|
10
|
+
export const STRUCTURE_SPECS: ArticleStructurePluginOptions = [
|
|
11
|
+
titleSpec,
|
|
12
|
+
chapterSpec,
|
|
13
|
+
sectionSpec,
|
|
14
|
+
subsectionSpec,
|
|
15
|
+
articleSpec,
|
|
16
|
+
articleParagraphSpec,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const STRUCTURE_NODES = {
|
|
20
|
+
structure_header,
|
|
21
|
+
title,
|
|
22
|
+
title_body,
|
|
23
|
+
chapter,
|
|
24
|
+
chapter_body,
|
|
25
|
+
section,
|
|
26
|
+
section_body,
|
|
27
|
+
subsection,
|
|
28
|
+
subsection_body,
|
|
29
|
+
article,
|
|
30
|
+
article_header,
|
|
31
|
+
article_body,
|
|
32
|
+
article_paragraph,
|
|
33
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
constructStructureBodyNodeSpec,
|
|
3
|
+
constructStructureNodeSpec,
|
|
4
|
+
romanize,
|
|
5
|
+
} from '../utils/structure';
|
|
6
|
+
import { v4 as uuid } from 'uuid';
|
|
7
|
+
import { StructureSpec } from '..';
|
|
8
|
+
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
9
|
+
import { SAY } from '../constants';
|
|
10
|
+
|
|
11
|
+
const PLACEHOLDERS = {
|
|
12
|
+
title: 'article-structure-plugin.placeholder.section.heading',
|
|
13
|
+
body: 'article-structure-plugin.placeholder.section.body',
|
|
14
|
+
};
|
|
15
|
+
export const sectionSpec: StructureSpec = {
|
|
16
|
+
name: 'section',
|
|
17
|
+
context: ['chapter_body'],
|
|
18
|
+
continuous: false,
|
|
19
|
+
translations: {
|
|
20
|
+
insert: 'article-structure-plugin.insert.section',
|
|
21
|
+
move: {
|
|
22
|
+
up: 'article-structure-plugin.moveUp.section',
|
|
23
|
+
down: 'article-structure-plugin.moveDown.section',
|
|
24
|
+
},
|
|
25
|
+
remove: 'article-structure-plugin.remove.section',
|
|
26
|
+
},
|
|
27
|
+
constructor: ({ schema, number, content, intl }) => {
|
|
28
|
+
const numberConverted = romanize(number || 1);
|
|
29
|
+
const node = schema.node(
|
|
30
|
+
`section`,
|
|
31
|
+
{ resource: `http://data.lblod.info/sections/${uuid()}` },
|
|
32
|
+
[
|
|
33
|
+
schema.node(
|
|
34
|
+
'structure_header',
|
|
35
|
+
{ level: 4, number: numberConverted },
|
|
36
|
+
schema.node('placeholder', {
|
|
37
|
+
placeholderText: intl?.t(PLACEHOLDERS.title),
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
|
+
schema.node(
|
|
41
|
+
`section_body`,
|
|
42
|
+
{},
|
|
43
|
+
content ??
|
|
44
|
+
schema.node(
|
|
45
|
+
'paragraph',
|
|
46
|
+
{},
|
|
47
|
+
schema.node('placeholder', {
|
|
48
|
+
placeholderText: intl?.t(PLACEHOLDERS.body),
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
),
|
|
52
|
+
]
|
|
53
|
+
);
|
|
54
|
+
const selectionConfig: {
|
|
55
|
+
relativePos: number;
|
|
56
|
+
type: 'text' | 'node';
|
|
57
|
+
} = content
|
|
58
|
+
? { relativePos: 5, type: 'text' }
|
|
59
|
+
: { relativePos: 6, type: 'node' };
|
|
60
|
+
return {
|
|
61
|
+
node,
|
|
62
|
+
selectionConfig,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
updateNumber: ({ number, pos, transaction }) => {
|
|
66
|
+
const numberConverted = romanize(number);
|
|
67
|
+
return transaction.setNodeAttribute(pos + 1, 'number', numberConverted);
|
|
68
|
+
},
|
|
69
|
+
content: ({ pos, state }) => {
|
|
70
|
+
const node = unwrap(state.doc.nodeAt(pos));
|
|
71
|
+
return node.child(1).content;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const section = constructStructureNodeSpec({
|
|
76
|
+
type: SAY('Section'),
|
|
77
|
+
content: 'structure_header section_body',
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export const section_body = constructStructureBodyNodeSpec({
|
|
81
|
+
content: '(subsection|paragraph)+|(article|paragraph)+',
|
|
82
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NodeSpec } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { ELI, EXT, SAY, XSD } from '../constants';
|
|
3
|
+
import { getStructureHeaderAttrs } from '../utils/structure';
|
|
4
|
+
|
|
5
|
+
const TAG_TO_LEVEL = new Map([
|
|
6
|
+
['h1', 1],
|
|
7
|
+
['h2', 2],
|
|
8
|
+
['h3', 3],
|
|
9
|
+
['h4', 4],
|
|
10
|
+
['h5', 5],
|
|
11
|
+
['h6', 6],
|
|
12
|
+
['span', 6],
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export const structure_header: NodeSpec = {
|
|
16
|
+
content: 'text*|placeholder',
|
|
17
|
+
inline: false,
|
|
18
|
+
attrs: {
|
|
19
|
+
property: {
|
|
20
|
+
default: SAY('heading').prefixed,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
number: {
|
|
24
|
+
default: '1',
|
|
25
|
+
},
|
|
26
|
+
level: {
|
|
27
|
+
default: 1,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
toDOM(node) {
|
|
31
|
+
return [
|
|
32
|
+
`h${node.attrs.level as number}`,
|
|
33
|
+
{ property: node.attrs.property as string },
|
|
34
|
+
[
|
|
35
|
+
'span',
|
|
36
|
+
{ property: ELI('number').prefixed, datatype: XSD('string').prefixed },
|
|
37
|
+
node.attrs.number,
|
|
38
|
+
],
|
|
39
|
+
'. ',
|
|
40
|
+
[
|
|
41
|
+
'span',
|
|
42
|
+
{
|
|
43
|
+
property: EXT('title').prefixed,
|
|
44
|
+
},
|
|
45
|
+
0,
|
|
46
|
+
],
|
|
47
|
+
];
|
|
48
|
+
},
|
|
49
|
+
parseDOM: [
|
|
50
|
+
{
|
|
51
|
+
tag: 'h1,h2,h3,h4,h5,h6,span',
|
|
52
|
+
getAttrs(element: HTMLElement) {
|
|
53
|
+
const level = TAG_TO_LEVEL.get(element.tagName.toLowerCase()) ?? 6;
|
|
54
|
+
const headerAttrs = getStructureHeaderAttrs(element);
|
|
55
|
+
if (headerAttrs) {
|
|
56
|
+
return { level, ...headerAttrs };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return false;
|
|
60
|
+
},
|
|
61
|
+
contentElement: `span[property~='${EXT('title').prefixed}'],
|
|
62
|
+
span[property~='${EXT('title').full}']`,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { StructureSpec } from '..';
|
|
2
|
+
import {
|
|
3
|
+
constructStructureBodyNodeSpec,
|
|
4
|
+
constructStructureNodeSpec,
|
|
5
|
+
romanize,
|
|
6
|
+
} from '../utils/structure';
|
|
7
|
+
import { v4 as uuid } from 'uuid';
|
|
8
|
+
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
9
|
+
import { SAY } from '../constants';
|
|
10
|
+
|
|
11
|
+
const PLACEHOLDERS = {
|
|
12
|
+
title: 'article-structure-plugin.placeholder.subsection.heading',
|
|
13
|
+
body: 'article-structure-plugin.placeholder.subsection.body',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const subsectionSpec: StructureSpec = {
|
|
17
|
+
name: 'subsection',
|
|
18
|
+
context: ['section_body'],
|
|
19
|
+
continuous: false,
|
|
20
|
+
translations: {
|
|
21
|
+
insert: 'article-structure-plugin.insert.subsection',
|
|
22
|
+
move: {
|
|
23
|
+
up: 'article-structure-plugin.moveUp.subsection',
|
|
24
|
+
down: 'article-structure-plugin.moveDown.subsection',
|
|
25
|
+
},
|
|
26
|
+
remove: 'article-structure-plugin.remove.subsection',
|
|
27
|
+
},
|
|
28
|
+
constructor: ({ schema, number, intl, content }) => {
|
|
29
|
+
const numberConverted = romanize(number ?? 1);
|
|
30
|
+
const node = schema.node(
|
|
31
|
+
`subsection`,
|
|
32
|
+
{ resource: `http://data.lblod.info/subsections/${uuid()}` },
|
|
33
|
+
[
|
|
34
|
+
schema.node(
|
|
35
|
+
'structure_header',
|
|
36
|
+
{ level: 4, number: numberConverted },
|
|
37
|
+
schema.node('placeholder', {
|
|
38
|
+
placeholderText: intl?.t(PLACEHOLDERS.title),
|
|
39
|
+
})
|
|
40
|
+
),
|
|
41
|
+
schema.node(
|
|
42
|
+
`subsection_body`,
|
|
43
|
+
{},
|
|
44
|
+
content ??
|
|
45
|
+
schema.node(
|
|
46
|
+
'paragraph',
|
|
47
|
+
{},
|
|
48
|
+
schema.node('placeholder', {
|
|
49
|
+
placeholderText: intl?.t(PLACEHOLDERS.body),
|
|
50
|
+
})
|
|
51
|
+
)
|
|
52
|
+
),
|
|
53
|
+
]
|
|
54
|
+
);
|
|
55
|
+
const selectionConfig: {
|
|
56
|
+
relativePos: number;
|
|
57
|
+
type: 'text' | 'node';
|
|
58
|
+
} = content
|
|
59
|
+
? { relativePos: 5, type: 'text' }
|
|
60
|
+
: { relativePos: 6, type: 'node' };
|
|
61
|
+
return {
|
|
62
|
+
node,
|
|
63
|
+
selectionConfig,
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
updateNumber: ({ number, pos, transaction }) => {
|
|
67
|
+
const numberConverted = romanize(number);
|
|
68
|
+
return transaction.setNodeAttribute(pos + 1, 'number', numberConverted);
|
|
69
|
+
},
|
|
70
|
+
content: ({ pos, state }) => {
|
|
71
|
+
const node = unwrap(state.doc.nodeAt(pos));
|
|
72
|
+
return node.child(1).content;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const subsection = constructStructureNodeSpec({
|
|
77
|
+
type: SAY('Subsection'),
|
|
78
|
+
content: 'structure_header subsection_body',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const subsection_body = constructStructureBodyNodeSpec({
|
|
82
|
+
content: '(article|paragraph)+',
|
|
83
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
2
|
+
import { StructureSpec } from '..';
|
|
3
|
+
import {
|
|
4
|
+
constructStructureBodyNodeSpec,
|
|
5
|
+
constructStructureNodeSpec,
|
|
6
|
+
romanize,
|
|
7
|
+
} from '../utils/structure';
|
|
8
|
+
import { v4 as uuid } from 'uuid';
|
|
9
|
+
import { SAY } from '../constants';
|
|
10
|
+
|
|
11
|
+
const PLACEHOLDERS = {
|
|
12
|
+
heading: 'article-structure-plugin.placeholder.generic.heading',
|
|
13
|
+
body: 'article-structure-plugin.placeholder.generic.body',
|
|
14
|
+
};
|
|
15
|
+
export const titleSpec: StructureSpec = {
|
|
16
|
+
name: 'title',
|
|
17
|
+
context: ['doc', 'block'],
|
|
18
|
+
continuous: false,
|
|
19
|
+
translations: {
|
|
20
|
+
insert: 'article-structure-plugin.insert.title',
|
|
21
|
+
move: {
|
|
22
|
+
up: 'article-structure-plugin.moveUp.title',
|
|
23
|
+
down: 'article-structure-plugin.moveDown.title',
|
|
24
|
+
},
|
|
25
|
+
remove: 'article-structure-plugin.remove.title',
|
|
26
|
+
},
|
|
27
|
+
constructor: ({ schema, number, content, intl }) => {
|
|
28
|
+
const numberConverted = romanize(number ?? 1);
|
|
29
|
+
const node = schema.node(
|
|
30
|
+
`title`,
|
|
31
|
+
{ resource: `http://data.lblod.info/titles/${uuid()}` },
|
|
32
|
+
[
|
|
33
|
+
schema.node(
|
|
34
|
+
'structure_header',
|
|
35
|
+
{ level: 3, number: numberConverted },
|
|
36
|
+
schema.node('placeholder', {
|
|
37
|
+
placeholderText: intl?.t(PLACEHOLDERS.heading),
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
|
+
schema.node(
|
|
41
|
+
`title_body`,
|
|
42
|
+
{},
|
|
43
|
+
content ??
|
|
44
|
+
schema.node(
|
|
45
|
+
'paragraph',
|
|
46
|
+
{},
|
|
47
|
+
schema.node('placeholder', {
|
|
48
|
+
placeholderText: intl?.t(PLACEHOLDERS.body),
|
|
49
|
+
})
|
|
50
|
+
)
|
|
51
|
+
),
|
|
52
|
+
]
|
|
53
|
+
);
|
|
54
|
+
const selectionConfig: {
|
|
55
|
+
relativePos: number;
|
|
56
|
+
type: 'text' | 'node';
|
|
57
|
+
} = content
|
|
58
|
+
? { relativePos: 5, type: 'text' }
|
|
59
|
+
: { relativePos: 6, type: 'node' };
|
|
60
|
+
return {
|
|
61
|
+
node,
|
|
62
|
+
selectionConfig,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
updateNumber: ({ number, pos, transaction }) => {
|
|
66
|
+
const numberConverted = romanize(number);
|
|
67
|
+
return transaction.setNodeAttribute(pos + 1, 'number', numberConverted);
|
|
68
|
+
},
|
|
69
|
+
content: ({ pos, state }) => {
|
|
70
|
+
const node = unwrap(state.doc.nodeAt(pos));
|
|
71
|
+
return node.child(1).content;
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const title = constructStructureNodeSpec({
|
|
76
|
+
type: SAY('Title'),
|
|
77
|
+
content: 'structure_header title_body',
|
|
78
|
+
group: 'block',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export const title_body = constructStructureBodyNodeSpec({
|
|
82
|
+
content: '(chapter|paragraph)+|(article|paragraph)+',
|
|
83
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type Resource = {
|
|
2
|
+
prefixed: string;
|
|
3
|
+
full: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export function namespace(uri: string, prefix: string) {
|
|
7
|
+
return (s: string): Resource => {
|
|
8
|
+
return {
|
|
9
|
+
prefixed: prefix && `${prefix}:${s}`,
|
|
10
|
+
full: uri + s,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function hasRDFaAttribute(
|
|
16
|
+
element: Element,
|
|
17
|
+
attr: string,
|
|
18
|
+
value: Resource
|
|
19
|
+
) {
|
|
20
|
+
const result = element.getAttribute(attr)?.split(' ');
|
|
21
|
+
if (result) {
|
|
22
|
+
return result.includes(value.full) || result.includes(value.prefixed);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { NodeSpec, NodeType, Selection } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
3
|
+
import { ELI, RDF, SAY } from '../constants';
|
|
4
|
+
import { hasRDFaAttribute, Resource } from './namespace';
|
|
5
|
+
|
|
6
|
+
export function constructStructureNodeSpec(config: {
|
|
7
|
+
type: Resource;
|
|
8
|
+
content: string;
|
|
9
|
+
group?: string;
|
|
10
|
+
}): NodeSpec {
|
|
11
|
+
const { group, content, type } = config;
|
|
12
|
+
return {
|
|
13
|
+
group,
|
|
14
|
+
content,
|
|
15
|
+
inline: false,
|
|
16
|
+
attrs: {
|
|
17
|
+
property: {
|
|
18
|
+
default: SAY('hasPart').prefixed,
|
|
19
|
+
},
|
|
20
|
+
typeof: {
|
|
21
|
+
default: type.prefixed,
|
|
22
|
+
},
|
|
23
|
+
resource: {},
|
|
24
|
+
},
|
|
25
|
+
toDOM(node) {
|
|
26
|
+
return [
|
|
27
|
+
'div',
|
|
28
|
+
{
|
|
29
|
+
property: node.attrs.property as string,
|
|
30
|
+
typeof: node.attrs.typeof as string,
|
|
31
|
+
resource: node.attrs.resource as string,
|
|
32
|
+
},
|
|
33
|
+
0,
|
|
34
|
+
];
|
|
35
|
+
},
|
|
36
|
+
parseDOM: [
|
|
37
|
+
{
|
|
38
|
+
tag: 'div',
|
|
39
|
+
getAttrs(element: HTMLElement) {
|
|
40
|
+
if (
|
|
41
|
+
hasRDFaAttribute(element, 'property', SAY('hasPart')) &&
|
|
42
|
+
hasRDFaAttribute(element, 'typeof', type) &&
|
|
43
|
+
element.getAttribute('resource')
|
|
44
|
+
) {
|
|
45
|
+
return { resource: element.getAttribute('resource') };
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function constructStructureBodyNodeSpec(config: {
|
|
55
|
+
content: string;
|
|
56
|
+
}): NodeSpec {
|
|
57
|
+
const { content } = config;
|
|
58
|
+
return {
|
|
59
|
+
content,
|
|
60
|
+
inline: false,
|
|
61
|
+
toDOM() {
|
|
62
|
+
return [
|
|
63
|
+
'div',
|
|
64
|
+
{
|
|
65
|
+
property: SAY('body').prefixed,
|
|
66
|
+
datatype: RDF('XMLLiteral').prefixed,
|
|
67
|
+
},
|
|
68
|
+
0,
|
|
69
|
+
];
|
|
70
|
+
},
|
|
71
|
+
parseDOM: [
|
|
72
|
+
{
|
|
73
|
+
tag: 'div',
|
|
74
|
+
getAttrs(element: HTMLElement) {
|
|
75
|
+
if (
|
|
76
|
+
hasRDFaAttribute(element, 'property', SAY('body')) &&
|
|
77
|
+
hasRDFaAttribute(element, 'datatype', RDF('XMLLiteral'))
|
|
78
|
+
) {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function findAncestorOfType(selection: Selection, ...types: NodeType[]) {
|
|
89
|
+
const parent = findParentNodeOfType(types)(selection);
|
|
90
|
+
if (parent) {
|
|
91
|
+
return parent;
|
|
92
|
+
}
|
|
93
|
+
if (types.includes(selection.$from.doc.type)) {
|
|
94
|
+
return {
|
|
95
|
+
node: selection.$from.doc,
|
|
96
|
+
pos: -1,
|
|
97
|
+
start: 0,
|
|
98
|
+
depth: 0,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function getStructureHeaderAttrs(element: HTMLElement) {
|
|
105
|
+
const numberNode = element.children[0];
|
|
106
|
+
if (
|
|
107
|
+
hasRDFaAttribute(element, 'property', SAY('heading')) &&
|
|
108
|
+
numberNode &&
|
|
109
|
+
hasRDFaAttribute(numberNode, 'property', ELI('number'))
|
|
110
|
+
) {
|
|
111
|
+
return {
|
|
112
|
+
number: numberNode.textContent,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function romanize(num: number) {
|
|
119
|
+
if (isNaN(num)) throw new Error('Provided number is NaN');
|
|
120
|
+
const digits = String(+num).split('');
|
|
121
|
+
const key = [
|
|
122
|
+
'',
|
|
123
|
+
'C',
|
|
124
|
+
'CC',
|
|
125
|
+
'CCC',
|
|
126
|
+
'CD',
|
|
127
|
+
'D',
|
|
128
|
+
'DC',
|
|
129
|
+
'DCC',
|
|
130
|
+
'DCCC',
|
|
131
|
+
'CM',
|
|
132
|
+
'',
|
|
133
|
+
'X',
|
|
134
|
+
'XX',
|
|
135
|
+
'XXX',
|
|
136
|
+
'XL',
|
|
137
|
+
'L',
|
|
138
|
+
'LX',
|
|
139
|
+
'LXX',
|
|
140
|
+
'LXXX',
|
|
141
|
+
'XC',
|
|
142
|
+
'',
|
|
143
|
+
'I',
|
|
144
|
+
'II',
|
|
145
|
+
'III',
|
|
146
|
+
'IV',
|
|
147
|
+
'V',
|
|
148
|
+
'VI',
|
|
149
|
+
'VII',
|
|
150
|
+
'VIII',
|
|
151
|
+
'IX',
|
|
152
|
+
];
|
|
153
|
+
let roman = '';
|
|
154
|
+
let i = 3;
|
|
155
|
+
while (i--) {
|
|
156
|
+
const digit = digits.pop();
|
|
157
|
+
if (digit) {
|
|
158
|
+
roman = (key[Number(digit) + i * 10] || '') + roman;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return Array(+digits.join('') + 1).join('M') + roman;
|
|
162
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProseController } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
3
|
+
|
|
4
|
+
export default function getArticleNodesForBesluit(
|
|
5
|
+
controller: ProseController,
|
|
6
|
+
besluitUri?: string
|
|
7
|
+
) {
|
|
8
|
+
if (!besluitUri) {
|
|
9
|
+
const selection = controller.state.selection;
|
|
10
|
+
besluitUri = controller.datastore
|
|
11
|
+
.limitToRange(controller.state, selection.from, selection.to)
|
|
12
|
+
.match(null, 'a', 'besluit:Besluit')
|
|
13
|
+
.asQuadResultSet()
|
|
14
|
+
.first()?.subject.value;
|
|
15
|
+
}
|
|
16
|
+
if (!besluitUri) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const articles = controller.datastore
|
|
20
|
+
.match(`>${besluitUri}`, 'eli:has_part')
|
|
21
|
+
.asObjectNodeMapping();
|
|
22
|
+
return [
|
|
23
|
+
...articles.map((article) => {
|
|
24
|
+
return {
|
|
25
|
+
uri: article.term.value,
|
|
26
|
+
range: unwrap(article.nodes.shift()),
|
|
27
|
+
};
|
|
28
|
+
}),
|
|
29
|
+
];
|
|
30
|
+
}
|