microboard-temp 0.4.4 → 0.4.6

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/esm/index.js CHANGED
@@ -9537,17 +9537,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
9537
9537
  break;
9538
9538
  default:
9539
9539
  if ("text" in child && typeof child.text === "string") {
9540
- const fontScale2 = (child.fontSize === "auto" ? 14 : child.fontSize ?? 14) / 14;
9540
+ const textNode = child;
9541
+ const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
9541
9542
  handleTextNode({
9542
9543
  isFrame,
9543
- child,
9544
+ child: textNode,
9544
9545
  node,
9545
9546
  maxWidth,
9546
9547
  paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
9547
9548
  marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
9548
9549
  newLine: i === 0 ? newLine : false,
9549
9550
  listMark: i === 0 ? listMark : undefined,
9550
- link: child.link
9551
+ link: textNode.link
9551
9552
  });
9552
9553
  } else {
9553
9554
  const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
@@ -9591,7 +9592,8 @@ function getTextNode(data) {
9591
9592
  type: "text",
9592
9593
  text,
9593
9594
  style: getTextStyle(data),
9594
- blocks: []
9595
+ blocks: [],
9596
+ newLine: false
9595
9597
  };
9596
9598
  return node;
9597
9599
  }
@@ -9837,7 +9839,7 @@ function setBlockNodeCoordinates(blockNode) {
9837
9839
  }
9838
9840
  lineBottom += maxFontSize * lineHeight;
9839
9841
  leading = maxFontSize * lineHeight - maxFontSize;
9840
- yOffset = lineBottom - leading / 2 - highestBlock.measure.descent;
9842
+ yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
9841
9843
  for (const block of line) {
9842
9844
  block.y = yOffset;
9843
9845
  }
@@ -9861,7 +9863,7 @@ function getTextBlock({
9861
9863
  x: 0,
9862
9864
  y: 0,
9863
9865
  measure,
9864
- fontSize: style.fontSize,
9866
+ fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
9865
9867
  paddingTop,
9866
9868
  marginLeft,
9867
9869
  listMark,
@@ -10383,7 +10385,7 @@ function handleListMerge(editor) {
10383
10385
  return false;
10384
10386
  }
10385
10387
  const [textNode, textNodePath] = Editor2.node(editor, anchor.path);
10386
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string" || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
10388
+ if (!textNode || Editor2.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
10387
10389
  return false;
10388
10390
  }
10389
10391
  const paragraphPath = Path5.parent(textNodePath);
@@ -10393,12 +10395,12 @@ function handleListMerge(editor) {
10393
10395
  }
10394
10396
  const listItemPath = Path5.parent(paragraphPath);
10395
10397
  const [listItem] = Editor2.node(editor, listItemPath);
10396
- if (!listItem || listItem.type !== "list_item") {
10398
+ if (!listItem || Editor2.isEditor(listItem) || listItem.type !== "list_item") {
10397
10399
  return false;
10398
10400
  }
10399
10401
  const listPath = Path5.parent(listItemPath);
10400
10402
  const [list] = Editor2.node(editor, listPath);
10401
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
10403
+ if (!list || Editor2.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
10402
10404
  return false;
10403
10405
  }
10404
10406
  const listItemIndex = listItemPath[listItemPath.length - 1];
@@ -10432,6 +10434,9 @@ function handleListMerge(editor) {
10432
10434
  } else {
10433
10435
  const previousItemPath = Path5.previous(listItemPath);
10434
10436
  const [previousItem] = Editor2.node(editor, previousItemPath);
10437
+ if ("text" in previousItem) {
10438
+ return false;
10439
+ }
10435
10440
  currentListItemChildren.forEach((childNode, index) => {
10436
10441
  const copiedNode = structuredClone(childNode);
10437
10442
  copiedNode.paddingTop = 0;
@@ -10463,7 +10468,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
10463
10468
  const marks = Editor3.marks(editor) || {};
10464
10469
  const pargaraph = {
10465
10470
  type: "paragraph",
10466
- children: [{ type: "text", text, ...marks }]
10471
+ children: [{
10472
+ type: "text",
10473
+ text,
10474
+ ...marks,
10475
+ bold: false,
10476
+ italic: false,
10477
+ underline: false,
10478
+ overline: false,
10479
+ "line-through": false,
10480
+ subscript: false,
10481
+ superscript: false
10482
+ }]
10467
10483
  };
10468
10484
  if (horisontalAlignment) {
10469
10485
  pargaraph.horisontalAlignment = horisontalAlignment;
@@ -10517,6 +10533,9 @@ function handleSplitListItem(editor) {
10517
10533
  if (isBlockEmpty && isOnlyChildParagraph) {
10518
10534
  const listItemIndex = listItemPath[listItemPath.length - 1];
10519
10535
  const [parentList, parentListPath] = Editor4.parent(editor, listItemPath);
10536
+ if (Editor4.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
10537
+ return false;
10538
+ }
10520
10539
  const listType = parentList.type;
10521
10540
  Editor4.withoutNormalizing(editor, () => {
10522
10541
  const nextPath = Path6.next(parentListPath);
@@ -10541,6 +10560,9 @@ function handleSplitListItem(editor) {
10541
10560
  match: (n, path2) => path2[path2.length - 1] >= listItemIndex
10542
10561
  });
10543
10562
  const [updatedParentList] = Editor4.node(editor, parentListPath);
10563
+ if (Editor4.isEditor(updatedParentList)) {
10564
+ return false;
10565
+ }
10544
10566
  if (getAreAllChildrenEmpty(updatedParentList)) {
10545
10567
  Transforms3.removeNodes(editor, { at: parentListPath });
10546
10568
  }
@@ -10572,7 +10594,7 @@ import { Transforms as Transforms5 } from "slate";
10572
10594
  import { Editor as Editor5, Transforms as Transforms4 } from "slate";
10573
10595
  function clearAllTextNodes(editor) {
10574
10596
  for (const [node, path2] of Editor5.nodes(editor, {
10575
- match: (n) => n.type === "text"
10597
+ match: (n) => !Editor5.isEditor(n) && n.type === "text"
10576
10598
  })) {
10577
10599
  Transforms4.removeNodes(editor, { at: path2 });
10578
10600
  Transforms4.setNodes(editor, { ...node, text: "" }, { at: path2 });
@@ -10607,7 +10629,7 @@ function handleWrapIntoNestedList(editor) {
10607
10629
  }
10608
10630
  const { anchor } = selection;
10609
10631
  const [textNode, textNodePath] = Editor6.node(editor, anchor.path);
10610
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string" || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
10632
+ if (!textNode || Editor6.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
10611
10633
  return false;
10612
10634
  }
10613
10635
  const paragraphPath = Path7.parent(textNodePath);
@@ -10617,12 +10639,12 @@ function handleWrapIntoNestedList(editor) {
10617
10639
  }
10618
10640
  const listItemPath = Path7.parent(paragraphPath);
10619
10641
  const [listItem] = Editor6.node(editor, listItemPath);
10620
- if (!listItem || listItem.type !== "list_item") {
10642
+ if (!listItem || Editor6.isEditor(listItem) || listItem.type !== "list_item") {
10621
10643
  return false;
10622
10644
  }
10623
10645
  const listPath = Path7.parent(listItemPath);
10624
10646
  const [list] = Editor6.node(editor, listPath);
10625
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
10647
+ if (!list || Editor6.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
10626
10648
  return false;
10627
10649
  }
10628
10650
  Transforms6.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
@@ -10645,19 +10667,19 @@ function wrapIntoList(editor, targetListType, location) {
10645
10667
  }
10646
10668
 
10647
10669
  // src/Items/RichText/editorHelpers/lists/toggleListTypeForSelection.ts
10648
- import { Editor as Editor8, Element as Element2, Path as Path9, Range as Range4, Transforms as Transforms8 } from "slate";
10670
+ import { Editor as Editor8, Element as Element2, Path as Path9, Transforms as Transforms8 } from "slate";
10649
10671
 
10650
10672
  // src/Items/RichText/editorHelpers/lists/getBlockParentList.ts
10651
10673
  import { Editor as Editor7, Path as Path8 } from "slate";
10652
10674
  function getBlockParentList(editor, blockPath) {
10653
10675
  const listItemPath = Path8.parent(blockPath);
10654
10676
  const [listItem] = Editor7.node(editor, listItemPath);
10655
- if (!listItem || listItem.type !== "list_item") {
10677
+ if (!listItem || Editor7.isEditor(listItem) || listItem.type !== "list_item") {
10656
10678
  return null;
10657
10679
  }
10658
10680
  const listPath = Path8.parent(listItemPath);
10659
10681
  const [list] = Editor7.node(editor, listPath);
10660
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
10682
+ if (!list || Editor7.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
10661
10683
  return null;
10662
10684
  }
10663
10685
  return [list, listPath];
@@ -10670,17 +10692,16 @@ function toggleListTypeForSelection(editor, targetListType) {
10670
10692
  return false;
10671
10693
  }
10672
10694
  Editor8.withoutNormalizing(editor, () => {
10673
- const [start, end] = Range4.edges(selection);
10674
- const commonAncestorPath = Path9.common(start.path, end.path);
10675
10695
  const nodes = Array.from(Editor8.nodes(editor, {
10676
10696
  at: selection,
10677
10697
  mode: "lowest",
10678
- match: (n) => Editor8.isBlock(editor, n)
10698
+ match: (n) => !Editor8.isEditor(n) && n.type !== "text" && Editor8.isBlock(editor, n)
10679
10699
  }));
10680
10700
  const nodesWithLists = {};
10681
10701
  const unwrapCandidates = [];
10682
10702
  nodes.forEach(([node, path2]) => {
10683
10703
  const parentList = getBlockParentList(editor, path2);
10704
+ node = node;
10684
10705
  if (parentList) {
10685
10706
  unwrapCandidates.push(node);
10686
10707
  if (!nodesWithLists[parentList[1].length]) {
@@ -10790,7 +10811,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
10790
10811
  Editor9.withoutNormalizing(editor, () => {
10791
10812
  const { anchor } = selection;
10792
10813
  const [textNode, textNodePath] = Editor9.node(editor, anchor.path);
10793
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string") {
10814
+ if (!textNode || Editor9.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
10794
10815
  result = false;
10795
10816
  return;
10796
10817
  }
@@ -10802,7 +10823,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
10802
10823
  }
10803
10824
  const listItemPath = Path10.parent(paragraphPath);
10804
10825
  const [listItem] = Editor9.node(editor, listItemPath);
10805
- if (!listItem || listItem.type !== "list_item") {
10826
+ if (!listItem || Editor9.isEditor(listItem) || listItem.type !== "list_item") {
10806
10827
  if (shouldWrap) {
10807
10828
  wrapIntoList(editor, targetListType, selection);
10808
10829
  return;
@@ -10812,7 +10833,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
10812
10833
  }
10813
10834
  const listPath = Path10.parent(listItemPath);
10814
10835
  const [list] = Editor9.node(editor, listPath);
10815
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
10836
+ if (!list || Editor9.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
10816
10837
  if (shouldWrap) {
10817
10838
  wrapIntoList(editor, targetListType, selection);
10818
10839
  return;
@@ -10894,7 +10915,7 @@ function getListTypeAtSelectionStart(editor) {
10894
10915
  const startPoint = Range6.start(selection);
10895
10916
  const listEntry = Editor11.above(editor, {
10896
10917
  at: startPoint,
10897
- match: (n) => n.type === "ol_list" || n.type === "ul_list"
10918
+ match: (n) => !Editor11.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
10898
10919
  });
10899
10920
  if (listEntry) {
10900
10921
  const [listNode] = listEntry;
@@ -10917,11 +10938,11 @@ var setLink = (editor, link, selection) => {
10917
10938
  const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
10918
10939
  Editor12.addMark(editor, "fontColor", format);
10919
10940
  for (const [node, path2] of Editor12.nodes(editor, {
10920
- match: (n) => n.type === "text"
10941
+ match: (n) => !Editor12.isEditor(n) && n.type === "text"
10921
10942
  })) {
10922
10943
  const nodeRange = Editor12.range(editor, path2);
10923
10944
  Transforms11.select(editor, nodeRange);
10924
- Transforms11.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
10945
+ Transforms11.setNodes(editor, { link }, { split: false, match: (n) => !Editor12.isEditor(n) && n.type === "text" });
10925
10946
  }
10926
10947
  };
10927
10948
 
@@ -17311,7 +17332,7 @@ function getFirstSelectionLink(editor, selection) {
17311
17332
  }
17312
17333
  for (const [node2] of Editor20.nodes(editor, {
17313
17334
  at: selection,
17314
- match: (n) => !!n.link
17335
+ match: (n) => ("link" in n) && !!n.link
17315
17336
  })) {
17316
17337
  return node2.link;
17317
17338
  }
@@ -17617,15 +17638,17 @@ class EditorContainer {
17617
17638
  if (isRecordingOperations) {
17618
17639
  const isSettingNodeFontSize = operation.type === "set_node" && "fontSize" in operation.newProperties && "fontSize" in operation.properties;
17619
17640
  if (isSettingNodeFontSize) {
17620
- const isSettingNodeFontSizeToAuto = operation.newProperties.fontSize === "auto";
17641
+ const newProperties = operation.newProperties;
17642
+ const properties = operation.properties;
17643
+ const isSettingNodeFontSizeToAuto = newProperties.fontSize === "auto";
17621
17644
  if (isSettingNodeFontSizeToAuto) {
17622
- operation.newProperties.fontSize = 14;
17623
- operation.newProperties.enableAuto = true;
17624
- operation.properties.enableAuto = false;
17645
+ newProperties.fontSize = 14;
17646
+ newProperties.enableAuto = true;
17647
+ properties.enableAuto = false;
17625
17648
  } else {
17626
- operation.newProperties.enableAuto = false;
17649
+ newProperties.enableAuto = false;
17627
17650
  if (this.getAutosize()) {
17628
- operation.properties.enableAuto = true;
17651
+ properties.enableAuto = true;
17629
17652
  }
17630
17653
  }
17631
17654
  }
@@ -17708,7 +17731,7 @@ class EditorContainer {
17708
17731
  stopOpRecordingAndGetOps() {
17709
17732
  const op = this.recordedOps;
17710
17733
  this.recordedOps = null;
17711
- const opsArr = op?.ops ?? op ?? [];
17734
+ const opsArr = op ? "ops" in op ? op.ops : op : [];
17712
17735
  return opsArr.filter((op2) => op2.type !== "set_selection");
17713
17736
  }
17714
17737
  applyRichTextOp(op) {
@@ -17731,7 +17754,6 @@ class EditorContainer {
17731
17754
  case "setSelectionHorizontalAlignment":
17732
17755
  this.applySelectionOp(op);
17733
17756
  break;
17734
- case "setBlockType":
17735
17757
  case "setFontStyle":
17736
17758
  case "setFontColor":
17737
17759
  case "setFontFamily":
@@ -17746,7 +17768,11 @@ class EditorContainer {
17746
17768
  }
17747
17769
  } catch (error) {
17748
17770
  console.error("Error in applying RichText Operation in Item: ", this.id, error);
17749
- console.error("Error applying this type operation: ", op.ops?.map((op2) => op2.type));
17771
+ const operations2 = [];
17772
+ if ("ops" in op && Array.isArray(op.ops)) {
17773
+ operations2.push(...op.ops.map((op2) => op2.type));
17774
+ }
17775
+ console.error("Error applying this type operation: ", operations2);
17750
17776
  }
17751
17777
  }
17752
17778
  applySelectionEdit(op) {
@@ -17776,7 +17802,6 @@ class EditorContainer {
17776
17802
  this.setSelectionFontColor(op.fontColor);
17777
17803
  break;
17778
17804
  case "setFontFamily":
17779
- this.setSelectionFontFamily(op.fontFamily);
17780
17805
  break;
17781
17806
  case "setFontSize":
17782
17807
  this.textScale = Number(op.fontSize) / this.getScale() / this.initialTextStyles.fontSize;
package/dist/esm/node.js CHANGED
@@ -10321,17 +10321,18 @@ function getBlockNode(data, maxWidth, isFrame, listData, listMark, newLine = fal
10321
10321
  break;
10322
10322
  default:
10323
10323
  if ("text" in child && typeof child.text === "string") {
10324
- const fontScale2 = (child.fontSize === "auto" ? 14 : child.fontSize ?? 14) / 14;
10324
+ const textNode = child;
10325
+ const fontScale2 = (textNode.fontSize === "auto" ? 14 : textNode.fontSize ?? 14) / 14;
10325
10326
  handleTextNode({
10326
10327
  isFrame,
10327
- child,
10328
+ child: textNode,
10328
10329
  node,
10329
10330
  maxWidth,
10330
10331
  paddingTop: i === 0 ? 16 * (data.paddingTop || 0) : 0,
10331
10332
  marginLeft: (listData ? fontScale2 * 16 : 0) + (listData?.level || 0) * fontScale2 * 24,
10332
10333
  newLine: i === 0 ? newLine : false,
10333
10334
  listMark: i === 0 ? listMark : undefined,
10334
- link: child.link
10335
+ link: textNode.link
10335
10336
  });
10336
10337
  } else {
10337
10338
  const blockNode = getBlockNode(child, maxWidth, isFrame, listData, i === 0 ? listMark : undefined, true);
@@ -10375,7 +10376,8 @@ function getTextNode(data) {
10375
10376
  type: "text",
10376
10377
  text,
10377
10378
  style: getTextStyle(data),
10378
- blocks: []
10379
+ blocks: [],
10380
+ newLine: false
10379
10381
  };
10380
10382
  return node;
10381
10383
  }
@@ -10621,7 +10623,7 @@ function setBlockNodeCoordinates(blockNode) {
10621
10623
  }
10622
10624
  lineBottom += maxFontSize * lineHeight;
10623
10625
  leading = maxFontSize * lineHeight - maxFontSize;
10624
- yOffset = lineBottom - leading / 2 - highestBlock.measure.descent;
10626
+ yOffset = lineBottom - leading / 2 - (highestBlock?.measure.descent || 0);
10625
10627
  for (const block of line) {
10626
10628
  block.y = yOffset;
10627
10629
  }
@@ -10645,7 +10647,7 @@ function getTextBlock({
10645
10647
  x: 0,
10646
10648
  y: 0,
10647
10649
  measure,
10648
- fontSize: style.fontSize,
10650
+ fontSize: style.fontSize === "auto" ? 14 : style.fontSize,
10649
10651
  paddingTop,
10650
10652
  marginLeft,
10651
10653
  listMark,
@@ -11203,7 +11205,7 @@ function handleListMerge(editor) {
11203
11205
  return false;
11204
11206
  }
11205
11207
  const [textNode, textNodePath] = Editor.node(editor, anchor.path);
11206
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string" || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
11208
+ if (!textNode || Editor.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
11207
11209
  return false;
11208
11210
  }
11209
11211
  const paragraphPath = Path4.parent(textNodePath);
@@ -11213,12 +11215,12 @@ function handleListMerge(editor) {
11213
11215
  }
11214
11216
  const listItemPath = Path4.parent(paragraphPath);
11215
11217
  const [listItem] = Editor.node(editor, listItemPath);
11216
- if (!listItem || listItem.type !== "list_item") {
11218
+ if (!listItem || Editor.isEditor(listItem) || listItem.type !== "list_item") {
11217
11219
  return false;
11218
11220
  }
11219
11221
  const listPath = Path4.parent(listItemPath);
11220
11222
  const [list] = Editor.node(editor, listPath);
11221
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
11223
+ if (!list || Editor.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
11222
11224
  return false;
11223
11225
  }
11224
11226
  const listItemIndex = listItemPath[listItemPath.length - 1];
@@ -11252,6 +11254,9 @@ function handleListMerge(editor) {
11252
11254
  } else {
11253
11255
  const previousItemPath = Path4.previous(listItemPath);
11254
11256
  const [previousItem] = Editor.node(editor, previousItemPath);
11257
+ if ("text" in previousItem) {
11258
+ return false;
11259
+ }
11255
11260
  currentListItemChildren.forEach((childNode, index) => {
11256
11261
  const copiedNode = structuredClone(childNode);
11257
11262
  copiedNode.paddingTop = 0;
@@ -11283,7 +11288,18 @@ function createParagraphNode(text, editor, horisontalAlignment) {
11283
11288
  const marks = Editor2.marks(editor) || {};
11284
11289
  const pargaraph = {
11285
11290
  type: "paragraph",
11286
- children: [{ type: "text", text, ...marks }]
11291
+ children: [{
11292
+ type: "text",
11293
+ text,
11294
+ ...marks,
11295
+ bold: false,
11296
+ italic: false,
11297
+ underline: false,
11298
+ overline: false,
11299
+ "line-through": false,
11300
+ subscript: false,
11301
+ superscript: false
11302
+ }]
11287
11303
  };
11288
11304
  if (horisontalAlignment) {
11289
11305
  pargaraph.horisontalAlignment = horisontalAlignment;
@@ -11337,6 +11353,9 @@ function handleSplitListItem(editor) {
11337
11353
  if (isBlockEmpty && isOnlyChildParagraph) {
11338
11354
  const listItemIndex = listItemPath[listItemPath.length - 1];
11339
11355
  const [parentList, parentListPath] = Editor3.parent(editor, listItemPath);
11356
+ if (Editor3.isEditor(parentList) || parentList.type !== "ol_list" && parentList.type !== "ul_list") {
11357
+ return false;
11358
+ }
11340
11359
  const listType = parentList.type;
11341
11360
  Editor3.withoutNormalizing(editor, () => {
11342
11361
  const nextPath = Path5.next(parentListPath);
@@ -11361,6 +11380,9 @@ function handleSplitListItem(editor) {
11361
11380
  match: (n, path2) => path2[path2.length - 1] >= listItemIndex
11362
11381
  });
11363
11382
  const [updatedParentList] = Editor3.node(editor, parentListPath);
11383
+ if (Editor3.isEditor(updatedParentList)) {
11384
+ return false;
11385
+ }
11364
11386
  if (getAreAllChildrenEmpty(updatedParentList)) {
11365
11387
  Transforms2.removeNodes(editor, { at: parentListPath });
11366
11388
  }
@@ -11392,7 +11414,7 @@ import { Transforms as Transforms4 } from "slate";
11392
11414
  import { Editor as Editor4, Transforms as Transforms3 } from "slate";
11393
11415
  function clearAllTextNodes(editor) {
11394
11416
  for (const [node, path2] of Editor4.nodes(editor, {
11395
- match: (n) => n.type === "text"
11417
+ match: (n) => !Editor4.isEditor(n) && n.type === "text"
11396
11418
  })) {
11397
11419
  Transforms3.removeNodes(editor, { at: path2 });
11398
11420
  Transforms3.setNodes(editor, { ...node, text: "" }, { at: path2 });
@@ -11427,7 +11449,7 @@ function handleWrapIntoNestedList(editor) {
11427
11449
  }
11428
11450
  const { anchor } = selection;
11429
11451
  const [textNode, textNodePath] = Editor5.node(editor, anchor.path);
11430
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string" || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
11452
+ if (!textNode || Editor5.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode) || !isCursorAtStartOfFirstChild(editor, textNodePath)) {
11431
11453
  return false;
11432
11454
  }
11433
11455
  const paragraphPath = Path6.parent(textNodePath);
@@ -11437,12 +11459,12 @@ function handleWrapIntoNestedList(editor) {
11437
11459
  }
11438
11460
  const listItemPath = Path6.parent(paragraphPath);
11439
11461
  const [listItem] = Editor5.node(editor, listItemPath);
11440
- if (!listItem || listItem.type !== "list_item") {
11462
+ if (!listItem || Editor5.isEditor(listItem) || listItem.type !== "list_item") {
11441
11463
  return false;
11442
11464
  }
11443
11465
  const listPath = Path6.parent(listItemPath);
11444
11466
  const [list] = Editor5.node(editor, listPath);
11445
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
11467
+ if (!list || Editor5.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
11446
11468
  return false;
11447
11469
  }
11448
11470
  Transforms5.wrapNodes(editor, { type: "list_item", children: [] }, { at: paragraphPath });
@@ -11465,19 +11487,19 @@ function wrapIntoList(editor, targetListType, location) {
11465
11487
  }
11466
11488
 
11467
11489
  // src/Items/RichText/editorHelpers/lists/toggleListTypeForSelection.ts
11468
- import { Editor as Editor7, Element as Element2, Path as Path8, Range as Range4, Transforms as Transforms7 } from "slate";
11490
+ import { Editor as Editor7, Element as Element2, Path as Path8, Transforms as Transforms7 } from "slate";
11469
11491
 
11470
11492
  // src/Items/RichText/editorHelpers/lists/getBlockParentList.ts
11471
11493
  import { Editor as Editor6, Path as Path7 } from "slate";
11472
11494
  function getBlockParentList(editor, blockPath) {
11473
11495
  const listItemPath = Path7.parent(blockPath);
11474
11496
  const [listItem] = Editor6.node(editor, listItemPath);
11475
- if (!listItem || listItem.type !== "list_item") {
11497
+ if (!listItem || Editor6.isEditor(listItem) || listItem.type !== "list_item") {
11476
11498
  return null;
11477
11499
  }
11478
11500
  const listPath = Path7.parent(listItemPath);
11479
11501
  const [list] = Editor6.node(editor, listPath);
11480
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
11502
+ if (!list || Editor6.isEditor(listItem) || "type" in list && list.type !== "ol_list" && list.type !== "ul_list") {
11481
11503
  return null;
11482
11504
  }
11483
11505
  return [list, listPath];
@@ -11490,17 +11512,16 @@ function toggleListTypeForSelection(editor, targetListType) {
11490
11512
  return false;
11491
11513
  }
11492
11514
  Editor7.withoutNormalizing(editor, () => {
11493
- const [start, end] = Range4.edges(selection);
11494
- const commonAncestorPath = Path8.common(start.path, end.path);
11495
11515
  const nodes = Array.from(Editor7.nodes(editor, {
11496
11516
  at: selection,
11497
11517
  mode: "lowest",
11498
- match: (n) => Editor7.isBlock(editor, n)
11518
+ match: (n) => !Editor7.isEditor(n) && n.type !== "text" && Editor7.isBlock(editor, n)
11499
11519
  }));
11500
11520
  const nodesWithLists = {};
11501
11521
  const unwrapCandidates = [];
11502
11522
  nodes.forEach(([node, path2]) => {
11503
11523
  const parentList = getBlockParentList(editor, path2);
11524
+ node = node;
11504
11525
  if (parentList) {
11505
11526
  unwrapCandidates.push(node);
11506
11527
  if (!nodesWithLists[parentList[1].length]) {
@@ -11610,7 +11631,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
11610
11631
  Editor8.withoutNormalizing(editor, () => {
11611
11632
  const { anchor } = selection;
11612
11633
  const [textNode, textNodePath] = Editor8.node(editor, anchor.path);
11613
- if (!textNode || textNode.type !== "text" || typeof textNode.text !== "string") {
11634
+ if (!textNode || Editor8.isEditor(textNode) || textNode.type !== "text" || !("text" in textNode)) {
11614
11635
  result = false;
11615
11636
  return;
11616
11637
  }
@@ -11622,7 +11643,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
11622
11643
  }
11623
11644
  const listItemPath = Path9.parent(paragraphPath);
11624
11645
  const [listItem] = Editor8.node(editor, listItemPath);
11625
- if (!listItem || listItem.type !== "list_item") {
11646
+ if (!listItem || Editor8.isEditor(listItem) || listItem.type !== "list_item") {
11626
11647
  if (shouldWrap) {
11627
11648
  wrapIntoList(editor, targetListType, selection);
11628
11649
  return;
@@ -11632,7 +11653,7 @@ function toggleListType(editor, targetListType, shouldWrap = true) {
11632
11653
  }
11633
11654
  const listPath = Path9.parent(listItemPath);
11634
11655
  const [list] = Editor8.node(editor, listPath);
11635
- if (!list || list.type !== "ol_list" && list.type !== "ul_list") {
11656
+ if (!list || Editor8.isEditor(list) || list.type !== "ol_list" && list.type !== "ul_list") {
11636
11657
  if (shouldWrap) {
11637
11658
  wrapIntoList(editor, targetListType, selection);
11638
11659
  return;
@@ -11714,7 +11735,7 @@ function getListTypeAtSelectionStart(editor) {
11714
11735
  const startPoint = Range6.start(selection);
11715
11736
  const listEntry = Editor10.above(editor, {
11716
11737
  at: startPoint,
11717
- match: (n) => n.type === "ol_list" || n.type === "ul_list"
11738
+ match: (n) => !Editor10.isEditor(n) && (n.type === "ol_list" || n.type === "ul_list")
11718
11739
  });
11719
11740
  if (listEntry) {
11720
11741
  const [listNode] = listEntry;
@@ -11737,11 +11758,11 @@ var setLink = (editor, link, selection) => {
11737
11758
  const format = link ? "rgba(71, 120, 245, 1)" : "rgb(20, 21, 26)";
11738
11759
  Editor11.addMark(editor, "fontColor", format);
11739
11760
  for (const [node, path2] of Editor11.nodes(editor, {
11740
- match: (n) => n.type === "text"
11761
+ match: (n) => !Editor11.isEditor(n) && n.type === "text"
11741
11762
  })) {
11742
11763
  const nodeRange = Editor11.range(editor, path2);
11743
11764
  Transforms10.select(editor, nodeRange);
11744
- Transforms10.setNodes(editor, { link }, { split: false, match: (n) => n.type === "text" });
11765
+ Transforms10.setNodes(editor, { link }, { split: false, match: (n) => !Editor11.isEditor(n) && n.type === "text" });
11745
11766
  }
11746
11767
  };
11747
11768
 
@@ -19846,7 +19867,7 @@ function getFirstSelectionLink(editor, selection) {
19846
19867
  }
19847
19868
  for (const [node2] of Editor19.nodes(editor, {
19848
19869
  at: selection,
19849
- match: (n) => !!n.link
19870
+ match: (n) => ("link" in n) && !!n.link
19850
19871
  })) {
19851
19872
  return node2.link;
19852
19873
  }
@@ -20152,15 +20173,17 @@ class EditorContainer {
20152
20173
  if (isRecordingOperations) {
20153
20174
  const isSettingNodeFontSize = operation.type === "set_node" && "fontSize" in operation.newProperties && "fontSize" in operation.properties;
20154
20175
  if (isSettingNodeFontSize) {
20155
- const isSettingNodeFontSizeToAuto = operation.newProperties.fontSize === "auto";
20176
+ const newProperties = operation.newProperties;
20177
+ const properties = operation.properties;
20178
+ const isSettingNodeFontSizeToAuto = newProperties.fontSize === "auto";
20156
20179
  if (isSettingNodeFontSizeToAuto) {
20157
- operation.newProperties.fontSize = 14;
20158
- operation.newProperties.enableAuto = true;
20159
- operation.properties.enableAuto = false;
20180
+ newProperties.fontSize = 14;
20181
+ newProperties.enableAuto = true;
20182
+ properties.enableAuto = false;
20160
20183
  } else {
20161
- operation.newProperties.enableAuto = false;
20184
+ newProperties.enableAuto = false;
20162
20185
  if (this.getAutosize()) {
20163
- operation.properties.enableAuto = true;
20186
+ properties.enableAuto = true;
20164
20187
  }
20165
20188
  }
20166
20189
  }
@@ -20243,7 +20266,7 @@ class EditorContainer {
20243
20266
  stopOpRecordingAndGetOps() {
20244
20267
  const op = this.recordedOps;
20245
20268
  this.recordedOps = null;
20246
- const opsArr = op?.ops ?? op ?? [];
20269
+ const opsArr = op ? "ops" in op ? op.ops : op : [];
20247
20270
  return opsArr.filter((op2) => op2.type !== "set_selection");
20248
20271
  }
20249
20272
  applyRichTextOp(op) {
@@ -20266,7 +20289,6 @@ class EditorContainer {
20266
20289
  case "setSelectionHorizontalAlignment":
20267
20290
  this.applySelectionOp(op);
20268
20291
  break;
20269
- case "setBlockType":
20270
20292
  case "setFontStyle":
20271
20293
  case "setFontColor":
20272
20294
  case "setFontFamily":
@@ -20281,7 +20303,11 @@ class EditorContainer {
20281
20303
  }
20282
20304
  } catch (error) {
20283
20305
  console.error("Error in applying RichText Operation in Item: ", this.id, error);
20284
- console.error("Error applying this type operation: ", op.ops?.map((op2) => op2.type));
20306
+ const operations2 = [];
20307
+ if ("ops" in op && Array.isArray(op.ops)) {
20308
+ operations2.push(...op.ops.map((op2) => op2.type));
20309
+ }
20310
+ console.error("Error applying this type operation: ", operations2);
20285
20311
  }
20286
20312
  }
20287
20313
  applySelectionEdit(op) {
@@ -20311,7 +20337,6 @@ class EditorContainer {
20311
20337
  this.setSelectionFontColor(op.fontColor);
20312
20338
  break;
20313
20339
  case "setFontFamily":
20314
- this.setSelectionFontFamily(op.fontFamily);
20315
20340
  break;
20316
20341
  case "setFontSize":
20317
20342
  this.textScale = Number(op.fontSize) / this.getScale() / this.initialTextStyles.fontSize;
@@ -1,3 +1,3 @@
1
1
  import { Path } from "../../Path";
2
- import { BoardPoint, ControlPoint } from "../ControlPoint";
3
- export declare function getCurvedLine(start: ControlPoint, end: ControlPoint, middle: BoardPoint | null): Path;
2
+ import { ControlPoint } from "../ControlPoint";
3
+ export declare function getCurvedLine(start: ControlPoint, end: ControlPoint, middle: ControlPoint | null): Path;
@@ -1,3 +1,3 @@
1
1
  import { Path } from 'Items';
2
- import { ControlPoint, BoardPoint } from '../ControlPoint';
3
- export declare function getOrthogonalLine(start: ControlPoint, end: ControlPoint, middle: BoardPoint | null, skipObstacles?: boolean): Path;
2
+ import { ControlPoint } from '../ControlPoint';
3
+ export declare function getOrthogonalLine(start: ControlPoint, end: ControlPoint, middle: ControlPoint | null, skipObstacles?: boolean): Path;
@@ -1,5 +1,6 @@
1
+ import { LayoutBlockNode } from "./Render";
1
2
  export interface LayoutBlockNodes {
2
- nodes: [];
3
+ nodes: LayoutBlockNode[];
3
4
  maxWidth: number;
4
5
  width: number;
5
6
  height: number;