@flozy/editor 5.7.0 → 5.7.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.
@@ -648,6 +648,7 @@ export function getInitialValue(value = [], readOnly) {
648
648
  // remove last empty nodes on readonly mode, to remove empty spaces
649
649
 
650
650
  let lastNonEmptyElementIndex;
651
+ const omittedNodes = [];
651
652
  for (let i = value?.length; i > 0; i--) {
652
653
  const elementIndex = i - 1;
653
654
  const node = value[elementIndex];
@@ -660,13 +661,14 @@ export function getInitialValue(value = [], readOnly) {
660
661
  const text = node.children[node.children.length - 1]?.text;
661
662
  lastNonEmptyElementIndex = hasOnlyTextChildren ? text ? elementIndex : null : elementIndex;
662
663
  } else if (omitNodes.includes(node?.type)) {
664
+ omittedNodes.push(node);
663
665
  continue;
664
666
  } else {
665
667
  lastNonEmptyElementIndex = elementIndex;
666
668
  }
667
669
  }
668
670
  const newValue = [...value].slice(0, lastNonEmptyElementIndex + 1);
669
- return newValue;
671
+ return [...newValue, ...omittedNodes];
670
672
  }
671
673
  return value;
672
674
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"