@quadrats/common 0.4.0 → 0.4.4

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.
@@ -1,5 +1,5 @@
1
1
  import { isUrl } from '@quadrats/utils';
2
- import { Range, unwrapNodesByTypes, Editor, Element, Transforms, getRangeBeforeFromAboveBlockStart, getRangeBefore, isNodesTypeIn, wrapNodesWithUnhangRange, Text, getAboveByTypes } from '@quadrats/core';
2
+ import { Range, unwrapNodesByTypes, Editor, Element, Transforms, Text, getRangeBeforeFromAboveBlockStart, getRangeBefore, isNodesTypeIn, wrapNodesWithUnhangRange, getAboveByTypes } from '@quadrats/core';
3
3
  import { LINK_TYPE } from './constants.js';
4
4
 
5
5
  function createLink({ type = LINK_TYPE, isUrl: isUrl$1 = isUrl, prevUrlToLinkAfterSpaceEntered = true, wrappableVoidTypes, } = {}) {
@@ -129,6 +129,15 @@ function createLink({ type = LINK_TYPE, isUrl: isUrl$1 = isUrl, prevUrlToLinkAft
129
129
  Transforms.unwrapNodes(editor, { at: path });
130
130
  return;
131
131
  }
132
+ /**
133
+ * Remove empty content.
134
+ */
135
+ if (Text.isTextList(node.children)) {
136
+ if (node.children.every((textNode) => !textNode.text)) {
137
+ Transforms.unwrapNodes(editor, { at: path });
138
+ return;
139
+ }
140
+ }
132
141
  }
133
142
  normalizeNode(entry);
134
143
  };
package/link/index.cjs.js CHANGED
@@ -134,6 +134,15 @@ function createLink({ type = LINK_TYPE, isUrl = utils.isUrl, prevUrlToLinkAfterS
134
134
  core.Transforms.unwrapNodes(editor, { at: path });
135
135
  return;
136
136
  }
137
+ /**
138
+ * Remove empty content.
139
+ */
140
+ if (core.Text.isTextList(node.children)) {
141
+ if (node.children.every((textNode) => !textNode.text)) {
142
+ core.Transforms.unwrapNodes(editor, { at: path });
143
+ return;
144
+ }
145
+ }
137
146
  }
138
147
  normalizeNode(entry);
139
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quadrats/common",
3
- "version": "0.4.0",
3
+ "version": "0.4.4",
4
4
  "description": "",
5
5
  "author": "Rytass",
6
6
  "homepage": "https://github.com/Quadrats/quadrats#readme",