@trafica/editor 1.0.31 → 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.mjs CHANGED
@@ -659,9 +659,16 @@ function applyTransaction(state, tr) {
659
659
  case "split_block":
660
660
  doc = splitBlock(doc, step.path, step.offset);
661
661
  break;
662
- case "join_blocks":
662
+ case "join_blocks": {
663
+ const joinIdx = step.path[step.path.length - 1];
664
+ const prevPath = [...step.path.slice(0, -1), joinIdx - 1];
665
+ const prevNode = getNodeAtPath(doc, prevPath);
666
+ const prevTextLen = prevNode && "children" in prevNode ? collectText(prevNode).length : 0;
663
667
  doc = joinBlocks(doc, step.path);
668
+ const joinPos = getPosFromCharOffset(doc, prevPath, prevTextLen);
669
+ selection = { anchor: joinPos, focus: joinPos, isCollapsed: true };
664
670
  break;
671
+ }
665
672
  case "set_node_type":
666
673
  doc = setBlockType(doc, step.path, step.nodeType, step.attrs);
667
674
  break;
@@ -8521,7 +8528,7 @@ function EditorCore({
8521
8528
  isVisualEmpty && /* @__PURE__ */ jsx(
8522
8529
  "div",
8523
8530
  {
8524
- 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 ",
8531
+ 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 ",
8525
8532
  "aria-hidden": "true",
8526
8533
  children: placeholder
8527
8534
  }