superdoc 0.31.0-next.4 → 0.31.0-next.5
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-mTeXBeGP.es.js → PdfViewer-BjFaPQBd.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CMqo3BcJ.cjs → PdfViewer-DXwcotXc.cjs} +1 -1
- package/dist/chunks/{index-INrjzFwK.es.js → index-B6TttOzK.es.js} +3 -3
- package/dist/chunks/{index-BmNdb0G--hU1qknba.es.js → index-B7dC-H-Q-BeQx_MXI.es.js} +1 -1
- package/dist/chunks/{index-BmNdb0G--CqIBE8k-.cjs → index-B7dC-H-Q-DfBEU7rR.cjs} +1 -1
- package/dist/chunks/{index-BtYu5_4F.cjs → index-BF_Yvius.cjs} +3 -3
- package/dist/chunks/{super-editor.es-_Mo5sfTs.cjs → super-editor.es-CVDIAxlg.cjs} +196 -237
- package/dist/chunks/{super-editor.es-DUqAKtdo.es.js → super-editor.es-M2e4wbRW.es.js} +196 -237
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BsxkbtGe.js → converter-BIsS-JzD.js} +194 -235
- package/dist/super-editor/chunks/{docx-zipper-DzOHQzzj.js → docx-zipper-DVDiaIyD.js} +1 -1
- package/dist/super-editor/chunks/{editor-o3FNUBVU.js → editor-ZbcM1RTL.js} +4 -4
- package/dist/super-editor/chunks/{index-BmNdb0G-.js → index-B7dC-H-Q.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CbCPJP6P.js → toolbar-8qqw8IXG.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +0 -48
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts +8 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts +8 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts.map +1 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 -239
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -15406,19 +15406,6 @@ const hasSomeParentWithClass = (element, classname) => {
|
|
|
15406
15406
|
if (element.className?.split(" ")?.indexOf(classname) >= 0) return true;
|
|
15407
15407
|
return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
|
|
15408
15408
|
};
|
|
15409
|
-
function generateDocxRandomId(length = 8) {
|
|
15410
|
-
const max2 = 2147483647;
|
|
15411
|
-
const value = Math.floor(Math.random() * (max2 + 1));
|
|
15412
|
-
return value.toString(16).padStart(length, "0").slice(0, length);
|
|
15413
|
-
}
|
|
15414
|
-
function generateRandomSigned32BitIntStrId() {
|
|
15415
|
-
const val = Math.floor(Math.random() * 2147483647);
|
|
15416
|
-
return val.toString();
|
|
15417
|
-
}
|
|
15418
|
-
function generateRandom32BitHex() {
|
|
15419
|
-
const val = Math.floor(Math.random() * 2147483647);
|
|
15420
|
-
return val.toString(16).toUpperCase().padStart(8, "0");
|
|
15421
|
-
}
|
|
15422
15409
|
const DEFAULT_DOCX_DEFS = {
|
|
15423
15410
|
"xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
|
|
15424
15411
|
"xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
|
|
@@ -16624,15 +16611,6 @@ const COMMENTS_XML_DEFINITIONS = {
|
|
|
16624
16611
|
DOCUMENT_RELS_XML_DEF,
|
|
16625
16612
|
CONTENT_TYPES
|
|
16626
16613
|
};
|
|
16627
|
-
const carbonCopy = (obj) => {
|
|
16628
|
-
if (!obj) return void 0;
|
|
16629
|
-
try {
|
|
16630
|
-
return JSON.parse(JSON.stringify(obj));
|
|
16631
|
-
} catch (e) {
|
|
16632
|
-
console.error("Error in carbonCopy", obj, e);
|
|
16633
|
-
return void 0;
|
|
16634
|
-
}
|
|
16635
|
-
};
|
|
16636
16614
|
function translateChildNodes(params) {
|
|
16637
16615
|
const { content: nodes } = params.node;
|
|
16638
16616
|
if (!nodes) return [];
|
|
@@ -18249,6 +18227,15 @@ const config$n = {
|
|
|
18249
18227
|
attributes: validXmlAttributes$h
|
|
18250
18228
|
};
|
|
18251
18229
|
const translator$21 = NodeTranslator.from(config$n);
|
|
18230
|
+
const carbonCopy = (obj) => {
|
|
18231
|
+
if (!obj) return void 0;
|
|
18232
|
+
try {
|
|
18233
|
+
return JSON.parse(JSON.stringify(obj));
|
|
18234
|
+
} catch (e) {
|
|
18235
|
+
console.error("Error in carbonCopy", obj, e);
|
|
18236
|
+
return void 0;
|
|
18237
|
+
}
|
|
18238
|
+
};
|
|
18252
18239
|
const mergeTextNodes = (nodes) => {
|
|
18253
18240
|
if (!nodes || !Array.isArray(nodes)) {
|
|
18254
18241
|
return nodes;
|
|
@@ -20082,6 +20069,56 @@ const handleParagraphNode$1 = (params) => {
|
|
|
20082
20069
|
}
|
|
20083
20070
|
return schemaNode;
|
|
20084
20071
|
};
|
|
20072
|
+
function generateParagraphProperties(params) {
|
|
20073
|
+
const { node } = params;
|
|
20074
|
+
const { attrs = {} } = node;
|
|
20075
|
+
const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
|
|
20076
|
+
if (attrs.styleId !== paragraphProperties.styleId) {
|
|
20077
|
+
paragraphProperties.styleId = attrs.styleId;
|
|
20078
|
+
}
|
|
20079
|
+
["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key) => {
|
|
20080
|
+
let propKey = key === "textAlign" ? "justification" : key;
|
|
20081
|
+
if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key])) {
|
|
20082
|
+
paragraphProperties[propKey] = attrs[key];
|
|
20083
|
+
}
|
|
20084
|
+
});
|
|
20085
|
+
const framePr = attrs.dropcap;
|
|
20086
|
+
if (framePr) {
|
|
20087
|
+
framePr.dropCap = framePr.type;
|
|
20088
|
+
delete framePr.type;
|
|
20089
|
+
}
|
|
20090
|
+
if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
|
|
20091
|
+
paragraphProperties.framePr = framePr;
|
|
20092
|
+
}
|
|
20093
|
+
const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
|
|
20094
|
+
const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
|
|
20095
|
+
paragraphProperties.runProperties = finalRunProps;
|
|
20096
|
+
const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
|
|
20097
|
+
const sectPr = node.attrs?.paragraphProperties?.sectPr;
|
|
20098
|
+
if (sectPr) {
|
|
20099
|
+
pPr.elements.push(sectPr);
|
|
20100
|
+
}
|
|
20101
|
+
return pPr;
|
|
20102
|
+
}
|
|
20103
|
+
function translateParagraphNode(params) {
|
|
20104
|
+
const elements = translateChildNodes(params);
|
|
20105
|
+
const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
|
|
20106
|
+
if (htmlAnnotationChild) {
|
|
20107
|
+
return htmlAnnotationChild.elements;
|
|
20108
|
+
}
|
|
20109
|
+
const pPr = generateParagraphProperties(params);
|
|
20110
|
+
if (pPr) elements.unshift(pPr);
|
|
20111
|
+
let attributes = {};
|
|
20112
|
+
if (params.node.attrs?.rsidRDefault) {
|
|
20113
|
+
attributes["w:rsidRDefault"] = params.node.attrs.rsidRDefault;
|
|
20114
|
+
}
|
|
20115
|
+
const result = {
|
|
20116
|
+
name: "w:p",
|
|
20117
|
+
elements,
|
|
20118
|
+
attributes
|
|
20119
|
+
};
|
|
20120
|
+
return result;
|
|
20121
|
+
}
|
|
20085
20122
|
const encode$A = (attributes) => {
|
|
20086
20123
|
return attributes["w:rsidDel"];
|
|
20087
20124
|
};
|
|
@@ -20361,6 +20398,19 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
|
|
|
20361
20398
|
}
|
|
20362
20399
|
return runs;
|
|
20363
20400
|
};
|
|
20401
|
+
function generateDocxRandomId(length = 8) {
|
|
20402
|
+
const max2 = 2147483647;
|
|
20403
|
+
const value = Math.floor(Math.random() * (max2 + 1));
|
|
20404
|
+
return value.toString(16).padStart(length, "0").slice(0, length);
|
|
20405
|
+
}
|
|
20406
|
+
function generateRandomSigned32BitIntStrId() {
|
|
20407
|
+
const val = Math.floor(Math.random() * 2147483647);
|
|
20408
|
+
return val.toString();
|
|
20409
|
+
}
|
|
20410
|
+
function generateRandom32BitHex() {
|
|
20411
|
+
const val = Math.floor(Math.random() * 2147483647);
|
|
20412
|
+
return val.toString(16).toUpperCase().padStart(8, "0");
|
|
20413
|
+
}
|
|
20364
20414
|
const XML_NODE_NAME$j = "w:hyperlink";
|
|
20365
20415
|
const SD_NODE_NAME$g = "link";
|
|
20366
20416
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
@@ -20457,13 +20507,13 @@ function _addNewLinkRelationship(params, link) {
|
|
|
20457
20507
|
type: "element",
|
|
20458
20508
|
name: "Relationship",
|
|
20459
20509
|
attributes: {
|
|
20460
|
-
Id: id
|
|
20510
|
+
Id: `rId${id}`,
|
|
20461
20511
|
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
20462
20512
|
Target: link,
|
|
20463
20513
|
TargetMode: "External"
|
|
20464
20514
|
}
|
|
20465
20515
|
});
|
|
20466
|
-
return id
|
|
20516
|
+
return `rId${id}`;
|
|
20467
20517
|
}
|
|
20468
20518
|
const config$i = {
|
|
20469
20519
|
xmlName: XML_NODE_NAME$j,
|
|
@@ -30477,6 +30527,59 @@ const config$c = {
|
|
|
30477
30527
|
attributes: validXmlAttributes$6
|
|
30478
30528
|
};
|
|
30479
30529
|
const translator$s = NodeTranslator.from(config$c);
|
|
30530
|
+
function getTextNodeForExport(text, marks, params) {
|
|
30531
|
+
const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
|
|
30532
|
+
const space = hasLeadingOrTrailingSpace ? "preserve" : null;
|
|
30533
|
+
const nodeAttrs = space ? { "xml:space": space } : null;
|
|
30534
|
+
const textNodes = [];
|
|
30535
|
+
const textRunProperties = decodeRPrFromMarks(marks || []);
|
|
30536
|
+
const parentRunProperties = params.extraParams?.runProperties || {};
|
|
30537
|
+
const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
|
|
30538
|
+
const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
|
|
30539
|
+
textNodes.push({
|
|
30540
|
+
name: "w:t",
|
|
30541
|
+
elements: [{ text, type: "text" }],
|
|
30542
|
+
attributes: nodeAttrs
|
|
30543
|
+
});
|
|
30544
|
+
if (params) {
|
|
30545
|
+
const { editor } = params;
|
|
30546
|
+
const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
|
|
30547
|
+
marks.forEach((mark) => {
|
|
30548
|
+
const isCustomMark = customMarks.some((customMark) => {
|
|
30549
|
+
const customMarkName = customMark.name;
|
|
30550
|
+
return mark.type === customMarkName;
|
|
30551
|
+
});
|
|
30552
|
+
if (!isCustomMark) return;
|
|
30553
|
+
let attrsString = "";
|
|
30554
|
+
Object.entries(mark.attrs).forEach(([key, value]) => {
|
|
30555
|
+
if (value) {
|
|
30556
|
+
attrsString += `${key}=${value};`;
|
|
30557
|
+
}
|
|
30558
|
+
});
|
|
30559
|
+
if (isCustomMark) {
|
|
30560
|
+
textNodes.unshift({
|
|
30561
|
+
type: "element",
|
|
30562
|
+
name: "w:bookmarkStart",
|
|
30563
|
+
attributes: {
|
|
30564
|
+
"w:id": "5000",
|
|
30565
|
+
"w:name": mark.type + ";" + attrsString
|
|
30566
|
+
}
|
|
30567
|
+
});
|
|
30568
|
+
textNodes.push({
|
|
30569
|
+
type: "element",
|
|
30570
|
+
name: "w:bookmarkEnd",
|
|
30571
|
+
attributes: {
|
|
30572
|
+
"w:id": "5000"
|
|
30573
|
+
}
|
|
30574
|
+
});
|
|
30575
|
+
}
|
|
30576
|
+
});
|
|
30577
|
+
}
|
|
30578
|
+
return {
|
|
30579
|
+
name: "w:r",
|
|
30580
|
+
elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
|
|
30581
|
+
};
|
|
30582
|
+
}
|
|
30480
30583
|
var he$2 = { exports: {} };
|
|
30481
30584
|
/*! https://mths.be/he v1.2.0 by @mathias | MIT license */
|
|
30482
30585
|
var he$1 = he$2.exports;
|
|
@@ -30883,18 +30986,31 @@ function prepareUrlAnnotation(params) {
|
|
|
30883
30986
|
node: { attrs = {}, marks = [] }
|
|
30884
30987
|
} = params;
|
|
30885
30988
|
if (!attrs.linkUrl) return prepareTextAnnotation(params);
|
|
30886
|
-
const
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
|
|
30894
|
-
|
|
30895
|
-
|
|
30896
|
-
|
|
30989
|
+
const linkTextNode = {
|
|
30990
|
+
type: "text",
|
|
30991
|
+
text: attrs.linkUrl,
|
|
30992
|
+
marks: [
|
|
30993
|
+
...marks,
|
|
30994
|
+
{
|
|
30995
|
+
type: "link",
|
|
30996
|
+
attrs: {
|
|
30997
|
+
href: attrs.linkUrl,
|
|
30998
|
+
history: true,
|
|
30999
|
+
text: attrs.linkUrl
|
|
31000
|
+
}
|
|
31001
|
+
},
|
|
31002
|
+
{
|
|
31003
|
+
type: "textStyle",
|
|
31004
|
+
attrs: {
|
|
31005
|
+
color: "#467886"
|
|
31006
|
+
}
|
|
31007
|
+
}
|
|
31008
|
+
]
|
|
30897
31009
|
};
|
|
31010
|
+
return translator$10.decode({
|
|
31011
|
+
...params,
|
|
31012
|
+
node: linkTextNode
|
|
31013
|
+
});
|
|
30898
31014
|
}
|
|
30899
31015
|
function translateFieldAttrsToMarks(attrs = {}) {
|
|
30900
31016
|
const { fontFamily, fontSize, bold, underline, italic, textColor, textHighlight } = attrs;
|
|
@@ -31087,6 +31203,46 @@ function translateDocumentPartObj(params) {
|
|
|
31087
31203
|
};
|
|
31088
31204
|
return result;
|
|
31089
31205
|
}
|
|
31206
|
+
const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
|
|
31207
|
+
function convertSdtContentToRuns(elements) {
|
|
31208
|
+
const normalized = Array.isArray(elements) ? elements : [elements];
|
|
31209
|
+
const runs = [];
|
|
31210
|
+
normalized.forEach((element) => {
|
|
31211
|
+
if (!element) return;
|
|
31212
|
+
if (element.name === "w:sdtPr") {
|
|
31213
|
+
return;
|
|
31214
|
+
}
|
|
31215
|
+
if (element.name === "w:r") {
|
|
31216
|
+
runs.push(element);
|
|
31217
|
+
return;
|
|
31218
|
+
}
|
|
31219
|
+
if (element.name === "w:sdt") {
|
|
31220
|
+
const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
|
|
31221
|
+
if (sdtContent?.elements) {
|
|
31222
|
+
runs.push(...convertSdtContentToRuns(sdtContent.elements));
|
|
31223
|
+
}
|
|
31224
|
+
return;
|
|
31225
|
+
}
|
|
31226
|
+
if (RUN_LEVEL_WRAPPERS.has(element.name)) {
|
|
31227
|
+
const wrapperElements = convertSdtContentToRuns(element.elements || []);
|
|
31228
|
+
if (wrapperElements.length) {
|
|
31229
|
+
runs.push({
|
|
31230
|
+
...element,
|
|
31231
|
+
elements: wrapperElements
|
|
31232
|
+
});
|
|
31233
|
+
}
|
|
31234
|
+
return;
|
|
31235
|
+
}
|
|
31236
|
+
if (element.name) {
|
|
31237
|
+
runs.push({
|
|
31238
|
+
name: "w:r",
|
|
31239
|
+
type: "element",
|
|
31240
|
+
elements: element.elements || [element]
|
|
31241
|
+
});
|
|
31242
|
+
}
|
|
31243
|
+
});
|
|
31244
|
+
return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
|
|
31245
|
+
}
|
|
31090
31246
|
function translateStructuredContent(params) {
|
|
31091
31247
|
const { node, isFinalDoc } = params;
|
|
31092
31248
|
const childContent = translateChildNodes({ ...params, node });
|
|
@@ -34609,7 +34765,6 @@ const config = {
|
|
|
34609
34765
|
attributes: validXmlAttributes
|
|
34610
34766
|
};
|
|
34611
34767
|
const translator = NodeTranslator.from(config);
|
|
34612
|
-
const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
|
|
34613
34768
|
const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
34614
34769
|
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
34615
34770
|
pageMargins: Object.freeze({
|
|
@@ -34667,45 +34822,6 @@ const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
|
34667
34822
|
});
|
|
34668
34823
|
return sectPr;
|
|
34669
34824
|
};
|
|
34670
|
-
function convertSdtContentToRuns(elements) {
|
|
34671
|
-
const normalized = Array.isArray(elements) ? elements : [elements];
|
|
34672
|
-
const runs = [];
|
|
34673
|
-
normalized.forEach((element) => {
|
|
34674
|
-
if (!element) return;
|
|
34675
|
-
if (element.name === "w:sdtPr") {
|
|
34676
|
-
return;
|
|
34677
|
-
}
|
|
34678
|
-
if (element.name === "w:r") {
|
|
34679
|
-
runs.push(element);
|
|
34680
|
-
return;
|
|
34681
|
-
}
|
|
34682
|
-
if (element.name === "w:sdt") {
|
|
34683
|
-
const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
|
|
34684
|
-
if (sdtContent?.elements) {
|
|
34685
|
-
runs.push(...convertSdtContentToRuns(sdtContent.elements));
|
|
34686
|
-
}
|
|
34687
|
-
return;
|
|
34688
|
-
}
|
|
34689
|
-
if (RUN_LEVEL_WRAPPERS.has(element.name)) {
|
|
34690
|
-
const wrapperElements = convertSdtContentToRuns(element.elements || []);
|
|
34691
|
-
if (wrapperElements.length) {
|
|
34692
|
-
runs.push({
|
|
34693
|
-
...element,
|
|
34694
|
-
elements: wrapperElements
|
|
34695
|
-
});
|
|
34696
|
-
}
|
|
34697
|
-
return;
|
|
34698
|
-
}
|
|
34699
|
-
if (element.name) {
|
|
34700
|
-
runs.push({
|
|
34701
|
-
name: "w:r",
|
|
34702
|
-
type: "element",
|
|
34703
|
-
elements: element.elements || [element]
|
|
34704
|
-
});
|
|
34705
|
-
}
|
|
34706
|
-
});
|
|
34707
|
-
return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
|
|
34708
|
-
}
|
|
34709
34825
|
function exportSchemaToJson(params) {
|
|
34710
34826
|
const { type: type2 } = params.node || {};
|
|
34711
34827
|
const router = {
|
|
@@ -34812,57 +34928,7 @@ function translateHeadingNode(params) {
|
|
|
34812
34928
|
// Maps to Heading1, Heading2, etc. in Word
|
|
34813
34929
|
}
|
|
34814
34930
|
};
|
|
34815
|
-
return
|
|
34816
|
-
}
|
|
34817
|
-
function translateParagraphNode(params) {
|
|
34818
|
-
const elements = translateChildNodes(params);
|
|
34819
|
-
const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
|
|
34820
|
-
if (htmlAnnotationChild) {
|
|
34821
|
-
return htmlAnnotationChild.elements;
|
|
34822
|
-
}
|
|
34823
|
-
const pPr = generateParagraphProperties(params);
|
|
34824
|
-
if (pPr) elements.unshift(pPr);
|
|
34825
|
-
let attributes = {};
|
|
34826
|
-
if (params.node.attrs?.rsidRDefault) {
|
|
34827
|
-
attributes["w:rsidRDefault"] = params.node.attrs.rsidRDefault;
|
|
34828
|
-
}
|
|
34829
|
-
const result = {
|
|
34830
|
-
name: "w:p",
|
|
34831
|
-
elements,
|
|
34832
|
-
attributes
|
|
34833
|
-
};
|
|
34834
|
-
return result;
|
|
34835
|
-
}
|
|
34836
|
-
function generateParagraphProperties(params) {
|
|
34837
|
-
const { node } = params;
|
|
34838
|
-
const { attrs = {} } = node;
|
|
34839
|
-
const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
|
|
34840
|
-
if (attrs.styleId !== paragraphProperties.styleId) {
|
|
34841
|
-
paragraphProperties.styleId = attrs.styleId;
|
|
34842
|
-
}
|
|
34843
|
-
["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key) => {
|
|
34844
|
-
let propKey = key === "textAlign" ? "justification" : key;
|
|
34845
|
-
if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key])) {
|
|
34846
|
-
paragraphProperties[key] = attrs[key];
|
|
34847
|
-
}
|
|
34848
|
-
});
|
|
34849
|
-
const framePr = attrs.dropcap;
|
|
34850
|
-
if (framePr) {
|
|
34851
|
-
framePr.dropCap = framePr.type;
|
|
34852
|
-
delete framePr.type;
|
|
34853
|
-
}
|
|
34854
|
-
if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
|
|
34855
|
-
paragraphProperties.framePr = framePr;
|
|
34856
|
-
}
|
|
34857
|
-
const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
|
|
34858
|
-
const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
|
|
34859
|
-
paragraphProperties.runProperties = finalRunProps;
|
|
34860
|
-
const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
|
|
34861
|
-
const sectPr = node.attrs?.paragraphProperties?.sectPr;
|
|
34862
|
-
if (sectPr) {
|
|
34863
|
-
pPr.elements.push(sectPr);
|
|
34864
|
-
}
|
|
34865
|
-
return pPr;
|
|
34931
|
+
return translator$11.decode({ ...params, node: paragraphNode });
|
|
34866
34932
|
}
|
|
34867
34933
|
function translateDocumentNode(params) {
|
|
34868
34934
|
const bodyNode = {
|
|
@@ -34877,59 +34943,6 @@ function translateDocumentNode(params) {
|
|
|
34877
34943
|
};
|
|
34878
34944
|
return [node, params];
|
|
34879
34945
|
}
|
|
34880
|
-
function getTextNodeForExport(text, marks, params) {
|
|
34881
|
-
const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
|
|
34882
|
-
const space = hasLeadingOrTrailingSpace ? "preserve" : null;
|
|
34883
|
-
const nodeAttrs = space ? { "xml:space": space } : null;
|
|
34884
|
-
const textNodes = [];
|
|
34885
|
-
const textRunProperties = decodeRPrFromMarks(marks || []);
|
|
34886
|
-
const parentRunProperties = params.extraParams?.runProperties || {};
|
|
34887
|
-
const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
|
|
34888
|
-
const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
|
|
34889
|
-
textNodes.push({
|
|
34890
|
-
name: "w:t",
|
|
34891
|
-
elements: [{ text, type: "text" }],
|
|
34892
|
-
attributes: nodeAttrs
|
|
34893
|
-
});
|
|
34894
|
-
if (params) {
|
|
34895
|
-
const { editor } = params;
|
|
34896
|
-
const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
|
|
34897
|
-
marks.forEach((mark) => {
|
|
34898
|
-
const isCustomMark = customMarks.some((customMark) => {
|
|
34899
|
-
const customMarkName = customMark.name;
|
|
34900
|
-
return mark.type === customMarkName;
|
|
34901
|
-
});
|
|
34902
|
-
if (!isCustomMark) return;
|
|
34903
|
-
let attrsString = "";
|
|
34904
|
-
Object.entries(mark.attrs).forEach(([key, value]) => {
|
|
34905
|
-
if (value) {
|
|
34906
|
-
attrsString += `${key}=${value};`;
|
|
34907
|
-
}
|
|
34908
|
-
});
|
|
34909
|
-
if (isCustomMark) {
|
|
34910
|
-
textNodes.unshift({
|
|
34911
|
-
type: "element",
|
|
34912
|
-
name: "w:bookmarkStart",
|
|
34913
|
-
attributes: {
|
|
34914
|
-
"w:id": "5000",
|
|
34915
|
-
"w:name": mark.type + ";" + attrsString
|
|
34916
|
-
}
|
|
34917
|
-
});
|
|
34918
|
-
textNodes.push({
|
|
34919
|
-
type: "element",
|
|
34920
|
-
name: "w:bookmarkEnd",
|
|
34921
|
-
attributes: {
|
|
34922
|
-
"w:id": "5000"
|
|
34923
|
-
}
|
|
34924
|
-
});
|
|
34925
|
-
}
|
|
34926
|
-
});
|
|
34927
|
-
}
|
|
34928
|
-
return {
|
|
34929
|
-
name: "w:r",
|
|
34930
|
-
elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
|
|
34931
|
-
};
|
|
34932
|
-
}
|
|
34933
34946
|
function wrapTextInRun(nodeOrNodes, marks) {
|
|
34934
34947
|
let elements = [];
|
|
34935
34948
|
if (Array.isArray(nodeOrNodes)) elements = nodeOrNodes;
|
|
@@ -34958,60 +34971,6 @@ function processOutputMarks(marks = []) {
|
|
|
34958
34971
|
}
|
|
34959
34972
|
});
|
|
34960
34973
|
}
|
|
34961
|
-
function processLinkContentNode(node) {
|
|
34962
|
-
if (!node) return node;
|
|
34963
|
-
const contentNode = carbonCopy(node);
|
|
34964
|
-
if (!contentNode) return contentNode;
|
|
34965
|
-
const hyperlinkStyle = {
|
|
34966
|
-
name: "w:rStyle",
|
|
34967
|
-
attributes: { "w:val": "Hyperlink" }
|
|
34968
|
-
};
|
|
34969
|
-
const color = {
|
|
34970
|
-
name: "w:color",
|
|
34971
|
-
attributes: { "w:val": "467886" }
|
|
34972
|
-
};
|
|
34973
|
-
const underline = {
|
|
34974
|
-
name: "w:u",
|
|
34975
|
-
attributes: {
|
|
34976
|
-
"w:val": "none"
|
|
34977
|
-
}
|
|
34978
|
-
};
|
|
34979
|
-
if (contentNode.name === "w:r") {
|
|
34980
|
-
const runProps = contentNode.elements.find((el) => el.name === "w:rPr");
|
|
34981
|
-
if (runProps) {
|
|
34982
|
-
const foundColor = runProps.elements.find((el) => el.name === "w:color");
|
|
34983
|
-
const foundHyperlinkStyle = runProps.elements.find((el) => el.name === "w:rStyle");
|
|
34984
|
-
const underlineMark = runProps.elements.find((el) => el.name === "w:u");
|
|
34985
|
-
if (!foundColor) runProps.elements.unshift(color);
|
|
34986
|
-
if (!foundHyperlinkStyle) runProps.elements.unshift(hyperlinkStyle);
|
|
34987
|
-
if (!underlineMark) runProps.elements.unshift(underline);
|
|
34988
|
-
} else {
|
|
34989
|
-
const runProps2 = {
|
|
34990
|
-
name: "w:rPr",
|
|
34991
|
-
elements: [hyperlinkStyle, color]
|
|
34992
|
-
};
|
|
34993
|
-
contentNode.elements.unshift(runProps2);
|
|
34994
|
-
}
|
|
34995
|
-
}
|
|
34996
|
-
return contentNode;
|
|
34997
|
-
}
|
|
34998
|
-
function addNewLinkRelationship(params, link) {
|
|
34999
|
-
const newId = "rId" + generateDocxRandomId();
|
|
35000
|
-
if (!params.relationships || !Array.isArray(params.relationships)) {
|
|
35001
|
-
params.relationships = [];
|
|
35002
|
-
}
|
|
35003
|
-
params.relationships.push({
|
|
35004
|
-
type: "element",
|
|
35005
|
-
name: "Relationship",
|
|
35006
|
-
attributes: {
|
|
35007
|
-
Id: newId,
|
|
35008
|
-
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
35009
|
-
Target: link,
|
|
35010
|
-
TargetMode: "External"
|
|
35011
|
-
}
|
|
35012
|
-
});
|
|
35013
|
-
return newId;
|
|
35014
|
-
}
|
|
35015
34974
|
function translateMark(mark) {
|
|
35016
34975
|
const xmlMark = SuperConverter.markTypes.find((m2) => m2.type === mark.type);
|
|
35017
34976
|
if (!xmlMark) {
|
|
@@ -35192,7 +35151,7 @@ const prepareCommentParaIds = (comment) => {
|
|
|
35192
35151
|
return newComment;
|
|
35193
35152
|
};
|
|
35194
35153
|
const getCommentDefinition = (comment, commentId, allComments, editor) => {
|
|
35195
|
-
const translatedText =
|
|
35154
|
+
const translatedText = translator$11.decode({ editor, node: comment.commentJSON });
|
|
35196
35155
|
const attributes = {
|
|
35197
35156
|
"w:id": String(commentId),
|
|
35198
35157
|
"w:author": comment.creatorName || comment.importedAuthor?.name,
|
|
@@ -35607,7 +35566,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
35607
35566
|
static getStoredSuperdocVersion(docx) {
|
|
35608
35567
|
return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35609
35568
|
}
|
|
35610
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.31.0-next.
|
|
35569
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.31.0-next.5") {
|
|
35611
35570
|
return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
35612
35571
|
}
|
|
35613
35572
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, aE as commonjsGlobal, B as Buffer, aF as getDefaultExportFromCjs, aG as getContentTypesFromXml, aH as xmljs } from "./converter-
|
|
1
|
+
import { p as process$1, aE as commonjsGlobal, B as Buffer, aF as getDefaultExportFromCjs, aG as getContentTypesFromXml, aH as xmljs } from "./converter-BIsS-JzD.js";
|
|
2
2
|
function commonjsRequire(path) {
|
|
3
3
|
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
4
4
|
}
|
|
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, isElementNode_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-BIsS-JzD.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-DVDiaIyD.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -14109,7 +14109,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14109
14109
|
{ default: remarkStringify },
|
|
14110
14110
|
{ default: remarkGfm }
|
|
14111
14111
|
] = await Promise.all([
|
|
14112
|
-
import("./index-
|
|
14112
|
+
import("./index-B7dC-H-Q.js"),
|
|
14113
14113
|
import("./index-DRCvimau.js"),
|
|
14114
14114
|
import("./index-C_x_N6Uh.js"),
|
|
14115
14115
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14310,7 +14310,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14310
14310
|
* Process collaboration migrations
|
|
14311
14311
|
*/
|
|
14312
14312
|
processCollaborationMigrations() {
|
|
14313
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.
|
|
14313
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.5");
|
|
14314
14314
|
if (!this.options.ydoc) return;
|
|
14315
14315
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14316
14316
|
let docVersion = metaMap.get("version");
|
|
@@ -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
|
-
import { p as process$1 } from "./converter-
|
|
3
|
-
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-
|
|
2
|
+
import { p as process$1 } from "./converter-BIsS-JzD.js";
|
|
3
|
+
import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-ZbcM1RTL.js";
|
|
4
4
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
5
5
|
let sanitized = value.replace(/[^0-9.]/g, "");
|
|
6
6
|
sanitized = parseFloat(sanitized);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E } from "./chunks/editor-
|
|
2
|
-
import "./chunks/converter-
|
|
3
|
-
import "./chunks/docx-zipper-
|
|
1
|
+
import { E } from "./chunks/editor-ZbcM1RTL.js";
|
|
2
|
+
import "./chunks/converter-BIsS-JzD.js";
|
|
3
|
+
import "./chunks/docx-zipper-DVDiaIyD.js";
|
|
4
4
|
export {
|
|
5
5
|
E as Editor
|
|
6
6
|
};
|