@harbour-enterprises/superdoc 0.25.0-next.6 → 0.25.0-next.7
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/chunks/{PdfViewer-BeQy7uL0.cjs → PdfViewer-B2IOirxr.cjs} +1 -1
- package/dist/chunks/{PdfViewer-BOrm7Awj.es.js → PdfViewer-lMsL6l5A.es.js} +1 -1
- package/dist/chunks/{index-DDGjYIm1.es.js → index-DOLVGSYC.es.js} +2 -2
- package/dist/chunks/{index-7exCeEb1.cjs → index-aoNHRlnl.cjs} +2 -2
- package/dist/chunks/{super-editor.es-GExnUB7l.cjs → super-editor.es-B2cypcnX.cjs} +198 -0
- package/dist/chunks/{super-editor.es-XXbEUVCc.es.js → super-editor.es-CHq5MqBc.es.js} +198 -0
- package/dist/super-editor/ai-writer.es.js +1 -1
- package/dist/super-editor/chunks/{editor-D1Q0suDz.js → editor-CEZNgaJQ.js} +198 -0
- package/dist/super-editor/chunks/{toolbar-DjuLzygc.js → toolbar-C6e42Zol.js} +1 -1
- package/dist/super-editor/editor.es.js +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +25 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTablesById.d.ts +10 -0
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +84 -0
- package/dist/super-editor/super-editor/src/extensions/table/tableHelpers/appendRows.d.ts +139 -0
- package/dist/super-editor/super-editor.es.js +3 -3
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +198 -0
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -17604,10 +17604,27 @@ function getStructuredContentBlockTags(state) {
|
|
|
17604
17604
|
const result = findChildren$5(state.doc, (node) => node.type.name === "structuredContentBlock");
|
|
17605
17605
|
return result;
|
|
17606
17606
|
}
|
|
17607
|
+
function getStructuredContentTablesById(id, state) {
|
|
17608
|
+
if (!id || !state) return [];
|
|
17609
|
+
const blocks = getStructuredContentTagsById(id, state).filter(
|
|
17610
|
+
({ node }) => node.type.name === "structuredContentBlock"
|
|
17611
|
+
);
|
|
17612
|
+
if (!blocks.length) return [];
|
|
17613
|
+
const { pos: blockPos, node: blockNode } = blocks[0];
|
|
17614
|
+
const tablesInBlock = [];
|
|
17615
|
+
blockNode.descendants((child, relPos) => {
|
|
17616
|
+
if (child.type.name === "table") {
|
|
17617
|
+
const absPos = blockPos + 1 + relPos;
|
|
17618
|
+
tablesInBlock.push({ node: child, pos: absPos });
|
|
17619
|
+
}
|
|
17620
|
+
});
|
|
17621
|
+
return tablesInBlock;
|
|
17622
|
+
}
|
|
17607
17623
|
const structuredContentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
17608
17624
|
__proto__: null,
|
|
17609
17625
|
getStructuredContentBlockTags,
|
|
17610
17626
|
getStructuredContentInlineTags,
|
|
17627
|
+
getStructuredContentTablesById,
|
|
17611
17628
|
getStructuredContentTags,
|
|
17612
17629
|
getStructuredContentTagsById
|
|
17613
17630
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -17804,6 +17821,36 @@ const StructuredContentCommands = Extension.create({
|
|
|
17804
17821
|
tr.replaceWith(posFrom, posTo, content);
|
|
17805
17822
|
}
|
|
17806
17823
|
return true;
|
|
17824
|
+
},
|
|
17825
|
+
/**
|
|
17826
|
+
* Append multiple rows to the end of a table inside a structured content block.
|
|
17827
|
+
* Each inner array represents the cell values for one new row.
|
|
17828
|
+
* @category Command
|
|
17829
|
+
* @param {StructuredContentTableAppendRowsOptions} options - Append configuration
|
|
17830
|
+
* @example
|
|
17831
|
+
* editor.commands.appendRowsToStructuredContentTable({
|
|
17832
|
+
* id: 'block-123',
|
|
17833
|
+
* tableIndex: 0,
|
|
17834
|
+
* rows: [['A', 'B'], ['C', 'D']],
|
|
17835
|
+
* copyRowStyle: true,
|
|
17836
|
+
* });
|
|
17837
|
+
*/
|
|
17838
|
+
appendRowsToStructuredContentTable: ({ id, tableIndex = 0, rows = [], copyRowStyle = false }) => ({ state, commands: commands2, dispatch }) => {
|
|
17839
|
+
const normalized = normalizeRowsInput(rows);
|
|
17840
|
+
if (!normalized.length) return true;
|
|
17841
|
+
const tables = getStructuredContentTablesById(id, state);
|
|
17842
|
+
if (!tables.length || tableIndex < 0 || tableIndex >= tables.length) return true;
|
|
17843
|
+
const { node: tableNode, pos: tablePos } = tables[tableIndex];
|
|
17844
|
+
if (dispatch) {
|
|
17845
|
+
return commands2.appendRowsWithContent({ tablePos, tableNode, valueRows: normalized, copyRowStyle });
|
|
17846
|
+
}
|
|
17847
|
+
return commands2.appendRowsWithContent({
|
|
17848
|
+
tablePos,
|
|
17849
|
+
tableNode,
|
|
17850
|
+
valueRows: normalized,
|
|
17851
|
+
copyRowStyle,
|
|
17852
|
+
dispatch: false
|
|
17853
|
+
});
|
|
17807
17854
|
}
|
|
17808
17855
|
};
|
|
17809
17856
|
},
|
|
@@ -17813,6 +17860,15 @@ const StructuredContentCommands = Extension.create({
|
|
|
17813
17860
|
};
|
|
17814
17861
|
}
|
|
17815
17862
|
});
|
|
17863
|
+
const normalizeRowsInput = (rowsOrValues) => {
|
|
17864
|
+
if (!Array.isArray(rowsOrValues) || !rowsOrValues.length) {
|
|
17865
|
+
return [];
|
|
17866
|
+
}
|
|
17867
|
+
if (Array.isArray(rowsOrValues[0])) {
|
|
17868
|
+
return rowsOrValues;
|
|
17869
|
+
}
|
|
17870
|
+
return [rowsOrValues];
|
|
17871
|
+
};
|
|
17816
17872
|
class DocumentSectionView {
|
|
17817
17873
|
constructor(node, getPos, decorations, editor) {
|
|
17818
17874
|
__privateAdd(this, _DocumentSectionView_instances);
|
|
@@ -23565,6 +23621,107 @@ function cellWrapping($pos) {
|
|
|
23565
23621
|
}
|
|
23566
23622
|
return null;
|
|
23567
23623
|
}
|
|
23624
|
+
function resolveTable(tr, tablePos, tableNode) {
|
|
23625
|
+
if (tableNode && tableNode.type && tableNode.type.name === "table") {
|
|
23626
|
+
return tableNode;
|
|
23627
|
+
}
|
|
23628
|
+
if (typeof tablePos === "number") {
|
|
23629
|
+
const current = tr.doc.nodeAt(tablePos);
|
|
23630
|
+
if (current && current.type.name === "table") {
|
|
23631
|
+
return current;
|
|
23632
|
+
}
|
|
23633
|
+
}
|
|
23634
|
+
return null;
|
|
23635
|
+
}
|
|
23636
|
+
function pickTemplateRowForAppend(tableNode, schema) {
|
|
23637
|
+
const RowType = schema.nodes.tableRow;
|
|
23638
|
+
const rows = [];
|
|
23639
|
+
tableNode.descendants((child) => {
|
|
23640
|
+
if (child.type === RowType) rows.push(child);
|
|
23641
|
+
});
|
|
23642
|
+
if (!rows.length) return null;
|
|
23643
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
23644
|
+
const r2 = rows[i];
|
|
23645
|
+
const hasBodyCell = r2.content?.content?.some((c) => c.type.name === "tableCell");
|
|
23646
|
+
if (hasBodyCell) return r2;
|
|
23647
|
+
}
|
|
23648
|
+
return rows[rows.length - 1];
|
|
23649
|
+
}
|
|
23650
|
+
function extractRowTemplateFormatting(cellNode, schema) {
|
|
23651
|
+
const ParagraphType = schema.nodes.paragraph;
|
|
23652
|
+
let blockType = ParagraphType;
|
|
23653
|
+
let blockAttrs = null;
|
|
23654
|
+
let textMarks = [];
|
|
23655
|
+
const blocks = cellNode?.content?.content || [];
|
|
23656
|
+
for (const block of blocks) {
|
|
23657
|
+
const isParagraphish = block.type === ParagraphType || block.type.name === "heading";
|
|
23658
|
+
if (isParagraphish) {
|
|
23659
|
+
blockType = block.type || ParagraphType;
|
|
23660
|
+
blockAttrs = block.attrs || null;
|
|
23661
|
+
}
|
|
23662
|
+
let foundText = null;
|
|
23663
|
+
block.descendants?.((n) => {
|
|
23664
|
+
if (!foundText && n.isText) foundText = n;
|
|
23665
|
+
});
|
|
23666
|
+
if (foundText) {
|
|
23667
|
+
textMarks = foundText.marks ? Array.from(foundText.marks) : [];
|
|
23668
|
+
break;
|
|
23669
|
+
}
|
|
23670
|
+
}
|
|
23671
|
+
if (!blockType || !blockType.validContent) blockType = ParagraphType;
|
|
23672
|
+
return { blockType, blockAttrs, textMarks };
|
|
23673
|
+
}
|
|
23674
|
+
function buildFormattedCellBlock(schema, value, { blockType, blockAttrs, textMarks }, copyRowStyle = false) {
|
|
23675
|
+
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
23676
|
+
const marks = copyRowStyle ? textMarks || [] : [];
|
|
23677
|
+
const textNode = schema.text(text, marks);
|
|
23678
|
+
const type = blockType || schema.nodes.paragraph;
|
|
23679
|
+
return type.createAndFill(blockAttrs || null, textNode);
|
|
23680
|
+
}
|
|
23681
|
+
function buildRowFromTemplateRow({ schema, tableNode, templateRow, values, copyRowStyle = false }) {
|
|
23682
|
+
const RowType = schema.nodes.tableRow;
|
|
23683
|
+
const CellType = schema.nodes.tableCell;
|
|
23684
|
+
const HeaderType = schema.nodes.tableHeader;
|
|
23685
|
+
const map2 = TableMap.get(tableNode);
|
|
23686
|
+
const totalColumns = map2.width;
|
|
23687
|
+
const byColumns = Array.isArray(values) && values.length === totalColumns;
|
|
23688
|
+
const newCells = [];
|
|
23689
|
+
let columnCursor = 0;
|
|
23690
|
+
templateRow.content.content.forEach((cellNode, cellIndex) => {
|
|
23691
|
+
const isHeaderCell = cellNode.type === HeaderType;
|
|
23692
|
+
const targetCellType = isHeaderCell ? CellType : cellNode.type;
|
|
23693
|
+
const attrs = { ...cellNode.attrs };
|
|
23694
|
+
const formatting = extractRowTemplateFormatting(cellNode, schema);
|
|
23695
|
+
let cellValue = "";
|
|
23696
|
+
if (byColumns) {
|
|
23697
|
+
const span = Math.max(1, attrs.colspan || 1);
|
|
23698
|
+
cellValue = values[columnCursor] ?? "";
|
|
23699
|
+
columnCursor += span;
|
|
23700
|
+
} else {
|
|
23701
|
+
cellValue = Array.isArray(values) ? values[cellIndex] ?? "" : "";
|
|
23702
|
+
}
|
|
23703
|
+
const content = buildFormattedCellBlock(schema, cellValue, formatting, copyRowStyle);
|
|
23704
|
+
const newCell = targetCellType.createAndFill(attrs, content);
|
|
23705
|
+
if (newCell) newCells.push(newCell);
|
|
23706
|
+
});
|
|
23707
|
+
return RowType.createAndFill(null, newCells);
|
|
23708
|
+
}
|
|
23709
|
+
function insertRowsAtTableEnd({ tr, tablePos, tableNode, rows }) {
|
|
23710
|
+
if (!rows || !rows.length) return;
|
|
23711
|
+
const RowTypeName = "tableRow";
|
|
23712
|
+
let lastRowRelPos = 0;
|
|
23713
|
+
let lastRowNode = null;
|
|
23714
|
+
tableNode.descendants((child, relPos) => {
|
|
23715
|
+
if (child.type.name === RowTypeName) {
|
|
23716
|
+
lastRowRelPos = relPos;
|
|
23717
|
+
lastRowNode = child;
|
|
23718
|
+
}
|
|
23719
|
+
});
|
|
23720
|
+
if (!lastRowNode) return;
|
|
23721
|
+
const lastRowAbsEnd = tablePos + 1 + lastRowRelPos + lastRowNode.nodeSize;
|
|
23722
|
+
const frag = Fragment.fromArray(rows);
|
|
23723
|
+
tr.insert(lastRowAbsEnd, frag);
|
|
23724
|
+
}
|
|
23568
23725
|
const Table = Node$1.create({
|
|
23569
23726
|
name: "table",
|
|
23570
23727
|
content: "tableRow+",
|
|
@@ -23724,6 +23881,47 @@ const Table = Node$1.create({
|
|
|
23724
23881
|
},
|
|
23725
23882
|
addCommands() {
|
|
23726
23883
|
return {
|
|
23884
|
+
/**
|
|
23885
|
+
* Append multiple rows to the end of a table in a single transaction.
|
|
23886
|
+
* @category Command
|
|
23887
|
+
* @param {appendRowsWithContentOptions} options - Append configuration
|
|
23888
|
+
* @example
|
|
23889
|
+
* editor.commands.appendRowsWithContent({ tablePos, valueRows: [['A','B'], ['C','D']], copyRowStyle: true })
|
|
23890
|
+
*/
|
|
23891
|
+
appendRowsWithContent: ({ tablePos, tableNode, valueRows = [], copyRowStyle = false }) => ({ editor, chain }) => {
|
|
23892
|
+
if (typeof tablePos !== "number" && !tableNode || !Array.isArray(valueRows) || !valueRows.length) {
|
|
23893
|
+
return false;
|
|
23894
|
+
}
|
|
23895
|
+
return chain().command(({ tr, dispatch }) => {
|
|
23896
|
+
const workingTable = resolveTable(tr, tablePos, tableNode);
|
|
23897
|
+
if (!workingTable) return false;
|
|
23898
|
+
const templateRow = pickTemplateRowForAppend(workingTable, editor.schema);
|
|
23899
|
+
if (!templateRow) return false;
|
|
23900
|
+
const newRows = valueRows.map(
|
|
23901
|
+
(vals) => buildRowFromTemplateRow({
|
|
23902
|
+
schema: editor.schema,
|
|
23903
|
+
tableNode: workingTable,
|
|
23904
|
+
templateRow,
|
|
23905
|
+
values: vals,
|
|
23906
|
+
copyRowStyle
|
|
23907
|
+
})
|
|
23908
|
+
).filter(Boolean);
|
|
23909
|
+
if (!newRows.length) return false;
|
|
23910
|
+
let resolvedTablePos = tablePos;
|
|
23911
|
+
if (typeof resolvedTablePos !== "number" && workingTable) {
|
|
23912
|
+
const tables = editor.getNodesOfType("table");
|
|
23913
|
+
const match = workingTable ? tables.find((t) => t.node.eq(workingTable)) : tables[0];
|
|
23914
|
+
resolvedTablePos = match?.pos ?? null;
|
|
23915
|
+
}
|
|
23916
|
+
if (typeof resolvedTablePos !== "number") {
|
|
23917
|
+
return false;
|
|
23918
|
+
}
|
|
23919
|
+
if (dispatch) {
|
|
23920
|
+
insertRowsAtTableEnd({ tr, tablePos, tableNode: workingTable, rows: newRows });
|
|
23921
|
+
}
|
|
23922
|
+
return true;
|
|
23923
|
+
}).run();
|
|
23924
|
+
},
|
|
23727
23925
|
/**
|
|
23728
23926
|
* Insert a new table into the document
|
|
23729
23927
|
* @category Command
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
|
|
2
2
|
import { p as process$1 } from "./converter-DOkexB95.js";
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CEZNgaJQ.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
* @property {Object} [json] - Replace content with ProseMirror JSON (overrides html)
|
|
18
18
|
* @property {Object} [attrs] - Update attributes only (preserves content)
|
|
19
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} StructuredContentTableAppendRowsOptions
|
|
22
|
+
* @property {string} id - Structured content block identifier
|
|
23
|
+
* @property {number} [tableIndex=0] - Index of the table inside the block
|
|
24
|
+
* @property {Array<string[]>|Array<string>} rows - Cell values to append
|
|
25
|
+
* @property {boolean} [copyRowStyle=false] - Clone the last row's styling when true
|
|
26
|
+
*/
|
|
20
27
|
export const StructuredContentCommands: Extension;
|
|
21
28
|
export type StructuredContentInlineInsert = {
|
|
22
29
|
/**
|
|
@@ -64,4 +71,22 @@ export type StructuredContentUpdate = {
|
|
|
64
71
|
*/
|
|
65
72
|
attrs?: any;
|
|
66
73
|
};
|
|
74
|
+
export type StructuredContentTableAppendRowsOptions = {
|
|
75
|
+
/**
|
|
76
|
+
* - Structured content block identifier
|
|
77
|
+
*/
|
|
78
|
+
id: string;
|
|
79
|
+
/**
|
|
80
|
+
* - Index of the table inside the block
|
|
81
|
+
*/
|
|
82
|
+
tableIndex?: number;
|
|
83
|
+
/**
|
|
84
|
+
* - Cell values to append
|
|
85
|
+
*/
|
|
86
|
+
rows: Array<string[]> | Array<string>;
|
|
87
|
+
/**
|
|
88
|
+
* - Clone the last row's styling when true
|
|
89
|
+
*/
|
|
90
|
+
copyRowStyle?: boolean;
|
|
91
|
+
};
|
|
67
92
|
import { Extension } from '@core/index';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find all tables inside a structured content block identified by id.
|
|
3
|
+
* @param {string} id - Structured content block id
|
|
4
|
+
* @param {import('prosemirror-state').EditorState} state - Editor state
|
|
5
|
+
* @returns {Array<{ node: import('prosemirror-model').Node, pos: number }>} tables with absolute positions
|
|
6
|
+
*/
|
|
7
|
+
export function getStructuredContentTablesById(id: string, state: import("prosemirror-state").EditorState): Array<{
|
|
8
|
+
node: import("prosemirror-model").Node;
|
|
9
|
+
pos: number;
|
|
10
|
+
}>;
|
|
@@ -388,6 +388,90 @@ export type TableGrid = {
|
|
|
388
388
|
*/
|
|
389
389
|
colWidths?: ColWidth[];
|
|
390
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Row template formatting
|
|
393
|
+
*/
|
|
394
|
+
export type RowTemplateFormatting = {
|
|
395
|
+
/**
|
|
396
|
+
* - Node type used when building cell content
|
|
397
|
+
*/
|
|
398
|
+
blockType: import("prosemirror-model").NodeType;
|
|
399
|
+
/**
|
|
400
|
+
* - Attributes to apply to the created block node
|
|
401
|
+
*/
|
|
402
|
+
blockAttrs: any | null;
|
|
403
|
+
/**
|
|
404
|
+
* - Marks copied from the template text node
|
|
405
|
+
*/
|
|
406
|
+
textMarks: Array<import("prosemirror-model").Mark>;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Build row from template row parameters
|
|
410
|
+
*/
|
|
411
|
+
export type BuildRowFromTemplateRowParams = {
|
|
412
|
+
/**
|
|
413
|
+
* - Editor schema
|
|
414
|
+
*/
|
|
415
|
+
schema: import("prosemirror-model").Schema;
|
|
416
|
+
/**
|
|
417
|
+
* - Table node used for column map lookup
|
|
418
|
+
*/
|
|
419
|
+
tableNode: import("prosemirror-model").Node;
|
|
420
|
+
/**
|
|
421
|
+
* - Row providing structure and formatting
|
|
422
|
+
*/
|
|
423
|
+
templateRow: import("prosemirror-model").Node;
|
|
424
|
+
/**
|
|
425
|
+
* - Values to populate each table cell
|
|
426
|
+
*/
|
|
427
|
+
values: any[];
|
|
428
|
+
/**
|
|
429
|
+
* - Clone template marks and block attrs when true
|
|
430
|
+
*/
|
|
431
|
+
copyRowStyle?: boolean;
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Append rows to the end of a table in a single transaction.
|
|
435
|
+
*/
|
|
436
|
+
export type appendRowsWithContentOptions = {
|
|
437
|
+
/**
|
|
438
|
+
* - Absolute position of the target table; required when `tableNode` is not provided
|
|
439
|
+
*/
|
|
440
|
+
tablePos?: number;
|
|
441
|
+
/**
|
|
442
|
+
* - Table node reference; required when `tablePos` is not provided
|
|
443
|
+
*/
|
|
444
|
+
tableNode?: import("prosemirror-model").Node;
|
|
445
|
+
/**
|
|
446
|
+
* - Cell values for each appended row
|
|
447
|
+
*/
|
|
448
|
+
valueRows: string[][];
|
|
449
|
+
/**
|
|
450
|
+
* - Clone template styling when true
|
|
451
|
+
*/
|
|
452
|
+
copyRowStyle?: boolean;
|
|
453
|
+
};
|
|
454
|
+
/**
|
|
455
|
+
* Insert rows at table end parameters
|
|
456
|
+
*/
|
|
457
|
+
export type InsertRowsAtTableEndParams = {
|
|
458
|
+
/**
|
|
459
|
+
* - Transaction to mutate
|
|
460
|
+
*/
|
|
461
|
+
tr: import("prosemirror-state").Transaction;
|
|
462
|
+
/**
|
|
463
|
+
* - Absolute position of the target table
|
|
464
|
+
*/
|
|
465
|
+
tablePos: number;
|
|
466
|
+
/**
|
|
467
|
+
* - Table node receiving new rows
|
|
468
|
+
*/
|
|
469
|
+
tableNode: import("prosemirror-model").Node;
|
|
470
|
+
/**
|
|
471
|
+
* - Row nodes to append
|
|
472
|
+
*/
|
|
473
|
+
rows: import("prosemirror-model").Node[];
|
|
474
|
+
};
|
|
391
475
|
/**
|
|
392
476
|
* Table configuration options
|
|
393
477
|
*/
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row template formatting
|
|
3
|
+
* @typedef {Object} RowTemplateFormatting
|
|
4
|
+
* @property {import('prosemirror-model').NodeType} blockType - Node type used when building cell content
|
|
5
|
+
* @property {Object|null} blockAttrs - Attributes to apply to the created block node
|
|
6
|
+
* @property {Array<import('prosemirror-model').Mark>} textMarks - Marks copied from the template text node
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Build row from template row parameters
|
|
10
|
+
* @typedef {Object} BuildRowFromTemplateRowParams
|
|
11
|
+
* @property {import('prosemirror-model').Schema} schema - Editor schema
|
|
12
|
+
* @property {import('prosemirror-model').Node} tableNode - Table node used for column map lookup
|
|
13
|
+
* @property {import('prosemirror-model').Node} templateRow - Row providing structure and formatting
|
|
14
|
+
* @property {Array} values - Values to populate each table cell
|
|
15
|
+
* @property {boolean} [copyRowStyle=false] - Clone template marks and block attrs when true
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Insert rows at table end parameters
|
|
19
|
+
* @typedef {Object} InsertRowsAtTableEndParams
|
|
20
|
+
* @property {import('prosemirror-state').Transaction} tr - Transaction to mutate
|
|
21
|
+
* @property {number} tablePos - Absolute position of the target table
|
|
22
|
+
* @property {import('prosemirror-model').Node} tableNode - Table node receiving new rows
|
|
23
|
+
* @property {import('prosemirror-model').Node[]} rows - Row nodes to append
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the table node that should receive appended rows.
|
|
27
|
+
* Prefers an explicit table node, falling back to a position lookup.
|
|
28
|
+
* @private
|
|
29
|
+
* @param {import('prosemirror-state').Transaction} tr - Current transaction
|
|
30
|
+
* @param {number} [tablePos] - Absolute position of the table in the document
|
|
31
|
+
* @param {import('prosemirror-model').Node} [tableNode] - Explicit table node reference
|
|
32
|
+
* @returns {import('prosemirror-model').Node|null} Table node to append rows to, or null if not found
|
|
33
|
+
*/
|
|
34
|
+
export function resolveTable(tr: import("prosemirror-state").Transaction, tablePos?: number, tableNode?: import("prosemirror-model").Node): import("prosemirror-model").Node | null;
|
|
35
|
+
/**
|
|
36
|
+
* Select the template row used to derive structure and attributes for appended rows.
|
|
37
|
+
* Prefers the last body row (containing table cells) and falls back to the last row in the table.
|
|
38
|
+
* @private
|
|
39
|
+
* @param {import('prosemirror-model').Node} tableNode - Table node to inspect
|
|
40
|
+
* @param {import('prosemirror-model').Schema} schema - Editor schema
|
|
41
|
+
* @returns {import('prosemirror-model').Node|null} Template row node or null if none exist
|
|
42
|
+
*/
|
|
43
|
+
export function pickTemplateRowForAppend(tableNode: import("prosemirror-model").Node, schema: import("prosemirror-model").Schema): import("prosemirror-model").Node | null;
|
|
44
|
+
/**
|
|
45
|
+
* Extract block type, attributes, and text marks from a template cell.
|
|
46
|
+
* Used to reproduce formatting when constructing new row content.
|
|
47
|
+
* @private
|
|
48
|
+
* @param {import('prosemirror-model').Node} cellNode - Template cell node
|
|
49
|
+
* @param {import('prosemirror-model').Schema} schema - Editor schema
|
|
50
|
+
* @returns {RowTemplateFormatting} Formatting info
|
|
51
|
+
*/
|
|
52
|
+
export function extractRowTemplateFormatting(cellNode: import("prosemirror-model").Node, schema: import("prosemirror-model").Schema): RowTemplateFormatting;
|
|
53
|
+
/**
|
|
54
|
+
* Create a block node for a new cell, optionally applying marks from the template row.
|
|
55
|
+
* @private
|
|
56
|
+
* @param {import('prosemirror-model').Schema} schema - Editor schema
|
|
57
|
+
* @param {string|any} value - Cell text value
|
|
58
|
+
* @param {RowTemplateFormatting} formatting - Template formatting info
|
|
59
|
+
* @param {boolean} [copyRowStyle=false] - Whether to copy marks from the template row
|
|
60
|
+
* @returns {import('prosemirror-model').Node} Block node ready to insert into the cell
|
|
61
|
+
*/
|
|
62
|
+
export function buildFormattedCellBlock(schema: import("prosemirror-model").Schema, value: string | any, { blockType, blockAttrs, textMarks }: RowTemplateFormatting, copyRowStyle?: boolean): import("prosemirror-model").Node;
|
|
63
|
+
/**
|
|
64
|
+
* Construct a new table row by cloning structure from a template row and filling in values.
|
|
65
|
+
* Handles colspan-based value mapping and optional style copying.
|
|
66
|
+
* @private
|
|
67
|
+
* @param {BuildRowFromTemplateRowParams} params - Build parameters
|
|
68
|
+
* @returns {import('prosemirror-model').Node|null} Newly created table row node
|
|
69
|
+
*/
|
|
70
|
+
export function buildRowFromTemplateRow({ schema, tableNode, templateRow, values, copyRowStyle }: BuildRowFromTemplateRowParams): import("prosemirror-model").Node | null;
|
|
71
|
+
/**
|
|
72
|
+
* Append one or more rows to the end of a table in a single transaction.
|
|
73
|
+
* @private
|
|
74
|
+
* @param {InsertRowsAtTableEndParams} params - Insert parameters
|
|
75
|
+
*/
|
|
76
|
+
export function insertRowsAtTableEnd({ tr, tablePos, tableNode, rows }: InsertRowsAtTableEndParams): void;
|
|
77
|
+
/**
|
|
78
|
+
* Row template formatting
|
|
79
|
+
*/
|
|
80
|
+
export type RowTemplateFormatting = {
|
|
81
|
+
/**
|
|
82
|
+
* - Node type used when building cell content
|
|
83
|
+
*/
|
|
84
|
+
blockType: import("prosemirror-model").NodeType;
|
|
85
|
+
/**
|
|
86
|
+
* - Attributes to apply to the created block node
|
|
87
|
+
*/
|
|
88
|
+
blockAttrs: any | null;
|
|
89
|
+
/**
|
|
90
|
+
* - Marks copied from the template text node
|
|
91
|
+
*/
|
|
92
|
+
textMarks: Array<import("prosemirror-model").Mark>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Build row from template row parameters
|
|
96
|
+
*/
|
|
97
|
+
export type BuildRowFromTemplateRowParams = {
|
|
98
|
+
/**
|
|
99
|
+
* - Editor schema
|
|
100
|
+
*/
|
|
101
|
+
schema: import("prosemirror-model").Schema;
|
|
102
|
+
/**
|
|
103
|
+
* - Table node used for column map lookup
|
|
104
|
+
*/
|
|
105
|
+
tableNode: import("prosemirror-model").Node;
|
|
106
|
+
/**
|
|
107
|
+
* - Row providing structure and formatting
|
|
108
|
+
*/
|
|
109
|
+
templateRow: import("prosemirror-model").Node;
|
|
110
|
+
/**
|
|
111
|
+
* - Values to populate each table cell
|
|
112
|
+
*/
|
|
113
|
+
values: any[];
|
|
114
|
+
/**
|
|
115
|
+
* - Clone template marks and block attrs when true
|
|
116
|
+
*/
|
|
117
|
+
copyRowStyle?: boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Insert rows at table end parameters
|
|
121
|
+
*/
|
|
122
|
+
export type InsertRowsAtTableEndParams = {
|
|
123
|
+
/**
|
|
124
|
+
* - Transaction to mutate
|
|
125
|
+
*/
|
|
126
|
+
tr: import("prosemirror-state").Transaction;
|
|
127
|
+
/**
|
|
128
|
+
* - Absolute position of the target table
|
|
129
|
+
*/
|
|
130
|
+
tablePos: number;
|
|
131
|
+
/**
|
|
132
|
+
* - Table node receiving new rows
|
|
133
|
+
*/
|
|
134
|
+
tableNode: import("prosemirror-model").Node;
|
|
135
|
+
/**
|
|
136
|
+
* - Row nodes to append
|
|
137
|
+
*/
|
|
138
|
+
rows: import("prosemirror-model").Node[];
|
|
139
|
+
};
|
|
@@ -11,10 +11,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
11
11
|
var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
|
|
12
12
|
import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-DOkexB95.js";
|
|
13
13
|
import { c1, a5, i, a2 } from "./chunks/converter-DOkexB95.js";
|
|
14
|
-
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-
|
|
15
|
-
import { t, C, v, T, p, w, q } from "./chunks/editor-
|
|
14
|
+
import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-CEZNgaJQ.js";
|
|
15
|
+
import { t, C, v, T, p, w, q } from "./chunks/editor-CEZNgaJQ.js";
|
|
16
16
|
import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
|
|
17
|
-
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-
|
|
17
|
+
import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-C6e42Zol.js";
|
|
18
18
|
import AIWriter from "./ai-writer.es.js";
|
|
19
19
|
import { D } from "./chunks/docx-zipper-Ci5JbfjE.js";
|
|
20
20
|
import { createZip } from "./file-zipper.es.js";
|
package/dist/super-editor.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-B2cypcnX.cjs");
|
|
4
4
|
require("./chunks/vue-DKMj1I9B.cjs");
|
|
5
5
|
exports.AIWriter = superEditor_es.AIWriter;
|
|
6
6
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
package/dist/super-editor.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-
|
|
1
|
+
import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-CHq5MqBc.es.js";
|
|
2
2
|
import "./chunks/vue-ZWZLQtoU.es.js";
|
|
3
3
|
export {
|
|
4
4
|
A as AIWriter,
|
package/dist/superdoc.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const superEditor_es = require("./chunks/super-editor.es-
|
|
4
|
-
const superdoc = require("./chunks/index-
|
|
3
|
+
const superEditor_es = require("./chunks/super-editor.es-B2cypcnX.cjs");
|
|
4
|
+
const superdoc = require("./chunks/index-aoNHRlnl.cjs");
|
|
5
5
|
require("./chunks/vue-DKMj1I9B.cjs");
|
|
6
6
|
const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
|
|
7
7
|
exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
|
package/dist/superdoc.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-
|
|
2
|
-
import { D, H, P, S as S2, m, l } from "./chunks/index-
|
|
1
|
+
import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-CHq5MqBc.es.js";
|
|
2
|
+
import { D, H, P, S as S2, m, l } from "./chunks/index-DOLVGSYC.es.js";
|
|
3
3
|
import "./chunks/vue-ZWZLQtoU.es.js";
|
|
4
4
|
import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
|
|
5
5
|
export {
|