@lblod/ember-rdfa-editor-lblod-plugins 1.0.0-beta.4 → 1.0.0-beta.5

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 CHANGED
@@ -13,6 +13,18 @@
13
13
 
14
14
 
15
15
 
16
+ ## 1.0.0-beta.5 (2023-01-25)
17
+
18
+ * chore(deps): update editor to beta 7 (ef72b82)
19
+ * Merge pull request #80 (d76dd89)
20
+ * Merge pull request #79 (69a5c62)
21
+ * Merge pull request #78 (fc68bf5)
22
+ * fix(decision-type): remove the old type before adding the new one (701ad87)
23
+ * fix(template): improve insertion behavior of standard templates (96cba5c)
24
+ * fix(nodes): make important nodes defining (5534c00)
25
+ * fix(nodes): make title node also parse on other header levels (9229677)
26
+
27
+
16
28
  ## 1.0.0-beta.4 (2023-01-24)
17
29
 
18
30
  #### :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
- if (
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),
@@ -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.4",
3
+ "version": "1.0.0-beta.5",
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.6",
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",