@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.
Files changed (95) 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 +31 -1
  5. package/README.md +1 -0
  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 +6 -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.ts +27 -25
  14. package/addon/components/citation-plugin/citation-insert.ts +34 -27
  15. package/addon/components/import-snippet-plugin/card.ts +9 -6
  16. package/addon/components/rdfa-date-plugin/card.ts +14 -18
  17. package/addon/components/rdfa-date-plugin/insert.hbs +0 -9
  18. package/addon/components/rdfa-date-plugin/insert.ts +12 -20
  19. package/addon/components/roadsign-regulation-plugin/roadsign-regulation-card.ts +3 -3
  20. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +5 -4
  21. package/addon/components/roadsign-regulation-plugin/roadsigns-table.ts +1 -1
  22. package/addon/components/standard-template-plugin/card.ts +2 -2
  23. package/addon/components/standard-template-plugin/template-provider.ts +6 -5
  24. package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +1 -1
  25. package/addon/components/table-of-contents-plugin/toolbar-button.ts +15 -9
  26. package/addon/components/variable-plugin/insert-variable-card.ts +19 -14
  27. package/addon/components/variable-plugin/template-variable-card.hbs +1 -1
  28. package/addon/components/variable-plugin/template-variable-card.ts +10 -7
  29. package/addon/components/variable-plugin/variable.hbs +8 -3
  30. package/addon/models/instruction.ts +1 -1
  31. package/addon/models/measure.ts +1 -1
  32. package/addon/models/sign.ts +1 -1
  33. package/addon/plugins/article-structure-plugin/commands/move-selected-structure.ts +1 -1
  34. package/addon/plugins/article-structure-plugin/index.ts +2 -32
  35. package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +16 -7
  36. package/addon/plugins/article-structure-plugin/structures/article.ts +7 -3
  37. package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -1
  38. package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
  39. package/addon/plugins/article-structure-plugin/structures/structure-header.ts +7 -2
  40. package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
  41. package/addon/plugins/article-structure-plugin/structures/title.ts +1 -1
  42. package/addon/plugins/besluit-plugin/utils/get-title-for-decision.ts +3 -6
  43. package/addon/plugins/citation-plugin/index.ts +1 -49
  44. package/addon/plugins/rdfa-date-plugin/index.ts +5 -28
  45. package/addon/plugins/rdfa-date-plugin/nodes/date.ts +1 -6
  46. package/addon/plugins/standard-template-plugin/index.ts +0 -6
  47. package/addon/plugins/standard-template-plugin/utils/nodes.ts +1 -1
  48. package/addon/plugins/table-of-contents-plugin/index.ts +0 -7
  49. package/addon/plugins/variable-plugin/nodes.ts +6 -3
  50. package/addon/services/roadsign-registry.ts +1 -1
  51. package/app/styles/article-structure-plugin.scss +7 -0
  52. package/app/styles/besluit-plugin.scss +4 -0
  53. package/components/article-structure-plugin/article-structure-card.d.ts +4 -5
  54. package/components/article-structure-plugin/structure-card.d.ts +4 -6
  55. package/components/besluit-plugin/besluit-plugin-card.d.ts +3 -3
  56. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +3 -3
  57. package/components/citation-plugin/citation-card.d.ts +4 -6
  58. package/components/citation-plugin/citation-insert.d.ts +5 -7
  59. package/components/import-snippet-plugin/card.d.ts +3 -3
  60. package/components/rdfa-date-plugin/card.d.ts +5 -10
  61. package/components/rdfa-date-plugin/insert.d.ts +6 -12
  62. package/components/roadsign-regulation-plugin/roadsign-regulation-card.d.ts +3 -3
  63. package/components/roadsign-regulation-plugin/roadsigns-modal.d.ts +2 -2
  64. package/components/standard-template-plugin/card.d.ts +3 -3
  65. package/components/standard-template-plugin/template-provider.d.ts +3 -3
  66. package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
  67. package/components/table-of-contents-plugin/toolbar-button.d.ts +3 -3
  68. package/components/variable-plugin/insert-variable-card.d.ts +7 -8
  69. package/components/variable-plugin/template-variable-card.d.ts +3 -3
  70. package/package.json +26 -29
  71. package/plugins/article-structure-plugin/index.d.ts +2 -3
  72. package/plugins/besluit-plugin/utils/get-title-for-decision.d.ts +3 -3
  73. package/plugins/citation-plugin/index.d.ts +2 -12
  74. package/plugins/rdfa-date-plugin/index.d.ts +5 -5
  75. package/plugins/rdfa-date-plugin/nodes/date.d.ts +1 -6
  76. package/plugins/standard-template-plugin/index.d.ts +0 -2
  77. package/plugins/table-of-contents-plugin/index.d.ts +0 -2
  78. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
  79. package/plugins/variable-plugin/nodes.d.ts +1 -1
  80. package/translations/en-US.yaml +63 -61
  81. package/translations/nl-BE.yaml +65 -59
  82. package/addon/components/variable-plugin/variable.ts +0 -262
  83. package/addon/plugins/besluit-plugin/index.ts +0 -6
  84. package/addon/plugins/besluit-type-plugin/index.ts +0 -6
  85. package/addon/plugins/import-snippet-plugin.ts +0 -6
  86. package/addon/plugins/rdfa-date-plugin/nodes/index.ts +0 -1
  87. package/addon/plugins/roadsign-regulation-plugin/index.ts +0 -6
  88. package/addon/plugins/variable-plugin/index.ts +0 -16
  89. package/components/variable-plugin/variable.d.ts +0 -43
  90. package/plugins/besluit-plugin/index.d.ts +0 -2
  91. package/plugins/besluit-type-plugin/index.d.ts +0 -2
  92. package/plugins/import-snippet-plugin.d.ts +0 -2
  93. package/plugins/rdfa-date-plugin/nodes/index.d.ts +0 -1
  94. package/plugins/roadsign-regulation-plugin/index.d.ts +0 -2
  95. package/plugins/variable-plugin/index.d.ts +0 -3
@@ -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 {
@@ -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>
@@ -1,18 +1,16 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
3
+ import { SayController } from '@lblod/ember-rdfa-editor';
4
4
  import { NodeSelection } from '@lblod/ember-rdfa-editor';
5
- import { DateFormat } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
5
+ import {
6
+ DateFormat,
7
+ DateOptions,
8
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/rdfa-date-plugin';
6
9
  import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
7
10
 
8
11
  type Args = {
9
- controller: ProseController;
10
- widgetArgs: {
11
- options: {
12
- formats: [DateFormat];
13
- allowCustomFormat: boolean;
14
- };
15
- };
12
+ controller: SayController;
13
+ options: DateOptions;
16
14
  };
17
15
 
18
16
  export default class RdfaDatePluginInsertComponent extends Component<Args> {
@@ -25,26 +23,20 @@ export default class RdfaDatePluginInsertComponent extends Component<Args> {
25
23
  }
26
24
 
27
25
  get formats(): DateFormat[] {
28
- return this.args.widgetArgs.options.formats;
26
+ return this.args.options.formats;
29
27
  }
30
28
 
31
29
  get defaultDateFormat(): Option<string> {
32
30
  return this.formats[0].dateFormat;
33
31
  }
34
32
 
35
- get defaultDateTimeFormat(): Option<string> {
36
- return this.formats[0].dateTimeFormat;
37
- }
38
-
39
33
  @action
40
- insertDate(onlyDate: boolean) {
34
+ insertDate() {
41
35
  this.controller.withTransaction((tr) => {
42
36
  tr.replaceSelectionWith(
43
37
  this.schema.node('date', {
44
- onlyDate,
45
- format: onlyDate
46
- ? this.defaultDateFormat
47
- : this.defaultDateTimeFormat,
38
+ onlyDate: true,
39
+ format: this.defaultDateFormat,
48
40
  })
49
41
  );
50
42
  if (tr.selection.$anchor.nodeBefore) {
@@ -54,6 +46,6 @@ export default class RdfaDatePluginInsertComponent extends Component<Args> {
54
46
  tr.setSelection(new NodeSelection(resolvedPos));
55
47
  }
56
48
  return tr;
57
- }, true);
49
+ });
58
50
  }
59
51
  }
@@ -2,7 +2,7 @@ import { findParentNode } from '@curvenote/prosemirror-utils';
2
2
  import { action } from '@ember/object';
3
3
  import Component from '@glimmer/component';
4
4
  import { tracked } from '@glimmer/tracking';
5
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
5
+ import { SayController } from '@lblod/ember-rdfa-editor';
6
6
 
7
7
  /**
8
8
  * Card displaying a hint of the Date plugin
@@ -22,7 +22,7 @@ const acceptedTypes = [
22
22
  ];
23
23
 
24
24
  type Args = {
25
- controller: ProseController;
25
+ controller: SayController;
26
26
  };
27
27
 
28
28
  export default class RoadsignRegulationCard extends Component<Args> {
@@ -48,7 +48,7 @@ export default class RoadsignRegulationCard extends Component<Args> {
48
48
  }
49
49
 
50
50
  get showCard() {
51
- const selection = this.controller.state.selection;
51
+ const selection = this.controller.mainEditorState.selection;
52
52
  const besluitNode = findParentNode((node) => {
53
53
  if (node.type === this.schema.nodes['besluit']) {
54
54
  const rdfTypes = (node.attrs['typeof'] as string | undefined)?.split(
@@ -13,13 +13,13 @@ import {
13
13
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/constants';
14
14
  import RoadsignRegistryService from '@lblod/ember-rdfa-editor-lblod-plugins/services/roadsign-registry';
15
15
  import { assert } from '@ember/debug';
16
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
17
16
  import Measure from '@lblod/ember-rdfa-editor-lblod-plugins/models/measure';
18
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
17
+ import { SayController } from '@lblod/ember-rdfa-editor';
19
18
  import { insertStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/commands';
20
19
  import { besluitArticleStructure } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/standard-template-plugin/utils/nodes';
21
20
  import IntlService from 'ember-intl/services/intl';
22
21
  import { ProseParser } from '@lblod/ember-rdfa-editor';
22
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
23
23
 
24
24
  const PAGE_SIZE = 10;
25
25
  const SIGN_TYPE_URI =
@@ -42,7 +42,7 @@ type Category = Option;
42
42
 
43
43
  type Args = {
44
44
  closeModal: () => void;
45
- controller: ProseController;
45
+ controller: SayController;
46
46
  };
47
47
 
48
48
  export default class RoadsignRegulationCard extends Component<Args> {
@@ -306,7 +306,8 @@ export default class RoadsignRegulationCard extends Component<Args> {
306
306
  }).content;
307
307
 
308
308
  this.args.controller.doCommand(
309
- insertStructure(besluitArticleStructure, this.intl, contentFragment)
309
+ insertStructure(besluitArticleStructure, this.intl, contentFragment),
310
+ { view: this.args.controller.mainEditorView }
310
311
  );
311
312
  this.args.closeModal();
312
313
  }
@@ -2,7 +2,7 @@ import { action } from '@ember/object';
2
2
  import Component from '@glimmer/component';
3
3
  import { tracked } from '@glimmer/tracking';
4
4
  import { getOwner } from '@ember/application';
5
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
5
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
6
6
 
7
7
  type Args = Record<string, never>;
8
8
  export default class RoadsignsTable extends Component<Args> {
@@ -1,8 +1,8 @@
1
1
  import Component from '@glimmer/component';
2
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
3
 
4
4
  type Args = {
5
- controller: ProseController;
5
+ controller: SayController;
6
6
  };
7
7
  export default class StandardTemplatePluginCardComponent extends Component<Args> {
8
8
  get controller() {
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
2
2
  import { action } from '@ember/object';
3
3
  import { inject as service } from '@ember/service';
4
4
  import StandardTemplatePluginService from '@lblod/ember-rdfa-editor-lblod-plugins/services/standard-template-plugin';
5
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
5
+ import { SayController } from '@lblod/ember-rdfa-editor';
6
6
  import TemplateModel from '@lblod/ember-rdfa-editor-lblod-plugins/models/template';
7
7
  import { insertHtml } from '@lblod/ember-rdfa-editor/commands/insert-html-command';
8
8
  import instantiateUuids from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/standard-template-plugin/utils/instantiate-uuids';
@@ -14,7 +14,7 @@ import {
14
14
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
15
15
 
16
16
  type Args = {
17
- controller: ProseController;
17
+ controller: SayController;
18
18
  };
19
19
 
20
20
  const HACKY_LOOKUP: Record<string, Resource> = {
@@ -65,7 +65,7 @@ export default class TemplateProviderComponent extends Component<Args> {
65
65
  }
66
66
 
67
67
  templateIsApplicable(template: TemplateModel) {
68
- const { $from } = this.controller.state.selection;
68
+ const { $from } = this.controller.mainEditorState.selection;
69
69
  const containsTypes =
70
70
  this.controller.externalContextStore
71
71
  .match(null, 'a')
@@ -95,7 +95,7 @@ export default class TemplateProviderComponent extends Component<Args> {
95
95
  @action
96
96
  async insert(template: TemplateModel) {
97
97
  await template.reload();
98
- const selection = this.controller.state.selection;
98
+ const selection = this.controller.mainEditorState.selection;
99
99
  let insertRange: { from: number; to: number } = selection;
100
100
  const { $from, $to } = selection;
101
101
  const isInPlaceholder =
@@ -119,7 +119,8 @@ export default class TemplateProviderComponent extends Component<Args> {
119
119
  instantiateUuids(template.body),
120
120
  insertRange.from,
121
121
  insertRange.to
122
- )
122
+ ),
123
+ { view: this.controller.mainEditorView }
123
124
  );
124
125
  }
125
126
  }
@@ -21,7 +21,7 @@ export default class TableOfContentsComponent extends Component<EmberNodeArgs> {
21
21
 
22
22
  get outline() {
23
23
  const entries = this.extractOutline({
24
- node: this.controller.state.doc,
24
+ node: this.controller.mainEditorState.doc,
25
25
  pos: -1,
26
26
  });
27
27
  return {
@@ -1,9 +1,9 @@
1
1
  import { action } from '@ember/object';
2
2
  import Component from '@glimmer/component';
3
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
3
+ import { SayController } from '@lblod/ember-rdfa-editor';
4
4
 
5
5
  type Args = {
6
- controller: ProseController;
6
+ controller: SayController;
7
7
  };
8
8
 
9
9
  export default class TableOfContentsCardComponent extends Component<Args> {
@@ -17,7 +17,7 @@ export default class TableOfContentsCardComponent extends Component<Args> {
17
17
 
18
18
  get tableOfContentsRange() {
19
19
  let result: { from: number; to: number } | undefined;
20
- this.controller.state.doc.descendants((node, pos) => {
20
+ this.controller.mainEditorState.doc.descendants((node, pos) => {
21
21
  if (node.type === this.controller.schema.nodes['table_of_contents']) {
22
22
  result = { from: pos, to: pos + node.nodeSize };
23
23
  }
@@ -30,14 +30,20 @@ export default class TableOfContentsCardComponent extends Component<Args> {
30
30
  toggle() {
31
31
  if (this.tableOfContentsRange) {
32
32
  const { from, to } = this.tableOfContentsRange;
33
- this.controller.withTransaction((tr) => {
34
- return tr.deleteRange(from, to);
35
- });
33
+ this.controller.withTransaction(
34
+ (tr) => {
35
+ return tr.deleteRange(from, to);
36
+ },
37
+ { view: this.controller.mainEditorView }
38
+ );
36
39
  } else {
37
40
  const { schema } = this.controller;
38
- this.controller.withTransaction((tr) => {
39
- return tr.replaceRangeWith(0, 0, schema.node('table_of_contents'));
40
- });
41
+ this.controller.withTransaction(
42
+ (tr) => {
43
+ return tr.replaceRangeWith(0, 0, schema.node('table_of_contents'));
44
+ },
45
+ { view: this.controller.mainEditorView }
46
+ );
41
47
  }
42
48
  }
43
49
  }
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
2
2
  import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
4
  import { task } from 'ember-concurrency';
5
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
5
+ import { SayController } from '@lblod/ember-rdfa-editor';
6
6
  import {
7
7
  DEFAULT_VARIABLE_TYPES,
8
8
  VariableType,
@@ -11,13 +11,11 @@ import { CodeList } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variabl
11
11
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
12
12
  import { NodeSelection } from '@lblod/ember-rdfa-editor';
13
13
  type Args = {
14
- controller: ProseController;
15
- widgetArgs: {
16
- options: {
17
- publisher: string;
18
- variableTypes: (VariableType | string)[];
19
- defaultEndpoint: string;
20
- };
14
+ controller: SayController;
15
+ options: {
16
+ publisher: string;
17
+ variableTypes: (VariableType | string)[];
18
+ defaultEndpoint: string;
21
19
  };
22
20
  };
23
21
 
@@ -33,7 +31,7 @@ export default class EditorPluginsInsertCodelistCardComponent extends Component<
33
31
  constructor(parent: unknown, args: Args) {
34
32
  super(parent, args);
35
33
  const { publisher, variableTypes, defaultEndpoint } =
36
- this.args.widgetArgs.options || {};
34
+ this.args.options || {};
37
35
  this.publisher = publisher;
38
36
  this.endpoint = defaultEndpoint;
39
37
  const variableTypesSelectedByUser = variableTypes ?? [
@@ -62,19 +60,26 @@ export default class EditorPluginsInsertCodelistCardComponent extends Component<
62
60
  this.variablesArray = variablesArray;
63
61
  }
64
62
 
63
+ get controller() {
64
+ return this.args.controller;
65
+ }
66
+
65
67
  @action
66
68
  insert() {
67
69
  if (!this.selectedVariable) {
68
70
  return;
69
71
  }
70
72
  const node = this.selectedVariable.constructor(
71
- this.args.controller.schema,
73
+ this.controller.schema,
72
74
  this.endpoint,
73
75
  this.selectedSubtype
74
76
  );
75
- this.args.controller.withTransaction((tr) => {
76
- return tr.replaceSelectionWith(node);
77
- });
77
+ this.controller.withTransaction(
78
+ (tr) => {
79
+ return tr.replaceSelectionWith(node);
80
+ },
81
+ { view: this.controller.mainEditorView }
82
+ );
78
83
  }
79
84
 
80
85
  @action
@@ -109,7 +114,7 @@ export default class EditorPluginsInsertCodelistCardComponent extends Component<
109
114
  if (this.args.controller.inEmbeddedView) {
110
115
  return false;
111
116
  }
112
- const { selection } = this.args.controller.state;
117
+ const { selection } = this.args.controller.mainEditorState;
113
118
  if (
114
119
  selection instanceof NodeSelection &&
115
120
  selection.node.type === this.args.controller.schema.nodes.variable
@@ -1,4 +1,4 @@
1
- <div {{did-update this.selectionChanged @controller.state}}>
1
+ <div {{did-update this.selectionChanged @controller.mainEditorState}}>
2
2
  {{#if this.showCard}}
3
3
  <AuCard @flex={{true}} @divided={{true}} @isOpenInitially={{true}} @expandable={{true}} @shadow={{true}} @size="small" as |c|>
4
4
  <c.header>
@@ -3,8 +3,7 @@ import { tracked } from '@glimmer/tracking';
3
3
  import { action } from '@ember/object';
4
4
  import { getOwner } from '@ember/application';
5
5
  import { task } from 'ember-concurrency';
6
- import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
7
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
6
+ import { SayController } from '@lblod/ember-rdfa-editor';
8
7
  import {
9
8
  CodeListOption,
10
9
  fetchCodeListOptions,
@@ -13,9 +12,10 @@ import { MULTI_SELECT_CODELIST_TYPE } from '@lblod/ember-rdfa-editor-lblod-plugi
13
12
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
14
13
  import { NodeSelection, PNode, ProseParser } from '@lblod/ember-rdfa-editor';
15
14
  import { ZONAL_URI } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/roadsign-regulation-plugin/utils/constants';
15
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
16
16
 
17
17
  type Args = {
18
- controller: ProseController;
18
+ controller: SayController;
19
19
  };
20
20
  export default class EditorPluginsTemplateVariableCardComponent extends Component<Args> {
21
21
  @tracked variableOptions: CodeListOption[] = [];
@@ -74,9 +74,12 @@ export default class EditorPluginsTemplateVariableCardComponent extends Componen
74
74
  from: this.selectedVariable.pos + 1,
75
75
  to: this.selectedVariable.pos + this.selectedVariable.node.nodeSize - 1,
76
76
  };
77
- this.controller.withTransaction((tr) => {
78
- return tr.replaceWith(range.from, range.to, contentFragment);
79
- });
77
+ this.controller.withTransaction(
78
+ (tr) => {
79
+ return tr.replaceWith(range.from, range.to, contentFragment);
80
+ },
81
+ { view: this.controller.mainEditorView }
82
+ );
80
83
  }
81
84
 
82
85
  wrapVariableInHighlight(text: string) {
@@ -90,7 +93,7 @@ export default class EditorPluginsTemplateVariableCardComponent extends Componen
90
93
  selectionChanged() {
91
94
  this.showCard = false;
92
95
  this.selectedVariableOption = undefined;
93
- const { selection } = this.controller.state;
96
+ const { selection } = this.controller.mainEditorState;
94
97
  if (
95
98
  selection instanceof NodeSelection &&
96
99
  selection.node.type === this.controller.schema.nodes.variable
@@ -1,4 +1,9 @@
1
- <AuPill @icon="pencil" @iconAlignment="right" class="variable" {{on "click" this.onClick}}>
2
- <div {{did-insert this.didInsertContentWrapper}} {{did-update this.onNodeUpdate @node}}>
3
- </div>
1
+ <AuPill @icon="pencil" @iconAlignment="right" class="variable">
2
+ <EmberNode::EmbeddedEditor
3
+ @controller={{@controller}}
4
+ @node={{@node}}
5
+ @view={{@view}}
6
+ @getPos={{@getPos}}
7
+ @selected={{@selected}}
8
+ />
4
9
  </AuPill>
@@ -1,5 +1,5 @@
1
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
2
1
  import { IBindings } from 'fetch-sparql-endpoint';
2
+ import { unwrap } from '../utils/option';
3
3
 
4
4
  export default class Instruction {
5
5
  constructor(
@@ -1,6 +1,6 @@
1
1
  import { tracked } from '@glimmer/tracking';
2
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
3
2
  import { IBindings } from 'fetch-sparql-endpoint';
3
+ import { unwrap } from '../utils/option';
4
4
  import Sign from './sign';
5
5
 
6
6
  export default class Measure {
@@ -1,5 +1,5 @@
1
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
2
1
  import { IBindings } from 'fetch-sparql-endpoint';
2
+ import { unwrap } from '../utils/option';
3
3
 
4
4
  export default class Sign {
5
5
  constructor(
@@ -7,13 +7,13 @@ import {
7
7
  Selection,
8
8
  TextSelection,
9
9
  } from '@lblod/ember-rdfa-editor';
10
- import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
11
10
  import { ArticleStructurePluginOptions } from '..';
12
11
  import { findAncestorOfType } from '../utils/structure';
13
12
  import recalculateStructureNumbers from './recalculate-structure-numbers';
14
13
  import { findNodes } from '@lblod/ember-rdfa-editor/utils/position-utils';
15
14
  import IntlService from 'ember-intl/services/intl';
16
15
  import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
16
+ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
17
17
  const moveSelectedStructure = (
18
18
  options: ArticleStructurePluginOptions,
19
19
  direction: 'up' | 'down',
@@ -1,13 +1,6 @@
1
- import {
2
- Fragment,
3
- PNode,
4
- Schema,
5
- WidgetSpec,
6
- EditorState,
7
- } from '@lblod/ember-rdfa-editor';
1
+ import { Fragment, PNode, Schema, EditorState } from '@lblod/ember-rdfa-editor';
8
2
  import IntlService from 'ember-intl/services/intl';
9
3
  import { Transaction } from '@lblod/ember-rdfa-editor';
10
- import { STRUCTURE_SPECS } from './structures';
11
4
 
12
5
  export type SpecName = string;
13
6
 
@@ -41,30 +34,7 @@ export type StructureSpec = {
41
34
  content?: (args: { pos: number; state: EditorState }) => Fragment;
42
35
  continuous: boolean;
43
36
  limitTo?: string;
37
+ noUnwrap?: boolean;
44
38
  };
45
39
 
46
40
  export type ArticleStructurePluginOptions = StructureSpec[];
47
-
48
- export const articleStructureInsertWidget: (
49
- options?: ArticleStructurePluginOptions
50
- ) => WidgetSpec = (options) => {
51
- return {
52
- componentName: 'article-structure-plugin/article-structure-card',
53
- desiredLocation: 'insertSidebar',
54
- widgetArgs: {
55
- options: options ?? STRUCTURE_SPECS,
56
- },
57
- };
58
- };
59
-
60
- export const articleStructureContextWidget: (
61
- options?: ArticleStructurePluginOptions
62
- ) => WidgetSpec = (options) => {
63
- return {
64
- componentName: 'article-structure-plugin/structure-card',
65
- desiredLocation: 'sidebar',
66
- widgetArgs: {
67
- options: options ?? STRUCTURE_SPECS,
68
- },
69
- };
70
- };
@@ -23,6 +23,7 @@ export const articleParagraphSpec: StructureSpec = {
23
23
  remove: 'article-structure-plugin.remove.paragraph',
24
24
  },
25
25
  continuous: true,
26
+ noUnwrap: true,
26
27
  constructor: ({ schema, number, intl }) => {
27
28
  const numberConverted = number?.toString() ?? '1';
28
29
  const node = schema.node(
@@ -31,9 +32,13 @@ export const articleParagraphSpec: StructureSpec = {
31
32
  resource: `http://data.lblod.info/paragraphs/${uuid()}`,
32
33
  number: numberConverted,
33
34
  },
34
- schema.node('placeholder', {
35
- placeholderText: intl?.t(PLACEHOLDERS.body),
36
- })
35
+ schema.node(
36
+ 'paragraph',
37
+ {},
38
+ schema.node('placeholder', {
39
+ placeholderText: intl?.t(PLACEHOLDERS.body),
40
+ })
41
+ )
37
42
  );
38
43
  return { node, selectionConfig: { relativePos: 1, type: 'node' } };
39
44
  },
@@ -47,7 +52,7 @@ const contentSelector = `span[property~='${SAY('body').prefixed}'],
47
52
  span[property~='${SAY('body').full}']`;
48
53
 
49
54
  export const article_paragraph: NodeSpec = {
50
- content: 'inline*',
55
+ content: 'paragraph*',
51
56
  inline: false,
52
57
  isolating: true,
53
58
  defining: true,
@@ -71,13 +76,17 @@ export const article_paragraph: NodeSpec = {
71
76
  typeof: node.attrs.typeof as string,
72
77
  resource: node.attrs.resource as string,
73
78
  },
74
- '$',
79
+ ['span', { contenteditable: false }, '$'],
75
80
  [
76
81
  'span',
77
- { property: ELI('number').prefixed, datatype: XSD('integer').prefixed },
82
+ {
83
+ property: ELI('number').prefixed,
84
+ datatype: XSD('integer').prefixed,
85
+ contenteditable: false,
86
+ },
78
87
  node.attrs.number,
79
88
  ],
80
- '. ',
89
+ ['span', { contenteditable: false }, '. '],
81
90
  ['span', { property: SAY('body').prefixed }, 0],
82
91
  ];
83
92
  },