@lblod/ember-rdfa-editor-lblod-plugins 23.0.0 → 23.1.0-dev.7bb598372e1d150f34e69ae52ed021a0f4f2fd7b
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.
- package/.changeset/mean-deers-call.md +5 -0
- package/CHANGELOG.md +6 -0
- package/addon/components/variable-plugin/autofilled/edit.gts +224 -0
- package/addon/components/variable-plugin/autofilled/insert.gts +143 -0
- package/addon/components/variable-plugin/autofilled/nodeview.gts +100 -0
- package/addon/components/variable-plugin/utils/label-input.gts +28 -0
- package/addon/plugins/snippet-plugin/commands/insert-snippet.ts +1 -1
- package/addon/plugins/template-comments-plugin/node.ts +10 -0
- package/addon/plugins/variable-plugin/plugins/autofiller.ts +98 -0
- package/addon/plugins/variable-plugin/variables/autofilled.ts +170 -0
- package/addon/plugins/variable-plugin/variables/index.ts +1 -0
- package/app/components/variable-plugin/autofilled/edit.js +1 -0
- package/app/components/variable-plugin/autofilled/insert.js +1 -0
- package/app/components/variable-plugin/autofilled/nodeview.js +1 -0
- package/declarations/addon/components/variable-plugin/autofilled/edit.d.ts +28 -0
- package/declarations/addon/components/variable-plugin/autofilled/insert.d.ts +20 -0
- package/declarations/addon/components/variable-plugin/autofilled/nodeview.d.ts +22 -0
- package/declarations/addon/components/variable-plugin/utils/label-input.d.ts +11 -1
- package/declarations/addon/plugins/variable-plugin/plugins/autofiller.d.ts +8 -0
- package/declarations/addon/plugins/variable-plugin/variables/autofilled.d.ts +2 -0
- package/declarations/addon/plugins/variable-plugin/variables/index.d.ts +1 -0
- package/package.json +2 -1
- package/pnpm-lock.yaml +27 -24
- package/translations/en-US.yaml +6 -0
- package/translations/nl-BE.yaml +6 -0
- package/addon/components/variable-plugin/utils/label-input.hbs +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 23.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#483](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/483) [`2ac7d9a`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/2ac7d9ae70a885fa7747df6e3a18eece2b06e910) Thanks [@piemonkey](https://github.com/piemonkey)! - Add property to hide template comments while publishing
|
|
8
|
+
|
|
3
9
|
## 23.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { service } from '@ember/service';
|
|
5
|
+
import { type SayController } from '@lblod/ember-rdfa-editor';
|
|
6
|
+
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
7
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
8
|
+
import IntlService from 'ember-intl/services/intl';
|
|
9
|
+
import {
|
|
10
|
+
DCT,
|
|
11
|
+
EXT,
|
|
12
|
+
RDF,
|
|
13
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
14
|
+
import { replaceSelectionWithAndSelectNode } from '@lblod/ember-rdfa-editor-lblod-plugins/commands';
|
|
15
|
+
import AuFormRow from '@appuniversum/ember-appuniversum/components/au-form-row';
|
|
16
|
+
import AuLabel from '@appuniversum/ember-appuniversum/components/au-label';
|
|
17
|
+
import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
|
|
18
|
+
import AuCheckbox from '@appuniversum/ember-appuniversum/components/au-checkbox';
|
|
19
|
+
import AuNativeInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-native-input';
|
|
20
|
+
import t from 'ember-intl/helpers/t';
|
|
21
|
+
import { on } from '@ember/modifier';
|
|
22
|
+
import LabelInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/utils/label-input';
|
|
23
|
+
|
|
24
|
+
type Args = {
|
|
25
|
+
controller: SayController;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
29
|
+
@service declare intl: IntlService;
|
|
30
|
+
@tracked label: string = '';
|
|
31
|
+
@tracked autofillKey?: string;
|
|
32
|
+
@tracked convertToString?: boolean;
|
|
33
|
+
|
|
34
|
+
get controller() {
|
|
35
|
+
return this.args.controller;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get schema() {
|
|
39
|
+
return this.args.controller.schema;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get documentLanguage() {
|
|
43
|
+
return this.controller.documentLanguage;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@action
|
|
47
|
+
updateLabel(event: InputEvent) {
|
|
48
|
+
this.label = (event.target as HTMLInputElement).value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@action
|
|
52
|
+
updateAutofillKey(event: InputEvent) {
|
|
53
|
+
this.autofillKey = (event.target as HTMLInputElement).value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@action
|
|
57
|
+
updateConvertToString(value: boolean) {
|
|
58
|
+
this.convertToString = value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@action
|
|
62
|
+
insert() {
|
|
63
|
+
const mappingSubject = `http://data.lblod.info/mappings/${uuidv4()}`;
|
|
64
|
+
const variableInstance = `http://data.lblod.info/variables/${uuidv4()}`;
|
|
65
|
+
const variableId = uuidv4();
|
|
66
|
+
|
|
67
|
+
const placeholder = this.intl.t('variable.autofilled.label', {
|
|
68
|
+
locale: this.documentLanguage,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const label = this.label != '' ? this.label : placeholder;
|
|
72
|
+
const node = this.schema.nodes.autofilled_variable.create(
|
|
73
|
+
{
|
|
74
|
+
subject: mappingSubject,
|
|
75
|
+
rdfaNodeType: 'resource',
|
|
76
|
+
__rdfaId: variableId,
|
|
77
|
+
properties: [
|
|
78
|
+
{
|
|
79
|
+
predicate: RDF('type').full,
|
|
80
|
+
object: sayDataFactory.namedNode(EXT('Mapping').full),
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
predicate: EXT('instance').full,
|
|
84
|
+
object: sayDataFactory.namedNode(variableInstance),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
predicate: EXT('label').full,
|
|
88
|
+
object: sayDataFactory.literal(label),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
predicate: DCT('type').full,
|
|
92
|
+
object: sayDataFactory.literal('autofilled'),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
predicate: EXT('content').full,
|
|
96
|
+
object: sayDataFactory.contentLiteral(),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
autofillKey: this.autofillKey,
|
|
100
|
+
convertToString: this.convertToString,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
this.schema.node('placeholder', {
|
|
104
|
+
placeholderText: `Autofill ${this.autofillKey}`,
|
|
105
|
+
}),
|
|
106
|
+
);
|
|
107
|
+
this.label = '';
|
|
108
|
+
|
|
109
|
+
this.controller.doCommand(replaceSelectionWithAndSelectNode(node), {
|
|
110
|
+
view: this.controller.mainEditorView,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
<template>
|
|
114
|
+
<AuFormRow>
|
|
115
|
+
<LabelInput @label={{this.label}} @updateLabel={{this.updateLabel}} />
|
|
116
|
+
</AuFormRow>
|
|
117
|
+
<AuFormRow>
|
|
118
|
+
<AuLabel for='autofill_key'>
|
|
119
|
+
{{t 'variable-plugin.autofill.autofillKey'}}
|
|
120
|
+
</AuLabel>
|
|
121
|
+
<AuNativeInput
|
|
122
|
+
id='autofill_key'
|
|
123
|
+
placeholder={{t 'variable-plugin.autofill.autofillKeyPlaceholder'}}
|
|
124
|
+
@type='text'
|
|
125
|
+
@width='block'
|
|
126
|
+
value={{this.autofillKey}}
|
|
127
|
+
{{on 'input' this.updateAutofillKey}}
|
|
128
|
+
/>
|
|
129
|
+
</AuFormRow>
|
|
130
|
+
<AuFormRow>
|
|
131
|
+
<AuCheckbox
|
|
132
|
+
id='convert_to_string'
|
|
133
|
+
@checked={{this.convertToString}}
|
|
134
|
+
@onChange={{this.updateConvertToString}}
|
|
135
|
+
>
|
|
136
|
+
{{t 'variable-plugin.autofill.convertToString'}}
|
|
137
|
+
</AuCheckbox>
|
|
138
|
+
</AuFormRow>
|
|
139
|
+
<AuButton {{on 'click' this.insert}}>
|
|
140
|
+
{{t 'variable-plugin.button'}}
|
|
141
|
+
</AuButton>
|
|
142
|
+
</template>
|
|
143
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import AuLabel from '@appuniversum/ember-appuniversum/components/au-label';
|
|
2
|
+
import AuNativeInput from '@lblod/ember-rdfa-editor-lblod-plugins/components/au-native-input';
|
|
3
|
+
import t from 'ember-intl/helpers/t';
|
|
4
|
+
import { on } from '@ember/modifier';
|
|
5
|
+
import { TemplateOnlyComponent } from '@ember/component/template-only';
|
|
6
|
+
|
|
7
|
+
interface Sig {
|
|
8
|
+
Args: {
|
|
9
|
+
label: string;
|
|
10
|
+
updateLabel: (event: InputEvent) => void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const LabelInput: TemplateOnlyComponent<Sig> = <template>
|
|
15
|
+
<AuLabel for='label'>
|
|
16
|
+
{{t 'variable-plugin.label'}}
|
|
17
|
+
</AuLabel>
|
|
18
|
+
<AuNativeInput
|
|
19
|
+
id='label'
|
|
20
|
+
placeholder={{t 'variable-plugin.labelPlaceholder'}}
|
|
21
|
+
@type='text'
|
|
22
|
+
@width='block'
|
|
23
|
+
value={{@label}}
|
|
24
|
+
{{on 'input' @updateLabel}}
|
|
25
|
+
/>
|
|
26
|
+
</template>;
|
|
27
|
+
|
|
28
|
+
export default LabelInput;
|
|
@@ -60,7 +60,6 @@ const insertSnippet = ({
|
|
|
60
60
|
);
|
|
61
61
|
})
|
|
62
62
|
.flat();
|
|
63
|
-
|
|
64
63
|
tr = transactionCombinator(
|
|
65
64
|
state,
|
|
66
65
|
tr.replaceRangeWith(insertRange.start, insertRange.end, snippet),
|
|
@@ -72,6 +71,7 @@ const insertSnippet = ({
|
|
|
72
71
|
tr.replaceRange(insertRange.start, insertRange.end, slice),
|
|
73
72
|
)([recalculateNumbers]).transaction;
|
|
74
73
|
}
|
|
74
|
+
tr.setMeta('insertSnippet', true);
|
|
75
75
|
if (dispatch) {
|
|
76
76
|
dispatch(tr);
|
|
77
77
|
}
|
|
@@ -7,6 +7,15 @@ import {
|
|
|
7
7
|
createEmberNodeView,
|
|
8
8
|
EmberNodeConfig,
|
|
9
9
|
} from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
10
|
+
import { dependencySatisfies, macroCondition } from '@embroider/macros';
|
|
11
|
+
import { importSync } from '@embroider/macros';
|
|
12
|
+
const HIDE_FOR_PUBLISH_ATTR = macroCondition(
|
|
13
|
+
dependencySatisfies('@lblod/ember-rdfa-editor', '>=10.6.0'),
|
|
14
|
+
)
|
|
15
|
+
? // @ts-expect-error TS/glint doesn't seem to treat this as an import
|
|
16
|
+
importSync('@lblod/ember-rdfa-editor/utils/strip-html-for-publish')
|
|
17
|
+
.HIDE_FOR_PUBLISH_ATTR
|
|
18
|
+
: 'data-say-hide-for-publish';
|
|
10
19
|
import { getTranslationFunction } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/translation';
|
|
11
20
|
|
|
12
21
|
export const emberNodeConfig: () => EmberNodeConfig = () => {
|
|
@@ -30,6 +39,7 @@ export const emberNodeConfig: () => EmberNodeConfig = () => {
|
|
|
30
39
|
{
|
|
31
40
|
typeof: EXT('TemplateComment').prefixed,
|
|
32
41
|
class: 'say-template-comment',
|
|
42
|
+
[HIDE_FOR_PUBLISH_ATTR]: true,
|
|
33
43
|
},
|
|
34
44
|
['p', {}, ['strong', {}, heading]],
|
|
35
45
|
['div', { property: EXT('content').prefixed }, 0],
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EditorState,
|
|
3
|
+
PNode,
|
|
4
|
+
ProsePlugin,
|
|
5
|
+
Schema,
|
|
6
|
+
Transaction,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor';
|
|
8
|
+
import { changedDescendants } from '@lblod/ember-rdfa-editor/utils/_private/changed-descendants';
|
|
9
|
+
import { undoDepth } from '@lblod/ember-rdfa-editor/plugins/history';
|
|
10
|
+
|
|
11
|
+
type AutofilledArgs = {
|
|
12
|
+
autofilledValues: {
|
|
13
|
+
[Key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function variableAutofillerPlugin(config: AutofilledArgs): ProsePlugin {
|
|
18
|
+
return new ProsePlugin({
|
|
19
|
+
appendTransaction(
|
|
20
|
+
transactions: readonly Transaction[],
|
|
21
|
+
oldState: EditorState,
|
|
22
|
+
newState: EditorState,
|
|
23
|
+
) {
|
|
24
|
+
const autofilledVariables: { node: PNode; pos: number }[] = [];
|
|
25
|
+
if (undoDepth(oldState)) {
|
|
26
|
+
let isInsertSnippet = false;
|
|
27
|
+
for (const transaction of transactions) {
|
|
28
|
+
if (transaction.getMeta('insertSnippet')) {
|
|
29
|
+
isInsertSnippet = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!isInsertSnippet) return;
|
|
33
|
+
changedDescendants(
|
|
34
|
+
oldState.doc,
|
|
35
|
+
newState.doc,
|
|
36
|
+
0,
|
|
37
|
+
(node: PNode, pos: number) => {
|
|
38
|
+
if (
|
|
39
|
+
node.type.name === 'autofilled_variable' &&
|
|
40
|
+
!node.attrs.initialized
|
|
41
|
+
) {
|
|
42
|
+
autofilledVariables.push({ node, pos });
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
newState.doc.descendants((node: PNode, pos: number) => {
|
|
50
|
+
if (
|
|
51
|
+
node.type.name === 'autofilled_variable' &&
|
|
52
|
+
!node.attrs.initialized
|
|
53
|
+
) {
|
|
54
|
+
autofilledVariables.push({ node, pos });
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (autofilledVariables.length) {
|
|
61
|
+
const tr = newState.tr;
|
|
62
|
+
autofilledVariables.reverse();
|
|
63
|
+
for (const { node, pos } of autofilledVariables) {
|
|
64
|
+
autofillVariable(
|
|
65
|
+
node,
|
|
66
|
+
pos,
|
|
67
|
+
config.autofilledValues,
|
|
68
|
+
tr,
|
|
69
|
+
newState.schema,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return tr;
|
|
73
|
+
}
|
|
74
|
+
return newState.tr;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function autofillVariable(
|
|
80
|
+
node: PNode,
|
|
81
|
+
pos: number,
|
|
82
|
+
values: { [Key: string]: string },
|
|
83
|
+
tr: Transaction,
|
|
84
|
+
schema: Schema,
|
|
85
|
+
) {
|
|
86
|
+
const autofillKey = node.attrs.autofillKey as string;
|
|
87
|
+
const value = values[autofillKey];
|
|
88
|
+
if (value) {
|
|
89
|
+
const nodeSize = node.nodeSize;
|
|
90
|
+
const valueNode = schema.text(value);
|
|
91
|
+
if (node.attrs.convertToString === true) {
|
|
92
|
+
tr.replaceRangeWith(pos, pos + nodeSize, valueNode);
|
|
93
|
+
} else {
|
|
94
|
+
tr.replaceRangeWith(pos + 1, pos + nodeSize - 1, valueNode);
|
|
95
|
+
tr.setNodeAttribute(pos, 'initialized', true);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DCT,
|
|
3
|
+
EXT,
|
|
4
|
+
RDF,
|
|
5
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
6
|
+
import {
|
|
7
|
+
createEmberNodeSpec,
|
|
8
|
+
createEmberNodeView,
|
|
9
|
+
EmberNodeConfig,
|
|
10
|
+
} from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
11
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
|
+
import {
|
|
13
|
+
DOMOutputSpec,
|
|
14
|
+
getRdfaAttrs,
|
|
15
|
+
PNode,
|
|
16
|
+
rdfaAttrSpec,
|
|
17
|
+
} from '@lblod/ember-rdfa-editor';
|
|
18
|
+
import {
|
|
19
|
+
hasRdfaVariableType,
|
|
20
|
+
isVariable,
|
|
21
|
+
parseLabel,
|
|
22
|
+
parseVariableInstance,
|
|
23
|
+
parseVariableType,
|
|
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';
|
|
26
|
+
import type { ComponentLike } from '@glint/template';
|
|
27
|
+
import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
28
|
+
import { renderRdfaAware } from '@lblod/ember-rdfa-editor/core/schema';
|
|
29
|
+
import { sayDataFactory } from '@lblod/ember-rdfa-editor/core/say-data-factory';
|
|
30
|
+
|
|
31
|
+
const CONTENT_SELECTOR = `span[property~='${EXT('content').prefixed}'],
|
|
32
|
+
span[property~='${EXT('content').full}']`;
|
|
33
|
+
const rdfaAware = true;
|
|
34
|
+
const parseDOM = [
|
|
35
|
+
{
|
|
36
|
+
tag: 'span',
|
|
37
|
+
getAttrs: (node: HTMLElement) => {
|
|
38
|
+
const attrs = getRdfaAttrs(node, { rdfaAware });
|
|
39
|
+
if (!attrs) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (
|
|
43
|
+
hasOutgoingNamedNodeTriple(attrs, RDF('type'), EXT('Mapping')) &&
|
|
44
|
+
node.querySelector('[data-content-container="true"]') &&
|
|
45
|
+
hasRdfaVariableType(attrs, 'autofilled')
|
|
46
|
+
) {
|
|
47
|
+
if (attrs.rdfaNodeType !== 'resource') {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const autofillKey = node.dataset.autofillKey;
|
|
51
|
+
const convertToString = node.dataset.convertToString === 'true';
|
|
52
|
+
const initialized = node.dataset.initialized === 'true';
|
|
53
|
+
return {
|
|
54
|
+
...attrs,
|
|
55
|
+
autofillKey,
|
|
56
|
+
convertToString,
|
|
57
|
+
initialized,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return false;
|
|
62
|
+
},
|
|
63
|
+
contentElement: '[data-content-container="true"]',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
tag: 'span',
|
|
67
|
+
getAttrs: (node: HTMLElement) => {
|
|
68
|
+
if (
|
|
69
|
+
isVariable(node) &&
|
|
70
|
+
node.querySelector(CONTENT_SELECTOR) &&
|
|
71
|
+
parseVariableType(node) === 'autofilled'
|
|
72
|
+
) {
|
|
73
|
+
const mappingSubject =
|
|
74
|
+
node.getAttribute('subject') ||
|
|
75
|
+
node.getAttribute('resource') ||
|
|
76
|
+
node.getAttribute('about');
|
|
77
|
+
if (!mappingSubject) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const variableInstance = parseVariableInstance(node);
|
|
81
|
+
const label = parseLabel(node);
|
|
82
|
+
const autofillKey = node.dataset.autofillKey;
|
|
83
|
+
const convertToString = node.dataset.convertToString === 'true';
|
|
84
|
+
const initialized = node.dataset.initialized === 'true';
|
|
85
|
+
return {
|
|
86
|
+
__rdfaId: uuidv4(),
|
|
87
|
+
subject: mappingSubject,
|
|
88
|
+
rdfaNodeType: 'resource',
|
|
89
|
+
properties: [
|
|
90
|
+
{
|
|
91
|
+
predicate: RDF('type').full,
|
|
92
|
+
object: sayDataFactory.namedNode(EXT('Mapping').full),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
predicate: EXT('instance').full,
|
|
96
|
+
object: sayDataFactory.namedNode(
|
|
97
|
+
variableInstance ??
|
|
98
|
+
`http://data.lblod.info/variables/${uuidv4()}`,
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
predicate: EXT('label').full,
|
|
103
|
+
object: sayDataFactory.literal(label || ''),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
predicate: DCT('type').full,
|
|
107
|
+
object: sayDataFactory.literal('autofilled'),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
predicate: EXT('content').full,
|
|
111
|
+
object: sayDataFactory.contentLiteral(),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
autofillKey,
|
|
115
|
+
convertToString,
|
|
116
|
+
initialized,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
},
|
|
122
|
+
contentElement: CONTENT_SELECTOR,
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
const toDOM = (node: PNode): DOMOutputSpec => {
|
|
127
|
+
return renderRdfaAware({
|
|
128
|
+
renderable: node,
|
|
129
|
+
tag: 'span',
|
|
130
|
+
attrs: {
|
|
131
|
+
...node.attrs,
|
|
132
|
+
'data-autofill-key': node.attrs.autofillKey,
|
|
133
|
+
'data-convert-to-string': node.attrs.convertToString,
|
|
134
|
+
'data-initialized': node.attrs.initialized,
|
|
135
|
+
},
|
|
136
|
+
content: 0,
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const emberNodeConfig: EmberNodeConfig = {
|
|
141
|
+
name: 'autofilled-variable',
|
|
142
|
+
component: AutofilledNodeViewComponent as unknown as ComponentLike,
|
|
143
|
+
inline: true,
|
|
144
|
+
group: 'inline variable',
|
|
145
|
+
content: 'inline*',
|
|
146
|
+
atom: true,
|
|
147
|
+
recreateUri: true,
|
|
148
|
+
uriAttributes: ['variableInstance'],
|
|
149
|
+
draggable: false,
|
|
150
|
+
needsFFKludge: true,
|
|
151
|
+
editable: true,
|
|
152
|
+
selectable: true,
|
|
153
|
+
attrs: {
|
|
154
|
+
...rdfaAttrSpec({ rdfaAware }),
|
|
155
|
+
autofillKey: {
|
|
156
|
+
default: '',
|
|
157
|
+
},
|
|
158
|
+
convertToString: {
|
|
159
|
+
default: false,
|
|
160
|
+
},
|
|
161
|
+
initialized: {
|
|
162
|
+
default: false,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
toDOM,
|
|
166
|
+
parseDOM,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const autofilled_variable = createEmberNodeSpec(emberNodeConfig);
|
|
170
|
+
export const autofilledVariableView = createEmberNodeView(emberNodeConfig);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/autofilled/edit';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/autofilled/insert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/variable-plugin/autofilled/nodeview';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import IntlService from 'ember-intl/services/intl';
|
|
4
|
+
type Args = {
|
|
5
|
+
controller: SayController;
|
|
6
|
+
};
|
|
7
|
+
export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
8
|
+
intl: IntlService;
|
|
9
|
+
convertToString: boolean;
|
|
10
|
+
autofillKey?: string;
|
|
11
|
+
label: string;
|
|
12
|
+
get selectedVariable(): {
|
|
13
|
+
node: import("prosemirror-model").Node;
|
|
14
|
+
pos: number;
|
|
15
|
+
} | null;
|
|
16
|
+
get autofillKeyAttr(): any;
|
|
17
|
+
get convertToStringAttr(): any;
|
|
18
|
+
get labelAttr(): string | undefined;
|
|
19
|
+
get showCard(): boolean;
|
|
20
|
+
get controller(): SayController;
|
|
21
|
+
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
22
|
+
get documentLanguage(): string;
|
|
23
|
+
updateLabel(event: InputEvent): void;
|
|
24
|
+
updateAutofillKey(event: InputEvent): void;
|
|
25
|
+
updateConvertToString(value: boolean): void;
|
|
26
|
+
edit(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import IntlService from 'ember-intl/services/intl';
|
|
4
|
+
type Args = {
|
|
5
|
+
controller: SayController;
|
|
6
|
+
};
|
|
7
|
+
export default class AutoFilledVariableInsertComponent extends Component<Args> {
|
|
8
|
+
intl: IntlService;
|
|
9
|
+
label: string;
|
|
10
|
+
autofillKey?: string;
|
|
11
|
+
convertToString?: boolean;
|
|
12
|
+
get controller(): SayController;
|
|
13
|
+
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
14
|
+
get documentLanguage(): string;
|
|
15
|
+
updateLabel(event: InputEvent): void;
|
|
16
|
+
updateAutofillKey(event: InputEvent): void;
|
|
17
|
+
updateConvertToString(value: boolean): void;
|
|
18
|
+
insert(): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
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 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types=".pnpm/ember-source@4.12.0_@babel+core@7.24.7_@glimmer+component@1.1.2_@babel+core@7.24.7__@glint+template@1.4.0_webpack@5.92.1/node_modules/ember-source/types/stable/@ember/component/template-only" />
|
|
2
|
+
/// <reference types="@glint/environment-ember-loose/-private/dsl/integration-declarations" />
|
|
3
|
+
import { TemplateOnlyComponent } from '@ember/component/template-only';
|
|
4
|
+
interface Sig {
|
|
5
|
+
Args: {
|
|
6
|
+
label: string;
|
|
7
|
+
updateLabel: (event: InputEvent) => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare const LabelInput: TemplateOnlyComponent<Sig>;
|
|
11
|
+
export default LabelInput;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const autofilled_variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
2
|
+
export declare const autofilledVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "23.0.
|
|
3
|
+
"version": "23.1.0-dev.7bb598372e1d150f34e69ae52ed021a0f4f2fd7b",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@codemirror/state": "^6.4.1",
|
|
56
56
|
"@codemirror/view": "^6.28.3",
|
|
57
57
|
"@curvenote/prosemirror-utils": "^1.0.5",
|
|
58
|
+
"@embroider/macros": "^1.16.5",
|
|
58
59
|
"@lblod/marawa": "0.8.0-beta.6",
|
|
59
60
|
"@rdfjs/data-model": "^2.0.2",
|
|
60
61
|
"@rdfjs/dataset": "^2.0.2",
|
package/pnpm-lock.yaml
CHANGED
|
@@ -23,6 +23,9 @@ importers:
|
|
|
23
23
|
'@curvenote/prosemirror-utils':
|
|
24
24
|
specifier: ^1.0.5
|
|
25
25
|
version: 1.0.5(prosemirror-model@1.21.3)(prosemirror-state@1.4.3)
|
|
26
|
+
'@embroider/macros':
|
|
27
|
+
specifier: ^1.16.5
|
|
28
|
+
version: 1.16.5(@glint/template@1.4.0)
|
|
26
29
|
'@lblod/marawa':
|
|
27
30
|
specifier: 0.8.0-beta.6
|
|
28
31
|
version: 0.8.0-beta.6
|
|
@@ -2602,8 +2605,8 @@ packages:
|
|
|
2602
2605
|
async@2.6.4:
|
|
2603
2606
|
resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==}
|
|
2604
2607
|
|
|
2605
|
-
async@3.2.
|
|
2606
|
-
resolution: {integrity: sha512-
|
|
2608
|
+
async@3.2.6:
|
|
2609
|
+
resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==}
|
|
2607
2610
|
|
|
2608
2611
|
at-least-node@1.0.0:
|
|
2609
2612
|
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==}
|
|
@@ -3891,8 +3894,8 @@ packages:
|
|
|
3891
3894
|
resolution: {integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==}
|
|
3892
3895
|
engines: {node: '>=0.4', npm: '>=1.2'}
|
|
3893
3896
|
|
|
3894
|
-
dompurify@3.1.
|
|
3895
|
-
resolution: {integrity: sha512-
|
|
3897
|
+
dompurify@3.1.7:
|
|
3898
|
+
resolution: {integrity: sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==}
|
|
3896
3899
|
|
|
3897
3900
|
dot-case@3.0.4:
|
|
3898
3901
|
resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==}
|
|
@@ -7267,8 +7270,8 @@ packages:
|
|
|
7267
7270
|
property-expr@2.0.6:
|
|
7268
7271
|
resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==}
|
|
7269
7272
|
|
|
7270
|
-
prosemirror-commands@1.
|
|
7271
|
-
resolution: {integrity: sha512-
|
|
7273
|
+
prosemirror-commands@1.6.0:
|
|
7274
|
+
resolution: {integrity: sha512-xn1U/g36OqXn2tn5nGmvnnimAj/g1pUx2ypJJIe8WkVX83WyJVC5LTARaxZa2AtQRwntu9Jc5zXs9gL9svp/mg==}
|
|
7272
7275
|
|
|
7273
7276
|
prosemirror-dev-tools@4.1.0:
|
|
7274
7277
|
resolution: {integrity: sha512-TqMyXLiY8EUoq4f4LV+8dQVuRejwGfeOJdJWjrHNXR9ttKy3MVYBCqmiu3CDULgjv8gtLsqoZY6+ab6BZRmr1g==}
|
|
@@ -7280,8 +7283,8 @@ packages:
|
|
|
7280
7283
|
prosemirror-dropcursor@1.8.1:
|
|
7281
7284
|
resolution: {integrity: sha512-M30WJdJZLyXHi3N8vxN6Zh5O8ZBbQCz0gURTfPmTIBNQ5pxrdU7A58QkNqfa98YEjSAL1HUyyU34f6Pm5xBSGw==}
|
|
7282
7285
|
|
|
7283
|
-
prosemirror-history@1.4.
|
|
7284
|
-
resolution: {integrity: sha512-
|
|
7286
|
+
prosemirror-history@1.4.1:
|
|
7287
|
+
resolution: {integrity: sha512-2JZD8z2JviJrboD9cPuX/Sv/1ChFng+xh2tChQ2X4bB2HeK+rra/bmJ3xGntCcjhOqIzSDG6Id7e8RJ9QPXLEQ==}
|
|
7285
7288
|
|
|
7286
7289
|
prosemirror-inputrules@1.4.0:
|
|
7287
7290
|
resolution: {integrity: sha512-6ygpPRuTJ2lcOXs9JkefieMst63wVJBgHZGl5QOytN7oSZs3Co/BYbc3Yx9zm9H37Bxw8kVzCnDsihsVsL4yEg==}
|
|
@@ -7292,11 +7295,11 @@ packages:
|
|
|
7292
7295
|
prosemirror-model@1.21.3:
|
|
7293
7296
|
resolution: {integrity: sha512-nt2Xs/RNGepD9hrrkzXvtCm1mpGJoQfFSPktGa0BF/aav6XsnmVGZ9sTXNWRLupAz5SCLa3EyKlFeK7zJWROKg==}
|
|
7294
7297
|
|
|
7295
|
-
prosemirror-schema-basic@1.2.
|
|
7296
|
-
resolution: {integrity: sha512
|
|
7298
|
+
prosemirror-schema-basic@1.2.3:
|
|
7299
|
+
resolution: {integrity: sha512-h+H0OQwZVqMon1PNn0AG9cTfx513zgIG2DY00eJ00Yvgb3UD+GQ/VlWW5rcaxacpCGT1Yx8nuhwXk4+QbXUfJA==}
|
|
7297
7300
|
|
|
7298
|
-
prosemirror-schema-list@1.4.
|
|
7299
|
-
resolution: {integrity: sha512-
|
|
7301
|
+
prosemirror-schema-list@1.4.1:
|
|
7302
|
+
resolution: {integrity: sha512-jbDyaP/6AFfDfu70VzySsD75Om2t3sXTOdl5+31Wlxlg62td1haUpty/ybajSfJ1pkGadlOfwQq9kgW5IMo1Rg==}
|
|
7300
7303
|
|
|
7301
7304
|
prosemirror-state@1.4.3:
|
|
7302
7305
|
resolution: {integrity: sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==}
|
|
@@ -10749,7 +10752,7 @@ snapshots:
|
|
|
10749
10752
|
common-tags: 1.8.2
|
|
10750
10753
|
crypto-browserify: 3.12.0
|
|
10751
10754
|
debug: 4.3.5
|
|
10752
|
-
dompurify: 3.1.
|
|
10755
|
+
dompurify: 3.1.7
|
|
10753
10756
|
ember-auto-import: 2.7.4(@glint/template@1.4.0)(webpack@5.92.1)
|
|
10754
10757
|
ember-changeset: 4.1.2(@glint/template@1.4.0)(webpack@5.92.1)
|
|
10755
10758
|
ember-cli-babel: 8.2.0(@babel/core@7.24.7)
|
|
@@ -10769,14 +10772,14 @@ snapshots:
|
|
|
10769
10772
|
linkifyjs: 4.1.3
|
|
10770
10773
|
mdn-polyfills: 5.20.0
|
|
10771
10774
|
process: 0.11.10
|
|
10772
|
-
prosemirror-commands: 1.
|
|
10775
|
+
prosemirror-commands: 1.6.0
|
|
10773
10776
|
prosemirror-dropcursor: 1.8.1
|
|
10774
|
-
prosemirror-history: 1.4.
|
|
10777
|
+
prosemirror-history: 1.4.1
|
|
10775
10778
|
prosemirror-inputrules: 1.4.0
|
|
10776
10779
|
prosemirror-keymap: 1.2.2
|
|
10777
10780
|
prosemirror-model: 1.21.3
|
|
10778
|
-
prosemirror-schema-basic: 1.2.
|
|
10779
|
-
prosemirror-schema-list: 1.4.
|
|
10781
|
+
prosemirror-schema-basic: 1.2.3
|
|
10782
|
+
prosemirror-schema-list: 1.4.1
|
|
10780
10783
|
prosemirror-state: 1.4.3
|
|
10781
10784
|
prosemirror-transform: 1.9.0
|
|
10782
10785
|
prosemirror-view: 1.33.8
|
|
@@ -12105,7 +12108,7 @@ snapshots:
|
|
|
12105
12108
|
dependencies:
|
|
12106
12109
|
lodash: 4.17.21
|
|
12107
12110
|
|
|
12108
|
-
async@3.2.
|
|
12111
|
+
async@3.2.6: {}
|
|
12109
12112
|
|
|
12110
12113
|
at-least-node@1.0.0: {}
|
|
12111
12114
|
|
|
@@ -13778,7 +13781,7 @@ snapshots:
|
|
|
13778
13781
|
|
|
13779
13782
|
domain-browser@1.2.0: {}
|
|
13780
13783
|
|
|
13781
|
-
dompurify@3.1.
|
|
13784
|
+
dompurify@3.1.7: {}
|
|
13782
13785
|
|
|
13783
13786
|
dot-case@3.0.4:
|
|
13784
13787
|
dependencies:
|
|
@@ -16134,7 +16137,7 @@ snapshots:
|
|
|
16134
16137
|
|
|
16135
16138
|
handlebars-loader@1.7.3(handlebars@4.7.8):
|
|
16136
16139
|
dependencies:
|
|
16137
|
-
async: 3.2.
|
|
16140
|
+
async: 3.2.6
|
|
16138
16141
|
fastparse: 1.1.2
|
|
16139
16142
|
handlebars: 4.7.8
|
|
16140
16143
|
loader-utils: 1.4.2
|
|
@@ -18253,7 +18256,7 @@ snapshots:
|
|
|
18253
18256
|
|
|
18254
18257
|
property-expr@2.0.6: {}
|
|
18255
18258
|
|
|
18256
|
-
prosemirror-commands@1.
|
|
18259
|
+
prosemirror-commands@1.6.0:
|
|
18257
18260
|
dependencies:
|
|
18258
18261
|
prosemirror-model: 1.21.3
|
|
18259
18262
|
prosemirror-state: 1.4.3
|
|
@@ -18293,7 +18296,7 @@ snapshots:
|
|
|
18293
18296
|
prosemirror-transform: 1.9.0
|
|
18294
18297
|
prosemirror-view: 1.33.8
|
|
18295
18298
|
|
|
18296
|
-
prosemirror-history@1.4.
|
|
18299
|
+
prosemirror-history@1.4.1:
|
|
18297
18300
|
dependencies:
|
|
18298
18301
|
prosemirror-state: 1.4.3
|
|
18299
18302
|
prosemirror-transform: 1.9.0
|
|
@@ -18314,11 +18317,11 @@ snapshots:
|
|
|
18314
18317
|
dependencies:
|
|
18315
18318
|
orderedmap: 2.1.1
|
|
18316
18319
|
|
|
18317
|
-
prosemirror-schema-basic@1.2.
|
|
18320
|
+
prosemirror-schema-basic@1.2.3:
|
|
18318
18321
|
dependencies:
|
|
18319
18322
|
prosemirror-model: 1.21.3
|
|
18320
18323
|
|
|
18321
|
-
prosemirror-schema-list@1.4.
|
|
18324
|
+
prosemirror-schema-list@1.4.1:
|
|
18322
18325
|
dependencies:
|
|
18323
18326
|
prosemirror-model: 1.21.3
|
|
18324
18327
|
prosemirror-state: 1.4.3
|
package/translations/en-US.yaml
CHANGED
|
@@ -254,6 +254,8 @@ variable:
|
|
|
254
254
|
label: address
|
|
255
255
|
person:
|
|
256
256
|
label: person
|
|
257
|
+
autofilled:
|
|
258
|
+
label: autofilled
|
|
257
259
|
variable-plugin:
|
|
258
260
|
insert-variable: Insert variable
|
|
259
261
|
button: Insert
|
|
@@ -269,6 +271,10 @@ variable-plugin:
|
|
|
269
271
|
person:
|
|
270
272
|
card-title: Insert person
|
|
271
273
|
nodeview-placeholder: Insert person
|
|
274
|
+
autofill:
|
|
275
|
+
autofillKey: Autofill Key
|
|
276
|
+
convertToString: Replace variable node with plain text on text insertion
|
|
277
|
+
autofillKeyPlaceholder: Autofill Key
|
|
272
278
|
|
|
273
279
|
table-of-contents-plugin:
|
|
274
280
|
title: Table of Contents
|
package/translations/nl-BE.yaml
CHANGED
|
@@ -258,6 +258,8 @@ variable:
|
|
|
258
258
|
label: adres
|
|
259
259
|
person:
|
|
260
260
|
label: persoon
|
|
261
|
+
autofilled:
|
|
262
|
+
label: automatisch ingevuld
|
|
261
263
|
variable-plugin:
|
|
262
264
|
insert-variable: Voeg variabele in
|
|
263
265
|
button: Voeg in
|
|
@@ -273,6 +275,10 @@ variable-plugin:
|
|
|
273
275
|
person:
|
|
274
276
|
card-title: Persoon invoegen
|
|
275
277
|
nodeview-placeholder: Voeg persoon in
|
|
278
|
+
autofill:
|
|
279
|
+
autofillKey: Sleutelwaarde
|
|
280
|
+
convertToString: Vervang variabele door platte tekst bij invoegen
|
|
281
|
+
autofillKeyPlaceholder: Sleutelwaarde
|
|
276
282
|
dummy:
|
|
277
283
|
validation-card:
|
|
278
284
|
title: Documentvalidatie
|