@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
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import { task } from 'ember-concurrency';
|
|
5
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
6
|
-
import { INVISIBLE_SPACE } from '@lblod/ember-rdfa-editor/model/util/constants';
|
|
7
|
-
import { defaultVariableTypes } from '../../utils/variable-plugins/default-variable-types';
|
|
8
|
-
|
|
9
|
-
export default class EditorPluginsInsertCodelistCardComponent extends Component {
|
|
10
|
-
@tracked variablesArray;
|
|
11
|
-
@tracked selectedVariable;
|
|
12
|
-
@tracked showCard = true;
|
|
13
|
-
@tracked hasSubtype = false;
|
|
14
|
-
@tracked selectedSubtype;
|
|
15
|
-
@tracked subtypes;
|
|
16
|
-
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
const { publisher, variableTypes, defaultEndpoint } =
|
|
20
|
-
this.args.widgetArgs.options || {};
|
|
21
|
-
this.publisher = publisher;
|
|
22
|
-
this.endpoint = defaultEndpoint;
|
|
23
|
-
let variableTypesSelectedByUser = variableTypes ?? [
|
|
24
|
-
'text',
|
|
25
|
-
'number',
|
|
26
|
-
'date',
|
|
27
|
-
'location',
|
|
28
|
-
'codelist',
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const variablesArray = [];
|
|
32
|
-
for (let type of variableTypesSelectedByUser) {
|
|
33
|
-
if (typeof type === 'string') {
|
|
34
|
-
const defaultVariable = defaultVariableTypes[type];
|
|
35
|
-
if (defaultVariable) {
|
|
36
|
-
variablesArray.push(defaultVariable);
|
|
37
|
-
} else {
|
|
38
|
-
console.warn(
|
|
39
|
-
`Template Variable Plugin: variable type ${type} not found in the default variable types`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
variablesArray.push(type);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
this.variablesArray = variablesArray;
|
|
47
|
-
this.args.controller.onEvent('selectionChanged', this.selectionChanged);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@action
|
|
51
|
-
insert() {
|
|
52
|
-
const uri = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
53
|
-
let variableContent;
|
|
54
|
-
if (typeof this.selectedVariable.template === 'function') {
|
|
55
|
-
variableContent = this.selectedVariable.template(
|
|
56
|
-
this.endpoint,
|
|
57
|
-
this.selectedSubtype
|
|
58
|
-
);
|
|
59
|
-
} else {
|
|
60
|
-
variableContent = this.selectedVariable.template;
|
|
61
|
-
}
|
|
62
|
-
const htmlToInsert = `
|
|
63
|
-
<span resource="${uri}" typeof="ext:Mapping">
|
|
64
|
-
${variableContent}
|
|
65
|
-
</span>
|
|
66
|
-
`;
|
|
67
|
-
this.args.controller.executeCommand(
|
|
68
|
-
'insert-html',
|
|
69
|
-
htmlToInsert,
|
|
70
|
-
this.args.controller.selection.lastRange
|
|
71
|
-
);
|
|
72
|
-
this.args.controller.executeCommand(
|
|
73
|
-
'insert-text',
|
|
74
|
-
INVISIBLE_SPACE,
|
|
75
|
-
this.args.controller.selection.lastRange
|
|
76
|
-
);
|
|
77
|
-
this.selectedVariableType = undefined;
|
|
78
|
-
this.selectedCodelist = undefined;
|
|
79
|
-
this.isCodelist = false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@action
|
|
83
|
-
updateSelectedVariable(variable) {
|
|
84
|
-
this.selectedVariable = variable;
|
|
85
|
-
if (variable.fetchSubtypes) {
|
|
86
|
-
this.fetchSubtypes.perform(variable.fetchSubtypes);
|
|
87
|
-
this.hasSubtype = true;
|
|
88
|
-
} else {
|
|
89
|
-
this.hasSubtype = false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@task
|
|
94
|
-
*fetchSubtypes(fetchFunction) {
|
|
95
|
-
const subtypes = yield fetchFunction(this.endpoint, this.publisher);
|
|
96
|
-
this.subtypes = subtypes;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@action
|
|
100
|
-
updateSubtype(subtype) {
|
|
101
|
-
this.selectedSubtype = subtype;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@action
|
|
105
|
-
selectionChanged() {
|
|
106
|
-
const currentSelection = this.args.controller.selection.lastRange;
|
|
107
|
-
if (!currentSelection) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.showCard = false;
|
|
111
|
-
const limitedDatastore = this.args.controller.datastore.limitToRange(
|
|
112
|
-
currentSelection,
|
|
113
|
-
'rangeIsInside'
|
|
114
|
-
);
|
|
115
|
-
const mapping = limitedDatastore
|
|
116
|
-
.match(null, 'a', 'ext:Mapping')
|
|
117
|
-
.asQuads()
|
|
118
|
-
.next().value;
|
|
119
|
-
if (mapping) {
|
|
120
|
-
this.showCard = false;
|
|
121
|
-
} else {
|
|
122
|
-
this.showCard = true;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
|
|
5
|
-
export default class RdfaDatePluginCardComponent extends Component {
|
|
6
|
-
@tracked showCard = false;
|
|
7
|
-
@tracked dateValue;
|
|
8
|
-
@tracked dateElement;
|
|
9
|
-
@tracked dateInDocument;
|
|
10
|
-
@tracked onlyDate;
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.args.controller.onEvent(
|
|
15
|
-
'selectionChanged',
|
|
16
|
-
this.selectionChangedHandler
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@action
|
|
21
|
-
modifyDate() {
|
|
22
|
-
this.args.controller.executeCommand(
|
|
23
|
-
'modify-date',
|
|
24
|
-
this.args.controller,
|
|
25
|
-
this.dateElement,
|
|
26
|
-
this.dateValue,
|
|
27
|
-
this.onlyDate
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@action
|
|
32
|
-
changeDate(date) {
|
|
33
|
-
this.dateValue = date;
|
|
34
|
-
if (this.dateInDocument) this.modifyDate();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@action
|
|
38
|
-
selectionChangedHandler() {
|
|
39
|
-
const selectedRange = this.args.controller.selection.lastRange;
|
|
40
|
-
if (!selectedRange) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const selectionParent = selectedRange.start.findAncestors(
|
|
44
|
-
(element) => element.attributeMap && element.attributeMap.get('datatype')
|
|
45
|
-
)[0];
|
|
46
|
-
if (!selectionParent) {
|
|
47
|
-
this.showCard = false;
|
|
48
|
-
this.dateElement = undefined;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const datatype = selectionParent.attributeMap.get('datatype');
|
|
52
|
-
if (datatype === 'xsd:dateTime') {
|
|
53
|
-
this.showCard = true;
|
|
54
|
-
this.dateElement = selectionParent;
|
|
55
|
-
const dateContent = selectionParent.attributeMap.get('content');
|
|
56
|
-
this.dateValue = dateContent ? new Date(dateContent) : new Date();
|
|
57
|
-
this.dateInDocument = !!dateContent;
|
|
58
|
-
this.onlyDate = false;
|
|
59
|
-
} else if (datatype === 'xsd:date') {
|
|
60
|
-
this.showCard = true;
|
|
61
|
-
this.dateElement = selectionParent;
|
|
62
|
-
const dateContent = selectionParent.attributeMap.get('content');
|
|
63
|
-
this.dateValue = dateContent ? new Date(dateContent) : new Date();
|
|
64
|
-
this.dateInDocument = !!dateContent;
|
|
65
|
-
this.onlyDate = true;
|
|
66
|
-
} else {
|
|
67
|
-
this.showCard = false;
|
|
68
|
-
this.dateElement = undefined;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { action } from '@ember/object';
|
|
3
|
-
|
|
4
|
-
export default class RdfaDatePluginInsertComponent extends Component {
|
|
5
|
-
@action
|
|
6
|
-
insertDate() {
|
|
7
|
-
const selection = this.args.controller.selection.lastRange;
|
|
8
|
-
this.args.controller.executeCommand(
|
|
9
|
-
'insert-html',
|
|
10
|
-
'<span datatype="xsd:date" property="ext:content">${date}</span>',
|
|
11
|
-
selection
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@action
|
|
16
|
-
insertDateTime() {
|
|
17
|
-
const selection = this.args.controller.selection.lastRange;
|
|
18
|
-
this.args.controller.executeCommand(
|
|
19
|
-
'insert-html',
|
|
20
|
-
'<span datatype="xsd:dateTime" property="ext:content">${date and time}</span>',
|
|
21
|
-
selection
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import {
|
|
5
|
-
NON_ZONAL_URI,
|
|
6
|
-
POTENTIALLY_ZONAL_URI,
|
|
7
|
-
ZONAL_URI,
|
|
8
|
-
} from '../../constants';
|
|
9
|
-
|
|
10
|
-
export default class ExpandedMeasureComponent extends Component {
|
|
11
|
-
@tracked zonalityValue;
|
|
12
|
-
@tracked temporalValue;
|
|
13
|
-
ZONAL_URI = ZONAL_URI;
|
|
14
|
-
NON_ZONAL_URI = NON_ZONAL_URI;
|
|
15
|
-
get isPotentiallyZonal() {
|
|
16
|
-
return this.args.measure.zonality === POTENTIALLY_ZONAL_URI;
|
|
17
|
-
}
|
|
18
|
-
get insertButtonDisabled() {
|
|
19
|
-
return this.isPotentiallyZonal && !this.zonalityValue;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@action
|
|
23
|
-
changeZonality(e) {
|
|
24
|
-
this.zonalityValue = e.target.value;
|
|
25
|
-
}
|
|
26
|
-
@action
|
|
27
|
-
changeTemporality(e) {
|
|
28
|
-
this.temporalValue = e.target.value;
|
|
29
|
-
}
|
|
30
|
-
@action
|
|
31
|
-
insert() {
|
|
32
|
-
this.args.insert(this.args.measure, this.zonalityValue, this.temporalValue);
|
|
33
|
-
}
|
|
34
|
-
@action
|
|
35
|
-
unselectRow() {
|
|
36
|
-
this.args.selectRow(this.args.measure.uri);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { inject as service } from '@ember/service';
|
|
3
|
-
import { task } from 'ember-concurrency';
|
|
4
|
-
import { tracked } from '@glimmer/tracking';
|
|
5
|
-
import includeInstructions from '../../utils/roadsign-regulation-plugin/includeInstructions';
|
|
6
|
-
|
|
7
|
-
export default class MeasureTemplateComponent extends Component {
|
|
8
|
-
@service roadsignRegistry;
|
|
9
|
-
@tracked template = '';
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.template = this.args.template;
|
|
14
|
-
this.fetchData.perform();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@task
|
|
18
|
-
*fetchData() {
|
|
19
|
-
const instructions =
|
|
20
|
-
yield this.roadsignRegistry.getInstructionsForMeasure.perform(
|
|
21
|
-
this.args.measure
|
|
22
|
-
);
|
|
23
|
-
let template = includeInstructions(
|
|
24
|
-
this.args.template,
|
|
25
|
-
instructions,
|
|
26
|
-
this.args.annotated
|
|
27
|
-
);
|
|
28
|
-
this.template = template;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
|
-
import Component from '@glimmer/component';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Card displaying a hint of the Date plugin
|
|
7
|
-
*
|
|
8
|
-
* @module editor-roadsign-regulation-plugin
|
|
9
|
-
* @class RoadsignRegulationCard
|
|
10
|
-
* @extends Ember.Component
|
|
11
|
-
*/
|
|
12
|
-
const acceptedTypes = [
|
|
13
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/4d8f678a-6fa4-4d5f-a2a1-80974e43bf34',
|
|
14
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/7d95fd2e-3cc9-4a4c-a58e-0fbc408c2f9b',
|
|
15
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/3bba9f10-faff-49a6-acaa-85af7f2199a3',
|
|
16
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/0d1278af-b69e-4152-a418-ec5cfd1c7d0b',
|
|
17
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/e8afe7c5-9640-4db8-8f74-3f023bec3241',
|
|
18
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/256bd04a-b74b-4f2a-8f5d-14dda4765af9',
|
|
19
|
-
'>https://data.vlaanderen.be/id/concept/BesluitType/67378dd0-5413-474b-8996-d992ef81637a',
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
export default class RoadsignRegulationCard extends Component {
|
|
23
|
-
@tracked modalOpen;
|
|
24
|
-
@tracked showCard = false;
|
|
25
|
-
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.args.controller.onEvent('selectionChanged', this.selectionChanged);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@action
|
|
32
|
-
toggleModal() {
|
|
33
|
-
this.modalOpen = !this.modalOpen;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@action
|
|
37
|
-
insert(html) {
|
|
38
|
-
const selectedRange = this.args.controller.selection.lastRange;
|
|
39
|
-
if (!selectedRange) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const limitedDatastore = this.args.controller.datastore.limitToRange(
|
|
43
|
-
selectedRange,
|
|
44
|
-
'rangeIsInside'
|
|
45
|
-
);
|
|
46
|
-
const besluit = limitedDatastore
|
|
47
|
-
.match(null, 'a')
|
|
48
|
-
.transformDataset((dataset, termConverter) => {
|
|
49
|
-
return dataset.filter((quad) =>
|
|
50
|
-
acceptedTypes
|
|
51
|
-
.map((type) => termConverter(type).value)
|
|
52
|
-
.includes(quad.object.value)
|
|
53
|
-
);
|
|
54
|
-
})
|
|
55
|
-
.asSubjectNodes()
|
|
56
|
-
.next().value;
|
|
57
|
-
const besluitNode = [...besluit.nodes][0];
|
|
58
|
-
let articleContainerNode;
|
|
59
|
-
for (let child of besluitNode.children) {
|
|
60
|
-
if (child.attributeMap.get('property') === 'prov:value') {
|
|
61
|
-
articleContainerNode = child;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const range = this.args.controller.rangeFactory.fromInNode(
|
|
66
|
-
articleContainerNode,
|
|
67
|
-
articleContainerNode.getMaxOffset(),
|
|
68
|
-
articleContainerNode.getMaxOffset()
|
|
69
|
-
);
|
|
70
|
-
this.args.controller.executeCommand('insert-html', html, range);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@action
|
|
74
|
-
selectionChanged() {
|
|
75
|
-
const selectedRange = this.args.controller.selection.lastRange;
|
|
76
|
-
if (!selectedRange) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const limitedDatastore = this.args.controller.datastore.limitToRange(
|
|
80
|
-
selectedRange,
|
|
81
|
-
'rangeIsInside'
|
|
82
|
-
);
|
|
83
|
-
const besluit = limitedDatastore
|
|
84
|
-
.match(null, 'a')
|
|
85
|
-
.transformDataset((dataset, termConverter) => {
|
|
86
|
-
return dataset.filter((quad) =>
|
|
87
|
-
acceptedTypes
|
|
88
|
-
.map((type) => termConverter(type).value)
|
|
89
|
-
.includes(quad.object.value)
|
|
90
|
-
);
|
|
91
|
-
})
|
|
92
|
-
.asQuads()
|
|
93
|
-
.next().value;
|
|
94
|
-
if (besluit) {
|
|
95
|
-
this.showCard = true;
|
|
96
|
-
this.besluitUri = besluit.subject.value;
|
|
97
|
-
} else {
|
|
98
|
-
this.showCard = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
|
-
import Component from '@glimmer/component';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
import { getOwner } from '@ember/application';
|
|
5
|
-
|
|
6
|
-
export default class RoadsignsTable extends Component {
|
|
7
|
-
@tracked selected;
|
|
8
|
-
imageBaseUrl;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
const config = getOwner(this).resolveRegistration('config:environment');
|
|
13
|
-
this.imageBaseUrl = config.roadsignRegulationPlugin.imageBaseUrl;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@action
|
|
17
|
-
selectRow(id) {
|
|
18
|
-
if (this.selected === id) {
|
|
19
|
-
this.selected = undefined;
|
|
20
|
-
} else {
|
|
21
|
-
this.selected = id;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
import { action } from '@ember/object';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
import { inject as service } from '@ember/service';
|
|
5
|
-
import instantiateUuids from '../../utils/instantiate-uuids';
|
|
6
|
-
|
|
7
|
-
export default class TemplateProviderComponent extends Component {
|
|
8
|
-
@service standardTemplatePlugin;
|
|
9
|
-
@tracked applicableTemplates = [];
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.args.controller.onEvent('selectionChanged', this.trackSelectionChange);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get busy() {
|
|
17
|
-
return this.standardTemplatePlugin.fetchTemplates.isRunning;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get controller() {
|
|
21
|
-
return this.args.controller;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get hasApplicableTemplates() {
|
|
25
|
-
return this.applicableTemplates.length > 0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
templateIsApplicable(template) {
|
|
29
|
-
const selectedRange = this.controller.selection.lastRange;
|
|
30
|
-
if (!selectedRange) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
const rangeStore = this.controller.datastore.limitToRange(
|
|
34
|
-
selectedRange,
|
|
35
|
-
'rangeIsInside'
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const containsTypes = rangeStore.match(null, 'a').dataset.some((quad) => {
|
|
39
|
-
return template.contexts.includes(quad.object.value);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const containsDisabledTypes = rangeStore
|
|
43
|
-
.match(null, 'a')
|
|
44
|
-
.dataset.some((quad) =>
|
|
45
|
-
template.disabledInContexts.includes(quad.object.value)
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return containsTypes && !containsDisabledTypes;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@action
|
|
52
|
-
trackSelectionChange() {
|
|
53
|
-
this.applicableTemplates =
|
|
54
|
-
this.standardTemplatePlugin.fetchTemplates.last.value?.filter(
|
|
55
|
-
(template) => this.templateIsApplicable(template)
|
|
56
|
-
) || [];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@action
|
|
60
|
-
async insert(template) {
|
|
61
|
-
await template.reload();
|
|
62
|
-
let insertRange = this.controller.selection.lastRange;
|
|
63
|
-
if (insertRange.getMarks().hasMarkName('highlighted')) {
|
|
64
|
-
insertRange = this.controller.rangeFactory.fromAroundNode(
|
|
65
|
-
insertRange.getCommonAncestor()
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
this.controller.executeCommand(
|
|
69
|
-
'insert-html',
|
|
70
|
-
instantiateUuids(template.body),
|
|
71
|
-
insertRange,
|
|
72
|
-
'right'
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { action } from '@ember/object';
|
|
2
|
-
import Component from '@glimmer/component';
|
|
3
|
-
import { tracked } from '@glimmer/tracking';
|
|
4
|
-
|
|
5
|
-
export default class TableOfContentsCardComponent extends Component {
|
|
6
|
-
@tracked toggled;
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.toggled = this.tableOfContentsInstances.length !== 0;
|
|
11
|
-
this.args.controller.onEvent('modelWritten', () => {
|
|
12
|
-
this.toggled = this.tableOfContentsInstances.length !== 0;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get tableOfContentsInstances() {
|
|
17
|
-
return this.args.controller.getComponentInstances({
|
|
18
|
-
componentName:
|
|
19
|
-
'table-of-contents-plugin/inline-components/table-of-contents',
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get tableOfContentsProps() {
|
|
24
|
-
return this.args.widgetArgs.config
|
|
25
|
-
? { config: this.args.widgetArgs.config }
|
|
26
|
-
: {};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@action
|
|
30
|
-
toggle() {
|
|
31
|
-
if (this.toggled) {
|
|
32
|
-
// Remove instances from table of contents
|
|
33
|
-
this.tableOfContentsInstances.forEach((instance) => {
|
|
34
|
-
const model = instance.componentController.model;
|
|
35
|
-
this.args.controller.executeCommand('remove-component', model);
|
|
36
|
-
});
|
|
37
|
-
} else {
|
|
38
|
-
// Add table of contents
|
|
39
|
-
console.log(this.tableOfContentsProps);
|
|
40
|
-
this.args.controller.executeCommand(
|
|
41
|
-
'insert-component',
|
|
42
|
-
'table-of-contents-plugin/inline-components/table-of-contents',
|
|
43
|
-
this.tableOfContentsProps,
|
|
44
|
-
false,
|
|
45
|
-
this.args.controller.rangeFactory.fromInElement(
|
|
46
|
-
this.args.controller.modelRoot,
|
|
47
|
-
0,
|
|
48
|
-
0
|
|
49
|
-
)
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<div class='au-u-background-gray-100 au-u-padding-tiny table-of-contents'>
|
|
2
|
-
<h3>{{t "table-of-contents-plugin.title"}}</h3>
|
|
3
|
-
{{#if this.documentOutline}}
|
|
4
|
-
<TableOfContentsPlugin::InlineComponents::Outline
|
|
5
|
-
@entries={{this.documentOutline.entries}}
|
|
6
|
-
@onEntryClick={{this.moveToSection}}
|
|
7
|
-
/>
|
|
8
|
-
{{/if}}
|
|
9
|
-
</div>
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import ModelNode from '@lblod/ember-rdfa-editor/model/model-node';
|
|
2
|
-
import { tracked } from '@glimmer/tracking';
|
|
3
|
-
import ModelNodeUtils from '@lblod/ember-rdfa-editor/model/util/model-node-utils';
|
|
4
|
-
import { action } from '@ember/object';
|
|
5
|
-
import Component from '@glimmer/component';
|
|
6
|
-
import dataFactory from '@rdfjs/data-model';
|
|
7
|
-
import { TABLE_OF_CONTENTS_DEFAULT_CONFIG } from '../../../constants';
|
|
8
|
-
export default class TableOfContentsComponent extends Component {
|
|
9
|
-
@tracked
|
|
10
|
-
documentOutline;
|
|
11
|
-
|
|
12
|
-
constructor(owner, args) {
|
|
13
|
-
super(owner, args);
|
|
14
|
-
this.update();
|
|
15
|
-
|
|
16
|
-
this.args.editorController.onEvent(
|
|
17
|
-
'contentChanged',
|
|
18
|
-
this.update.bind(this)
|
|
19
|
-
);
|
|
20
|
-
this.args.editorController.onEvent('modelRead', this.update.bind(this));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get config() {
|
|
24
|
-
return (
|
|
25
|
-
this.args.componentController.getProperty('config') ??
|
|
26
|
-
TABLE_OF_CONTENTS_DEFAULT_CONFIG
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
willDestroy() {
|
|
31
|
-
this.args.editorController.offEvent(
|
|
32
|
-
'contentChanged',
|
|
33
|
-
this.update.bind(this)
|
|
34
|
-
);
|
|
35
|
-
this.args.editorController.offEvent('modelRead', this.update.bind(this));
|
|
36
|
-
super.willDestroy();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
update() {
|
|
40
|
-
const outline = {
|
|
41
|
-
entries: this.extractOutline(this.args.editorController.modelRoot),
|
|
42
|
-
};
|
|
43
|
-
this.documentOutline = outline;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
extractOutline(node) {
|
|
47
|
-
let result = [];
|
|
48
|
-
|
|
49
|
-
if (ModelNode.isModelElement(node)) {
|
|
50
|
-
let parent;
|
|
51
|
-
const attributes = node.getRdfaAttributes();
|
|
52
|
-
if (attributes.properties) {
|
|
53
|
-
for (const tocConfigEntry of this.config) {
|
|
54
|
-
if (attributes.properties.includes(tocConfigEntry.sectionPredicate)) {
|
|
55
|
-
if (typeof tocConfigEntry.value === 'string') {
|
|
56
|
-
parent = { content: tocConfigEntry.value, node };
|
|
57
|
-
break;
|
|
58
|
-
} else {
|
|
59
|
-
const nodes = [
|
|
60
|
-
...this.args.editorController.datastore
|
|
61
|
-
.match(
|
|
62
|
-
`>${attributes.resource}`,
|
|
63
|
-
dataFactory.namedNode(tocConfigEntry.value.predicate)
|
|
64
|
-
)
|
|
65
|
-
.asObjectNodeMapping()
|
|
66
|
-
.nodes(),
|
|
67
|
-
];
|
|
68
|
-
if (nodes.length) {
|
|
69
|
-
parent = {
|
|
70
|
-
content: ModelNodeUtils.getTextContent(nodes[0]),
|
|
71
|
-
node,
|
|
72
|
-
};
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const subResults = [];
|
|
80
|
-
node.children.forEach((child) => {
|
|
81
|
-
subResults.push(...this.extractOutline(child));
|
|
82
|
-
});
|
|
83
|
-
if (parent) {
|
|
84
|
-
parent.children = subResults;
|
|
85
|
-
result = [parent];
|
|
86
|
-
} else {
|
|
87
|
-
result = subResults;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
@action
|
|
94
|
-
moveToSection(node) {
|
|
95
|
-
console.log('moveToSection');
|
|
96
|
-
const range = this.args.editorController.rangeFactory.fromInNode(node, 0);
|
|
97
|
-
this.args.editorController.selection.selectRange(range);
|
|
98
|
-
this.args.editorController.write(true, true);
|
|
99
|
-
}
|
|
100
|
-
}
|