@harbour-enterprises/superdoc 1.15.0-next.20 → 1.15.0-next.22
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/{SuperConverter-DB6IcvO0.es.js → SuperConverter-BeUtWDJH.es.js} +55 -3
- package/dist/chunks/{SuperConverter-C7dh9em9.cjs → SuperConverter-DALx-_2i.cjs} +60 -2
- package/dist/chunks/{src-DDry6tZe.cjs → src-BCA2J2jX.cjs} +98 -84
- package/dist/chunks/{src-DJA6eZbt.es.js → src-DHJvvz3b.es.js} +96 -82
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/src/core/helpers/importHtml.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/textbox-content-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/paragraph/numberingPlugin.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/table/table.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/table/tableHelpers/appendRows.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/table-cell/helpers/renderCellBorderStyle.d.ts +4 -0
- package/dist/super-editor/src/extensions/table-cell/helpers/renderCellBorderStyle.d.ts.map +1 -0
- package/dist/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/table-header/table-header.d.ts +1 -0
- package/dist/super-editor/src/extensions/table-header/table-header.d.ts.map +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +150 -84
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -16428,6 +16428,10 @@ function extractRunFormatting(rPr, paragraphProperties, params) {
|
|
|
16428
16428
|
if (fontSizePx) formatting.fontSize = fontSizePx;
|
|
16429
16429
|
const fontFamily = resolveFontFamilyForTextBox(resolvedRunProperties.fontFamily, params.docx);
|
|
16430
16430
|
if (fontFamily) formatting.fontFamily = fontFamily;
|
|
16431
|
+
if (resolvedRunProperties.letterSpacing != null) {
|
|
16432
|
+
const letterSpacingPx = Number(twipsToPixels(resolvedRunProperties.letterSpacing));
|
|
16433
|
+
if (Number.isFinite(letterSpacingPx) && letterSpacingPx !== 0) formatting.letterSpacing = letterSpacingPx;
|
|
16434
|
+
}
|
|
16431
16435
|
return formatting;
|
|
16432
16436
|
}
|
|
16433
16437
|
function extractParagraphAlignment(paragraph) {
|
|
@@ -16659,7 +16663,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16659
16663
|
const val = srcRectAttrs[attr];
|
|
16660
16664
|
return val != null && parseFloat(val) < 0;
|
|
16661
16665
|
});
|
|
16662
|
-
const
|
|
16666
|
+
const shouldStretch = Boolean(stretch && fillRect);
|
|
16667
|
+
const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
|
|
16668
|
+
const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
|
|
16663
16669
|
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
16664
16670
|
if (spPr) {
|
|
16665
16671
|
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -16726,6 +16732,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16726
16732
|
...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
|
|
16727
16733
|
wrapTopAndBottom: wrap$1.type === "TopAndBottom",
|
|
16728
16734
|
shouldCover,
|
|
16735
|
+
...shouldFillClippedStretch ? { objectFit: "fill" } : {},
|
|
16729
16736
|
...clipPath ? { clipPath } : {},
|
|
16730
16737
|
rawSrcRect: srcRect,
|
|
16731
16738
|
originalPadding: {
|
|
@@ -17801,10 +17808,12 @@ var listIndexMap = {
|
|
|
17801
17808
|
japaneseCounting: handleJapaneseCounting
|
|
17802
17809
|
};
|
|
17803
17810
|
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
17811
|
+
if (typeof lvlText !== "string") return null;
|
|
17804
17812
|
const handler$1 = listIndexMap[listNumberingType];
|
|
17805
17813
|
return handler$1 ? handler$1(listLevel, lvlText, customFormat) : null;
|
|
17806
17814
|
};
|
|
17807
17815
|
var createNumbering = (values, lvlText) => {
|
|
17816
|
+
if (typeof lvlText !== "string") return "";
|
|
17808
17817
|
return values.reduce((acc, value, index) => {
|
|
17809
17818
|
return Number(value) > 9 ? acc.replace(/^0/, "").replace(`%${index + 1}`, value) : acc.replace(`%${index + 1}`, value);
|
|
17810
17819
|
}, lvlText);
|
|
@@ -17827,6 +17836,7 @@ var decimalZeroFormatter = (value, idx) => {
|
|
|
17827
17836
|
return `0${value}`;
|
|
17828
17837
|
};
|
|
17829
17838
|
var generateFromCustom = (path, lvlText, customFormat) => {
|
|
17839
|
+
if (typeof customFormat !== "string") return generateNumbering(path, lvlText, numberToStringFormatter);
|
|
17830
17840
|
if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path, lvlText, numberToStringFormatter);
|
|
17831
17841
|
const match = customFormat.match(/(\d+)/);
|
|
17832
17842
|
if (!match) throw new Error("Invalid format string: no numeric pattern found");
|
|
@@ -20659,6 +20669,47 @@ function handleClipboardPaste({ editor, view }, html) {
|
|
|
20659
20669
|
}
|
|
20660
20670
|
return false;
|
|
20661
20671
|
}
|
|
20672
|
+
const createCellBorders = (borderSpec = {}) => {
|
|
20673
|
+
borderSpec = {
|
|
20674
|
+
size: .66665,
|
|
20675
|
+
color: "#000000",
|
|
20676
|
+
...borderSpec
|
|
20677
|
+
};
|
|
20678
|
+
return {
|
|
20679
|
+
top: borderSpec,
|
|
20680
|
+
left: borderSpec,
|
|
20681
|
+
bottom: borderSpec,
|
|
20682
|
+
right: borderSpec
|
|
20683
|
+
};
|
|
20684
|
+
};
|
|
20685
|
+
var TABLE_HEADER_NODE_NAME = "tableHeader";
|
|
20686
|
+
var hasMeaningfulCellBorders = (borderValue) => {
|
|
20687
|
+
if (!borderValue || typeof borderValue !== "object") return false;
|
|
20688
|
+
return Object.values(borderValue).some((side) => side && typeof side === "object" && Object.keys(side).length > 0);
|
|
20689
|
+
};
|
|
20690
|
+
var normalizeImportedHtmlTableHeaders = (doc$1) => {
|
|
20691
|
+
const normalizeNode = (node) => {
|
|
20692
|
+
let nextNode = node;
|
|
20693
|
+
if (node.childCount > 0) {
|
|
20694
|
+
const nextChildren = [];
|
|
20695
|
+
let childrenChanged = false;
|
|
20696
|
+
node.forEach((child) => {
|
|
20697
|
+
const normalizedChild = normalizeNode(child);
|
|
20698
|
+
if (normalizedChild !== child) childrenChanged = true;
|
|
20699
|
+
nextChildren.push(normalizedChild);
|
|
20700
|
+
});
|
|
20701
|
+
if (childrenChanged) nextNode = node.copy(Fragment.fromArray(nextChildren));
|
|
20702
|
+
}
|
|
20703
|
+
if (nextNode.type.name !== TABLE_HEADER_NODE_NAME) return nextNode;
|
|
20704
|
+
if (hasMeaningfulCellBorders(nextNode.attrs?.borders)) return nextNode;
|
|
20705
|
+
const nextAttrs = {
|
|
20706
|
+
...nextNode.attrs,
|
|
20707
|
+
borders: createCellBorders()
|
|
20708
|
+
};
|
|
20709
|
+
return nextNode.type.create(nextAttrs, nextNode.content, nextNode.marks);
|
|
20710
|
+
};
|
|
20711
|
+
return normalizeNode(doc$1);
|
|
20712
|
+
};
|
|
20662
20713
|
function createDocFromHTML(content, editor, options = {}) {
|
|
20663
20714
|
const { isImport = false } = options;
|
|
20664
20715
|
let parsedContent;
|
|
@@ -20669,6 +20720,7 @@ function createDocFromHTML(content, editor, options = {}) {
|
|
|
20669
20720
|
parsedContent = tempDiv;
|
|
20670
20721
|
} else parsedContent = content;
|
|
20671
20722
|
let doc$1 = DOMParser$1.fromSchema(editor.schema).parse(parsedContent);
|
|
20723
|
+
if (isImport) doc$1 = normalizeImportedHtmlTableHeaders(doc$1);
|
|
20672
20724
|
doc$1 = wrapTextsInRuns(doc$1);
|
|
20673
20725
|
return doc$1;
|
|
20674
20726
|
}
|
|
@@ -33754,7 +33806,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33754
33806
|
static getStoredSuperdocVersion(docx) {
|
|
33755
33807
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33756
33808
|
}
|
|
33757
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.
|
|
33809
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.22") {
|
|
33758
33810
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33759
33811
|
}
|
|
33760
33812
|
static generateWordTimestamp() {
|
|
@@ -34314,4 +34366,4 @@ var SuperConverter = class SuperConverter {
|
|
|
34314
34366
|
function generateCustomXml() {
|
|
34315
34367
|
return DEFAULT_CUSTOM_XML;
|
|
34316
34368
|
}
|
|
34317
|
-
export {
|
|
34369
|
+
export { TextSelection as $, findMark as A, Mark as At, defaultBlockAt as B, docxNumberingHelpers as C, TrackDeleteMarkName as Ct, posToDOMRect as D, DOMParser$1 as Dt, isInTable as E, carbonCopy as Et, isMarkActive as F, getExtensionConfigField as Ft, createDocument as G, getNodeType as H, getMarkRange as I, NodeSelection as J, AllSelection as K, isTextSelection as L, isActive as M, Slice as Mt, isNodeActive as N, minMax as Nt, findChildren as O, DOMSerializer as Ot, getSchemaTypeNameByName as P, callOrGet as Pt, SelectionRange as Q, findParentNode as R, getResolvedParagraphProperties as S, getUnderlineCssString as St, CommandService as T, TrackInsertMarkName as Tt, cleanSchemaItem as U, getMarkType as V, getSchemaTypeByName as W, PluginKey as X, Plugin as Y, Selection as Z, ListHelpers as _, encodeMarksFromRPr as _t, _getReferencedTableStyles as a, Transform as at, isList as b, resolveRunProperties as bt, processContent as c, dropPoint as ct, createCellBorders as d, replaceStep as dt, AddMarkStep as et, InputRule as f, generateDocxRandomId as ft, unflattenListsInHtml as g, encodeCSSFromRPr as gt, inputRulesPlugin as h, encodeCSSFromPPr as ht, registeredHandlers as i, ReplaceStep as it, getMarksFromSelection as j, Schema as jt, getActiveFormatting as k, Fragment as kt, createDocFromMarkdown as l, joinPoint as lt, htmlHandler as m, decodeRPrFromMarks as mt, kebabCase as n, RemoveMarkStep as nt, helpers_exports as o, canJoin as ot, handleClipboardPaste as p, generateRandomSigned32BitIntStrId as pt, EditorState as q, insertNewRelationship as r, ReplaceAroundStep as rt, updateDOMAttributes as s, canSplit as st, SuperConverter as t, Mapping as tt, createDocFromHTML as u, liftTarget as ut, changeListLevel as v, resolveDocxFontFamily as vt, generateOrderedListIndex as w, TrackFormatMarkName as wt, calculateResolvedParagraphProperties as x, resolveTableCellProperties as xt, updateNumberingProperties as y, resolveParagraphProperties as yt, findParentNodeClosestToPos as z };
|
|
@@ -16440,6 +16440,10 @@ function extractRunFormatting(rPr, paragraphProperties, params) {
|
|
|
16440
16440
|
if (fontSizePx) formatting.fontSize = fontSizePx;
|
|
16441
16441
|
const fontFamily = resolveFontFamilyForTextBox(resolvedRunProperties.fontFamily, params.docx);
|
|
16442
16442
|
if (fontFamily) formatting.fontFamily = fontFamily;
|
|
16443
|
+
if (resolvedRunProperties.letterSpacing != null) {
|
|
16444
|
+
const letterSpacingPx = Number(require_helpers.twipsToPixels(resolvedRunProperties.letterSpacing));
|
|
16445
|
+
if (Number.isFinite(letterSpacingPx) && letterSpacingPx !== 0) formatting.letterSpacing = letterSpacingPx;
|
|
16446
|
+
}
|
|
16443
16447
|
return formatting;
|
|
16444
16448
|
}
|
|
16445
16449
|
function extractParagraphAlignment(paragraph) {
|
|
@@ -16671,7 +16675,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16671
16675
|
const val = srcRectAttrs[attr];
|
|
16672
16676
|
return val != null && parseFloat(val) < 0;
|
|
16673
16677
|
});
|
|
16674
|
-
const
|
|
16678
|
+
const shouldStretch = Boolean(stretch && fillRect);
|
|
16679
|
+
const shouldCover = shouldStretch && !srcRectHasNegativeValues && !clipPath;
|
|
16680
|
+
const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
|
|
16675
16681
|
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
16676
16682
|
if (spPr) {
|
|
16677
16683
|
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -16738,6 +16744,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16738
16744
|
...wrap$1.type === "Square" && wrap$1.attrs.wrapText ? { wrapText: wrap$1.attrs.wrapText } : {},
|
|
16739
16745
|
wrapTopAndBottom: wrap$1.type === "TopAndBottom",
|
|
16740
16746
|
shouldCover,
|
|
16747
|
+
...shouldFillClippedStretch ? { objectFit: "fill" } : {},
|
|
16741
16748
|
...clipPath ? { clipPath } : {},
|
|
16742
16749
|
rawSrcRect: srcRect,
|
|
16743
16750
|
originalPadding: {
|
|
@@ -17813,10 +17820,12 @@ var listIndexMap = {
|
|
|
17813
17820
|
japaneseCounting: handleJapaneseCounting
|
|
17814
17821
|
};
|
|
17815
17822
|
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
17823
|
+
if (typeof lvlText !== "string") return null;
|
|
17816
17824
|
const handler$1 = listIndexMap[listNumberingType];
|
|
17817
17825
|
return handler$1 ? handler$1(listLevel, lvlText, customFormat) : null;
|
|
17818
17826
|
};
|
|
17819
17827
|
var createNumbering = (values, lvlText) => {
|
|
17828
|
+
if (typeof lvlText !== "string") return "";
|
|
17820
17829
|
return values.reduce((acc, value, index) => {
|
|
17821
17830
|
return Number(value) > 9 ? acc.replace(/^0/, "").replace(`%${index + 1}`, value) : acc.replace(`%${index + 1}`, value);
|
|
17822
17831
|
}, lvlText);
|
|
@@ -17839,6 +17848,7 @@ var decimalZeroFormatter = (value, idx) => {
|
|
|
17839
17848
|
return `0${value}`;
|
|
17840
17849
|
};
|
|
17841
17850
|
var generateFromCustom = (path, lvlText, customFormat) => {
|
|
17851
|
+
if (typeof customFormat !== "string") return generateNumbering(path, lvlText, numberToStringFormatter);
|
|
17842
17852
|
if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path, lvlText, numberToStringFormatter);
|
|
17843
17853
|
const match = customFormat.match(/(\d+)/);
|
|
17844
17854
|
if (!match) throw new Error("Invalid format string: no numeric pattern found");
|
|
@@ -20672,6 +20682,47 @@ function handleClipboardPaste({ editor, view }, html) {
|
|
|
20672
20682
|
}
|
|
20673
20683
|
return false;
|
|
20674
20684
|
}
|
|
20685
|
+
const createCellBorders = (borderSpec = {}) => {
|
|
20686
|
+
borderSpec = {
|
|
20687
|
+
size: .66665,
|
|
20688
|
+
color: "#000000",
|
|
20689
|
+
...borderSpec
|
|
20690
|
+
};
|
|
20691
|
+
return {
|
|
20692
|
+
top: borderSpec,
|
|
20693
|
+
left: borderSpec,
|
|
20694
|
+
bottom: borderSpec,
|
|
20695
|
+
right: borderSpec
|
|
20696
|
+
};
|
|
20697
|
+
};
|
|
20698
|
+
var TABLE_HEADER_NODE_NAME = "tableHeader";
|
|
20699
|
+
var hasMeaningfulCellBorders = (borderValue) => {
|
|
20700
|
+
if (!borderValue || typeof borderValue !== "object") return false;
|
|
20701
|
+
return Object.values(borderValue).some((side) => side && typeof side === "object" && Object.keys(side).length > 0);
|
|
20702
|
+
};
|
|
20703
|
+
var normalizeImportedHtmlTableHeaders = (doc$1) => {
|
|
20704
|
+
const normalizeNode = (node) => {
|
|
20705
|
+
let nextNode = node;
|
|
20706
|
+
if (node.childCount > 0) {
|
|
20707
|
+
const nextChildren = [];
|
|
20708
|
+
let childrenChanged = false;
|
|
20709
|
+
node.forEach((child) => {
|
|
20710
|
+
const normalizedChild = normalizeNode(child);
|
|
20711
|
+
if (normalizedChild !== child) childrenChanged = true;
|
|
20712
|
+
nextChildren.push(normalizedChild);
|
|
20713
|
+
});
|
|
20714
|
+
if (childrenChanged) nextNode = node.copy(Fragment.fromArray(nextChildren));
|
|
20715
|
+
}
|
|
20716
|
+
if (nextNode.type.name !== TABLE_HEADER_NODE_NAME) return nextNode;
|
|
20717
|
+
if (hasMeaningfulCellBorders(nextNode.attrs?.borders)) return nextNode;
|
|
20718
|
+
const nextAttrs = {
|
|
20719
|
+
...nextNode.attrs,
|
|
20720
|
+
borders: createCellBorders()
|
|
20721
|
+
};
|
|
20722
|
+
return nextNode.type.create(nextAttrs, nextNode.content, nextNode.marks);
|
|
20723
|
+
};
|
|
20724
|
+
return normalizeNode(doc$1);
|
|
20725
|
+
};
|
|
20675
20726
|
function createDocFromHTML(content, editor, options = {}) {
|
|
20676
20727
|
const { isImport = false } = options;
|
|
20677
20728
|
let parsedContent;
|
|
@@ -20682,6 +20733,7 @@ function createDocFromHTML(content, editor, options = {}) {
|
|
|
20682
20733
|
parsedContent = tempDiv;
|
|
20683
20734
|
} else parsedContent = content;
|
|
20684
20735
|
let doc$1 = DOMParser$1.fromSchema(editor.schema).parse(parsedContent);
|
|
20736
|
+
if (isImport) doc$1 = normalizeImportedHtmlTableHeaders(doc$1);
|
|
20685
20737
|
doc$1 = wrapTextsInRuns(doc$1);
|
|
20686
20738
|
return doc$1;
|
|
20687
20739
|
}
|
|
@@ -33772,7 +33824,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33772
33824
|
static getStoredSuperdocVersion(docx) {
|
|
33773
33825
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33774
33826
|
}
|
|
33775
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.
|
|
33827
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.15.0-next.22") {
|
|
33776
33828
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33777
33829
|
}
|
|
33778
33830
|
static generateWordTimestamp() {
|
|
@@ -34542,6 +34594,12 @@ Object.defineProperty(exports, "cleanSchemaItem", {
|
|
|
34542
34594
|
return cleanSchemaItem;
|
|
34543
34595
|
}
|
|
34544
34596
|
});
|
|
34597
|
+
Object.defineProperty(exports, "createCellBorders", {
|
|
34598
|
+
enumerable: true,
|
|
34599
|
+
get: function() {
|
|
34600
|
+
return createCellBorders;
|
|
34601
|
+
}
|
|
34602
|
+
});
|
|
34545
34603
|
Object.defineProperty(exports, "createDocFromHTML", {
|
|
34546
34604
|
enumerable: true,
|
|
34547
34605
|
get: function() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Dp2H1eGw.cjs");
|
|
2
|
-
const require_SuperConverter = require("./SuperConverter-
|
|
2
|
+
const require_SuperConverter = require("./SuperConverter-DALx-_2i.cjs");
|
|
3
3
|
const require_jszip = require("./jszip-DCT9QYaK.cjs");
|
|
4
4
|
const require_uuid = require("./uuid-CHj_rjgt.cjs");
|
|
5
5
|
const require_helpers = require("./helpers-Cs_Zz44i.cjs");
|
|
@@ -243,7 +243,7 @@ var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
|
|
|
243
243
|
const COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
|
|
244
244
|
function getSuperdocVersion() {
|
|
245
245
|
try {
|
|
246
|
-
return "1.15.0-next.
|
|
246
|
+
return "1.15.0-next.22";
|
|
247
247
|
} catch {
|
|
248
248
|
return "unknown";
|
|
249
249
|
}
|
|
@@ -20689,7 +20689,7 @@ const canUseDOM = () => {
|
|
|
20689
20689
|
return false;
|
|
20690
20690
|
}
|
|
20691
20691
|
};
|
|
20692
|
-
var summaryVersion = "1.15.0-next.
|
|
20692
|
+
var summaryVersion = "1.15.0-next.22";
|
|
20693
20693
|
var nodeKeys = [
|
|
20694
20694
|
"group",
|
|
20695
20695
|
"content",
|
|
@@ -27305,7 +27305,7 @@ var Editor = class Editor extends EventEmitter$1 {
|
|
|
27305
27305
|
return migrations.length > 0;
|
|
27306
27306
|
}
|
|
27307
27307
|
processCollaborationMigrations() {
|
|
27308
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.
|
|
27308
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.15.0-next.22");
|
|
27309
27309
|
if (!this.options.ydoc) return;
|
|
27310
27310
|
let docVersion = this.options.ydoc.getMap("meta").get("version");
|
|
27311
27311
|
if (!docVersion) docVersion = "initial";
|
|
@@ -37788,6 +37788,7 @@ var DomPainter = class DomPainter {
|
|
|
37788
37788
|
if (validatedColor) span.style.color = validatedColor;
|
|
37789
37789
|
}
|
|
37790
37790
|
if (part.formatting.fontSize) span.style.fontSize = `${part.formatting.fontSize}px`;
|
|
37791
|
+
if (part.formatting.letterSpacing != null) span.style.letterSpacing = `${part.formatting.letterSpacing}px`;
|
|
37791
37792
|
}
|
|
37792
37793
|
currentParagraph.appendChild(span);
|
|
37793
37794
|
}
|
|
@@ -48539,8 +48540,7 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
48539
48540
|
floatManager.registerDrawing(entry.block, entry.measure, anchorY, state.columnIndex, state.page.number);
|
|
48540
48541
|
preRegisteredPositions.set(entry.block.id, {
|
|
48541
48542
|
anchorX,
|
|
48542
|
-
anchorY
|
|
48543
|
-
pageNumber: state.page.number
|
|
48543
|
+
anchorY
|
|
48544
48544
|
});
|
|
48545
48545
|
}
|
|
48546
48546
|
const keepNextChains = computeKeepNextChains(blocks);
|
|
@@ -48808,8 +48808,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
48808
48808
|
if (block.kind === "image") {
|
|
48809
48809
|
if (measure.kind !== "image") throw new Error(`layoutDocument: expected image measure for block ${block.id}`);
|
|
48810
48810
|
const preRegPos = preRegisteredPositions.get(block.id);
|
|
48811
|
-
if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)
|
|
48812
|
-
const state = paginator.
|
|
48811
|
+
if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
|
|
48812
|
+
const state = paginator.ensurePage();
|
|
48813
48813
|
const imgBlock = block;
|
|
48814
48814
|
const imgMeasure = measure;
|
|
48815
48815
|
const pageContentHeight = Math.max(0, state.contentBottom - state.topMargin);
|
|
@@ -48863,8 +48863,8 @@ function layoutDocument(blocks, measures, options = {}) {
|
|
|
48863
48863
|
if (block.kind === "drawing") {
|
|
48864
48864
|
if (measure.kind !== "drawing") throw new Error(`layoutDocument: expected drawing measure for block ${block.id}`);
|
|
48865
48865
|
const preRegPos = preRegisteredPositions.get(block.id);
|
|
48866
|
-
if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)
|
|
48867
|
-
const state = paginator.
|
|
48866
|
+
if (preRegPos && Number.isFinite(preRegPos.anchorX) && Number.isFinite(preRegPos.anchorY)) {
|
|
48867
|
+
const state = paginator.ensurePage();
|
|
48868
48868
|
const drawBlock = block;
|
|
48869
48869
|
const drawMeasure = measure;
|
|
48870
48870
|
const fragment = {
|
|
@@ -65744,47 +65744,50 @@ function createNumberingPlugin(editor) {
|
|
|
65744
65744
|
if (nextRev != null) tr.setNodeAttribute(pos, "sdBlockRev", nextRev);
|
|
65745
65745
|
};
|
|
65746
65746
|
numberingManager.enableCache();
|
|
65747
|
-
|
|
65748
|
-
|
|
65749
|
-
|
|
65750
|
-
|
|
65751
|
-
|
|
65752
|
-
|
|
65753
|
-
|
|
65754
|
-
|
|
65755
|
-
|
|
65756
|
-
|
|
65757
|
-
|
|
65758
|
-
|
|
65759
|
-
|
|
65760
|
-
|
|
65761
|
-
|
|
65762
|
-
|
|
65763
|
-
|
|
65764
|
-
|
|
65765
|
-
|
|
65766
|
-
|
|
65767
|
-
|
|
65768
|
-
|
|
65769
|
-
|
|
65770
|
-
|
|
65771
|
-
|
|
65747
|
+
try {
|
|
65748
|
+
newState.doc.descendants((node, pos) => {
|
|
65749
|
+
let resolvedProps = require_SuperConverter.calculateResolvedParagraphProperties(editor, node, newState.doc.resolve(pos));
|
|
65750
|
+
if (node.type.name !== "paragraph" || !resolvedProps.numberingProperties) return;
|
|
65751
|
+
const { numId, ilvl: level = 0 } = resolvedProps.numberingProperties;
|
|
65752
|
+
const definitionDetails = require_SuperConverter.ListHelpers.getListDefinitionDetails({
|
|
65753
|
+
numId,
|
|
65754
|
+
level,
|
|
65755
|
+
editor
|
|
65756
|
+
});
|
|
65757
|
+
if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
|
|
65758
|
+
tr.setNodeAttribute(pos, "listRendering", null);
|
|
65759
|
+
bumpBlockRev(node, pos);
|
|
65760
|
+
return;
|
|
65761
|
+
}
|
|
65762
|
+
let { lvlText, customFormat, listNumberingType, suffix: suffix$1, justification, abstractId } = definitionDetails;
|
|
65763
|
+
let markerText = "";
|
|
65764
|
+
listNumberingType = listNumberingType || "decimal";
|
|
65765
|
+
const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
|
|
65766
|
+
numberingManager.setCounter(numId, level, pos, count, abstractId);
|
|
65767
|
+
const path = numberingManager.calculatePath(numId, level, pos);
|
|
65768
|
+
if (listNumberingType !== "bullet") markerText = require_SuperConverter.generateOrderedListIndex({
|
|
65769
|
+
listLevel: path,
|
|
65770
|
+
lvlText,
|
|
65771
|
+
listNumberingType,
|
|
65772
|
+
customFormat
|
|
65773
|
+
}) ?? "";
|
|
65774
|
+
else markerText = require_SuperConverter.docxNumberingHelpers.normalizeLvlTextChar(lvlText) ?? "";
|
|
65775
|
+
const newListRendering = {
|
|
65776
|
+
markerText,
|
|
65777
|
+
suffix: suffix$1,
|
|
65778
|
+
justification,
|
|
65779
|
+
path,
|
|
65780
|
+
numberingType: listNumberingType
|
|
65781
|
+
};
|
|
65782
|
+
if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
|
|
65783
|
+
tr.setNodeAttribute(pos, "listRendering", newListRendering);
|
|
65784
|
+
bumpBlockRev(node, pos);
|
|
65785
|
+
}
|
|
65786
|
+
return false;
|
|
65772
65787
|
});
|
|
65773
|
-
|
|
65774
|
-
|
|
65775
|
-
|
|
65776
|
-
suffix: suffix$1,
|
|
65777
|
-
justification,
|
|
65778
|
-
path,
|
|
65779
|
-
numberingType: listNumberingType
|
|
65780
|
-
};
|
|
65781
|
-
if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify(newListRendering)) {
|
|
65782
|
-
tr.setNodeAttribute(pos, "listRendering", newListRendering);
|
|
65783
|
-
bumpBlockRev(node, pos);
|
|
65784
|
-
}
|
|
65785
|
-
return false;
|
|
65786
|
-
});
|
|
65787
|
-
numberingManager.disableCache();
|
|
65788
|
+
} finally {
|
|
65789
|
+
numberingManager.disableCache();
|
|
65790
|
+
}
|
|
65788
65791
|
return tr.docChanged ? tr : null;
|
|
65789
65792
|
}
|
|
65790
65793
|
});
|
|
@@ -67059,19 +67062,6 @@ const deleteTableWhenSelected = ({ editor }) => {
|
|
|
67059
67062
|
editor.commands.deleteTable();
|
|
67060
67063
|
return true;
|
|
67061
67064
|
};
|
|
67062
|
-
const createCellBorders = (borderSpec = {}) => {
|
|
67063
|
-
borderSpec = {
|
|
67064
|
-
size: .66665,
|
|
67065
|
-
color: "#000000",
|
|
67066
|
-
...borderSpec
|
|
67067
|
-
};
|
|
67068
|
-
return {
|
|
67069
|
-
top: borderSpec,
|
|
67070
|
-
left: borderSpec,
|
|
67071
|
-
bottom: borderSpec,
|
|
67072
|
-
right: borderSpec
|
|
67073
|
-
};
|
|
67074
|
-
};
|
|
67075
67065
|
function cellAround($pos) {
|
|
67076
67066
|
for (let d = $pos.depth - 1; d > 0; d--) if ($pos.node(d).type.spec.tableRole == "row") return $pos.node(0).resolve($pos.before(d + 1));
|
|
67077
67067
|
return null;
|
|
@@ -67086,6 +67076,12 @@ function cellWrapping($pos) {
|
|
|
67086
67076
|
var ZERO_WIDTH_SPACE = "";
|
|
67087
67077
|
var ROW_START_TO_TEXT_OFFSET = 3;
|
|
67088
67078
|
var CELL_TO_TEXT_OFFSET = 2;
|
|
67079
|
+
var normalizeHeaderAttrsForBodyCell = (attrs) => {
|
|
67080
|
+
if (attrs?.borders !== null) return attrs;
|
|
67081
|
+
const nextAttrs = { ...attrs };
|
|
67082
|
+
delete nextAttrs.borders;
|
|
67083
|
+
return nextAttrs;
|
|
67084
|
+
};
|
|
67089
67085
|
function resolveTable(tr, tablePos, tableNode) {
|
|
67090
67086
|
if (tableNode && tableNode.type && tableNode.type.name === "table") return tableNode;
|
|
67091
67087
|
if (typeof tablePos === "number") {
|
|
@@ -67154,8 +67150,9 @@ function buildRowFromTemplateRow({ schema, tableNode, templateRow, values, copyR
|
|
|
67154
67150
|
const newCells = [];
|
|
67155
67151
|
let columnCursor = 0;
|
|
67156
67152
|
templateRow.content.content.forEach((cellNode, cellIndex) => {
|
|
67157
|
-
const
|
|
67158
|
-
const
|
|
67153
|
+
const isHeaderCell = cellNode.type === HeaderType;
|
|
67154
|
+
const targetCellType = isHeaderCell ? CellType : cellNode.type;
|
|
67155
|
+
const attrs = isHeaderCell ? normalizeHeaderAttrsForBodyCell({ ...cellNode.attrs }) : { ...cellNode.attrs };
|
|
67159
67156
|
const formatting = extractRowTemplateFormatting(cellNode, schema);
|
|
67160
67157
|
let cellValue = "";
|
|
67161
67158
|
if (byColumns) {
|
|
@@ -67237,7 +67234,9 @@ function insertRowAtIndex({ tr, tablePos, tableNode, sourceRowIndex, insertIndex
|
|
|
67237
67234
|
rowspan: 1
|
|
67238
67235
|
};
|
|
67239
67236
|
const content = buildFormattedCellBlock(schema, "", formatting, true);
|
|
67240
|
-
const
|
|
67237
|
+
const targetCellType = sourceCell.type.name === "tableHeader" ? CellType : sourceCell.type;
|
|
67238
|
+
const normalizedCellAttrs = sourceCell.type.name === "tableHeader" ? normalizeHeaderAttrsForBodyCell(cellAttrs) : cellAttrs;
|
|
67239
|
+
const newCell = targetCellType.createAndFill(normalizedCellAttrs, content);
|
|
67241
67240
|
if (newCell) newCells.push(newCell);
|
|
67242
67241
|
col += colspan;
|
|
67243
67242
|
}
|
|
@@ -67260,6 +67259,9 @@ function insertRowAtIndex({ tr, tablePos, tableNode, sourceRowIndex, insertIndex
|
|
|
67260
67259
|
}
|
|
67261
67260
|
return true;
|
|
67262
67261
|
}
|
|
67262
|
+
var IMPORT_CONTEXT_SELECTOR = "[data-superdoc-import=\"true\"]";
|
|
67263
|
+
var IMPORT_DEFAULT_TABLE_WIDTH_PCT = 5e3;
|
|
67264
|
+
var isImportedTableElement = (element) => Boolean(element?.closest?.(IMPORT_CONTEXT_SELECTOR));
|
|
67263
67265
|
const Table = Node$1.create({
|
|
67264
67266
|
name: "table",
|
|
67265
67267
|
content: "tableRow+",
|
|
@@ -67320,6 +67322,13 @@ const Table = Node$1.create({
|
|
|
67320
67322
|
value: null,
|
|
67321
67323
|
type: "auto"
|
|
67322
67324
|
} },
|
|
67325
|
+
parseDOM: (element) => {
|
|
67326
|
+
if (!isImportedTableElement(element)) return void 0;
|
|
67327
|
+
return { tableWidth: {
|
|
67328
|
+
value: IMPORT_DEFAULT_TABLE_WIDTH_PCT,
|
|
67329
|
+
type: "pct"
|
|
67330
|
+
} };
|
|
67331
|
+
},
|
|
67323
67332
|
rendered: false
|
|
67324
67333
|
},
|
|
67325
67334
|
grid: {
|
|
@@ -67610,7 +67619,7 @@ const Table = Node$1.create({
|
|
|
67610
67619
|
state.doc.nodesBetween(from$1, to, (node, pos) => {
|
|
67611
67620
|
if (["tableCell", "tableHeader"].includes(node.type.name)) tr.setNodeMarkup(pos, void 0, {
|
|
67612
67621
|
...node.attrs,
|
|
67613
|
-
borders: createCellBorders({
|
|
67622
|
+
borders: require_SuperConverter.createCellBorders({
|
|
67614
67623
|
size: 0,
|
|
67615
67624
|
space: 0,
|
|
67616
67625
|
val: "none",
|
|
@@ -67684,6 +67693,22 @@ function getCurrentCellAttrs(state) {
|
|
|
67684
67693
|
attrs: copyCellAttrs(cell)
|
|
67685
67694
|
};
|
|
67686
67695
|
}
|
|
67696
|
+
const renderCellBorderStyle = (borders) => {
|
|
67697
|
+
if (!borders) return {};
|
|
67698
|
+
return { style: [
|
|
67699
|
+
"top",
|
|
67700
|
+
"right",
|
|
67701
|
+
"bottom",
|
|
67702
|
+
"left"
|
|
67703
|
+
].map((side) => {
|
|
67704
|
+
const border = borders?.[side];
|
|
67705
|
+
if (border && border.val === "none") return `border-${side}: ${border.val};`;
|
|
67706
|
+
let color = border?.color || "black";
|
|
67707
|
+
if (color === "auto") color = "black";
|
|
67708
|
+
if (border) return `border-${side}: ${Math.ceil(border.size)}px solid ${color};`;
|
|
67709
|
+
return "";
|
|
67710
|
+
}).join(" ") };
|
|
67711
|
+
};
|
|
67687
67712
|
const TableHeader = Node$1.create({
|
|
67688
67713
|
name: "tableHeader",
|
|
67689
67714
|
content: "block+",
|
|
@@ -67707,6 +67732,10 @@ const TableHeader = Node$1.create({
|
|
|
67707
67732
|
return { "data-colwidth": attrs.colwidth.join(",") };
|
|
67708
67733
|
}
|
|
67709
67734
|
},
|
|
67735
|
+
borders: {
|
|
67736
|
+
default: () => require_SuperConverter.createCellBorders(),
|
|
67737
|
+
renderDOM: ({ borders }) => renderCellBorderStyle(borders)
|
|
67738
|
+
},
|
|
67710
67739
|
__placeholder: {
|
|
67711
67740
|
default: null,
|
|
67712
67741
|
parseDOM: (element) => {
|
|
@@ -67821,23 +67850,8 @@ const TableCell = Node$1.create({
|
|
|
67821
67850
|
}).join(" ") };
|
|
67822
67851
|
} },
|
|
67823
67852
|
borders: {
|
|
67824
|
-
default: () => createCellBorders(),
|
|
67825
|
-
renderDOM({ borders })
|
|
67826
|
-
if (!borders) return {};
|
|
67827
|
-
return { style: [
|
|
67828
|
-
"top",
|
|
67829
|
-
"right",
|
|
67830
|
-
"bottom",
|
|
67831
|
-
"left"
|
|
67832
|
-
].map((side) => {
|
|
67833
|
-
const border = borders?.[side];
|
|
67834
|
-
if (border && border.val === "none") return `border-${side}: ${border.val};`;
|
|
67835
|
-
let color = border?.color || "black";
|
|
67836
|
-
if (color === "auto") color = "black";
|
|
67837
|
-
if (border) return `border-${side}: ${Math.ceil(border.size)}px solid ${color};`;
|
|
67838
|
-
return "";
|
|
67839
|
-
}).join(" ") };
|
|
67840
|
-
}
|
|
67853
|
+
default: () => require_SuperConverter.createCellBorders(),
|
|
67854
|
+
renderDOM: ({ borders }) => renderCellBorderStyle(borders)
|
|
67841
67855
|
},
|
|
67842
67856
|
widthType: {
|
|
67843
67857
|
default: "auto",
|