@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-alpha.3 → 1.0.0-beta.1
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 +19 -0
- package/addon/components/citation-plugin/citation-card.hbs +2 -2
- package/addon/components/citation-plugin/citation-insert.hbs +3 -1
- package/addon/components/citation-plugin/citation-insert.ts +27 -1
- package/addon/components/citation-plugin/citations/search-modal.hbs +1 -1
- package/addon/components/citation-plugin/citations/search-modal.ts +3 -18
- package/addon/components/roadsign-regulation-plugin/roadsigns-modal.ts +1 -1
- package/addon/components/table-of-contents-plugin/ember-nodes/table-of-contents.ts +27 -30
- package/addon/components/table-of-contents-plugin/toolbar-button.hbs +8 -0
- package/addon/components/table-of-contents-plugin/{card.ts → toolbar-button.ts} +1 -18
- package/addon/plugins/article-structure-plugin/commands/insert-structure.ts +54 -29
- package/addon/plugins/article-structure-plugin/structures/article-paragraph.ts +38 -6
- package/addon/plugins/article-structure-plugin/structures/article.ts +13 -3
- package/addon/plugins/article-structure-plugin/structures/chapter.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/section.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/structure-header.ts +11 -4
- package/addon/plugins/article-structure-plugin/structures/subsection.ts +1 -1
- package/addon/plugins/article-structure-plugin/structures/title.ts +1 -1
- package/addon/plugins/article-structure-plugin/utils/structure.ts +29 -9
- package/addon/plugins/citation-plugin/index.ts +2 -2
- package/addon/plugins/table-of-contents-plugin/index.ts +8 -12
- package/addon/plugins/table-of-contents-plugin/nodes/table-of-contents.ts +35 -42
- package/addon/{plugins/article-structure-plugin → utils}/constants.ts +1 -1
- package/addon/{plugins/article-structure-plugin/utils → utils}/namespace.ts +0 -0
- package/app/components/table-of-contents-plugin/{card.js → toolbar-button.js} +1 -1
- package/components/citation-plugin/citation-insert.d.ts +7 -0
- package/components/citation-plugin/citations/search-modal.d.ts +1 -3
- package/components/table-of-contents-plugin/ember-nodes/table-of-contents.d.ts +1 -1
- package/components/table-of-contents-plugin/{card.d.ts → toolbar-button.d.ts} +0 -5
- package/package.json +5 -5
- package/plugins/article-structure-plugin/utils/structure.d.ts +4 -3
- package/plugins/table-of-contents-plugin/index.d.ts +4 -2
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +4 -3
- package/translations/nl-BE.yaml +3 -3
- package/utils/constants.d.ts +5 -0
- package/{plugins/article-structure-plugin/utils → utils}/namespace.d.ts +0 -0
- package/addon/components/table-of-contents-plugin/card.hbs +0 -16
- package/addon/plugins/table-of-contents-plugin/utils/constants.ts +0 -17
- package/plugins/article-structure-plugin/constants.d.ts +0 -5
- package/plugins/table-of-contents-plugin/utils/constants.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
## 1.0.0-beta.1 (2023-01-17)
|
|
15
|
+
|
|
16
|
+
#### :rocket: Enhancement
|
|
17
|
+
* [#27](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/27) Conversion of plugins to prosemirror based editor ([@elpoelma](https://github.com/elpoelma))
|
|
18
|
+
* [#54](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/54) Move table-of-contents toggle to toolbar ([@elpoelma](https://github.com/elpoelma))
|
|
19
|
+
* [#46](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/46) Update insert-structure command so it looks forward for the next best position to insert ([@elpoelma](https://github.com/elpoelma))
|
|
20
|
+
|
|
21
|
+
#### :bug: Bug Fix
|
|
22
|
+
* [#59](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/59) Rename verwijzing to citeeropschrift ([@elpoelma](https://github.com/elpoelma))
|
|
23
|
+
* [#56](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/56) Add space before 'met zonale geldigheid' ([@elpoelma](https://github.com/elpoelma))
|
|
24
|
+
|
|
25
|
+
#### :house: Internal
|
|
26
|
+
* [#61](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/61) Update editor to 1.0.0-beta.2 ([@elpoelma](https://github.com/elpoelma))
|
|
27
|
+
* [#60](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/60) Update editor to 1.0.0-beta.1 ([@elpoelma](https://github.com/elpoelma))
|
|
28
|
+
|
|
29
|
+
#### Committers: 1
|
|
30
|
+
- Elena Poelman ([@elpoelma](https://github.com/elpoelma))
|
|
31
|
+
|
|
13
32
|
## 1.0.0-alpha.3 (2023-01-09)
|
|
14
33
|
|
|
15
34
|
#### :house: Internal
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
</c.footer>
|
|
107
107
|
</AuCard>
|
|
108
108
|
{{/if}}
|
|
109
|
-
|
|
110
109
|
<CitationPlugin::Citations::SearchModal
|
|
111
110
|
@open={{this.showModal}}
|
|
112
111
|
@closeModal={{this.closeModal}}
|
|
113
112
|
@insertDecisionCitation={{this.insertDecisionCitation}}
|
|
114
113
|
@insertArticleCitation={{this.insertArticleCitation}}
|
|
115
114
|
@selectedDecision={{this.decision}}
|
|
116
|
-
@legislationTypeUri={{this.
|
|
115
|
+
@legislationTypeUri={{this.selectedLegislationTypeUri}}
|
|
116
|
+
@selectLegislationType={{this.selectLegislationType}}
|
|
117
117
|
@text={{this.searchText}}
|
|
118
118
|
/>
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
@closeModal={{this.closeModal}}
|
|
16
16
|
@insertDecisionCitation={{this.insertDecisionCitation}}
|
|
17
17
|
@insertArticleCitation={{this.insertArticleCitation}}
|
|
18
|
-
@legislationTypeUri={{this.
|
|
18
|
+
@legislationTypeUri={{this.selectedLegislationTypeUri}}
|
|
19
|
+
|
|
20
|
+
@selectLegislationType={{this.selectLegislationType}}
|
|
19
21
|
@text={{this.text}}
|
|
20
22
|
/>
|
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/vlaamse-codex';
|
|
14
14
|
import { citedText } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/cited-text';
|
|
15
15
|
import { CitationPlugin } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
LEGISLATION_TYPE_CONCEPTS,
|
|
18
|
+
LEGISLATION_TYPES,
|
|
19
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/citation-plugin/utils/legislation-types';
|
|
20
|
+
import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
17
21
|
|
|
18
22
|
interface Args {
|
|
19
23
|
controller: ProseController;
|
|
@@ -24,6 +28,28 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
24
28
|
@tracked showModal = false;
|
|
25
29
|
@tracked legislationTypeUri = LEGISLATION_TYPES.decreet;
|
|
26
30
|
@tracked text = '';
|
|
31
|
+
@tracked legislationType: string | null = null;
|
|
32
|
+
|
|
33
|
+
get selectedLegislationTypeUri(): string {
|
|
34
|
+
return this.selectedLegislationType.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get selectedLegislationType() {
|
|
38
|
+
const type = this.legislationType;
|
|
39
|
+
const found = LEGISLATION_TYPE_CONCEPTS.find((c) => c.value === type);
|
|
40
|
+
return found || unwrap(LEGISLATION_TYPE_CONCEPTS[0]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@action
|
|
44
|
+
selectLegislationType(type: string) {
|
|
45
|
+
type = type.toLowerCase();
|
|
46
|
+
const found = LEGISLATION_TYPE_CONCEPTS.find(
|
|
47
|
+
(c) => c.label.toLowerCase() === type
|
|
48
|
+
);
|
|
49
|
+
this.legislationType = found
|
|
50
|
+
? found.value
|
|
51
|
+
: unwrap(LEGISLATION_TYPE_CONCEPTS[0]).value;
|
|
52
|
+
}
|
|
27
53
|
|
|
28
54
|
get disableInsert() {
|
|
29
55
|
if (!this.activeRanges) {
|
|
@@ -47,13 +47,12 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
47
47
|
// Vlaamse Codex currently doesn't contain captions and content of decisions
|
|
48
48
|
// @tracked isEnabledSearchCaption = false
|
|
49
49
|
// @tracked isEnabledSearchContent = false
|
|
50
|
-
@tracked legislationTypeUri: string;
|
|
51
50
|
@tracked pageNumber = 0;
|
|
52
51
|
@tracked pageSize = 5;
|
|
53
52
|
@tracked totalCount = 0;
|
|
54
53
|
@tracked decisions = [];
|
|
55
54
|
@tracked error: unknown;
|
|
56
|
-
@tracked selectedDecision: Decision | null;
|
|
55
|
+
@tracked selectedDecision: Decision | null = null;
|
|
57
56
|
@tracked documentDateFrom: Date | null = null;
|
|
58
57
|
@tracked documentDateTo: Date | null = null;
|
|
59
58
|
@tracked publicationDateFrom: Date | null = null;
|
|
@@ -62,11 +61,8 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
62
61
|
minDate = new Date('1930-01-01T12:00:00');
|
|
63
62
|
maxDate = new Date(`${new Date().getFullYear() + 10}-01-01T12:00:00`);
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.selectedDecision = this.args.selectedDecision;
|
|
68
|
-
this.legislationTypeUri =
|
|
69
|
-
this.args.legislationTypeUri || LEGISLATION_TYPES['decreet'];
|
|
64
|
+
get legislationTypeUri() {
|
|
65
|
+
return this.args.legislationTypeUri || LEGISLATION_TYPES['decreet'];
|
|
70
66
|
}
|
|
71
67
|
|
|
72
68
|
get datePickerLocalization() {
|
|
@@ -174,17 +170,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
174
170
|
this.inputSearchText = (event.target as HTMLInputElement).value;
|
|
175
171
|
}
|
|
176
172
|
|
|
177
|
-
@action
|
|
178
|
-
selectLegislationType(type: string) {
|
|
179
|
-
type = type.toLowerCase();
|
|
180
|
-
const found = LEGISLATION_TYPE_CONCEPTS.find(
|
|
181
|
-
(c) => c.label.toLowerCase() === type
|
|
182
|
-
);
|
|
183
|
-
this.legislationTypeUri = found
|
|
184
|
-
? found.value
|
|
185
|
-
: unwrap(LEGISLATION_TYPE_CONCEPTS[0]).value;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
173
|
@action
|
|
189
174
|
updateDocumentDateFrom(_isoDate: unknown, date: Date) {
|
|
190
175
|
this.documentDateFrom = date;
|
|
@@ -260,7 +260,7 @@ export default class RoadsignRegulationCard extends Component<Args> {
|
|
|
260
260
|
}</span>
|
|
261
261
|
<span style="margin-left:0;margin-top:0;">${
|
|
262
262
|
sign.zonality === POTENTIALLY_ZONAL_URI && zonality === ZONAL_URI
|
|
263
|
-
? 'met zonale geldigheid'
|
|
263
|
+
? ' met zonale geldigheid'
|
|
264
264
|
: ''
|
|
265
265
|
}
|
|
266
266
|
</span>
|
|
@@ -3,9 +3,8 @@ import Component from '@glimmer/component';
|
|
|
3
3
|
import { PNode } from '@lblod/ember-rdfa-editor';
|
|
4
4
|
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
5
5
|
import { Selection } from '@lblod/ember-rdfa-editor';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin/utils/constants';
|
|
6
|
+
import { NodeWithPos } from '@curvenote/prosemirror-utils';
|
|
7
|
+
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin';
|
|
9
8
|
type OutlineEntry = {
|
|
10
9
|
content: string;
|
|
11
10
|
pos: number;
|
|
@@ -33,34 +32,32 @@ export default class TableOfContentsComponent extends Component<EmberNodeArgs> {
|
|
|
33
32
|
extractOutline({ node, pos }: { node: PNode; pos: number }): OutlineEntry[] {
|
|
34
33
|
let result: OutlineEntry[] = [];
|
|
35
34
|
let parent: OutlineEntry | undefined;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
break;
|
|
48
|
-
} else {
|
|
49
|
-
const range = [
|
|
50
|
-
...this.args.controller.datastore
|
|
51
|
-
.match(`>${resource}`, `>${tocConfigEntry.value.predicate}`)
|
|
52
|
-
.asPredicateNodeMapping()
|
|
53
|
-
.nodes(),
|
|
54
|
-
][0];
|
|
55
|
-
if (range) {
|
|
56
|
-
const node = unwrap(this.controller.state.doc.nodeAt(range.from));
|
|
57
|
-
parent = {
|
|
58
|
-
content: node.textContent,
|
|
59
|
-
pos: range.from,
|
|
60
|
-
};
|
|
61
|
-
break;
|
|
35
|
+
for (const option of this.config) {
|
|
36
|
+
const { nodeHierarchy } = option;
|
|
37
|
+
if (RegExp(`^${nodeHierarchy[0]}$`).exec(node.type.name)) {
|
|
38
|
+
let i = 1;
|
|
39
|
+
let currentNode: NodeWithPos | undefined = { node, pos };
|
|
40
|
+
while (currentNode && i < nodeHierarchy.length) {
|
|
41
|
+
let newCurrentNode: NodeWithPos | undefined;
|
|
42
|
+
currentNode.node.forEach((child, offset) => {
|
|
43
|
+
if (RegExp(`^${nodeHierarchy[i]}$`).exec(child.type.name)) {
|
|
44
|
+
newCurrentNode = { pos: pos + offset, node: child };
|
|
45
|
+
return;
|
|
62
46
|
}
|
|
63
|
-
}
|
|
47
|
+
});
|
|
48
|
+
currentNode = newCurrentNode;
|
|
49
|
+
i++;
|
|
50
|
+
}
|
|
51
|
+
if (currentNode) {
|
|
52
|
+
const outlineText = currentNode.node.type.spec.outlineText as
|
|
53
|
+
| ((node: PNode) => string)
|
|
54
|
+
| undefined;
|
|
55
|
+
const content =
|
|
56
|
+
outlineText?.(currentNode.node) ?? currentNode.node.textContent;
|
|
57
|
+
parent = {
|
|
58
|
+
pos: currentNode.pos,
|
|
59
|
+
content,
|
|
60
|
+
};
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<label class="au-c-toggle-switch">
|
|
2
|
+
<input type="checkbox"
|
|
3
|
+
checked={{this.toggled}}
|
|
4
|
+
class="au-c-toggle-switch__input au-u-hidden-visually"
|
|
5
|
+
{{on "input" this.toggle}}/>
|
|
6
|
+
<span class="au-c-toggle-switch__toggle"></span>
|
|
7
|
+
<span class="au-c-toggle-switch__label">{{t "table-of-contents-plugin.toggle" }}</span>
|
|
8
|
+
</label>
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { action } from '@ember/object';
|
|
2
2
|
import Component from '@glimmer/component';
|
|
3
|
-
import {
|
|
4
|
-
TableOfContentsConfig,
|
|
5
|
-
TABLE_OF_CONTENTS_DEFAULT_CONFIG,
|
|
6
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin/utils/constants';
|
|
7
3
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
8
4
|
|
|
9
5
|
type Args = {
|
|
10
6
|
controller: ProseController;
|
|
11
|
-
widgetArgs: {
|
|
12
|
-
config: TableOfContentsConfig;
|
|
13
|
-
};
|
|
14
7
|
};
|
|
15
8
|
|
|
16
9
|
export default class TableOfContentsCardComponent extends Component<Args> {
|
|
@@ -33,10 +26,6 @@ export default class TableOfContentsCardComponent extends Component<Args> {
|
|
|
33
26
|
return result;
|
|
34
27
|
}
|
|
35
28
|
|
|
36
|
-
get config() {
|
|
37
|
-
return this.args.widgetArgs.config ?? TABLE_OF_CONTENTS_DEFAULT_CONFIG;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
29
|
@action
|
|
41
30
|
toggle() {
|
|
42
31
|
if (this.tableOfContentsRange) {
|
|
@@ -47,13 +36,7 @@ export default class TableOfContentsCardComponent extends Component<Args> {
|
|
|
47
36
|
} else {
|
|
48
37
|
const { schema } = this.controller;
|
|
49
38
|
this.controller.withTransaction((tr) => {
|
|
50
|
-
return tr.replaceRangeWith(
|
|
51
|
-
0,
|
|
52
|
-
0,
|
|
53
|
-
schema.node('table_of_contents', {
|
|
54
|
-
config: this.config,
|
|
55
|
-
})
|
|
56
|
-
);
|
|
39
|
+
return tr.replaceRangeWith(0, 0, schema.node('table_of_contents'));
|
|
57
40
|
});
|
|
58
41
|
}
|
|
59
42
|
}
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
Command,
|
|
3
3
|
NodeSelection,
|
|
4
4
|
NodeType,
|
|
5
|
+
PNode,
|
|
6
|
+
Schema,
|
|
5
7
|
Selection,
|
|
6
8
|
TextSelection,
|
|
7
9
|
} from '@lblod/ember-rdfa-editor';
|
|
@@ -9,56 +11,43 @@ import recalculateStructureNumbers from './recalculate-structure-numbers';
|
|
|
9
11
|
import { StructureSpec } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin';
|
|
10
12
|
import wrapStructureContent from './wrap-structure-content';
|
|
11
13
|
import IntlService from 'ember-intl/services/intl';
|
|
14
|
+
import { findNodes } from '@lblod/ember-rdfa-editor/utils/position-utils';
|
|
15
|
+
import { containsOnlyPlaceholder } from '../utils/structure';
|
|
12
16
|
|
|
13
17
|
const insertStructure = (
|
|
14
18
|
structureSpec: StructureSpec,
|
|
15
19
|
intl: IntlService
|
|
16
20
|
): Command => {
|
|
17
21
|
return (state, dispatch) => {
|
|
18
|
-
const { schema, selection } = state;
|
|
19
|
-
const
|
|
22
|
+
const { schema, selection, doc } = state;
|
|
23
|
+
const insertionRange = findInsertionRange({
|
|
24
|
+
doc,
|
|
20
25
|
selection,
|
|
21
|
-
schema.nodes[structureSpec.name]
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
nodeType: schema.nodes[structureSpec.name],
|
|
27
|
+
schema,
|
|
28
|
+
});
|
|
29
|
+
if (!insertionRange) {
|
|
24
30
|
return wrapStructureContent(structureSpec, intl)(state, dispatch);
|
|
25
31
|
}
|
|
26
32
|
if (dispatch) {
|
|
27
33
|
const { node: newStructureNode, selectionConfig } =
|
|
28
34
|
structureSpec.constructor({ schema, intl });
|
|
29
35
|
const transaction = state.tr;
|
|
30
|
-
let insertRange: { from: number; to: number };
|
|
31
|
-
if (
|
|
32
|
-
container.node.childCount === 1 &&
|
|
33
|
-
container.node.firstChild?.type === schema.nodes['paragraph'] &&
|
|
34
|
-
container.node.firstChild.firstChild?.type ===
|
|
35
|
-
schema.nodes['placeholder']
|
|
36
|
-
) {
|
|
37
|
-
insertRange = {
|
|
38
|
-
from: container.pos + 1,
|
|
39
|
-
to: container.pos + container.node.nodeSize - 1,
|
|
40
|
-
};
|
|
41
|
-
} else {
|
|
42
|
-
insertRange = {
|
|
43
|
-
from: selection.$from.after(container.depth + 1),
|
|
44
|
-
to: selection.$from.after(container.depth + 1),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
36
|
|
|
48
37
|
transaction.replaceWith(
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
insertionRange.from,
|
|
39
|
+
insertionRange.to,
|
|
51
40
|
newStructureNode
|
|
52
41
|
);
|
|
53
42
|
const newSelection =
|
|
54
43
|
selectionConfig.type === 'node'
|
|
55
44
|
? NodeSelection.create(
|
|
56
45
|
transaction.doc,
|
|
57
|
-
|
|
46
|
+
insertionRange.from + selectionConfig.relativePos
|
|
58
47
|
)
|
|
59
48
|
: TextSelection.create(
|
|
60
49
|
transaction.doc,
|
|
61
|
-
|
|
50
|
+
insertionRange.from + selectionConfig.relativePos
|
|
62
51
|
);
|
|
63
52
|
transaction.setSelection(newSelection);
|
|
64
53
|
transaction.scrollIntoView();
|
|
@@ -69,14 +58,50 @@ const insertStructure = (
|
|
|
69
58
|
};
|
|
70
59
|
};
|
|
71
60
|
|
|
72
|
-
function
|
|
61
|
+
function findInsertionRange(args: {
|
|
62
|
+
doc: PNode;
|
|
63
|
+
selection: Selection;
|
|
64
|
+
nodeType: NodeType;
|
|
65
|
+
schema: Schema;
|
|
66
|
+
}) {
|
|
67
|
+
const { doc, selection, nodeType, schema } = args;
|
|
73
68
|
const { $from } = selection;
|
|
74
69
|
for (let currentDepth = $from.depth; currentDepth >= 0; currentDepth--) {
|
|
75
70
|
const currentAncestor = $from.node(currentDepth);
|
|
76
71
|
const index = $from.index(currentDepth);
|
|
77
|
-
const pos = currentDepth > 0 ? $from.before(currentDepth) : -1;
|
|
78
72
|
if (currentAncestor.canReplaceWith(index, index, nodeType)) {
|
|
79
|
-
|
|
73
|
+
if (containsOnlyPlaceholder(schema, currentAncestor)) {
|
|
74
|
+
return { from: $from.start(currentDepth), to: $from.end(currentDepth) };
|
|
75
|
+
} else {
|
|
76
|
+
const insertPos = $from.after(currentDepth + 1);
|
|
77
|
+
return { from: insertPos, to: insertPos };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const nextContainerRange = findNodes(
|
|
82
|
+
doc,
|
|
83
|
+
selection.from,
|
|
84
|
+
true,
|
|
85
|
+
false,
|
|
86
|
+
({ from }) => {
|
|
87
|
+
const node = doc.nodeAt(from);
|
|
88
|
+
if (node) {
|
|
89
|
+
if (node.canReplaceWith(node.childCount, node.childCount, nodeType)) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
).next().value;
|
|
96
|
+
if (nextContainerRange) {
|
|
97
|
+
const { from, to } = nextContainerRange;
|
|
98
|
+
const containerNode = doc.nodeAt(from);
|
|
99
|
+
if (containerNode) {
|
|
100
|
+
if (containsOnlyPlaceholder(schema, containerNode)) {
|
|
101
|
+
return { from: from + 1, to: to - 1 };
|
|
102
|
+
} else {
|
|
103
|
+
return { from: to - 1, to: to - 1 };
|
|
104
|
+
}
|
|
80
105
|
}
|
|
81
106
|
}
|
|
82
107
|
return null;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { NodeSpec } from '@lblod/ember-rdfa-editor';
|
|
1
|
+
import { Fragment, NodeSpec } from '@lblod/ember-rdfa-editor';
|
|
2
2
|
import { StructureSpec } from '..';
|
|
3
3
|
import { v4 as uuid } from 'uuid';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
ELI,
|
|
6
|
+
SAY,
|
|
7
|
+
XSD,
|
|
8
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
9
|
+
import { hasRDFaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
6
10
|
|
|
7
11
|
const PLACEHOLDERS = {
|
|
8
12
|
body: 'article-structure-plugin.placeholder.paragraph.body',
|
|
@@ -39,8 +43,11 @@ export const articleParagraphSpec: StructureSpec = {
|
|
|
39
43
|
},
|
|
40
44
|
};
|
|
41
45
|
|
|
46
|
+
const contentSelector = `span[property~='${SAY('body').prefixed}'],
|
|
47
|
+
span[property~='${SAY('body').full}']`;
|
|
48
|
+
|
|
42
49
|
export const article_paragraph: NodeSpec = {
|
|
43
|
-
content: '
|
|
50
|
+
content: 'inline*',
|
|
44
51
|
inline: false,
|
|
45
52
|
attrs: {
|
|
46
53
|
resource: {},
|
|
@@ -67,6 +74,29 @@ export const article_paragraph: NodeSpec = {
|
|
|
67
74
|
];
|
|
68
75
|
},
|
|
69
76
|
parseDOM: [
|
|
77
|
+
{
|
|
78
|
+
tag: 'div',
|
|
79
|
+
getAttrs(element: HTMLElement) {
|
|
80
|
+
const numberSpan = element.querySelector(`
|
|
81
|
+
span[property~='${ELI('number').prefixed}'],
|
|
82
|
+
span[property~='${ELI('number').full}']`);
|
|
83
|
+
if (
|
|
84
|
+
hasRDFaAttribute(element, 'property', SAY('hasParagraph')) &&
|
|
85
|
+
hasRDFaAttribute(element, 'typeof', SAY('Paragraph')) &&
|
|
86
|
+
element.getAttribute('resource') &&
|
|
87
|
+
element.querySelector(contentSelector) &&
|
|
88
|
+
numberSpan
|
|
89
|
+
) {
|
|
90
|
+
return {
|
|
91
|
+
resource: element.getAttribute('resource'),
|
|
92
|
+
number: numberSpan.textContent,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
},
|
|
97
|
+
contentElement: contentSelector,
|
|
98
|
+
},
|
|
99
|
+
// Parsing rule for backwards compatibility (when content was not inside seperate say:body div)
|
|
70
100
|
{
|
|
71
101
|
tag: 'div',
|
|
72
102
|
getAttrs(element: HTMLElement) {
|
|
@@ -86,8 +116,10 @@ export const article_paragraph: NodeSpec = {
|
|
|
86
116
|
}
|
|
87
117
|
return false;
|
|
88
118
|
},
|
|
89
|
-
|
|
90
|
-
|
|
119
|
+
getContent: (node, schema) => {
|
|
120
|
+
const content = node.lastChild?.textContent ?? '';
|
|
121
|
+
return Fragment.from(schema.text(content));
|
|
122
|
+
},
|
|
91
123
|
},
|
|
92
124
|
],
|
|
93
125
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NodeSpec } from '@lblod/ember-rdfa-editor';
|
|
1
|
+
import { NodeSpec, PNode } from '@lblod/ember-rdfa-editor';
|
|
2
2
|
import { StructureSpec } from '..';
|
|
3
3
|
import {
|
|
4
4
|
constructStructureBodyNodeSpec,
|
|
@@ -7,7 +7,12 @@ import {
|
|
|
7
7
|
} from '../utils/structure';
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
9
9
|
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ELI,
|
|
12
|
+
EXT,
|
|
13
|
+
SAY,
|
|
14
|
+
XSD,
|
|
15
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
11
16
|
|
|
12
17
|
const PLACEHOLDERS = {
|
|
13
18
|
title: 'article-structure-plugin.placeholder.article.heading',
|
|
@@ -88,6 +93,10 @@ export const article_header: NodeSpec = {
|
|
|
88
93
|
default: SAY('heading').prefixed,
|
|
89
94
|
},
|
|
90
95
|
},
|
|
96
|
+
outlineText: (node: PNode) => {
|
|
97
|
+
const { number } = node.attrs;
|
|
98
|
+
return `Artikel ${number as string}: ${node.textContent}`;
|
|
99
|
+
},
|
|
91
100
|
toDOM(node) {
|
|
92
101
|
return [
|
|
93
102
|
'div',
|
|
@@ -118,7 +127,8 @@ export const article_header: NodeSpec = {
|
|
|
118
127
|
}
|
|
119
128
|
return false;
|
|
120
129
|
},
|
|
121
|
-
contentElement: `span[property~='${EXT('title').prefixed}']
|
|
130
|
+
contentElement: `span[property~='${EXT('title').prefixed}'],
|
|
131
|
+
span[property~='${EXT('title').full}']`,
|
|
122
132
|
},
|
|
123
133
|
],
|
|
124
134
|
};
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
romanize,
|
|
7
7
|
} from '../utils/structure';
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
9
|
-
import { SAY } from '
|
|
9
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
10
10
|
|
|
11
11
|
const PLACEHOLDERS = {
|
|
12
12
|
title: 'article-structure-plugin.placeholder.chapter.heading',
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { v4 as uuid } from 'uuid';
|
|
7
7
|
import { StructureSpec } from '..';
|
|
8
8
|
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
9
|
-
import { SAY } from '
|
|
9
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
10
10
|
|
|
11
11
|
const PLACEHOLDERS = {
|
|
12
12
|
title: 'article-structure-plugin.placeholder.section.heading',
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { NodeSpec } from '@lblod/ember-rdfa-editor';
|
|
2
|
-
import {
|
|
1
|
+
import { NodeSpec, PNode } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import {
|
|
3
|
+
ELI,
|
|
4
|
+
EXT,
|
|
5
|
+
SAY,
|
|
6
|
+
XSD,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
3
8
|
import { getStructureHeaderAttrs } from '../utils/structure';
|
|
4
9
|
|
|
5
10
|
const TAG_TO_LEVEL = new Map([
|
|
@@ -9,7 +14,6 @@ const TAG_TO_LEVEL = new Map([
|
|
|
9
14
|
['h4', 4],
|
|
10
15
|
['h5', 5],
|
|
11
16
|
['h6', 6],
|
|
12
|
-
['span', 6],
|
|
13
17
|
]);
|
|
14
18
|
|
|
15
19
|
export const structure_header: NodeSpec = {
|
|
@@ -19,7 +23,6 @@ export const structure_header: NodeSpec = {
|
|
|
19
23
|
property: {
|
|
20
24
|
default: SAY('heading').prefixed,
|
|
21
25
|
},
|
|
22
|
-
|
|
23
26
|
number: {
|
|
24
27
|
default: '1',
|
|
25
28
|
},
|
|
@@ -27,6 +30,10 @@ export const structure_header: NodeSpec = {
|
|
|
27
30
|
default: 1,
|
|
28
31
|
},
|
|
29
32
|
},
|
|
33
|
+
outlineText: (node: PNode) => {
|
|
34
|
+
const { number } = node.attrs;
|
|
35
|
+
return `${number as string}. ${node.textContent}`;
|
|
36
|
+
},
|
|
30
37
|
toDOM(node) {
|
|
31
38
|
return [
|
|
32
39
|
`h${node.attrs.level as number}`,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '../utils/structure';
|
|
7
7
|
import { v4 as uuid } from 'uuid';
|
|
8
8
|
import { unwrap } from '@lblod/ember-rdfa-editor/utils/option';
|
|
9
|
-
import { SAY } from '
|
|
9
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
10
10
|
|
|
11
11
|
const PLACEHOLDERS = {
|
|
12
12
|
title: 'article-structure-plugin.placeholder.subsection.heading',
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
romanize,
|
|
7
7
|
} from '../utils/structure';
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
9
|
-
import { SAY } from '
|
|
9
|
+
import { SAY } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
10
10
|
|
|
11
11
|
const PLACEHOLDERS = {
|
|
12
12
|
heading: 'article-structure-plugin.placeholder.generic.heading',
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
NodeSpec,
|
|
3
|
+
NodeType,
|
|
4
|
+
PNode,
|
|
5
|
+
Schema,
|
|
6
|
+
Selection,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor';
|
|
2
8
|
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
3
|
-
import {
|
|
4
|
-
|
|
9
|
+
import {
|
|
10
|
+
ELI,
|
|
11
|
+
RDF,
|
|
12
|
+
SAY,
|
|
13
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
14
|
+
import {
|
|
15
|
+
hasRDFaAttribute,
|
|
16
|
+
Resource,
|
|
17
|
+
} from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
5
18
|
|
|
6
19
|
export function constructStructureNodeSpec(config: {
|
|
7
20
|
type: Resource;
|
|
@@ -102,12 +115,11 @@ export function findAncestorOfType(selection: Selection, ...types: NodeType[]) {
|
|
|
102
115
|
}
|
|
103
116
|
|
|
104
117
|
export function getStructureHeaderAttrs(element: HTMLElement) {
|
|
105
|
-
const numberNode = element.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
) {
|
|
118
|
+
const numberNode = element.querySelector(
|
|
119
|
+
`[property~="${ELI('number').prefixed}"],
|
|
120
|
+
[property~="${ELI('number').full}"]`
|
|
121
|
+
);
|
|
122
|
+
if (hasRDFaAttribute(element, 'property', SAY('heading')) && numberNode) {
|
|
111
123
|
return {
|
|
112
124
|
number: numberNode.textContent,
|
|
113
125
|
};
|
|
@@ -160,3 +172,11 @@ export function romanize(num: number) {
|
|
|
160
172
|
}
|
|
161
173
|
return Array(+digits.join('') + 1).join('M') + roman;
|
|
162
174
|
}
|
|
175
|
+
|
|
176
|
+
export function containsOnlyPlaceholder(schema: Schema, node: PNode) {
|
|
177
|
+
return (
|
|
178
|
+
node.childCount === 1 &&
|
|
179
|
+
node.firstChild?.type === schema.nodes['paragraph'] &&
|
|
180
|
+
node.firstChild.firstChild?.type === schema.nodes['placeholder']
|
|
181
|
+
);
|
|
182
|
+
}
|
|
@@ -127,7 +127,7 @@ function citationPlugin({
|
|
|
127
127
|
expect(
|
|
128
128
|
'the datastore plugin is required for this plugin',
|
|
129
129
|
datastoreKey.getState(state)
|
|
130
|
-
)
|
|
130
|
+
)()
|
|
131
131
|
);
|
|
132
132
|
return {
|
|
133
133
|
highlights: calculateDecorations(schema, doc, activeRanges),
|
|
@@ -141,7 +141,7 @@ function citationPlugin({
|
|
|
141
141
|
expect(
|
|
142
142
|
'the datastore plugin is required for this plugin',
|
|
143
143
|
datastoreKey.getState(newState)
|
|
144
|
-
)
|
|
144
|
+
)()
|
|
145
145
|
);
|
|
146
146
|
return {
|
|
147
147
|
highlights: calculateDecorations(schema, doc, activeRanges),
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { WidgetSpec } from '@lblod/ember-rdfa-editor';
|
|
2
|
-
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin/utils/constants';
|
|
3
2
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
3
|
+
export type TableOfContentsConfig = {
|
|
4
|
+
nodeHierarchy: string[];
|
|
5
|
+
}[];
|
|
6
|
+
|
|
7
|
+
export const tableOfContentsWidget: WidgetSpec = {
|
|
8
|
+
componentName: 'table-of-contents-plugin/toolbar-button',
|
|
9
|
+
desiredLocation: 'toolbarRight',
|
|
10
|
+
};
|
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
import { optionMapOr } from '@lblod/ember-rdfa-editor/utils/option';
|
|
2
1
|
import {
|
|
3
2
|
createEmberNodeSpec,
|
|
4
3
|
createEmberNodeView,
|
|
5
4
|
EmberNodeConfig,
|
|
6
5
|
} from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
7
|
-
import {
|
|
8
|
-
TableOfContentsConfig,
|
|
9
|
-
TABLE_OF_CONTENTS_DEFAULT_CONFIG,
|
|
10
|
-
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin/utils/constants';
|
|
6
|
+
import { TableOfContentsConfig } from '..';
|
|
11
7
|
|
|
12
|
-
export const emberNodeConfig:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
export const emberNodeConfig: (
|
|
9
|
+
config: TableOfContentsConfig
|
|
10
|
+
) => EmberNodeConfig = (config) => {
|
|
11
|
+
return {
|
|
12
|
+
name: 'table-of-contents',
|
|
13
|
+
componentPath: 'table-of-contents-plugin/ember-nodes/table-of-contents',
|
|
14
|
+
inline: false,
|
|
15
|
+
group: 'table_of_contents',
|
|
16
|
+
atom: true,
|
|
17
|
+
attrs: {
|
|
18
|
+
config: {
|
|
19
|
+
default: config,
|
|
23
20
|
},
|
|
24
21
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'inline-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
JSON.parse,
|
|
42
|
-
element.getAttribute('config')
|
|
43
|
-
) as TableOfContentsConfig,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
22
|
+
parseDOM: [
|
|
23
|
+
{
|
|
24
|
+
tag: 'div',
|
|
25
|
+
getAttrs(element: HTMLElement) {
|
|
26
|
+
if (
|
|
27
|
+
element.dataset['emberNode'] === 'table-of-contents' ||
|
|
28
|
+
// Ensure backwards compatibility
|
|
29
|
+
element.dataset['inlineComponent'] ===
|
|
30
|
+
'inline-components/table-of-contents' ||
|
|
31
|
+
(element.classList.contains('inline-component') &&
|
|
32
|
+
element.classList.contains('inline-components/table-of-contents'))
|
|
33
|
+
) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
47
38
|
},
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
],
|
|
40
|
+
};
|
|
50
41
|
};
|
|
51
42
|
|
|
52
|
-
export const table_of_contents =
|
|
53
|
-
|
|
43
|
+
export const table_of_contents = (config: TableOfContentsConfig) =>
|
|
44
|
+
createEmberNodeSpec(emberNodeConfig(config));
|
|
45
|
+
export const tableOfContentsView = (config: TableOfContentsConfig) =>
|
|
46
|
+
createEmberNodeView(emberNodeConfig(config));
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/table-of-contents-plugin/
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/table-of-contents-plugin/toolbar-button';
|
|
@@ -12,6 +12,13 @@ export default class EditorPluginsCitationInsertComponent extends Component<Args
|
|
|
12
12
|
showModal: boolean;
|
|
13
13
|
legislationTypeUri: string;
|
|
14
14
|
text: string;
|
|
15
|
+
legislationType: string | null;
|
|
16
|
+
get selectedLegislationTypeUri(): string;
|
|
17
|
+
get selectedLegislationType(): {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
};
|
|
21
|
+
selectLegislationType(type: string): void;
|
|
15
22
|
get disableInsert(): boolean;
|
|
16
23
|
get plugin(): CitationPlugin;
|
|
17
24
|
get activeRanges(): [number, number][] | undefined;
|
|
@@ -11,7 +11,6 @@ interface Args {
|
|
|
11
11
|
}
|
|
12
12
|
export default class EditorPluginsCitationsSearchModalComponent extends Component<Args> {
|
|
13
13
|
intl: IntlService;
|
|
14
|
-
legislationTypeUri: string;
|
|
15
14
|
pageNumber: number;
|
|
16
15
|
pageSize: number;
|
|
17
16
|
totalCount: number;
|
|
@@ -25,7 +24,7 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
25
24
|
inputSearchText: string | null;
|
|
26
25
|
minDate: Date;
|
|
27
26
|
maxDate: Date;
|
|
28
|
-
|
|
27
|
+
get legislationTypeUri(): string;
|
|
29
28
|
get datePickerLocalization(): {
|
|
30
29
|
buttonLabel: string;
|
|
31
30
|
selectedDateMessage: string;
|
|
@@ -51,7 +50,6 @@ export default class EditorPluginsCitationsSearchModalComponent extends Componen
|
|
|
51
50
|
resourceSearch: import("ember-concurrency").TaskForAsyncTaskFunction<unknown, () => Promise<Decision[]>>;
|
|
52
51
|
decisionResource: import("ember-resources/util/ember-concurrency").TaskInstance<unknown>;
|
|
53
52
|
setInputSearchText(event: InputEvent): void;
|
|
54
|
-
selectLegislationType(type: string): void;
|
|
55
53
|
updateDocumentDateFrom(_isoDate: unknown, date: Date): void;
|
|
56
54
|
updateDocumentDateTo(_isoDate: unknown, date: Date): void;
|
|
57
55
|
updatePublicationDateFrom(_isoDate: unknown, date: Date): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { PNode } from '@lblod/ember-rdfa-editor';
|
|
3
3
|
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
4
|
-
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin
|
|
4
|
+
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin';
|
|
5
5
|
type OutlineEntry = {
|
|
6
6
|
content: string;
|
|
7
7
|
pos: number;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { TableOfContentsConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/table-of-contents-plugin/utils/constants';
|
|
3
2
|
import { ProseController } from '@lblod/ember-rdfa-editor/core/prosemirror';
|
|
4
3
|
type Args = {
|
|
5
4
|
controller: ProseController;
|
|
6
|
-
widgetArgs: {
|
|
7
|
-
config: TableOfContentsConfig;
|
|
8
|
-
};
|
|
9
5
|
};
|
|
10
6
|
export default class TableOfContentsCardComponent extends Component<Args> {
|
|
11
7
|
get toggled(): boolean;
|
|
@@ -14,7 +10,6 @@ export default class TableOfContentsCardComponent extends Component<Args> {
|
|
|
14
10
|
from: number;
|
|
15
11
|
to: number;
|
|
16
12
|
} | undefined;
|
|
17
|
-
get config(): TableOfContentsConfig;
|
|
18
13
|
toggle(): void;
|
|
19
14
|
}
|
|
20
15
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"uuid": "^9.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@appuniversum/ember-appuniversum": "^
|
|
59
|
+
"@appuniversum/ember-appuniversum": "^2.2.0",
|
|
60
60
|
"@ember/optional-features": "^2.0.0",
|
|
61
61
|
"@ember/test-helpers": "^2.7.0",
|
|
62
62
|
"@embroider/test-setup": "^1.6.0",
|
|
63
63
|
"@glimmer/component": "^1.1.2",
|
|
64
64
|
"@glimmer/tracking": "^1.1.2",
|
|
65
|
-
"@lblod/ember-rdfa-editor": "^1.0.0-
|
|
65
|
+
"@lblod/ember-rdfa-editor": "^1.0.0-beta.2",
|
|
66
66
|
"@rdfjs/types": "^1.1.0",
|
|
67
67
|
"@release-it-plugins/lerna-changelog": "^5.0.0",
|
|
68
68
|
"@tsconfig/ember": "^1.0.1",
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
"webpack": "^5.72.1"
|
|
144
144
|
},
|
|
145
145
|
"peerDependencies": {
|
|
146
|
-
"@appuniversum/ember-appuniversum": "^
|
|
147
|
-
"@lblod/ember-rdfa-editor": "^1.0.0-
|
|
146
|
+
"@appuniversum/ember-appuniversum": "^2.2.0",
|
|
147
|
+
"@lblod/ember-rdfa-editor": "^1.0.0-beta.2",
|
|
148
148
|
"ember-concurrency": "^2.3.7"
|
|
149
149
|
},
|
|
150
150
|
"engines": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeSpec, NodeType, Selection } from '@lblod/ember-rdfa-editor';
|
|
2
|
-
import { Resource } from '
|
|
1
|
+
import { NodeSpec, NodeType, PNode, Schema, Selection } from '@lblod/ember-rdfa-editor';
|
|
2
|
+
import { Resource } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
3
3
|
export declare function constructStructureNodeSpec(config: {
|
|
4
4
|
type: Resource;
|
|
5
5
|
content: string;
|
|
@@ -12,9 +12,10 @@ export declare function findAncestorOfType(selection: Selection, ...types: NodeT
|
|
|
12
12
|
pos: number;
|
|
13
13
|
start: number;
|
|
14
14
|
depth: number;
|
|
15
|
-
node:
|
|
15
|
+
node: PNode;
|
|
16
16
|
} | undefined;
|
|
17
17
|
export declare function getStructureHeaderAttrs(element: HTMLElement): false | {
|
|
18
18
|
number: string | null;
|
|
19
19
|
};
|
|
20
20
|
export declare function romanize(num: number): string;
|
|
21
|
+
export declare function containsOnlyPlaceholder(schema: Schema, node: PNode): boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { WidgetSpec } from '@lblod/ember-rdfa-editor';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export type TableOfContentsConfig = {
|
|
3
|
+
nodeHierarchy: string[];
|
|
4
|
+
}[];
|
|
5
|
+
export declare const tableOfContentsWidget: WidgetSpec;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
import { TableOfContentsConfig } from '..';
|
|
3
|
+
export declare const emberNodeConfig: (config: TableOfContentsConfig) => EmberNodeConfig;
|
|
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").ProseController) => import("prosemirror-view").NodeViewConstructor;
|
package/translations/nl-BE.yaml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
citaten-plugin:
|
|
2
2
|
card:
|
|
3
|
-
title: Voeg
|
|
3
|
+
title: Voeg citeeropschrift toe
|
|
4
4
|
suggestions: Suggesties
|
|
5
5
|
|
|
6
6
|
insert:
|
|
7
|
-
title:
|
|
7
|
+
title: Citeeropschrift invoegen
|
|
8
8
|
|
|
9
9
|
search:
|
|
10
10
|
term: Zoekterm
|
|
@@ -30,7 +30,7 @@ citaten-plugin:
|
|
|
30
30
|
of: van
|
|
31
31
|
|
|
32
32
|
references:
|
|
33
|
-
insert:
|
|
33
|
+
insert: Citeeropschrift invoegen
|
|
34
34
|
details: Details
|
|
35
35
|
refer-whole: Verwijs naar volledig document
|
|
36
36
|
refer-article: Verwijs naar artikel
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SAY: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
2
|
+
export declare const RDF: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
3
|
+
export declare const ELI: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
4
|
+
export declare const XSD: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
5
|
+
export declare const EXT: (s: string) => import("@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace").Resource;
|
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<AuCard @flex={{true}} @divided={{true}} @expandable={{false}} @shadow={{true}} @size="flush" as |c|>
|
|
2
|
-
<c.content class="au-c-content--small">
|
|
3
|
-
<label
|
|
4
|
-
class="au-c-toggle-switch"
|
|
5
|
-
>
|
|
6
|
-
<input
|
|
7
|
-
type="checkbox"
|
|
8
|
-
checked={{this.toggled}}
|
|
9
|
-
class="au-c-toggle-switch__input au-u-hidden-visually"
|
|
10
|
-
{{on "input" this.toggle}}
|
|
11
|
-
/>
|
|
12
|
-
<span class="au-c-toggle-switch__toggle"></span>
|
|
13
|
-
<span class="au-c-toggle-switch__label">{{t "table-of-contents-plugin.toggle" }}</span>
|
|
14
|
-
</label>
|
|
15
|
-
</c.content>
|
|
16
|
-
</AuCard>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type TableOfContentsConfig = {
|
|
2
|
-
sectionPredicate: string[];
|
|
3
|
-
value:
|
|
4
|
-
| string
|
|
5
|
-
| {
|
|
6
|
-
predicate: string;
|
|
7
|
-
};
|
|
8
|
-
}[];
|
|
9
|
-
|
|
10
|
-
export const TABLE_OF_CONTENTS_DEFAULT_CONFIG: TableOfContentsConfig = [
|
|
11
|
-
{
|
|
12
|
-
sectionPredicate: ['https://say.data.gift/ns/hasPart', 'say:hasPart'],
|
|
13
|
-
value: {
|
|
14
|
-
predicate: 'https://say.data.gift/ns/heading',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
];
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const SAY: (s: string) => import("./utils/namespace").Resource;
|
|
2
|
-
export declare const RDF: (s: string) => import("./utils/namespace").Resource;
|
|
3
|
-
export declare const ELI: (s: string) => import("./utils/namespace").Resource;
|
|
4
|
-
export declare const XSD: (s: string) => import("./utils/namespace").Resource;
|
|
5
|
-
export declare const EXT: (s: string) => import("./utils/namespace").Resource;
|