@lblod/ember-rdfa-editor-lblod-plugins 20.0.0 → 21.0.0-dev.c5ce781692d110862a9e25838e6909d944bb4a42

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 (73) hide show
  1. package/.changeset/brave-cobras-grab.md +5 -0
  2. package/.changeset/brown-berries-kneel.md +5 -0
  3. package/.changeset/dull-files-sip.md +5 -0
  4. package/.changeset/fair-spoons-tell.md +5 -0
  5. package/.changeset/funny-queens-doubt.md +5 -0
  6. package/.changeset/modern-plants-change.md +5 -0
  7. package/.changeset/thick-snails-scream.md +5 -0
  8. package/CHANGELOG.md +32 -0
  9. package/Dockerfile +1 -1
  10. package/addon/components/hover-tooltip.gts +13 -16
  11. package/addon/components/lmb-plugin/search-modal.ts +10 -8
  12. package/addon/components/location-plugin/edit.gts +5 -2
  13. package/addon/components/location-plugin/insert.gts +99 -50
  14. package/addon/components/location-plugin/map.gts +246 -68
  15. package/addon/components/snippet-plugin/nodes/snippet.gts +194 -0
  16. package/addon/components/snippet-plugin/search-modal.ts +2 -0
  17. package/addon/components/snippet-plugin/snippet-insert.ts +15 -6
  18. package/addon/components/snippet-plugin/snippets/snippet-preview.ts +5 -2
  19. package/addon/components/structure-plugin/_private/structure.gts +23 -1
  20. package/addon/components/variable-plugin/date/edit.ts +12 -3
  21. package/addon/components/variable-plugin/number/insert.ts +7 -13
  22. package/addon/models/mandatee.ts +3 -3
  23. package/addon/models/sign.ts +2 -2
  24. package/addon/plugins/decision-plugin/utils/build-article-structure.ts +8 -3
  25. package/addon/plugins/location-plugin/node-contents/address.ts +6 -5
  26. package/addon/plugins/location-plugin/node-contents/area.ts +60 -0
  27. package/addon/plugins/location-plugin/node-contents/index.ts +13 -7
  28. package/addon/plugins/location-plugin/node-contents/place.ts +8 -5
  29. package/addon/plugins/location-plugin/node-contents/point.ts +29 -15
  30. package/addon/plugins/location-plugin/node.ts +12 -8
  31. package/addon/plugins/location-plugin/utils/address-helpers.ts +2 -2
  32. package/addon/plugins/location-plugin/utils/geo-helpers.ts +94 -51
  33. package/addon/plugins/snippet-plugin/nodes/snippet.ts +86 -0
  34. package/addon/plugins/standard-template-plugin/index.ts +0 -27
  35. package/addon/plugins/structure-plugin/node.ts +172 -47
  36. package/addon/plugins/variable-plugin/variables/address.ts +2 -2
  37. package/addon/plugins/variable-plugin/variables/number.ts +2 -2
  38. package/addon/services/roadsign-registry.ts +3 -1
  39. package/addon/utils/translation.ts +18 -4
  40. package/app/components/snippet-plugin/nodes/snippet.js +1 -0
  41. package/app/styles/snippet-plugin.scss +56 -0
  42. package/declarations/addon/components/common/search/alert-load-error.d.ts +1 -1
  43. package/declarations/addon/components/common/search/alert-no-items.d.ts +1 -1
  44. package/declarations/addon/components/confidentiality-plugin/redact.d.ts +1 -1
  45. package/declarations/addon/components/location-plugin/insert.d.ts +2 -0
  46. package/declarations/addon/components/location-plugin/map.d.ts +10 -6
  47. package/declarations/addon/components/pagination/pagination-view.d.ts +1 -1
  48. package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +25 -0
  49. package/declarations/addon/components/snippet-plugin/search-modal.d.ts +2 -0
  50. package/declarations/addon/components/snippet-plugin/snippet-insert.d.ts +1 -1
  51. package/declarations/addon/components/snippet-plugin/snippets/snippet-preview.d.ts +1 -1
  52. package/declarations/addon/components/structure-plugin/_private/structure.d.ts +6 -1
  53. package/declarations/addon/components/variable-plugin/address/edit.d.ts +2 -2
  54. package/declarations/addon/components/variable-plugin/number/insert.d.ts +2 -2
  55. package/declarations/addon/models/mandatee.d.ts +2 -2
  56. package/declarations/addon/models/sign.d.ts +2 -2
  57. package/declarations/addon/plugins/location-plugin/node-contents/area.d.ts +4 -0
  58. package/declarations/addon/plugins/location-plugin/node-contents/index.d.ts +9 -5
  59. package/declarations/addon/plugins/location-plugin/node-contents/point.d.ts +3 -3
  60. package/declarations/addon/plugins/location-plugin/utils/geo-helpers.d.ts +25 -13
  61. package/declarations/addon/plugins/snippet-plugin/nodes/snippet.d.ts +3 -0
  62. package/declarations/addon/plugins/standard-template-plugin/index.d.ts +0 -12
  63. package/declarations/addon/plugins/structure-plugin/node.d.ts +3 -0
  64. package/declarations/addon/utils/translation.d.ts +6 -2
  65. package/package.json +104 -93
  66. package/pnpm-lock.yaml +12643 -10115
  67. package/translations/en-US.yaml +16 -0
  68. package/translations/nl-BE.yaml +17 -0
  69. package/types/ember-leaflet.d.ts +72 -23
  70. package/types/tracked-toolbox/index.d.ts +2 -1
  71. package/addon/plugins/standard-template-plugin/utils/nodes.ts +0 -485
  72. package/declarations/addon/plugins/standard-template-plugin/utils/nodes.d.ts +0 -13
  73. package/types/ember-intl.d.ts +0 -15
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": major
3
+ ---
4
+
5
+ Update ember-intl to v7, drops support for v5 and v6 due to API changes
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": major
3
+ ---
4
+
5
+ Update ember-modifier to v4 and drop support for older versions
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': major
3
+ ---
4
+
5
+ Update to ember-power-select v7.1, drops support for older versions
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": patch
3
+ ---
4
+
5
+ lbm-plugin: add support for inserting independent mandatees (who are not part of a fraction)
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": minor
3
+ ---
4
+
5
+ Update to ember-template-imports 4.1.1
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': major
3
+ ---
4
+
5
+ Update all dependencies to latest supported versions
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@lblod/ember-rdfa-editor-lblod-plugins": major
3
+ ---
4
+
5
+ Run pnpm up to update dependencies to latest supported versions
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 21.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#449](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/449) [`335cb673df926d26a0d421a958c414d334653575`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/335cb673df926d26a0d421a958c414d334653575) Thanks [@elpoelma](https://github.com/elpoelma)! - Drop obsolete decision nodes from `standard-template` plugin
8
+
9
+ ### Minor Changes
10
+
11
+ - [#443](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/443) [`9f53a0c5a0e0db0414b0c84aed978d01752ccbf8`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/9f53a0c5a0e0db0414b0c84aed978d01752ccbf8) Thanks [@piemonkey](https://github.com/piemonkey)! - Add ability to specify area locations in the location-plugin
12
+
13
+ - [#445](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/445) [`06fe546cea3d3e7076f3a0ab4549c8de389a43d7`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/06fe546cea3d3e7076f3a0ab4549c8de389a43d7) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Support for repeatable fragments
14
+
15
+ Addition of a custom, interactive `fragment` node and nodeview.
16
+ Using the fragment node interactive buttons, you can replace, add and remove fragments.
17
+
18
+ - [#444](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/444) [`3eea339d0d4bd5bf746d6c8cd9c99cf95e127825`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/3eea339d0d4bd5bf746d6c8cd9c99cf95e127825) Thanks [@elpoelma](https://github.com/elpoelma)! - Addition of a backwards-compatible parsing-rule for decision articles to `structure` node-spec
19
+
20
+ - [#446](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/446) [`f9b4a65a743b214d4f5fa2ba3936fc9fca9fa4c2`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f9b4a65a743b214d4f5fa2ba3936fc9fca9fa4c2) Thanks [@elpoelma](https://github.com/elpoelma)! - Introduce some modifications to new `structure` node-spec:
21
+ - Drop `structureName` node-attribute. This attribute has been replaced by both the `structureType` and `displayStructureName` attributes.
22
+ - Introduction of a required `structureType` attribute. Examples of `structureType` values are:
23
+ - `article`
24
+ - `title`
25
+ - `chapter`
26
+ - `section`
27
+ - `subsection`
28
+ - `paragraph`
29
+ - Introduction of a `displayStructureName` attribute. This attribute controls whether the internationalizated (based on the document language) version of the structure name is displayed inside the header of the structure. The internationalized structure name is based on the `structureType` value and the entries included in the translation files. `displayStructureName` has a default value of `false`.
30
+
31
+ ### Patch Changes
32
+
33
+ - [#447](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/447) [`f06edfdf1681fc2c52e46462cad8faa5d97215c4`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f06edfdf1681fc2c52e46462cad8faa5d97215c4) Thanks [@elpoelma](https://github.com/elpoelma)! - Ensure `zonality` is set up as optional when fetching traffic signs
34
+
3
35
  ## 20.0.0
4
36
 
5
37
  ### Major Changes
package/Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM node:20-slim AS builder
3
3
  LABEL maintainer="info@redpencil.io"
4
4
 
5
5
  RUN corepack enable
6
- RUN corepack prepare pnpm@latest-8 --activate
6
+ RUN corepack prepare pnpm@9.4 --activate
7
7
  WORKDIR /app
8
8
  COPY package.json pnpm-lock.yaml ./
9
9
  RUN pnpm i --frozen-lockfile
@@ -24,21 +24,18 @@ interface Sig {
24
24
  }
25
25
 
26
26
  export default class HoverTooltip extends Component<Sig> {
27
- hover = modifier<HoverModifierSig>(
28
- (element) => {
29
- element.addEventListener('mouseenter', this.showTooltip);
30
- element.addEventListener('mouseleave', this.hideTooltip);
31
- element.addEventListener('focus', this.showTooltip);
32
- element.addEventListener('blur', this.hideTooltip);
33
- return () => {
34
- element.removeEventListener('mouseenter', this.showTooltip);
35
- element.removeEventListener('mouseleave', this.hideTooltip);
36
- element.removeEventListener('focus', this.showTooltip);
37
- element.removeEventListener('blur', this.hideTooltip);
38
- };
39
- },
40
- { eager: false },
41
- );
27
+ hover = modifier<HoverModifierSig>((element) => {
28
+ element.addEventListener('mouseenter', this.showTooltip);
29
+ element.addEventListener('mouseleave', this.hideTooltip);
30
+ element.addEventListener('focus', this.showTooltip);
31
+ element.addEventListener('blur', this.hideTooltip);
32
+ return () => {
33
+ element.removeEventListener('mouseenter', this.showTooltip);
34
+ element.removeEventListener('mouseleave', this.hideTooltip);
35
+ element.removeEventListener('focus', this.showTooltip);
36
+ element.removeEventListener('blur', this.hideTooltip);
37
+ };
38
+ });
42
39
  @tracked tooltipOpen = false;
43
40
 
44
41
  get placement(): Placement | undefined {
@@ -56,7 +53,7 @@ export default class HoverTooltip extends Component<Sig> {
56
53
  <Velcro @placement={{this.placement}} as |velcro|>
57
54
  {{#let velcro.loop as |loop|}}
58
55
  {{yield
59
- (hash velcroHook=velcro.hook handleHover=(modifier this.hover))
56
+ (hash velcroHook=velcro.hook handleHover=this.hover)
60
57
  to='hover'
61
58
  }}
62
59
  {{#if this.tooltipOpen}}
@@ -53,31 +53,33 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
53
53
  },
54
54
  body: JSON.stringify({
55
55
  query: `
56
- PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
57
- PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
56
+ PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
57
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
58
58
  PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
59
59
  PREFIX foaf: <http://xmlns.com/foaf/0.1/>
60
60
  PREFIX persoon: <http://data.vlaanderen.be/ns/persoon#>
61
61
  PREFIX org: <http://www.w3.org/ns/org#>
62
62
  PREFIX regorg: <https://www.w3.org/ns/regorg#>
63
- SELECT DISTINCT ?mandatee ?person ?firstName ?lastName ?statusLabel ?fractieLabel ?roleLabel WHERE {
63
+ SELECT DISTINCT ?mandatee ?person ?firstName ?lastName ?statusLabel ?fractieLabel ?roleLabel WHERE {
64
64
  ?mandatee a mandaat:Mandataris;
65
65
  org:holds ?mandaat;
66
66
  mandaat:status ?status;
67
- mandaat:isBestuurlijkeAliasVan ?person;
68
- org:hasMembership ?membership.
67
+ mandaat:isBestuurlijkeAliasVan ?person.
69
68
  ?person foaf:familyName ?lastName;
70
69
  persoon:gebruikteVoornaam ?firstName.
71
70
  ?status skos:prefLabel ?statusLabel.
72
- ?membership org:organisation ?fractie.
73
- ?fractie regorg:legalName ?fractieLabel.
74
71
  ?mandaat org:role ?role.
75
72
  ?role skos:prefLabel ?roleLabel.
76
73
  OPTIONAL {
77
74
  ?mandatee mandaat:einde ?endDate
78
75
  }
76
+ OPTIONAL {
77
+ ?mandatee org:hasMembership ?membership.
78
+ ?membership org:organisation ?fractie.
79
+ ?fractie regorg:legalName ?fractieLabel.
80
+ }
79
81
  filter (!bound(?endDate) || ?endDate > now()).
80
- }
82
+ }
81
83
  `,
82
84
  }),
83
85
  });
@@ -349,10 +349,13 @@ export default class LocationPluginEditComponent extends Component<Signature> {
349
349
  <Group.Radio @value='place'>
350
350
  {{t 'location-plugin.types.place'}}
351
351
  </Group.Radio>
352
+ <Group.Radio @value='area'>
353
+ {{t 'location-plugin.types.area'}}
354
+ </Group.Radio>
352
355
  </AuRadioGroup>
353
356
  </fs.content>
354
357
  </AuFieldset>
355
- {{#if (eq @locationType 'place')}}
358
+ {{#unless (eq @locationType 'address')}}
356
359
  <AuFormRow>
357
360
  <AuLabel for='place-name'>
358
361
  {{t 'location-plugin.search.place-name.label'}}*
@@ -371,7 +374,7 @@ export default class LocationPluginEditComponent extends Component<Signature> {
371
374
  <p class='au-u-para-tiny au-u-margin-none'>
372
375
  {{t 'location-plugin.search.hint'}}
373
376
  </p>
374
- {{/if}}
377
+ {{/unless}}
375
378
  <AuFormRow>
376
379
  <AuLabel for='municipality-select'>
377
380
  {{t 'location-plugin.search.municipality.label'}}
@@ -16,11 +16,13 @@ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
16
16
 
17
17
  import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/address-helpers';
18
18
  import {
19
+ Area,
19
20
  convertWGS84CoordsToLambert,
20
21
  GeoPos,
21
22
  type GlobalCoordinates,
22
23
  Place,
23
24
  Point,
25
+ Polygon,
24
26
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
25
27
  import { replaceSelectionWithAddress } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/node-utils';
26
28
  import { type LocationPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/node';
@@ -30,6 +32,23 @@ import LocationMap, { type LocationType } from './map';
30
32
 
31
33
  export type CurrentLocation = Address | GlobalCoordinates | undefined;
32
34
 
35
+ function updateFromNode<T extends Address | Place | Area, R>(
36
+ Class: new (...args: unknown[]) => T,
37
+ extractFunc: (current: T) => R,
38
+ defaultValue?: R,
39
+ ) {
40
+ return (component: LocationPluginInsertComponent): R | undefined => {
41
+ const curLocation = component.selectedLocationNode?.value.attrs.value as
42
+ | Address
43
+ | Area
44
+ | Place
45
+ | null;
46
+ return curLocation instanceof Class
47
+ ? extractFunc(curLocation)
48
+ : defaultValue;
49
+ };
50
+ }
51
+
33
52
  interface Signature {
34
53
  Args: {
35
54
  controller: SayController;
@@ -46,43 +65,41 @@ export default class LocationPluginInsertComponent extends Component<Signature>
46
65
  @tracked isLoading = false;
47
66
 
48
67
  @trackedReset({
49
- memo: 'selectedLocationNode',
50
- update(component: LocationPluginInsertComponent) {
51
- const currentLocation = component.selectedLocationNode?.value.attrs
52
- .value as Address | Place | null;
53
- return currentLocation instanceof Address ? currentLocation : undefined;
54
- },
68
+ memo: 'modalOpen',
69
+ update: updateFromNode(Address, (address) => address),
55
70
  })
56
71
  addressToInsert?: Address;
57
72
 
58
73
  @trackedReset({
59
- memo: 'selectedLocationNode',
60
- update(component: LocationPluginInsertComponent) {
61
- const currentLocation = component.selectedLocationNode?.value.attrs
62
- .value as Address | Place | null;
63
- return currentLocation instanceof Place
64
- ? currentLocation.location.location
65
- : undefined;
66
- },
74
+ memo: 'modalOpen',
75
+ update: updateFromNode(Place, (place) => place.location.location),
67
76
  })
68
77
  savedLocation: GeoPos | undefined;
69
78
 
70
79
  @trackedReset({
71
- memo: 'selectedLocationNode',
80
+ memo: 'modalOpen',
72
81
  update(component: LocationPluginInsertComponent) {
73
- const currentLocation = component.selectedLocationNode?.value.attrs
74
- .value as Address | Place | null;
75
- return currentLocation instanceof Place ? currentLocation.name : '';
82
+ return (
83
+ updateFromNode(Place, (place) => place.name)(component) ??
84
+ updateFromNode(Area, (area) => area.name, '')(component)
85
+ );
76
86
  },
77
87
  })
78
88
  placeName: string = '';
79
89
 
80
90
  @trackedReset({
81
- memo: 'selectedLocationNode',
91
+ memo: 'modalOpen',
92
+ update: updateFromNode(Area, (area) => area.shape.locations),
93
+ })
94
+ savedArea: GeoPos[] | undefined;
95
+
96
+ @trackedReset({
97
+ memo: 'modalOpen',
82
98
  update(component: LocationPluginInsertComponent) {
83
- const currentLocation = component.selectedLocationNode?.value.attrs
84
- .value as Address | Place | null;
85
- return currentLocation instanceof Place ? 'place' : 'address';
99
+ return (
100
+ updateFromNode(Place, () => 'place')(component) ??
101
+ updateFromNode(Area, () => 'area', 'address')(component)
102
+ );
86
103
  },
87
104
  })
88
105
  locationType: LocationType = 'address';
@@ -121,14 +138,27 @@ export default class LocationPluginInsertComponent extends Component<Signature>
121
138
  }
122
139
 
123
140
  get canInsert() {
141
+ // trackedReset only actually resets any values if the values are used somewhere. Since we're
142
+ // not actually rendering anything inside the modal if this.modalOpen is false, we need to use
143
+ // these values somewhere outside of the modal contents block.
144
+ this.addressToInsert;
145
+ this.placeName;
146
+ this.savedLocation;
147
+ this.savedArea;
148
+ this.locationType;
124
149
  return !!this.controller.activeEditorView.props.nodeViews?.oslo_location;
125
150
  }
126
151
 
127
152
  get disableConfirm() {
128
- if (this.locationType === 'place') {
129
- return !this.selectedLocationNode || !this.placeName || !this.chosenPoint;
130
- } else {
131
- return !this.selectedLocationNode || !this.addressToInsert;
153
+ switch (this.locationType) {
154
+ case 'place':
155
+ return (
156
+ !this.selectedLocationNode || !this.placeName || !this.chosenPoint
157
+ );
158
+ case 'address':
159
+ return !this.selectedLocationNode || !this.addressToInsert;
160
+ default:
161
+ return !this.selectedLocationNode || !this.placeName || !this.savedArea;
132
162
  }
133
163
  }
134
164
 
@@ -139,9 +169,8 @@ export default class LocationPluginInsertComponent extends Component<Signature>
139
169
 
140
170
  @action
141
171
  setChosenPoint(point: GlobalCoordinates) {
142
- // Since we only use the global coordinates, we don't have to do a conversion to lambert here
143
172
  this.chosenPoint = {
144
- lambert: { x: 0, y: 0 },
173
+ lambert: convertWGS84CoordsToLambert(point),
145
174
  global: point,
146
175
  };
147
176
  }
@@ -153,6 +182,7 @@ export default class LocationPluginInsertComponent extends Component<Signature>
153
182
 
154
183
  @action
155
184
  closeModal() {
185
+ this.chosenPoint = undefined;
156
186
  this.modalOpen = false;
157
187
  }
158
188
 
@@ -179,41 +209,58 @@ export default class LocationPluginInsertComponent extends Component<Signature>
179
209
  this.addressToInsert = address;
180
210
  }
181
211
 
212
+ @action
213
+ setArea(vertices: GlobalCoordinates[]) {
214
+ this.savedArea = vertices.map((vertex) => ({
215
+ global: vertex,
216
+ lambert: convertWGS84CoordsToLambert(vertex),
217
+ }));
218
+ }
219
+
182
220
  @action
183
221
  confirmLocation() {
184
222
  if (this.selectedLocationNode) {
185
- let toInsert: Address | Place | undefined;
223
+ let toInsert: Address | Place | Area | undefined;
186
224
  const { pos } = this.selectedLocationNode;
187
225
  if (this.locationType === 'address' && this.addressToInsert) {
188
226
  toInsert = this.addressToInsert;
189
- this.controller.withTransaction((tr) => {
190
- return tr.setNodeAttribute(pos, 'value', toInsert);
191
- });
192
- this.modalOpen = false;
193
227
  } else if (
194
228
  this.locationType === 'place' &&
195
229
  this.chosenPoint?.global &&
196
230
  this.placeName
197
231
  ) {
198
- convertWGS84CoordsToLambert(this.chosenPoint.global).then((lambert) => {
199
- toInsert = new Place({
200
- uri: this.nodeContentsUtils.fallbackPlaceUri(),
201
- name: this.placeName,
202
- location: new Point({
203
- uri: this.nodeContentsUtils.fallbackPointUri(),
204
- location: {
205
- lambert,
206
- global: this.chosenPoint?.global,
207
- },
208
- }),
209
- });
210
- this.controller.withTransaction((tr) => {
211
- return tr.setNodeAttribute(pos, 'value', toInsert);
212
- });
213
- this.modalOpen = false;
214
- this.chosenPoint = undefined;
232
+ toInsert = new Place({
233
+ uri: this.nodeContentsUtils.fallbackPlaceUri(),
234
+ name: this.placeName,
235
+ location: new Point({
236
+ uri: this.nodeContentsUtils.fallbackGeometryUri(),
237
+ location: {
238
+ lambert: convertWGS84CoordsToLambert(this.chosenPoint.global),
239
+ global: this.chosenPoint?.global,
240
+ },
241
+ }),
242
+ });
243
+ this.chosenPoint = undefined;
244
+ } else if (
245
+ this.locationType === 'area' &&
246
+ this.savedArea &&
247
+ this.placeName
248
+ ) {
249
+ toInsert = new Area({
250
+ uri: this.nodeContentsUtils.fallbackPlaceUri(),
251
+ name: this.placeName,
252
+ shape: new Polygon({
253
+ uri: this.nodeContentsUtils.fallbackGeometryUri(),
254
+ locations: this.savedArea,
255
+ }),
215
256
  });
216
257
  }
258
+ if (toInsert) {
259
+ this.controller.withTransaction((tr) => {
260
+ return tr.setNodeAttribute(pos, 'value', toInsert);
261
+ });
262
+ this.modalOpen = false;
263
+ }
217
264
  }
218
265
  }
219
266
 
@@ -263,6 +310,8 @@ export default class LocationPluginInsertComponent extends Component<Signature>
263
310
  @location={{this.chosenPoint}}
264
311
  @existingLocation={{this.savedLocation}}
265
312
  @setLocation={{this.setChosenPoint}}
313
+ @existingArea={{this.savedArea}}
314
+ @setArea={{this.setArea}}
266
315
  />
267
316
  </div>
268
317
  </modal.Body>