@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-beta.4 → 1.0.0-beta.6
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 +21 -0
- package/addon/components/besluit-type-plugin/toolbar-dropdown.ts +4 -3
- package/addon/components/standard-template-plugin/template-provider.ts +10 -3
- package/addon/plugins/article-structure-plugin/commands/wrap-structure-content.ts +3 -6
- package/addon/plugins/standard-template-plugin/utils/nodes.ts +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,27 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
## 1.0.0-beta.6 (2023-01-25)
|
|
18
|
+
|
|
19
|
+
#### :bug: Bug Fix
|
|
20
|
+
* [#81](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/pull/81) Wrap-structure-content: return false if structure is not a wrapper ([@elpoelma](https://github.com/elpoelma))
|
|
21
|
+
|
|
22
|
+
#### Committers: 1
|
|
23
|
+
- Elena Poelman ([@elpoelma](https://github.com/elpoelma))
|
|
24
|
+
|
|
25
|
+
## 1.0.0-beta.5 (2023-01-25)
|
|
26
|
+
|
|
27
|
+
* chore(deps): update editor to beta 7 (ef72b82)
|
|
28
|
+
* Merge pull request #80 (d76dd89)
|
|
29
|
+
* Merge pull request #79 (69a5c62)
|
|
30
|
+
* Merge pull request #78 (fc68bf5)
|
|
31
|
+
* fix(decision-type): remove the old type before adding the new one (701ad87)
|
|
32
|
+
* fix(template): improve insertion behavior of standard templates (96cba5c)
|
|
33
|
+
* fix(nodes): make important nodes defining (5534c00)
|
|
34
|
+
* fix(nodes): make title node also parse on other header levels (9229677)
|
|
35
|
+
|
|
36
|
+
|
|
16
37
|
## 1.0.0-beta.4 (2023-01-24)
|
|
17
38
|
|
|
18
39
|
#### :bug: Bug Fix
|
|
@@ -17,6 +17,7 @@ import fetchBesluitTypes, {
|
|
|
17
17
|
BesluitType,
|
|
18
18
|
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/besluit-type-plugin/utils/fetchBesluitTypes';
|
|
19
19
|
import { findAncestorOfType } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/article-structure-plugin/utils/structure';
|
|
20
|
+
|
|
20
21
|
declare module 'ember__owner' {
|
|
21
22
|
export default interface Owner {
|
|
22
23
|
resolveRegistration(name: string): unknown;
|
|
@@ -207,14 +208,14 @@ export default class EditorPluginsToolbarDropdownComponent extends Component<Arg
|
|
|
207
208
|
insert() {
|
|
208
209
|
if (this.besluitType && this.currentBesluitRange) {
|
|
209
210
|
this.cardExpanded = false;
|
|
210
|
-
this.controller.checkAndDoCommand(
|
|
211
|
-
addType(this.currentBesluitRange.from, this.besluitType.uri)
|
|
212
|
-
);
|
|
213
211
|
if (this.previousBesluitType) {
|
|
214
212
|
this.controller.checkAndDoCommand(
|
|
215
213
|
removeType(this.currentBesluitRange.from, this.previousBesluitType)
|
|
216
214
|
);
|
|
217
215
|
}
|
|
216
|
+
this.controller.checkAndDoCommand(
|
|
217
|
+
addType(this.currentBesluitRange.from, this.besluitType.uri)
|
|
218
|
+
);
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -98,10 +98,17 @@ export default class TemplateProviderComponent extends Component<Args> {
|
|
|
98
98
|
const selection = this.controller.state.selection;
|
|
99
99
|
let insertRange: { from: number; to: number } = selection;
|
|
100
100
|
const { $from, $to } = selection;
|
|
101
|
-
|
|
101
|
+
const isInPlaceholder =
|
|
102
102
|
$from.parent.type === this.controller.schema.nodes['placeholder'] &&
|
|
103
|
-
$from.sameParent($to)
|
|
104
|
-
|
|
103
|
+
$from.sameParent($to);
|
|
104
|
+
// if we would be completely replacing the contents of a simple paragraph node,
|
|
105
|
+
// replace the entire node instead
|
|
106
|
+
const isInSimpleParagraph =
|
|
107
|
+
$from.parent.type === this.controller.schema.nodes.paragraph &&
|
|
108
|
+
$from.sameParent($to) &&
|
|
109
|
+
$from.pos === $from.start() &&
|
|
110
|
+
$to.pos === $to.end();
|
|
111
|
+
if (isInPlaceholder || isInSimpleParagraph) {
|
|
105
112
|
insertRange = {
|
|
106
113
|
from: $from.start($from.depth - 1),
|
|
107
114
|
to: $from.end($from.depth - 1),
|
|
@@ -15,6 +15,9 @@ const wrapStructureContent = (
|
|
|
15
15
|
intl: IntlService
|
|
16
16
|
): Command => {
|
|
17
17
|
return (state, dispatch) => {
|
|
18
|
+
if (!structureSpec.content) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
18
21
|
const { selection, schema } = state;
|
|
19
22
|
const container = findInsertionContainer(
|
|
20
23
|
selection,
|
|
@@ -23,12 +26,6 @@ const wrapStructureContent = (
|
|
|
23
26
|
if (!container) {
|
|
24
27
|
return false;
|
|
25
28
|
}
|
|
26
|
-
// const { node, pos } = parent;
|
|
27
|
-
// if (
|
|
28
|
-
// !node.canReplaceWith(0, node.childCount, schema.nodes[structureSpec.name])
|
|
29
|
-
// ) {
|
|
30
|
-
// return false;
|
|
31
|
-
// }
|
|
32
29
|
const contentToWrap = container.node.content;
|
|
33
30
|
|
|
34
31
|
let result: {
|
|
@@ -19,6 +19,7 @@ import { unwrap } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
|
|
|
19
19
|
export const title: NodeSpec = {
|
|
20
20
|
content: 'paragraph+',
|
|
21
21
|
inline: false,
|
|
22
|
+
defining: true,
|
|
22
23
|
attrs: {
|
|
23
24
|
...rdfaAttrs,
|
|
24
25
|
property: {
|
|
@@ -33,7 +34,7 @@ export const title: NodeSpec = {
|
|
|
33
34
|
},
|
|
34
35
|
parseDOM: [
|
|
35
36
|
{
|
|
36
|
-
tag: 'h4',
|
|
37
|
+
tag: 'h1,h2,h3,h4,h5',
|
|
37
38
|
getAttrs(element: HTMLElement) {
|
|
38
39
|
if (hasRDFaAttribute(element, 'property', ELI('title'))) {
|
|
39
40
|
return getRdfaAttrs(element);
|
|
@@ -298,6 +299,7 @@ export const besluit: NodeSpec = {
|
|
|
298
299
|
group: 'block',
|
|
299
300
|
content: 'block*title?block*description?block*motivering?block*',
|
|
300
301
|
inline: false,
|
|
302
|
+
defining: true,
|
|
301
303
|
attrs: {
|
|
302
304
|
...rdfaAttrs,
|
|
303
305
|
property: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lblod/ember-rdfa-editor-lblod-plugins",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -62,7 +62,7 @@
|
|
|
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-beta.
|
|
65
|
+
"@lblod/ember-rdfa-editor": "^1.0.0-beta.7",
|
|
66
66
|
"@rdfjs/types": "^1.1.0",
|
|
67
67
|
"@release-it-plugins/lerna-changelog": "^5.0.0",
|
|
68
68
|
"@tsconfig/ember": "^1.0.1",
|