@contentful/field-editor-rich-text 1.1.0 → 1.1.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.
@@ -3016,12 +3016,20 @@ var HyperlinkPlugin = function HyperlinkPlugin(_ref) {
3016
3016
  return next();
3017
3017
  },
3018
3018
  normalizeNode: function normalizeNode(node, editor, next) {
3019
- if (isHyperlink(node.type) && node.getInlines().size > 0) {
3020
- return function () {
3021
- node.getInlines().forEach(function (inlineNode) {
3022
- return editor.unwrapInlineByKey(inlineNode.key, node.type);
3023
- });
3024
- };
3019
+ if (isHyperlink(node.type)) {
3020
+ if (node.text.trim() === '') {
3021
+ return function () {
3022
+ editor.removeNodeByKey(node.key);
3023
+ };
3024
+ }
3025
+
3026
+ if (node.getInlines().size > 0) {
3027
+ return function () {
3028
+ node.getInlines().forEach(function (inlineNode) {
3029
+ return editor.unwrapInlineByKey(inlineNode.key, node.type);
3030
+ });
3031
+ };
3032
+ }
3025
3033
  }
3026
3034
 
3027
3035
  next();