@lblod/ember-rdfa-editor-lblod-plugins 2.1.2 → 4.0.1

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.
Files changed (101) hide show
  1. package/.woodpecker/.release.yml +1 -1
  2. package/.woodpecker/.test-scenarios.yml +17 -0
  3. package/.woodpecker/.test.yml +5 -5
  4. package/CHANGELOG.md +61 -1
  5. package/README.md +184 -141
  6. package/addon/components/article-structure-plugin/article-structure-card.hbs +1 -3
  7. package/addon/components/article-structure-plugin/article-structure-card.ts +14 -8
  8. package/addon/components/article-structure-plugin/structure-card.hbs +9 -4
  9. package/addon/components/article-structure-plugin/structure-card.ts +19 -15
  10. package/addon/components/besluit-plugin/besluit-plugin-card.ts +8 -4
  11. package/addon/components/besluit-type-plugin/toolbar-dropdown.hbs +2 -2
  12. package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +12 -10
  13. package/addon/components/citation-plugin/citation-card.hbs +4 -0
  14. package/addon/components/citation-plugin/citation-card.ts +42 -33
  15. package/addon/components/citation-plugin/citation-insert.ts +32 -37
  16. package/addon/components/import-snippet-plugin/card.ts +9 -6
  17. package/addon/components/rdfa-date-plugin/card.ts +16 -20
  18. package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
  19. package/addon/components/rdfa-date-plugin/insert.ts +12 -20
  20. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +3 -3
  21. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +5 -4
  22. package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +1 -1
  23. package/addon/components/standard-template-plugin/card.ts +2 -2
  24. package/addon/components/standard-template-plugin/template-provider.ts +6 -5
  25. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -1
  26. package/addon/components/table-of-contents-plugin/toolbar-button.ts +45 -8
  27. package/addon/components/variable-plugin/insert-variable-card.hbs +23 -9
  28. package/addon/components/variable-plugin/insert-variable-card.ts +19 -14
  29. package/addon/components/variable-plugin/template-variable-card.hbs +1 -1
  30. package/addon/components/variable-plugin/template-variable-card.ts +10 -7
  31. package/addon/components/variable-plugin/variable.hbs +8 -3
  32. package/addon/models/instruction.ts +1 -1
  33. package/addon/models/measure.ts +1 -1
  34. package/addon/models/sign.ts +1 -1
  35. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +1 -1
  36. package/addon/plugins/article-structure-plugin/index.ts +2 -32
  37. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +17 -8
  38. package/addon/plugins/article-structure-plugin/structures/article.ts +7 -3
  39. package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -1
  40. package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
  41. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +7 -2
  42. package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
  43. package/addon/plugins/article-structure-plugin/structures/title.ts +1 -1
  44. package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +3 -6
  45. package/addon/plugins/citation-plugin/index.ts +17 -55
  46. package/addon/plugins/citation-plugin/utils/cited-text.ts +5 -4
  47. package/addon/plugins/rdfa-date-plugin/index.ts +5 -28
  48. package/addon/plugins/rdfa-date-plugin/nodes/date.ts +1 -6
  49. package/addon/plugins/standard-template-plugin/index.ts +0 -6
  50. package/addon/plugins/standard-template-plugin/utils/nodes.ts +1 -1
  51. package/addon/plugins/table-of-contents-plugin/index.ts +0 -7
  52. package/addon/plugins/variable-plugin/utils/constants.ts +1 -0
  53. package/addon/services/roadsign-registry.ts +1 -1
  54. package/app/styles/article-structure-plugin.scss +7 -0
  55. package/app/styles/besluit-plugin.scss +4 -0
  56. package/app/styles/variable-plugin.scss +1 -1
  57. package/components/article-structure-plugin/article-structure-card.d.ts +4 -5
  58. package/components/article-structure-plugin/structure-card.d.ts +4 -6
  59. package/components/besluit-plugin/besluit-plugin-card.d.ts +3 -3
  60. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +3 -3
  61. package/components/citation-plugin/citation-card.d.ts +7 -8
  62. package/components/citation-plugin/citation-insert.d.ts +5 -10
  63. package/components/import-snippet-plugin/card.d.ts +3 -3
  64. package/components/rdfa-date-plugin/card.d.ts +6 -11
  65. package/components/rdfa-date-plugin/insert.d.ts +6 -12
  66. package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +3 -3
  67. package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -2
  68. package/components/standard-template-plugin/card.d.ts +3 -3
  69. package/components/standard-template-plugin/template-provider.d.ts +3 -3
  70. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
  71. package/components/table-of-contents-plugin/toolbar-button.d.ts +3 -3
  72. package/components/variable-plugin/insert-variable-card.d.ts +7 -8
  73. package/components/variable-plugin/template-variable-card.d.ts +3 -3
  74. package/package.json +26 -29
  75. package/plugins/article-structure-plugin/index.d.ts +2 -3
  76. package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +3 -3
  77. package/plugins/citation-plugin/index.d.ts +2 -12
  78. package/plugins/rdfa-date-plugin/index.d.ts +5 -5
  79. package/plugins/rdfa-date-plugin/nodes/date.d.ts +1 -6
  80. package/plugins/standard-template-plugin/index.d.ts +0 -2
  81. package/plugins/table-of-contents-plugin/index.d.ts +0 -2
  82. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
  83. package/plugins/variable-plugin/nodes.d.ts +1 -1
  84. package/translations/en-US.yaml +63 -61
  85. package/translations/nl-BE.yaml +65 -59
  86. package/addon/components/variable-plugin/variable.ts +0 -262
  87. package/addon/plugins/besluit-plugin/index.ts +0 -6
  88. package/addon/plugins/besluit-type-plugin/index.ts +0 -6
  89. package/addon/plugins/citation-plugin/marks/citation.ts +0 -27
  90. package/addon/plugins/import-snippet-plugin.ts +0 -6
  91. package/addon/plugins/rdfa-date-plugin/nodes/index.ts +0 -1
  92. package/addon/plugins/roadsign-regulation-plugin/index.ts +0 -6
  93. package/addon/plugins/variable-plugin/index.ts +0 -16
  94. package/components/variable-plugin/variable.d.ts +0 -43
  95. package/plugins/besluit-plugin/index.d.ts +0 -2
  96. package/plugins/besluit-type-plugin/index.d.ts +0 -2
  97. package/plugins/citation-plugin/marks/citation.d.ts +0 -2
  98. package/plugins/import-snippet-plugin.d.ts +0 -2
  99. package/plugins/rdfa-date-plugin/nodes/index.d.ts +0 -1
  100. package/plugins/roadsign-regulation-plugin/index.d.ts +0 -2
  101. package/plugins/variable-plugin/index.d.ts +0 -3
@@ -1,6 +1,6 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
- import { ProseController } from '@lblod/ember-rdfa-editor';
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: ProseController;
17
- widgetArgs: {
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.widgetArgs.options;
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.state.selection;
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 { ProseController } from '@lblod/ember-rdfa-editor';
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: ProseController;
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.state}}
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 { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
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: ProseController;
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.state.doc;
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.state.selection;
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.state.selection,
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.checkAndDoCommand(
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.checkAndDoCommand(
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
  }
@@ -11,6 +11,10 @@
11
11
  this.documentText
12
12
  this.documentLegislationType
13
13
  }}
14
+ {{did-update
15
+ this.update
16
+ this.activeDecoration
17
+ }}
14
18
  as |c|
15
19
  >
16
20
  <c.header>
@@ -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 { ProseController, Transaction } from '@lblod/ember-rdfa-editor';
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: ProseController;
31
- widgetArgs: {
32
- plugin: CitationPlugin;
33
- };
30
+ controller: SayController;
31
+ plugin: CitationPlugin;
34
32
  }
35
33
 
36
34
  export default class CitationCardComponent extends Component<Args> {
@@ -44,8 +42,23 @@ export default class CitationCardComponent extends Component<Args> {
44
42
  @tracked decision: Decision | null = null;
45
43
  @tracked cardText: string | null = null;
46
44
  @tracked cardLegislationType: string | null = null;
45
+ @tracked documentLegislationType: Option<string>;
46
+ @tracked documentText: Option<string>;
47
47
 
48
- get controller(): ProseController {
48
+ @action
49
+ update() {
50
+ if (this.activeDecoration) {
51
+ const { legislationTypeUri, searchText } = this.activeDecoration?.spec;
52
+ if (legislationTypeUri !== this.documentLegislationType) {
53
+ this.documentLegislationType = legislationTypeUri;
54
+ }
55
+ if (searchText !== this.documentText) {
56
+ this.documentText = searchText;
57
+ }
58
+ }
59
+ }
60
+
61
+ get controller(): SayController {
49
62
  return this.args.controller;
50
63
  }
51
64
 
@@ -54,26 +67,18 @@ export default class CitationCardComponent extends Component<Args> {
54
67
  }
55
68
 
56
69
  get plugin() {
57
- return this.args.widgetArgs.plugin;
70
+ return this.args.plugin;
58
71
  }
59
72
 
60
73
  get decorations() {
61
- return this.plugin.getState(this.controller.state)?.highlights;
74
+ return this.plugin.getState(this.controller.mainEditorState)?.highlights;
62
75
  }
63
76
 
64
77
  get activeDecoration(): Option<CitationDecoration> {
65
- const { from, to } = this.controller.state.selection;
78
+ const { from, to } = this.controller.mainEditorState.selection;
66
79
  return this.decorations?.find(from, to)[0];
67
80
  }
68
81
 
69
- get documentLegislationType(): Option<string> {
70
- return this.activeDecoration?.spec.legislationTypeUri;
71
- }
72
-
73
- get documentText(): Option<string> {
74
- return this.activeDecoration?.spec.searchText;
75
- }
76
-
77
82
  get searchText(): string {
78
83
  return (this.cardText ?? this.documentText) || '';
79
84
  }
@@ -186,14 +191,16 @@ export default class CitationCardComponent extends Component<Args> {
186
191
  const uri = decision.uri;
187
192
  const title = decision.title ?? '';
188
193
  const { from, to } = unwrap(this.activeDecoration);
189
- this.controller.withTransaction((tr: Transaction) =>
190
- tr
191
- .replaceRangeWith(
192
- from,
193
- to,
194
- citedText(this.controller.schema, title, uri)
195
- )
196
- .scrollIntoView()
194
+ this.controller.withTransaction(
195
+ (tr: Transaction) =>
196
+ tr
197
+ .replaceRangeWith(
198
+ from,
199
+ to,
200
+ citedText(this.controller.schema, title, uri)
201
+ )
202
+ .scrollIntoView(),
203
+ { view: this.controller.mainEditorView }
197
204
  );
198
205
  }
199
206
 
@@ -205,14 +212,16 @@ export default class CitationCardComponent extends Component<Args> {
205
212
  title = `${decision.title}, ${article.number || ''}`;
206
213
  }
207
214
  const { from, to } = unwrap(this.activeDecoration);
208
- this.controller.withTransaction((tr: Transaction) =>
209
- tr
210
- .replaceRangeWith(
211
- from,
212
- to,
213
- citedText(this.controller.schema, title, uri)
214
- )
215
- .scrollIntoView()
215
+ this.controller.withTransaction(
216
+ (tr: Transaction) =>
217
+ tr
218
+ .replaceRangeWith(
219
+ from,
220
+ to,
221
+ citedText(this.controller.schema, title, uri)
222
+ )
223
+ .scrollIntoView(),
224
+ { view: this.controller.mainEditorView }
216
225
  );
217
226
  }
218
227
 
@@ -3,7 +3,7 @@ import { action } from '@ember/object';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import {
5
5
  Fragment,
6
- ProseController,
6
+ SayController,
7
7
  Slice,
8
8
  Transaction,
9
9
  } from '@lblod/ember-rdfa-editor';
@@ -12,10 +12,7 @@ import {
12
12
  Decision,
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
- import {
16
- CitationPlugin,
17
- CitationPluginConfig,
18
- } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
15
+ import { CitationPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
19
16
  import {
20
17
  LEGISLATION_TYPE_CONCEPTS,
21
18
  LEGISLATION_TYPES,
@@ -24,8 +21,8 @@ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
24
21
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
25
22
 
26
23
  interface Args {
27
- controller: ProseController;
28
- widgetArgs: { plugin: CitationPlugin; config: CitationPluginConfig };
24
+ controller: SayController;
25
+ config: CitationPluginConfig;
29
26
  }
30
27
 
31
28
  export default class EditorPluginsCitationInsertComponent extends Component<Args> {
@@ -35,7 +32,7 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
35
32
  @tracked legislationType: string | null = null;
36
33
 
37
34
  get config() {
38
- return this.args.widgetArgs.config;
35
+ return this.args.config;
39
36
  }
40
37
 
41
38
  get selectedLegislationTypeUri(): string {
@@ -63,9 +60,11 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
63
60
  if (this.controller.inEmbeddedView) {
64
61
  return true;
65
62
  }
66
- const { selection } = this.controller.state;
63
+ const { selection } = this.controller.mainEditorState;
67
64
  if (this.config.type === 'ranges') {
68
- const ranges = this.config.activeInRanges(this.controller.state);
65
+ const ranges = this.config.activeInRanges(
66
+ this.controller.mainEditorState
67
+ );
69
68
  for (const range of ranges) {
70
69
  if (selection.from > range[0] && selection.from < range[1]) {
71
70
  return false;
@@ -75,20 +74,12 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
75
74
  } else {
76
75
  const nodeTypes = this.config.activeInNodeTypes(
77
76
  this.controller.schema,
78
- this.controller.state
77
+ this.controller.mainEditorState
79
78
  );
80
79
  return !findParentNodeOfType([...nodeTypes])(selection);
81
80
  }
82
81
  }
83
82
 
84
- get plugin() {
85
- return this.args.widgetArgs.plugin;
86
- }
87
-
88
- get activeRanges() {
89
- return this.plugin.getState(this.controller.state)?.activeRanges;
90
- }
91
-
92
83
  get controller() {
93
84
  return this.args.controller;
94
85
  }
@@ -113,19 +104,21 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
113
104
  const type = decision.legislationType?.label || '';
114
105
  const uri = decision.uri;
115
106
  const title = decision.title ?? '';
116
- this.controller.withTransaction((tr: Transaction) =>
117
- tr
118
- .replaceSelection(
119
- new Slice(
120
- Fragment.fromArray([
121
- this.controller.schema.text(`${type} `),
122
- citedText(this.controller.schema, title, uri),
123
- ]),
124
- 0,
125
- 0
107
+ this.controller.withTransaction(
108
+ (tr: Transaction) =>
109
+ tr
110
+ .replaceSelection(
111
+ new Slice(
112
+ Fragment.fromArray([
113
+ this.controller.schema.text(`${type} `),
114
+ citedText(this.controller.schema, title, uri),
115
+ ]),
116
+ 0,
117
+ 0
118
+ )
126
119
  )
127
- )
128
- .scrollIntoView()
120
+ .scrollIntoView(),
121
+ { view: this.controller.mainEditorView }
129
122
  );
130
123
  }
131
124
 
@@ -137,12 +130,14 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
137
130
  if (decision.title) {
138
131
  title = `${decision.title}, ${article.number ?? ''}`;
139
132
  }
140
- const { from, to } = this.args.controller.state.selection;
141
- this.controller.withTransaction((tr: Transaction) =>
142
- tr.replaceWith(from, to, [
143
- this.controller.schema.text(`${type} `),
144
- citedText(this.controller.schema, title, uri),
145
- ])
133
+ const { from, to } = this.controller.mainEditorState.selection;
134
+ this.controller.withTransaction(
135
+ (tr: Transaction) =>
136
+ tr.replaceWith(from, to, [
137
+ this.controller.schema.text(`${type} `),
138
+ citedText(this.controller.schema, title, uri),
139
+ ]),
140
+ { view: this.controller.mainEditorView }
146
141
  );
147
142
  }
148
143
  }
@@ -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 { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
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: ProseController;
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.state;
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((tr) => {
45
- return tr.replaceRangeWith(insertRange.from, insertRange.to, node);
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');
@@ -1,9 +1,12 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
4
+ import { SayController } from '@lblod/ember-rdfa-editor';
5
5
  import { NodeSelection, PNode } from '@lblod/ember-rdfa-editor';
6
- import { DateFormat } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
6
+ import {
7
+ DateFormat,
8
+ DateOptions,
9
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
7
10
  import {
8
11
  formatContainsTime,
9
12
  validateDateFormat,
@@ -21,13 +24,8 @@ import {
21
24
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
22
25
 
23
26
  type Args = {
24
- controller: ProseController;
25
- widgetArgs: {
26
- options: {
27
- formats: [DateFormat];
28
- allowCustomFormat: boolean;
29
- };
30
- };
27
+ controller: SayController;
28
+ options: DateOptions;
31
29
  };
32
30
  const SECONDS_REGEX = new RegExp('[sStT]|p{2,}');
33
31
  export default class RdfaDatePluginCardComponent extends Component<Args> {
@@ -39,7 +37,7 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
39
37
  tooltipOpen = false;
40
38
 
41
39
  get formats(): DateFormat[] {
42
- return this.args.widgetArgs.options.formats;
40
+ return this.args.options.formats;
43
41
  }
44
42
 
45
43
  get controller() {
@@ -47,13 +45,13 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
47
45
  }
48
46
 
49
47
  get selection() {
50
- return this.controller.getState(true).selection;
48
+ return this.controller.activeEditorState.selection;
51
49
  }
52
50
 
53
51
  get selectedDateNode(): Option<PNode> {
54
52
  if (
55
53
  this.selection instanceof NodeSelection &&
56
- this.selection.node.type === this.args.controller.schema.nodes['date']
54
+ this.selection.node.type === this.controller.schema.nodes['date']
57
55
  ) {
58
56
  return this.selection.node;
59
57
  } else {
@@ -159,8 +157,8 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
159
157
  return null;
160
158
  }
161
159
 
162
- get pickerDate(): Date {
163
- return this.documentDate ?? new Date();
160
+ get pickerDate(): Option<Date> {
161
+ return this.documentDate;
164
162
  }
165
163
 
166
164
  @action
@@ -178,15 +176,13 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
178
176
  if (pos) {
179
177
  this.controller.withTransaction((tr) => {
180
178
  return tr.setNodeAttribute(pos, 'value', date.toISOString());
181
- }, true);
179
+ });
182
180
  }
183
181
  }
184
182
 
185
183
  @action
186
184
  changeIncludeTime(includeTime: boolean) {
187
- console.log('Include time', includeTime);
188
185
  if (this.isCustom) {
189
- console.log("but it's custom");
190
186
  return;
191
187
  }
192
188
  const dateFormatType = this.documentDateFormatType;
@@ -209,7 +205,7 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
209
205
  .setNodeAttribute(pos, 'format', dateFormat)
210
206
  .setNodeAttribute(pos, 'custom', custom)
211
207
  .setNodeAttribute(pos, 'onlyDate', !formatContainsTime(dateFormat));
212
- }, true);
208
+ });
213
209
  }
214
210
 
215
211
  @action
@@ -221,7 +217,7 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
221
217
  if (formatKey === 'custom') {
222
218
  this.controller.withTransaction((tr) => {
223
219
  return tr.setNodeAttribute(pos, 'custom', true);
224
- }, true);
220
+ });
225
221
  } else {
226
222
  const format = this.formats.find((format) => format.key === formatKey);
227
223
  if (format) {
@@ -243,7 +239,7 @@ export default class RdfaDatePluginCardComponent extends Component<Args> {
243
239
  return tr
244
240
  .setNodeAttribute(pos, 'format', format)
245
241
  .setNodeAttribute(pos, 'onlyDate', !formatContainsTime(format));
246
- }, true);
242
+ });
247
243
  }
248
244
  }
249
245
 
@@ -7,12 +7,3 @@
7
7
  {{t "date-plugin.insert.date"}}
8
8
  </AuButton>
9
9
  </AuList::Item>
10
- <AuList::Item>
11
- <AuButton
12
- @icon="add"
13
- @iconAlignment="left"
14
- @skin="link"
15
- {{on 'click' (fn this.insertDate false)}}>
16
- {{t "date-plugin.insert.datetime"}}
17
- </AuButton>
18
- </AuList::Item>