@lblod/ember-rdfa-editor-lblod-plugins 23.1.0 → 24.0.0-dev.88fa28f6ec00ad4ba4d7f41ee8a103a051203e10

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 (50) hide show
  1. package/.changeset/healthy-wolves-perform.md +5 -0
  2. package/CHANGELOG.md +12 -0
  3. package/addon/components/lmb-plugin/search-modal.ts +10 -0
  4. package/addon/components/snippet-plugin/nodes/snippet.gts +27 -19
  5. package/addon/components/snippet-plugin/snippet-insert-placeholder.gts +10 -2
  6. package/addon/components/snippet-plugin/snippet-insert-rdfa.gts +5 -0
  7. package/addon/components/snippet-plugin/snippet-insert.gts +2 -0
  8. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.hbs +23 -12
  9. package/addon/components/snippet-plugin/snippet-list/snippet-list-modal.ts +18 -3
  10. package/addon/components/snippet-plugin/snippet-list-select.gts +7 -1
  11. package/addon/components/variable-plugin/autofilled/edit.gts +224 -0
  12. package/addon/components/variable-plugin/autofilled/insert.gts +143 -0
  13. package/addon/components/variable-plugin/autofilled/nodeview.gts +100 -0
  14. package/addon/components/variable-plugin/utils/label-input.gts +28 -0
  15. package/addon/plugins/citation-plugin/utils/public-decisions.ts +7 -6
  16. package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +7 -6
  17. package/addon/plugins/snippet-plugin/commands/insert-snippet.ts +4 -1
  18. package/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.ts +7 -0
  19. package/addon/plugins/snippet-plugin/nodes/snippet-placeholder.ts +10 -1
  20. package/addon/plugins/snippet-plugin/nodes/snippet.ts +7 -0
  21. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +32 -29
  22. package/addon/plugins/variable-plugin/plugins/autofiller.ts +98 -0
  23. package/addon/plugins/variable-plugin/variables/autofilled.ts +170 -0
  24. package/addon/plugins/variable-plugin/variables/index.ts +1 -0
  25. package/addon/services/roadsign-registry.ts +2 -1
  26. package/app/components/variable-plugin/autofilled/edit.js +1 -0
  27. package/app/components/variable-plugin/autofilled/insert.js +1 -0
  28. package/app/components/variable-plugin/autofilled/nodeview.js +1 -0
  29. package/app/styles/snippet-plugin.scss +0 -5
  30. package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +1 -0
  31. package/declarations/addon/components/snippet-plugin/snippet-insert-placeholder.d.ts +1 -1
  32. package/declarations/addon/components/snippet-plugin/snippet-insert-rdfa.d.ts +1 -0
  33. package/declarations/addon/components/snippet-plugin/snippet-insert.d.ts +1 -0
  34. package/declarations/addon/components/snippet-plugin/snippet-list/snippet-list-modal.d.ts +4 -1
  35. package/declarations/addon/components/snippet-plugin/snippet-list-select.d.ts +2 -1
  36. package/declarations/addon/components/variable-plugin/autofilled/edit.d.ts +28 -0
  37. package/declarations/addon/components/variable-plugin/autofilled/insert.d.ts +20 -0
  38. package/declarations/addon/components/variable-plugin/autofilled/nodeview.d.ts +22 -0
  39. package/declarations/addon/components/variable-plugin/utils/label-input.d.ts +11 -1
  40. package/declarations/addon/plugins/snippet-plugin/commands/insert-snippet.d.ts +2 -1
  41. package/declarations/addon/plugins/snippet-plugin/commands/update-snippet-placeholder.d.ts +2 -1
  42. package/declarations/addon/plugins/snippet-plugin/nodes/snippet-placeholder.d.ts +1 -1
  43. package/declarations/addon/plugins/snippet-plugin/nodes/snippet.d.ts +2 -1
  44. package/declarations/addon/plugins/variable-plugin/plugins/autofiller.d.ts +8 -0
  45. package/declarations/addon/plugins/variable-plugin/variables/autofilled.d.ts +2 -0
  46. package/declarations/addon/plugins/variable-plugin/variables/index.d.ts +1 -0
  47. package/package.json +1 -1
  48. package/translations/en-US.yaml +7 -0
  49. package/translations/nl-BE.yaml +7 -0
  50. package/addon/components/variable-plugin/utils/label-input.hbs +0 -11
@@ -0,0 +1,5 @@
1
+ ---
2
+ '@lblod/ember-rdfa-editor-lblod-plugins': patch
3
+ ---
4
+
5
+ Fix the person edit modal was not being resetted on closing
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 24.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#482](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/482) [`8c46ded`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/8c46deddb0ab3d156b27fb555709e6489f647ced) Thanks [@elpoelma](https://github.com/elpoelma)! - Adjust snippet queries to work with new snippet data-model
8
+
9
+ ### Minor Changes
10
+
11
+ - [#472](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/472) [`a114436`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/a114436ce7b0a7a4f2fca9faf494729169554dbd) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Add autofill variable
12
+
13
+ - [#484](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/484) [`14e8c57`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/14e8c5746b7674dfa3e0d968d4ce16c5855ffff3) Thanks [@elpoelma](https://github.com/elpoelma)! - Add option for enabling/disabling multi-snippet insertion
14
+
3
15
  ## 23.1.0
4
16
 
5
17
  ### Minor Changes
@@ -34,6 +34,8 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
34
34
 
35
35
  @action
36
36
  async closeModal() {
37
+ this.inputSearchText = null;
38
+ this.sort = false;
37
39
  await this.servicesResource.cancel();
38
40
  this.args.closeModal();
39
41
  }
@@ -45,6 +47,13 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
45
47
  // TODO Either make this a trackedFunction or do filtering on the query and correctly pass an
46
48
  // AbortController
47
49
  search = restartableTask(async () => {
50
+ if (!this.args.open) {
51
+ return {
52
+ results: [],
53
+ totalCount: 0,
54
+ };
55
+ }
56
+
48
57
  // Can't do what I want, so if the user modifies the filter before resolving the query will run again
49
58
  if (!this.fetchData.lastComplete) {
50
59
  try {
@@ -108,6 +117,7 @@ export default class LmbPluginSearchModalComponent extends Component<Args> {
108
117
  this.sort,
109
118
  this.pageNumber,
110
119
  this.pageSize,
120
+ this.args.open,
111
121
  ]);
112
122
 
113
123
  @action
@@ -5,7 +5,6 @@ import { tracked } from '@glimmer/tracking';
5
5
  import { action } from '@ember/object';
6
6
  import { TemplateOnlyComponent } from '@ember/component/template-only';
7
7
  import t from 'ember-intl/helpers/t';
8
- import { not } from 'ember-truth-helpers';
9
8
  import AuIcon, {
10
9
  type AuIconSignature,
11
10
  } from '@appuniversum/ember-appuniversum/components/au-icon';
@@ -41,20 +40,19 @@ interface ButtonSig {
41
40
  }
42
41
 
43
42
  const SnippetButton: TemplateOnlyComponent<ButtonSig> = <template>
44
- <button
45
- class='say-snippet-button {{if @isActive "" "say-snippet-hidden"}}'
46
- disabled={{(not @isActive)}}
47
- type='button'
48
- {{on 'click' @onClick}}
49
- ...attributes
50
- >
51
- {{#if @isActive}}
43
+ {{#if @isActive}}
44
+ <button
45
+ class='say-snippet-button'
46
+ type='button'
47
+ {{on 'click' @onClick}}
48
+ ...attributes
49
+ >
52
50
  <AuIcon @icon={{@icon}} @size='large' {{on 'click' @onClick}} />
53
51
  <div class='say-snippet-button-text'>
54
52
  {{t @helpText}}
55
53
  </div>
56
- {{/if}}
57
- </button>
54
+ </button>
55
+ {{/if}}
58
56
  </template>;
59
57
 
60
58
  interface Signature {
@@ -81,10 +79,17 @@ export default class SnippetNode extends Component<Signature> {
81
79
  this.controller.focus();
82
80
  this.showModal = true;
83
81
  }
82
+
83
+ get allowMultipleSnippets() {
84
+ return this.node.attrs.allowMultipleSnippets as boolean;
85
+ }
86
+
84
87
  @action
85
88
  addFragment() {
86
- this.mode = 'add';
87
- this.openModal();
89
+ if (this.allowMultipleSnippets) {
90
+ this.mode = 'add';
91
+ this.openModal();
92
+ }
88
93
  }
89
94
  @action
90
95
  editFragment() {
@@ -151,6 +156,7 @@ export default class SnippetNode extends Component<Signature> {
151
156
  assignedSnippetListsIds,
152
157
  importedResources: this.node.attrs.importedResources,
153
158
  range: { start, end },
159
+ allowMultipleSnippets: this.allowMultipleSnippets,
154
160
  }),
155
161
  );
156
162
  }
@@ -173,12 +179,14 @@ export default class SnippetNode extends Component<Signature> {
173
179
  @isActive={{this.isActive}}
174
180
  class='say-snippet-remove-button'
175
181
  />
176
- <SnippetButton
177
- @icon={{AddIcon}}
178
- @helpText='snippet-plugin.snippet-node.add-fragment'
179
- @onClick={{this.addFragment}}
180
- @isActive={{this.isActive}}
181
- />
182
+ {{#if this.allowMultipleSnippets}}
183
+ <SnippetButton
184
+ @icon={{AddIcon}}
185
+ @helpText='snippet-plugin.snippet-node.add-fragment'
186
+ @onClick={{this.addFragment}}
187
+ @isActive={{this.isActive}}
188
+ />
189
+ {{/if}}
182
190
  </div>
183
191
 
184
192
  </div>
@@ -38,9 +38,16 @@ export default class SnippetPluginSnippetInsertPlaceholder extends Component<Sig
38
38
  }
39
39
 
40
40
  @action
41
- insertPlaceholder(lists: SnippetList[] | undefined) {
41
+ insertPlaceholder(
42
+ lists: SnippetList[] | undefined,
43
+ allowMultipleSnippets: boolean,
44
+ ) {
42
45
  if (lists) {
43
- const node = createSnippetPlaceholder(lists, this.args.controller.schema);
46
+ const node = createSnippetPlaceholder(
47
+ lists,
48
+ this.args.controller.schema,
49
+ allowMultipleSnippets,
50
+ );
44
51
 
45
52
  this.args.controller.withTransaction(
46
53
  (tr) => {
@@ -66,6 +73,7 @@ export default class SnippetPluginSnippetInsertPlaceholder extends Component<Sig
66
73
  <SnippetListModal
67
74
  @config={{@config}}
68
75
  @assignedSnippetListsIds={{empty}}
76
+ @allowMultipleSnippets={{false}}
69
77
  @onSaveSnippetLists={{this.insertPlaceholder}}
70
78
  @open={{this.isModalOpen}}
71
79
  @closeModal={{this.closeModal}}
@@ -71,12 +71,17 @@ export default class SnippetInsertRdfaComponent extends Component<Sig> {
71
71
  return undefined;
72
72
  }
73
73
 
74
+ get allowMultipleSnippets() {
75
+ return this.args.node.value.attrs.allowMultipleSnippets as boolean;
76
+ }
77
+
74
78
  <template>
75
79
  <SnippetInsert
76
80
  @config={{@config}}
77
81
  @controller={{@controller}}
78
82
  @snippetListProperties={{this.snippetListProperties}}
79
83
  @disabled={{this.disableInsert}}
84
+ @allowMultipleSnippets={{this.allowMultipleSnippets}}
80
85
  />
81
86
  </template>
82
87
  }
@@ -23,6 +23,7 @@ interface Sig {
23
23
  | { listIds: string[]; importedResources: ImportedResourceMap }
24
24
  | undefined;
25
25
  disabled?: boolean;
26
+ allowMultipleSnippets?: boolean;
26
27
  };
27
28
  }
28
29
 
@@ -63,6 +64,7 @@ export default class SnippetInsertComponent extends Component<Sig> {
63
64
  title,
64
65
  assignedSnippetListsIds: this.args.snippetListProperties?.listIds || [],
65
66
  importedResources: this.args.snippetListProperties?.importedResources,
67
+ allowMultipleSnippets: this.args.allowMultipleSnippets,
66
68
  }),
67
69
  );
68
70
  }
@@ -31,20 +31,31 @@
31
31
  @border='top'
32
32
  @size='large'
33
33
  @nowrap={{true}}
34
- @reverse={{true}}
34
+ class='au-u-flex--vertical-center'
35
+ as |Group|
35
36
  >
36
- <AuButtonGroup>
37
- <AuButton @skin='secondary' {{on 'click' this.closeModal}}>
38
- {{t 'snippet-plugin.snippet-list.modal.button.cancel'}}
39
- </AuButton>
40
- <AuButton
41
- @skin='primary'
42
- {{on 'click' this.saveAndClose}}
43
- @disabled={{@onSaveSnippetLists.isRunning}}
37
+ <Group>
38
+ <AuCheckbox
39
+ @checked={{this.allowMultipleSnippets}}
40
+ @onChange={{this.handleMultipleSnippetsCheckbox}}
44
41
  >
45
- {{t 'snippet-plugin.snippet-list.modal.button.update'}}
46
- </AuButton>
47
- </AuButtonGroup>
42
+ {{t 'snippet-plugin.snippet-list.modal.multi-snippet-toggle'}}
43
+ </AuCheckbox>
44
+ </Group>
45
+ <Group>
46
+ <AuButtonGroup>
47
+ <AuButton @skin='secondary' {{on 'click' this.closeModal}}>
48
+ {{t 'snippet-plugin.snippet-list.modal.button.cancel'}}
49
+ </AuButton>
50
+ <AuButton
51
+ @skin='primary'
52
+ {{on 'click' this.saveAndClose}}
53
+ @disabled={{@onSaveSnippetLists.isRunning}}
54
+ >
55
+ {{t 'snippet-plugin.snippet-list.modal.button.update'}}
56
+ </AuButton>
57
+ </AuButtonGroup>
58
+ </Group>
48
59
  </AuToolbar>
49
60
  </mc.content>
50
61
  </AuMainContainer>
@@ -14,15 +14,19 @@ import {
14
14
  SnippetPluginConfig,
15
15
  SnippetList,
16
16
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
17
- import { trackedReset } from 'tracked-toolbox';
17
+ import { localCopy, trackedReset } from 'tracked-toolbox';
18
18
 
19
19
  interface Signature {
20
20
  Args: {
21
21
  config: SnippetPluginConfig;
22
- onSaveSnippetLists: (lists: SnippetList[]) => void;
22
+ onSaveSnippetLists: (
23
+ lists: SnippetList[],
24
+ allowMultipleSnippets: boolean,
25
+ ) => void;
23
26
  assignedSnippetListsIds: string[] | undefined;
24
27
  closeModal: () => void;
25
28
  open: boolean;
29
+ allowMultipleSnippets?: boolean;
26
30
  };
27
31
  }
28
32
 
@@ -41,12 +45,20 @@ export default class SnippetListModalComponent extends Component<Signature> {
41
45
  ...(this.args.assignedSnippetListsIds ?? []),
42
46
  ];
43
47
 
48
+ @localCopy('args.allowMultipleSnippets') allowMultipleSnippets = false;
49
+
50
+ @action
51
+ handleMultipleSnippetsCheckbox(checked: boolean) {
52
+ this.allowMultipleSnippets = checked;
53
+ }
54
+
44
55
  get config() {
45
56
  return this.args.config;
46
57
  }
47
58
 
48
59
  @action
49
60
  closeModal() {
61
+ this.allowMultipleSnippets = this.args.allowMultipleSnippets ?? false;
50
62
  this.args.closeModal();
51
63
  }
52
64
 
@@ -55,7 +67,10 @@ export default class SnippetListModalComponent extends Component<Signature> {
55
67
  const snippetLists = this.snippetListResource.value?.filter((snippetList) =>
56
68
  this.assignedSnippetListsIds.includes(snippetList.id),
57
69
  );
58
- this.args.onSaveSnippetLists(snippetLists || []);
70
+ this.args.onSaveSnippetLists(
71
+ snippetLists || [],
72
+ this.allowMultipleSnippets,
73
+ );
59
74
  this.args.closeModal();
60
75
  // Clear selection for next time
61
76
  this.assignedSnippetListsIds = [];
@@ -59,12 +59,16 @@ export default class SnippetListSelect extends Component<Signature> {
59
59
  );
60
60
  }
61
61
 
62
+ get allowMultipleSnippets(): boolean {
63
+ return this.args.node.value.attrs.allowMultipleSnippets as boolean;
64
+ }
65
+
62
66
  get imported(): ImportedResourceMap {
63
67
  return this.args.node.value.attrs['importedResources'];
64
68
  }
65
69
 
66
70
  @action
67
- onSaveSnippetLists(lists: SnippetList[]) {
71
+ onSaveSnippetLists(lists: SnippetList[], allowMultipleSnippets: boolean) {
68
72
  if (this.currentResource) {
69
73
  this.args.controller?.doCommand(
70
74
  updateSnippetPlaceholder({
@@ -73,6 +77,7 @@ export default class SnippetListSelect extends Component<Signature> {
73
77
  newSnippetLists: lists,
74
78
  oldImportedResources: this.imported,
75
79
  node: this.args.node,
80
+ allowMultipleSnippets,
76
81
  }),
77
82
  {
78
83
  view: this.args.controller.mainEditorView,
@@ -96,6 +101,7 @@ export default class SnippetListSelect extends Component<Signature> {
96
101
  @config={{@config}}
97
102
  @assignedSnippetListsIds={{this.assignedSnippetListsIds}}
98
103
  @onSaveSnippetLists={{this.onSaveSnippetLists}}
104
+ @allowMultipleSnippets={{this.allowMultipleSnippets}}
99
105
  @open={{this.showModal}}
100
106
  @closeModal={{this.closeModal}}
101
107
  />
@@ -0,0 +1,224 @@
1
+ import Component from '@glimmer/component';
2
+ import { action } from '@ember/object';
3
+ import { service } from '@ember/service';
4
+ import { NodeSelection, type SayController } from '@lblod/ember-rdfa-editor';
5
+ import IntlService from 'ember-intl/services/intl';
6
+ import AuFormRow from '@appuniversum/ember-appuniversum/components/au-form-row';
7
+ import AuLabel from '@appuniversum/ember-appuniversum/components/au-label';
8
+ import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
9
+ import AuCheckbox from '@appuniversum/ember-appuniversum/components/au-checkbox';
10
+ import AuNativeInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-native-input';
11
+ import AuCard from '@appuniversum/ember-appuniversum/components/au-card';
12
+ import AuHeading from '@appuniversum/ember-appuniversum/components/au-heading';
13
+ import t from 'ember-intl/helpers/t';
14
+ import { on } from '@ember/modifier';
15
+ import { trackedReset } from 'tracked-toolbox';
16
+ import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
17
+ import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory/data-factory';
18
+ import { getOutgoingTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
19
+ import LabelInput from '../utils/label-input';
20
+ import {
21
+ ContentLiteralTerm,
22
+ SayLiteral,
23
+ SayNamedNode,
24
+ } from '@lblod/ember-rdfa-editor/core/say-data-factory';
25
+ type Args = {
26
+ controller: SayController;
27
+ };
28
+
29
+ type nodeProperty =
30
+ | {
31
+ predicate: string;
32
+ object: SayNamedNode<string>;
33
+ }
34
+ | {
35
+ predicate: string;
36
+ object: SayLiteral;
37
+ }
38
+ | {
39
+ predicate: string;
40
+ object: ContentLiteralTerm;
41
+ };
42
+
43
+ export default class AutoFilledVariableInsertComponent extends Component<Args> {
44
+ @service declare intl: IntlService;
45
+
46
+ // memo is the path to the trigger, which calls update
47
+ // see https://github.com/tracked-tools/tracked-toolbox?tab=readme-ov-file#trackedreset
48
+ // it's sort of badly explained in the docs, but it's a more generic version
49
+ // of localCopy, which we can't use here cause our derived state from the args
50
+ // is too complex to express as a string path
51
+ @trackedReset({
52
+ memo: 'args.controller.mainEditorState',
53
+ // using this as the first arg is special typescript syntax
54
+ // which allows you to explicitly type the this context, cause
55
+ // ts is not smart enough to know that
56
+ update(this: AutoFilledVariableInsertComponent) {
57
+ return this.convertToStringAttr;
58
+ },
59
+ })
60
+ convertToString: boolean = false;
61
+
62
+ @trackedReset({
63
+ memo: 'args.controller.mainEditorState',
64
+ update(this: AutoFilledVariableInsertComponent) {
65
+ return this.autofillKeyAttr;
66
+ },
67
+ })
68
+ autofillKey?: string;
69
+
70
+ @trackedReset({
71
+ memo: 'args.controller.mainEditorState',
72
+ update(this: AutoFilledVariableInsertComponent) {
73
+ return this.labelAttr;
74
+ },
75
+ })
76
+ label!: string;
77
+
78
+ get selectedVariable() {
79
+ const { selection } = this.controller.mainEditorState;
80
+ if (
81
+ selection instanceof NodeSelection &&
82
+ selection.node.type === this.controller.schema.nodes.autofilled_variable
83
+ ) {
84
+ return {
85
+ node: selection.node,
86
+ pos: selection.from,
87
+ };
88
+ } else {
89
+ return null;
90
+ }
91
+ }
92
+ get autofillKeyAttr() {
93
+ return this.selectedVariable?.node.attrs.autofillKey;
94
+ }
95
+ get convertToStringAttr() {
96
+ return this.selectedVariable?.node.attrs.convertToString;
97
+ }
98
+ get labelAttr() {
99
+ if (!this.selectedVariable) return '';
100
+ return getOutgoingTriple(this.selectedVariable.node.attrs, EXT('label'))
101
+ ?.object.value;
102
+ }
103
+
104
+ get showCard() {
105
+ return !!this.selectedVariable;
106
+ }
107
+
108
+ get controller() {
109
+ return this.args.controller;
110
+ }
111
+
112
+ get schema() {
113
+ return this.args.controller.schema;
114
+ }
115
+
116
+ get documentLanguage() {
117
+ return this.controller.documentLanguage;
118
+ }
119
+
120
+ @action
121
+ updateLabel(event: InputEvent) {
122
+ this.label = (event.target as HTMLInputElement).value;
123
+ }
124
+
125
+ @action
126
+ updateAutofillKey(event: InputEvent) {
127
+ this.autofillKey = (event.target as HTMLInputElement).value;
128
+ }
129
+
130
+ @action
131
+ updateConvertToString(value: boolean) {
132
+ this.convertToString = value;
133
+ }
134
+
135
+ @action
136
+ edit() {
137
+ if (this.selectedVariable) {
138
+ this.controller.withTransaction(
139
+ (tr) => {
140
+ const position = this.selectedVariable?.pos as number;
141
+ tr.setNodeAttribute(position, 'autofillKey', this.autofillKey);
142
+ tr.setNodeAttribute(
143
+ position,
144
+ 'convertToString',
145
+ this.convertToString,
146
+ );
147
+ const oldProperties = this.selectedVariable?.node.attrs.properties;
148
+ const newProperties = oldProperties.filter(
149
+ (property: nodeProperty) =>
150
+ property.predicate !== EXT('label').full,
151
+ );
152
+ newProperties.push({
153
+ predicate: EXT('label').full,
154
+ object: sayDataFactory.literal(this.label || ''),
155
+ });
156
+ tr.setNodeAttribute(position, 'properties', newProperties);
157
+ return tr;
158
+ },
159
+ // because the variable pill contains a nested editor, when it's
160
+ // selected, the currentEditorView is the nested one. When you run
161
+ // withTransaction without the optional second argument, it defaults to using
162
+ // the current view.
163
+ //
164
+ // Here, we don't want that, cause we want to edit the outside node, not
165
+ // any node in the nested editor.
166
+ { view: this.controller.mainEditorView },
167
+ );
168
+ }
169
+ }
170
+ <template>
171
+ {{#if this.showCard}}
172
+ <AuCard
173
+ @flex={{true}}
174
+ @divided={{true}}
175
+ @isOpenInitially={{true}}
176
+ @expandable={{true}}
177
+ @shadow={{true}}
178
+ @size='small'
179
+ as |c|
180
+ >
181
+ <c.header>
182
+ <AuHeading @level='3' @skin='6'>
183
+ {{t 'variable-plugin.enter-variable-value'}}
184
+ </AuHeading>
185
+ </c.header>
186
+ <c.content>
187
+ <AuFormRow>
188
+ <LabelInput
189
+ @label={{this.label}}
190
+ @updateLabel={{this.updateLabel}}
191
+ />
192
+ </AuFormRow>
193
+ <AuFormRow>
194
+ <AuLabel for='autofill_key'>
195
+ {{t 'variable-plugin.autofill.autofillKey'}}
196
+ </AuLabel>
197
+ <AuNativeInput
198
+ id='autofill_key'
199
+ placeholder={{t
200
+ 'variable-plugin.autofill.autofillKeyPlaceholder'
201
+ }}
202
+ @type='text'
203
+ @width='block'
204
+ value={{this.autofillKey}}
205
+ {{on 'input' this.updateAutofillKey}}
206
+ />
207
+ </AuFormRow>
208
+ <AuFormRow>
209
+ <AuCheckbox
210
+ id='convert_to_string'
211
+ @checked={{this.convertToString}}
212
+ @onChange={{this.updateConvertToString}}
213
+ >
214
+ {{t 'variable-plugin.autofill.convertToString'}}
215
+ </AuCheckbox>
216
+ </AuFormRow>
217
+ <AuButton {{on 'click' this.edit}}>
218
+ {{t 'variable-plugin.button'}}
219
+ </AuButton>
220
+ </c.content>
221
+ </AuCard>
222
+ {{/if}}
223
+ </template>
224
+ }