@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-alpha.3 → 1.0.0-beta.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 +48 -0
- package/addon/components/article-structure-plugin/article-structure-card.hbs +3 -1
- package/addon/components/au-dropdown-pill.hbs +32 -0
- package/addon/components/au-dropdown-pill.ts +65 -0
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +19 -12
- package/addon/components/citation-plugin/citation-card.hbs +2 -2
- package/addon/components/citation-plugin/citation-card.ts +1 -1
- package/addon/components/citation-plugin/citation-insert.hbs +3 -1
- package/addon/components/citation-plugin/citation-insert.ts +28 -2
- package/addon/components/citation-plugin/citations/search-modal.hbs +1 -1
- package/addon/components/citation-plugin/citations/search-modal.ts +3 -18
- package/addon/components/import-snippet-plugin/card.ts +8 -12
- package/addon/components/rdfa-date-plugin/card.hbs +28 -0
- package/addon/components/rdfa-date-plugin/card.ts +72 -38
- package/addon/components/rdfa-date-plugin/date-time-picker.ts +1 -0
- package/addon/components/rdfa-date-plugin/insert.hbs +2 -2
- package/addon/components/rdfa-date-plugin/insert.ts +14 -23
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +24 -25
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +37 -18
- package/addon/components/standard-template-plugin/template-provider.ts +54 -11
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +27 -30
- package/addon/components/table-of-contents-plugin/toolbar-button.hbs +8 -0
- package/addon/components/table-of-contents-plugin/{card.ts → toolbar-button.ts} +1 -18
- package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.hbs +4 -4
- package/addon/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.ts +26 -35
- package/addon/components/{template-variable-plugin → variable-plugin}/template-variable-card.hbs +6 -6
- package/addon/components/variable-plugin/template-variable-card.ts +174 -0
- package/addon/components/variable-plugin/variable.hbs +4 -0
- package/addon/components/variable-plugin/variable.ts +250 -0
- package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +58 -31
- package/addon/plugins/article-structure-plugin/index.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +42 -6
- package/addon/plugins/article-structure-plugin/structures/article.ts +14 -4
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +2 -3
- package/addon/plugins/article-structure-plugin/structures/section.ts +2 -2
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +11 -4
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +2 -2
- package/addon/plugins/article-structure-plugin/structures/title.ts +2 -3
- package/addon/plugins/article-structure-plugin/utils/structure.ts +29 -9
- package/addon/plugins/citation-plugin/index.ts +184 -113
- package/addon/plugins/rdfa-date-plugin/index.ts +42 -3
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +127 -0
- package/addon/plugins/rdfa-date-plugin/nodes/index.ts +1 -0
- package/addon/plugins/rdfa-date-plugin/utils.ts +10 -0
- package/addon/plugins/roadsign-regulation-plugin/nodes.ts +107 -0
- package/addon/plugins/standard-template-plugin/index.ts +26 -0
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +366 -0
- package/addon/plugins/table-of-contents-plugin/index.ts +8 -12
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +35 -42
- package/addon/plugins/{insert-variable-plugin → variable-plugin}/index.ts +6 -1
- package/addon/plugins/variable-plugin/nodes.ts +137 -0
- package/addon/plugins/variable-plugin/utils/constants.ts +107 -0
- package/addon/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.ts +41 -0
- package/addon/services/standard-template-plugin.ts +16 -12
- package/addon/utils/changed-descendants.ts +29 -0
- package/addon/utils/constants.ts +22 -0
- package/addon/utils/namespace.ts +60 -0
- package/app/components/{table-of-contents-plugin/card.js → au-dropdown-pill.js} +1 -1
- package/app/components/table-of-contents-plugin/toolbar-button.js +1 -0
- package/app/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.js +1 -1
- package/app/components/{template-variable-plugin → variable-plugin}/template-variable-card.js +1 -1
- package/app/components/variable-plugin/variable-edit-modal.js +1 -0
- package/app/components/variable-plugin/variable.js +1 -0
- package/app/styles/date-plugin.scss +17 -0
- package/app/styles/variable-plugin.scss +65 -0
- package/components/au-dropdown-pill.d.ts +19 -0
- package/components/au-native-input.d.ts +1 -1
- package/components/citation-plugin/citation-card.d.ts +1 -1
- package/components/citation-plugin/citation-insert.d.ts +7 -0
- package/components/citation-plugin/citations/search-modal.d.ts +1 -3
- package/components/rdfa-date-plugin/card.d.ts +14 -5
- package/components/rdfa-date-plugin/insert.d.ts +1 -2
- package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +1 -0
- package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +3 -0
- package/components/standard-template-plugin/template-provider.d.ts +6 -1
- package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
- package/components/table-of-contents-plugin/{card.d.ts → toolbar-button.d.ts} +0 -5
- package/components/{insert-variable-plugin → variable-plugin}/insert-variable-card.d.ts +3 -4
- package/components/{template-variable-plugin → variable-plugin}/template-variable-card.d.ts +8 -5
- package/components/variable-plugin/variable.d.ts +42 -0
- package/package.json +6 -6
- package/plugins/article-structure-plugin/commands/insert-structure.d.ts +2 -2
- package/plugins/article-structure-plugin/index.d.ts +1 -1
- package/plugins/article-structure-plugin/utils/structure.d.ts +4 -3
- package/plugins/citation-plugin/index.d.ts +11 -4
- package/plugins/rdfa-date-plugin/index.d.ts +13 -1
- package/plugins/rdfa-date-plugin/nodes/date.d.ts +9 -0
- package/plugins/rdfa-date-plugin/nodes/index.d.ts +1 -0
- package/plugins/rdfa-date-plugin/utils.d.ts +1 -0
- package/plugins/roadsign-regulation-plugin/nodes.d.ts +2 -0
- package/plugins/standard-template-plugin/index.d.ts +12 -0
- package/plugins/standard-template-plugin/utils/nodes.d.ts +12 -0
- package/plugins/table-of-contents-plugin/index.d.ts +4 -2
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -3
- package/plugins/{insert-variable-plugin → variable-plugin}/index.d.ts +1 -0
- package/plugins/variable-plugin/nodes.d.ts +2 -0
- package/plugins/variable-plugin/utils/constants.d.ts +9 -0
- package/plugins/{template-variable-plugin → variable-plugin}/utils/fetch-data.d.ts +5 -0
- package/services/standard-template-plugin.d.ts +9 -10
- package/translations/en-US.yaml +4 -3
- package/translations/nl-BE.yaml +8 -7
- package/utils/changed-descendants.d.ts +2 -0
- package/utils/constants.d.ts +10 -0
- package/utils/namespace.d.ts +11 -0
- package/addon/components/table-of-contents-plugin/card.hbs +0 -16
- package/addon/components/template-variable-plugin/template-variable-card.ts +0 -227
- package/addon/plugins/article-structure-plugin/constants.ts +0 -11
- package/addon/plugins/article-structure-plugin/utils/namespace.ts +0 -25
- package/addon/plugins/insert-variable-plugin/utils/constants.ts +0 -67
- package/addon/plugins/insert-variable-plugin/utils/fetch-data.ts +0 -41
- package/addon/plugins/rdfa-date-plugin/commands/index.ts +0 -1
- package/addon/plugins/rdfa-date-plugin/commands/modify-date.ts +0 -48
- package/addon/plugins/table-of-contents-plugin/utils/constants.ts +0 -17
- package/addon/plugins/template-variable-plugin/index.ts +0 -6
- package/addon/plugins/template-variable-plugin/utils/constants.ts +0 -2
- package/plugins/article-structure-plugin/constants.d.ts +0 -5
- package/plugins/article-structure-plugin/utils/namespace.d.ts +0 -6
- package/plugins/insert-variable-plugin/utils/constants.d.ts +0 -7
- package/plugins/insert-variable-plugin/utils/fetch-data.d.ts +0 -5
- package/plugins/rdfa-date-plugin/commands/index.d.ts +0 -1
- package/plugins/rdfa-date-plugin/commands/modify-date.d.ts +0 -2
- package/plugins/table-of-contents-plugin/utils/constants.d.ts +0 -7
- package/plugins/template-variable-plugin/index.d.ts +0 -2
- package/plugins/template-variable-plugin/utils/constants.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,54 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 1.0.0-beta.2 (2023-01-23)
|
|
16
|
+
|
|
17
|
+
#### :boom: Breaking Change
|
|
18
|
+
* [#67](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/67) New version of the variable plugin ([@elpoelma](https://github.com/elpoelma))
|
|
19
|
+
* [#62](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/62) feat(citation): make citation plugin datastore-independent ([@abeforgit](https://github.com/abeforgit))
|
|
20
|
+
|
|
21
|
+
#### :rocket: Enhancement
|
|
22
|
+
* [#69](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/69) Add enter handler to variable editor view ([@elpoelma](https://github.com/elpoelma))
|
|
23
|
+
* [#66](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/66) make the template plugin independent of the datastore ([@abeforgit](https://github.com/abeforgit))
|
|
24
|
+
* [#43](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/43) Feature/template nodes ([@lagartoverde](https://github.com/lagartoverde))
|
|
25
|
+
* [#62](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/62) feat(citation): make citation plugin datastore-independent ([@abeforgit](https://github.com/abeforgit))
|
|
26
|
+
* [#49](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/49) Avoid using the datastore on the besluit type plugin ([@lagartoverde](https://github.com/lagartoverde))
|
|
27
|
+
* [#47](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/47) Implement besluit articles using article-structure plugin ([@elpoelma](https://github.com/elpoelma))
|
|
28
|
+
* [#48](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/48) Roadsign regulation plugin rework ([@elpoelma](https://github.com/elpoelma))
|
|
29
|
+
|
|
30
|
+
#### :bug: Bug Fix
|
|
31
|
+
* [#63](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/63) Preserve date format across reloads ([@elpoelma](https://github.com/elpoelma))
|
|
32
|
+
|
|
33
|
+
#### :house: Internal
|
|
34
|
+
* [#68](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/68) Update editor to 1.0.0-beta.5 ([@elpoelma](https://github.com/elpoelma))
|
|
35
|
+
* [#65](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/65) Update editor to 1.0.0-beta.4 ([@elpoelma](https://github.com/elpoelma))
|
|
36
|
+
|
|
37
|
+
#### Committers: 3
|
|
38
|
+
- Arne Bertrand ([@abeforgit](https://github.com/abeforgit))
|
|
39
|
+
- Elena Poelman ([@elpoelma](https://github.com/elpoelma))
|
|
40
|
+
- Oscar Rodriguez Villalobos ([@lagartoverde](https://github.com/lagartoverde))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## 1.0.0-beta.1 (2023-01-17)
|
|
44
|
+
|
|
45
|
+
#### :rocket: Enhancement
|
|
46
|
+
* [#27](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/27) Conversion of plugins to prosemirror based editor ([@elpoelma](https://github.com/elpoelma))
|
|
47
|
+
* [#54](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/54) Move table-of-contents toggle to toolbar ([@elpoelma](https://github.com/elpoelma))
|
|
48
|
+
* [#46](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/46) Update insert-structure command so it looks forward for the next best position to insert ([@elpoelma](https://github.com/elpoelma))
|
|
49
|
+
|
|
50
|
+
#### :bug: Bug Fix
|
|
51
|
+
* [#59](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/59) Rename verwijzing to citeeropschrift ([@elpoelma](https://github.com/elpoelma))
|
|
52
|
+
* [#56](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/56) Add space before 'met zonale geldigheid' ([@elpoelma](https://github.com/elpoelma))
|
|
53
|
+
|
|
54
|
+
#### :house: Internal
|
|
55
|
+
* [#61](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/61) Update editor to 1.0.0-beta.2 ([@elpoelma](https://github.com/elpoelma))
|
|
56
|
+
* [#60](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/60) Update editor to 1.0.0-beta.1 ([@elpoelma](https://github.com/elpoelma))
|
|
57
|
+
|
|
58
|
+
#### Committers: 1
|
|
59
|
+
- Elena Poelman ([@elpoelma](https://github.com/elpoelma))
|
|
60
|
+
|
|
13
61
|
## 1.0.0-alpha.3 (2023-01-09)
|
|
14
62
|
|
|
15
63
|
#### :house: Internal
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div class="au-c-dropdown" ...attributes>
|
|
2
|
+
<AuPill
|
|
3
|
+
@skin={{this.skin}}
|
|
4
|
+
@size={{@size}}
|
|
5
|
+
@actionIcon={{this.icon}}
|
|
6
|
+
@iconAlignment={{this.iconAlignment}}
|
|
7
|
+
@hideText={{@hideText}}
|
|
8
|
+
aria-haspopup="true"
|
|
9
|
+
aria-expanded="{{if this.dropdownOpen 'true' 'false'}}"
|
|
10
|
+
@onClickAction={{this.toggleDropdown}}
|
|
11
|
+
data-test-dropdown-button
|
|
12
|
+
data-au-dropdown-toggle
|
|
13
|
+
>
|
|
14
|
+
<span class="au-c-dropdown__name" data-test-dropdown-title>
|
|
15
|
+
{{@title}}
|
|
16
|
+
</span>
|
|
17
|
+
</AuPill>
|
|
18
|
+
<div
|
|
19
|
+
class="au-c-dropdown__menu {{this.alignment}} {{if this.dropdownOpen 'is-visible'}}"
|
|
20
|
+
role="menu"
|
|
21
|
+
tabindex="-1"
|
|
22
|
+
{{focus-trap
|
|
23
|
+
isActive=this.dropdownOpen
|
|
24
|
+
shouldSelfFocus=true
|
|
25
|
+
focusTrapOptions=(hash
|
|
26
|
+
clickOutsideDeactivates=this.clickOutsideDeactivates
|
|
27
|
+
)
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{{yield}}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
|
|
5
|
+
type Args = {
|
|
6
|
+
alignment: 'left' | 'right';
|
|
7
|
+
icon: string;
|
|
8
|
+
iconAlignment: 'left' | 'right';
|
|
9
|
+
skin?: string;
|
|
10
|
+
};
|
|
11
|
+
export default class AuDropdownPill extends Component<Args> {
|
|
12
|
+
@tracked dropdownOpen = false;
|
|
13
|
+
|
|
14
|
+
@action
|
|
15
|
+
openDropdown() {
|
|
16
|
+
this.dropdownOpen = true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@action
|
|
20
|
+
closeDropdown() {
|
|
21
|
+
this.dropdownOpen = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@action
|
|
25
|
+
toggleDropdown() {
|
|
26
|
+
this.dropdownOpen = !this.dropdownOpen;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@action
|
|
30
|
+
clickOutsideDeactivates(event: InputEvent) {
|
|
31
|
+
const toggleButton = document.querySelector('[data-au-dropdown-toggle]');
|
|
32
|
+
const isClosedByToggleButton = toggleButton?.contains(
|
|
33
|
+
event.target as HTMLInputElement
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (!isClosedByToggleButton) {
|
|
37
|
+
this.closeDropdown();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Dropdown alignment
|
|
44
|
+
get alignment() {
|
|
45
|
+
if (this.args.alignment == 'left') return 'au-c-dropdown__menu--left';
|
|
46
|
+
if (this.args.alignment == 'right') return 'au-c-dropdown__menu--right';
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get skin() {
|
|
51
|
+
return this.args.skin || 'default';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Set default button icon
|
|
55
|
+
get icon() {
|
|
56
|
+
if (this.args.icon) return this.args.icon;
|
|
57
|
+
else return 'chevron-down';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Set default icon alignment
|
|
61
|
+
get iconAlignment() {
|
|
62
|
+
if (this.args.iconAlignment) return this.args.iconAlignment;
|
|
63
|
+
else return 'right';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -16,6 +16,7 @@ import { getRdfaAttribute } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
|
|
|
16
16
|
import fetchBesluitTypes, {
|
|
17
17
|
BesluitType,
|
|
18
18
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
|
|
19
|
+
import { findAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/utils/structure';
|
|
19
20
|
declare module 'ember__owner' {
|
|
20
21
|
export default interface Owner {
|
|
21
22
|
resolveRegistration(name: string): unknown;
|
|
@@ -73,14 +74,18 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
73
74
|
|
|
74
75
|
get currentBesluitRange(): ResolvedPNode | undefined {
|
|
75
76
|
const selection = this.controller.state.selection;
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
77
|
+
const besluit = findAncestorOfType(
|
|
78
|
+
selection,
|
|
79
|
+
this.controller.schema.nodes['besluit']
|
|
80
|
+
);
|
|
81
|
+
if (!besluit) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
node: besluit.node,
|
|
86
|
+
from: besluit.start - 1,
|
|
87
|
+
to: besluit.start + besluit.node.nodeSize - 1,
|
|
88
|
+
};
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
get currentBesluitURI() {
|
|
@@ -100,10 +105,12 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
100
105
|
if (!this.currentBesluitURI) {
|
|
101
106
|
return;
|
|
102
107
|
}
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
.
|
|
106
|
-
|
|
108
|
+
const besluit = findAncestorOfType(
|
|
109
|
+
this.controller.state.selection,
|
|
110
|
+
this.controller.schema.nodes['besluit']
|
|
111
|
+
);
|
|
112
|
+
const besluitTypeof = besluit?.node.attrs.typeof as string;
|
|
113
|
+
const besluitTypesUris = besluitTypeof.split(' ');
|
|
107
114
|
const besluitTypeRelevant = besluitTypesUris.find((type) =>
|
|
108
115
|
type.includes('https://data.vlaanderen.be/id/concept/BesluitType/')
|
|
109
116
|
);
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
</c.footer>
|
|
107
107
|
</AuCard>
|
|
108
108
|
{{/if}}
|
|
109
|
-
|
|
110
109
|
<CitationPlugin::Citations::SearchModal
|
|
111
110
|
@open={{this.showModal}}
|
|
112
111
|
@closeModal={{this.closeModal}}
|
|
113
112
|
@insertDecisionCitation={{this.insertDecisionCitation}}
|
|
114
113
|
@insertArticleCitation={{this.insertArticleCitation}}
|
|
115
114
|
@selectedDecision={{this.decision}}
|
|
116
|
-
@legislationTypeUri={{this.
|
|
115
|
+
@legislationTypeUri={{this.selectedLegislationTypeUri}}
|
|
116
|
+
@selectLegislationType={{this.selectLegislationType}}
|
|
117
117
|
@text={{this.searchText}}
|
|
118
118
|
/>
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
@closeModal={{this.closeModal}}
|
|
16
16
|
@insertDecisionCitation={{this.insertDecisionCitation}}
|
|
17
17
|
@insertArticleCitation={{this.insertArticleCitation}}
|
|
18
|
-
@legislationTypeUri={{this.
|
|
18
|
+
@legislationTypeUri={{this.selectedLegislationTypeUri}}
|
|
19
|
+
|
|
20
|
+
@selectLegislationType={{this.selectLegislationType}}
|
|
19
21
|
@text={{this.text}}
|
|
20
22
|
/>
|
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
|
|
14
14
|
import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
|
|
15
15
|
import { CitationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
LEGISLATION_TYPE_CONCEPTS,
|
|
18
|
+
LEGISLATION_TYPES,
|
|
19
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
|
|
20
|
+
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
17
21
|
|
|
18
22
|
interface Args {
|
|
19
23
|
controller: ProseController;
|
|
@@ -24,9 +28,31 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
24
28
|
@tracked showModal = false;
|
|
25
29
|
@tracked legislationTypeUri = LEGISLATION_TYPES.decreet;
|
|
26
30
|
@tracked text = '';
|
|
31
|
+
@tracked legislationType: string | null = null;
|
|
32
|
+
|
|
33
|
+
get selectedLegislationTypeUri(): string {
|
|
34
|
+
return this.selectedLegislationType.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get selectedLegislationType() {
|
|
38
|
+
const type = this.legislationType;
|
|
39
|
+
const found = LEGISLATION_TYPE_CONCEPTS.find((c) => c.value === type);
|
|
40
|
+
return found || unwrap(LEGISLATION_TYPE_CONCEPTS[0]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@action
|
|
44
|
+
selectLegislationType(type: string) {
|
|
45
|
+
type = type.toLowerCase();
|
|
46
|
+
const found = LEGISLATION_TYPE_CONCEPTS.find(
|
|
47
|
+
(c) => c.label.toLowerCase() === type
|
|
48
|
+
);
|
|
49
|
+
this.legislationType = found
|
|
50
|
+
? found.value
|
|
51
|
+
: unwrap(LEGISLATION_TYPE_CONCEPTS[0]).value;
|
|
52
|
+
}
|
|
27
53
|
|
|
28
54
|
get disableInsert() {
|
|
29
|
-
if (!this.activeRanges) {
|
|
55
|
+
if (!this.activeRanges || this.controller.inEmbeddedView) {
|
|
30
56
|
return true;
|
|
31
57
|
}
|
|
32
58
|
const { from } = this.controller.state.selection;
|
|
@@ -47,13 +47,12 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
47
47
|
// Vlaamse Codex currently doesn't contain captions and content of decisions
|
|
48
48
|
// @tracked isEnabledSearchCaption = false
|
|
49
49
|
// @tracked isEnabledSearchContent = false
|
|
50
|
-
@tracked legislationTypeUri: string;
|
|
51
50
|
@tracked pageNumber = 0;
|
|
52
51
|
@tracked pageSize = 5;
|
|
53
52
|
@tracked totalCount = 0;
|
|
54
53
|
@tracked decisions = [];
|
|
55
54
|
@tracked error: unknown;
|
|
56
|
-
@tracked selectedDecision: Decision | null;
|
|
55
|
+
@tracked selectedDecision: Decision | null = null;
|
|
57
56
|
@tracked documentDateFrom: Date | null = null;
|
|
58
57
|
@tracked documentDateTo: Date | null = null;
|
|
59
58
|
@tracked publicationDateFrom: Date | null = null;
|
|
@@ -62,11 +61,8 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
62
61
|
minDate = new Date('1930-01-01T12:00:00');
|
|
63
62
|
maxDate = new Date(`${new Date().getFullYear() + 10}-01-01T12:00:00`);
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.selectedDecision = this.args.selectedDecision;
|
|
68
|
-
this.legislationTypeUri =
|
|
69
|
-
this.args.legislationTypeUri || LEGISLATION_TYPES['decreet'];
|
|
64
|
+
get legislationTypeUri() {
|
|
65
|
+
return this.args.legislationTypeUri || LEGISLATION_TYPES['decreet'];
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
get datePickerLocalization() {
|
|
@@ -174,17 +170,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
174
170
|
this.inputSearchText = (event.target as HTMLInputElement).value;
|
|
175
171
|
}
|
|
176
172
|
|
|
177
|
-
@action
|
|
178
|
-
selectLegislationType(type: string) {
|
|
179
|
-
type = type.toLowerCase();
|
|
180
|
-
const found = LEGISLATION_TYPE_CONCEPTS.find(
|
|
181
|
-
(c) => c.label.toLowerCase() === type
|
|
182
|
-
);
|
|
183
|
-
this.legislationTypeUri = found
|
|
184
|
-
? found.value
|
|
185
|
-
: unwrap(LEGISLATION_TYPE_CONCEPTS[0]).value;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
173
|
@action
|
|
189
174
|
updateDocumentDateFrom(_isoDate: unknown, date: Date) {
|
|
190
175
|
this.documentDateFrom = date;
|
|
@@ -5,6 +5,7 @@ import { ProseParser } from '@lblod/ember-rdfa-editor';
|
|
|
5
5
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
6
6
|
import ImportRdfaSnippet from '@lblod/ember-rdfa-editor-lblod-plugins/services/import-rdfa-snippet';
|
|
7
7
|
import { RdfaSnippet } from '@lblod/ember-rdfa-editor-lblod-plugins/services/import-rdfa-snippet';
|
|
8
|
+
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
8
9
|
|
|
9
10
|
type Args = {
|
|
10
11
|
controller: ProseController;
|
|
@@ -21,19 +22,14 @@ export default class ImportSnippetPluginCard extends Component<Args> {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
get insertRange() {
|
|
24
|
-
const selection = this.controller.state
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.asSubjectNodeMapping()
|
|
30
|
-
.nodes(),
|
|
31
|
-
][0];
|
|
32
|
-
if (besluitRange) {
|
|
33
|
-
const { to } = besluitRange;
|
|
25
|
+
const { selection } = this.controller.state;
|
|
26
|
+
const besluit = findParentNodeOfType(this.controller.schema.nodes.besluit)(
|
|
27
|
+
selection
|
|
28
|
+
);
|
|
29
|
+
if (besluit) {
|
|
34
30
|
return {
|
|
35
|
-
from:
|
|
36
|
-
to:
|
|
31
|
+
from: besluit.pos + besluit.node.nodeSize - 1,
|
|
32
|
+
to: besluit.pos + besluit.node.nodeSize - 1,
|
|
37
33
|
};
|
|
38
34
|
} else {
|
|
39
35
|
return selection;
|
|
@@ -10,6 +10,34 @@
|
|
|
10
10
|
@onChange={{this.changeDate}}
|
|
11
11
|
@value={{this.dateValue}}
|
|
12
12
|
@onlyDate={{this.onlyDate}}/>
|
|
13
|
+
{{#each @widgetArgs.options.formats as |format|}}
|
|
14
|
+
<AuFormRow>
|
|
15
|
+
<AuControlRadio
|
|
16
|
+
@label={{format.label}}
|
|
17
|
+
@identifier={{format.key}}
|
|
18
|
+
@name="dateFormat"
|
|
19
|
+
@value={{format.key}}
|
|
20
|
+
checked={{eq this.dateFormat format.key}}
|
|
21
|
+
@onChange={{this.setDateFormat}}
|
|
22
|
+
/>
|
|
23
|
+
</AuFormRow>
|
|
24
|
+
{{/each}}
|
|
25
|
+
<AuFormRow>
|
|
26
|
+
<AuControlRadio
|
|
27
|
+
@label="Custom Date"
|
|
28
|
+
@identifier="custom"
|
|
29
|
+
@name="dateFormat"
|
|
30
|
+
@value="custom"
|
|
31
|
+
checked={{eq this.dateFormat "custom"}}
|
|
32
|
+
@onChange={{this.setDateFormat}}
|
|
33
|
+
/>
|
|
34
|
+
{{#if (eq this.dateFormat "custom")}}
|
|
35
|
+
<AuInput
|
|
36
|
+
@value={{this.customDateFormat}}
|
|
37
|
+
{{on "input" this.setCustomDateFormat}}
|
|
38
|
+
/>
|
|
39
|
+
{{/if}}
|
|
40
|
+
</AuFormRow>
|
|
13
41
|
{{#unless this.dateInDocument}}
|
|
14
42
|
<AuFormRow class="au-u-margin-top">
|
|
15
43
|
<AuButton {{on 'click' this.modifyDate}}>
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { tracked } from '@glimmer/tracking';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
|
-
import { modifyDate } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin/commands';
|
|
5
4
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
6
|
-
import {
|
|
5
|
+
import { NodeSelection } from '@lblod/ember-rdfa-editor';
|
|
6
|
+
import { DateFormat } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
|
|
7
|
+
|
|
7
8
|
type Args = {
|
|
8
9
|
controller: ProseController;
|
|
10
|
+
widgetArgs: {
|
|
11
|
+
options: {
|
|
12
|
+
formats: [DateFormat];
|
|
13
|
+
allowCustomFormat: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
9
16
|
};
|
|
10
17
|
export default class RdfaDatePluginCardComponent extends Component<Args> {
|
|
11
18
|
@tracked dateValue?: Date;
|
|
12
|
-
@tracked
|
|
19
|
+
@tracked datePos?: number;
|
|
13
20
|
@tracked dateInDocument = false;
|
|
14
21
|
@tracked onlyDate = false;
|
|
15
|
-
@tracked
|
|
22
|
+
@tracked dateFormat = '';
|
|
23
|
+
@tracked customDateFormat = 'dd/MM/yyyy';
|
|
24
|
+
|
|
25
|
+
constructor(owner: unknown, args: Args) {
|
|
26
|
+
super(owner, args);
|
|
27
|
+
const formats = this.args.widgetArgs.options.formats;
|
|
28
|
+
const firstKey = [...formats.keys()][0];
|
|
29
|
+
this.dateFormat = formats[firstKey].key;
|
|
30
|
+
}
|
|
16
31
|
|
|
17
32
|
get controller() {
|
|
18
33
|
return this.args.controller;
|
|
@@ -20,15 +35,13 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
|
|
|
20
35
|
|
|
21
36
|
@action
|
|
22
37
|
modifyDate() {
|
|
23
|
-
if (this.
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
)
|
|
31
|
-
);
|
|
38
|
+
if (this.datePos && this.dateValue) {
|
|
39
|
+
const pos = this.datePos;
|
|
40
|
+
const value = this.dateValue;
|
|
41
|
+
this.controller.withTransaction((tr) => {
|
|
42
|
+
tr.setNodeAttribute(pos, 'format', this.customDateFormat);
|
|
43
|
+
return tr.setNodeAttribute(pos, 'value', value.toISOString());
|
|
44
|
+
}, true);
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
|
|
@@ -39,34 +52,55 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
|
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
@action
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
setDateFormat(dateFormat: string) {
|
|
56
|
+
this.dateFormat = dateFormat;
|
|
57
|
+
if (dateFormat !== 'custom') {
|
|
58
|
+
const format = this.args.widgetArgs.options.formats.find(
|
|
59
|
+
(format) => format.key === dateFormat
|
|
60
|
+
);
|
|
61
|
+
if (format) {
|
|
62
|
+
if (this.onlyDate) {
|
|
63
|
+
this.customDateFormat = format.dateFormat;
|
|
64
|
+
} else {
|
|
65
|
+
this.customDateFormat = format.dateTimeFormat;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
54
68
|
}
|
|
55
|
-
|
|
69
|
+
if (this.dateInDocument) this.modifyDate();
|
|
70
|
+
}
|
|
71
|
+
@action
|
|
72
|
+
setCustomDateFormat(event: InputEvent) {
|
|
73
|
+
this.customDateFormat = (event.target as HTMLInputElement).value;
|
|
74
|
+
if (this.dateInDocument) this.modifyDate();
|
|
75
|
+
}
|
|
56
76
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
get showCard() {
|
|
78
|
+
return this.datePos !== undefined && this.datePos !== null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@action
|
|
82
|
+
onSelectionChanged() {
|
|
83
|
+
const selection = this.controller.getState(true).selection;
|
|
84
|
+
if (
|
|
85
|
+
selection instanceof NodeSelection &&
|
|
86
|
+
selection.node.type === this.args.controller.schema.nodes['date']
|
|
87
|
+
) {
|
|
88
|
+
this.dateInDocument = !!selection.node.attrs.value;
|
|
89
|
+
this.onlyDate = selection.node.attrs.onlyDate as boolean;
|
|
90
|
+
this.dateValue = this.dateInDocument
|
|
91
|
+
? new Date(selection.node.attrs.value)
|
|
92
|
+
: new Date();
|
|
93
|
+
if (this.dateInDocument) {
|
|
94
|
+
this.dateValue = new Date(selection.node.attrs.value);
|
|
95
|
+
} else {
|
|
96
|
+
this.dateValue = new Date();
|
|
97
|
+
if (this.onlyDate) {
|
|
98
|
+
this.dateValue.setHours(0, 0, 0, 0);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
this.datePos = selection.from;
|
|
67
102
|
} else {
|
|
68
|
-
this.
|
|
69
|
-
this.showCard = false;
|
|
103
|
+
this.datePos = undefined;
|
|
70
104
|
}
|
|
71
105
|
}
|
|
72
106
|
}
|
|
@@ -46,6 +46,7 @@ export default class RdfaDatePluginDateTimePicker extends Component<Args> {
|
|
|
46
46
|
if (!wasDateInputCleared) {
|
|
47
47
|
if (!this.date) {
|
|
48
48
|
this.date = new Date();
|
|
49
|
+
this.date.setHours(0, 0, 0, 0);
|
|
49
50
|
}
|
|
50
51
|
this.date.setDate(date.getDate());
|
|
51
52
|
this.date.setMonth(date.getMonth());
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@icon="add"
|
|
4
4
|
@iconAlignment="left"
|
|
5
5
|
@skin="link"
|
|
6
|
-
{{on 'click' this.insertDate}}>
|
|
6
|
+
{{on 'click' (fn this.insertDate true)}}>
|
|
7
7
|
{{t "date-plugin.insert.date"}}
|
|
8
8
|
</AuButton>
|
|
9
9
|
</AuList::Item>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
@icon="add"
|
|
13
13
|
@iconAlignment="left"
|
|
14
14
|
@skin="link"
|
|
15
|
-
{{on 'click' this.
|
|
15
|
+
{{on 'click' (fn this.insertDate false)}}>
|
|
16
16
|
{{t "date-plugin.insert.datetime"}}
|
|
17
17
|
</AuButton>
|
|
18
18
|
</AuList::Item>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
4
|
+
import { NodeSelection } from '@lblod/ember-rdfa-editor';
|
|
4
5
|
|
|
5
6
|
type Args = {
|
|
6
7
|
controller: ProseController;
|
|
@@ -16,30 +17,20 @@ export default class RdfaDatePluginInsertComponent extends Component<Args> {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
@action
|
|
19
|
-
insertDate() {
|
|
20
|
+
insertDate(onlyDate: boolean) {
|
|
20
21
|
this.controller.withTransaction((tr) => {
|
|
21
|
-
|
|
22
|
-
this.schema.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
]);
|
|
27
|
-
return tr.replaceSelectionWith(dateNode, false);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@action
|
|
32
|
-
insertDateTime() {
|
|
33
|
-
this.controller.withTransaction((tr) => {
|
|
34
|
-
return tr.replaceSelectionWith(
|
|
35
|
-
this.schema.text('${date and time}', [
|
|
36
|
-
this.schema.mark('inline_rdfa', {
|
|
37
|
-
datatype: 'xsd:dateTime',
|
|
38
|
-
property: 'ext:content',
|
|
39
|
-
}),
|
|
40
|
-
]),
|
|
41
|
-
false
|
|
22
|
+
tr.replaceSelectionWith(
|
|
23
|
+
this.schema.node('date', {
|
|
24
|
+
onlyDate,
|
|
25
|
+
})
|
|
42
26
|
);
|
|
43
|
-
|
|
27
|
+
if (tr.selection.$anchor.nodeBefore) {
|
|
28
|
+
const resolvedPos = tr.doc.resolve(
|
|
29
|
+
tr.selection.anchor - tr.selection.$anchor.nodeBefore?.nodeSize
|
|
30
|
+
);
|
|
31
|
+
tr.setSelection(new NodeSelection(resolvedPos));
|
|
32
|
+
}
|
|
33
|
+
return tr;
|
|
34
|
+
}, true);
|
|
44
35
|
}
|
|
45
36
|
}
|