@lblod/ember-rdfa-editor-lblod-plugins 27.1.0 → 28.0.0-dev.fdff223490a881e1079b030f29100bfc3819e8aa
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/metal-glasses-reply.md +5 -0
- package/CHANGELOG.md +16 -0
- package/addon/components/common/documents/preview-list.gts +35 -0
- package/addon/components/common/documents/preview.gts +130 -0
- package/addon/components/common/documents/types.ts +4 -0
- package/addon/components/common/search/alert-load-error.gts +17 -6
- package/addon/components/common/search/alert-no-items.gts +15 -6
- package/addon/components/common/search/loading.gts +13 -0
- package/addon/components/common/vote-star-unfilled-icon.gts +25 -0
- package/addon/components/snippet-plugin/nodes/snippet.gts +4 -3
- package/addon/components/snippet-plugin/search-modal.gts +216 -0
- package/addon/components/snippet-plugin/snippet-insert.gts +7 -4
- package/addon/components/table-of-contents-plugin/ember-nodes/outline.hbs +1 -1
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.hbs +4 -1
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +9 -4
- package/addon/helpers/pagination.ts +15 -3
- package/addon/plugins/snippet-plugin/index.ts +5 -10
- package/addon/plugins/snippet-plugin/utils/collate-imported-resources.ts +5 -2
- package/addon/plugins/structure-plugin/node.ts +44 -3
- package/addon/plugins/table-of-contents-plugin/index.ts +4 -1
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +4 -4
- package/addon/plugins/table-of-contents-plugin/utils/index.ts +47 -4
- package/app/components/{snippet-plugin/snippets/snippet-list.js → common/documents/preview-list.js} +1 -1
- package/app/components/{snippet-plugin/snippets/snippet-preview.js → common/documents/preview.js} +1 -1
- package/declarations/addon/components/common/documents/preview-list.d.ts +14 -0
- package/declarations/addon/components/common/documents/preview.d.ts +23 -0
- package/declarations/addon/components/common/documents/types.d.ts +4 -0
- package/declarations/addon/components/common/search/alert-load-error.d.ts +11 -2
- package/declarations/addon/components/common/search/alert-no-items.d.ts +10 -2
- package/declarations/addon/components/common/search/loading.d.ts +5 -1
- package/declarations/addon/components/common/vote-star-unfilled-icon.d.ts +9 -0
- package/declarations/addon/components/snippet-plugin/nodes/snippet.d.ts +2 -1
- package/declarations/addon/components/snippet-plugin/search-modal.d.ts +4 -4
- package/declarations/addon/components/snippet-plugin/snippet-insert.d.ts +2 -2
- package/declarations/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
- package/declarations/addon/helpers/pagination.d.ts +4 -3
- package/declarations/addon/plugins/snippet-plugin/index.d.ts +3 -3
- package/declarations/addon/plugins/table-of-contents-plugin/index.d.ts +4 -1
- package/declarations/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +3 -3
- package/declarations/addon/plugins/table-of-contents-plugin/utils/index.d.ts +5 -7
- package/package.json +5 -5
- package/pnpm-lock.yaml +48 -56
- package/translations/en-US.yaml +7 -6
- package/translations/nl-BE.yaml +7 -6
- package/addon/components/common/search/loading.hbs +0 -3
- package/addon/components/snippet-plugin/search-modal.hbs +0 -85
- package/addon/components/snippet-plugin/search-modal.ts +0 -107
- package/addon/components/snippet-plugin/snippets/snippet-list.hbs +0 -12
- package/addon/components/snippet-plugin/snippets/snippet-preview.gts +0 -96
- package/declarations/addon/components/snippet-plugin/snippets/snippet-list.d.ts +0 -1
- package/declarations/addon/components/snippet-plugin/snippets/snippet-preview.d.ts +0 -19
|
@@ -7,12 +7,24 @@ interface PaginationArguments {
|
|
|
7
7
|
pageSize: number;
|
|
8
8
|
page: number;
|
|
9
9
|
}
|
|
10
|
+
interface PaginationResult {
|
|
11
|
+
count: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
page: number;
|
|
14
|
+
totalPages: number;
|
|
15
|
+
pageStart: number;
|
|
16
|
+
pageEnd: number;
|
|
17
|
+
nextPage: number | null;
|
|
18
|
+
previousPage: number | null;
|
|
19
|
+
hasPreviousPage: boolean;
|
|
20
|
+
hasNextPage: boolean;
|
|
21
|
+
}
|
|
10
22
|
|
|
11
23
|
export function pagination({
|
|
12
24
|
page = 0,
|
|
13
25
|
count = 0,
|
|
14
26
|
pageSize = 20,
|
|
15
|
-
}: PaginationArguments) {
|
|
27
|
+
}: PaginationArguments): PaginationResult {
|
|
16
28
|
const totalPages = count / pageSize;
|
|
17
29
|
const pageStart = page * pageSize + 1;
|
|
18
30
|
const pageEnd = Math.min((page + 1) * pageSize, count);
|
|
@@ -35,6 +47,6 @@ export function pagination({
|
|
|
35
47
|
};
|
|
36
48
|
}
|
|
37
49
|
|
|
38
|
-
export default helper<unknown[], PaginationArguments>(
|
|
39
|
-
pagination(named),
|
|
50
|
+
export default helper<unknown[], PaginationArguments, PaginationResult>(
|
|
51
|
+
(_, named) => pagination(named),
|
|
40
52
|
);
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
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]')
|
|
@@ -38,7 +38,10 @@ import {
|
|
|
38
38
|
StructureType,
|
|
39
39
|
} from './structure-types';
|
|
40
40
|
import { parseBooleanDatasetAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/dom-utils';
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
Option,
|
|
43
|
+
isSome,
|
|
44
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
42
45
|
|
|
43
46
|
const rdfaAware = true;
|
|
44
47
|
|
|
@@ -67,7 +70,46 @@ function getNumberForDisplay(number: number, romanizeNumber: boolean): string {
|
|
|
67
70
|
return number.toString();
|
|
68
71
|
}
|
|
69
72
|
}
|
|
73
|
+
function buildTocEntry(node: PNode, state: EditorState) {
|
|
74
|
+
const intlService = getIntlService(state);
|
|
75
|
+
|
|
76
|
+
const structureType = node.attrs.structureType as StructureType;
|
|
77
|
+
const number = node.attrs.number as number;
|
|
70
78
|
|
|
79
|
+
const headerFormat = node.attrs.headerFormat as string;
|
|
80
|
+
const numberString = isSome(number) ? String(number) : '';
|
|
81
|
+
|
|
82
|
+
let titleString = '';
|
|
83
|
+
if (isSome(node.attrs.title)) {
|
|
84
|
+
const parsed = parser.parseFromString(node.attrs.title, 'text/html');
|
|
85
|
+
const parsedString = parsed.body.textContent ?? '';
|
|
86
|
+
if (parsedString.length) {
|
|
87
|
+
titleString = `: ${parsedString}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (headerFormat === 'name') {
|
|
92
|
+
const structureName = getNameForStructureType(
|
|
93
|
+
structureType,
|
|
94
|
+
number,
|
|
95
|
+
node.attrs.fullLengthArticles,
|
|
96
|
+
intlService,
|
|
97
|
+
state.doc.attrs.lang,
|
|
98
|
+
);
|
|
99
|
+
if (numberString.length) {
|
|
100
|
+
return `${structureName} ${numberString}${titleString}`;
|
|
101
|
+
} else {
|
|
102
|
+
return `${structureName}${titleString}`;
|
|
103
|
+
}
|
|
104
|
+
} else if (headerFormat === 'section-symbol') {
|
|
105
|
+
const structureName = '§';
|
|
106
|
+
return `${structureName}${numberString}${titleString}`;
|
|
107
|
+
} else {
|
|
108
|
+
return `${numberString}${titleString}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const parser = new DOMParser();
|
|
71
113
|
export const emberNodeConfig: (
|
|
72
114
|
config?: StructurePluginOptions,
|
|
73
115
|
) => EmberNodeConfig = (config) => {
|
|
@@ -82,7 +124,7 @@ export const emberNodeConfig: (
|
|
|
82
124
|
isolating: true,
|
|
83
125
|
atom: false,
|
|
84
126
|
editable: rdfaAware,
|
|
85
|
-
|
|
127
|
+
tocEntry: buildTocEntry,
|
|
86
128
|
attrs: {
|
|
87
129
|
...rdfaAttrSpec({ rdfaAware }),
|
|
88
130
|
|
|
@@ -122,7 +164,6 @@ export const emberNodeConfig: (
|
|
|
122
164
|
},
|
|
123
165
|
},
|
|
124
166
|
serialize(node: PNode, state: EditorState) {
|
|
125
|
-
const parser = new DOMParser();
|
|
126
167
|
const tag = node.attrs.headerTag;
|
|
127
168
|
const structureType = node.attrs.structureType as StructureType;
|
|
128
169
|
const number = node.attrs.number as number;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type LegacyTableOfContentsConfig = {
|
|
2
2
|
nodeHierarchy: string[];
|
|
3
3
|
scrollContainer?: () => HTMLElement;
|
|
4
4
|
}[];
|
|
5
|
+
export type TableOfContentsConfig =
|
|
6
|
+
| LegacyTableOfContentsConfig
|
|
7
|
+
| { scrollContainer?: () => HTMLElement };
|
|
@@ -14,7 +14,7 @@ import { getTranslationFunction } from '@lblod/ember-rdfa-editor-lblod-plugins/u
|
|
|
14
14
|
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
15
15
|
|
|
16
16
|
export const emberNodeConfig: (
|
|
17
|
-
config
|
|
17
|
+
config?: TableOfContentsConfig,
|
|
18
18
|
) => EmberNodeConfig = (config) => {
|
|
19
19
|
return {
|
|
20
20
|
name: 'table-of-contents',
|
|
@@ -34,7 +34,7 @@ export const emberNodeConfig: (
|
|
|
34
34
|
const entries = extractOutline({
|
|
35
35
|
node: unwrap(state).doc,
|
|
36
36
|
pos: -1,
|
|
37
|
-
config: configToSerialize
|
|
37
|
+
config: configToSerialize,
|
|
38
38
|
state: unwrap(state),
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -67,7 +67,7 @@ export const emberNodeConfig: (
|
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const table_of_contents = (config
|
|
70
|
+
export const table_of_contents = (config?: TableOfContentsConfig) =>
|
|
71
71
|
createEmberNodeSpec(emberNodeConfig(config));
|
|
72
|
-
export const tableOfContentsView = (config
|
|
72
|
+
export const tableOfContentsView = (config?: TableOfContentsConfig) =>
|
|
73
73
|
createEmberNodeView(emberNodeConfig(config));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DOMOutputSpec, EditorState, PNode } from '@lblod/ember-rdfa-editor';
|
|
2
1
|
import { NodeWithPos } from '@curvenote/prosemirror-utils';
|
|
2
|
+
import { LegacyTableOfContentsConfig, TableOfContentsConfig } from '..';
|
|
3
|
+
import { DOMOutputSpec, PNode, EditorState } from '@lblod/ember-rdfa-editor';
|
|
3
4
|
|
|
4
5
|
export type OutlineEntry = {
|
|
5
6
|
content: string;
|
|
@@ -43,9 +44,51 @@ export function createTableOfContents(entries: OutlineEntry[]) {
|
|
|
43
44
|
return tableOfContents;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
export function extractOutline(args: {
|
|
48
|
+
node: PNode;
|
|
49
|
+
pos: number;
|
|
50
|
+
/** @deprecated */
|
|
51
|
+
config?: TableOfContentsConfig;
|
|
52
|
+
state: EditorState;
|
|
53
|
+
}): OutlineEntry[] {
|
|
54
|
+
const { node, pos, config, state } = args;
|
|
55
|
+
if (config && Array.isArray(config)) {
|
|
56
|
+
return extractOutlineLegacy({ ...args, config });
|
|
57
|
+
}
|
|
58
|
+
let result: OutlineEntry[] = [];
|
|
59
|
+
let parent: OutlineEntry | undefined;
|
|
60
|
+
const tocEntry = node.type.spec.tocEntry as
|
|
61
|
+
| ((node: PNode, state: EditorState) => string)
|
|
62
|
+
| string
|
|
63
|
+
| undefined;
|
|
64
|
+
if (tocEntry) {
|
|
65
|
+
let entry: string;
|
|
66
|
+
if (typeof tocEntry === 'function') {
|
|
67
|
+
entry = tocEntry(node, state);
|
|
68
|
+
} else {
|
|
69
|
+
entry = tocEntry;
|
|
70
|
+
}
|
|
71
|
+
parent = {
|
|
72
|
+
pos,
|
|
73
|
+
content: entry,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const subResults: OutlineEntry[] = [];
|
|
77
|
+
node.forEach((child, offset) => {
|
|
78
|
+
subResults.push(
|
|
79
|
+
...extractOutline({ node: child, pos: pos + 1 + offset, config, state }),
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
if (parent) {
|
|
83
|
+
parent.children = subResults;
|
|
84
|
+
result = [parent];
|
|
85
|
+
} else {
|
|
86
|
+
result = subResults;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
47
90
|
|
|
48
|
-
|
|
91
|
+
function extractOutlineLegacy({
|
|
49
92
|
node,
|
|
50
93
|
pos,
|
|
51
94
|
config,
|
|
@@ -53,7 +96,7 @@ export function extractOutline({
|
|
|
53
96
|
}: {
|
|
54
97
|
node: PNode;
|
|
55
98
|
pos: number;
|
|
56
|
-
config:
|
|
99
|
+
config: LegacyTableOfContentsConfig;
|
|
57
100
|
state: EditorState;
|
|
58
101
|
}): OutlineEntry[] {
|
|
59
102
|
let result: OutlineEntry[] = [];
|
package/app/components/{snippet-plugin/snippets/snippet-list.js → common/documents/preview-list.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/documents/preview-list';
|
package/app/components/{snippet-plugin/snippets/snippet-preview.js → common/documents/preview.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/common/documents/preview';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { PreviewableDocument } from './types';
|
|
3
|
+
interface Sig<Doc extends PreviewableDocument> {
|
|
4
|
+
Args: {
|
|
5
|
+
docs: Doc[];
|
|
6
|
+
onInsert: (toInsert: Doc) => void;
|
|
7
|
+
isFavourite?: (doc: Doc) => boolean;
|
|
8
|
+
toggleFavourite?: (doc: Doc) => void;
|
|
9
|
+
};
|
|
10
|
+
Element: HTMLDivElement;
|
|
11
|
+
}
|
|
12
|
+
export default class PreviewList<Doc extends PreviewableDocument> extends Component<Sig<Doc>> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import { PreviewableDocument } from './types';
|
|
4
|
+
interface Signature<Doc extends PreviewableDocument> {
|
|
5
|
+
Args: {
|
|
6
|
+
doc: Doc;
|
|
7
|
+
onInsert: (toInsert: Doc) => void;
|
|
8
|
+
isFavourite?: (doc: Doc) => boolean;
|
|
9
|
+
toggleFavourite?: (doc: Doc) => void;
|
|
10
|
+
};
|
|
11
|
+
Element: HTMLDivElement;
|
|
12
|
+
}
|
|
13
|
+
export default class DocumentPreview<Doc extends PreviewableDocument> extends Component<Signature<Doc>> {
|
|
14
|
+
controller?: SayController;
|
|
15
|
+
isExpanded: boolean;
|
|
16
|
+
onInsert(): void;
|
|
17
|
+
togglePreview(): void;
|
|
18
|
+
get isFavourite(): boolean | undefined;
|
|
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;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TemplateOnlyComponent } from '@ember/component/template-only';
|
|
2
|
+
import { AuAlertSignature } from '@appuniversum/ember-appuniversum/components/au-alert';
|
|
3
|
+
interface Sig {
|
|
4
|
+
Args: {
|
|
5
|
+
error: unknown;
|
|
6
|
+
fullSize?: boolean;
|
|
7
|
+
};
|
|
8
|
+
Element: AuAlertSignature['Element'];
|
|
9
|
+
}
|
|
10
|
+
declare const AlertLoadError: TemplateOnlyComponent<Sig>;
|
|
11
|
+
export default AlertLoadError;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { TemplateOnlyComponent } from '@ember/component/template-only';
|
|
2
|
+
import { AuAlertSignature } from '@appuniversum/ember-appuniversum/components/au-alert';
|
|
3
|
+
interface Sig {
|
|
4
|
+
Args: {
|
|
5
|
+
fullSize?: boolean;
|
|
6
|
+
};
|
|
7
|
+
Element: AuAlertSignature['Element'];
|
|
8
|
+
}
|
|
9
|
+
declare const AlertNoItems: TemplateOnlyComponent<Sig>;
|
|
10
|
+
export default AlertNoItems;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
export interface VoteStarUnfilledIconSignature {
|
|
3
|
+
Element: SVGSVGElement;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* There is no unfilled version in AU. Unfortunately, due to AU including a `stroke-width: 0` style
|
|
7
|
+
* for icons, this icon shouldn't be used inside an `AuIcon`, it should be used in place of one.
|
|
8
|
+
*/
|
|
9
|
+
export declare const VoteStarUnfilledIcon: TOC<VoteStarUnfilledIconSignature>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { type EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/_private/ember-node';
|
|
3
3
|
import { type PNode, type Selection, Slice } from '@lblod/ember-rdfa-editor';
|
|
4
|
+
import { Snippet } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
4
5
|
interface Signature {
|
|
5
6
|
Args: EmberNodeArgs;
|
|
6
7
|
Blocks: {
|
|
@@ -24,6 +25,6 @@ export default class SnippetNode extends Component<Signature> {
|
|
|
24
25
|
createSliceFromElement(element: Element): Slice;
|
|
25
26
|
get selection(): Selection;
|
|
26
27
|
get isActive(): boolean;
|
|
27
|
-
onInsert(
|
|
28
|
+
onInsert(snippet: Snippet): void;
|
|
28
29
|
}
|
|
29
30
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
2
|
+
import { Snippet, SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
3
3
|
interface Args {
|
|
4
4
|
config: SnippetPluginConfig;
|
|
5
5
|
snippetListUris: string[] | undefined;
|
|
6
6
|
snippetListNames: string[] | undefined;
|
|
7
7
|
closeModal: () => void;
|
|
8
8
|
open: boolean;
|
|
9
|
-
onInsert: (
|
|
9
|
+
onInsert: (snippet: Snippet) => void;
|
|
10
10
|
}
|
|
11
11
|
export default class SnippetPluginSearchModalComponent extends Component<Args> {
|
|
12
12
|
inputSearchText: string | null;
|
|
@@ -19,8 +19,8 @@ export default class SnippetPluginSearchModalComponent extends Component<Args> {
|
|
|
19
19
|
get snippetListNames(): string | undefined;
|
|
20
20
|
setInputSearchText(event: InputEvent): void;
|
|
21
21
|
closeModal(): Promise<void>;
|
|
22
|
-
snippetsSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<
|
|
23
|
-
snippetsResource: import("reactiveweb/ember-concurrency").TaskInstance<
|
|
22
|
+
snippetsSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Snippet[]>>;
|
|
23
|
+
snippetsResource: import("reactiveweb/ember-concurrency").TaskInstance<Snippet[]>;
|
|
24
24
|
previousPage(): void;
|
|
25
25
|
nextPage(): void;
|
|
26
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { type SayController, Slice } from '@lblod/ember-rdfa-editor';
|
|
3
|
-
import { SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
3
|
+
import { Snippet, SnippetPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
4
4
|
import { type SnippetListProperties } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/snippet-plugin';
|
|
5
5
|
interface Sig {
|
|
6
6
|
Args: {
|
|
@@ -17,6 +17,6 @@ export default class SnippetInsertComponent extends Component<Sig> {
|
|
|
17
17
|
openModal(): void;
|
|
18
18
|
closeModal(): void;
|
|
19
19
|
createSliceFromElement(element: Element): Slice;
|
|
20
|
-
onInsert(
|
|
20
|
+
onInsert(snippet: Snippet): void;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
package/declarations/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/pl
|
|
|
4
4
|
import IntlService from 'ember-intl/services/intl';
|
|
5
5
|
export default class TableOfContentsComponent extends Component<EmberNodeArgs> {
|
|
6
6
|
intl: IntlService;
|
|
7
|
-
get config(): TableOfContentsConfig;
|
|
7
|
+
get config(): TableOfContentsConfig | undefined;
|
|
8
8
|
get documentLanguage(): string;
|
|
9
9
|
get title(): string;
|
|
10
10
|
get controller(): import("@lblod/ember-rdfa-editor").SayController;
|
|
@@ -3,7 +3,7 @@ interface PaginationArguments {
|
|
|
3
3
|
pageSize: number;
|
|
4
4
|
page: number;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface PaginationResult {
|
|
7
7
|
count: number;
|
|
8
8
|
pageSize: number;
|
|
9
9
|
page: number;
|
|
@@ -14,12 +14,13 @@ export declare function pagination({ page, count, pageSize, }: PaginationArgumen
|
|
|
14
14
|
previousPage: number | null;
|
|
15
15
|
hasPreviousPage: boolean;
|
|
16
16
|
hasNextPage: boolean;
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
|
+
export declare function pagination({ page, count, pageSize, }: PaginationArguments): PaginationResult;
|
|
18
19
|
declare const _default: import("@ember/component/helper").FunctionBasedHelper<{
|
|
19
20
|
Args: {
|
|
20
21
|
Positional: unknown[];
|
|
21
22
|
Named: PaginationArguments;
|
|
22
23
|
};
|
|
23
|
-
Return:
|
|
24
|
+
Return: PaginationResult;
|
|
24
25
|
}>;
|
|
25
26
|
export default _default;
|
|
@@ -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:
|
|
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);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type LegacyTableOfContentsConfig = {
|
|
2
2
|
nodeHierarchy: string[];
|
|
3
3
|
scrollContainer?: () => HTMLElement;
|
|
4
4
|
}[];
|
|
5
|
+
export type TableOfContentsConfig = LegacyTableOfContentsConfig | {
|
|
6
|
+
scrollContainer?: () => HTMLElement;
|
|
7
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
2
2
|
import { TableOfContentsConfig } from '..';
|
|
3
|
-
export declare const emberNodeConfig: (config
|
|
4
|
-
export declare const table_of_contents: (config
|
|
5
|
-
export declare const tableOfContentsView: (config
|
|
3
|
+
export declare const emberNodeConfig: (config?: TableOfContentsConfig) => EmberNodeConfig;
|
|
4
|
+
export declare const table_of_contents: (config?: TableOfContentsConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
5
|
+
export declare const tableOfContentsView: (config?: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor/utils/ember-node").SayNodeViewConstructor;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TableOfContentsConfig } from '..';
|
|
2
|
+
import { PNode, EditorState } from '@lblod/ember-rdfa-editor';
|
|
2
3
|
export type OutlineEntry = {
|
|
3
4
|
content: string;
|
|
4
5
|
pos: number;
|
|
5
6
|
children?: OutlineEntry[];
|
|
6
7
|
};
|
|
7
8
|
export declare function createTableOfContents(entries: OutlineEntry[]): [string, ...any[]];
|
|
8
|
-
|
|
9
|
-
nodeHierarchy: string[];
|
|
10
|
-
}[];
|
|
11
|
-
export declare function extractOutline({ node, pos, config, state, }: {
|
|
9
|
+
export declare function extractOutline(args: {
|
|
12
10
|
node: PNode;
|
|
13
11
|
pos: number;
|
|
14
|
-
|
|
12
|
+
/** @deprecated */
|
|
13
|
+
config?: TableOfContentsConfig;
|
|
15
14
|
state: EditorState;
|
|
16
15
|
}): OutlineEntry[];
|
|
17
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.0-dev.fdff223490a881e1079b030f29100bfc3819e8aa",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
"ember-cli-babel": "^8.2.0",
|
|
73
73
|
"ember-cli-htmlbars": "^6.3.0",
|
|
74
74
|
"ember-cli-version-checker": "^5.1.2",
|
|
75
|
-
"ember-concurrency": "^3.1.1",
|
|
76
75
|
"ember-mu-transform-helpers": "^2.1.2",
|
|
77
76
|
"ember-resources": "^7.0.2",
|
|
78
77
|
"ember-template-imports": "^4.1.1",
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
"zod": "^3.24.1"
|
|
92
91
|
},
|
|
93
92
|
"devDependencies": {
|
|
94
|
-
"@appuniversum/ember-appuniversum": "~3.
|
|
93
|
+
"@appuniversum/ember-appuniversum": "~3.5.0",
|
|
95
94
|
"@changesets/changelog-github": "^0.5.0",
|
|
96
95
|
"@changesets/cli": "^2.27.7",
|
|
97
96
|
"@ember/optional-features": "^2.1.0",
|
|
@@ -143,6 +142,7 @@
|
|
|
143
142
|
"ember-leaflet": "^5.1.3",
|
|
144
143
|
"ember-load-initializers": "^2.1.2",
|
|
145
144
|
"ember-modifier": "~4.1.0",
|
|
145
|
+
"ember-concurrency": "^4.0.2",
|
|
146
146
|
"ember-page-title": "^8.2.3",
|
|
147
147
|
"ember-power-select": "~7.1.0",
|
|
148
148
|
"ember-qunit": "^8.1.0",
|
|
@@ -174,11 +174,11 @@
|
|
|
174
174
|
"webpack": "^5.95.0"
|
|
175
175
|
},
|
|
176
176
|
"peerDependencies": {
|
|
177
|
-
"@appuniversum/ember-appuniversum": "^3.
|
|
177
|
+
"@appuniversum/ember-appuniversum": "^3.5.0",
|
|
178
178
|
"@ember/string": "3.x",
|
|
179
179
|
"@glint/template": "^1.4.0",
|
|
180
180
|
"@lblod/ember-rdfa-editor": "^11.0.0",
|
|
181
|
-
"ember-concurrency": "^
|
|
181
|
+
"ember-concurrency": "^4.0.2",
|
|
182
182
|
"ember-element-helper": "^0.8.6",
|
|
183
183
|
"ember-intl": "^7.0.0",
|
|
184
184
|
"ember-leaflet": "^5.1.3",
|