@lblod/ember-rdfa-editor-lblod-plugins 22.5.1 → 22.5.2
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/CHANGELOG.md +8 -0
- package/addon/components/snippet-plugin/nodes/snippet.gts +55 -35
- package/addon/plugins/snippet-plugin/index.ts +3 -0
- package/addon/plugins/snippet-plugin/nodes/snippet.ts +2 -1
- package/app/styles/snippet-plugin.scss +5 -0
- package/declarations/addon/plugins/snippet-plugin/index.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @lblod/ember-rdfa-editor-lblod-plugins
|
|
2
2
|
|
|
3
|
+
## 22.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#476](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/476) [`6de71f8`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/6de71f8b57e1cf5297445e288e0221707f1fbc7c) Thanks [@piemonkey](https://github.com/piemonkey)! - Add configuration option to snippet plugin to set the allowed content
|
|
8
|
+
|
|
9
|
+
- [#479](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/479) [`4755750`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/47557501ed745a274cc062bd59234736bc278ded) Thanks [@piemonkey](https://github.com/piemonkey)! - Fix bug where snippet hover buttons were not always functional on Chrome
|
|
10
|
+
|
|
3
11
|
## 22.5.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -3,8 +3,12 @@ import { on } from '@ember/modifier';
|
|
|
3
3
|
import SearchModal from '../search-modal';
|
|
4
4
|
import { tracked } from '@glimmer/tracking';
|
|
5
5
|
import { action } from '@ember/object';
|
|
6
|
+
import { TemplateOnlyComponent } from '@ember/component/template-only';
|
|
6
7
|
import t from 'ember-intl/helpers/t';
|
|
7
|
-
import
|
|
8
|
+
import { not } from 'ember-truth-helpers';
|
|
9
|
+
import AuIcon, {
|
|
10
|
+
type AuIconSignature,
|
|
11
|
+
} from '@appuniversum/ember-appuniversum/components/au-icon';
|
|
8
12
|
import { SynchronizeIcon } from '@appuniversum/ember-appuniversum/components/icons/synchronize';
|
|
9
13
|
import { BinIcon } from '@appuniversum/ember-appuniversum/components/icons/bin';
|
|
10
14
|
import { AddIcon } from '@appuniversum/ember-appuniversum/components/icons/add';
|
|
@@ -23,6 +27,33 @@ import {
|
|
|
23
27
|
import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
24
28
|
import { createAndInsertSnippet } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin/nodes/snippet';
|
|
25
29
|
|
|
30
|
+
interface ButtonSig {
|
|
31
|
+
Args: {
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
onClick: () => void;
|
|
34
|
+
icon: AuIconSignature['Args']['icon'];
|
|
35
|
+
helpText: string;
|
|
36
|
+
};
|
|
37
|
+
Element: HTMLButtonElement;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const SnippetButton: TemplateOnlyComponent<ButtonSig> = <template>
|
|
41
|
+
<button
|
|
42
|
+
class='say-snippet-button {{if @isActive "" "say-snippet-hidden"}}'
|
|
43
|
+
disabled={{(not @isActive)}}
|
|
44
|
+
type='button'
|
|
45
|
+
{{on 'click' @onClick}}
|
|
46
|
+
...attributes
|
|
47
|
+
>
|
|
48
|
+
{{#if @isActive}}
|
|
49
|
+
<AuIcon @icon={{@icon}} @size='large' {{on 'click' @onClick}} />
|
|
50
|
+
<div class='say-snippet-button-text'>
|
|
51
|
+
{{t @helpText}}
|
|
52
|
+
</div>
|
|
53
|
+
{{/if}}
|
|
54
|
+
</button>
|
|
55
|
+
</template>;
|
|
56
|
+
|
|
26
57
|
interface Signature {
|
|
27
58
|
Args: EmberNodeArgs;
|
|
28
59
|
Blocks: {
|
|
@@ -44,6 +75,7 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
44
75
|
this.showModal = false;
|
|
45
76
|
}
|
|
46
77
|
openModal() {
|
|
78
|
+
this.controller.focus();
|
|
47
79
|
this.showModal = true;
|
|
48
80
|
}
|
|
49
81
|
@action
|
|
@@ -130,44 +162,32 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
130
162
|
);
|
|
131
163
|
this.closeModal();
|
|
132
164
|
}
|
|
165
|
+
|
|
133
166
|
<template>
|
|
134
167
|
<div class='say-snippet-card'>
|
|
135
168
|
<div class='say-snippet-title'>{{this.node.attrs.title}}</div>
|
|
136
169
|
<div class='say-snippet-content'>{{yield}}</div>
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
</button>
|
|
159
|
-
<button
|
|
160
|
-
class='say-snippet-button'
|
|
161
|
-
type='button'
|
|
162
|
-
{{on 'click' this.addFragment}}
|
|
163
|
-
>
|
|
164
|
-
<AuIcon @icon={{AddIcon}} />
|
|
165
|
-
<div class='say-snippet-button-text'>
|
|
166
|
-
{{t 'snippet-plugin.snippet-node.add-fragment'}}
|
|
167
|
-
</div>
|
|
168
|
-
</button>
|
|
169
|
-
</div>
|
|
170
|
-
{{/if}}
|
|
170
|
+
<div class='say-snippet-icons' contenteditable='false'>
|
|
171
|
+
<SnippetButton
|
|
172
|
+
@icon={{SynchronizeIcon}}
|
|
173
|
+
@helpText='snippet-plugin.snippet-node.change-fragment'
|
|
174
|
+
@onClick={{this.editFragment}}
|
|
175
|
+
@isActive={{this.isActive}}
|
|
176
|
+
/>
|
|
177
|
+
<SnippetButton
|
|
178
|
+
@icon={{BinIcon}}
|
|
179
|
+
@helpText='snippet-plugin.snippet-node.remove-fragment'
|
|
180
|
+
@onClick={{this.deleteFragment}}
|
|
181
|
+
@isActive={{this.isActive}}
|
|
182
|
+
class='say-snippet-remove-button'
|
|
183
|
+
/>
|
|
184
|
+
<SnippetButton
|
|
185
|
+
@icon={{AddIcon}}
|
|
186
|
+
@helpText='snippet-plugin.snippet-node.add-fragment'
|
|
187
|
+
@onClick={{this.addFragment}}
|
|
188
|
+
@isActive={{this.isActive}}
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
171
191
|
|
|
172
192
|
</div>
|
|
173
193
|
<SearchModal
|
|
@@ -7,8 +7,11 @@ import {
|
|
|
7
7
|
import { dateValue } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
|
|
8
8
|
import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
|
|
9
9
|
|
|
10
|
+
export const DEFAULT_CONTENT_STRING = 'block+';
|
|
11
|
+
|
|
10
12
|
export type SnippetPluginConfig = {
|
|
11
13
|
endpoint: string;
|
|
14
|
+
allowedContent?: string;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
interface SnippetArgs {
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { hasOutgoingNamedNodeTriple } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
34
34
|
import { jsonParse } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
|
|
35
35
|
import {
|
|
36
|
+
DEFAULT_CONTENT_STRING,
|
|
36
37
|
type ImportedResourceMap,
|
|
37
38
|
type SnippetPluginConfig,
|
|
38
39
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
@@ -195,7 +196,7 @@ const emberNodeConfig = (options: SnippetPluginConfig): EmberNodeConfig => ({
|
|
|
195
196
|
config: { default: options },
|
|
196
197
|
},
|
|
197
198
|
component: SnippetComponent,
|
|
198
|
-
content:
|
|
199
|
+
content: options.allowedContent || DEFAULT_CONTENT_STRING,
|
|
199
200
|
serialize(node) {
|
|
200
201
|
return renderRdfaAware({
|
|
201
202
|
renderable: node,
|
|
@@ -140,6 +140,11 @@ div[typeof='besluitpublicatie:Documentonderdeel']
|
|
|
140
140
|
border-radius: 4px;
|
|
141
141
|
color: var(--au-blue-700);
|
|
142
142
|
cursor: pointer;
|
|
143
|
+
&.say-snippet-hidden {
|
|
144
|
+
color: transparent;
|
|
145
|
+
border: none;
|
|
146
|
+
cursor: auto;
|
|
147
|
+
}
|
|
143
148
|
&.say-snippet-remove-button {
|
|
144
149
|
color: var(--au-red-600);
|
|
145
150
|
border-color: var(--au-red-600);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
2
2
|
import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
|
|
3
|
+
export declare const DEFAULT_CONTENT_STRING = "block+";
|
|
3
4
|
export type SnippetPluginConfig = {
|
|
4
5
|
endpoint: string;
|
|
6
|
+
allowedContent?: string;
|
|
5
7
|
};
|
|
6
8
|
interface SnippetArgs {
|
|
7
9
|
title: string | null;
|