@trafica/editor 1.0.30 → 1.0.32

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/dist/index.js CHANGED
@@ -661,9 +661,16 @@ function applyTransaction(state, tr) {
661
661
  case "split_block":
662
662
  doc = splitBlock(doc, step.path, step.offset);
663
663
  break;
664
- case "join_blocks":
664
+ case "join_blocks": {
665
+ const joinIdx = step.path[step.path.length - 1];
666
+ const prevPath = [...step.path.slice(0, -1), joinIdx - 1];
667
+ const prevNode = getNodeAtPath(doc, prevPath);
668
+ const prevTextLen = prevNode && "children" in prevNode ? collectText(prevNode).length : 0;
665
669
  doc = joinBlocks(doc, step.path);
670
+ const joinPos = getPosFromCharOffset(doc, prevPath, prevTextLen);
671
+ selection = { anchor: joinPos, focus: joinPos, isCollapsed: true };
666
672
  break;
673
+ }
667
674
  case "set_node_type":
668
675
  doc = setBlockType(doc, step.path, step.nodeType, step.attrs);
669
676
  break;
@@ -8523,7 +8530,7 @@ function EditorCore({
8523
8530
  isVisualEmpty && /* @__PURE__ */ jsxRuntime.jsx(
8524
8531
  "div",
8525
8532
  {
8526
- className: "\n absolute\n top-6\n left-6\n pointer-events-none\n select-none\n text-base\n text-gray-400\n \n ",
8533
+ className: "\r\n absolute\r\n top-6\r\n left-6\r\n pointer-events-none\r\n select-none\r\n text-base\r\n text-gray-400\r\n \r\n ",
8527
8534
  "aria-hidden": "true",
8528
8535
  children: placeholder
8529
8536
  }