@superdoc-dev/cli 0.2.0-next.87 → 0.2.0-next.89

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.
Files changed (2) hide show
  1. package/dist/index.js +155 -27
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -886,13 +886,13 @@ var schemaBooleanOrNull = () => ({
886
886
  tracked: true,
887
887
  carrier: markCarrier(markName),
888
888
  schema: schemaBooleanOrNull()
889
- }), markTextStyleValue = (key, type, ooxmlElement, schema) => ({
889
+ }), markTextStyleValue = (key, type, ooxmlElement, schema, textStyleAttr) => ({
890
890
  key,
891
891
  type,
892
892
  ooxmlElement,
893
893
  storage: "mark",
894
894
  tracked: true,
895
- carrier: markCarrier("textStyle", key),
895
+ carrier: markCarrier("textStyle", textStyleAttr ?? key),
896
896
  schema
897
897
  }), runAttribute = (key, type, ooxmlElement, schema, runPropertyKey) => ({
898
898
  key,
@@ -957,7 +957,7 @@ var init_inline_run_patch = __esm(() => {
957
957
  markTextStyleValue("position", "number", "w:position", schemaNumberOrNull()),
958
958
  runAttribute("dstrike", "boolean", "w:dstrike", schemaBooleanOrNull()),
959
959
  runAttribute("smallCaps", "boolean", "w:smallCaps", schemaBooleanOrNull()),
960
- runAttribute("caps", "boolean", "w:caps", schemaBooleanOrNull()),
960
+ markTextStyleValue("caps", "boolean", "w:caps", schemaBooleanOrNull(), "textTransform"),
961
961
  runAttribute("shading", "object", "w:shd", schemaObjectOrNull({
962
962
  fill: { oneOf: [{ type: "string", minLength: 1 }, { type: "null" }] },
963
963
  color: { oneOf: [{ type: "string", minLength: 1 }, { type: "null" }] },
@@ -33220,7 +33220,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
33220
33220
  emptyOptions2 = {};
33221
33221
  });
33222
33222
 
33223
- // ../../packages/superdoc/dist/chunks/SuperConverter-BcmJ8-gc.es.js
33223
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CHHvo5ta.es.js
33224
33224
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
33225
33225
  const fieldValue = extension$1.config[field];
33226
33226
  if (typeof fieldValue === "function")
@@ -53630,13 +53630,13 @@ var isRegExp = (value) => {
53630
53630
  tracked: true,
53631
53631
  carrier: markCarrier2(markName),
53632
53632
  schema: schemaBooleanOrNull2()
53633
- }), markTextStyleValue2 = (key, type, ooxmlElement, schema) => ({
53633
+ }), markTextStyleValue2 = (key, type, ooxmlElement, schema, textStyleAttr) => ({
53634
53634
  key,
53635
53635
  type,
53636
53636
  ooxmlElement,
53637
53637
  storage: "mark",
53638
53638
  tracked: true,
53639
- carrier: markCarrier2("textStyle", key),
53639
+ carrier: markCarrier2("textStyle", textStyleAttr ?? key),
53640
53640
  schema
53641
53641
  }), runAttribute2 = (key, type, ooxmlElement, schema, runPropertyKey) => ({
53642
53642
  key,
@@ -65012,7 +65012,7 @@ var isRegExp = (value) => {
65012
65012
  state.kern = kernNode.attributes["w:val"];
65013
65013
  }
65014
65014
  }, SuperConverter;
65015
- var init_SuperConverter_BcmJ8_gc_es = __esm(() => {
65015
+ var init_SuperConverter_CHHvo5ta_es = __esm(() => {
65016
65016
  init_rolldown_runtime_B2q5OVn9_es();
65017
65017
  init_jszip_ChlR43oI_es();
65018
65018
  init_xml_js_DLE8mr0n_es();
@@ -67552,7 +67552,7 @@ var init_SuperConverter_BcmJ8_gc_es = __esm(() => {
67552
67552
  markTextStyleValue2("position", "number", "w:position", schemaNumberOrNull2()),
67553
67553
  runAttribute2("dstrike", "boolean", "w:dstrike", schemaBooleanOrNull2()),
67554
67554
  runAttribute2("smallCaps", "boolean", "w:smallCaps", schemaBooleanOrNull2()),
67555
- runAttribute2("caps", "boolean", "w:caps", schemaBooleanOrNull2()),
67555
+ markTextStyleValue2("caps", "boolean", "w:caps", schemaBooleanOrNull2(), "textTransform"),
67556
67556
  runAttribute2("shading", "object", "w:shd", schemaObjectOrNull2({
67557
67557
  fill: { oneOf: [{
67558
67558
  type: "string",
@@ -121745,9 +121745,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
121745
121745
  init_remark_gfm_z_sDF4ss_es();
121746
121746
  });
121747
121747
 
121748
- // ../../packages/superdoc/dist/chunks/src-LqliKMID.es.js
121749
- var exports_src_LqliKMID_es = {};
121750
- __export(exports_src_LqliKMID_es, {
121748
+ // ../../packages/superdoc/dist/chunks/src-CKjtLfFG.es.js
121749
+ var exports_src_CKjtLfFG_es = {};
121750
+ __export(exports_src_CKjtLfFG_es, {
121751
121751
  zt: () => defineMark,
121752
121752
  z: () => cM,
121753
121753
  yt: () => removeAwarenessStates,
@@ -127544,6 +127544,20 @@ function skipTab(dir) {
127544
127544
  return true;
127545
127545
  };
127546
127546
  }
127547
+ function tableSeparatorNeeds$1(doc$2, pos) {
127548
+ const $pos = doc$2.resolve(pos);
127549
+ if ($pos.depth !== 0)
127550
+ return {
127551
+ before: false,
127552
+ after: false
127553
+ };
127554
+ const indexAfter = $pos.index(0);
127555
+ const nodeAfter = indexAfter < doc$2.childCount ? doc$2.child(indexAfter) : null;
127556
+ return {
127557
+ before: (indexAfter > 0 ? doc$2.child(indexAfter - 1) : null)?.type.name === "table",
127558
+ after: !nodeAfter || nodeAfter.type.name === "table"
127559
+ };
127560
+ }
127547
127561
  function isVisuallyEmptyParagraph(node3) {
127548
127562
  if (!node3 || node3.type.name !== "paragraph")
127549
127563
  return false;
@@ -132162,6 +132176,11 @@ function toPointString(value) {
132162
132176
  function toHalfPoints(value) {
132163
132177
  return Math.round(value * 2);
132164
132178
  }
132179
+ function capsToTextTransform(caps) {
132180
+ if (caps === null)
132181
+ return null;
132182
+ return caps ? "uppercase" : "none";
132183
+ }
132165
132184
  function collectInlineTextSegments(doc$2, absFrom, absTo) {
132166
132185
  const segments = [];
132167
132186
  doc$2.nodesBetween(absFrom, absTo, (node3, pos) => {
@@ -132211,8 +132230,7 @@ function applyHighlightPatch(tr, markType, absFrom, absTo, value) {
132211
132230
  }
132212
132231
  function mergeTextStyleAttrs(currentAttrs, patch3) {
132213
132232
  const next2 = { ...currentAttrs };
132214
- for (const key$1 of TEXT_STYLE_KEYS) {
132215
- const value = patch3[key$1];
132233
+ for (const [key$1, value] of Object.entries(patch3)) {
132216
132234
  if (value === undefined)
132217
132235
  continue;
132218
132236
  if (value === null) {
@@ -132515,6 +132533,8 @@ function applyInlinePatchToRange(editor, tr, absFrom, absTo, inline) {
132515
132533
  for (const key$1 of TEXT_STYLE_KEYS)
132516
132534
  if (inline[key$1] !== undefined)
132517
132535
  textStylePatch[key$1] = inline[key$1];
132536
+ if (inline.caps !== undefined)
132537
+ textStylePatch.textTransform = capsToTextTransform(inline.caps ?? null);
132518
132538
  if (applyTextStylePatch(tr, schema.marks.textStyle, absFrom, absTo, textStylePatch))
132519
132539
  changed = true;
132520
132540
  const runAttributeUpdates = buildRunAttributeUpdates(inline);
@@ -133011,6 +133031,11 @@ function editorHasDom(editor) {
133011
133031
  const opts = editor.options;
133012
133032
  return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
133013
133033
  }
133034
+ function ensureTableSeparators(jsonNodes) {
133035
+ for (let i$1 = jsonNodes.length - 2;i$1 >= 0; i$1--)
133036
+ if (jsonNodes[i$1].type === "table" && jsonNodes[i$1 + 1].type === "table")
133037
+ jsonNodes.splice(i$1 + 1, 0, { type: "paragraph" });
133038
+ }
133014
133039
  function normalizeWriteLocator(request) {
133015
133040
  if (request.kind === "insert") {
133016
133041
  const hasBlockId = request.blockId !== undefined;
@@ -133472,6 +133497,22 @@ function insertStructuredWrapper(editor, input2, options) {
133472
133497
  }
133473
133498
  const jsonNodes = [];
133474
133499
  fragment.forEach((node3) => jsonNodes.push(node3.toJSON()));
133500
+ ensureTableSeparators(jsonNodes);
133501
+ if (from$12 === to) {
133502
+ const $pos = editor.state.doc.resolve(from$12);
133503
+ const parent = $pos.parent;
133504
+ if (parent.isTextblock && !parent.childCount) {
133505
+ const grandparent = $pos.node($pos.depth - 1);
133506
+ const idx = $pos.index($pos.depth - 1);
133507
+ const prevIsTable = idx > 0 && grandparent.child(idx - 1).type.name === "table";
133508
+ const nextIsTable = idx + 1 < grandparent.childCount && grandparent.child(idx + 1).type.name === "table";
133509
+ const atEnd = idx + 1 >= grandparent.childCount;
133510
+ if (jsonNodes[0]?.type === "table" && prevIsTable)
133511
+ jsonNodes.unshift({ type: "paragraph" });
133512
+ if (jsonNodes[jsonNodes.length - 1]?.type === "table" && (nextIsTable || atEnd))
133513
+ jsonNodes.push({ type: "paragraph" });
133514
+ }
133515
+ }
133475
133516
  const ok3 = Boolean(editor.commands.insertContentAt({
133476
133517
  from: from$12,
133477
133518
  to
@@ -163756,6 +163797,20 @@ function insertRowAtIndex({ tr, tablePos, tableNode, sourceRowIndex, insertIndex
163756
163797
  }
163757
163798
  return true;
163758
163799
  }
163800
+ function tableSeparatorNeeds(doc$2, pos) {
163801
+ const $pos = doc$2.resolve(pos);
163802
+ if ($pos.depth !== 0)
163803
+ return {
163804
+ before: false,
163805
+ after: false
163806
+ };
163807
+ const indexAfter = $pos.index(0);
163808
+ const nodeAfter = indexAfter < doc$2.childCount ? doc$2.child(indexAfter) : null;
163809
+ return {
163810
+ before: (indexAfter > 0 ? doc$2.child(indexAfter - 1) : null)?.type.name === "table",
163811
+ after: !nodeAfter || nodeAfter.type.name === "table"
163812
+ };
163813
+ }
163759
163814
  function getCellType({ node: node3, state }) {
163760
163815
  return tableNodeTypes(state.schema)[node3.type.spec.tableRole];
163761
163816
  }
@@ -176501,7 +176556,25 @@ var Node$13 = class Node$14 {
176501
176556
  }
176502
176557
  const tableAttrs = sdBlockId ? { sdBlockId } : undefined;
176503
176558
  const tableNode = tableType.createChecked(tableAttrs, rowNodes);
176504
- const tr = state.tr.insert(pos, tableNode);
176559
+ const sep = tableSeparatorNeeds$1(state.doc, pos);
176560
+ let tr;
176561
+ if (sep.before || sep.after) {
176562
+ const makeSep = () => state.schema.nodes.paragraph.createAndFill();
176563
+ const nodes = [];
176564
+ if (sep.before) {
176565
+ const s2 = makeSep();
176566
+ if (s2)
176567
+ nodes.push(s2);
176568
+ }
176569
+ nodes.push(tableNode);
176570
+ if (sep.after) {
176571
+ const s2 = makeSep();
176572
+ if (s2)
176573
+ nodes.push(s2);
176574
+ }
176575
+ tr = state.tr.insert(pos, Fragment.from(nodes));
176576
+ } else
176577
+ tr = state.tr.insert(pos, tableNode);
176505
176578
  if (!dispatch)
176506
176579
  return true;
176507
176580
  tr.setMeta("inputType", "programmatic");
@@ -198723,9 +198796,9 @@ var Node$13 = class Node$14 {
198723
198796
  trackedChanges: context.trackedChanges ?? []
198724
198797
  });
198725
198798
  }, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
198726
- var init_src_LqliKMID_es = __esm(() => {
198799
+ var init_src_CKjtLfFG_es = __esm(() => {
198727
198800
  init_rolldown_runtime_B2q5OVn9_es();
198728
- init_SuperConverter_BcmJ8_gc_es();
198801
+ init_SuperConverter_CHHvo5ta_es();
198729
198802
  init_jszip_ChlR43oI_es();
198730
198803
  init_uuid_qzgm05fK_es();
198731
198804
  init_constants_CMPtQbp7_es();
@@ -222643,7 +222716,30 @@ function print() { __p += __j.call(arguments, '') }
222643
222716
  };
222644
222717
  const tableNode = tableType.createChecked(tableAttrs, rowNodes);
222645
222718
  if (dispatch) {
222646
- tr.insert(pos, tableNode);
222719
+ const sep = tableSeparatorNeeds(state.doc, pos);
222720
+ const makeSep = () => {
222721
+ const attrs = {
222722
+ sdBlockId: v4_default(),
222723
+ paraId: genParaId()
222724
+ };
222725
+ return state.schema.nodes.paragraph.createAndFill(attrs);
222726
+ };
222727
+ if (sep.before || sep.after) {
222728
+ const nodes = [];
222729
+ if (sep.before) {
222730
+ const s2 = makeSep();
222731
+ if (s2)
222732
+ nodes.push(s2);
222733
+ }
222734
+ nodes.push(tableNode);
222735
+ if (sep.after) {
222736
+ const s2 = makeSep();
222737
+ if (s2)
222738
+ nodes.push(s2);
222739
+ }
222740
+ tr.insert(pos, Fragment.from(nodes));
222741
+ } else
222742
+ tr.insert(pos, tableNode);
222647
222743
  tr.setMeta("inputType", "programmatic");
222648
222744
  if (tracked === true)
222649
222745
  tr.setMeta("forceTrackChanges", true);
@@ -230433,8 +230529,8 @@ function print() { __p += __j.call(arguments, '') }
230433
230529
  return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
230434
230530
  };
230435
230531
  stubFalse_default = stubFalse;
230436
- freeExports$2 = typeof exports_src_LqliKMID_es == "object" && exports_src_LqliKMID_es && !exports_src_LqliKMID_es.nodeType && exports_src_LqliKMID_es;
230437
- freeModule$2 = freeExports$2 && typeof module_src_LqliKMID_es == "object" && module_src_LqliKMID_es && !module_src_LqliKMID_es.nodeType && module_src_LqliKMID_es;
230532
+ freeExports$2 = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230533
+ freeModule$2 = freeExports$2 && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230438
230534
  Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
230439
230535
  isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
230440
230536
  typedArrayTags = {};
@@ -230442,8 +230538,8 @@ function print() { __p += __j.call(arguments, '') }
230442
230538
  typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
230443
230539
  _baseIsTypedArray_default = baseIsTypedArray;
230444
230540
  _baseUnary_default = baseUnary;
230445
- freeExports$1 = typeof exports_src_LqliKMID_es == "object" && exports_src_LqliKMID_es && !exports_src_LqliKMID_es.nodeType && exports_src_LqliKMID_es;
230446
- freeModule$1 = freeExports$1 && typeof module_src_LqliKMID_es == "object" && module_src_LqliKMID_es && !module_src_LqliKMID_es.nodeType && module_src_LqliKMID_es;
230541
+ freeExports$1 = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230542
+ freeModule$1 = freeExports$1 && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230447
230543
  freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
230448
230544
  _nodeUtil_default = function() {
230449
230545
  try {
@@ -230548,8 +230644,8 @@ function print() { __p += __j.call(arguments, '') }
230548
230644
  Stack.prototype.has = _stackHas_default;
230549
230645
  Stack.prototype.set = _stackSet_default;
230550
230646
  _Stack_default = Stack;
230551
- freeExports = typeof exports_src_LqliKMID_es == "object" && exports_src_LqliKMID_es && !exports_src_LqliKMID_es.nodeType && exports_src_LqliKMID_es;
230552
- freeModule = freeExports && typeof module_src_LqliKMID_es == "object" && module_src_LqliKMID_es && !module_src_LqliKMID_es.nodeType && module_src_LqliKMID_es;
230647
+ freeExports = typeof exports_src_CKjtLfFG_es == "object" && exports_src_CKjtLfFG_es && !exports_src_CKjtLfFG_es.nodeType && exports_src_CKjtLfFG_es;
230648
+ freeModule = freeExports && typeof module_src_CKjtLfFG_es == "object" && module_src_CKjtLfFG_es && !module_src_CKjtLfFG_es.nodeType && module_src_CKjtLfFG_es;
230553
230649
  Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
230554
230650
  allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
230555
230651
  _cloneBuffer_default = cloneBuffer;
@@ -238629,8 +238725,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
238629
238725
 
238630
238726
  // ../../packages/superdoc/dist/super-editor.es.js
238631
238727
  var init_super_editor_es = __esm(() => {
238632
- init_src_LqliKMID_es();
238633
- init_SuperConverter_BcmJ8_gc_es();
238728
+ init_src_CKjtLfFG_es();
238729
+ init_SuperConverter_CHHvo5ta_es();
238634
238730
  init_jszip_ChlR43oI_es();
238635
238731
  init_xml_js_DLE8mr0n_es();
238636
238732
  init_constants_CMPtQbp7_es();
@@ -302702,6 +302798,11 @@ function toPointString2(value) {
302702
302798
  function toHalfPoints2(value) {
302703
302799
  return Math.round(value * 2);
302704
302800
  }
302801
+ function capsToTextTransform2(caps) {
302802
+ if (caps === null)
302803
+ return null;
302804
+ return caps ? "uppercase" : "none";
302805
+ }
302705
302806
  function collectInlineTextSegments2(doc4, absFrom, absTo) {
302706
302807
  const segments = [];
302707
302808
  doc4.nodesBetween(absFrom, absTo, (node4, pos) => {
@@ -302751,8 +302852,7 @@ function applyHighlightPatch2(tr, markType, absFrom, absTo, value) {
302751
302852
  }
302752
302853
  function mergeTextStyleAttrs2(currentAttrs, patch3) {
302753
302854
  const next2 = { ...currentAttrs };
302754
- for (const key2 of TEXT_STYLE_KEYS2) {
302755
- const value = patch3[key2];
302855
+ for (const [key2, value] of Object.entries(patch3)) {
302756
302856
  if (value === undefined)
302757
302857
  continue;
302758
302858
  if (value === null) {
@@ -303050,6 +303150,9 @@ function applyInlinePatchToRange2(editor, tr, absFrom, absTo, inline) {
303050
303150
  textStylePatch[key2] = inline[key2];
303051
303151
  }
303052
303152
  }
303153
+ if (inline.caps !== undefined) {
303154
+ textStylePatch.textTransform = capsToTextTransform2(inline.caps ?? null);
303155
+ }
303053
303156
  if (applyTextStylePatch2(tr, schema.marks.textStyle, absFrom, absTo, textStylePatch)) {
303054
303157
  changed = true;
303055
303158
  }
@@ -303588,6 +303691,13 @@ function editorHasDom2(editor) {
303588
303691
  const opts = editor.options;
303589
303692
  return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
303590
303693
  }
303694
+ function ensureTableSeparators2(jsonNodes) {
303695
+ for (let i4 = jsonNodes.length - 2;i4 >= 0; i4--) {
303696
+ if (jsonNodes[i4].type === "table" && jsonNodes[i4 + 1].type === "table") {
303697
+ jsonNodes.splice(i4 + 1, 0, { type: "paragraph" });
303698
+ }
303699
+ }
303700
+ }
303591
303701
  function normalizeWriteLocator2(request) {
303592
303702
  if (request.kind === "insert") {
303593
303703
  const hasBlockId = request.blockId !== undefined;
@@ -303982,6 +304092,24 @@ function insertStructuredWrapper2(editor, input2, options) {
303982
304092
  }
303983
304093
  const jsonNodes = [];
303984
304094
  fragment.forEach((node4) => jsonNodes.push(node4.toJSON()));
304095
+ ensureTableSeparators2(jsonNodes);
304096
+ if (from4 === to) {
304097
+ const $pos = editor.state.doc.resolve(from4);
304098
+ const parent = $pos.parent;
304099
+ if (parent.isTextblock && !parent.childCount) {
304100
+ const grandparent = $pos.node($pos.depth - 1);
304101
+ const idx = $pos.index($pos.depth - 1);
304102
+ const prevIsTable = idx > 0 && grandparent.child(idx - 1).type.name === "table";
304103
+ const nextIsTable = idx + 1 < grandparent.childCount && grandparent.child(idx + 1).type.name === "table";
304104
+ const atEnd = idx + 1 >= grandparent.childCount;
304105
+ if (jsonNodes[0]?.type === "table" && prevIsTable) {
304106
+ jsonNodes.unshift({ type: "paragraph" });
304107
+ }
304108
+ if (jsonNodes[jsonNodes.length - 1]?.type === "table" && (nextIsTable || atEnd)) {
304109
+ jsonNodes.push({ type: "paragraph" });
304110
+ }
304111
+ }
304112
+ }
303985
304113
  const ok5 = Boolean(editor.commands.insertContentAt({ from: from4, to }, jsonNodes));
303986
304114
  if (!ok5) {
303987
304115
  insertFailure = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.87",
3
+ "version": "0.2.0-next.89",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.87",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.87",
35
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.87",
36
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.87",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.87"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.89",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.89",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.89",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.89",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.89"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",