@harbour-enterprises/superdoc 0.5.36 → 0.5.37
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/{index-CtEWl-ZH.js → index-B_N4inTK.js} +2 -2
- package/dist/chunks/{index-CtEWl-ZH.js.map → index-B_N4inTK.js.map} +1 -1
- package/dist/chunks/{index-9S4X_ywo.js → index-DQD_ZI0o.js} +3 -3
- package/dist/chunks/{index-9S4X_ywo.js.map → index-DQD_ZI0o.js.map} +1 -1
- package/dist/chunks/{super-editor.es-qZ3KZirs.js → super-editor.es-CudGhkZK.js} +59 -69
- package/dist/chunks/super-editor.es-CudGhkZK.js.map +1 -0
- package/dist/chunks/{url-mmnBIIf_.js → url-RFOJMKKF.js} +2 -2
- package/dist/chunks/{url-mmnBIIf_.js.map → url-RFOJMKKF.js.map} +1 -1
- package/dist/chunks/{xml-js-Bp3TZtDC.js → xml-js-ETODspvn.js} +3 -6
- package/dist/chunks/xml-js-ETODspvn.js.map +1 -0
- package/dist/super-editor/chunks/{converter-Ddgo09YG.js → converter-DDbOtZBT.js} +51 -53
- package/dist/super-editor/chunks/converter-DDbOtZBT.js.map +1 -0
- package/dist/super-editor/chunks/{docx-zipper-DOKk393z.js → docx-zipper-D-LpzKMF.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-DOKk393z.js.map → docx-zipper-D-LpzKMF.js.map} +1 -1
- package/dist/super-editor/chunks/{editor-DMbaJ3Hc.js → editor-D1UhT8dv.js} +11 -19
- package/dist/super-editor/chunks/editor-D1UhT8dv.js.map +1 -0
- package/dist/super-editor/chunks/{toolbar-HMCBUVgd.js → toolbar-B6UAuAVN.js} +3 -3
- package/dist/super-editor/chunks/{toolbar-HMCBUVgd.js.map → toolbar-B6UAuAVN.js.map} +1 -1
- package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/commands/clearNodes.d.ts.map +1 -1
- package/dist/super-editor/core/commands/command.d.ts.map +1 -1
- package/dist/super-editor/core/commands/createParagraphNear.d.ts.map +1 -1
- package/dist/super-editor/core/commands/deleteSelection.d.ts.map +1 -1
- package/dist/super-editor/core/commands/exitCode.d.ts.map +1 -1
- package/dist/super-editor/core/commands/first.d.ts.map +1 -1
- package/dist/super-editor/core/commands/insertContent.d.ts.map +1 -1
- package/dist/super-editor/core/commands/insertContentAt.d.ts.map +1 -1
- package/dist/super-editor/core/commands/insertTabChar.d.ts.map +1 -1
- package/dist/super-editor/core/commands/insertTabNode.d.ts.map +1 -1
- package/dist/super-editor/core/commands/joinBackward.d.ts.map +1 -1
- package/dist/super-editor/core/commands/joinDown.d.ts.map +1 -1
- package/dist/super-editor/core/commands/joinForward.d.ts.map +1 -1
- package/dist/super-editor/core/commands/joinUp.d.ts.map +1 -1
- package/dist/super-editor/core/commands/liftEmptyBlock.d.ts.map +1 -1
- package/dist/super-editor/core/commands/liftListItem.d.ts.map +1 -1
- package/dist/super-editor/core/commands/newlineInCode.d.ts.map +1 -1
- package/dist/super-editor/core/commands/resetAttributes.d.ts.map +1 -1
- package/dist/super-editor/core/commands/selectAll.d.ts.map +1 -1
- package/dist/super-editor/core/commands/selectNodeBackward.d.ts.map +1 -1
- package/dist/super-editor/core/commands/selectNodeForward.d.ts.map +1 -1
- package/dist/super-editor/core/commands/selectTextblockEnd.d.ts.map +1 -1
- package/dist/super-editor/core/commands/selectTextblockStart.d.ts.map +1 -1
- package/dist/super-editor/core/commands/setMark.d.ts.map +1 -1
- package/dist/super-editor/core/commands/setMeta.d.ts.map +1 -1
- package/dist/super-editor/core/commands/setNode.d.ts.map +1 -1
- package/dist/super-editor/core/commands/sinkListItem.d.ts.map +1 -1
- package/dist/super-editor/core/commands/splitBlock.d.ts.map +1 -1
- package/dist/super-editor/core/commands/splitListItem.d.ts.map +1 -1
- package/dist/super-editor/core/commands/toggleList.d.ts.map +1 -1
- package/dist/super-editor/core/commands/toggleMark.d.ts.map +1 -1
- package/dist/super-editor/core/commands/toggleNode.d.ts.map +1 -1
- package/dist/super-editor/core/commands/unsetAllMarks.d.ts.map +1 -1
- package/dist/super-editor/core/commands/unsetMark.d.ts.map +1 -1
- package/dist/super-editor/core/commands/updateAttributes.d.ts.map +1 -1
- package/dist/super-editor/core/commands/wrapInList.d.ts.map +1 -1
- package/dist/super-editor/core/helpers/findParentNode.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/SuperConverter.d.ts +1 -1
- package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/exporter.d.ts +1 -1
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +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.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.es.js +7 -7
- package/package.json +1 -1
- package/dist/chunks/super-editor.es-qZ3KZirs.js.map +0 -1
- package/dist/chunks/xml-js-Bp3TZtDC.js.map +0 -1
- package/dist/super-editor/chunks/converter-Ddgo09YG.js.map +0 -1
- package/dist/super-editor/chunks/editor-DMbaJ3Hc.js.map +0 -1
|
@@ -3019,14 +3019,11 @@ var callBindBasic = callBindApplyHelpers;
|
|
|
3019
3019
|
var $indexOf$1 = callBindBasic([GetIntrinsic$1("%String.prototype.indexOf%")]);
|
|
3020
3020
|
var callBound$5 = function callBoundIntrinsic(name, allowMissing) {
|
|
3021
3021
|
var intrinsic = (
|
|
3022
|
-
/** @type {
|
|
3022
|
+
/** @type {Parameters<typeof callBindBasic>[0][0]} */
|
|
3023
3023
|
GetIntrinsic$1(name, !!allowMissing)
|
|
3024
3024
|
);
|
|
3025
3025
|
if (typeof intrinsic === "function" && $indexOf$1(name, ".prototype.") > -1) {
|
|
3026
|
-
return callBindBasic(
|
|
3027
|
-
/** @type {const} */
|
|
3028
|
-
[intrinsic]
|
|
3029
|
-
);
|
|
3026
|
+
return callBindBasic([intrinsic]);
|
|
3030
3027
|
}
|
|
3031
3028
|
return intrinsic;
|
|
3032
3029
|
};
|
|
@@ -12924,24 +12921,23 @@ class Mapping {
|
|
|
12924
12921
|
/**
|
|
12925
12922
|
Create a new mapping with the given position maps.
|
|
12926
12923
|
*/
|
|
12927
|
-
constructor(maps, mirror, from = 0, to = maps
|
|
12924
|
+
constructor(maps = [], mirror, from = 0, to = maps.length) {
|
|
12925
|
+
this.maps = maps;
|
|
12928
12926
|
this.mirror = mirror;
|
|
12929
12927
|
this.from = from;
|
|
12930
12928
|
this.to = to;
|
|
12931
|
-
this._maps = maps || [];
|
|
12932
|
-
this.ownData = !(maps || mirror);
|
|
12933
12929
|
}
|
|
12934
12930
|
/**
|
|
12935
|
-
|
|
12931
|
+
Create a mapping that maps only through a part of this one.
|
|
12936
12932
|
*/
|
|
12937
|
-
|
|
12938
|
-
return this.
|
|
12933
|
+
slice(from = 0, to = this.maps.length) {
|
|
12934
|
+
return new Mapping(this.maps, this.mirror, from, to);
|
|
12939
12935
|
}
|
|
12940
12936
|
/**
|
|
12941
|
-
|
|
12937
|
+
@internal
|
|
12942
12938
|
*/
|
|
12943
|
-
|
|
12944
|
-
return new Mapping(this.
|
|
12939
|
+
copy() {
|
|
12940
|
+
return new Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to);
|
|
12945
12941
|
}
|
|
12946
12942
|
/**
|
|
12947
12943
|
Add a step map to the end of this mapping. If `mirrors` is
|
|
@@ -12949,23 +12945,18 @@ class Mapping {
|
|
|
12949
12945
|
image of this one.
|
|
12950
12946
|
*/
|
|
12951
12947
|
appendMap(map, mirrors) {
|
|
12952
|
-
|
|
12953
|
-
this._maps = this._maps.slice();
|
|
12954
|
-
this.mirror = this.mirror && this.mirror.slice();
|
|
12955
|
-
this.ownData = true;
|
|
12956
|
-
}
|
|
12957
|
-
this.to = this._maps.push(map);
|
|
12948
|
+
this.to = this.maps.push(map);
|
|
12958
12949
|
if (mirrors != null)
|
|
12959
|
-
this.setMirror(this.
|
|
12950
|
+
this.setMirror(this.maps.length - 1, mirrors);
|
|
12960
12951
|
}
|
|
12961
12952
|
/**
|
|
12962
12953
|
Add all the step maps in a given mapping to this one (preserving
|
|
12963
12954
|
mirroring information).
|
|
12964
12955
|
*/
|
|
12965
12956
|
appendMapping(mapping) {
|
|
12966
|
-
for (let i2 = 0, startSize = this.
|
|
12957
|
+
for (let i2 = 0, startSize = this.maps.length; i2 < mapping.maps.length; i2++) {
|
|
12967
12958
|
let mirr = mapping.getMirror(i2);
|
|
12968
|
-
this.appendMap(mapping.
|
|
12959
|
+
this.appendMap(mapping.maps[i2], mirr != null && mirr < i2 ? startSize + mirr : void 0);
|
|
12969
12960
|
}
|
|
12970
12961
|
}
|
|
12971
12962
|
/**
|
|
@@ -12992,9 +12983,9 @@ class Mapping {
|
|
|
12992
12983
|
Append the inverse of the given mapping to this one.
|
|
12993
12984
|
*/
|
|
12994
12985
|
appendMappingInverted(mapping) {
|
|
12995
|
-
for (let i2 = mapping.maps.length - 1, totalSize = this.
|
|
12986
|
+
for (let i2 = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i2 >= 0; i2--) {
|
|
12996
12987
|
let mirr = mapping.getMirror(i2);
|
|
12997
|
-
this.appendMap(mapping.
|
|
12988
|
+
this.appendMap(mapping.maps[i2].invert(), mirr != null && mirr > i2 ? totalSize - mirr - 1 : void 0);
|
|
12998
12989
|
}
|
|
12999
12990
|
}
|
|
13000
12991
|
/**
|
|
@@ -13012,7 +13003,7 @@ class Mapping {
|
|
|
13012
13003
|
if (this.mirror)
|
|
13013
13004
|
return this._map(pos, assoc, true);
|
|
13014
13005
|
for (let i2 = this.from; i2 < this.to; i2++)
|
|
13015
|
-
pos = this.
|
|
13006
|
+
pos = this.maps[i2].map(pos, assoc);
|
|
13016
13007
|
return pos;
|
|
13017
13008
|
}
|
|
13018
13009
|
/**
|
|
@@ -13028,12 +13019,12 @@ class Mapping {
|
|
|
13028
13019
|
_map(pos, assoc, simple) {
|
|
13029
13020
|
let delInfo = 0;
|
|
13030
13021
|
for (let i2 = this.from; i2 < this.to; i2++) {
|
|
13031
|
-
let map = this.
|
|
13022
|
+
let map = this.maps[i2], result = map.mapResult(pos, assoc);
|
|
13032
13023
|
if (result.recover != null) {
|
|
13033
13024
|
let corr = this.getMirror(i2);
|
|
13034
13025
|
if (corr != null && corr > i2 && corr < this.to) {
|
|
13035
13026
|
i2 = corr;
|
|
13036
|
-
pos = this.
|
|
13027
|
+
pos = this.maps[corr].recover(result.recover);
|
|
13037
13028
|
continue;
|
|
13038
13029
|
}
|
|
13039
13030
|
}
|
|
@@ -14534,7 +14525,7 @@ let Transform$8 = class Transform2 {
|
|
|
14534
14525
|
greater than one, any number of nodes above that. By default, the
|
|
14535
14526
|
parts split off will inherit the node type of the original node.
|
|
14536
14527
|
This can be changed by passing an array of types and attributes to
|
|
14537
|
-
use after the split
|
|
14528
|
+
use after the split.
|
|
14538
14529
|
*/
|
|
14539
14530
|
split(pos, depth = 1, typesAfter) {
|
|
14540
14531
|
split(this, pos, depth, typesAfter);
|
|
@@ -50565,9 +50556,9 @@ class DocxExporter {
|
|
|
50565
50556
|
__privateAdd(this, _DocxExporter_instances);
|
|
50566
50557
|
this.converter = converter;
|
|
50567
50558
|
}
|
|
50568
|
-
schemaToXml(data) {
|
|
50559
|
+
schemaToXml(data, debug = false) {
|
|
50569
50560
|
console.debug("[SuperConverter] schemaToXml:", data);
|
|
50570
|
-
const result = __privateMethod(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data);
|
|
50561
|
+
const result = __privateMethod(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data, debug);
|
|
50571
50562
|
return result.join("");
|
|
50572
50563
|
}
|
|
50573
50564
|
}
|
|
@@ -50588,11 +50579,11 @@ generateInstrText_fn = function(data) {
|
|
|
50588
50579
|
elements: [{ name: "w:instrText", elements: [{ type: "text", text: data }] }]
|
|
50589
50580
|
};
|
|
50590
50581
|
};
|
|
50591
|
-
generate_xml_as_list_fn = function(data) {
|
|
50582
|
+
generate_xml_as_list_fn = function(data, debug = falase) {
|
|
50592
50583
|
const json = JSON.parse(JSON.stringify(data));
|
|
50593
50584
|
const declaration = this.converter.declaration.attributes;
|
|
50594
50585
|
const xmlTag = `<?xml${Object.entries(declaration).map(([key2, value]) => ` ${key2}="${value}"`).join("")}?>`;
|
|
50595
|
-
const result = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, json);
|
|
50586
|
+
const result = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, json, debug);
|
|
50596
50587
|
const final2 = [xmlTag, ...result];
|
|
50597
50588
|
return final2;
|
|
50598
50589
|
};
|
|
@@ -50600,14 +50591,16 @@ replaceSpecialCharacters_fn = function(text) {
|
|
|
50600
50591
|
if (!text) return;
|
|
50601
50592
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
50602
50593
|
};
|
|
50603
|
-
generateXml_fn = function(node2) {
|
|
50594
|
+
generateXml_fn = function(node2, debug = false) {
|
|
50604
50595
|
if (!node2) return null;
|
|
50605
|
-
|
|
50596
|
+
let { name } = node2;
|
|
50597
|
+
const { elements, attributes } = node2;
|
|
50606
50598
|
let tag = `<${name}`;
|
|
50607
50599
|
for (let attr in attributes) {
|
|
50608
|
-
|
|
50600
|
+
const parsedAttrName = typeof attributes[attr] === "string" ? __privateMethod(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, attributes[attr]) : attributes[attr];
|
|
50601
|
+
tag += ` ${attr}="${parsedAttrName}"`;
|
|
50609
50602
|
}
|
|
50610
|
-
const selfClosing = !elements || !elements.length;
|
|
50603
|
+
const selfClosing = name && (!elements || !elements.length);
|
|
50611
50604
|
if (selfClosing) tag += " />";
|
|
50612
50605
|
else tag += ">";
|
|
50613
50606
|
let tags = [tag];
|
|
@@ -50621,7 +50614,10 @@ generateXml_fn = function(node2) {
|
|
|
50621
50614
|
for (let child of elements) {
|
|
50622
50615
|
const newElements = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, child);
|
|
50623
50616
|
if (!newElements) continue;
|
|
50624
|
-
|
|
50617
|
+
const removeUndefined = newElements.filter((el) => {
|
|
50618
|
+
return el !== "<undefined>" && el !== "</undefined>";
|
|
50619
|
+
});
|
|
50620
|
+
tags.push(...removeUndefined);
|
|
50625
50621
|
}
|
|
50626
50622
|
}
|
|
50627
50623
|
}
|
|
@@ -52634,14 +52630,14 @@ const _SuperConverter = class _SuperConverter {
|
|
|
52634
52630
|
if (!properties.elements) return;
|
|
52635
52631
|
const superdocVersion = properties.elements.find((el) => el.name === "property" && el.attributes.name === "SuperdocVersion");
|
|
52636
52632
|
if (!superdocVersion) return;
|
|
52637
|
-
const version2 = superdocVersion.elements[0].elements[0].
|
|
52633
|
+
const version2 = superdocVersion.elements[0].elements[0].text;
|
|
52638
52634
|
return version2;
|
|
52639
52635
|
} catch (e) {
|
|
52640
52636
|
console.warn("Error getting Superdoc version", e);
|
|
52641
52637
|
return;
|
|
52642
52638
|
}
|
|
52643
52639
|
}
|
|
52644
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.5.
|
|
52640
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.5.37") {
|
|
52645
52641
|
const customLocation = "docProps/custom.xml";
|
|
52646
52642
|
if (!docx[customLocation]) {
|
|
52647
52643
|
docx[customLocation] = generateCustomXml();
|
|
@@ -52749,9 +52745,9 @@ const _SuperConverter = class _SuperConverter {
|
|
|
52749
52745
|
return null;
|
|
52750
52746
|
}
|
|
52751
52747
|
}
|
|
52752
|
-
schemaToXml(data) {
|
|
52748
|
+
schemaToXml(data, debug = false) {
|
|
52753
52749
|
const exporter = new DocxExporter(this);
|
|
52754
|
-
return exporter.schemaToXml(data);
|
|
52750
|
+
return exporter.schemaToXml(data, debug);
|
|
52755
52751
|
}
|
|
52756
52752
|
async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = []) {
|
|
52757
52753
|
const bodyNode = this.savedTagsToRestore.find((el) => el.name === "w:body");
|
|
@@ -52889,32 +52885,34 @@ function storeSuperdocVersion(docx) {
|
|
|
52889
52885
|
const properties = customXml.elements.find((el) => el.name === "Properties");
|
|
52890
52886
|
if (!properties.elements) properties.elements = [];
|
|
52891
52887
|
const elements = properties.elements;
|
|
52892
|
-
|
|
52888
|
+
let pid = 1;
|
|
52889
|
+
try {
|
|
52890
|
+
pid = elements.length ? Math.max(...elements.map((el) => el.attributes.pid)) + 1 : 1;
|
|
52891
|
+
} catch (error2) {
|
|
52892
|
+
}
|
|
52893
|
+
elements.push(pid, generateSuperdocVersion());
|
|
52893
52894
|
return docx;
|
|
52894
52895
|
}
|
|
52895
52896
|
function generateCustomXml() {
|
|
52896
52897
|
return DEFAULT_CUSTOM_XML;
|
|
52897
52898
|
}
|
|
52898
|
-
function generateSuperdocVersion(version2 = "0.5.
|
|
52899
|
+
function generateSuperdocVersion(pid = 1, version2 = "0.5.37") {
|
|
52899
52900
|
return {
|
|
52900
52901
|
type: "element",
|
|
52901
52902
|
name: "property",
|
|
52902
52903
|
attributes: {
|
|
52903
52904
|
name: "SuperdocVersion",
|
|
52904
|
-
|
|
52905
|
-
pid
|
|
52905
|
+
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
|
|
52906
|
+
pid
|
|
52906
52907
|
},
|
|
52907
52908
|
elements: [
|
|
52908
52909
|
{
|
|
52909
52910
|
type: "element",
|
|
52910
|
-
name: "vt:
|
|
52911
|
+
name: "vt:lpwstr",
|
|
52911
52912
|
elements: [
|
|
52912
52913
|
{
|
|
52913
|
-
|
|
52914
|
-
|
|
52915
|
-
type: "text",
|
|
52916
|
-
text: version2
|
|
52917
|
-
}]
|
|
52914
|
+
type: "text",
|
|
52915
|
+
text: version2
|
|
52918
52916
|
}
|
|
52919
52917
|
]
|
|
52920
52918
|
}
|
|
@@ -52967,4 +52965,4 @@ export {
|
|
|
52967
52965
|
twipsToLines as y,
|
|
52968
52966
|
pixelsToTwips as z
|
|
52969
52967
|
};
|
|
52970
|
-
//# sourceMappingURL=converter-
|
|
52968
|
+
//# sourceMappingURL=converter-DDbOtZBT.js.map
|