@jvs-milkdown/components 1.1.9 → 1.2.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.
- package/lib/code-block/index.js +37 -2
- package/lib/code-block/index.js.map +1 -1
- package/lib/image-block/index.js +628 -107
- package/lib/image-block/index.js.map +1 -1
- package/lib/table-block/index.js +135 -64
- package/lib/table-block/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/code-block/config.ts +4 -0
- package/src/code-block/view/components/code-block.tsx +24 -0
- package/src/code-block/view/node-view.ts +15 -0
- package/src/image-block/config.ts +10 -0
- package/src/image-block/schema.ts +16 -0
- package/src/image-block/view/components/__tests__/image-viewer.onImageLoadError.spec.tsx +14 -0
- package/src/image-block/view/components/image-block.tsx +40 -0
- package/src/image-block/view/components/image-viewer.tsx +548 -65
- package/src/image-block/view/index.ts +42 -0
- package/src/table-block/view/component.tsx +116 -46
- package/src/table-block/view/operation.ts +55 -30
- package/lib/__internal__/components/icon.d.ts +0 -24
- package/lib/__internal__/components/icon.d.ts.map +0 -1
- package/lib/__internal__/components/image-input.d.ts +0 -17
- package/lib/__internal__/components/image-input.d.ts.map +0 -1
- package/lib/__internal__/keep-alive.d.ts +0 -2
- package/lib/__internal__/keep-alive.d.ts.map +0 -1
- package/lib/__internal__/meta.d.ts +0 -3
- package/lib/__internal__/meta.d.ts.map +0 -1
- package/lib/__tests__/setup.d.ts +0 -2
- package/lib/__tests__/setup.d.ts.map +0 -1
- package/lib/code-block/config.d.ts +0 -23
- package/lib/code-block/config.d.ts.map +0 -1
- package/lib/code-block/index.d.ts +0 -5
- package/lib/code-block/index.d.ts.map +0 -1
- package/lib/code-block/view/components/code-block.d.ts +0 -16
- package/lib/code-block/view/components/code-block.d.ts.map +0 -1
- package/lib/code-block/view/components/copy-button.d.ts +0 -9
- package/lib/code-block/view/components/copy-button.d.ts.map +0 -1
- package/lib/code-block/view/components/language-picker.d.ts +0 -5
- package/lib/code-block/view/components/language-picker.d.ts.map +0 -1
- package/lib/code-block/view/components/preview-panel.d.ts +0 -9
- package/lib/code-block/view/components/preview-panel.d.ts.map +0 -1
- package/lib/code-block/view/index.d.ts +0 -3
- package/lib/code-block/view/index.d.ts.map +0 -1
- package/lib/code-block/view/loader.d.ts +0 -13
- package/lib/code-block/view/loader.d.ts.map +0 -1
- package/lib/code-block/view/node-view.d.ts +0 -40
- package/lib/code-block/view/node-view.d.ts.map +0 -1
- package/lib/image-block/config.d.ts +0 -16
- package/lib/image-block/config.d.ts.map +0 -1
- package/lib/image-block/convert-plugin.d.ts +0 -2
- package/lib/image-block/convert-plugin.d.ts.map +0 -1
- package/lib/image-block/index.d.ts +0 -9
- package/lib/image-block/index.d.ts.map +0 -1
- package/lib/image-block/paste-rule.d.ts +0 -2
- package/lib/image-block/paste-rule.d.ts.map +0 -1
- package/lib/image-block/remark-plugin.d.ts +0 -2
- package/lib/image-block/remark-plugin.d.ts.map +0 -1
- package/lib/image-block/schema.d.ts +0 -3
- package/lib/image-block/schema.d.ts.map +0 -1
- package/lib/image-block/view/components/__tests__/image-viewer.onImageLoadError.spec.d.ts +0 -2
- package/lib/image-block/view/components/__tests__/image-viewer.onImageLoadError.spec.d.ts.map +0 -1
- package/lib/image-block/view/components/image-block.d.ts +0 -19
- package/lib/image-block/view/components/image-block.d.ts.map +0 -1
- package/lib/image-block/view/components/image-viewer.d.ts +0 -3
- package/lib/image-block/view/components/image-viewer.d.ts.map +0 -1
- package/lib/image-block/view/index.d.ts +0 -3
- package/lib/image-block/view/index.d.ts.map +0 -1
- package/lib/image-inline/components/image-inline.d.ts +0 -18
- package/lib/image-inline/components/image-inline.d.ts.map +0 -1
- package/lib/image-inline/config.d.ts +0 -11
- package/lib/image-inline/config.d.ts.map +0 -1
- package/lib/image-inline/index.d.ts +0 -5
- package/lib/image-inline/index.d.ts.map +0 -1
- package/lib/image-inline/view.d.ts +0 -3
- package/lib/image-inline/view.d.ts.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +0 -1
- package/lib/link-tooltip/command.d.ts +0 -2
- package/lib/link-tooltip/command.d.ts.map +0 -1
- package/lib/link-tooltip/configure.d.ts +0 -3
- package/lib/link-tooltip/configure.d.ts.map +0 -1
- package/lib/link-tooltip/edit/component.d.ts +0 -11
- package/lib/link-tooltip/edit/component.d.ts.map +0 -1
- package/lib/link-tooltip/edit/edit-configure.d.ts +0 -3
- package/lib/link-tooltip/edit/edit-configure.d.ts.map +0 -1
- package/lib/link-tooltip/edit/edit-view.d.ts +0 -15
- package/lib/link-tooltip/edit/edit-view.d.ts.map +0 -1
- package/lib/link-tooltip/index.d.ts +0 -7
- package/lib/link-tooltip/index.d.ts.map +0 -1
- package/lib/link-tooltip/preview/component.d.ts +0 -11
- package/lib/link-tooltip/preview/component.d.ts.map +0 -1
- package/lib/link-tooltip/preview/preview-configure.d.ts +0 -3
- package/lib/link-tooltip/preview/preview-configure.d.ts.map +0 -1
- package/lib/link-tooltip/preview/preview-view.d.ts +0 -14
- package/lib/link-tooltip/preview/preview-view.d.ts.map +0 -1
- package/lib/link-tooltip/slices.d.ts +0 -34
- package/lib/link-tooltip/slices.d.ts.map +0 -1
- package/lib/link-tooltip/tooltips.d.ts +0 -3
- package/lib/link-tooltip/tooltips.d.ts.map +0 -1
- package/lib/link-tooltip/utils.d.ts +0 -14
- package/lib/link-tooltip/utils.d.ts.map +0 -1
- package/lib/list-item-block/component.d.ts +0 -19
- package/lib/list-item-block/component.d.ts.map +0 -1
- package/lib/list-item-block/config.d.ts +0 -13
- package/lib/list-item-block/config.d.ts.map +0 -1
- package/lib/list-item-block/index.d.ts +0 -6
- package/lib/list-item-block/index.d.ts.map +0 -1
- package/lib/list-item-block/view.d.ts +0 -3
- package/lib/list-item-block/view.d.ts.map +0 -1
- package/lib/table-block/config.d.ts +0 -8
- package/lib/table-block/config.d.ts.map +0 -1
- package/lib/table-block/dnd/calc-drag-over.d.ts +0 -3
- package/lib/table-block/dnd/calc-drag-over.d.ts.map +0 -1
- package/lib/table-block/dnd/create-drag-handler.d.ts +0 -5
- package/lib/table-block/dnd/create-drag-handler.d.ts.map +0 -1
- package/lib/table-block/dnd/drag-over-handler.d.ts +0 -3
- package/lib/table-block/dnd/drag-over-handler.d.ts.map +0 -1
- package/lib/table-block/dnd/prepare-dnd-context.d.ts +0 -3
- package/lib/table-block/dnd/prepare-dnd-context.d.ts.map +0 -1
- package/lib/table-block/dnd/preview.d.ts +0 -3
- package/lib/table-block/dnd/preview.d.ts.map +0 -1
- package/lib/table-block/index.d.ts +0 -5
- package/lib/table-block/index.d.ts.map +0 -1
- package/lib/table-block/view/component.d.ts +0 -16
- package/lib/table-block/view/component.d.ts.map +0 -1
- package/lib/table-block/view/drag.d.ts +0 -10
- package/lib/table-block/view/drag.d.ts.map +0 -1
- package/lib/table-block/view/index.d.ts +0 -2
- package/lib/table-block/view/index.d.ts.map +0 -1
- package/lib/table-block/view/operation.d.ts +0 -13
- package/lib/table-block/view/operation.d.ts.map +0 -1
- package/lib/table-block/view/pointer.d.ts +0 -7
- package/lib/table-block/view/pointer.d.ts.map +0 -1
- package/lib/table-block/view/types.d.ts +0 -28
- package/lib/table-block/view/types.d.ts.map +0 -1
- package/lib/table-block/view/utils.d.ts +0 -12
- package/lib/table-block/view/utils.d.ts.map +0 -1
- package/lib/table-block/view/view.d.ts +0 -22
- package/lib/table-block/view/view.d.ts.map +0 -1
package/lib/table-block/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $ctx, $view } from '@jvs-milkdown/utils';
|
|
2
|
-
import { selectColCommand, moveColCommand, selectRowCommand, moveRowCommand, mergeCellsCommand, setAlignCommand, deleteSelectedCellsCommand,
|
|
2
|
+
import { selectColCommand, moveColCommand, selectRowCommand, moveRowCommand, mergeCellsCommand, setAlignCommand, deleteSelectedCellsCommand, addRowWithAlignment, tableSchema } from '@jvs-milkdown/preset-gfm';
|
|
3
3
|
import { h, defineComponent, ref, onMounted, watch, onBeforeUnmount, shallowRef, createApp, triggerRef } from 'vue';
|
|
4
4
|
import { computePosition, offset } from '@floating-ui/dom';
|
|
5
|
-
import { findTable, CellSelection, selectedRect, splitCellWithType, mergeCells, splitCell } from '@jvs-milkdown/prose/tables';
|
|
5
|
+
import { findTable, CellSelection, selectedRect, splitCellWithType, TableMap, addColumn, mergeCells, splitCell } from '@jvs-milkdown/prose/tables';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import DOMPurify from 'dompurify';
|
|
8
8
|
import { editorViewCtx, commandsCtx } from '@jvs-milkdown/core';
|
|
@@ -502,40 +502,52 @@ function useDragHandlers(refs, ctx, getPos) {
|
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
function useOperation(refs, ctx, getPos) {
|
|
505
|
-
const {
|
|
505
|
+
const { hoverIndex } = refs;
|
|
506
506
|
const addRowByIndex = (index) => {
|
|
507
|
-
var _a, _b, _c;
|
|
508
507
|
if (!ctx || !ctx.get(editorViewCtx).editable) return;
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
);
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
508
|
+
const view = ctx.get(editorViewCtx);
|
|
509
|
+
const tablePos = getPos == null ? void 0 : getPos();
|
|
510
|
+
if (tablePos == null) return;
|
|
511
|
+
const table = view.state.doc.nodeAt(tablePos);
|
|
512
|
+
if (!table) return;
|
|
513
|
+
const tableStart = tablePos + 1;
|
|
514
|
+
const map = TableMap.get(table);
|
|
515
|
+
const insertRow = Math.min(index, map.height);
|
|
516
|
+
const tr = view.state.tr;
|
|
517
|
+
const rect = {
|
|
518
|
+
map,
|
|
519
|
+
tableStart,
|
|
520
|
+
table,
|
|
521
|
+
left: 0,
|
|
522
|
+
right: map.width,
|
|
523
|
+
top: 0,
|
|
524
|
+
bottom: map.height
|
|
525
|
+
};
|
|
526
|
+
addRowWithAlignment(ctx, tr, rect, insertRow);
|
|
527
|
+
view.dispatch(tr);
|
|
522
528
|
};
|
|
523
529
|
const addColByIndex = (index) => {
|
|
524
|
-
var _a, _b, _c, _d;
|
|
525
530
|
if (!ctx || !ctx.get(editorViewCtx).editable) return;
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
);
|
|
529
|
-
const
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
531
|
+
const view = ctx.get(editorViewCtx);
|
|
532
|
+
const tablePos = getPos == null ? void 0 : getPos();
|
|
533
|
+
if (tablePos == null) return;
|
|
534
|
+
const table = view.state.doc.nodeAt(tablePos);
|
|
535
|
+
if (!table) return;
|
|
536
|
+
const tableStart = tablePos + 1;
|
|
537
|
+
const map = TableMap.get(table);
|
|
538
|
+
const insertCol = Math.min(index, map.width);
|
|
539
|
+
const tr = view.state.tr;
|
|
540
|
+
const rect = {
|
|
541
|
+
map,
|
|
542
|
+
tableStart,
|
|
543
|
+
table,
|
|
544
|
+
left: 0,
|
|
545
|
+
right: map.width,
|
|
546
|
+
top: 0,
|
|
547
|
+
bottom: map.height
|
|
548
|
+
};
|
|
549
|
+
addColumn(tr, rect, insertCol);
|
|
550
|
+
view.dispatch(tr);
|
|
539
551
|
};
|
|
540
552
|
const selectCol = () => {
|
|
541
553
|
var _a;
|
|
@@ -556,6 +568,7 @@ function useOperation(refs, ctx, getPos) {
|
|
|
556
568
|
const deleteSelected = (e) => {
|
|
557
569
|
if (!ctx) return;
|
|
558
570
|
if (!ctx.get(editorViewCtx).editable) return;
|
|
571
|
+
if (e.button !== 0) return;
|
|
559
572
|
e.preventDefault();
|
|
560
573
|
e.stopPropagation();
|
|
561
574
|
const commands = ctx.get(commandsCtx);
|
|
@@ -567,6 +580,7 @@ function useOperation(refs, ctx, getPos) {
|
|
|
567
580
|
const onAlign = (direction) => (e) => {
|
|
568
581
|
if (!ctx) return;
|
|
569
582
|
if (!ctx.get(editorViewCtx).editable) return;
|
|
583
|
+
if (e.button !== 0) return;
|
|
570
584
|
e.preventDefault();
|
|
571
585
|
e.stopPropagation();
|
|
572
586
|
const commands = ctx.get(commandsCtx);
|
|
@@ -578,6 +592,7 @@ function useOperation(refs, ctx, getPos) {
|
|
|
578
592
|
const onMergeCells = (e) => {
|
|
579
593
|
if (!ctx) return;
|
|
580
594
|
if (!ctx.get(editorViewCtx).editable) return;
|
|
595
|
+
if (e.button !== 0) return;
|
|
581
596
|
e.preventDefault();
|
|
582
597
|
e.stopPropagation();
|
|
583
598
|
const commands = ctx.get(commandsCtx);
|
|
@@ -590,6 +605,7 @@ function useOperation(refs, ctx, getPos) {
|
|
|
590
605
|
var _a, _b;
|
|
591
606
|
if (!ctx) return;
|
|
592
607
|
if (!ctx.get(editorViewCtx).editable) return;
|
|
608
|
+
if (e.button !== 0) return;
|
|
593
609
|
e.preventDefault();
|
|
594
610
|
e.stopPropagation();
|
|
595
611
|
const view = ctx.get(editorViewCtx);
|
|
@@ -728,22 +744,68 @@ const TableBlock = defineComponent({
|
|
|
728
744
|
const xLineHandleRef = ref();
|
|
729
745
|
const resizingCol = ref(-1);
|
|
730
746
|
const colWidths = ref([]);
|
|
747
|
+
const getColCount = () => {
|
|
748
|
+
let maxCols = 0;
|
|
749
|
+
node.value.forEach((row) => {
|
|
750
|
+
let cols = 0;
|
|
751
|
+
row.forEach((cell) => {
|
|
752
|
+
cols += cell.attrs.colspan || 1;
|
|
753
|
+
});
|
|
754
|
+
if (cols > maxCols) maxCols = cols;
|
|
755
|
+
});
|
|
756
|
+
return maxCols;
|
|
757
|
+
};
|
|
731
758
|
const syncColWidths = () => {
|
|
732
759
|
if (resizingCol.value >= 0) return;
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
const colCount = firstRow.content.childCount;
|
|
760
|
+
const colCount = getColCount();
|
|
761
|
+
const prevColCount = colWidths.value.length;
|
|
736
762
|
const widths = [];
|
|
737
|
-
const hasBounds = colBounds.value.length
|
|
763
|
+
const hasBounds = colBounds.value.length >= colCount;
|
|
764
|
+
const existingNonZero = colWidths.value.filter((w) => w > 0);
|
|
765
|
+
const avgWidth = existingNonZero.length > 0 ? Math.round(
|
|
766
|
+
existingNonZero.reduce((a, b) => a + b, 0) / existingNonZero.length
|
|
767
|
+
) : 0;
|
|
738
768
|
for (let i = 0; i < colCount; i++) {
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
769
|
+
const isNewColumn = i >= prevColCount;
|
|
770
|
+
let found = false;
|
|
771
|
+
node.value.forEach((row) => {
|
|
772
|
+
if (found) return;
|
|
773
|
+
let colIdx = 0;
|
|
774
|
+
row.forEach((cell) => {
|
|
775
|
+
if (found) return;
|
|
776
|
+
const colspan = cell.attrs.colspan || 1;
|
|
777
|
+
const colwidth = cell.attrs.colwidth;
|
|
778
|
+
if (colIdx === i) {
|
|
779
|
+
if (colspan > 1) {
|
|
780
|
+
if (Array.isArray(colwidth) && colwidth.length > 0) {
|
|
781
|
+
const totalW = colwidth.reduce(
|
|
782
|
+
(sum, w) => sum + (w || 0),
|
|
783
|
+
0
|
|
784
|
+
);
|
|
785
|
+
widths.push(Math.round(totalW / colspan));
|
|
786
|
+
} else if (!isNewColumn && hasBounds && colBounds.value[i]) {
|
|
787
|
+
widths.push(Math.round(colBounds.value[i].width));
|
|
788
|
+
} else {
|
|
789
|
+
widths.push(avgWidth);
|
|
790
|
+
}
|
|
791
|
+
} else {
|
|
792
|
+
if (Array.isArray(colwidth) && colwidth[0]) {
|
|
793
|
+
widths.push(colwidth[0]);
|
|
794
|
+
} else if (!isNewColumn && hasBounds && colBounds.value[i]) {
|
|
795
|
+
widths.push(Math.round(colBounds.value[i].width));
|
|
796
|
+
} else {
|
|
797
|
+
widths.push(avgWidth);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
found = true;
|
|
801
|
+
}
|
|
802
|
+
colIdx += colspan;
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
if (!found) {
|
|
806
|
+
widths.push(
|
|
807
|
+
!isNewColumn && hasBounds && colBounds.value[i] ? Math.round(colBounds.value[i].width) : avgWidth
|
|
808
|
+
);
|
|
747
809
|
}
|
|
748
810
|
}
|
|
749
811
|
colWidths.value = widths;
|
|
@@ -839,15 +901,23 @@ const TableBlock = defineComponent({
|
|
|
839
901
|
const updateBounds = () => {
|
|
840
902
|
const content = contentWrapperRef.value;
|
|
841
903
|
if (!content) return;
|
|
842
|
-
const
|
|
904
|
+
const rows = content.querySelectorAll("tr");
|
|
843
905
|
const tableRect = content.getBoundingClientRect();
|
|
844
|
-
|
|
845
|
-
|
|
906
|
+
const expectedColCount = getColCount();
|
|
907
|
+
let bestRow = null;
|
|
908
|
+
rows.forEach((row) => {
|
|
909
|
+
if (bestRow) return;
|
|
910
|
+
if (row.children.length === expectedColCount) {
|
|
911
|
+
bestRow = row;
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
const measureRow = bestRow != null ? bestRow : content.querySelector("tr");
|
|
915
|
+
if (measureRow) {
|
|
916
|
+
colBounds.value = Array.from(measureRow.children).map((c) => {
|
|
846
917
|
const rect = c.getBoundingClientRect();
|
|
847
918
|
return { left: rect.left - tableRect.left, width: rect.width };
|
|
848
919
|
});
|
|
849
920
|
}
|
|
850
|
-
const rows = content.querySelectorAll("tr");
|
|
851
921
|
rowBounds.value = Array.from(rows).map((c) => {
|
|
852
922
|
const rect = c.getBoundingClientRect();
|
|
853
923
|
return { top: rect.top - tableRect.top, height: rect.height };
|
|
@@ -971,6 +1041,7 @@ const TableBlock = defineComponent({
|
|
|
971
1041
|
});
|
|
972
1042
|
watch(node, () => {
|
|
973
1043
|
dispatchListener();
|
|
1044
|
+
requestAnimationFrame(updateBounds);
|
|
974
1045
|
});
|
|
975
1046
|
onBeforeUnmount(() => {
|
|
976
1047
|
view.dom.removeEventListener("keyup", dispatchListener);
|
|
@@ -1012,7 +1083,7 @@ const TableBlock = defineComponent({
|
|
|
1012
1083
|
contenteditable: "false",
|
|
1013
1084
|
onPointerdown: (e) => e.stopPropagation()
|
|
1014
1085
|
},
|
|
1015
|
-
/* @__PURE__ */ h(
|
|
1086
|
+
canMerge.value ? /* @__PURE__ */ h(
|
|
1016
1087
|
"button",
|
|
1017
1088
|
{
|
|
1018
1089
|
type: "button",
|
|
@@ -1020,8 +1091,7 @@ const TableBlock = defineComponent({
|
|
|
1020
1091
|
onPointerdown: onMergeCells
|
|
1021
1092
|
},
|
|
1022
1093
|
/* @__PURE__ */ h(Icon, { icon: config.renderButton("merge_cells") })
|
|
1023
|
-
)
|
|
1024
|
-
/* @__PURE__ */ h(
|
|
1094
|
+
) : canSplit.value ? /* @__PURE__ */ h(
|
|
1025
1095
|
"button",
|
|
1026
1096
|
{
|
|
1027
1097
|
type: "button",
|
|
@@ -1029,7 +1099,7 @@ const TableBlock = defineComponent({
|
|
|
1029
1099
|
onPointerdown: onSplitCell
|
|
1030
1100
|
},
|
|
1031
1101
|
/* @__PURE__ */ h(Icon, { icon: config.renderButton("split_cell") })
|
|
1032
|
-
)
|
|
1102
|
+
) : void 0
|
|
1033
1103
|
),
|
|
1034
1104
|
/* @__PURE__ */ h("div", { class: "table-wrapper", ref: tableWrapperRef }, /* @__PURE__ */ h("div", { contenteditable: "false", class: "fixed-handles-col" }, colBounds.value.map((bound, i) => /* @__PURE__ */ h(
|
|
1035
1105
|
"div",
|
|
@@ -1060,6 +1130,7 @@ const TableBlock = defineComponent({
|
|
|
1060
1130
|
"data-show": activeColIndex.value === i ? "true" : "false",
|
|
1061
1131
|
onPointermove: (e) => e.stopPropagation()
|
|
1062
1132
|
},
|
|
1133
|
+
canMerge.value ? /* @__PURE__ */ h("button", { type: "button", onPointerdown: onMergeCells }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("merge_cells") })) : canSplit.value ? /* @__PURE__ */ h("button", { type: "button", onPointerdown: onSplitCell }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("split_cell") })) : void 0,
|
|
1063
1134
|
/* @__PURE__ */ h(
|
|
1064
1135
|
"button",
|
|
1065
1136
|
{
|
|
@@ -1103,9 +1174,7 @@ const TableBlock = defineComponent({
|
|
|
1103
1174
|
}
|
|
1104
1175
|
},
|
|
1105
1176
|
/* @__PURE__ */ h(Icon, { icon: config.renderButton("delete_col") })
|
|
1106
|
-
)
|
|
1107
|
-
canMerge.value && /* @__PURE__ */ h("button", { type: "button", onPointerdown: onMergeCells }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("merge_cells") })),
|
|
1108
|
-
canSplit.value && /* @__PURE__ */ h("button", { type: "button", onPointerdown: onSplitCell }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("split_cell") }))
|
|
1177
|
+
)
|
|
1109
1178
|
)
|
|
1110
1179
|
))), /* @__PURE__ */ h("div", { contenteditable: "false", class: "add-dots-col" }, [
|
|
1111
1180
|
...colBounds.value.map((b) => b.left),
|
|
@@ -1161,6 +1230,7 @@ const TableBlock = defineComponent({
|
|
|
1161
1230
|
"data-show": activeRowIndex.value === i ? "true" : "false",
|
|
1162
1231
|
onPointermove: (e) => e.stopPropagation()
|
|
1163
1232
|
},
|
|
1233
|
+
canMerge.value ? /* @__PURE__ */ h("button", { type: "button", onPointerdown: onMergeCells }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("merge_cells") })) : canSplit.value ? /* @__PURE__ */ h("button", { type: "button", onPointerdown: onSplitCell }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("split_cell") })) : void 0,
|
|
1164
1234
|
/* @__PURE__ */ h(
|
|
1165
1235
|
"button",
|
|
1166
1236
|
{
|
|
@@ -1171,9 +1241,7 @@ const TableBlock = defineComponent({
|
|
|
1171
1241
|
}
|
|
1172
1242
|
},
|
|
1173
1243
|
/* @__PURE__ */ h(Icon, { icon: config.renderButton("delete_row") })
|
|
1174
|
-
)
|
|
1175
|
-
canMerge.value && /* @__PURE__ */ h("button", { type: "button", onPointerdown: onMergeCells }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("merge_cells") })),
|
|
1176
|
-
canSplit.value && /* @__PURE__ */ h("button", { type: "button", onPointerdown: onSplitCell }, /* @__PURE__ */ h(Icon, { icon: config.renderButton("split_cell") }))
|
|
1244
|
+
)
|
|
1177
1245
|
)
|
|
1178
1246
|
))), /* @__PURE__ */ h("div", { contenteditable: "false", class: "add-dots-row" }, [
|
|
1179
1247
|
...rowBounds.value.map((b) => b.top),
|
|
@@ -1217,13 +1285,16 @@ const TableBlock = defineComponent({
|
|
|
1217
1285
|
class: "handle line-handle",
|
|
1218
1286
|
ref: yLineHandleRef
|
|
1219
1287
|
}
|
|
1220
|
-
), /* @__PURE__ */ h("table", { ref: contentWrapperFunctionRef, class: "children" }, /* @__PURE__ */ h("colgroup", null,
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1288
|
+
), /* @__PURE__ */ h("table", { ref: contentWrapperFunctionRef, class: "children" }, /* @__PURE__ */ h("colgroup", null, Array.from({ length: getColCount() }, (_, i) => {
|
|
1289
|
+
const w = colWidths.value[i];
|
|
1290
|
+
return /* @__PURE__ */ h(
|
|
1291
|
+
"col",
|
|
1292
|
+
{
|
|
1293
|
+
key: i,
|
|
1294
|
+
style: w && w > 0 ? { width: `${w}px` } : void 0
|
|
1295
|
+
}
|
|
1296
|
+
);
|
|
1297
|
+
}))))
|
|
1227
1298
|
);
|
|
1228
1299
|
};
|
|
1229
1300
|
}
|