@lblod/ember-rdfa-editor-lblod-plugins 25.2.0 → 25.2.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 (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/addon/components/location-plugin/nodeview.gts +16 -28
  3. package/addon/components/variable-plugin/address/nodeview.hbs +4 -18
  4. package/addon/components/variable-plugin/address/nodeview.ts +12 -23
  5. package/addon/components/variable-plugin/autofilled/insert.gts +3 -2
  6. package/addon/components/variable-plugin/codelist/insert.ts +1 -1
  7. package/addon/components/variable-plugin/date/nodeview.hbs +4 -12
  8. package/addon/components/variable-plugin/date/nodeview.ts +5 -23
  9. package/addon/components/variable-plugin/location/insert.ts +4 -2
  10. package/addon/components/variable-plugin/number/nodeview.hbs +4 -19
  11. package/addon/components/variable-plugin/number/nodeview.ts +12 -10
  12. package/addon/components/variable-plugin/person/nodeview.hbs +4 -18
  13. package/addon/components/variable-plugin/person/nodeview.ts +12 -19
  14. package/addon/components/variable-plugin/text/insert.ts +1 -1
  15. package/addon/components/variable-plugin/variable/nodeview.hbs +2 -8
  16. package/addon/components/variable-plugin/variable/nodeview.ts +16 -7
  17. package/addon/plugins/variable-plugin/variables/autofilled.ts +2 -2
  18. package/addon/plugins/variable-plugin/variables/location.ts +2 -3
  19. package/addon/utils/namespace.ts +4 -1
  20. package/app/styles/variable-plugin.scss +21 -26
  21. package/declarations/addon/components/location-plugin/nodeview.d.ts +2 -3
  22. package/declarations/addon/components/variable-plugin/address/nodeview.d.ts +2 -8
  23. package/declarations/addon/components/variable-plugin/date/nodeview.d.ts +2 -6
  24. package/declarations/addon/components/variable-plugin/number/nodeview.d.ts +2 -4
  25. package/declarations/addon/components/variable-plugin/person/nodeview.d.ts +2 -7
  26. package/declarations/addon/components/variable-plugin/variable/nodeview.d.ts +2 -2
  27. package/package.json +3 -3
  28. package/pnpm-lock.yaml +24 -17
  29. package/translations/en-US.yaml +5 -5
  30. package/translations/nl-BE.yaml +5 -5
  31. package/addon/components/variable-plugin/autofilled/nodeview.gts +0 -100
  32. package/addon/components/variable-plugin/location/nodeview.hbs +0 -24
  33. package/addon/components/variable-plugin/location/nodeview.ts +0 -46
  34. package/declarations/addon/components/variable-plugin/autofilled/nodeview.d.ts +0 -22
  35. package/declarations/addon/components/variable-plugin/location/nodeview.d.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 25.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Redesign variable pills
8
+
9
+ - [#497](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/497) [`2b4b401`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2b4b4011e3d66c23f232bf6690ca80a5b0a90298) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Bump ember-rdfa-editor to 10.7.3
10
+
3
11
  ## 25.2.0
4
12
 
5
13
  ### Minor Changes
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
2
2
  import { service } from '@ember/service';
3
3
  import { on } from '@ember/modifier';
4
4
  import IntlService from 'ember-intl/services/intl';
5
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
6
5
  import AuPill, {
7
6
  type AuPillSignature,
8
7
  } from '@appuniversum/ember-appuniversum/components/au-pill';
@@ -25,14 +24,6 @@ type Signature = {
25
24
  export default class AddressNodeviewComponent extends Component<Signature> {
26
25
  @service declare intl: IntlService;
27
26
 
28
- get translations() {
29
- return {
30
- placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
31
- locale: this.args.controller.documentLanguage,
32
- }),
33
- };
34
- }
35
-
36
27
  get address() {
37
28
  return this.args.node.attrs.value as Address | null;
38
29
  }
@@ -42,26 +33,23 @@ export default class AddressNodeviewComponent extends Component<Signature> {
42
33
  return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
43
34
  }
44
35
 
36
+ get filled() {
37
+ return !!this.address;
38
+ }
39
+
40
+ get content() {
41
+ if (this.filled) {
42
+ return this.address?.formatted;
43
+ } else {
44
+ return this.label;
45
+ }
46
+ }
47
+
45
48
  <template>
46
- <AuPill
47
- class='variable atomic'
48
- @icon={{PencilIcon}}
49
- @iconAlignment='right'
50
- ...attributes
51
- {{on 'click' @selectNode}}
52
- >
53
- {{#if this.address}}
54
- {{this.address.formatted}}
55
- {{else}}
56
- <span class='mark-highlight-manual'>
57
- {{this.translations.placeholder}}
58
- </span>
59
- {{/if}}
60
- {{#if this.label}}
61
- <span class='label'>
62
- ({{this.label}})
63
- </span>
64
- {{/if}}
49
+ <AuPill class='say-pill atomic' ...attributes {{on 'click' @selectNode}}>
50
+ <span class='{{unless this.filled "unfilled-variable"}}'>
51
+ {{this.content}}
52
+ </span>
65
53
  </AuPill>
66
54
  </template>
67
55
  }
@@ -1,20 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{#if this.address}}
9
- {{this.address.formatted}}
10
- {{else}}
11
- <span class='mark-highlight-manual'>
12
- {{this.translations.placeholder}}
13
- </span>
14
- {{/if}}
15
- {{#if this.label}}
16
- <span class='label'>
17
- ({{this.label}})
18
- </span>
19
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.content}}
5
+ </span>
20
6
  </AuPill>
@@ -1,7 +1,4 @@
1
1
  import Component from '@glimmer/component';
2
- import { service } from '@ember/service';
3
- import IntlService from 'ember-intl/services/intl';
4
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
5
2
 
6
3
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
7
4
  import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/address-helpers';
@@ -15,26 +12,6 @@ type Args = {
15
12
  };
16
13
 
17
14
  export default class AddressNodeviewComponent extends Component<Args> {
18
- PencilIcon = PencilIcon;
19
-
20
- @service declare intl: IntlService;
21
-
22
- get controller() {
23
- return this.args.controller;
24
- }
25
-
26
- get documentLanguage() {
27
- return this.controller.documentLanguage;
28
- }
29
-
30
- get translations() {
31
- return {
32
- placeholder: this.intl.t('editor-plugins.address.nodeview.placeholder', {
33
- locale: this.documentLanguage,
34
- }),
35
- };
36
- }
37
-
38
15
  get node() {
39
16
  return this.args.node;
40
17
  }
@@ -47,4 +24,16 @@ export default class AddressNodeviewComponent extends Component<Args> {
47
24
  if (this.address) return '';
48
25
  return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
49
26
  }
27
+
28
+ get filled() {
29
+ return !!this.address;
30
+ }
31
+
32
+ get content() {
33
+ if (this.filled) {
34
+ return this.address?.formatted;
35
+ } else {
36
+ return this.label;
37
+ }
38
+ }
50
39
  }
@@ -68,7 +68,8 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
68
68
  locale: this.documentLanguage,
69
69
  });
70
70
 
71
- const label = this.label != '' ? this.label : placeholder;
71
+ const label =
72
+ this.label != '' ? this.label : this.autofillKey || placeholder;
72
73
  const node = this.schema.nodes.autofilled_variable.create(
73
74
  {
74
75
  subject: mappingSubject,
@@ -101,7 +102,7 @@ export default class AutoFilledVariableInsertComponent extends Component<Args> {
101
102
  },
102
103
 
103
104
  this.schema.node('placeholder', {
104
- placeholderText: `Autofill ${this.autofillKey}`,
105
+ placeholderText: label,
105
106
  }),
106
107
  );
107
108
  this.label = '';
@@ -137,7 +137,7 @@ export default class CodelistInsertComponent extends Component<Args> {
137
137
  ],
138
138
  },
139
139
  this.schema.node('placeholder', {
140
- placeholderText: this.selectedCodelist?.label,
140
+ placeholderText: label,
141
141
  }),
142
142
  );
143
143
 
@@ -1,14 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{this.humanReadableDate}}
9
- {{#if this.label}}
10
- <span class='label'>
11
- ({{this.label}})
12
- </span>
13
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.humanReadableDate}}
5
+ </span>
14
6
  </AuPill>
@@ -5,15 +5,12 @@ import {
5
5
  SayController,
6
6
  SayView,
7
7
  } from '@lblod/ember-rdfa-editor';
8
- import IntlService from 'ember-intl/services/intl';
9
- import { service } from '@ember/service';
10
8
  import {
11
9
  formatDate,
12
10
  validateDateFormat,
13
11
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
14
12
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
15
13
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
16
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
17
14
 
18
15
  type Args = {
19
16
  getPos: () => number | undefined;
@@ -26,16 +23,10 @@ type Args = {
26
23
  };
27
24
 
28
25
  export default class DateNodeviewComponent extends Component<Args> {
29
- PencilIcon = PencilIcon;
30
-
31
- @service declare intl: IntlService;
32
-
33
- get controller() {
34
- return this.args.controller;
35
- }
36
-
37
- get documentLanguage() {
38
- return this.controller.documentLanguage;
26
+ get filled() {
27
+ const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
28
+ ?.object.value;
29
+ return !!value;
39
30
  }
40
31
 
41
32
  get humanReadableDate() {
@@ -49,20 +40,11 @@ export default class DateNodeviewComponent extends Component<Args> {
49
40
  return 'Ongeldig formaat';
50
41
  }
51
42
  } else {
52
- return (this.args.node.attrs.onlyDate as boolean)
53
- ? this.intl.t('date-plugin.insert.date', {
54
- locale: this.documentLanguage,
55
- })
56
- : this.intl.t('date-plugin.insert.datetime', {
57
- locale: this.documentLanguage,
58
- });
43
+ return this.label;
59
44
  }
60
45
  }
61
46
 
62
47
  get label() {
63
- const value = getOutgoingTriple(this.args.node.attrs, EXT('content'))
64
- ?.object.value;
65
- if (value) return '';
66
48
  return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
67
49
  }
68
50
  }
@@ -51,15 +51,17 @@ export default class LocationInsertComponent extends Component<Args> {
51
51
  locale: this.documentLanguage,
52
52
  });
53
53
 
54
+ const label = this.label ?? placeholder;
55
+
54
56
  const node = this.schema.nodes.location.create(
55
57
  {
56
58
  mappingResource,
57
59
  variableInstance,
58
- label: this.label ?? placeholder,
60
+ label: label,
59
61
  source: this.endpoint,
60
62
  },
61
63
  this.schema.node('placeholder', {
62
- placeholderText: placeholder,
64
+ placeholderText: label,
63
65
  }),
64
66
  );
65
67
 
@@ -4,25 +4,10 @@
4
4
  @offsetOptions={{hash mainAxis=3}}
5
5
  as |velcro|
6
6
  >
7
- <AuPill
8
- @icon={{this.PencilIcon}}
9
- @iconAlignment='right'
10
- class='variable atomic'
11
- {{velcro.hook}}
12
- {{on 'click' @selectNode}}
13
- >
14
- {{#if this.formattedNumber}}
15
- {{this.formattedNumber}}
16
- {{else}}
17
- <span class='mark-highlight-manual'>
18
- {{this.translations.placeholder}}
19
- </span>
20
- {{/if}}
21
- {{#if this.label}}
22
- <span class='label'>
23
- ({{this.label}})
24
- </span>
25
- {{/if}}
7
+ <AuPill class='say-pill atomic' {{velcro.hook}} {{on 'click' @selectNode}}>
8
+ <span class='{{unless this.filled "unfilled-variable"}}'>
9
+ {{this.content}}
10
+ </span>
26
11
  </AuPill>
27
12
  {{#if this.selected}}
28
13
  <div class='say-tooltip say-number-tooltip' {{velcro.loop}}>
@@ -17,7 +17,6 @@ import { isNumber } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
17
17
  import { numberToWords } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/number-to-words';
18
18
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
19
19
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
20
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
21
20
 
22
21
  type Args = {
23
22
  getPos: () => number | undefined;
@@ -31,7 +30,6 @@ type Args = {
31
30
  };
32
31
 
33
32
  export default class NumberNodeviewComponent extends Component<Args> {
34
- PencilIcon = PencilIcon;
35
33
  Velcro = Velcro;
36
34
 
37
35
  @localCopy('number', '') declare inputNumber: string;
@@ -52,14 +50,6 @@ export default class NumberNodeviewComponent extends Component<Args> {
52
50
  return this.controller.documentLanguage;
53
51
  }
54
52
 
55
- get translations() {
56
- return {
57
- placeholder: this.intl.t('variable.number.placeholder', {
58
- locale: this.documentLanguage,
59
- }),
60
- };
61
- }
62
-
63
53
  get node() {
64
54
  return this.args.node;
65
55
  }
@@ -80,6 +70,18 @@ export default class NumberNodeviewComponent extends Component<Args> {
80
70
  }
81
71
  }
82
72
 
73
+ get filled() {
74
+ return !!this.formattedNumber;
75
+ }
76
+
77
+ get content() {
78
+ if (this.filled) {
79
+ return this.formattedNumber;
80
+ } else {
81
+ return this.label;
82
+ }
83
+ }
84
+
83
85
  get selected() {
84
86
  return this.args.selected;
85
87
  }
@@ -1,20 +1,6 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable atomic'
6
- {{on 'click' @selectNode}}
7
- >
8
- {{#if this.mandatee}}
9
- {{this.mandatee.fullName}}
10
- {{else}}
11
- <span class='mark-highlight-manual'>
12
- {{this.translations.placeholder}}
13
- </span>
14
- {{/if}}
15
- {{#if this.label}}
16
- <span class='label'>
17
- ({{this.label}})
18
- </span>
19
- {{/if}}
2
+ <AuPill class='say-pill atomic' {{on 'click' @selectNode}}>
3
+ <span class='{{unless this.filled "unfilled-variable"}}'>
4
+ {{this.content}}
5
+ </span>
20
6
  </AuPill>
@@ -1,7 +1,4 @@
1
1
  import Component from '@glimmer/component';
2
- import { service } from '@ember/service';
3
- import IntlService from 'ember-intl/services/intl';
4
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
5
2
 
6
3
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
7
4
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
@@ -15,26 +12,10 @@ type Args = {
15
12
  };
16
13
 
17
14
  export default class PersonNodeviewComponent extends Component<Args> {
18
- PencilIcon = PencilIcon;
19
-
20
- @service declare intl: IntlService;
21
-
22
15
  get controller() {
23
16
  return this.args.controller;
24
17
  }
25
18
 
26
- get documentLanguage() {
27
- return this.controller.documentLanguage;
28
- }
29
-
30
- get translations() {
31
- return {
32
- placeholder: this.intl.t('variable-plugin.person.nodeview-placeholder', {
33
- locale: this.documentLanguage,
34
- }),
35
- };
36
- }
37
-
38
19
  get node() {
39
20
  return this.args.node;
40
21
  }
@@ -47,4 +28,16 @@ export default class PersonNodeviewComponent extends Component<Args> {
47
28
  if (this.mandatee) return '';
48
29
  return getOutgoingTriple(this.node.attrs, EXT('label'))?.object.value;
49
30
  }
31
+
32
+ get filled() {
33
+ return !!this.mandatee;
34
+ }
35
+
36
+ get content() {
37
+ if (this.filled) {
38
+ return this.mandatee?.fullName;
39
+ } else {
40
+ return this.label;
41
+ }
42
+ }
50
43
  }
@@ -78,7 +78,7 @@ export default class TextVariableInsertComponent extends Component<Args> {
78
78
  ],
79
79
  },
80
80
  this.schema.node('placeholder', {
81
- placeholderText: 'text',
81
+ placeholderText: label,
82
82
  }),
83
83
  );
84
84
 
@@ -1,9 +1,8 @@
1
1
  {{! @glint-nocheck: not typesafe yet }}
2
2
  <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable'
3
+ class='say-pill'
6
4
  {{on 'click' this.onClick}}
5
+ {{on 'focusout' this.resetVariable}}
7
6
  >
8
7
  <EmberNode::EmbeddedEditor
9
8
  @controller={{@controller}}
@@ -17,9 +16,4 @@
17
16
  @decorations={{@decorations}}
18
17
  @contentDecorations={{@contentDecorations}}
19
18
  />
20
- {{#if this.label}}
21
- <span class='label'>
22
- ({{this.label}})
23
- </span>
24
- {{/if}}
25
19
  </AuPill>
@@ -3,15 +3,12 @@ import { NodeSelection, ProsePlugin, SayView } from '@lblod/ember-rdfa-editor';
3
3
  import { editableNodePlugin } from '@lblod/ember-rdfa-editor/plugins/editable-node';
4
4
  import { tracked } from '@glimmer/tracking';
5
5
  import { action } from '@ember/object';
6
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
7
6
 
8
7
  import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
9
8
  import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
10
9
  import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
11
10
 
12
11
  export default class VariableNodeViewComponent extends Component<EmberNodeArgs> {
13
- PencilIcon = PencilIcon;
14
-
15
12
  @tracked innerView?: SayView;
16
13
 
17
14
  get plugins(): ProsePlugin[] {
@@ -39,11 +36,23 @@ export default class VariableNodeViewComponent extends Component<EmberNodeArgs>
39
36
  initEditor(view: SayView) {
40
37
  this.innerView = view;
41
38
  }
42
-
39
+ @action
40
+ resetVariable() {
41
+ if (this.innerView && this.innerView.state.doc.childCount === 0) {
42
+ const tr = this.innerView.state.tr;
43
+ const placeholderNode = this.innerView.state.schema.node('placeholder', {
44
+ placeholderText: this.label,
45
+ });
46
+ tr.insert(0, placeholderNode);
47
+ this.innerView?.dispatch(tr);
48
+ }
49
+ }
43
50
  get label() {
44
- if (this.innerView?.state.doc.firstChild?.type.name !== 'placeholder') {
45
- return '';
51
+ const labelTriple = getOutgoingTriple(this.args.node.attrs, EXT('label'));
52
+ if (labelTriple) {
53
+ return labelTriple.object.value;
54
+ } else {
55
+ return this.args.node.attrs.label;
46
56
  }
47
- return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
48
57
  }
49
58
  }
@@ -22,7 +22,7 @@ import {
22
22
  parseVariableInstance,
23
23
  parseVariableType,
24
24
  } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/variable-attribute-parsers';
25
- import AutofilledNodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/autofilled/nodeview';
25
+ import NodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable/nodeview';
26
26
  import type { ComponentLike } from '@glint/template';
27
27
  import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
28
28
  import { renderRdfaAware } from '@lblod/ember-rdfa-editor/core/schema';
@@ -139,7 +139,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
139
139
 
140
140
  const emberNodeConfig: EmberNodeConfig = {
141
141
  name: 'autofilled-variable',
142
- component: AutofilledNodeViewComponent as unknown as ComponentLike,
142
+ component: NodeViewComponent as unknown as ComponentLike,
143
143
  inline: true,
144
144
  group: 'inline variable',
145
145
  content: 'inline*',
@@ -20,7 +20,7 @@ import {
20
20
  typeSpan,
21
21
  } from '../utils/dom-constructors';
22
22
  import { contentSpan } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-output-spec-helpers';
23
- import LocationNodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/location/nodeview';
23
+ import NodeViewComponent from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/variable/nodeview';
24
24
  import type { ComponentLike } from '@glint/template';
25
25
 
26
26
  const CONTENT_SELECTOR = `span[property~='${EXT('content').prefixed}'],
@@ -35,7 +35,6 @@ const parseDOM = [
35
35
  node.querySelector(CONTENT_SELECTOR) &&
36
36
  parseVariableType(node) === 'location'
37
37
  ) {
38
- console.log('Parse location: ', node);
39
38
  const mappingResource = node.getAttribute('resource');
40
39
  if (!mappingResource) {
41
40
  return false;
@@ -74,7 +73,7 @@ const toDOM = (node: PNode): DOMOutputSpec => {
74
73
 
75
74
  const emberNodeConfig: EmberNodeConfig = {
76
75
  name: 'location',
77
- component: LocationNodeViewComponent as unknown as ComponentLike,
76
+ component: NodeViewComponent as unknown as ComponentLike,
78
77
  inline: true,
79
78
  group: 'inline variable',
80
79
  content: 'inline*',
@@ -68,7 +68,10 @@ export function hasOutgoingNamedNodeTriple(
68
68
  });
69
69
  }
70
70
 
71
- export function getOutgoingTriple(rdfaAttrs: Attrs, predicate: Resource) {
71
+ export function getOutgoingTriple(
72
+ rdfaAttrs: Attrs,
73
+ predicate: Resource,
74
+ ): Option<OutgoingTriple> {
72
75
  return (isRdfaAttrs(rdfaAttrs) &&
73
76
  rdfaAttrs.rdfaNodeType === 'resource' &&
74
77
  rdfaAttrs.properties.find((prop) =>
@@ -49,39 +49,34 @@
49
49
  }
50
50
  }
51
51
 
52
+ .ember-node.say-active:has(> .say-pill) {
53
+ outline: none;
54
+ }
55
+
52
56
  .ember-node {
53
57
  white-space: normal !important;
54
- .variable {
55
- min-height: 30px;
56
- [contenteditable] {
57
- white-space: break-spaces;
58
- word-break: break-all;
59
- word-wrap: break-word;
60
- outline: 0px;
61
- padding: 2px;
62
- }
63
- .label {
64
- font-size: var(--au-tiny);
65
- color: var(--au-blue-700);
66
- user-select: none;
67
- margin: 0.3rem;
68
- }
69
- .au-c-icon {
70
- margin: 0;
58
+ .say-pill [contenteditable].mark-highlight-manual {
59
+ color: var(--au-orange-700);
60
+ &.ProseMirror-selectednode {
61
+ background-color: var(--au-blue-300);
62
+ outline: none;
71
63
  }
72
64
  }
65
+ .unfilled-variable {
66
+ color: var(--au-orange-700);
67
+ background-color: var(--au-orange-300);
68
+ font-style: italic;
69
+ line-height: 1.2rem;
70
+ padding: 0.3rem;
71
+ }
73
72
  }
74
73
 
75
74
  .ember-node.ProseMirror-selectednode {
76
- > .variable {
77
- &.atomic {
78
- background-color: var(--au-blue-200);
79
- }
80
- outline: 2px solid var(--au-blue-500);
81
-
82
- ::selection {
83
- background-color: var(--au-blue-300);
84
- }
75
+ > .say-pill.atomic {
76
+ background-color: var(--au-blue-200);
77
+ }
78
+ .unfilled-variable {
79
+ background-color: var(--au-blue-200);
85
80
  }
86
81
  }
87
82
 
@@ -14,10 +14,9 @@ type Signature = {
14
14
  };
15
15
  export default class AddressNodeviewComponent extends Component<Signature> {
16
16
  intl: IntlService;
17
- get translations(): {
18
- placeholder: string;
19
- };
20
17
  get address(): Address | null;
21
18
  get label(): string | undefined;
19
+ get filled(): boolean;
20
+ get content(): string | undefined;
22
21
  }
23
22
  export {};
@@ -1,5 +1,4 @@
1
1
  import Component from '@glimmer/component';
2
- import IntlService from 'ember-intl/services/intl';
3
2
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
4
3
  import { Address } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/address-helpers';
5
4
  type Args = {
@@ -8,15 +7,10 @@ type Args = {
8
7
  controller: SayController;
9
8
  };
10
9
  export default class AddressNodeviewComponent extends Component<Args> {
11
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
12
- intl: IntlService;
13
- get controller(): SayController;
14
- get documentLanguage(): string;
15
- get translations(): {
16
- placeholder: string;
17
- };
18
10
  get node(): PNode;
19
11
  get address(): Address | null;
20
12
  get label(): string | undefined;
13
+ get filled(): boolean;
14
+ get content(): string | undefined;
21
15
  }
22
16
  export {};
@@ -1,6 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
2
  import { DecorationSource, PNode, SayController, SayView } from '@lblod/ember-rdfa-editor';
3
- import IntlService from 'ember-intl/services/intl';
4
3
  type Args = {
5
4
  getPos: () => number | undefined;
6
5
  node: PNode;
@@ -11,11 +10,8 @@ type Args = {
11
10
  contentDecorations?: DecorationSource;
12
11
  };
13
12
  export default class DateNodeviewComponent extends Component<Args> {
14
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
15
- intl: IntlService;
16
- get controller(): SayController;
17
- get documentLanguage(): string;
18
- get humanReadableDate(): string;
13
+ get filled(): boolean;
14
+ get humanReadableDate(): string | undefined;
19
15
  get label(): string | undefined;
20
16
  }
21
17
  export {};
@@ -13,7 +13,6 @@ type Args = {
13
13
  selectNode: () => void;
14
14
  };
15
15
  export default class NumberNodeviewComponent extends Component<Args> {
16
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
17
16
  Velcro: typeof Velcro;
18
17
  inputNumber: string;
19
18
  writtenNumber: boolean;
@@ -22,12 +21,11 @@ export default class NumberNodeviewComponent extends Component<Args> {
22
21
  focus(element: HTMLInputElement): void;
23
22
  get controller(): SayController;
24
23
  get documentLanguage(): string;
25
- get translations(): {
26
- placeholder: string;
27
- };
28
24
  get node(): PNode;
29
25
  get number(): string | null | undefined;
30
26
  get formattedNumber(): string | null | undefined;
27
+ get filled(): boolean;
28
+ get content(): string | null | undefined;
31
29
  get selected(): boolean;
32
30
  get minValue(): number;
33
31
  get maxValue(): number;
@@ -1,5 +1,4 @@
1
1
  import Component from '@glimmer/component';
2
- import IntlService from 'ember-intl/services/intl';
3
2
  import { PNode, SayController } from '@lblod/ember-rdfa-editor';
4
3
  import Mandatee from '@lblod/ember-rdfa-editor-lblod-plugins/models/mandatee';
5
4
  type Args = {
@@ -8,15 +7,11 @@ type Args = {
8
7
  controller: SayController;
9
8
  };
10
9
  export default class PersonNodeviewComponent extends Component<Args> {
11
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
12
- intl: IntlService;
13
10
  get controller(): SayController;
14
- get documentLanguage(): string;
15
- get translations(): {
16
- placeholder: string;
17
- };
18
11
  get node(): PNode;
19
12
  get mandatee(): Mandatee | null;
20
13
  get label(): string | undefined;
14
+ get filled(): boolean;
15
+ get content(): string | undefined;
21
16
  }
22
17
  export {};
@@ -2,10 +2,10 @@ import Component from '@glimmer/component';
2
2
  import { ProsePlugin, SayView } from '@lblod/ember-rdfa-editor';
3
3
  import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
4
4
  export default class VariableNodeViewComponent extends Component<EmberNodeArgs> {
5
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
6
5
  innerView?: SayView;
7
6
  get plugins(): ProsePlugin[];
8
7
  onClick(): void;
9
8
  initEditor(view: SayView): void;
10
- get label(): string | undefined;
9
+ resetVariable(): void;
10
+ get label(): any;
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "25.2.0",
3
+ "version": "25.2.1",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -105,7 +105,7 @@
105
105
  "@glint/template": "^1.4.0",
106
106
  "@graphy/content.ttl.write": "^4.3.7",
107
107
  "@graphy/memory.dataset.fast": "4.3.3",
108
- "@lblod/ember-rdfa-editor": "10.7.2",
108
+ "@lblod/ember-rdfa-editor": "10.7.3",
109
109
  "@rdfjs/types": "^1.1.0",
110
110
  "@release-it/keep-a-changelog": "^4.0.0",
111
111
  "@tsconfig/ember": "^3.0.8",
@@ -192,7 +192,7 @@
192
192
  "@appuniversum/ember-appuniversum": "^3.4.1",
193
193
  "@ember/string": "3.x",
194
194
  "@glint/template": "^1.4.0",
195
- "@lblod/ember-rdfa-editor": "^10.7.2",
195
+ "@lblod/ember-rdfa-editor": "10.7.3",
196
196
  "ember-concurrency": "^3.1.0",
197
197
  "ember-element-helper": "^0.8.6",
198
198
  "ember-intl": "^7.0.0",
package/pnpm-lock.yaml CHANGED
@@ -169,8 +169,8 @@ importers:
169
169
  specifier: 4.3.3
170
170
  version: 4.3.3
171
171
  '@lblod/ember-rdfa-editor':
172
- specifier: 10.7.2
173
- version: 10.7.2(2ef3gpurqxbttnmniw6grhzpuy)
172
+ specifier: 10.7.3
173
+ version: 10.7.3(2ef3gpurqxbttnmniw6grhzpuy)
174
174
  '@rdfjs/types':
175
175
  specifier: ^1.1.0
176
176
  version: 1.1.0
@@ -1595,8 +1595,8 @@ packages:
1595
1595
  '@jridgewell/trace-mapping@0.3.25':
1596
1596
  resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
1597
1597
 
1598
- '@lblod/ember-rdfa-editor@10.7.2':
1599
- resolution: {integrity: sha512-PSkYAAFqhl7+wpPtSlX0cO4sFG8Gk+/Fic1ORuMr2hltYUx0BIZB/3JeTmnr0UAiUAmMZG7XXM1nDbcTPnlfYg==}
1598
+ '@lblod/ember-rdfa-editor@10.7.3':
1599
+ resolution: {integrity: sha512-8VsatXPiST7AM4Ruf/DT0BvX5gotcL5DSTP9HZGmxZQV7QIp3XQyiey7zwGHaD0c/ZHneq/h+vbvg0/r08RIlw==}
1600
1600
  engines: {node: 16.* || 18.* || >= 20}
1601
1601
  peerDependencies:
1602
1602
  '@appuniversum/ember-appuniversum': ^3.4.2
@@ -4974,7 +4974,7 @@ packages:
4974
4974
  resolution: {integrity: sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==}
4975
4975
  engines: {node: '>= 4.0'}
4976
4976
  os: [darwin]
4977
- deprecated: Upgrade to fsevents v2 to mitigate potential security issues
4977
+ deprecated: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
4978
4978
 
4979
4979
  fsevents@2.3.3:
4980
4980
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
@@ -7276,8 +7276,8 @@ packages:
7276
7276
  property-expr@2.0.6:
7277
7277
  resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==}
7278
7278
 
7279
- prosemirror-commands@1.6.0:
7280
- resolution: {integrity: sha512-xn1U/g36OqXn2tn5nGmvnnimAj/g1pUx2ypJJIe8WkVX83WyJVC5LTARaxZa2AtQRwntu9Jc5zXs9gL9svp/mg==}
7279
+ prosemirror-commands@1.6.2:
7280
+ resolution: {integrity: sha512-0nDHH++qcf/BuPLYvmqZTUUsPJUCPBUXt0J1ErTcDIS369CTp773itzLGIgIXG4LJXOlwYCr44+Mh4ii6MP1QA==}
7281
7281
 
7282
7282
  prosemirror-dev-tools@4.1.0:
7283
7283
  resolution: {integrity: sha512-TqMyXLiY8EUoq4f4LV+8dQVuRejwGfeOJdJWjrHNXR9ttKy3MVYBCqmiu3CDULgjv8gtLsqoZY6+ab6BZRmr1g==}
@@ -7310,6 +7310,9 @@ packages:
7310
7310
  prosemirror-state@1.4.3:
7311
7311
  resolution: {integrity: sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==}
7312
7312
 
7313
+ prosemirror-transform@1.10.2:
7314
+ resolution: {integrity: sha512-2iUq0wv2iRoJO/zj5mv8uDUriOHWzXRnOTVgCzSXnktS/2iQRa3UUQwVlkBlYZFtygw6Nh1+X4mGqoYBINn5KQ==}
7315
+
7313
7316
  prosemirror-transform@1.9.0:
7314
7317
  resolution: {integrity: sha512-5UXkr1LIRx3jmpXXNKDhv8OyAOeLTGuXNwdVfg8x27uASna/wQkr9p6fD3eupGOi4PLJfbezxTyi/7fSJypXHg==}
7315
7318
 
@@ -10735,7 +10738,7 @@ snapshots:
10735
10738
  '@jridgewell/resolve-uri': 3.1.2
10736
10739
  '@jridgewell/sourcemap-codec': 1.4.15
10737
10740
 
10738
- '@lblod/ember-rdfa-editor@10.7.2(2ef3gpurqxbttnmniw6grhzpuy)':
10741
+ '@lblod/ember-rdfa-editor@10.7.3(2ef3gpurqxbttnmniw6grhzpuy)':
10739
10742
  dependencies:
10740
10743
  '@appuniversum/ember-appuniversum': 3.4.2(yenc6o4wruytt4u2jbwlbsqcl4)
10741
10744
  '@babel/core': 7.24.7
@@ -10778,7 +10781,7 @@ snapshots:
10778
10781
  linkifyjs: 4.1.3
10779
10782
  mdn-polyfills: 5.20.0
10780
10783
  process: 0.11.10
10781
- prosemirror-commands: 1.6.0
10784
+ prosemirror-commands: 1.6.2
10782
10785
  prosemirror-dropcursor: 1.8.1
10783
10786
  prosemirror-history: 1.4.1
10784
10787
  prosemirror-inputrules: 1.4.0
@@ -10787,7 +10790,7 @@ snapshots:
10787
10790
  prosemirror-schema-basic: 1.2.3
10788
10791
  prosemirror-schema-list: 1.4.1
10789
10792
  prosemirror-state: 1.4.3
10790
- prosemirror-transform: 1.9.0
10793
+ prosemirror-transform: 1.10.2
10791
10794
  prosemirror-view: 1.33.8
10792
10795
  rdf-data-factory: 1.1.2
10793
10796
  relative-to-absolute-iri: 1.0.7
@@ -11181,7 +11184,7 @@ snapshots:
11181
11184
  prosemirror-keymap: 1.2.2
11182
11185
  prosemirror-model: 1.21.3
11183
11186
  prosemirror-state: 1.4.3
11184
- prosemirror-transform: 1.9.0
11187
+ prosemirror-transform: 1.10.2
11185
11188
  prosemirror-view: 1.33.8
11186
11189
 
11187
11190
  '@simple-dom/document@1.4.0':
@@ -18266,11 +18269,11 @@ snapshots:
18266
18269
 
18267
18270
  property-expr@2.0.6: {}
18268
18271
 
18269
- prosemirror-commands@1.6.0:
18272
+ prosemirror-commands@1.6.2:
18270
18273
  dependencies:
18271
18274
  prosemirror-model: 1.21.3
18272
18275
  prosemirror-state: 1.4.3
18273
- prosemirror-transform: 1.9.0
18276
+ prosemirror-transform: 1.10.2
18274
18277
 
18275
18278
  prosemirror-dev-tools@4.1.0(@babel/core@7.24.7)(@babel/template@7.24.7)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
18276
18279
  dependencies:
@@ -18303,20 +18306,20 @@ snapshots:
18303
18306
  prosemirror-dropcursor@1.8.1:
18304
18307
  dependencies:
18305
18308
  prosemirror-state: 1.4.3
18306
- prosemirror-transform: 1.9.0
18309
+ prosemirror-transform: 1.10.2
18307
18310
  prosemirror-view: 1.33.8
18308
18311
 
18309
18312
  prosemirror-history@1.4.1:
18310
18313
  dependencies:
18311
18314
  prosemirror-state: 1.4.3
18312
- prosemirror-transform: 1.9.0
18315
+ prosemirror-transform: 1.10.2
18313
18316
  prosemirror-view: 1.33.8
18314
18317
  rope-sequence: 1.3.4
18315
18318
 
18316
18319
  prosemirror-inputrules@1.4.0:
18317
18320
  dependencies:
18318
18321
  prosemirror-state: 1.4.3
18319
- prosemirror-transform: 1.9.0
18322
+ prosemirror-transform: 1.10.2
18320
18323
 
18321
18324
  prosemirror-keymap@1.2.2:
18322
18325
  dependencies:
@@ -18335,7 +18338,7 @@ snapshots:
18335
18338
  dependencies:
18336
18339
  prosemirror-model: 1.21.3
18337
18340
  prosemirror-state: 1.4.3
18338
- prosemirror-transform: 1.9.0
18341
+ prosemirror-transform: 1.10.2
18339
18342
 
18340
18343
  prosemirror-state@1.4.3:
18341
18344
  dependencies:
@@ -18343,6 +18346,10 @@ snapshots:
18343
18346
  prosemirror-transform: 1.9.0
18344
18347
  prosemirror-view: 1.33.8
18345
18348
 
18349
+ prosemirror-transform@1.10.2:
18350
+ dependencies:
18351
+ prosemirror-model: 1.21.3
18352
+
18346
18353
  prosemirror-transform@1.9.0:
18347
18354
  dependencies:
18348
18355
  prosemirror-model: 1.21.3
@@ -201,8 +201,8 @@ date-plugin:
201
201
  long-month-content: January, February, ..., December
202
202
  long-year: Long year
203
203
  insert:
204
- date: 'Insert date'
205
- datetime: 'Insert date and time'
204
+ date: 'Date'
205
+ datetime: 'Date and time'
206
206
  card:
207
207
  title: 'Date'
208
208
  insert-date: 'Insert date'
@@ -232,7 +232,7 @@ document-title-plugin:
232
232
 
233
233
  variable:
234
234
  number:
235
- placeholder: Insert number
235
+ placeholder: Number
236
236
  label: number
237
237
  type-number: Type a number...
238
238
  error-not-integer: Only integers are allowed
@@ -272,7 +272,7 @@ variable-plugin:
272
272
  to: to
273
273
  person:
274
274
  card-title: Insert person
275
- nodeview-placeholder: Insert person
275
+ nodeview-placeholder: Person
276
276
  autofill:
277
277
  autofillKey: Autofill Key
278
278
  convertToString: Replace variable node with plain text on text insertion
@@ -430,7 +430,7 @@ editor-plugins:
430
430
  projection-error: 'Unable to convert location coordinates: {coords}'
431
431
  contact: In case of persisting issues, contact <a href="mailto:{email}">{email}</a>.
432
432
  nodeview:
433
- placeholder: Insert address
433
+ placeholder: Address
434
434
 
435
435
  confidentiality-plugin:
436
436
  redact: Redact
@@ -201,8 +201,8 @@ date-plugin:
201
201
  long-month-content: Januari, Februari, ..., December
202
202
  long-year: Jaar
203
203
  insert:
204
- date: 'Datum invoegen'
205
- datetime: 'Datum en tijd invoegen'
204
+ date: 'Datum'
205
+ datetime: 'Datum en tijd'
206
206
  card:
207
207
  title: 'Datum'
208
208
  insert-date: 'Datum invoegen'
@@ -236,7 +236,7 @@ table-of-contents-plugin:
236
236
 
237
237
  variable:
238
238
  number:
239
- placeholder: Voeg getal in
239
+ placeholder: Getal
240
240
  label: nummer
241
241
  type-number: typ een nummer...
242
242
  error-not-integer: Enkel gehele getallen zijn toegelaten
@@ -276,7 +276,7 @@ variable-plugin:
276
276
  to: tot
277
277
  person:
278
278
  card-title: Persoon invoegen
279
- nodeview-placeholder: Voeg persoon in
279
+ nodeview-placeholder: Persoon
280
280
  autofill:
281
281
  autofillKey: Sleutelwaarde
282
282
  convertToString: Vervang variabele door platte tekst bij invoegen
@@ -429,7 +429,7 @@ editor-plugins:
429
429
  projection-error: 'Kan locatiecoördinaten niet converteren: {coords}'
430
430
  contact: Bij blijvende problemen, contacteer <a href="mailto:{email}">{email}</a>.
431
431
  nodeview:
432
- placeholder: Voeg adres in
432
+ placeholder: Adres
433
433
 
434
434
  confidentiality-plugin:
435
435
  redact: Redigeren
@@ -1,100 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import {
3
- NodeSelection,
4
- PNode,
5
- ProsePlugin,
6
- SayController,
7
- SayView,
8
- } from '@lblod/ember-rdfa-editor';
9
- import { editableNodePlugin } from '@lblod/ember-rdfa-editor/plugins/editable-node';
10
- import { tracked } from '@glimmer/tracking';
11
- import { action } from '@ember/object';
12
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
13
-
14
- import {
15
- EmberNodeArgs,
16
- SayNodeViewConstructor,
17
- } from '@lblod/ember-rdfa-editor/utils/ember-node';
18
- import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
19
- import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
20
- import AuPill from '@appuniversum/ember-appuniversum/components/au-pill';
21
- import { on } from '@ember/modifier';
22
- import EmbeddedEditor from '@lblod/ember-rdfa-editor/components/ember-node/embedded-editor';
23
-
24
- type Args = EmberNodeArgs & {
25
- getPos: () => number | undefined;
26
- node: PNode;
27
- updateAttribute: (attr: string, value: unknown) => void;
28
- controller: SayController;
29
- view: SayView;
30
- selected: boolean;
31
- selectNode: () => void;
32
- nodeViews: Record<string, SayNodeViewConstructor>;
33
- };
34
-
35
- export default class AutoFilledVariableNodeViewComponent extends Component<Args> {
36
- PencilIcon = PencilIcon;
37
-
38
- @tracked innerView?: SayView;
39
-
40
- get plugins(): ProsePlugin[] {
41
- return [editableNodePlugin(this.args.getPos)];
42
- }
43
- @action
44
- onClick() {
45
- if (this.innerView) {
46
- if (this.innerView.state.doc.firstChild?.type.name === 'placeholder') {
47
- this.innerView.focus();
48
- // Use request animation frame to only change the selection when the focus has been established
49
- window.requestAnimationFrame(() => {
50
- if (this.innerView) {
51
- const tr = this.innerView.state.tr;
52
- tr.setSelection(NodeSelection.create(this.innerView?.state.doc, 0));
53
- this.innerView?.dispatch(tr);
54
- }
55
- });
56
- } else {
57
- this.innerView.focus();
58
- }
59
- }
60
- }
61
- @action
62
- initEditor(view: SayView) {
63
- this.innerView = view;
64
- }
65
-
66
- get label() {
67
- if (this.innerView?.state.doc.firstChild?.type.name !== 'placeholder') {
68
- return '';
69
- }
70
- return getOutgoingTriple(this.args.node.attrs, EXT('label'))?.object.value;
71
- }
72
- <template>
73
- <AuPill
74
- @icon={{this.PencilIcon}}
75
- @iconAlignment='right'
76
- class='variable'
77
- {{on 'click' this.onClick}}
78
- >
79
- <EmbeddedEditor
80
- @controller={{@controller}}
81
- @view={{@view}}
82
- @getPos={{@getPos}}
83
- @node={{@node}}
84
- @selected={{@selected}}
85
- @initEditor={{this.initEditor}}
86
- @nodeViews={{@nodeViews}}
87
- @plugins={{this.plugins}}
88
- @updateAttribute={{@updateAttribute}}
89
- @selectNode={{@selectNode}}
90
- @placeholder=''
91
- @contentDecorations={{@contentDecorations}}
92
- />
93
- {{#if this.label}}
94
- <span class='label'>
95
- ({{this.label}})
96
- </span>
97
- {{/if}}
98
- </AuPill>
99
- </template>
100
- }
@@ -1,24 +0,0 @@
1
- {{! @glint-nocheck: not typesafe yet }}
2
- <AuPill
3
- @icon={{this.PencilIcon}}
4
- @iconAlignment='right'
5
- class='variable'
6
- {{on 'click' this.onClick}}
7
- >
8
- <EmberNode::EmbeddedEditor
9
- @controller={{@controller}}
10
- @node={{@node}}
11
- @view={{@view}}
12
- @getPos={{@getPos}}
13
- @selected={{@selected}}
14
- @initEditor={{this.initEditor}}
15
- @plugins={{this.plugins}}
16
- @decorations={{@decorations}}
17
- @contentDecorations={{@contentDecorations}}
18
- />
19
- {{#if this.label}}
20
- <span class='label'>
21
- ({{this.label}})
22
- </span>
23
- {{/if}}
24
- </AuPill>
@@ -1,46 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { NodeSelection, ProsePlugin, SayView } from '@lblod/ember-rdfa-editor';
3
- import { editableNodePlugin } from '@lblod/ember-rdfa-editor/plugins/editable-node';
4
- import { tracked } from '@glimmer/tracking';
5
- import { action } from '@ember/object';
6
- import { PencilIcon } from '@appuniversum/ember-appuniversum/components/icons/pencil';
7
- import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
8
-
9
- export default class LocationNodeViewComponent extends Component<EmberNodeArgs> {
10
- PencilIcon = PencilIcon;
11
-
12
- @tracked innerView?: SayView;
13
-
14
- get plugins(): ProsePlugin[] {
15
- return [editableNodePlugin(this.args.getPos)];
16
- }
17
- @action
18
- onClick() {
19
- if (this.innerView) {
20
- if (this.innerView.state.doc.firstChild?.type.name === 'placeholder') {
21
- this.innerView.focus();
22
- // Use request animation frame to only change the selection when the focus has been established
23
- window.requestAnimationFrame(() => {
24
- if (this.innerView) {
25
- const tr = this.innerView.state.tr;
26
- tr.setSelection(NodeSelection.create(this.innerView?.state.doc, 0));
27
- this.innerView?.dispatch(tr);
28
- }
29
- });
30
- } else {
31
- this.innerView.focus();
32
- }
33
- }
34
- }
35
- @action
36
- initEditor(view: SayView) {
37
- this.innerView = view;
38
- }
39
-
40
- get label() {
41
- if (this.innerView?.state.doc.firstChild?.type.name !== 'placeholder') {
42
- return '';
43
- }
44
- return this.args.node.attrs.label as string;
45
- }
46
- }
@@ -1,22 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { PNode, ProsePlugin, SayController, SayView } from '@lblod/ember-rdfa-editor';
3
- import { EmberNodeArgs, SayNodeViewConstructor } from '@lblod/ember-rdfa-editor/utils/ember-node';
4
- type Args = EmberNodeArgs & {
5
- getPos: () => number | undefined;
6
- node: PNode;
7
- updateAttribute: (attr: string, value: unknown) => void;
8
- controller: SayController;
9
- view: SayView;
10
- selected: boolean;
11
- selectNode: () => void;
12
- nodeViews: Record<string, SayNodeViewConstructor>;
13
- };
14
- export default class AutoFilledVariableNodeViewComponent extends Component<Args> {
15
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
16
- innerView?: SayView;
17
- get plugins(): ProsePlugin[];
18
- onClick(): void;
19
- initEditor(view: SayView): void;
20
- get label(): string | undefined;
21
- }
22
- export {};
@@ -1,11 +0,0 @@
1
- import Component from '@glimmer/component';
2
- import { ProsePlugin, SayView } from '@lblod/ember-rdfa-editor';
3
- import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
4
- export default class LocationNodeViewComponent extends Component<EmberNodeArgs> {
5
- PencilIcon: TOC<import("@appuniversum/ember-appuniversum/components/icons/pencil").PencilIconSignature>;
6
- innerView?: SayView;
7
- get plugins(): ProsePlugin[];
8
- onClick(): void;
9
- initEditor(view: SayView): void;
10
- get label(): string;
11
- }