@harbour-enterprises/superdoc 0.23.0-next.14 → 0.23.0-next.16
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-D3cgkd9j.cjs → PdfViewer-CJrsZCLf.cjs} +1 -1
- package/dist/chunks/{PdfViewer-BaaVD5bX.es.js → PdfViewer-DfGIeWvO.es.js} +1 -1
- package/dist/chunks/{eventemitter3-CR2eBWft.es.js → eventemitter3-BWEnUdTY.es.js} +1 -1
- package/dist/chunks/{eventemitter3-DSRogsNq.cjs → eventemitter3-DkXkH2rT.cjs} +1 -1
- package/dist/chunks/{index-CESuSQe2.es.js → index-CwhKMy0h.es.js} +27 -332
- package/dist/chunks/{index-CAHkANZY.cjs → index-DGSQ4Gfx.cjs} +160 -465
- package/dist/chunks/{super-editor.es-BYutUrPg.cjs → super-editor.es-b9ACFl9D.cjs} +649 -125
- package/dist/chunks/{super-editor.es-BKb7p4fi.es.js → super-editor.es-bIibjiHo.es.js} +649 -125
- package/dist/chunks/{xml-js-CWV8R-ek.cjs → xml-js-D_ZIzxu0.cjs} +1 -1
- package/dist/chunks/xml-js-Dx4FIjnp.es.js +2 -0
- package/dist/core/types/index.d.ts +19 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DD7uNz2k.js → converter-vEmAnrOg.js} +665 -249
- package/dist/super-editor/chunks/{docx-zipper-DraPR30Z.js → docx-zipper-DA00N7eN.js} +1 -1
- package/dist/super-editor/chunks/{editor-xzhKWRFZ.js → editor-CVzagv2Y.js} +127 -19
- package/dist/super-editor/chunks/{toolbar-D6SJTVWT.js → toolbar-BCJtFyig.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/src/core/Editor.d.ts +57 -3
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +58 -2
- package/dist/super-editor/src/core/super-converter/exporter-docx-defs.d.ts +28 -39
- 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 -3
- package/dist/superdoc.es.js +2 -3
- package/dist/superdoc.umd.js +674 -455
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-Bbc0NeKa.es.js +0 -2
- package/dist/chunks/{jszip-DAXEPCUv.es.js → jszip-BDk3JBqp.es.js} +3 -3
- package/dist/chunks/{jszip-B4LDL19y.cjs → jszip-u4dvXAKa.cjs} +3 -3
|
@@ -27,11 +27,7 @@ var __publicField$2 = (obj, key2, value) => __defNormalProp$2(obj, typeof key2 !
|
|
|
27
27
|
var __accessCheck$2 = (obj, member, msg2) => member.has(obj) || __typeError$2("Cannot " + msg2);
|
|
28
28
|
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
29
29
|
var __privateMethod$2 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
30
|
-
var _a, _DocxExporter_instances, generate_xml_as_list_fn, replaceSpecialCharacters_fn, generateXml_fn, _SuperConverter_instances, exportNumberingFile_fn, prepareCommentsXmlFilesForExport_fn, exportProcessHeadersFooters_fn, exportProcessNewRelationships_fn, exportProcessMediaFiles_fn;
|
|
31
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof vue.global !== "undefined" ? vue.global : typeof self !== "undefined" ? self : {};
|
|
32
|
-
function getDefaultExportFromCjs$1(x) {
|
|
33
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
34
|
-
}
|
|
30
|
+
var _a, _DocxExporter_instances, generate_xml_as_list_fn, replaceSpecialCharacters_fn, generateXml_fn, _SuperConverter_instances, generateDocumentHash_fn, exportNumberingFile_fn, prepareCommentsXmlFilesForExport_fn, exportProcessHeadersFooters_fn, exportProcessNewRelationships_fn, exportProcessMediaFiles_fn;
|
|
35
31
|
var buffer = {};
|
|
36
32
|
var base64Js = {};
|
|
37
33
|
base64Js.byteLength = byteLength;
|
|
@@ -1798,6 +1794,10 @@ ieee754.write = function(buffer2, value, offset2, isLE, mLen, nBytes) {
|
|
|
1798
1794
|
}
|
|
1799
1795
|
})(buffer);
|
|
1800
1796
|
const Buffer2 = buffer.Buffer;
|
|
1797
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof vue.global !== "undefined" ? vue.global : typeof self !== "undefined" ? self : {};
|
|
1798
|
+
function getDefaultExportFromCjs$2(x) {
|
|
1799
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1800
|
+
}
|
|
1801
1801
|
var sax = {};
|
|
1802
1802
|
var events$1 = { exports: {} };
|
|
1803
1803
|
var hasRequiredEvents;
|
|
@@ -2200,7 +2200,7 @@ function requireInherits_browser() {
|
|
|
2200
2200
|
}
|
|
2201
2201
|
return inherits_browser.exports;
|
|
2202
2202
|
}
|
|
2203
|
-
function getDefaultExportFromCjs(x) {
|
|
2203
|
+
function getDefaultExportFromCjs$1(x) {
|
|
2204
2204
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2205
2205
|
}
|
|
2206
2206
|
var browser$1 = { exports: {} };
|
|
@@ -2361,7 +2361,7 @@ process$1.umask = function() {
|
|
|
2361
2361
|
return 0;
|
|
2362
2362
|
};
|
|
2363
2363
|
var browserExports = browser$1.exports;
|
|
2364
|
-
const process$1$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
2364
|
+
const process$1$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(browserExports);
|
|
2365
2365
|
var streamBrowser;
|
|
2366
2366
|
var hasRequiredStreamBrowser;
|
|
2367
2367
|
function requireStreamBrowser() {
|
|
@@ -11346,7 +11346,7 @@ function requireLib() {
|
|
|
11346
11346
|
return lib;
|
|
11347
11347
|
}
|
|
11348
11348
|
var libExports = requireLib();
|
|
11349
|
-
const xmljs = /* @__PURE__ */ getDefaultExportFromCjs$
|
|
11349
|
+
const xmljs = /* @__PURE__ */ getDefaultExportFromCjs$2(libExports);
|
|
11350
11350
|
var getRandomValues;
|
|
11351
11351
|
var rnds8 = new Uint8Array(16);
|
|
11352
11352
|
function rng() {
|
|
@@ -11381,6 +11381,306 @@ function v4(options, buf, offset2) {
|
|
|
11381
11381
|
rnds[8] = rnds[8] & 63 | 128;
|
|
11382
11382
|
return stringify(rnds);
|
|
11383
11383
|
}
|
|
11384
|
+
function getDefaultExportFromCjs(x) {
|
|
11385
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
11386
|
+
}
|
|
11387
|
+
const CRC_TABLE = new Int32Array([
|
|
11388
|
+
0,
|
|
11389
|
+
1996959894,
|
|
11390
|
+
3993919788,
|
|
11391
|
+
2567524794,
|
|
11392
|
+
124634137,
|
|
11393
|
+
1886057615,
|
|
11394
|
+
3915621685,
|
|
11395
|
+
2657392035,
|
|
11396
|
+
249268274,
|
|
11397
|
+
2044508324,
|
|
11398
|
+
3772115230,
|
|
11399
|
+
2547177864,
|
|
11400
|
+
162941995,
|
|
11401
|
+
2125561021,
|
|
11402
|
+
3887607047,
|
|
11403
|
+
2428444049,
|
|
11404
|
+
498536548,
|
|
11405
|
+
1789927666,
|
|
11406
|
+
4089016648,
|
|
11407
|
+
2227061214,
|
|
11408
|
+
450548861,
|
|
11409
|
+
1843258603,
|
|
11410
|
+
4107580753,
|
|
11411
|
+
2211677639,
|
|
11412
|
+
325883990,
|
|
11413
|
+
1684777152,
|
|
11414
|
+
4251122042,
|
|
11415
|
+
2321926636,
|
|
11416
|
+
335633487,
|
|
11417
|
+
1661365465,
|
|
11418
|
+
4195302755,
|
|
11419
|
+
2366115317,
|
|
11420
|
+
997073096,
|
|
11421
|
+
1281953886,
|
|
11422
|
+
3579855332,
|
|
11423
|
+
2724688242,
|
|
11424
|
+
1006888145,
|
|
11425
|
+
1258607687,
|
|
11426
|
+
3524101629,
|
|
11427
|
+
2768942443,
|
|
11428
|
+
901097722,
|
|
11429
|
+
1119000684,
|
|
11430
|
+
3686517206,
|
|
11431
|
+
2898065728,
|
|
11432
|
+
853044451,
|
|
11433
|
+
1172266101,
|
|
11434
|
+
3705015759,
|
|
11435
|
+
2882616665,
|
|
11436
|
+
651767980,
|
|
11437
|
+
1373503546,
|
|
11438
|
+
3369554304,
|
|
11439
|
+
3218104598,
|
|
11440
|
+
565507253,
|
|
11441
|
+
1454621731,
|
|
11442
|
+
3485111705,
|
|
11443
|
+
3099436303,
|
|
11444
|
+
671266974,
|
|
11445
|
+
1594198024,
|
|
11446
|
+
3322730930,
|
|
11447
|
+
2970347812,
|
|
11448
|
+
795835527,
|
|
11449
|
+
1483230225,
|
|
11450
|
+
3244367275,
|
|
11451
|
+
3060149565,
|
|
11452
|
+
1994146192,
|
|
11453
|
+
31158534,
|
|
11454
|
+
2563907772,
|
|
11455
|
+
4023717930,
|
|
11456
|
+
1907459465,
|
|
11457
|
+
112637215,
|
|
11458
|
+
2680153253,
|
|
11459
|
+
3904427059,
|
|
11460
|
+
2013776290,
|
|
11461
|
+
251722036,
|
|
11462
|
+
2517215374,
|
|
11463
|
+
3775830040,
|
|
11464
|
+
2137656763,
|
|
11465
|
+
141376813,
|
|
11466
|
+
2439277719,
|
|
11467
|
+
3865271297,
|
|
11468
|
+
1802195444,
|
|
11469
|
+
476864866,
|
|
11470
|
+
2238001368,
|
|
11471
|
+
4066508878,
|
|
11472
|
+
1812370925,
|
|
11473
|
+
453092731,
|
|
11474
|
+
2181625025,
|
|
11475
|
+
4111451223,
|
|
11476
|
+
1706088902,
|
|
11477
|
+
314042704,
|
|
11478
|
+
2344532202,
|
|
11479
|
+
4240017532,
|
|
11480
|
+
1658658271,
|
|
11481
|
+
366619977,
|
|
11482
|
+
2362670323,
|
|
11483
|
+
4224994405,
|
|
11484
|
+
1303535960,
|
|
11485
|
+
984961486,
|
|
11486
|
+
2747007092,
|
|
11487
|
+
3569037538,
|
|
11488
|
+
1256170817,
|
|
11489
|
+
1037604311,
|
|
11490
|
+
2765210733,
|
|
11491
|
+
3554079995,
|
|
11492
|
+
1131014506,
|
|
11493
|
+
879679996,
|
|
11494
|
+
2909243462,
|
|
11495
|
+
3663771856,
|
|
11496
|
+
1141124467,
|
|
11497
|
+
855842277,
|
|
11498
|
+
2852801631,
|
|
11499
|
+
3708648649,
|
|
11500
|
+
1342533948,
|
|
11501
|
+
654459306,
|
|
11502
|
+
3188396048,
|
|
11503
|
+
3373015174,
|
|
11504
|
+
1466479909,
|
|
11505
|
+
544179635,
|
|
11506
|
+
3110523913,
|
|
11507
|
+
3462522015,
|
|
11508
|
+
1591671054,
|
|
11509
|
+
702138776,
|
|
11510
|
+
2966460450,
|
|
11511
|
+
3352799412,
|
|
11512
|
+
1504918807,
|
|
11513
|
+
783551873,
|
|
11514
|
+
3082640443,
|
|
11515
|
+
3233442989,
|
|
11516
|
+
3988292384,
|
|
11517
|
+
2596254646,
|
|
11518
|
+
62317068,
|
|
11519
|
+
1957810842,
|
|
11520
|
+
3939845945,
|
|
11521
|
+
2647816111,
|
|
11522
|
+
81470997,
|
|
11523
|
+
1943803523,
|
|
11524
|
+
3814918930,
|
|
11525
|
+
2489596804,
|
|
11526
|
+
225274430,
|
|
11527
|
+
2053790376,
|
|
11528
|
+
3826175755,
|
|
11529
|
+
2466906013,
|
|
11530
|
+
167816743,
|
|
11531
|
+
2097651377,
|
|
11532
|
+
4027552580,
|
|
11533
|
+
2265490386,
|
|
11534
|
+
503444072,
|
|
11535
|
+
1762050814,
|
|
11536
|
+
4150417245,
|
|
11537
|
+
2154129355,
|
|
11538
|
+
426522225,
|
|
11539
|
+
1852507879,
|
|
11540
|
+
4275313526,
|
|
11541
|
+
2312317920,
|
|
11542
|
+
282753626,
|
|
11543
|
+
1742555852,
|
|
11544
|
+
4189708143,
|
|
11545
|
+
2394877945,
|
|
11546
|
+
397917763,
|
|
11547
|
+
1622183637,
|
|
11548
|
+
3604390888,
|
|
11549
|
+
2714866558,
|
|
11550
|
+
953729732,
|
|
11551
|
+
1340076626,
|
|
11552
|
+
3518719985,
|
|
11553
|
+
2797360999,
|
|
11554
|
+
1068828381,
|
|
11555
|
+
1219638859,
|
|
11556
|
+
3624741850,
|
|
11557
|
+
2936675148,
|
|
11558
|
+
906185462,
|
|
11559
|
+
1090812512,
|
|
11560
|
+
3747672003,
|
|
11561
|
+
2825379669,
|
|
11562
|
+
829329135,
|
|
11563
|
+
1181335161,
|
|
11564
|
+
3412177804,
|
|
11565
|
+
3160834842,
|
|
11566
|
+
628085408,
|
|
11567
|
+
1382605366,
|
|
11568
|
+
3423369109,
|
|
11569
|
+
3138078467,
|
|
11570
|
+
570562233,
|
|
11571
|
+
1426400815,
|
|
11572
|
+
3317316542,
|
|
11573
|
+
2998733608,
|
|
11574
|
+
733239954,
|
|
11575
|
+
1555261956,
|
|
11576
|
+
3268935591,
|
|
11577
|
+
3050360625,
|
|
11578
|
+
752459403,
|
|
11579
|
+
1541320221,
|
|
11580
|
+
2607071920,
|
|
11581
|
+
3965973030,
|
|
11582
|
+
1969922972,
|
|
11583
|
+
40735498,
|
|
11584
|
+
2617837225,
|
|
11585
|
+
3943577151,
|
|
11586
|
+
1913087877,
|
|
11587
|
+
83908371,
|
|
11588
|
+
2512341634,
|
|
11589
|
+
3803740692,
|
|
11590
|
+
2075208622,
|
|
11591
|
+
213261112,
|
|
11592
|
+
2463272603,
|
|
11593
|
+
3855990285,
|
|
11594
|
+
2094854071,
|
|
11595
|
+
198958881,
|
|
11596
|
+
2262029012,
|
|
11597
|
+
4057260610,
|
|
11598
|
+
1759359992,
|
|
11599
|
+
534414190,
|
|
11600
|
+
2176718541,
|
|
11601
|
+
4139329115,
|
|
11602
|
+
1873836001,
|
|
11603
|
+
414664567,
|
|
11604
|
+
2282248934,
|
|
11605
|
+
4279200368,
|
|
11606
|
+
1711684554,
|
|
11607
|
+
285281116,
|
|
11608
|
+
2405801727,
|
|
11609
|
+
4167216745,
|
|
11610
|
+
1634467795,
|
|
11611
|
+
376229701,
|
|
11612
|
+
2685067896,
|
|
11613
|
+
3608007406,
|
|
11614
|
+
1308918612,
|
|
11615
|
+
956543938,
|
|
11616
|
+
2808555105,
|
|
11617
|
+
3495958263,
|
|
11618
|
+
1231636301,
|
|
11619
|
+
1047427035,
|
|
11620
|
+
2932959818,
|
|
11621
|
+
3654703836,
|
|
11622
|
+
1088359270,
|
|
11623
|
+
936918e3,
|
|
11624
|
+
2847714899,
|
|
11625
|
+
3736837829,
|
|
11626
|
+
1202900863,
|
|
11627
|
+
817233897,
|
|
11628
|
+
3183342108,
|
|
11629
|
+
3401237130,
|
|
11630
|
+
1404277552,
|
|
11631
|
+
615818150,
|
|
11632
|
+
3134207493,
|
|
11633
|
+
3453421203,
|
|
11634
|
+
1423857449,
|
|
11635
|
+
601450431,
|
|
11636
|
+
3009837614,
|
|
11637
|
+
3294710456,
|
|
11638
|
+
1567103746,
|
|
11639
|
+
711928724,
|
|
11640
|
+
3020668471,
|
|
11641
|
+
3272380065,
|
|
11642
|
+
1510334235,
|
|
11643
|
+
755167117
|
|
11644
|
+
]);
|
|
11645
|
+
function ensureBuffer(input) {
|
|
11646
|
+
if (Buffer2.isBuffer(input)) {
|
|
11647
|
+
return input;
|
|
11648
|
+
}
|
|
11649
|
+
if (typeof input === "number") {
|
|
11650
|
+
return Buffer2.alloc(input);
|
|
11651
|
+
} else if (typeof input === "string") {
|
|
11652
|
+
return Buffer2.from(input);
|
|
11653
|
+
} else {
|
|
11654
|
+
throw new Error("input must be buffer, number, or string, received " + typeof input);
|
|
11655
|
+
}
|
|
11656
|
+
}
|
|
11657
|
+
function bufferizeInt(num) {
|
|
11658
|
+
const tmp = ensureBuffer(4);
|
|
11659
|
+
tmp.writeInt32BE(num, 0);
|
|
11660
|
+
return tmp;
|
|
11661
|
+
}
|
|
11662
|
+
function _crc32(buf, previous) {
|
|
11663
|
+
buf = ensureBuffer(buf);
|
|
11664
|
+
if (Buffer2.isBuffer(previous)) {
|
|
11665
|
+
previous = previous.readUInt32BE(0);
|
|
11666
|
+
}
|
|
11667
|
+
let crc = ~~previous ^ -1;
|
|
11668
|
+
for (var n = 0; n < buf.length; n++) {
|
|
11669
|
+
crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
|
|
11670
|
+
}
|
|
11671
|
+
return crc ^ -1;
|
|
11672
|
+
}
|
|
11673
|
+
function crc32() {
|
|
11674
|
+
return bufferizeInt(_crc32.apply(null, arguments));
|
|
11675
|
+
}
|
|
11676
|
+
crc32.signed = function() {
|
|
11677
|
+
return _crc32.apply(null, arguments);
|
|
11678
|
+
};
|
|
11679
|
+
crc32.unsigned = function() {
|
|
11680
|
+
return _crc32.apply(null, arguments) >>> 0;
|
|
11681
|
+
};
|
|
11682
|
+
var bufferCrc32 = crc32;
|
|
11683
|
+
const index$2 = /* @__PURE__ */ getDefaultExportFromCjs(bufferCrc32);
|
|
11384
11684
|
function callOrGet(value, context = null, ...props) {
|
|
11385
11685
|
if (typeof value === "function") {
|
|
11386
11686
|
if (context) return value.bind(context)(...props);
|
|
@@ -15062,18 +15362,6 @@ const DEFAULT_CUSTOM_XML = {
|
|
|
15062
15362
|
}
|
|
15063
15363
|
]
|
|
15064
15364
|
};
|
|
15065
|
-
const SETTINGS_CUSTOM_XML = {
|
|
15066
|
-
elements: [
|
|
15067
|
-
{
|
|
15068
|
-
type: "element",
|
|
15069
|
-
name: "w:settings",
|
|
15070
|
-
attributes: {
|
|
15071
|
-
"xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
15072
|
-
},
|
|
15073
|
-
elements: []
|
|
15074
|
-
}
|
|
15075
|
-
]
|
|
15076
|
-
};
|
|
15077
15365
|
const COMMENT_REF = {
|
|
15078
15366
|
type: "element",
|
|
15079
15367
|
name: "w:r",
|
|
@@ -17410,15 +17698,15 @@ function canSplit(doc2, pos, depth = 1, typesAfter) {
|
|
|
17410
17698
|
if (base2 < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount)))
|
|
17411
17699
|
return false;
|
|
17412
17700
|
for (let d2 = $pos.depth - 1, i = depth - 2; d2 > base2; d2--, i--) {
|
|
17413
|
-
let node = $pos.node(d2),
|
|
17701
|
+
let node = $pos.node(d2), index3 = $pos.index(d2);
|
|
17414
17702
|
if (node.type.spec.isolating)
|
|
17415
17703
|
return false;
|
|
17416
|
-
let rest = node.content.cutByIndex(
|
|
17704
|
+
let rest = node.content.cutByIndex(index3, node.childCount);
|
|
17417
17705
|
let overrideChild = typesAfter && typesAfter[i + 1];
|
|
17418
17706
|
if (overrideChild)
|
|
17419
17707
|
rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
|
|
17420
17708
|
let after = typesAfter && typesAfter[i] || node;
|
|
17421
|
-
if (!node.canReplace(
|
|
17709
|
+
if (!node.canReplace(index3 + 1, node.childCount) || !after.type.validContent(rest))
|
|
17422
17710
|
return false;
|
|
17423
17711
|
}
|
|
17424
17712
|
let index2 = $pos.indexAfter(base2);
|
|
@@ -30157,7 +30445,7 @@ function requireHe() {
|
|
|
30157
30445
|
return he$2.exports;
|
|
30158
30446
|
}
|
|
30159
30447
|
var heExports = requireHe();
|
|
30160
|
-
const he = /* @__PURE__ */ getDefaultExportFromCjs$
|
|
30448
|
+
const he = /* @__PURE__ */ getDefaultExportFromCjs$2(heExports);
|
|
30161
30449
|
function translateFieldAnnotation(params2) {
|
|
30162
30450
|
const { node, isFinalDoc, fieldsHighlightColor } = params2;
|
|
30163
30451
|
const { attrs = {} } = node;
|
|
@@ -33322,7 +33610,7 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
33322
33610
|
fileType: filePath.split(".").pop()
|
|
33323
33611
|
};
|
|
33324
33612
|
});
|
|
33325
|
-
converter.telemetry.trackFileStructure(
|
|
33613
|
+
const trackStructure = (documentIdentifier = null) => converter.telemetry.trackFileStructure(
|
|
33326
33614
|
{
|
|
33327
33615
|
totalFiles: files.length,
|
|
33328
33616
|
maxDepth: Math.max(...files.map((f) => f.fileDepth)),
|
|
@@ -33330,9 +33618,20 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
33330
33618
|
files
|
|
33331
33619
|
},
|
|
33332
33620
|
converter.fileSource,
|
|
33333
|
-
converter.documentId,
|
|
33621
|
+
converter.documentGuid ?? converter.documentId ?? null,
|
|
33622
|
+
documentIdentifier ?? converter.documentId ?? null,
|
|
33334
33623
|
converter.documentInternalId
|
|
33335
33624
|
);
|
|
33625
|
+
try {
|
|
33626
|
+
const identifierResult = converter.getDocumentIdentifier?.();
|
|
33627
|
+
if (identifierResult && typeof identifierResult.then === "function") {
|
|
33628
|
+
identifierResult.then(trackStructure).catch(() => trackStructure());
|
|
33629
|
+
} else {
|
|
33630
|
+
trackStructure(identifierResult);
|
|
33631
|
+
}
|
|
33632
|
+
} catch (error) {
|
|
33633
|
+
trackStructure();
|
|
33634
|
+
}
|
|
33336
33635
|
}
|
|
33337
33636
|
const nodeListHandler = defaultNodeListHandler();
|
|
33338
33637
|
const bodyNode = json.elements[0].elements.find((el) => el.name === "w:body");
|
|
@@ -33883,6 +34182,9 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
33883
34182
|
this.documentInternalId = null;
|
|
33884
34183
|
this.fileSource = params2?.fileSource || null;
|
|
33885
34184
|
this.documentId = params2?.documentId || null;
|
|
34185
|
+
this.documentGuid = null;
|
|
34186
|
+
this.documentHash = null;
|
|
34187
|
+
this.documentModified = false;
|
|
33886
34188
|
if (this.docx.length || this.xml) this.parseFromXml();
|
|
33887
34189
|
}
|
|
33888
34190
|
static getFontTableEntry(docx, fontName) {
|
|
@@ -33930,50 +34232,177 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
33930
34232
|
this.initialJSON = this.convertedXml["word/document.xml"];
|
|
33931
34233
|
if (!this.initialJSON) this.initialJSON = this.parseXmlToJson(this.xml);
|
|
33932
34234
|
this.declaration = this.initialJSON?.declaration;
|
|
34235
|
+
this.resolveDocumentGuid();
|
|
33933
34236
|
}
|
|
33934
34237
|
parseXmlToJson(xml) {
|
|
33935
34238
|
const newXml = xml.replace(/(<w:t xml:space="preserve">)(\s+)(<\/w:t>)/g, "$1[[sdspace]]$2[[sdspace]]$3");
|
|
33936
34239
|
return JSON.parse(xmljs.xml2json(newXml, null, 2));
|
|
33937
34240
|
}
|
|
33938
|
-
|
|
34241
|
+
/**
|
|
34242
|
+
* Generic method to get a stored custom property from docx
|
|
34243
|
+
* @static
|
|
34244
|
+
* @param {Array} docx - Array of docx file objects
|
|
34245
|
+
* @param {string} propertyName - Name of the property to retrieve
|
|
34246
|
+
* @returns {string|null} The property value or null if not found
|
|
34247
|
+
*/
|
|
34248
|
+
static getStoredCustomProperty(docx, propertyName) {
|
|
33939
34249
|
try {
|
|
33940
34250
|
const customXml = docx.find((doc2) => doc2.name === "docProps/custom.xml");
|
|
33941
|
-
if (!customXml) return;
|
|
34251
|
+
if (!customXml) return null;
|
|
33942
34252
|
const converter = new _SuperConverter2();
|
|
33943
34253
|
const content = customXml.content;
|
|
33944
34254
|
const contentJson = converter.parseXmlToJson(content);
|
|
33945
34255
|
const properties = contentJson.elements.find((el) => el.name === "Properties");
|
|
33946
|
-
if (!properties.elements) return;
|
|
33947
|
-
const
|
|
33948
|
-
|
|
33949
|
-
|
|
33950
|
-
if (!superdocVersion) return;
|
|
33951
|
-
const version2 = superdocVersion.elements[0].elements[0].text;
|
|
33952
|
-
return version2;
|
|
34256
|
+
if (!properties.elements) return null;
|
|
34257
|
+
const property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
|
|
34258
|
+
if (!property2) return null;
|
|
34259
|
+
return property2.elements[0].elements[0].text;
|
|
33953
34260
|
} catch (e) {
|
|
33954
|
-
console.warn(
|
|
33955
|
-
return;
|
|
34261
|
+
console.warn(`Error getting custom property ${propertyName}:`, e);
|
|
34262
|
+
return null;
|
|
33956
34263
|
}
|
|
33957
34264
|
}
|
|
33958
|
-
|
|
34265
|
+
/**
|
|
34266
|
+
* Generic method to set a stored custom property in docx
|
|
34267
|
+
* @static
|
|
34268
|
+
* @param {Object} docx - The docx object to store the property in
|
|
34269
|
+
* @param {string} propertyName - Name of the property
|
|
34270
|
+
* @param {string|Function} value - Value or function that returns the value
|
|
34271
|
+
* @param {boolean} preserveExisting - If true, won't overwrite existing values
|
|
34272
|
+
* @returns {string} The stored value
|
|
34273
|
+
*/
|
|
34274
|
+
static setStoredCustomProperty(docx, propertyName, value, preserveExisting = false) {
|
|
33959
34275
|
const customLocation = "docProps/custom.xml";
|
|
33960
|
-
if (!docx[customLocation])
|
|
33961
|
-
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
if (!customXml) return;
|
|
33965
|
-
const properties = customXml.elements.find((el) => el.name === "Properties");
|
|
34276
|
+
if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
|
|
34277
|
+
const customXml = docx[customLocation];
|
|
34278
|
+
const properties = customXml.elements?.find((el) => el.name === "Properties");
|
|
34279
|
+
if (!properties) return null;
|
|
33966
34280
|
if (!properties.elements) properties.elements = [];
|
|
33967
|
-
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
|
|
33971
|
-
|
|
33972
|
-
|
|
34281
|
+
let property2 = properties.elements.find((el) => el.name === "property" && el.attributes.name === propertyName);
|
|
34282
|
+
if (property2 && preserveExisting) {
|
|
34283
|
+
return property2.elements[0].elements[0].text;
|
|
34284
|
+
}
|
|
34285
|
+
const finalValue = typeof value === "function" ? value() : value;
|
|
34286
|
+
if (!property2) {
|
|
34287
|
+
const existingPids = properties.elements.filter((el) => el.attributes?.pid).map((el) => parseInt(el.attributes.pid, 10)).filter(Number.isInteger);
|
|
34288
|
+
const pid = existingPids.length > 0 ? Math.max(...existingPids) + 1 : 2;
|
|
34289
|
+
property2 = {
|
|
34290
|
+
type: "element",
|
|
34291
|
+
name: "property",
|
|
34292
|
+
attributes: {
|
|
34293
|
+
name: propertyName,
|
|
34294
|
+
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
|
|
34295
|
+
pid
|
|
34296
|
+
},
|
|
34297
|
+
elements: [
|
|
34298
|
+
{
|
|
34299
|
+
type: "element",
|
|
34300
|
+
name: "vt:lpwstr",
|
|
34301
|
+
elements: [
|
|
34302
|
+
{
|
|
34303
|
+
type: "text",
|
|
34304
|
+
text: finalValue
|
|
34305
|
+
}
|
|
34306
|
+
]
|
|
34307
|
+
}
|
|
34308
|
+
]
|
|
34309
|
+
};
|
|
34310
|
+
properties.elements.push(property2);
|
|
33973
34311
|
} else {
|
|
33974
|
-
|
|
34312
|
+
property2.elements[0].elements[0].text = finalValue;
|
|
34313
|
+
}
|
|
34314
|
+
return finalValue;
|
|
34315
|
+
}
|
|
34316
|
+
static getStoredSuperdocVersion(docx) {
|
|
34317
|
+
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
34318
|
+
}
|
|
34319
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.22.0") {
|
|
34320
|
+
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
34321
|
+
}
|
|
34322
|
+
/**
|
|
34323
|
+
* Get document GUID from docx files (static method)
|
|
34324
|
+
* @static
|
|
34325
|
+
* @param {Array} docx - Array of docx file objects
|
|
34326
|
+
* @returns {string|null} The document GUID
|
|
34327
|
+
*/
|
|
34328
|
+
static extractDocumentGuid(docx) {
|
|
34329
|
+
try {
|
|
34330
|
+
const settingsXml = docx.find((doc2) => doc2.name === "word/settings.xml");
|
|
34331
|
+
if (!settingsXml) return null;
|
|
34332
|
+
const converter = new _SuperConverter2();
|
|
34333
|
+
const settingsJson = converter.parseXmlToJson(settingsXml.content);
|
|
34334
|
+
const settings = settingsJson.elements?.[0];
|
|
34335
|
+
if (!settings) return null;
|
|
34336
|
+
const docIdElement = settings.elements?.find((el) => el.name === "w15:docId");
|
|
34337
|
+
if (docIdElement?.attributes?.["w15:val"]) {
|
|
34338
|
+
return docIdElement.attributes["w15:val"].replace(/[{}]/g, "");
|
|
34339
|
+
}
|
|
34340
|
+
} catch {
|
|
34341
|
+
}
|
|
34342
|
+
return _SuperConverter2.getStoredCustomProperty(docx, "DocumentGuid");
|
|
34343
|
+
}
|
|
34344
|
+
/**
|
|
34345
|
+
* Get the permanent document GUID
|
|
34346
|
+
* @returns {string|null} The document GUID (only for modified documents)
|
|
34347
|
+
*/
|
|
34348
|
+
getDocumentGuid() {
|
|
34349
|
+
return this.documentGuid;
|
|
34350
|
+
}
|
|
34351
|
+
/**
|
|
34352
|
+
* Get the SuperDoc version for this converter instance
|
|
34353
|
+
* @returns {string|null} The SuperDoc version or null if not available
|
|
34354
|
+
*/
|
|
34355
|
+
getSuperdocVersion() {
|
|
34356
|
+
if (this.docx) {
|
|
34357
|
+
return _SuperConverter2.getStoredSuperdocVersion(this.docx);
|
|
34358
|
+
}
|
|
34359
|
+
return null;
|
|
34360
|
+
}
|
|
34361
|
+
/**
|
|
34362
|
+
* Resolve existing document GUID (synchronous)
|
|
34363
|
+
*/
|
|
34364
|
+
resolveDocumentGuid() {
|
|
34365
|
+
const microsoftGuid = this.getMicrosoftDocId();
|
|
34366
|
+
if (microsoftGuid) {
|
|
34367
|
+
this.documentGuid = microsoftGuid;
|
|
34368
|
+
return;
|
|
34369
|
+
}
|
|
34370
|
+
const customGuid = _SuperConverter2.getStoredCustomProperty(this.docx, "DocumentGuid");
|
|
34371
|
+
if (customGuid) {
|
|
34372
|
+
this.documentGuid = customGuid;
|
|
34373
|
+
}
|
|
34374
|
+
}
|
|
34375
|
+
/**
|
|
34376
|
+
* Get Microsoft's docId from settings.xml (READ ONLY)
|
|
34377
|
+
*/
|
|
34378
|
+
getMicrosoftDocId() {
|
|
34379
|
+
this.getDocumentInternalId();
|
|
34380
|
+
if (this.documentInternalId) {
|
|
34381
|
+
return this.documentInternalId.replace(/[{}]/g, "");
|
|
34382
|
+
}
|
|
34383
|
+
return null;
|
|
34384
|
+
}
|
|
34385
|
+
/**
|
|
34386
|
+
* Get document identifier (GUID or hash) - async for lazy hash generation
|
|
34387
|
+
*/
|
|
34388
|
+
async getDocumentIdentifier() {
|
|
34389
|
+
if (this.documentGuid) {
|
|
34390
|
+
return this.documentGuid;
|
|
34391
|
+
}
|
|
34392
|
+
if (!this.documentHash && this.fileSource) {
|
|
34393
|
+
this.documentHash = await __privateMethod$2(this, _SuperConverter_instances, generateDocumentHash_fn).call(this);
|
|
33975
34394
|
}
|
|
33976
|
-
return
|
|
34395
|
+
return this.documentHash;
|
|
34396
|
+
}
|
|
34397
|
+
/**
|
|
34398
|
+
* Promote from hash to GUID on first edit
|
|
34399
|
+
*/
|
|
34400
|
+
promoteToGuid() {
|
|
34401
|
+
if (this.documentGuid) return this.documentGuid;
|
|
34402
|
+
this.documentGuid = this.getMicrosoftDocId() || v4();
|
|
34403
|
+
this.documentModified = true;
|
|
34404
|
+
this.documentHash = null;
|
|
34405
|
+
return this.documentGuid;
|
|
33977
34406
|
}
|
|
33978
34407
|
getDocumentDefaultStyles() {
|
|
33979
34408
|
const styles = this.convertedXml["word/styles.xml"];
|
|
@@ -34062,20 +34491,14 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
34062
34491
|
getDocumentInternalId() {
|
|
34063
34492
|
const settingsLocation = "word/settings.xml";
|
|
34064
34493
|
if (!this.convertedXml[settingsLocation]) {
|
|
34065
|
-
|
|
34494
|
+
return;
|
|
34066
34495
|
}
|
|
34067
|
-
const settings =
|
|
34068
|
-
if (!settings.elements[0]?.elements?.length) {
|
|
34069
|
-
const idElement = this.createDocumentIdElement(settings);
|
|
34070
|
-
settings.elements[0].elements = [idElement];
|
|
34071
|
-
if (!settings.elements[0].attributes["xmlns:w15"]) {
|
|
34072
|
-
settings.elements[0].attributes["xmlns:w15"] = "http://schemas.microsoft.com/office/word/2012/wordml";
|
|
34073
|
-
}
|
|
34074
|
-
this.convertedXml[settingsLocation] = settings;
|
|
34496
|
+
const settings = this.convertedXml[settingsLocation];
|
|
34497
|
+
if (!settings.elements?.[0]?.elements?.length) {
|
|
34075
34498
|
return;
|
|
34076
34499
|
}
|
|
34077
34500
|
const w15DocId = settings.elements[0].elements.find((el) => el.name === "w15:docId");
|
|
34078
|
-
this.documentInternalId = w15DocId?.attributes["w15:val"];
|
|
34501
|
+
this.documentInternalId = w15DocId?.attributes?.["w15:val"];
|
|
34079
34502
|
}
|
|
34080
34503
|
createDocumentIdElement() {
|
|
34081
34504
|
const docId = v4().toUpperCase();
|
|
@@ -34164,7 +34587,13 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
34164
34587
|
this.convertedXml = { ...this.convertedXml, ...updatedXml };
|
|
34165
34588
|
const headFootRels = __privateMethod$2(this, _SuperConverter_instances, exportProcessHeadersFooters_fn).call(this, { isFinalDoc });
|
|
34166
34589
|
__privateMethod$2(this, _SuperConverter_instances, exportProcessNewRelationships_fn).call(this, [...params2.relationships, ...commentsRels, ...headFootRels]);
|
|
34167
|
-
|
|
34590
|
+
_SuperConverter2.setStoredSuperdocVersion(this.convertedXml);
|
|
34591
|
+
if (this.documentModified || this.documentGuid) {
|
|
34592
|
+
if (!this.documentGuid) {
|
|
34593
|
+
this.documentGuid = this.getMicrosoftDocId() || v4();
|
|
34594
|
+
}
|
|
34595
|
+
_SuperConverter2.setStoredCustomProperty(this.convertedXml, "DocumentGuid", this.documentGuid, true);
|
|
34596
|
+
}
|
|
34168
34597
|
__privateMethod$2(this, _SuperConverter_instances, exportNumberingFile_fn).call(this, params2);
|
|
34169
34598
|
return xml;
|
|
34170
34599
|
}
|
|
@@ -34199,8 +34628,38 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
34199
34628
|
});
|
|
34200
34629
|
return { result, params: params2 };
|
|
34201
34630
|
}
|
|
34631
|
+
// Deprecated methods for backward compatibility
|
|
34632
|
+
static getStoredSuperdocId(docx) {
|
|
34633
|
+
console.warn("getStoredSuperdocId is deprecated, use getDocumentGuid instead");
|
|
34634
|
+
return _SuperConverter2.extractDocumentGuid(docx);
|
|
34635
|
+
}
|
|
34636
|
+
static updateDocumentVersion(docx, version2) {
|
|
34637
|
+
console.warn("updateDocumentVersion is deprecated, use setStoredSuperdocVersion instead");
|
|
34638
|
+
return _SuperConverter2.setStoredSuperdocVersion(docx, version2);
|
|
34639
|
+
}
|
|
34202
34640
|
};
|
|
34203
34641
|
_SuperConverter_instances = /* @__PURE__ */ new WeakSet();
|
|
34642
|
+
generateDocumentHash_fn = async function() {
|
|
34643
|
+
if (!this.fileSource) return `HASH-${Date.now()}`;
|
|
34644
|
+
try {
|
|
34645
|
+
let buffer2;
|
|
34646
|
+
if (Buffer2.isBuffer(this.fileSource)) {
|
|
34647
|
+
buffer2 = this.fileSource;
|
|
34648
|
+
} else if (this.fileSource instanceof ArrayBuffer) {
|
|
34649
|
+
buffer2 = Buffer2.from(this.fileSource);
|
|
34650
|
+
} else if (this.fileSource instanceof Blob || this.fileSource instanceof File) {
|
|
34651
|
+
const arrayBuffer = await this.fileSource.arrayBuffer();
|
|
34652
|
+
buffer2 = Buffer2.from(arrayBuffer);
|
|
34653
|
+
} else {
|
|
34654
|
+
return `HASH-${Date.now()}`;
|
|
34655
|
+
}
|
|
34656
|
+
const hash2 = index$2(buffer2);
|
|
34657
|
+
return `HASH-${hash2.toString("hex").toUpperCase()}`;
|
|
34658
|
+
} catch (e) {
|
|
34659
|
+
console.warn("Could not generate document hash:", e);
|
|
34660
|
+
return `HASH-${Date.now()}`;
|
|
34661
|
+
}
|
|
34662
|
+
};
|
|
34204
34663
|
exportNumberingFile_fn = function() {
|
|
34205
34664
|
const numberingPath = "word/numbering.xml";
|
|
34206
34665
|
let numberingXml = this.convertedXml[numberingPath];
|
|
@@ -34421,52 +34880,9 @@ __publicField$2(_SuperConverter, "propertyTypes", Object.freeze({
|
|
|
34421
34880
|
}));
|
|
34422
34881
|
__publicField$2(_SuperConverter, "elements", /* @__PURE__ */ new Set(["w:document", "w:body", "w:p", "w:r", "w:t", "w:delText"]));
|
|
34423
34882
|
let SuperConverter = _SuperConverter;
|
|
34424
|
-
function storeSuperdocVersion(docx) {
|
|
34425
|
-
const customLocation = "docProps/custom.xml";
|
|
34426
|
-
if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
|
|
34427
|
-
const customXml = docx[customLocation];
|
|
34428
|
-
const properties = customXml.elements.find((el) => el.name === "Properties");
|
|
34429
|
-
if (!properties.elements) properties.elements = [];
|
|
34430
|
-
const elements = properties.elements;
|
|
34431
|
-
const cleanProperties = elements.filter((prop) => typeof prop === "object" && prop !== null).filter((prop) => {
|
|
34432
|
-
const { attributes } = prop;
|
|
34433
|
-
return attributes.name !== "SuperdocVersion";
|
|
34434
|
-
});
|
|
34435
|
-
let pid = 2;
|
|
34436
|
-
try {
|
|
34437
|
-
pid = cleanProperties.length ? Math.max(...elements.map((el) => el.attributes.pid)) + 1 : 2;
|
|
34438
|
-
} catch {
|
|
34439
|
-
}
|
|
34440
|
-
cleanProperties.push(generateSuperdocVersion(pid));
|
|
34441
|
-
properties.elements = cleanProperties;
|
|
34442
|
-
return docx;
|
|
34443
|
-
}
|
|
34444
34883
|
function generateCustomXml() {
|
|
34445
34884
|
return DEFAULT_CUSTOM_XML;
|
|
34446
34885
|
}
|
|
34447
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.22.0") {
|
|
34448
|
-
return {
|
|
34449
|
-
type: "element",
|
|
34450
|
-
name: "property",
|
|
34451
|
-
attributes: {
|
|
34452
|
-
name: "SuperdocVersion",
|
|
34453
|
-
fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
|
|
34454
|
-
pid
|
|
34455
|
-
},
|
|
34456
|
-
elements: [
|
|
34457
|
-
{
|
|
34458
|
-
type: "element",
|
|
34459
|
-
name: "vt:lpwstr",
|
|
34460
|
-
elements: [
|
|
34461
|
-
{
|
|
34462
|
-
type: "text",
|
|
34463
|
-
text: version2
|
|
34464
|
-
}
|
|
34465
|
-
]
|
|
34466
|
-
}
|
|
34467
|
-
]
|
|
34468
|
-
};
|
|
34469
|
-
}
|
|
34470
34886
|
function commonjsRequire(path) {
|
|
34471
34887
|
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.');
|
|
34472
34888
|
}
|
|
@@ -36782,7 +37198,7 @@ function requireJszip_min() {
|
|
|
36782
37198
|
return jszip_min.exports;
|
|
36783
37199
|
}
|
|
36784
37200
|
var jszip_minExports = requireJszip_min();
|
|
36785
|
-
const JSZip = /* @__PURE__ */ getDefaultExportFromCjs$
|
|
37201
|
+
const JSZip = /* @__PURE__ */ getDefaultExportFromCjs$2(jszip_minExports);
|
|
36786
37202
|
const isXmlLike = (name) => /\.xml$|\.rels$/i.test(name);
|
|
36787
37203
|
function sniffEncoding(u8) {
|
|
36788
37204
|
if (u8.length >= 2) {
|
|
@@ -46737,15 +47153,39 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
|
|
|
46737
47153
|
if (near) {
|
|
46738
47154
|
const isSameAsTarget = nearKind === targetKind;
|
|
46739
47155
|
if (isSameAsTarget) {
|
|
46740
|
-
const {
|
|
46741
|
-
|
|
46742
|
-
|
|
46743
|
-
|
|
46744
|
-
|
|
46745
|
-
|
|
46746
|
-
|
|
46747
|
-
|
|
46748
|
-
|
|
47156
|
+
const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
|
|
47157
|
+
let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
|
|
47158
|
+
if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
|
|
47159
|
+
listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
|
|
47160
|
+
}
|
|
47161
|
+
if (listsToUnwrap.length === 0) return false;
|
|
47162
|
+
let spanFromBefore2 = listsToUnwrap[0].pos;
|
|
47163
|
+
let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
|
|
47164
|
+
for (let i = 1; i < listsToUnwrap.length; i++) {
|
|
47165
|
+
const { node, pos: pos2 } = listsToUnwrap[i];
|
|
47166
|
+
spanFromBefore2 = Math.min(spanFromBefore2, pos2);
|
|
47167
|
+
spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
|
|
47168
|
+
}
|
|
47169
|
+
const ParagraphType = editor.schema.nodes.paragraph;
|
|
47170
|
+
listsToUnwrap.sort((a, b2) => b2.pos - a.pos);
|
|
47171
|
+
for (const { node, pos: pos2 } of listsToUnwrap) {
|
|
47172
|
+
const mappedFrom = tr.mapping.map(pos2, -1);
|
|
47173
|
+
const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
|
|
47174
|
+
const currentListNode = tr.doc.nodeAt(mappedFrom);
|
|
47175
|
+
const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
|
|
47176
|
+
const paragraphs = [];
|
|
47177
|
+
for (let i = 0; i < sourceListNode.childCount; i++) {
|
|
47178
|
+
const li = sourceListNode.child(i);
|
|
47179
|
+
if (li.type !== editor.schema.nodes.listItem) continue;
|
|
47180
|
+
const firstChild = li.firstChild;
|
|
47181
|
+
paragraphs.push(firstChild || ParagraphType.create());
|
|
47182
|
+
}
|
|
47183
|
+
if (paragraphs.length === 0) {
|
|
47184
|
+
paragraphs.push(ParagraphType.create());
|
|
47185
|
+
}
|
|
47186
|
+
const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
|
|
47187
|
+
tr.replaceWith(mappedFrom, mappedTo, replacement);
|
|
47188
|
+
}
|
|
46749
47189
|
setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
|
|
46750
47190
|
if (dispatch) dispatch(tr);
|
|
46751
47191
|
return true;
|
|
@@ -51542,19 +51982,34 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51542
51982
|
* @returns {string} Document version
|
|
51543
51983
|
*/
|
|
51544
51984
|
static getDocumentVersion(doc2) {
|
|
51545
|
-
|
|
51546
|
-
return version2;
|
|
51985
|
+
return SuperConverter.getStoredSuperdocVersion(doc2);
|
|
51547
51986
|
}
|
|
51548
51987
|
/**
|
|
51549
|
-
*
|
|
51988
|
+
* Set the document version
|
|
51550
51989
|
* @static
|
|
51551
51990
|
* @param {Object} doc - Document object
|
|
51552
51991
|
* @param {string} version - New version
|
|
51553
|
-
* @returns {
|
|
51992
|
+
* @returns {string} The set version
|
|
51993
|
+
*/
|
|
51994
|
+
static setDocumentVersion(doc2, version2) {
|
|
51995
|
+
return SuperConverter.setStoredSuperdocVersion(doc2, version2);
|
|
51996
|
+
}
|
|
51997
|
+
/**
|
|
51998
|
+
* Get the document GUID
|
|
51999
|
+
* @static
|
|
52000
|
+
* @param {Object} doc - Document object
|
|
52001
|
+
* @returns {string|null} Document GUID
|
|
52002
|
+
*/
|
|
52003
|
+
static getDocumentGuid(doc2) {
|
|
52004
|
+
return SuperConverter.extractDocumentGuid(doc2);
|
|
52005
|
+
}
|
|
52006
|
+
// Deprecated
|
|
52007
|
+
/**
|
|
52008
|
+
* @deprecated use setDocumentVersion instead
|
|
51554
52009
|
*/
|
|
51555
52010
|
static updateDocumentVersion(doc2, version2) {
|
|
51556
|
-
|
|
51557
|
-
return
|
|
52011
|
+
console.warn("updateDocumentVersion is deprecated, use setDocumentVersion instead");
|
|
52012
|
+
return _Editor2.setDocumentVersion(doc2, version2);
|
|
51558
52013
|
}
|
|
51559
52014
|
/**
|
|
51560
52015
|
* Creates all node views.
|
|
@@ -51690,6 +52145,43 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51690
52145
|
}
|
|
51691
52146
|
window.addEventListener("resize", () => handleResize);
|
|
51692
52147
|
}
|
|
52148
|
+
/**
|
|
52149
|
+
* Get document identifier for telemetry (async - may generate hash)
|
|
52150
|
+
* @returns {Promise<string>} GUID for modified docs, hash for unmodified
|
|
52151
|
+
*/
|
|
52152
|
+
async getDocumentIdentifier() {
|
|
52153
|
+
return await this.converter?.getDocumentIdentifier() || null;
|
|
52154
|
+
}
|
|
52155
|
+
/**
|
|
52156
|
+
* Get permanent document GUID (sync - only for modified documents)
|
|
52157
|
+
* @returns {string|null} GUID or null if document hasn't been modified
|
|
52158
|
+
*/
|
|
52159
|
+
getDocumentGuid() {
|
|
52160
|
+
return this.converter?.documentGuid || null;
|
|
52161
|
+
}
|
|
52162
|
+
/**
|
|
52163
|
+
* Check if document has been modified
|
|
52164
|
+
* @returns {boolean}
|
|
52165
|
+
*/
|
|
52166
|
+
isDocumentModified() {
|
|
52167
|
+
return this.converter?.documentModified || false;
|
|
52168
|
+
}
|
|
52169
|
+
/**
|
|
52170
|
+
* Get telemetry data (async because of lazy hash generation)
|
|
52171
|
+
*/
|
|
52172
|
+
async getTelemetryData() {
|
|
52173
|
+
return {
|
|
52174
|
+
documentId: await this.getDocumentIdentifier(),
|
|
52175
|
+
isModified: this.isDocumentModified(),
|
|
52176
|
+
isPermanentId: !!this.converter?.documentGuid,
|
|
52177
|
+
version: this.converter?.getSuperdocVersion()
|
|
52178
|
+
};
|
|
52179
|
+
}
|
|
52180
|
+
// Deprecated for backward compatibility
|
|
52181
|
+
getDocumentId() {
|
|
52182
|
+
console.warn("getDocumentId is deprecated, use getDocumentGuid instead");
|
|
52183
|
+
return this.getDocumentGuid();
|
|
52184
|
+
}
|
|
51693
52185
|
/**
|
|
51694
52186
|
* Get attrs of the currently selected node or mark.
|
|
51695
52187
|
* @param {String} nameOrType
|
|
@@ -51721,6 +52213,21 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51721
52213
|
getJSON() {
|
|
51722
52214
|
return this.state.doc.toJSON();
|
|
51723
52215
|
}
|
|
52216
|
+
/**
|
|
52217
|
+
* Get document metadata including GUID, modification status, and version
|
|
52218
|
+
* @returns {{
|
|
52219
|
+
* documentGuid: string | null,
|
|
52220
|
+
* isModified: boolean,
|
|
52221
|
+
* version: string | null
|
|
52222
|
+
* }} Document metadata
|
|
52223
|
+
*/
|
|
52224
|
+
getMetadata() {
|
|
52225
|
+
return {
|
|
52226
|
+
documentGuid: this.converter?.documentGuid || null,
|
|
52227
|
+
isModified: this.isDocumentModified(),
|
|
52228
|
+
version: this.converter?.getSuperdocVersion() || null
|
|
52229
|
+
};
|
|
52230
|
+
}
|
|
51724
52231
|
/**
|
|
51725
52232
|
* Get the editor content as HTML
|
|
51726
52233
|
* @param {Object} options - Options for the HTML serializer
|
|
@@ -51738,6 +52245,13 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51738
52245
|
}
|
|
51739
52246
|
return html;
|
|
51740
52247
|
}
|
|
52248
|
+
/**
|
|
52249
|
+
* Get the document version from the converter
|
|
52250
|
+
* @returns {string|null} The SuperDoc version stored in the document
|
|
52251
|
+
*/
|
|
52252
|
+
getDocumentVersion() {
|
|
52253
|
+
return this.converter?.getSuperdocVersion() || null;
|
|
52254
|
+
}
|
|
51741
52255
|
/**
|
|
51742
52256
|
* Create a child editor linked to this editor.
|
|
51743
52257
|
* This is useful for creating header/footer editors that are linked to the main editor.
|
|
@@ -51820,7 +52334,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51820
52334
|
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
51821
52335
|
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
51822
52336
|
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
51823
|
-
const
|
|
52337
|
+
const hasCustomSettings = !!this.converter.convertedXml["word/settings.xml"]?.elements?.length;
|
|
52338
|
+
const customSettings = hasCustomSettings ? this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"]?.elements?.[0]) : null;
|
|
51824
52339
|
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
51825
52340
|
const media = this.converter.addedMedia;
|
|
51826
52341
|
const updatedHeadersFooters = {};
|
|
@@ -51836,13 +52351,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51836
52351
|
...this.options.customUpdatedFiles,
|
|
51837
52352
|
"word/document.xml": String(documentXml),
|
|
51838
52353
|
"docProps/custom.xml": String(customXml),
|
|
51839
|
-
"word/settings.xml": String(customSettings),
|
|
51840
52354
|
"word/_rels/document.xml.rels": String(rels),
|
|
51841
52355
|
"word/numbering.xml": String(numbering),
|
|
51842
52356
|
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
51843
52357
|
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
51844
52358
|
...updatedHeadersFooters
|
|
51845
52359
|
};
|
|
52360
|
+
if (hasCustomSettings) {
|
|
52361
|
+
updatedDocs["word/settings.xml"] = String(customSettings);
|
|
52362
|
+
}
|
|
51846
52363
|
if (comments.length) {
|
|
51847
52364
|
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
51848
52365
|
const commentsExtendedXml = this.converter.schemaToXml(
|
|
@@ -52462,6 +52979,13 @@ dispatchTransaction_fn = function(transaction) {
|
|
|
52462
52979
|
if (!transaction.docChanged) {
|
|
52463
52980
|
return;
|
|
52464
52981
|
}
|
|
52982
|
+
if (transaction.docChanged && this.converter) {
|
|
52983
|
+
if (!this.converter.documentGuid) {
|
|
52984
|
+
this.converter.promoteToGuid();
|
|
52985
|
+
console.debug("Document modified - assigned GUID:", this.converter.documentGuid);
|
|
52986
|
+
}
|
|
52987
|
+
this.converter.documentModified = true;
|
|
52988
|
+
}
|
|
52465
52989
|
this.emit("update", {
|
|
52466
52990
|
editor: this,
|
|
52467
52991
|
transaction
|
|
@@ -82095,7 +82619,7 @@ function requireEventemitter3() {
|
|
|
82095
82619
|
return eventemitter3.exports;
|
|
82096
82620
|
}
|
|
82097
82621
|
var eventemitter3Exports = requireEventemitter3();
|
|
82098
|
-
const EventEmitter2 = /* @__PURE__ */ getDefaultExportFromCjs$
|
|
82622
|
+
const EventEmitter2 = /* @__PURE__ */ getDefaultExportFromCjs$2(eventemitter3Exports);
|
|
82099
82623
|
const useToolbarItem = (options) => {
|
|
82100
82624
|
const types2 = ["button", "options", "separator", "dropdown", "overflow"];
|
|
82101
82625
|
if (!types2.includes(options.type)) {
|