@lblod/ember-rdfa-editor-lblod-plugins 8.2.1 → 8.3.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.
Files changed (50) hide show
  1. package/.woodpecker/.test.yml +5 -0
  2. package/CHANGELOG.md +30 -1
  3. package/addon/components/citation-plugin/citations/search-modal.hbs +18 -41
  4. package/addon/components/citation-plugin/citations/search-modal.ts +0 -17
  5. package/addon/components/pagination/pagination-view.hbs +39 -0
  6. package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +7 -1
  7. package/addon/components/snippet-plugin/helpers/alert-load-error.hbs +22 -0
  8. package/addon/components/snippet-plugin/helpers/alert-no-items.hbs +8 -0
  9. package/addon/components/snippet-plugin/search-modal.hbs +83 -0
  10. package/addon/components/snippet-plugin/search-modal.ts +97 -0
  11. package/addon/components/snippet-plugin/snippet-insert.hbs +17 -0
  12. package/addon/components/snippet-plugin/snippet-insert.ts +50 -0
  13. package/addon/components/snippet-plugin/snippets/snippet-list.hbs +12 -0
  14. package/addon/components/snippet-plugin/snippets/snippet-preview.hbs +27 -0
  15. package/addon/components/snippet-plugin/snippets/snippet-preview.ts +28 -0
  16. package/addon/helpers/pagination.ts +40 -0
  17. package/addon/plugins/citation-plugin/utils/vlaamse-codex.ts +4 -34
  18. package/addon/plugins/snippet-plugin/index.ts +27 -0
  19. package/addon/plugins/snippet-plugin/utils/fetch-data.ts +96 -0
  20. package/addon/plugins/variable-plugin/nodes.ts +15 -11
  21. package/addon/plugins/variable-plugin/utils/fetch-data.ts +6 -6
  22. package/addon/utils/sparql-helpers.ts +28 -6
  23. package/addon/utils/strings.ts +34 -0
  24. package/addon/utils/types.ts +3 -0
  25. package/app/components/pagination/pagination-view.js +1 -0
  26. package/app/components/snippet-plugin/helpers/alert-load-error.js +1 -0
  27. package/app/components/snippet-plugin/helpers/alert-no-items.js +1 -0
  28. package/app/components/snippet-plugin/search-modal.js +1 -0
  29. package/app/components/snippet-plugin/snippet-insert.js +1 -0
  30. package/app/components/snippet-plugin/snippets/snippet-list.js +1 -0
  31. package/app/components/snippet-plugin/snippets/snippet-preview.js +1 -0
  32. package/app/helpers/pagination.js +4 -0
  33. package/app/styles/snippet-plugin.scss +66 -0
  34. package/components/besluit-type-plugin/toolbar-dropdown.d.ts +1 -1
  35. package/components/citation-plugin/citations/search-modal.d.ts +0 -4
  36. package/components/snippet-plugin/search-modal.d.ts +22 -0
  37. package/components/snippet-plugin/snippet-insert.d.ts +16 -0
  38. package/components/snippet-plugin/snippets/snippet-preview.d.ts +14 -0
  39. package/helpers/pagination.d.ts +25 -0
  40. package/package.json +5 -5
  41. package/plugins/snippet-plugin/index.d.ts +16 -0
  42. package/plugins/snippet-plugin/utils/fetch-data.d.ts +18 -0
  43. package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
  44. package/plugins/variable-plugin/nodes.d.ts +3 -3
  45. package/translations/en-US.yaml +23 -0
  46. package/translations/nl-BE.yaml +24 -1
  47. package/tsconfig.json +5 -13
  48. package/utils/sparql-helpers.d.ts +11 -4
  49. package/utils/strings.d.ts +2 -0
  50. package/utils/types.d.ts +2 -0
@@ -0,0 +1,27 @@
1
+ import { htmlSafe } from '@ember/template';
2
+
3
+ import { optionMapOr } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
4
+ import { dateValue } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
5
+ import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
6
+
7
+ export type SnippetPluginConfig = {
8
+ endpoint: string;
9
+ };
10
+
11
+ interface SnippetArgs {
12
+ title: string | null;
13
+ createdOn: string | null;
14
+ content: string | null;
15
+ }
16
+
17
+ export class Snippet {
18
+ content: SafeString | null;
19
+ createdOn: string | null;
20
+ title: string | null;
21
+
22
+ constructor({ title, createdOn, content }: SnippetArgs) {
23
+ this.content = optionMapOr(null, htmlSafe, content);
24
+ this.createdOn = dateValue(createdOn ?? undefined);
25
+ this.title = title;
26
+ }
27
+ }
@@ -0,0 +1,96 @@
1
+ import {
2
+ executeCountQuery,
3
+ executeQuery,
4
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/sparql-helpers';
5
+ import { Snippet } from '../index';
6
+
7
+ type Filter = { name?: string };
8
+ type Pagination = { pageNumber: number; pageSize: number };
9
+
10
+ const buildCountQuery = ({ name }: Filter) => {
11
+ return `
12
+ PREFIX dct: <http://purl.org/dc/terms/>
13
+ PREFIX pav: <http://purl.org/pav/>
14
+ PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
15
+
16
+ SELECT (COUNT(?snippetDocument) AS ?count)
17
+ WHERE {
18
+ ?snippetList a ext:SnippetList ;
19
+ ext:hasSnippet/pav:hasCurrentVersion ?snippetDocument .
20
+ ?snippetDocument dct:title ?title ;
21
+ ext:editorDocumentContent ?content ;
22
+ pav:createdOn ?createdOn .
23
+ ${name ? `FILTER (CONTAINS(LCASE(?title), "${name}"))` : ''}
24
+ }
25
+ `;
26
+ };
27
+
28
+ const buildFetchQuery = ({
29
+ filter: { name },
30
+ pagination: { pageSize, pageNumber },
31
+ }: {
32
+ filter: Filter;
33
+ pagination: Pagination;
34
+ }) => {
35
+ return `
36
+ PREFIX dct: <http://purl.org/dc/terms/>
37
+ PREFIX pav: <http://purl.org/pav/>
38
+ PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
39
+
40
+ SELECT DISTINCT ?title ?content ?createdOn
41
+ WHERE {
42
+ ?snippetList a ext:SnippetList ;
43
+ ext:hasSnippet/pav:hasCurrentVersion ?snippetDocument .
44
+ ?snippetDocument dct:title ?title ;
45
+ ext:editorDocumentContent ?content ;
46
+ pav:createdOn ?createdOn .
47
+ ${name ? `FILTER (CONTAINS(LCASE(?title), "${name}"))` : ''}
48
+ }
49
+ ORDER BY DESC(?createdOn) LIMIT ${pageSize} OFFSET ${
50
+ pageNumber * pageSize
51
+ }
52
+ `;
53
+ };
54
+
55
+ export const fetchSnippets = async ({
56
+ endpoint,
57
+ abortSignal,
58
+ filter,
59
+ pagination,
60
+ }: {
61
+ endpoint: string;
62
+ abortSignal: AbortSignal;
63
+ filter: Filter;
64
+ pagination: Pagination;
65
+ }) => {
66
+ const totalCount = await executeCountQuery({
67
+ endpoint,
68
+ query: buildCountQuery(filter),
69
+ abortSignal,
70
+ });
71
+
72
+ if (totalCount === 0) {
73
+ return { totalCount, results: [] };
74
+ }
75
+
76
+ const queryResult = await executeQuery<{
77
+ title: { value: string };
78
+ createdOn: { value: string };
79
+ content: { value: string };
80
+ }>({
81
+ endpoint,
82
+ query: buildFetchQuery({ filter, pagination }),
83
+ abortSignal,
84
+ });
85
+
86
+ const results = queryResult.results.bindings.map(
87
+ (binding) =>
88
+ new Snippet({
89
+ title: binding.title?.value,
90
+ createdOn: binding.createdOn?.value,
91
+ content: binding.content?.value,
92
+ })
93
+ );
94
+
95
+ return { totalCount, results };
96
+ };
@@ -73,20 +73,19 @@ export const contentToDom = ({
73
73
  type,
74
74
  node,
75
75
  }: {
76
- content: string;
76
+ content: string | null;
77
77
  type: string;
78
78
  node: PNode;
79
79
  }) => {
80
80
  if (type === 'number') {
81
- if (
82
- node.attrs[WRITTEN_NUMBER_PNODE_KEY] ||
83
- Number.isNaN(Number(content)) ||
84
- content === null ||
85
- content === ''
86
- ) {
87
- return n2words(Number(content), { lang: 'nl' });
81
+ if (!Number.isNaN(Number(content)) && content !== null && content !== '') {
82
+ if (node.attrs[WRITTEN_NUMBER_PNODE_KEY]) {
83
+ return n2words(Number(content), { lang: 'nl' });
84
+ } else {
85
+ return content;
86
+ }
88
87
  } else {
89
- return content;
88
+ return 'Voeg getal in';
90
89
  }
91
90
  } else {
92
91
  return content;
@@ -137,7 +136,10 @@ export const parseAttributes = (node: HTMLElement): false | Attrs => {
137
136
  return false;
138
137
  };
139
138
 
140
- export const attributesToDOM = (node: PNode, content = null): DOMOutputSpec => {
139
+ export const attributesToDOM = (
140
+ node: PNode,
141
+ content?: string | null
142
+ ): DOMOutputSpec => {
141
143
  const {
142
144
  mappingResource,
143
145
  codelistResource,
@@ -192,7 +194,9 @@ export const attributesToDOM = (node: PNode, content = null): DOMOutputSpec => {
192
194
  content: content ? content : '',
193
195
  ...(!!datatype && { datatype: datatype as string }),
194
196
  },
195
- content ? contentToDom({ content, type: type as string, node }) : 0,
197
+ content !== undefined
198
+ ? contentToDom({ content, type: type as string, node })
199
+ : 0,
196
200
  ],
197
201
  ];
198
202
  };
@@ -43,10 +43,10 @@ export async function fetchCodeListOptions(
43
43
  endpoint: string,
44
44
  codelistUri: string
45
45
  ): Promise<CodeListOptions> {
46
- const codelistsOptionsQueryResult = await executeQuery(
46
+ const codelistsOptionsQueryResult = await executeQuery({
47
47
  endpoint,
48
- generateCodeListOptionsQuery(codelistUri)
49
- );
48
+ query: generateCodeListOptionsQuery(codelistUri),
49
+ });
50
50
  const options = parseCodelistOptions(codelistsOptionsQueryResult);
51
51
  return {
52
52
  type:
@@ -95,10 +95,10 @@ export async function fetchCodeListsByPublisher(
95
95
  endpoint: string,
96
96
  publisher: string
97
97
  ): Promise<CodeList[]> {
98
- const codelistsOptionsQueryResult = await executeQuery(
98
+ const codelistsOptionsQueryResult = await executeQuery({
99
99
  endpoint,
100
- generateCodeListsByPublisherQuery(publisher)
101
- );
100
+ query: generateCodeListsByPublisherQuery(publisher),
101
+ });
102
102
  const bindings = codelistsOptionsQueryResult.results.bindings;
103
103
  return bindings.map((binding) => ({
104
104
  uri: binding['uri']?.value,
@@ -1,13 +1,25 @@
1
1
  import * as RDF from '@rdfjs/types';
2
+ import { optionMapOr } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
2
3
 
3
- export type QueryResult = {
4
+ export interface QueryResult<Binding = Record<string, RDF.Term>> {
4
5
  results: {
5
- bindings: Record<string, RDF.Term>[];
6
+ bindings: Binding[];
6
7
  };
7
- };
8
+ }
9
+
10
+ interface QueryConfig {
11
+ query: string;
12
+ endpoint: string;
13
+ abortSignal?: AbortSignal;
14
+ }
8
15
 
9
- export async function executeQuery(endpoint: string, query: string) {
16
+ export async function executeQuery<Binding = Record<string, RDF.Term>>({
17
+ query,
18
+ endpoint,
19
+ abortSignal,
20
+ }: QueryConfig) {
10
21
  const encodedQuery = encodeURIComponent(query.trim());
22
+
11
23
  const response = await fetch(endpoint, {
12
24
  method: 'POST',
13
25
  mode: 'cors',
@@ -16,12 +28,22 @@ export async function executeQuery(endpoint: string, query: string) {
16
28
  'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
17
29
  },
18
30
  body: `query=${encodedQuery}`,
31
+ signal: abortSignal,
19
32
  });
33
+
20
34
  if (response.ok) {
21
- return response.json() as unknown as QueryResult;
35
+ return response.json() as Promise<QueryResult<Binding>>;
22
36
  } else {
23
37
  throw new Error(
24
- `Request to MOW backend was unsuccessful: [${response.status}] ${response.statusText}`
38
+ `Request to ${endpoint} was unsuccessful: [${response.status}] ${response.statusText}`
25
39
  );
26
40
  }
27
41
  }
42
+
43
+ export async function executeCountQuery(queryConfig: QueryConfig) {
44
+ const response = await executeQuery<{ count: { value: string } }>(
45
+ queryConfig
46
+ );
47
+
48
+ return optionMapOr(0, parseInt, response.results.bindings[0]?.count.value);
49
+ }
@@ -0,0 +1,34 @@
1
+ import { warn } from '@ember/debug';
2
+
3
+ export function escapeValue(value?: string) {
4
+ if (value) {
5
+ const shadowDomElement = document.createElement('textarea');
6
+ shadowDomElement.innerHTML = value;
7
+ return shadowDomElement.textContent;
8
+ } else {
9
+ return null;
10
+ }
11
+ }
12
+
13
+ export function dateValue(value?: string): string | null {
14
+ if (value) {
15
+ try {
16
+ return new Intl.DateTimeFormat('nl-BE').format(
17
+ new Date(Date.parse(value))
18
+ );
19
+ } catch (e) {
20
+ let message: string;
21
+ if (e instanceof Error) {
22
+ message = e.message;
23
+ } else {
24
+ message = e as string;
25
+ }
26
+ warn(`Error parsing date ${value}: ${message}`, {
27
+ id: 'date-parsing-error',
28
+ });
29
+ return null;
30
+ }
31
+ } else {
32
+ return null;
33
+ }
34
+ }
@@ -0,0 +1,3 @@
1
+ import { htmlSafe } from '@ember/template';
2
+
3
+ export type SafeString = ReturnType<typeof htmlSafe>;
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/pagination/pagination-view';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/helpers/alert-load-error';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/helpers/alert-no-items';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/search-modal';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/snippet-insert';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/snippets/snippet-list';
@@ -0,0 +1 @@
1
+ export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/snippet-plugin/snippets/snippet-preview';
@@ -0,0 +1,4 @@
1
+ export {
2
+ default,
3
+ pagination,
4
+ } from '@lblod/ember-rdfa-editor-lblod-plugins/helpers/pagination';
@@ -0,0 +1,66 @@
1
+ .snippet-modal {
2
+ &--main-container {
3
+ height: 100% !important;
4
+
5
+ background-color: var(--au-gray-100);
6
+
7
+ .au-c-sidebar {
8
+ border-right: 0;
9
+ }
10
+
11
+ #content {
12
+ display: flex;
13
+ flex-direction: column;
14
+ }
15
+ }
16
+
17
+ &--list-container {
18
+ overflow: auto;
19
+ flex-grow: 1;
20
+ }
21
+
22
+ &--error-code {
23
+ font-family: var(--au-font-tertiary);
24
+ }
25
+ }
26
+
27
+ .snippet-preview {
28
+ &--container {
29
+ flex-direction: row;
30
+ }
31
+
32
+ &--article {
33
+ flex-grow: 1;
34
+
35
+ .say-editor__paper,
36
+ .say-editor__inner {
37
+ min-height: auto;
38
+ white-space: inherit;
39
+ }
40
+
41
+ .say-editor,
42
+ .say-editor__inner {
43
+ padding: 0;
44
+ }
45
+ }
46
+
47
+ &--title {
48
+ color: var(--au-gray-700);
49
+ font-weight: var(--au-medium);
50
+ }
51
+
52
+ &--button {
53
+ border-left: 1px solid var(--au-gray-200);
54
+ }
55
+
56
+ &--editor-overlay {
57
+ position: absolute !important;
58
+ top: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ }
62
+
63
+ &--editor-container {
64
+ position: relative;
65
+ }
66
+ }
@@ -30,7 +30,7 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
30
30
  constructor(parent: unknown, args: Args);
31
31
  get controller(): SayController;
32
32
  get doc(): import("prosemirror-model").Node;
33
- types: import("ember-resources/util/function").State<BesluitType[]>;
33
+ types: import("ember-resources/util/function").State<Promise<BesluitType[]>>;
34
34
  get currentBesluitRange(): ResolvedPNode | undefined;
35
35
  get currentBesluitURI(): string | undefined;
36
36
  get showCard(): boolean;
@@ -49,10 +49,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
49
49
  endpoint: string;
50
50
  };
51
51
  get searchText(): string;
52
- get rangeStart(): number;
53
- get rangeEnd(): number;
54
- get isFirstPage(): boolean;
55
- get isLastPage(): boolean;
56
52
  resourceSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Decision[]>>;
57
53
  decisionResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
58
54
  setInputSearchText(event: InputEvent): void;
@@ -0,0 +1,22 @@
1
+ import Component from '@glimmer/component';
2
+ import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
3
+ interface Args {
4
+ config: SnippetPluginConfig;
5
+ closeModal: () => void;
6
+ }
7
+ export default class SnippetPluginSearchModalComponent extends Component<Args> {
8
+ inputSearchText: string | null;
9
+ error: unknown;
10
+ pageNumber: number;
11
+ pageSize: number;
12
+ totalCount: number;
13
+ get config(): SnippetPluginConfig;
14
+ get searchText(): string | null;
15
+ setInputSearchText(event: InputEvent): void;
16
+ closeModal(): Promise<void>;
17
+ snippetsSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<import("@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin").Snippet[]>>;
18
+ snippetsResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
19
+ previousPage(): void;
20
+ nextPage(): void;
21
+ }
22
+ export {};
@@ -0,0 +1,16 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ interface Args {
5
+ controller: SayController;
6
+ config: SnippetPluginConfig;
7
+ }
8
+ export default class SnippetInsertComponent extends Component<Args> {
9
+ showModal: boolean;
10
+ get controller(): SayController;
11
+ get config(): SnippetPluginConfig;
12
+ openModal(): void;
13
+ closeModal(): void;
14
+ onInsert(content: string): void;
15
+ }
16
+ export {};
@@ -0,0 +1,14 @@
1
+ import Component from '@glimmer/component';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import { Snippet, SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
4
+ interface Args {
5
+ config: SnippetPluginConfig;
6
+ snippet: Snippet;
7
+ onInsert: (content: string) => void;
8
+ }
9
+ export default class SnippetPreviewComponent extends Component<Args> {
10
+ controller?: SayController;
11
+ get snippet(): Snippet;
12
+ onInsert(): void;
13
+ }
14
+ export {};
@@ -0,0 +1,25 @@
1
+ interface PaginationArguments {
2
+ count: number;
3
+ pageSize: number;
4
+ page: number;
5
+ }
6
+ export declare function pagination({ page, count, pageSize, }: PaginationArguments): {
7
+ count: number;
8
+ pageSize: number;
9
+ page: number;
10
+ totalPages: number;
11
+ pageStart: number;
12
+ pageEnd: number;
13
+ nextPage: number | null;
14
+ previousPage: number | null;
15
+ hasPreviousPage: boolean;
16
+ hasNextPage: boolean;
17
+ };
18
+ declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
19
+ Args: {
20
+ Positional: unknown[];
21
+ Named: PaginationArguments;
22
+ };
23
+ Return: unknown;
24
+ }>;
25
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "8.2.1",
3
+ "version": "8.3.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -50,8 +50,8 @@
50
50
  "ember-concurrency": "^2.3.7",
51
51
  "ember-mu-transform-helpers": "^2.0.0",
52
52
  "ember-power-select": "^6.0.1",
53
- "ember-resources": "^5.6.2",
54
- "ember-velcro": "^1.1.0",
53
+ "ember-resources": "^6.1.1",
54
+ "ember-velcro": "^2.1.0",
55
55
  "fetch-sparql-endpoint": "^3.0.0",
56
56
  "n2words": "^1.16.4",
57
57
  "process": "0.11.10",
@@ -69,7 +69,7 @@
69
69
  "@embroider/test-setup": "^1.8.3",
70
70
  "@glimmer/component": "^1.1.2",
71
71
  "@glimmer/tracking": "^1.1.2",
72
- "@lblod/ember-rdfa-editor": "^3.8.0",
72
+ "@lblod/ember-rdfa-editor": "^4.0.0",
73
73
  "@rdfjs/types": "^1.1.0",
74
74
  "@release-it/keep-a-changelog": "^3.1.0",
75
75
  "@tsconfig/ember": "^1.0.1",
@@ -148,7 +148,7 @@
148
148
  },
149
149
  "peerDependencies": {
150
150
  "@appuniversum/ember-appuniversum": "^2.4.2",
151
- "@lblod/ember-rdfa-editor": "^3.8.0",
151
+ "@lblod/ember-rdfa-editor": "^3.10.0",
152
152
  "ember-concurrency": "^2.3.7"
153
153
  },
154
154
  "overrides": {
@@ -0,0 +1,16 @@
1
+ import { SafeString } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/types';
2
+ export type SnippetPluginConfig = {
3
+ endpoint: string;
4
+ };
5
+ interface SnippetArgs {
6
+ title: string | null;
7
+ createdOn: string | null;
8
+ content: string | null;
9
+ }
10
+ export declare class Snippet {
11
+ content: SafeString | null;
12
+ createdOn: string | null;
13
+ title: string | null;
14
+ constructor({ title, createdOn, content }: SnippetArgs);
15
+ }
16
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Snippet } from '../index';
2
+ type Filter = {
3
+ name?: string;
4
+ };
5
+ type Pagination = {
6
+ pageNumber: number;
7
+ pageSize: number;
8
+ };
9
+ export declare const fetchSnippets: ({ endpoint, abortSignal, filter, pagination, }: {
10
+ endpoint: string;
11
+ abortSignal: AbortSignal;
12
+ filter: Filter;
13
+ pagination: Pagination;
14
+ }) => Promise<{
15
+ totalCount: number;
16
+ results: Snippet[];
17
+ }>;
18
+ export {};
@@ -2,4 +2,4 @@ import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
2
2
  import { TableOfContentsConfig } from '..';
3
3
  export declare const emberNodeConfig: (config: TableOfContentsConfig) => EmberNodeConfig;
4
4
  export declare const table_of_contents: (config: TableOfContentsConfig) => import("prosemirror-model").NodeSpec;
5
- export declare const tableOfContentsView: (config: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor/addon").SayController) => import("prosemirror-view").NodeViewConstructor;
5
+ export declare const tableOfContentsView: (config: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
@@ -26,12 +26,12 @@ export declare const getPNodeExtraAttributes: ({ node, type, }: {
26
26
  "data-written-number"?: undefined;
27
27
  };
28
28
  export declare const contentToDom: ({ content, type, node, }: {
29
- content: string;
29
+ content: string | null;
30
30
  type: string;
31
31
  node: PNode;
32
- }) => string;
32
+ }) => string | null;
33
33
  export declare const parseAttributes: (node: HTMLElement) => false | Attrs;
34
- export declare const attributesToDOM: (node: PNode, content?: null) => DOMOutputSpec;
34
+ export declare const attributesToDOM: (node: PNode, content?: string | null) => DOMOutputSpec;
35
35
  export declare const emberNodeConfig: EmberNodeConfig;
36
36
  export declare const variable: import("prosemirror-model").NodeSpec;
37
37
  export declare const variableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
@@ -228,3 +228,26 @@ generic-rdfa-variable:
228
228
  modal:
229
229
  insert: Insert
230
230
  cancel: Cancel
231
+
232
+ snippet-plugin:
233
+ insert:
234
+ title: Insert snippet
235
+ modal:
236
+ title: Choose a snippet
237
+ select: Select
238
+ search:
239
+ title: Filter on
240
+ label: Snippet name
241
+ placeholder: Type something...
242
+ alert:
243
+ loading: Loading…
244
+ no-results: No results found
245
+ error-title: Error while loading results
246
+ error-intro: 'An error occurred while loading results'
247
+ error-outro: In case this problem keeps occurring, please contact
248
+
249
+ pagination:
250
+ next: Next page
251
+ previous: Previous page
252
+ of: of
253
+ results: Results
@@ -197,7 +197,7 @@ variable:
197
197
  type-number: typ een nummer...
198
198
  error-not-integer: Enkel gehele getallen zijn toegelaten
199
199
  error-not-number: Enkel getallen zijn toegelaten
200
- error-number-between: Het getal moet tussen {minValue} en {maxValue} liggen
200
+ error-number-between: Het getal moet tussen {minValue} en {maxValue} liggen
201
201
  error-number-above: Het getal moet groter dan {minValue} zijn
202
202
  error-number-below: Het getal moet kleiner dan {maxValue} zijn
203
203
  written-number-label: Getal voluit schrijven
@@ -233,3 +233,26 @@ generic-rdfa-variable:
233
233
  modal:
234
234
  insert: Invoegen
235
235
  cancel: Terug
236
+
237
+ snippet-plugin:
238
+ insert:
239
+ title: Fragment invoegen
240
+ modal:
241
+ title: Kies een fragment
242
+ select: Selecteer
243
+ search:
244
+ title: Filter op
245
+ label: Fragmentnaam
246
+ placeholder: Typ iets...
247
+ alert:
248
+ loading: Laden…
249
+ no-results: Geen resultaten gevonden
250
+ error-title: Probleem bij het laden
251
+ error-intro: "Er is een fout opgetreden tijdens het laden van de resultaten:"
252
+ error-outro: Moest dit probleem aanhouden, neem contact op met
253
+
254
+ pagination:
255
+ next: Volgende pagina
256
+ previous: Vorige pagina
257
+ of: van
258
+ results: Resultaten