@lblod/ember-rdfa-editor-lblod-plugins 9.0.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/README.md +18 -0
- package/addon/components/snippet-plugin/snippet-insert.ts +17 -5
- package/addon/components/template-comments-plugin/edit-card.hbs +50 -0
- package/addon/components/template-comments-plugin/edit-card.ts +104 -0
- package/addon/components/template-comments-plugin/insert.hbs +11 -0
- package/addon/components/template-comments-plugin/insert.ts +81 -0
- package/addon/components/template-comments-plugin/template-comment.hbs +13 -0
- package/addon/components/template-comments-plugin/template-comment.ts +54 -0
- package/addon/plugins/template-comments-plugin/index.ts +5 -0
- package/addon/plugins/template-comments-plugin/node.ts +61 -0
- package/app/components/template-comments-plugin/comment-editor.js +1 -0
- package/app/components/template-comments-plugin/edit-card.js +1 -0
- package/app/components/template-comments-plugin/insert-template-comment.js +1 -0
- package/app/components/template-comments-plugin/insert.js +1 -0
- package/app/components/template-comments-plugin/template-comment.js +1 -0
- package/app/styles/template-comments-plugin.scss +40 -0
- package/components/template-comments-plugin/edit-card.d.ts +20 -0
- package/components/template-comments-plugin/insert.d.ts +13 -0
- package/components/template-comments-plugin/template-comment.d.ts +14 -0
- package/package.json +3 -3
- package/plugins/rdfa-date-plugin/nodes/date.d.ts +1 -1
- package/plugins/table-of-contents-plugin/nodes/table-of-contents.d.ts +1 -1
- package/plugins/template-comments-plugin/index.d.ts +1 -0
- package/plugins/template-comments-plugin/node.d.ts +8 -0
- package/plugins/variable-plugin/nodes.d.ts +1 -1
- package/plugins/variable-plugin/number.d.ts +1 -1
- package/translations/en-US.yaml +9 -0
- package/translations/nl-BE.yaml +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [9.1.0] - 2023-07-29
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- template-comments plugin
|
|
14
|
+
- A plugin to insert and edit template comments (as a "block")
|
|
15
|
+
- can be inserted anywhere
|
|
16
|
+
- have a specific rdfa-attribute so they can be removed at publishing
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [9.0.2] - 2023-07-28
|
|
20
|
+
### Dependencies
|
|
21
|
+
- Bumps `release-it` from 15.5.0 to 15.11.0
|
|
22
|
+
- Bumps `@codemirror/lang-html` from 6.4.3 to 6.4.5
|
|
23
|
+
- Bumps `@types/ember-data__model` from 4.0.0 to 4.0.1
|
|
24
|
+
- Bumps `eslint-plugin-ember` from 11.9.0 to 11.10.0
|
|
25
|
+
- Bumps `@types/ember__runloop` from 4.0.2 to 4.0.3
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
- Snippet insertion accounts for wrapping document
|
|
29
|
+
|
|
10
30
|
## [9.0.1] - 2023-07-24
|
|
11
31
|
|
|
12
32
|
### Changed
|
|
@@ -587,7 +607,7 @@ add onclick handler to pencil icon in variable plugin
|
|
|
587
607
|
|
|
588
608
|
# Changelog
|
|
589
609
|
|
|
590
|
-
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0
|
|
610
|
+
[unreleased]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.1.0...HEAD
|
|
591
611
|
[8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.0.0...v8.0.1
|
|
592
612
|
[8.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.1.0...v8.0.0
|
|
593
613
|
[7.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v7.0.0...v7.1.0
|
|
@@ -603,6 +623,8 @@ add onclick handler to pencil icon in variable plugin
|
|
|
603
623
|
[3.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.2...v3.0.0
|
|
604
624
|
[2.1.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.1...v2.1.2
|
|
605
625
|
[2.1.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v2.1.0...v2.1.1
|
|
626
|
+
[9.1.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.2...v9.1.0
|
|
627
|
+
[9.0.2]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.1...v9.0.2
|
|
606
628
|
[9.0.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v9.0.0...v9.0.1
|
|
607
629
|
[9.0.0]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.1...v9.0.0
|
|
608
630
|
[8.4.1]: https://github.com/lblod/ember-rdfa-editor-lblod-plugins/compare/v8.4.0...v8.4.1
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ This addon contains the following editor plugins:
|
|
|
32
32
|
* [template-variable-plugin](#template-variable-plugin)
|
|
33
33
|
* [validation-plugin](#validation-plugin)
|
|
34
34
|
* [address-plugin](#address-plugin)
|
|
35
|
+
* [template-comments-plugin](#template-comments-plugin)
|
|
35
36
|
|
|
36
37
|
You can configure your editor like this:
|
|
37
38
|
```hbs
|
|
@@ -626,6 +627,23 @@ For enabling it, you need to add the card provided by the plugin to the editor s
|
|
|
626
627
|
<AddressPlugin::Insert @controller={{this.controller}} />
|
|
627
628
|
```
|
|
628
629
|
|
|
630
|
+
## template-comments-plugin
|
|
631
|
+
A plugin to insert a template comment anywhere in the document.
|
|
632
|
+
This is meant as a block of text for extra information to provide to a created template. It has
|
|
633
|
+
the attribute `ext:TemplateComment`. This can (and should) be filtered out when publishing the document, as it is only meant as extra information while filling in a template.
|
|
634
|
+
It supports basic text with indenting, list items and the marks strong (bold), strikethrough and underline. Italic is not possible as the text is italic by default.
|
|
635
|
+
|
|
636
|
+
Add it to editor by adding `...templateCommentNodes` to your schema and `templateComment: templateCommentView(controller)` as a nodeview.
|
|
637
|
+
|
|
638
|
+
Logic to insert a template comment is added with
|
|
639
|
+
```hbs
|
|
640
|
+
<TemplateCommentsPlugin::Insert @controller={{this.controller}}/>
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
Buttons to remove and move it when selected can be shown with
|
|
644
|
+
```hbs
|
|
645
|
+
<TemplateCommentsPlugin::EditCard @controller={{this.controller}}/>
|
|
646
|
+
```
|
|
629
647
|
## Contributing
|
|
630
648
|
|
|
631
649
|
See the [Contributing](CONTRIBUTING.md) guide for details.
|
|
@@ -36,15 +36,27 @@ export default class SnippetInsertComponent extends Component<Args> {
|
|
|
36
36
|
@action
|
|
37
37
|
onInsert(content: string) {
|
|
38
38
|
const domParser = new DOMParser();
|
|
39
|
+
const parsed = domParser.parseFromString(content, 'text/html').body;
|
|
40
|
+
const documentDiv = parsed.querySelector('div[data-say-document="true"]');
|
|
39
41
|
|
|
40
42
|
this.closeModal();
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (documentDiv) {
|
|
45
|
+
return this.controller.withTransaction((tr) =>
|
|
46
|
+
tr.replaceSelectionWith(
|
|
47
|
+
ProseParser.fromSchema(this.controller.schema).parse(documentDiv, {
|
|
48
|
+
preserveWhitespace: true,
|
|
49
|
+
}),
|
|
46
50
|
),
|
|
47
51
|
);
|
|
48
|
-
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.controller.withTransaction((tr) =>
|
|
55
|
+
tr.replaceSelectionWith(
|
|
56
|
+
ProseParser.fromSchema(this.controller.schema).parse(parsed, {
|
|
57
|
+
preserveWhitespace: true,
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
);
|
|
49
61
|
}
|
|
50
62
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{{#if this.isInsideComment}}
|
|
2
|
+
<AuCard
|
|
3
|
+
@flex={{true}}
|
|
4
|
+
@divided={{true}}
|
|
5
|
+
@expandable={{false}}
|
|
6
|
+
@shadow={{true}}
|
|
7
|
+
@size='flush' as |c|
|
|
8
|
+
>
|
|
9
|
+
<c.content class='au-c-content--small'>
|
|
10
|
+
<AuList
|
|
11
|
+
@divider={{true}}
|
|
12
|
+
class='au-u-padding-top-tiny au-u-padding-bottom-tiny' as |Item|
|
|
13
|
+
>
|
|
14
|
+
<Item>
|
|
15
|
+
<AuButton
|
|
16
|
+
@icon='arrow-up'
|
|
17
|
+
@iconAlignment='left'
|
|
18
|
+
@skin='link'
|
|
19
|
+
@alert={{true}}
|
|
20
|
+
{{on 'click' this.moveUp}}
|
|
21
|
+
>
|
|
22
|
+
{{t 'template-comments-plugin.edit.move-up'}}
|
|
23
|
+
</AuButton>
|
|
24
|
+
</Item>
|
|
25
|
+
<Item>
|
|
26
|
+
<AuButton
|
|
27
|
+
@icon='bin'
|
|
28
|
+
@iconAlignment='left'
|
|
29
|
+
@skin='link'
|
|
30
|
+
@alert={{true}}
|
|
31
|
+
{{on 'click' this.remove}}
|
|
32
|
+
>
|
|
33
|
+
{{t 'template-comments-plugin.edit.remove'}}
|
|
34
|
+
</AuButton>
|
|
35
|
+
</Item>
|
|
36
|
+
<Item>
|
|
37
|
+
<AuButton
|
|
38
|
+
@icon='arrow-down'
|
|
39
|
+
@iconAlignment='left'
|
|
40
|
+
@skin='link'
|
|
41
|
+
@alert={{true}}
|
|
42
|
+
{{on 'click' this.moveDown}}
|
|
43
|
+
>
|
|
44
|
+
{{t 'template-comments-plugin.edit.move-down'}}
|
|
45
|
+
</AuButton>
|
|
46
|
+
</Item>
|
|
47
|
+
</AuList>
|
|
48
|
+
</c.content>
|
|
49
|
+
</AuCard>
|
|
50
|
+
{{/if}}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { SayController } from '@lblod/ember-rdfa-editor/addon';
|
|
4
|
+
import { TextSelection } from '@lblod/ember-rdfa-editor';
|
|
5
|
+
import { findParentNodeOfType } from '@curvenote/prosemirror-utils';
|
|
6
|
+
|
|
7
|
+
type Args = {
|
|
8
|
+
controller: SayController;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default class TemplateCommentsPluginEditCardComponent extends Component<Args> {
|
|
12
|
+
get controller() {
|
|
13
|
+
return this.args.controller;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get commentType() {
|
|
17
|
+
return this.controller.schema.nodes.templateComment;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get templateComment() {
|
|
21
|
+
const { selection } = this.controller.mainEditorState;
|
|
22
|
+
return findParentNodeOfType(this.commentType)(selection);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get isInsideComment() {
|
|
26
|
+
return !!this.templateComment;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@action
|
|
30
|
+
remove() {
|
|
31
|
+
const comment = this.templateComment;
|
|
32
|
+
if (!comment) return;
|
|
33
|
+
const { node: node, pos: pos } = comment;
|
|
34
|
+
this.controller.withTransaction((tr) => {
|
|
35
|
+
tr.replace(pos, pos + node.nodeSize);
|
|
36
|
+
return tr;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Move the template comment before the node left of this */
|
|
41
|
+
@action
|
|
42
|
+
moveUp() {
|
|
43
|
+
const comment = this.templateComment;
|
|
44
|
+
if (!comment) return;
|
|
45
|
+
const { node: node, pos: pos } = comment;
|
|
46
|
+
const resolvedPos = this.controller.mainEditorState.doc.resolve(pos);
|
|
47
|
+
const nodeBefore = resolvedPos.nodeBefore;
|
|
48
|
+
if (!nodeBefore) return;
|
|
49
|
+
const amountToMove = -nodeBefore.nodeSize;
|
|
50
|
+
const initialCursorPos =
|
|
51
|
+
this.controller.mainEditorState.selection.$head.pos;
|
|
52
|
+
const newPos = pos + amountToMove;
|
|
53
|
+
const newCursorPos = initialCursorPos + amountToMove;
|
|
54
|
+
this.controller.withTransaction((tr) => {
|
|
55
|
+
tr.delete(pos, pos + node.nodeSize);
|
|
56
|
+
tr.insert(newPos, node);
|
|
57
|
+
const mappedSelection = TextSelection.create(
|
|
58
|
+
tr.doc,
|
|
59
|
+
newCursorPos,
|
|
60
|
+
newCursorPos,
|
|
61
|
+
);
|
|
62
|
+
tr.setSelection(mappedSelection);
|
|
63
|
+
this.controller.focus();
|
|
64
|
+
return tr;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Move the template comment after the node right of this */
|
|
69
|
+
@action
|
|
70
|
+
moveDown() {
|
|
71
|
+
const comment = this.templateComment;
|
|
72
|
+
if (!comment) return;
|
|
73
|
+
|
|
74
|
+
const { node: commentNode, pos: startPos } = comment;
|
|
75
|
+
const posAfterComment = startPos + commentNode.nodeSize;
|
|
76
|
+
const resolvedPos =
|
|
77
|
+
this.controller.mainEditorState.doc.resolve(posAfterComment);
|
|
78
|
+
const nodeAfterComment = resolvedPos.nodeAfter;
|
|
79
|
+
if (!nodeAfterComment) return;
|
|
80
|
+
|
|
81
|
+
const amountToMove = commentNode.nodeSize + nodeAfterComment.nodeSize;
|
|
82
|
+
|
|
83
|
+
const newPos = startPos + amountToMove;
|
|
84
|
+
const initialCursorPos =
|
|
85
|
+
this.controller.mainEditorState.selection.$head.pos;
|
|
86
|
+
const newCursorPos = initialCursorPos + amountToMove;
|
|
87
|
+
|
|
88
|
+
this.controller.withTransaction((tr) => {
|
|
89
|
+
tr.insert(newPos, commentNode);
|
|
90
|
+
// do delete after setting the selection,
|
|
91
|
+
//so the selection position can be easily constructed
|
|
92
|
+
const mappedSelection = TextSelection.create(
|
|
93
|
+
tr.doc,
|
|
94
|
+
newCursorPos,
|
|
95
|
+
newCursorPos,
|
|
96
|
+
);
|
|
97
|
+
tr.setSelection(mappedSelection);
|
|
98
|
+
tr.delete(startPos, startPos + commentNode.nodeSize);
|
|
99
|
+
|
|
100
|
+
this.controller.focus();
|
|
101
|
+
return tr;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { findParentNode } from '@curvenote/prosemirror-utils';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
import { Command, SayController } from '@lblod/ember-rdfa-editor';
|
|
5
|
+
|
|
6
|
+
type Args = {
|
|
7
|
+
controller: SayController;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default class TemplateCommentsPluginInsertCardComponent extends Component<Args> {
|
|
11
|
+
get controller() {
|
|
12
|
+
return this.args.controller;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get schema() {
|
|
16
|
+
return this.controller.schema;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get canInsert() {
|
|
20
|
+
return this.controller.checkCommand(this.insertCommand());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@action
|
|
24
|
+
doInsert() {
|
|
25
|
+
this.controller.doCommand(this.insertCommand());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* insert before the first node in the selection
|
|
29
|
+
* This avoids splitting up existing nodes and follows the logic
|
|
30
|
+
* that a comment is desired before the place of the cursor
|
|
31
|
+
*/
|
|
32
|
+
insertCommand(): Command {
|
|
33
|
+
return (state, dispatch) => {
|
|
34
|
+
if (!this.controller || this.controller.inEmbeddedView) return false;
|
|
35
|
+
|
|
36
|
+
const selection = this.controller.mainEditorState.selection;
|
|
37
|
+
const parent = findParentNode((node) => {
|
|
38
|
+
return (
|
|
39
|
+
node.type !== this.controller.schema.nodes.text &&
|
|
40
|
+
node.type !== this.controller.schema.nodes.placeholder
|
|
41
|
+
);
|
|
42
|
+
})(selection);
|
|
43
|
+
const newTemplateNode = this.schema.nodes.templateComment.createAndFill();
|
|
44
|
+
if (!newTemplateNode) return false;
|
|
45
|
+
|
|
46
|
+
if (!parent) {
|
|
47
|
+
// if no parent, selection is somewhere at the top of doc, so insert at start of doc
|
|
48
|
+
if (dispatch) {
|
|
49
|
+
const transaction = state.tr
|
|
50
|
+
.insert(0, newTemplateNode)
|
|
51
|
+
.scrollIntoView();
|
|
52
|
+
|
|
53
|
+
dispatch(transaction);
|
|
54
|
+
this.controller.focus();
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// get the parent of parent
|
|
60
|
+
// check what content is allowed (contentMatchAt) by using the "index"
|
|
61
|
+
// check if template comment is allowed as comment.
|
|
62
|
+
// In principle this should be the same as `CanAppend`, but this seems to work better.
|
|
63
|
+
const insertPos = parent.pos;
|
|
64
|
+
const resolvedPos = state.doc.resolve(insertPos);
|
|
65
|
+
const parentAboveInsertion = resolvedPos.parent;
|
|
66
|
+
const indexInParent = resolvedPos.index();
|
|
67
|
+
const allowedContent = parentAboveInsertion.contentMatchAt(indexInParent);
|
|
68
|
+
const allowed = allowedContent.matchType(newTemplateNode.type);
|
|
69
|
+
if (!allowed) return false;
|
|
70
|
+
if (dispatch) {
|
|
71
|
+
const transaction = state.tr
|
|
72
|
+
.insert(insertPos, newTemplateNode)
|
|
73
|
+
.scrollIntoView();
|
|
74
|
+
|
|
75
|
+
dispatch(transaction);
|
|
76
|
+
this.controller.focus();
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<AuAlert
|
|
2
|
+
@size='small'
|
|
3
|
+
@title={{t 'template-comments-plugin.long-title'}}
|
|
4
|
+
@skin='info'
|
|
5
|
+
@icon='circle-info'
|
|
6
|
+
class='template-comment {{
|
|
7
|
+
if this.selectionInside 'ProseMirror-selectednode'
|
|
8
|
+
}} default-cursor'
|
|
9
|
+
>
|
|
10
|
+
<em class='text-cursor'>
|
|
11
|
+
{{yield}}
|
|
12
|
+
</em>
|
|
13
|
+
</AuAlert>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { PluginConfig, inputRules } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
4
|
+
import {
|
|
5
|
+
bullet_list_input_rule,
|
|
6
|
+
ordered_list_input_rule,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor/plugins/list';
|
|
8
|
+
import { baseKeymap } from '@lblod/ember-rdfa-editor/core/keymap';
|
|
9
|
+
|
|
10
|
+
export default class TemplateCommentsPluginTemplateCommentComponent extends Component<EmberNodeArgs> {
|
|
11
|
+
get outerView() {
|
|
12
|
+
return this.args.view;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get controller() {
|
|
16
|
+
return this.args.controller;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get schema() {
|
|
20
|
+
return this.controller.schema;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get selectionInside() {
|
|
24
|
+
const { pos: selectPos } = this.controller.mainEditorState.selection.$from;
|
|
25
|
+
const nodePos = this.args.getPos();
|
|
26
|
+
const startSelectionInsideNode =
|
|
27
|
+
nodePos !== undefined &&
|
|
28
|
+
selectPos > nodePos &&
|
|
29
|
+
selectPos < nodePos + this.args.node.nodeSize;
|
|
30
|
+
return startSelectionInsideNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get keymap() {
|
|
34
|
+
const keymap = baseKeymap(this.schema);
|
|
35
|
+
// bind ctrl+i to nothing, so it still gets catched by prosemirror
|
|
36
|
+
// otherwise the browser will see this as a key pressed, which can be confusing for user.
|
|
37
|
+
return {
|
|
38
|
+
...keymap,
|
|
39
|
+
'Mod-i': () => true,
|
|
40
|
+
'Mod-I': () => true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get plugins(): PluginConfig {
|
|
45
|
+
return [
|
|
46
|
+
inputRules({
|
|
47
|
+
rules: [
|
|
48
|
+
bullet_list_input_rule(this.schema.nodes.bullet_list),
|
|
49
|
+
ordered_list_input_rule(this.schema.nodes.ordered_list),
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EXT } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
|
|
2
|
+
import { hasRDFaAttribute } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/namespace';
|
|
3
|
+
import {
|
|
4
|
+
createEmberNodeSpec,
|
|
5
|
+
createEmberNodeView,
|
|
6
|
+
EmberNodeConfig,
|
|
7
|
+
} from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
8
|
+
import { paragraphWithConfig } from '@lblod/ember-rdfa-editor/nodes/paragraphWithConfig';
|
|
9
|
+
|
|
10
|
+
export const emberNodeConfig: () => EmberNodeConfig = () => {
|
|
11
|
+
return {
|
|
12
|
+
name: 'template-comment',
|
|
13
|
+
componentPath: 'template-comments-plugin/template-comment',
|
|
14
|
+
inline: false,
|
|
15
|
+
group: 'block',
|
|
16
|
+
content: '(templateCommentParagraph | list)+',
|
|
17
|
+
draggable: false,
|
|
18
|
+
selectable: true,
|
|
19
|
+
isolating: true,
|
|
20
|
+
atom: false,
|
|
21
|
+
attrs: {},
|
|
22
|
+
toDOM() {
|
|
23
|
+
return [
|
|
24
|
+
'div',
|
|
25
|
+
{
|
|
26
|
+
typeof: EXT('TemplateComment').prefixed,
|
|
27
|
+
},
|
|
28
|
+
[
|
|
29
|
+
'i',
|
|
30
|
+
{},
|
|
31
|
+
['h3', {}, 'toelichtingsbepaling'],
|
|
32
|
+
['div', { property: EXT('content').prefixed }, 0],
|
|
33
|
+
],
|
|
34
|
+
];
|
|
35
|
+
},
|
|
36
|
+
parseDOM: [
|
|
37
|
+
{
|
|
38
|
+
tag: 'div',
|
|
39
|
+
getAttrs(element: HTMLElement) {
|
|
40
|
+
if (hasRDFaAttribute(element, 'typeof', EXT('TemplateComment'))) {
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
},
|
|
45
|
+
contentElement: `div[property~='${EXT('content').prefixed}'],
|
|
46
|
+
div[property~='${EXT('content').full}']`,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const templateComment = createEmberNodeSpec(emberNodeConfig());
|
|
53
|
+
export const templateCommentView = createEmberNodeView(emberNodeConfig());
|
|
54
|
+
export const templateCommentNodes = {
|
|
55
|
+
templateComment: templateComment,
|
|
56
|
+
templateCommentParagraph: paragraphWithConfig({
|
|
57
|
+
marks: 'strong underline strikethrough',
|
|
58
|
+
// don't add to any groups, so it is only allowed for template comment
|
|
59
|
+
group: '',
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-comments-plugin/comment-editor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-comments-plugin/edit-card';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-comments-plugin/insert-template-comment';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-comments-plugin/insert';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@lblod/ember-rdfa-editor-lblod-plugins/components/template-comments-plugin/template-comment';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@import "ember-appuniversum";
|
|
2
|
+
|
|
3
|
+
.template-comment {
|
|
4
|
+
color: var(--au-blue-900);
|
|
5
|
+
|
|
6
|
+
.au-c-alert__content {
|
|
7
|
+
margin-top: 0;
|
|
8
|
+
|
|
9
|
+
::selection {
|
|
10
|
+
background-color: var(--au-blue-300);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
background-color: var(--au-blue-200);
|
|
15
|
+
|
|
16
|
+
.au-c-alert__icon {
|
|
17
|
+
background-color: var(--au-blue-200);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.au-c-alert__message {
|
|
21
|
+
color: var(--au-gray-900);
|
|
22
|
+
|
|
23
|
+
p {
|
|
24
|
+
white-space: break-spaces;
|
|
25
|
+
word-wrap: break-word;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.ProseMirror-selectednode {
|
|
30
|
+
outline: 2px solid var(--au-blue-500);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.default-cursor {
|
|
35
|
+
cursor: default;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.text-cursor {
|
|
39
|
+
cursor: text;
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { SayController } from '@lblod/ember-rdfa-editor/addon';
|
|
3
|
+
type Args = {
|
|
4
|
+
controller: SayController;
|
|
5
|
+
};
|
|
6
|
+
export default class TemplateCommentsPluginEditCardComponent extends Component<Args> {
|
|
7
|
+
get controller(): SayController;
|
|
8
|
+
get commentType(): import("prosemirror-model").NodeType;
|
|
9
|
+
get templateComment(): {
|
|
10
|
+
pos: number;
|
|
11
|
+
start: number;
|
|
12
|
+
depth: number;
|
|
13
|
+
node: import("prosemirror-model").Node;
|
|
14
|
+
} | undefined;
|
|
15
|
+
get isInsideComment(): boolean;
|
|
16
|
+
remove(): void;
|
|
17
|
+
moveUp(): void;
|
|
18
|
+
moveDown(): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { Command, SayController } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
type Args = {
|
|
4
|
+
controller: SayController;
|
|
5
|
+
};
|
|
6
|
+
export default class TemplateCommentsPluginInsertCardComponent extends Component<Args> {
|
|
7
|
+
get controller(): SayController;
|
|
8
|
+
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
9
|
+
get canInsert(): boolean;
|
|
10
|
+
doInsert(): void;
|
|
11
|
+
insertCommand(): Command;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { PluginConfig } from '@lblod/ember-rdfa-editor';
|
|
3
|
+
import { EmberNodeArgs } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
4
|
+
export default class TemplateCommentsPluginTemplateCommentComponent extends Component<EmberNodeArgs> {
|
|
5
|
+
get outerView(): import("@lblod/ember-rdfa-editor").SayView;
|
|
6
|
+
get controller(): import("@lblod/ember-rdfa-editor").SayController;
|
|
7
|
+
get schema(): import("prosemirror-model").Schema<any, any>;
|
|
8
|
+
get selectionInside(): boolean;
|
|
9
|
+
get keymap(): {
|
|
10
|
+
'Mod-i': () => boolean;
|
|
11
|
+
'Mod-I': () => boolean;
|
|
12
|
+
};
|
|
13
|
+
get plugins(): PluginConfig;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -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": "^4.
|
|
72
|
+
"@lblod/ember-rdfa-editor": "^4.2.0",
|
|
73
73
|
"@rdfjs/types": "^1.1.0",
|
|
74
74
|
"@release-it/keep-a-changelog": "^3.1.0",
|
|
75
75
|
"@tsconfig/ember": "^3.0.0",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
},
|
|
149
149
|
"peerDependencies": {
|
|
150
150
|
"@appuniversum/ember-appuniversum": "^2.4.2",
|
|
151
|
-
"@lblod/ember-rdfa-editor": "^4.
|
|
151
|
+
"@lblod/ember-rdfa-editor": "^4.2.0",
|
|
152
152
|
"ember-concurrency": "^2.3.7"
|
|
153
153
|
},
|
|
154
154
|
"overrides": {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DateOptions } from '..';
|
|
2
|
-
export declare const date: (options: DateOptions) => import("
|
|
2
|
+
export declare const date: (options: DateOptions) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
3
3
|
export declare const dateView: (options: DateOptions) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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
|
-
export declare const table_of_contents: (config: TableOfContentsConfig) => import("
|
|
4
|
+
export declare const table_of_contents: (config: TableOfContentsConfig) => import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
5
5
|
export declare const tableOfContentsView: (config: TableOfContentsConfig) => (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { templateComment, templateCommentView, templateCommentNodes, } from './node';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EmberNodeConfig } from '@lblod/ember-rdfa-editor/utils/ember-node';
|
|
2
|
+
export declare const emberNodeConfig: () => EmberNodeConfig;
|
|
3
|
+
export declare const templateComment: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
4
|
+
export declare const templateCommentView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
|
|
5
|
+
export declare const templateCommentNodes: {
|
|
6
|
+
templateComment: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
7
|
+
templateCommentParagraph: import("prosemirror-model").NodeSpec;
|
|
8
|
+
};
|
|
@@ -33,5 +33,5 @@ export declare const contentToDom: ({ content, type, node, }: {
|
|
|
33
33
|
export declare const parseAttributes: (node: HTMLElement) => false | Attrs;
|
|
34
34
|
export declare const attributesToDOM: (node: PNode, content?: string | null) => DOMOutputSpec;
|
|
35
35
|
export declare const emberNodeConfig: EmberNodeConfig;
|
|
36
|
-
export declare const variable: import("
|
|
36
|
+
export declare const variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
37
37
|
export declare const variableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const number: import("
|
|
1
|
+
export declare const number: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
|
|
2
2
|
export declare const numberView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("prosemirror-view").NodeViewConstructor;
|
package/translations/en-US.yaml
CHANGED
|
@@ -252,6 +252,15 @@ snippet-plugin:
|
|
|
252
252
|
error-intro: 'An error occurred while loading results'
|
|
253
253
|
error-outro: In case this problem keeps occurring, please contact
|
|
254
254
|
|
|
255
|
+
template-comments-plugin:
|
|
256
|
+
long-title: Template comment or example
|
|
257
|
+
insert:
|
|
258
|
+
title: Add template comment or example
|
|
259
|
+
edit:
|
|
260
|
+
remove: Remove template comment or example
|
|
261
|
+
move-up: Move comment up
|
|
262
|
+
move-down: Move comment down
|
|
263
|
+
|
|
255
264
|
pagination:
|
|
256
265
|
next: Next page
|
|
257
266
|
previous: Previous page
|
package/translations/nl-BE.yaml
CHANGED
|
@@ -256,6 +256,14 @@ snippet-plugin:
|
|
|
256
256
|
error-intro: "Er is een fout opgetreden tijdens het laden van de resultaten:"
|
|
257
257
|
error-outro: Moest dit probleem aanhouden, neem contact op met
|
|
258
258
|
|
|
259
|
+
template-comments-plugin:
|
|
260
|
+
long-title: Toelichtings- of voorbeeldbepaling
|
|
261
|
+
insert:
|
|
262
|
+
title: Toelichtings- of voorbeeldbepaling invoegen
|
|
263
|
+
edit:
|
|
264
|
+
remove: Verwijder Toelichtings- of voorbeeldbepaling
|
|
265
|
+
move-down: Toelichtings- of voorbeeldbepaling naar onder
|
|
266
|
+
move-up: Toelichtings- of voorbeeldbepaling naar boven
|
|
259
267
|
pagination:
|
|
260
268
|
next: Volgende pagina
|
|
261
269
|
previous: Vorige pagina
|