@lblod/ember-rdfa-editor-lblod-plugins 2.1.1 → 3.0.0
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/.woodpecker/.release.yml +1 -1
- package/.woodpecker/.test-scenarios.yml +17 -0
- package/.woodpecker/.test.yml +5 -5
- package/CHANGELOG.md +31 -1
- package/README.md +1 -0
- package/addon/components/article-structure-plugin/article-structure-card.hbs +1 -3
- package/addon/components/article-structure-plugin/article-structure-card.ts +14 -8
- package/addon/components/article-structure-plugin/structure-card.hbs +6 -4
- package/addon/components/article-structure-plugin/structure-card.ts +19 -15
- package/addon/components/besluit-plugin/besluit-plugin-card.ts +8 -4
- package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -2
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +12 -10
- package/addon/components/citation-plugin/citation-card.ts +27 -25
- package/addon/components/citation-plugin/citation-insert.ts +34 -27
- package/addon/components/import-snippet-plugin/card.ts +9 -6
- package/addon/components/rdfa-date-plugin/card.ts +14 -18
- package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
- package/addon/components/rdfa-date-plugin/insert.ts +12 -20
- package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +3 -3
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +5 -4
- package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +1 -1
- package/addon/components/standard-template-plugin/card.ts +2 -2
- package/addon/components/standard-template-plugin/template-provider.ts +6 -5
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -1
- package/addon/components/table-of-contents-plugin/toolbar-button.ts +15 -9
- package/addon/components/variable-plugin/insert-variable-card.ts +19 -14
- package/addon/components/variable-plugin/template-variable-card.hbs +1 -1
- package/addon/components/variable-plugin/template-variable-card.ts +10 -7
- package/addon/components/variable-plugin/variable.hbs +8 -3
- package/addon/models/instruction.ts +1 -1
- package/addon/models/measure.ts +1 -1
- package/addon/models/sign.ts +1 -1
- package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +1 -1
- package/addon/plugins/article-structure-plugin/index.ts +2 -32
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +16 -7
- package/addon/plugins/article-structure-plugin/structures/article.ts +7 -3
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +7 -2
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/title.ts +1 -1
- package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +3 -6
- package/addon/plugins/citation-plugin/index.ts +1 -49
- package/addon/plugins/rdfa-date-plugin/index.ts +5 -28
- package/addon/plugins/rdfa-date-plugin/nodes/date.ts +1 -6
- package/addon/plugins/standard-template-plugin/index.ts +0 -6
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +1 -1
- package/addon/plugins/table-of-contents-plugin/index.ts +0 -7
- package/addon/plugins/variable-plugin/nodes.ts +6 -3
- package/addon/services/roadsign-registry.ts +1 -1
- package/app/styles/article-structure-plugin.scss +7 -0
- package/app/styles/besluit-plugin.scss +4 -0
- package/components/article-structure-plugin/article-structure-card.d.ts +4 -5
- package/components/article-structure-plugin/structure-card.d.ts +4 -6
- package/components/besluit-plugin/besluit-plugin-card.d.ts +3 -3
- package/components/besluit-type-plugin/toolbar-dropdown.d.ts +3 -3
- package/components/citation-plugin/citation-card.d.ts +4 -6
- package/components/citation-plugin/citation-insert.d.ts +5 -7
- package/components/import-snippet-plugin/card.d.ts +3 -3
- package/components/rdfa-date-plugin/card.d.ts +5 -10
- package/components/rdfa-date-plugin/insert.d.ts +6 -12
- package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +3 -3
- package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -2
- package/components/standard-template-plugin/card.d.ts +3 -3
- package/components/standard-template-plugin/template-provider.d.ts +3 -3
- package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
- package/components/table-of-contents-plugin/toolbar-button.d.ts +3 -3
- package/components/variable-plugin/insert-variable-card.d.ts +7 -8
- package/components/variable-plugin/template-variable-card.d.ts +3 -3
- package/package.json +26 -29
- package/plugins/article-structure-plugin/index.d.ts +2 -3
- package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +3 -3
- package/plugins/citation-plugin/index.d.ts +2 -12
- package/plugins/rdfa-date-plugin/index.d.ts +5 -5
- package/plugins/rdfa-date-plugin/nodes/date.d.ts +1 -6
- package/plugins/standard-template-plugin/index.d.ts +0 -2
- package/plugins/table-of-contents-plugin/index.d.ts +0 -2
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
- package/plugins/variable-plugin/nodes.d.ts +1 -1
- package/translations/en-US.yaml +63 -61
- package/translations/nl-BE.yaml +65 -59
- package/addon/components/variable-plugin/variable.ts +0 -262
- package/addon/plugins/besluit-plugin/index.ts +0 -6
- package/addon/plugins/besluit-type-plugin/index.ts +0 -6
- package/addon/plugins/import-snippet-plugin.ts +0 -6
- package/addon/plugins/rdfa-date-plugin/nodes/index.ts +0 -1
- package/addon/plugins/roadsign-regulation-plugin/index.ts +0 -6
- package/addon/plugins/variable-plugin/index.ts +0 -16
- package/components/variable-plugin/variable.d.ts +0 -43
- package/plugins/besluit-plugin/index.d.ts +0 -2
- package/plugins/besluit-type-plugin/index.d.ts +0 -2
- package/plugins/import-snippet-plugin.d.ts +0 -2
- package/plugins/rdfa-date-plugin/nodes/index.d.ts +0 -1
- package/plugins/roadsign-regulation-plugin/index.d.ts +0 -2
- package/plugins/variable-plugin/index.d.ts +0 -3
package/.woodpecker/.release.yml
CHANGED
package/.woodpecker/.test.yml
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
pipeline:
|
|
3
3
|
install:
|
|
4
|
-
image: danlynn/ember-cli:4.
|
|
4
|
+
image: danlynn/ember-cli:4.8.0
|
|
5
5
|
commands:
|
|
6
6
|
- npm ci
|
|
7
7
|
lint-js:
|
|
8
|
-
image: danlynn/ember-cli:4.
|
|
8
|
+
image: danlynn/ember-cli:4.8.0
|
|
9
9
|
group: lint
|
|
10
10
|
commands:
|
|
11
11
|
- npm run lint:js
|
|
12
12
|
lint-hbs:
|
|
13
|
-
image: danlynn/ember-cli:4.
|
|
13
|
+
image: danlynn/ember-cli:4.8.0
|
|
14
14
|
group: lint
|
|
15
15
|
commands:
|
|
16
16
|
- npm run lint:hbs
|
|
17
17
|
test:
|
|
18
|
-
image: danlynn/ember-cli:4.
|
|
18
|
+
image: danlynn/ember-cli:4.8.0
|
|
19
19
|
commands:
|
|
20
|
-
- npm run test:ember
|
|
20
|
+
- npm run test:ember
|
|
21
21
|
when:
|
|
22
22
|
event:
|
|
23
23
|
- pull_request
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.0.0] - 2023-02-27
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Feature/allow paragraphs inside article paragraphs
|
|
14
|
+
- Set selectable on false for structure-headers
|
|
15
|
+
- BREAKING: the argument structure of plugin components has changed. `widgetArgs` is no longer in use, it's properties are now direct properties of the component `args`.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Added a new option to the structures to not support unwrap and made the article paragraphs the first structure to use this option
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- fix translation warnings
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
- Remove insert date and time as it's no longer needed
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
- Bumps `ember-power-select` to 6.0.1
|
|
28
|
+
- Bumps `ember-source` to 4.8.4
|
|
29
|
+
- Bumps `@lblod/ember-rdfa-editor` to 3.2.0
|
|
30
|
+
|
|
31
|
+
## [2.1.2] - 2023-02-15
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- fixed subsection 'move down' dutch translation
|
|
36
|
+
- Hotfix: use content attribute as a fallback to extract the codelist URI
|
|
37
|
+
|
|
10
38
|
## [2.1.1] - 2023-02-07
|
|
11
39
|
|
|
12
40
|
### Changed
|
|
@@ -316,5 +344,7 @@ add onclick handler to pencil icon in variable plugin
|
|
|
316
344
|
|
|
317
345
|
# Changelog
|
|
318
346
|
|
|
319
|
-
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/
|
|
347
|
+
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v3.0.0...HEAD
|
|
348
|
+
[3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
|
|
349
|
+
[2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
|
|
320
350
|
[2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
|
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { ProseController } from '@lblod/ember-rdfa-editor';
|
|
4
3
|
import IntlService from 'ember-intl/services/intl';
|
|
5
4
|
import {
|
|
6
5
|
ArticleStructurePluginOptions,
|
|
@@ -8,26 +7,33 @@ import {
|
|
|
8
7
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
|
|
9
8
|
import { action } from '@ember/object';
|
|
10
9
|
import { insertStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands';
|
|
10
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
11
11
|
|
|
12
12
|
type Args = {
|
|
13
|
-
controller:
|
|
14
|
-
|
|
15
|
-
options: ArticleStructurePluginOptions;
|
|
16
|
-
};
|
|
13
|
+
controller: SayController;
|
|
14
|
+
options: ArticleStructurePluginOptions;
|
|
17
15
|
};
|
|
18
16
|
export default class EditorPluginsArticleStructureCardComponent extends Component<Args> {
|
|
19
17
|
@service declare intl: IntlService;
|
|
20
18
|
|
|
21
19
|
get structureTypes() {
|
|
22
|
-
return this.args.
|
|
20
|
+
return this.args.options;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get controller() {
|
|
24
|
+
return this.args.controller;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
@action
|
|
26
28
|
insertStructure(spec: StructureSpec) {
|
|
27
|
-
this.args.controller.doCommand(insertStructure(spec, this.intl)
|
|
29
|
+
this.args.controller.doCommand(insertStructure(spec, this.intl), {
|
|
30
|
+
view: this.controller.mainEditorView,
|
|
31
|
+
});
|
|
28
32
|
this.args.controller.focus();
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
canInsertStructure = (spec: StructureSpec) =>
|
|
32
|
-
this.args.controller.checkCommand(insertStructure(spec, this.intl)
|
|
36
|
+
this.args.controller.checkCommand(insertStructure(spec, this.intl), {
|
|
37
|
+
view: this.controller.mainEditorView,
|
|
38
|
+
});
|
|
33
39
|
}
|
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
</AuButton>
|
|
27
27
|
</Item>
|
|
28
28
|
<Item>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
{{#unless this.currentStructureType.noUnwrap}}
|
|
30
|
+
<AuToggleSwitch
|
|
31
|
+
@label={{t "article-structure-plugin.remove.content"}}
|
|
32
|
+
@checked={{this.removeStructureContent}}
|
|
33
|
+
@onChange={{this.setRemoveStructureContent}}/>
|
|
34
|
+
{{/unless}}
|
|
33
35
|
<AuButton
|
|
34
36
|
@icon="bin"
|
|
35
37
|
@iconAlignment="left"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
|
-
import {
|
|
3
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
4
4
|
import {
|
|
5
5
|
moveSelectedStructure,
|
|
6
6
|
removeStructure,
|
|
@@ -13,10 +13,8 @@ import { inject as service } from '@ember/service';
|
|
|
13
13
|
import IntlService from 'ember-intl/services/intl';
|
|
14
14
|
|
|
15
15
|
type Args = {
|
|
16
|
-
controller:
|
|
17
|
-
|
|
18
|
-
options: ArticleStructurePluginOptions;
|
|
19
|
-
};
|
|
16
|
+
controller: SayController;
|
|
17
|
+
options: ArticleStructurePluginOptions;
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
export default class EditorPluginsStructureCardComponent extends Component<Args> {
|
|
@@ -30,7 +28,8 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
30
28
|
@action
|
|
31
29
|
moveStructure(direction: 'up' | 'down') {
|
|
32
30
|
this.controller.doCommand(
|
|
33
|
-
moveSelectedStructure(this.structureTypes, direction, this.intl)
|
|
31
|
+
moveSelectedStructure(this.structureTypes, direction, this.intl),
|
|
32
|
+
{ view: this.controller.mainEditorView }
|
|
34
33
|
);
|
|
35
34
|
this.controller.focus();
|
|
36
35
|
}
|
|
@@ -38,9 +37,10 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
38
37
|
@action
|
|
39
38
|
removeStructure() {
|
|
40
39
|
if (this.structure && this.currentStructureType) {
|
|
41
|
-
if (this.removeStructureContent) {
|
|
40
|
+
if (this.removeStructureContent || this.currentStructureType.noUnwrap) {
|
|
42
41
|
this.controller.doCommand(
|
|
43
|
-
removeStructure(this.structure, this.structureTypes)
|
|
42
|
+
removeStructure(this.structure, this.structureTypes),
|
|
43
|
+
{ view: this.controller.mainEditorView }
|
|
44
44
|
);
|
|
45
45
|
} else {
|
|
46
46
|
this.controller.doCommand(
|
|
@@ -50,7 +50,8 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
50
50
|
type: this.currentStructureType,
|
|
51
51
|
},
|
|
52
52
|
this.structureTypes
|
|
53
|
-
)
|
|
53
|
+
),
|
|
54
|
+
{ view: this.controller.mainEditorView }
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -63,7 +64,7 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
get structureTypes() {
|
|
66
|
-
return this.args.
|
|
67
|
+
return this.args.options;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
get structureNodeSpecs() {
|
|
@@ -73,7 +74,7 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
get structure() {
|
|
76
|
-
const currentSelection = this.controller.
|
|
77
|
+
const currentSelection = this.controller.mainEditorState.selection;
|
|
77
78
|
return findAncestorOfType(currentSelection, ...this.structureNodeSpecs);
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -93,19 +94,21 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
93
94
|
|
|
94
95
|
get canMoveDown() {
|
|
95
96
|
return this.controller.checkCommand(
|
|
96
|
-
moveSelectedStructure(this.structureTypes, 'down', this.intl)
|
|
97
|
+
moveSelectedStructure(this.structureTypes, 'down', this.intl),
|
|
98
|
+
{ view: this.controller.mainEditorView }
|
|
97
99
|
);
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
get canMoveUp() {
|
|
101
103
|
return this.controller.checkCommand(
|
|
102
|
-
moveSelectedStructure(this.structureTypes, 'up', this.intl)
|
|
104
|
+
moveSelectedStructure(this.structureTypes, 'up', this.intl),
|
|
105
|
+
{ view: this.controller.mainEditorView }
|
|
103
106
|
);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
get canRemoveStructure() {
|
|
107
110
|
if (this.structure && this.currentStructureType) {
|
|
108
|
-
if (this.removeStructureContent) {
|
|
111
|
+
if (this.removeStructureContent || this.currentStructureType.noUnwrap) {
|
|
109
112
|
return true;
|
|
110
113
|
} else {
|
|
111
114
|
return this.controller.checkCommand(
|
|
@@ -115,7 +118,8 @@ export default class EditorPluginsStructureCardComponent extends Component<Args>
|
|
|
115
118
|
type: this.currentStructureType,
|
|
116
119
|
},
|
|
117
120
|
this.structureTypes
|
|
118
|
-
)
|
|
121
|
+
),
|
|
122
|
+
{ view: this.controller.mainEditorView }
|
|
119
123
|
);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { action } from '@ember/object';
|
|
3
3
|
import { insertTitle } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-plugin/commands';
|
|
4
|
-
import {
|
|
4
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
5
5
|
import { inject as service } from '@ember/service';
|
|
6
6
|
import IntlService from 'ember-intl/services/intl';
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
|
-
controller:
|
|
9
|
+
controller: SayController;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export default class BesluitPluginCardComponent extends Component<Args> {
|
|
@@ -21,11 +21,15 @@ export default class BesluitPluginCardComponent extends Component<Args> {
|
|
|
21
21
|
|
|
22
22
|
@action
|
|
23
23
|
insertTitle() {
|
|
24
|
-
this.controller.doCommand(insertTitle(this.intl)
|
|
24
|
+
this.controller.doCommand(insertTitle(this.intl), {
|
|
25
|
+
view: this.controller.mainEditorView,
|
|
26
|
+
});
|
|
25
27
|
this.focus();
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
get canInsertTitle() {
|
|
29
|
-
return this.controller.checkCommand(insertTitle(this.intl)
|
|
31
|
+
return this.controller.checkCommand(insertTitle(this.intl), {
|
|
32
|
+
view: this.controller.mainEditorView,
|
|
33
|
+
});
|
|
30
34
|
}
|
|
31
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div {{did-update this.updateBesluitTypes @controller.
|
|
1
|
+
<div {{did-update this.updateBesluitTypes @controller.mainEditorState}}
|
|
2
2
|
{{did-update this.updateBesluitTypes this.types.value}}>
|
|
3
3
|
{{#if this.showCard}}
|
|
4
4
|
{{#if this.types.isError}}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
@skin="error"
|
|
7
7
|
@icon="circle-x"
|
|
8
8
|
@iconAlignment="left"
|
|
9
|
-
class="au-c-pill--link"
|
|
9
|
+
class="au-c-pill--link besluit-toolbar-pill"
|
|
10
10
|
{{on "click" this.toggleCard}}>
|
|
11
11
|
{{t "besluit-type-plugin.error-short"}}
|
|
12
12
|
</AuPill>
|
|
@@ -7,16 +7,16 @@ import {
|
|
|
7
7
|
addType,
|
|
8
8
|
removeType,
|
|
9
9
|
} from '@lblod/ember-rdfa-editor/commands/type-commands';
|
|
10
|
-
import {
|
|
10
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
11
11
|
import CurrentSessionService from '@lblod/frontend-gelinkt-notuleren/services/current-session';
|
|
12
12
|
import { ResolvedPNode } from '@lblod/ember-rdfa-editor/plugins/datastore';
|
|
13
|
-
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
14
13
|
import { getRdfaAttribute } from '@lblod/ember-rdfa-editor/utils/rdfa-utils';
|
|
15
14
|
import fetchBesluitTypes, {
|
|
16
15
|
BesluitType,
|
|
17
16
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
|
|
18
17
|
import { findAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/utils/structure';
|
|
19
18
|
import { trackedFunction } from 'ember-resources/util/function';
|
|
19
|
+
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
20
20
|
|
|
21
21
|
declare module 'ember__owner' {
|
|
22
22
|
export default interface Owner {
|
|
@@ -25,7 +25,7 @@ declare module 'ember__owner' {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
type Args = {
|
|
28
|
-
controller:
|
|
28
|
+
controller: SayController;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export default class EditorPluginsToolbarDropdownComponent extends Component<Args> {
|
|
@@ -56,7 +56,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
get doc() {
|
|
59
|
-
return this.controller.
|
|
59
|
+
return this.controller.mainEditorState.doc;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
types = trackedFunction(this, async () => {
|
|
@@ -71,7 +71,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
get currentBesluitRange(): ResolvedPNode | undefined {
|
|
74
|
-
const selection = this.controller.
|
|
74
|
+
const selection = this.controller.mainEditorState.selection;
|
|
75
75
|
const besluit = findAncestorOfType(
|
|
76
76
|
selection,
|
|
77
77
|
this.controller.schema.nodes['besluit']
|
|
@@ -104,7 +104,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
const besluit = findAncestorOfType(
|
|
107
|
-
this.controller.
|
|
107
|
+
this.controller.mainEditorState.selection,
|
|
108
108
|
this.controller.schema.nodes['besluit']
|
|
109
109
|
);
|
|
110
110
|
const besluitTypeof = besluit?.node.attrs.typeof as string;
|
|
@@ -206,12 +206,14 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
206
206
|
if (this.besluitType && this.currentBesluitRange) {
|
|
207
207
|
this.cardExpanded = false;
|
|
208
208
|
if (this.previousBesluitType) {
|
|
209
|
-
this.controller.
|
|
210
|
-
removeType(this.currentBesluitRange.from, this.previousBesluitType)
|
|
209
|
+
this.controller.doCommand(
|
|
210
|
+
removeType(this.currentBesluitRange.from, this.previousBesluitType),
|
|
211
|
+
{ view: this.controller.mainEditorView }
|
|
211
212
|
);
|
|
212
213
|
}
|
|
213
|
-
this.controller.
|
|
214
|
-
addType(this.currentBesluitRange.from, this.besluitType.uri)
|
|
214
|
+
this.controller.doCommand(
|
|
215
|
+
addType(this.currentBesluitRange.from, this.besluitType.uri),
|
|
216
|
+
{ view: this.controller.mainEditorView }
|
|
215
217
|
);
|
|
216
218
|
}
|
|
217
219
|
}
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
CitationDecoration,
|
|
20
20
|
CitationPlugin,
|
|
21
21
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
22
|
-
import {
|
|
22
|
+
import { SayController, Transaction } from '@lblod/ember-rdfa-editor';
|
|
23
23
|
import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
|
|
24
24
|
import {
|
|
25
25
|
LEGISLATION_TYPES,
|
|
@@ -27,10 +27,8 @@ import {
|
|
|
27
27
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
|
|
28
28
|
|
|
29
29
|
interface Args {
|
|
30
|
-
controller:
|
|
31
|
-
|
|
32
|
-
plugin: CitationPlugin;
|
|
33
|
-
};
|
|
30
|
+
controller: SayController;
|
|
31
|
+
plugin: CitationPlugin;
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export default class CitationCardComponent extends Component<Args> {
|
|
@@ -45,7 +43,7 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
45
43
|
@tracked cardText: string | null = null;
|
|
46
44
|
@tracked cardLegislationType: string | null = null;
|
|
47
45
|
|
|
48
|
-
get controller():
|
|
46
|
+
get controller(): SayController {
|
|
49
47
|
return this.args.controller;
|
|
50
48
|
}
|
|
51
49
|
|
|
@@ -54,15 +52,15 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
get plugin() {
|
|
57
|
-
return this.args.
|
|
55
|
+
return this.args.plugin;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
get decorations() {
|
|
61
|
-
return this.plugin.getState(this.controller.
|
|
59
|
+
return this.plugin.getState(this.controller.mainEditorState)?.highlights;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
get activeDecoration(): Option<CitationDecoration> {
|
|
65
|
-
const { from, to } = this.controller.
|
|
63
|
+
const { from, to } = this.controller.mainEditorState.selection;
|
|
66
64
|
return this.decorations?.find(from, to)[0];
|
|
67
65
|
}
|
|
68
66
|
|
|
@@ -186,14 +184,16 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
186
184
|
const uri = decision.uri;
|
|
187
185
|
const title = decision.title ?? '';
|
|
188
186
|
const { from, to } = unwrap(this.activeDecoration);
|
|
189
|
-
this.controller.withTransaction(
|
|
190
|
-
tr
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
187
|
+
this.controller.withTransaction(
|
|
188
|
+
(tr: Transaction) =>
|
|
189
|
+
tr
|
|
190
|
+
.replaceRangeWith(
|
|
191
|
+
from,
|
|
192
|
+
to,
|
|
193
|
+
citedText(this.controller.schema, title, uri)
|
|
194
|
+
)
|
|
195
|
+
.scrollIntoView(),
|
|
196
|
+
{ view: this.controller.mainEditorView }
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -205,14 +205,16 @@ export default class CitationCardComponent extends Component<Args> {
|
|
|
205
205
|
title = `${decision.title}, ${article.number || ''}`;
|
|
206
206
|
}
|
|
207
207
|
const { from, to } = unwrap(this.activeDecoration);
|
|
208
|
-
this.controller.withTransaction(
|
|
209
|
-
tr
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
this.controller.withTransaction(
|
|
209
|
+
(tr: Transaction) =>
|
|
210
|
+
tr
|
|
211
|
+
.replaceRangeWith(
|
|
212
|
+
from,
|
|
213
|
+
to,
|
|
214
|
+
citedText(this.controller.schema, title, uri)
|
|
215
|
+
)
|
|
216
|
+
.scrollIntoView(),
|
|
217
|
+
{ view: this.controller.mainEditorView }
|
|
216
218
|
);
|
|
217
219
|
}
|
|
218
220
|
|
|
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
|
|
|
3
3
|
import { tracked } from '@glimmer/tracking';
|
|
4
4
|
import {
|
|
5
5
|
Fragment,
|
|
6
|
-
|
|
6
|
+
SayController,
|
|
7
7
|
Slice,
|
|
8
8
|
Transaction,
|
|
9
9
|
} from '@lblod/ember-rdfa-editor';
|
|
@@ -24,8 +24,9 @@ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
|
24
24
|
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
25
25
|
|
|
26
26
|
interface Args {
|
|
27
|
-
controller:
|
|
28
|
-
|
|
27
|
+
controller: SayController;
|
|
28
|
+
plugin: CitationPlugin;
|
|
29
|
+
config: CitationPluginConfig;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export default class EditorPluginsCitationInsertComponent extends Component<Args> {
|
|
@@ -35,7 +36,7 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
35
36
|
@tracked legislationType: string | null = null;
|
|
36
37
|
|
|
37
38
|
get config() {
|
|
38
|
-
return this.args.
|
|
39
|
+
return this.args.config;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
get selectedLegislationTypeUri(): string {
|
|
@@ -63,9 +64,11 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
63
64
|
if (this.controller.inEmbeddedView) {
|
|
64
65
|
return true;
|
|
65
66
|
}
|
|
66
|
-
const { selection } = this.controller.
|
|
67
|
+
const { selection } = this.controller.mainEditorState;
|
|
67
68
|
if (this.config.type === 'ranges') {
|
|
68
|
-
const ranges = this.config.activeInRanges(
|
|
69
|
+
const ranges = this.config.activeInRanges(
|
|
70
|
+
this.controller.mainEditorState
|
|
71
|
+
);
|
|
69
72
|
for (const range of ranges) {
|
|
70
73
|
if (selection.from > range[0] && selection.from < range[1]) {
|
|
71
74
|
return false;
|
|
@@ -75,18 +78,18 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
75
78
|
} else {
|
|
76
79
|
const nodeTypes = this.config.activeInNodeTypes(
|
|
77
80
|
this.controller.schema,
|
|
78
|
-
this.controller.
|
|
81
|
+
this.controller.mainEditorState
|
|
79
82
|
);
|
|
80
83
|
return !findParentNodeOfType([...nodeTypes])(selection);
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
get plugin() {
|
|
85
|
-
return this.args.
|
|
88
|
+
return this.args.plugin;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
get activeRanges() {
|
|
89
|
-
return this.plugin.getState(this.controller.
|
|
92
|
+
return this.plugin.getState(this.controller.mainEditorState)?.activeRanges;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
get controller() {
|
|
@@ -113,19 +116,21 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
113
116
|
const type = decision.legislationType?.label || '';
|
|
114
117
|
const uri = decision.uri;
|
|
115
118
|
const title = decision.title ?? '';
|
|
116
|
-
this.controller.withTransaction(
|
|
117
|
-
tr
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
this.controller.withTransaction(
|
|
120
|
+
(tr: Transaction) =>
|
|
121
|
+
tr
|
|
122
|
+
.replaceSelection(
|
|
123
|
+
new Slice(
|
|
124
|
+
Fragment.fromArray([
|
|
125
|
+
this.controller.schema.text(`${type} `),
|
|
126
|
+
citedText(this.controller.schema, title, uri),
|
|
127
|
+
]),
|
|
128
|
+
0,
|
|
129
|
+
0
|
|
130
|
+
)
|
|
126
131
|
)
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
.scrollIntoView(),
|
|
133
|
+
{ view: this.controller.mainEditorView }
|
|
129
134
|
);
|
|
130
135
|
}
|
|
131
136
|
|
|
@@ -137,12 +142,14 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
137
142
|
if (decision.title) {
|
|
138
143
|
title = `${decision.title}, ${article.number ?? ''}`;
|
|
139
144
|
}
|
|
140
|
-
const { from, to } = this.
|
|
141
|
-
this.controller.withTransaction(
|
|
142
|
-
tr
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
const { from, to } = this.controller.mainEditorState.selection;
|
|
146
|
+
this.controller.withTransaction(
|
|
147
|
+
(tr: Transaction) =>
|
|
148
|
+
tr.replaceWith(from, to, [
|
|
149
|
+
this.controller.schema.text(`${type} `),
|
|
150
|
+
citedText(this.controller.schema, title, uri),
|
|
151
|
+
]),
|
|
152
|
+
{ view: this.controller.mainEditorView }
|
|
146
153
|
);
|
|
147
154
|
}
|
|
148
155
|
}
|
|
@@ -2,13 +2,13 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
4
|
import { ProseParser } from '@lblod/ember-rdfa-editor';
|
|
5
|
-
import {
|
|
5
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
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
8
|
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
9
9
|
|
|
10
10
|
type Args = {
|
|
11
|
-
controller:
|
|
11
|
+
controller: SayController;
|
|
12
12
|
};
|
|
13
13
|
export default class ImportSnippetPluginCard extends Component<Args> {
|
|
14
14
|
@service declare importRdfaSnippet: ImportRdfaSnippet;
|
|
@@ -22,7 +22,7 @@ export default class ImportSnippetPluginCard extends Component<Args> {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
get insertRange() {
|
|
25
|
-
const { selection } = this.controller.
|
|
25
|
+
const { selection } = this.controller.mainEditorState;
|
|
26
26
|
const besluit = findParentNodeOfType(this.controller.schema.nodes.besluit)(
|
|
27
27
|
selection
|
|
28
28
|
);
|
|
@@ -41,9 +41,12 @@ export default class ImportSnippetPluginCard extends Component<Args> {
|
|
|
41
41
|
const insertRange = this.insertRange;
|
|
42
42
|
if (insertRange) {
|
|
43
43
|
const node = this.generateSnippetHtml(snippet, type);
|
|
44
|
-
this.controller.withTransaction(
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
this.controller.withTransaction(
|
|
45
|
+
(tr) => {
|
|
46
|
+
return tr.replaceRangeWith(insertRange.from, insertRange.to, node);
|
|
47
|
+
},
|
|
48
|
+
{ view: this.controller.mainEditorView }
|
|
49
|
+
);
|
|
47
50
|
this.importRdfaSnippet.removeSnippet(snippet);
|
|
48
51
|
} else {
|
|
49
52
|
console.warn('Could not find a range to insert, so we skipped inserting');
|