@lblod/ember-rdfa-editor-lblod-plugins 28.0.0 → 28.1.0

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 28.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#549](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/549) [`ab33ef7`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/ab33ef7e9ef6d237457db61d217f5286362ed74d) Thanks [@piemonkey](https://github.com/piemonkey)! - Change preview list to asynchronously load previews
8
+
9
+ ### Patch Changes
10
+
11
+ - [#551](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/551) [`f88d903`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/f88d903697e4f689a09cf2d364bf8c5b81bbbb19) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Change number variable modal to clarify the upper number is also included in the range
12
+
13
+ - [#552](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/552) [`4cf94fd`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/4cf94fd78616a141265f09e8b403923e8018cd05) Thanks [@lagartoverde](https://github.com/lagartoverde)! - Rename "citeeropschrift" to "citaat"
14
+
3
15
  ## 28.0.0
4
16
 
5
17
  ### Major Changes
@@ -1,4 +1,5 @@
1
1
  import AuButton from '@appuniversum/ember-appuniversum/components/au-button';
2
+ import AuLoader from '@appuniversum/ember-appuniversum/components/au-loader';
2
3
  import AuIcon from '@appuniversum/ember-appuniversum/components/au-icon';
3
4
  import { NavDownIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-down';
4
5
  import { NavUpIcon } from '@appuniversum/ember-appuniversum/components/icons/nav-up';
@@ -7,6 +8,8 @@ import { on } from '@ember/modifier';
7
8
  import { action } from '@ember/object';
8
9
  import Component from '@glimmer/component';
9
10
  import { tracked } from '@glimmer/tracking';
11
+ import { htmlSafe } from '@ember/template';
12
+ import { task } from 'ember-concurrency';
10
13
  import t from 'ember-intl/helpers/t';
11
14
  import { SayController } from '@lblod/ember-rdfa-editor';
12
15
  import { PreviewableDocument } from './types';
@@ -35,6 +38,9 @@ export default class DocumentPreview<
35
38
 
36
39
  @action
37
40
  togglePreview() {
41
+ if (!this.isExpanded && this.contentTask.isIdle && !this.contentTask.last) {
42
+ this.contentTask.perform();
43
+ }
38
44
  this.isExpanded = !this.isExpanded;
39
45
  }
40
46
 
@@ -46,6 +52,14 @@ export default class DocumentPreview<
46
52
  this.args.toggleFavourite?.(this.args.doc);
47
53
  };
48
54
 
55
+ contentTask = task(async () => {
56
+ const content = await this.args.doc.content;
57
+ return content && htmlSafe(content);
58
+ });
59
+ get content() {
60
+ return this.contentTask.last?.value;
61
+ }
62
+
49
63
  <template>
50
64
  <div
51
65
  class='snippet-preview {{if this.isExpanded "snippet-preview--expanded"}}'
@@ -54,7 +68,7 @@ export default class DocumentPreview<
54
68
  <div class='snippet-preview__header'>
55
69
  <div
56
70
  role='button'
57
- title={{t 'snippet-plugin.modal.preview-button.title'}}
71
+ title={{t 'common.preview-list.preview-button.title'}}
58
72
  {{on 'click' this.togglePreview}}
59
73
  {{! template-lint-disable require-presentational-children}}
60
74
  >
@@ -86,12 +100,12 @@ export default class DocumentPreview<
86
100
  </div>
87
101
  <div
88
102
  role='button'
89
- title={{t 'snippet-plugin.modal.select-button.title'}}
103
+ title={{t 'common.preview-list.select-button.title'}}
90
104
  {{on 'click' this.onInsert}}
91
105
  {{! template-lint-disable require-presentational-children}}
92
106
  >
93
107
  <AuButton class='snippet-preview__insert-button' @skin='naked'>
94
- {{t 'snippet-plugin.modal.select-button.label'}}
108
+ {{t 'common.preview-list.select-button.label'}}
95
109
  </AuButton>
96
110
  </div>
97
111
 
@@ -100,10 +114,14 @@ export default class DocumentPreview<
100
114
  <div
101
115
  class='say-editor say-content rdfa-annotations rdfa-annotations-highlight rdfa-annotations-hover snippet-preview__content'
102
116
  >
103
- {{#if @doc.content}}
104
- {{@doc.content}}
117
+ {{#if this.content}}
118
+ {{this.content}}
119
+ {{else if this.contentTask.isRunning}}
120
+ <AuLoader @hideMessage={{true}}>
121
+ {{t 'common.search.loading'}}
122
+ </AuLoader>
105
123
  {{else}}
106
- <p class='au-u-italic'>{{t 'snippet-plugin.modal.no-content'}}</p>
124
+ <p class='au-u-italic'>{{t 'common.preview-list.no-content'}}</p>
107
125
  {{/if}}
108
126
  </div>
109
127
  {{/if}}
@@ -1,19 +1,4 @@
1
- import { htmlSafe } from '@ember/template';
2
-
3
- import { optionMapOr } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
- import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
5
-
6
- interface PreviewableDocumentArgs {
1
+ export interface PreviewableDocument {
7
2
  title: string | null;
8
- content: string | null;
9
- }
10
-
11
- export class PreviewableDocument {
12
- content: SafeString | null;
13
- title: string | null;
14
-
15
- constructor({ title, content }: PreviewableDocumentArgs) {
16
- this.content = optionMapOr(null, htmlSafe, content);
17
- this.title = title;
18
- }
3
+ content: string | Promise<string | null> | null;
19
4
  }
@@ -197,7 +197,7 @@ export default class SnippetNode extends Component<Signature> {
197
197
  }
198
198
  this.controller.doCommand(
199
199
  insertSnippet({
200
- content: snippet.content?.toHTML() ?? '',
200
+ content: snippet.content ?? '',
201
201
  title: snippet.title ?? '',
202
202
  listProperties: {
203
203
  placeholderId: this.node.attrs.placeholderId,
@@ -64,7 +64,7 @@ export default class SnippetInsertComponent extends Component<Sig> {
64
64
  if (this.args.listProperties) {
65
65
  this.controller.doCommand(
66
66
  insertSnippet({
67
- content: snippet.content?.toHTML() ?? '',
67
+ content: snippet.content ?? '',
68
68
  title: snippet.title ?? '',
69
69
  listProperties: this.args.listProperties,
70
70
  allowMultipleSnippets: this.args.allowMultipleSnippets,
@@ -1,11 +1,6 @@
1
- import { htmlSafe } from '@ember/template';
2
-
3
- import {
4
- type Option,
5
- optionMapOr,
6
- } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
1
+ import { PreviewableDocument } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/documents/types';
2
+ import { type Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
7
3
  import { dateValue } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
8
- import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
9
4
 
10
5
  export const DEFAULT_CONTENT_STRING = 'block+';
11
6
 
@@ -21,13 +16,13 @@ interface SnippetArgs {
21
16
  content: string | null;
22
17
  }
23
18
 
24
- export class Snippet {
25
- content: SafeString | null;
19
+ export class Snippet implements PreviewableDocument {
20
+ content: string | null;
26
21
  createdOn: string | null;
27
22
  title: string | null;
28
23
 
29
24
  constructor({ title, createdOn, content }: SnippetArgs) {
30
- this.content = optionMapOr(null, htmlSafe, content);
25
+ this.content = content;
31
26
  this.createdOn = dateValue(createdOn ?? undefined);
32
27
  this.title = title;
33
28
  }
@@ -1,14 +1,17 @@
1
1
  import { IMPORTED_RESOURCES_ATTR } from '@lblod/ember-rdfa-editor/plugins/imported-resources';
2
2
  import { jsonParse } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
3
3
  import { type Snippet } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ import { optionMap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
5
 
5
6
  export function collateImportedResources(snippets: Snippet[]): string[] {
6
7
  const domParser = new DOMParser();
7
8
  return [
8
9
  ...new Set(
9
10
  snippets.flatMap(({ content }) => {
10
- const htmlNode =
11
- content && domParser.parseFromString(content.toString(), 'text/html');
11
+ const htmlNode = optionMap(
12
+ (some) => domParser.parseFromString(some, 'text/html'),
13
+ content,
14
+ );
12
15
  const imports = jsonParse(
13
16
  htmlNode
14
17
  ?.querySelector('[data-say-document]')
@@ -17,5 +17,7 @@ export default class DocumentPreview<Doc extends PreviewableDocument> extends Co
17
17
  togglePreview(): void;
18
18
  get isFavourite(): boolean | undefined;
19
19
  toggleFavourite: (event: MouseEvent) => void;
20
+ contentTask: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<"" | import("@ember/template").SafeString | null>>;
21
+ get content(): "" | import("@ember/template").SafeString | null | undefined;
20
22
  }
21
23
  export {};
@@ -1,11 +1,4 @@
1
- import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
2
- interface PreviewableDocumentArgs {
1
+ export interface PreviewableDocument {
3
2
  title: string | null;
4
- content: string | null;
3
+ content: string | Promise<string | null> | null;
5
4
  }
6
- export declare class PreviewableDocument {
7
- content: SafeString | null;
8
- title: string | null;
9
- constructor({ title, content }: PreviewableDocumentArgs);
10
- }
11
- export {};
@@ -1,5 +1,5 @@
1
+ import { PreviewableDocument } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/documents/types';
1
2
  import { type Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
2
- import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
3
3
  export declare const DEFAULT_CONTENT_STRING = "block+";
4
4
  export type SnippetPluginConfig = {
5
5
  endpoint: string;
@@ -11,8 +11,8 @@ interface SnippetArgs {
11
11
  createdOn: string | null;
12
12
  content: string | null;
13
13
  }
14
- export declare class Snippet {
15
- content: SafeString | null;
14
+ export declare class Snippet implements PreviewableDocument {
15
+ content: string | null;
16
16
  createdOn: string | null;
17
17
  title: string | null;
18
18
  constructor({ title, createdOn, content }: SnippetArgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "28.0.0",
3
+ "version": "28.1.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -12,6 +12,13 @@ common:
12
12
  asc: Sort ascending
13
13
  desc: Sort descending
14
14
  not-applicable: 'N/A'
15
+ preview-list:
16
+ preview-button:
17
+ title: Show preview
18
+ select-button:
19
+ label: Select
20
+ title: Insert
21
+ no-content: Does not contain any content
15
22
 
16
23
  structure-plugin:
17
24
  move-up: 'Move {structureName} up'
@@ -219,7 +226,7 @@ variable-plugin:
219
226
  minimum-placeholder: minimum value
220
227
  maximum: Maximum
221
228
  maximum-placeholder: maximum value
222
- to: to
229
+ to: to and including
223
230
  person:
224
231
  card-title: Insert person
225
232
  nodeview-placeholder: Person
@@ -255,16 +262,10 @@ snippet-plugin:
255
262
  active-lists: 'Active lists:'
256
263
  modal:
257
264
  title: Choose a snippet from {snippetListNames}
258
- preview-button:
259
- title: Show snippet preview
260
- select-button:
261
- label: Select
262
- title: Insert snippet
263
265
  search:
264
266
  title: Filter on
265
267
  label: Snippet name
266
268
  placeholder: Type something...
267
- no-content: Snippet does not contain any content
268
269
  snippet-list:
269
270
  open-modal: Manage snippet lists
270
271
  modal:
@@ -12,6 +12,13 @@ common:
12
12
  asc: Oplopend sorteren
13
13
  desc: Aflopend sorteren
14
14
  not-applicable: 'n.v.t.'
15
+ preview-list:
16
+ preview-button:
17
+ title: Preview tonen
18
+ select-button:
19
+ label: Selecteer
20
+ title: Invoegen
21
+ no-content: Bevat geen inhoud
15
22
 
16
23
  structure-plugin:
17
24
  move-up: '{structureName} naar boven verplaatsen'
@@ -43,10 +50,10 @@ structure-plugin:
43
50
 
44
51
  citaten-plugin:
45
52
  card:
46
- title: Voeg citeeropschrift toe
53
+ title: Voeg citaat toe
47
54
  suggestions: Suggesties
48
55
  insert:
49
- title: Citeeropschrift invoegen
56
+ title: Citaat invoegen
50
57
  search:
51
58
  term: Zoekterm
52
59
  government-search: Filter op bestuursorgaan
@@ -70,7 +77,7 @@ citaten-plugin:
70
77
  previous: Vorige pagina
71
78
  of: van
72
79
  references:
73
- insert: Citeeropschrift invoegen
80
+ insert: Citaat invoegen
74
81
  details: Details
75
82
  refer-whole: Verwijs naar volledig document
76
83
  refer-article: Verwijs naar artikel
@@ -223,7 +230,7 @@ variable-plugin:
223
230
  minimum-placeholder: minimumwaarde
224
231
  maximum: Maximum
225
232
  maximum-placeholder: maximumwaarde
226
- to: tot
233
+ to: tot en met
227
234
  person:
228
235
  card-title: Persoon invoegen
229
236
  nodeview-placeholder: Persoon
@@ -254,16 +261,10 @@ snippet-plugin:
254
261
  active-lists: 'Actieve lijsten:'
255
262
  modal:
256
263
  title: Kies een fragment uit {snippetListNames}
257
- preview-button:
258
- title: Preview van fragment tonen
259
- select-button:
260
- label: Selecteer
261
- title: Fragment invoegen
262
264
  search:
263
265
  title: Filter op
264
266
  label: Fragmentnaam
265
267
  placeholder: Typ iets...
266
- no-content: Fragment bevat geen inhoud
267
268
  snippet-list:
268
269
  open-modal: Fragmentlijsten beheren
269
270
  modal: