@superdoc-dev/cli 0.2.0-next.90 → 0.2.0-next.91
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/index.js +287 -178
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -33254,7 +33254,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
33254
33254
|
emptyOptions2 = {};
|
|
33255
33255
|
});
|
|
33256
33256
|
|
|
33257
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
33257
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-CU5DAsJr.es.js
|
|
33258
33258
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
33259
33259
|
const fieldValue = extension$1.config[field];
|
|
33260
33260
|
if (typeof fieldValue === "function")
|
|
@@ -47666,6 +47666,144 @@ function remarkParse(options) {
|
|
|
47666
47666
|
function parseMarkdownToAst(markdown) {
|
|
47667
47667
|
return unified().use(remarkParse).use(remarkGfm).parse(markdown);
|
|
47668
47668
|
}
|
|
47669
|
+
function readImageDimensions(bytes) {
|
|
47670
|
+
if (!(bytes instanceof Uint8Array) || bytes.length < 12)
|
|
47671
|
+
return null;
|
|
47672
|
+
if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) {
|
|
47673
|
+
if (bytes.length < 24)
|
|
47674
|
+
return null;
|
|
47675
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
47676
|
+
const width = view.getInt32(16);
|
|
47677
|
+
const height = view.getInt32(20);
|
|
47678
|
+
if (width > 0 && height > 0)
|
|
47679
|
+
return {
|
|
47680
|
+
width,
|
|
47681
|
+
height
|
|
47682
|
+
};
|
|
47683
|
+
return null;
|
|
47684
|
+
}
|
|
47685
|
+
if (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255)
|
|
47686
|
+
return readJpegDimensions(bytes);
|
|
47687
|
+
if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 56) {
|
|
47688
|
+
if (bytes.length < 10)
|
|
47689
|
+
return null;
|
|
47690
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
47691
|
+
const width = view.getUint16(6, true);
|
|
47692
|
+
const height = view.getUint16(8, true);
|
|
47693
|
+
if (width > 0 && height > 0)
|
|
47694
|
+
return {
|
|
47695
|
+
width,
|
|
47696
|
+
height
|
|
47697
|
+
};
|
|
47698
|
+
return null;
|
|
47699
|
+
}
|
|
47700
|
+
if (bytes[0] === 66 && bytes[1] === 77) {
|
|
47701
|
+
if (bytes.length < 26)
|
|
47702
|
+
return null;
|
|
47703
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
47704
|
+
const width = view.getInt32(18, true);
|
|
47705
|
+
const height = Math.abs(view.getInt32(22, true));
|
|
47706
|
+
if (width > 0 && height > 0)
|
|
47707
|
+
return {
|
|
47708
|
+
width,
|
|
47709
|
+
height
|
|
47710
|
+
};
|
|
47711
|
+
return null;
|
|
47712
|
+
}
|
|
47713
|
+
if (bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80)
|
|
47714
|
+
return readWebpDimensions(bytes);
|
|
47715
|
+
return null;
|
|
47716
|
+
}
|
|
47717
|
+
function readJpegDimensions(bytes) {
|
|
47718
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
47719
|
+
let offset = 2;
|
|
47720
|
+
while (offset + 4 < bytes.length) {
|
|
47721
|
+
if (bytes[offset] !== 255)
|
|
47722
|
+
return null;
|
|
47723
|
+
const marker = bytes[offset + 1];
|
|
47724
|
+
if (marker === 192 || marker === 194) {
|
|
47725
|
+
if (offset + 9 > bytes.length)
|
|
47726
|
+
return null;
|
|
47727
|
+
const height = view.getUint16(offset + 5);
|
|
47728
|
+
const width = view.getUint16(offset + 7);
|
|
47729
|
+
if (width > 0 && height > 0)
|
|
47730
|
+
return {
|
|
47731
|
+
width,
|
|
47732
|
+
height
|
|
47733
|
+
};
|
|
47734
|
+
return null;
|
|
47735
|
+
}
|
|
47736
|
+
if (marker === 217)
|
|
47737
|
+
return null;
|
|
47738
|
+
if (marker === 218)
|
|
47739
|
+
return null;
|
|
47740
|
+
const segmentLength = view.getUint16(offset + 2);
|
|
47741
|
+
offset += 2 + segmentLength;
|
|
47742
|
+
}
|
|
47743
|
+
return null;
|
|
47744
|
+
}
|
|
47745
|
+
function readWebpDimensions(bytes) {
|
|
47746
|
+
if (bytes.length < 16)
|
|
47747
|
+
return null;
|
|
47748
|
+
const chunkTag = String.fromCharCode(bytes[12], bytes[13], bytes[14], bytes[15]);
|
|
47749
|
+
if (chunkTag === "VP8 ") {
|
|
47750
|
+
if (bytes.length < 30)
|
|
47751
|
+
return null;
|
|
47752
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
47753
|
+
const width = view.getUint16(26, true) & 16383;
|
|
47754
|
+
const height = view.getUint16(28, true) & 16383;
|
|
47755
|
+
if (width > 0 && height > 0)
|
|
47756
|
+
return {
|
|
47757
|
+
width,
|
|
47758
|
+
height
|
|
47759
|
+
};
|
|
47760
|
+
return null;
|
|
47761
|
+
}
|
|
47762
|
+
if (chunkTag === "VP8L") {
|
|
47763
|
+
if (bytes.length < 25)
|
|
47764
|
+
return null;
|
|
47765
|
+
const b0 = bytes[21];
|
|
47766
|
+
const b1 = bytes[22];
|
|
47767
|
+
const b2 = bytes[23];
|
|
47768
|
+
const b3 = bytes[24];
|
|
47769
|
+
const width = ((b1 & 63) << 8 | b0) + 1;
|
|
47770
|
+
const height = ((b3 & 15) << 10 | b2 << 2 | b1 >> 6) + 1;
|
|
47771
|
+
if (width > 0 && height > 0)
|
|
47772
|
+
return {
|
|
47773
|
+
width,
|
|
47774
|
+
height
|
|
47775
|
+
};
|
|
47776
|
+
return null;
|
|
47777
|
+
}
|
|
47778
|
+
if (chunkTag === "VP8X") {
|
|
47779
|
+
if (bytes.length < 30)
|
|
47780
|
+
return null;
|
|
47781
|
+
const width = (bytes[24] | bytes[25] << 8 | bytes[26] << 16) + 1;
|
|
47782
|
+
const height = (bytes[27] | bytes[28] << 8 | bytes[29] << 16) + 1;
|
|
47783
|
+
if (width > 0 && height > 0)
|
|
47784
|
+
return {
|
|
47785
|
+
width,
|
|
47786
|
+
height
|
|
47787
|
+
};
|
|
47788
|
+
return null;
|
|
47789
|
+
}
|
|
47790
|
+
return null;
|
|
47791
|
+
}
|
|
47792
|
+
function readImageDimensionsFromDataUri(dataUri) {
|
|
47793
|
+
if (typeof dataUri !== "string" || !dataUri.startsWith("data:"))
|
|
47794
|
+
return null;
|
|
47795
|
+
const commaIndex = dataUri.indexOf(",");
|
|
47796
|
+
if (commaIndex === -1)
|
|
47797
|
+
return null;
|
|
47798
|
+
const base64Payload = dataUri.slice(commaIndex + 1);
|
|
47799
|
+
if (!base64Payload)
|
|
47800
|
+
return null;
|
|
47801
|
+
try {
|
|
47802
|
+
return readImageDimensions(base64ToUint8Array(base64Payload));
|
|
47803
|
+
} catch {
|
|
47804
|
+
return null;
|
|
47805
|
+
}
|
|
47806
|
+
}
|
|
47669
47807
|
function convertMdastToBlocks(root2, ctx) {
|
|
47670
47808
|
return flatMapRootChildrenPreserveBlankLines(root2, ctx);
|
|
47671
47809
|
}
|
|
@@ -47852,11 +47990,7 @@ function convertImageBlock(node3, ctx) {
|
|
|
47852
47990
|
type: "paragraph",
|
|
47853
47991
|
content: [{
|
|
47854
47992
|
type: "image",
|
|
47855
|
-
attrs:
|
|
47856
|
-
src: node3.url,
|
|
47857
|
-
alt: node3.alt ?? null,
|
|
47858
|
-
title: node3.title ?? null
|
|
47859
|
-
}
|
|
47993
|
+
attrs: buildImageAttrs(node3, ctx)
|
|
47860
47994
|
}]
|
|
47861
47995
|
};
|
|
47862
47996
|
}
|
|
@@ -47926,13 +48060,47 @@ function convertInlineImage(node3, ctx) {
|
|
|
47926
48060
|
}
|
|
47927
48061
|
return [{
|
|
47928
48062
|
type: "image",
|
|
47929
|
-
attrs:
|
|
47930
|
-
src: node3.url,
|
|
47931
|
-
alt: node3.alt ?? null,
|
|
47932
|
-
title: node3.title ?? null
|
|
47933
|
-
}
|
|
48063
|
+
attrs: buildImageAttrs(node3, ctx)
|
|
47934
48064
|
}];
|
|
47935
48065
|
}
|
|
48066
|
+
function buildImageAttrs(node3, ctx) {
|
|
48067
|
+
const attrs = {
|
|
48068
|
+
src: node3.url,
|
|
48069
|
+
alt: node3.alt ?? null,
|
|
48070
|
+
title: node3.title ?? null,
|
|
48071
|
+
sdImageId: v4_default(),
|
|
48072
|
+
id: generateUniqueImageDocPrId(ctx)
|
|
48073
|
+
};
|
|
48074
|
+
const dimensions = readImageDimensionsFromDataUri(node3.url);
|
|
48075
|
+
if (dimensions)
|
|
48076
|
+
attrs.size = dimensions;
|
|
48077
|
+
return attrs;
|
|
48078
|
+
}
|
|
48079
|
+
function generateUniqueImageDocPrId(ctx) {
|
|
48080
|
+
const existingIds = getOrCreateImageDocPrIdSet(ctx);
|
|
48081
|
+
let candidate = "";
|
|
48082
|
+
do {
|
|
48083
|
+
const hex = generateDocxRandomId();
|
|
48084
|
+
candidate = String(parseInt(hex, 16));
|
|
48085
|
+
} while (!candidate || existingIds.has(candidate));
|
|
48086
|
+
existingIds.add(candidate);
|
|
48087
|
+
return candidate;
|
|
48088
|
+
}
|
|
48089
|
+
function getOrCreateImageDocPrIdSet(ctx) {
|
|
48090
|
+
const cached = imageDocPrIdsByContext.get(ctx);
|
|
48091
|
+
if (cached)
|
|
48092
|
+
return cached;
|
|
48093
|
+
const existingIds = /* @__PURE__ */ new Set;
|
|
48094
|
+
ctx.editor?.state?.doc?.descendants((node3) => {
|
|
48095
|
+
if (node3.type.name !== "image")
|
|
48096
|
+
return true;
|
|
48097
|
+
if (node3.attrs.id !== undefined && node3.attrs.id !== null)
|
|
48098
|
+
existingIds.add(String(node3.attrs.id));
|
|
48099
|
+
return true;
|
|
48100
|
+
});
|
|
48101
|
+
imageDocPrIdsByContext.set(ctx, existingIds);
|
|
48102
|
+
return existingIds;
|
|
48103
|
+
}
|
|
47936
48104
|
function makeParagraph(content$2, extraParagraphProps) {
|
|
47937
48105
|
const paragraphProperties = extraParagraphProps ? { ...extraParagraphProps } : undefined;
|
|
47938
48106
|
const attrs = {};
|
|
@@ -48386,144 +48554,6 @@ function updateDOMAttributes(dom, attrs = {}, options = {}) {
|
|
|
48386
48554
|
dom.removeAttribute(key);
|
|
48387
48555
|
});
|
|
48388
48556
|
}
|
|
48389
|
-
function readImageDimensions(bytes) {
|
|
48390
|
-
if (!(bytes instanceof Uint8Array) || bytes.length < 12)
|
|
48391
|
-
return null;
|
|
48392
|
-
if (bytes[0] === 137 && bytes[1] === 80 && bytes[2] === 78 && bytes[3] === 71) {
|
|
48393
|
-
if (bytes.length < 24)
|
|
48394
|
-
return null;
|
|
48395
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
48396
|
-
const width = view.getInt32(16);
|
|
48397
|
-
const height = view.getInt32(20);
|
|
48398
|
-
if (width > 0 && height > 0)
|
|
48399
|
-
return {
|
|
48400
|
-
width,
|
|
48401
|
-
height
|
|
48402
|
-
};
|
|
48403
|
-
return null;
|
|
48404
|
-
}
|
|
48405
|
-
if (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255)
|
|
48406
|
-
return readJpegDimensions(bytes);
|
|
48407
|
-
if (bytes[0] === 71 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 56) {
|
|
48408
|
-
if (bytes.length < 10)
|
|
48409
|
-
return null;
|
|
48410
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
48411
|
-
const width = view.getUint16(6, true);
|
|
48412
|
-
const height = view.getUint16(8, true);
|
|
48413
|
-
if (width > 0 && height > 0)
|
|
48414
|
-
return {
|
|
48415
|
-
width,
|
|
48416
|
-
height
|
|
48417
|
-
};
|
|
48418
|
-
return null;
|
|
48419
|
-
}
|
|
48420
|
-
if (bytes[0] === 66 && bytes[1] === 77) {
|
|
48421
|
-
if (bytes.length < 26)
|
|
48422
|
-
return null;
|
|
48423
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
48424
|
-
const width = view.getInt32(18, true);
|
|
48425
|
-
const height = Math.abs(view.getInt32(22, true));
|
|
48426
|
-
if (width > 0 && height > 0)
|
|
48427
|
-
return {
|
|
48428
|
-
width,
|
|
48429
|
-
height
|
|
48430
|
-
};
|
|
48431
|
-
return null;
|
|
48432
|
-
}
|
|
48433
|
-
if (bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80)
|
|
48434
|
-
return readWebpDimensions(bytes);
|
|
48435
|
-
return null;
|
|
48436
|
-
}
|
|
48437
|
-
function readJpegDimensions(bytes) {
|
|
48438
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
48439
|
-
let offset = 2;
|
|
48440
|
-
while (offset + 4 < bytes.length) {
|
|
48441
|
-
if (bytes[offset] !== 255)
|
|
48442
|
-
return null;
|
|
48443
|
-
const marker = bytes[offset + 1];
|
|
48444
|
-
if (marker === 192 || marker === 194) {
|
|
48445
|
-
if (offset + 9 > bytes.length)
|
|
48446
|
-
return null;
|
|
48447
|
-
const height = view.getUint16(offset + 5);
|
|
48448
|
-
const width = view.getUint16(offset + 7);
|
|
48449
|
-
if (width > 0 && height > 0)
|
|
48450
|
-
return {
|
|
48451
|
-
width,
|
|
48452
|
-
height
|
|
48453
|
-
};
|
|
48454
|
-
return null;
|
|
48455
|
-
}
|
|
48456
|
-
if (marker === 217)
|
|
48457
|
-
return null;
|
|
48458
|
-
if (marker === 218)
|
|
48459
|
-
return null;
|
|
48460
|
-
const segmentLength = view.getUint16(offset + 2);
|
|
48461
|
-
offset += 2 + segmentLength;
|
|
48462
|
-
}
|
|
48463
|
-
return null;
|
|
48464
|
-
}
|
|
48465
|
-
function readWebpDimensions(bytes) {
|
|
48466
|
-
if (bytes.length < 16)
|
|
48467
|
-
return null;
|
|
48468
|
-
const chunkTag = String.fromCharCode(bytes[12], bytes[13], bytes[14], bytes[15]);
|
|
48469
|
-
if (chunkTag === "VP8 ") {
|
|
48470
|
-
if (bytes.length < 30)
|
|
48471
|
-
return null;
|
|
48472
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
48473
|
-
const width = view.getUint16(26, true) & 16383;
|
|
48474
|
-
const height = view.getUint16(28, true) & 16383;
|
|
48475
|
-
if (width > 0 && height > 0)
|
|
48476
|
-
return {
|
|
48477
|
-
width,
|
|
48478
|
-
height
|
|
48479
|
-
};
|
|
48480
|
-
return null;
|
|
48481
|
-
}
|
|
48482
|
-
if (chunkTag === "VP8L") {
|
|
48483
|
-
if (bytes.length < 25)
|
|
48484
|
-
return null;
|
|
48485
|
-
const b0 = bytes[21];
|
|
48486
|
-
const b1 = bytes[22];
|
|
48487
|
-
const b2 = bytes[23];
|
|
48488
|
-
const b3 = bytes[24];
|
|
48489
|
-
const width = ((b1 & 63) << 8 | b0) + 1;
|
|
48490
|
-
const height = ((b3 & 15) << 10 | b2 << 2 | b1 >> 6) + 1;
|
|
48491
|
-
if (width > 0 && height > 0)
|
|
48492
|
-
return {
|
|
48493
|
-
width,
|
|
48494
|
-
height
|
|
48495
|
-
};
|
|
48496
|
-
return null;
|
|
48497
|
-
}
|
|
48498
|
-
if (chunkTag === "VP8X") {
|
|
48499
|
-
if (bytes.length < 30)
|
|
48500
|
-
return null;
|
|
48501
|
-
const width = (bytes[24] | bytes[25] << 8 | bytes[26] << 16) + 1;
|
|
48502
|
-
const height = (bytes[27] | bytes[28] << 8 | bytes[29] << 16) + 1;
|
|
48503
|
-
if (width > 0 && height > 0)
|
|
48504
|
-
return {
|
|
48505
|
-
width,
|
|
48506
|
-
height
|
|
48507
|
-
};
|
|
48508
|
-
return null;
|
|
48509
|
-
}
|
|
48510
|
-
return null;
|
|
48511
|
-
}
|
|
48512
|
-
function readImageDimensionsFromDataUri(dataUri) {
|
|
48513
|
-
if (typeof dataUri !== "string" || !dataUri.startsWith("data:"))
|
|
48514
|
-
return null;
|
|
48515
|
-
const commaIndex = dataUri.indexOf(",");
|
|
48516
|
-
if (commaIndex === -1)
|
|
48517
|
-
return null;
|
|
48518
|
-
const base64Payload = dataUri.slice(commaIndex + 1);
|
|
48519
|
-
if (!base64Payload)
|
|
48520
|
-
return null;
|
|
48521
|
-
try {
|
|
48522
|
-
return readImageDimensions(base64ToUint8Array(base64Payload));
|
|
48523
|
-
} catch {
|
|
48524
|
-
return null;
|
|
48525
|
-
}
|
|
48526
|
-
}
|
|
48527
48557
|
function resolveHyperlinkRId(attrs, params) {
|
|
48528
48558
|
if (!attrs.hyperlink?.url || !params)
|
|
48529
48559
|
return null;
|
|
@@ -61556,7 +61586,7 @@ var isRegExp = (value) => {
|
|
|
61556
61586
|
chunkedPush(this.left, removed.reverse());
|
|
61557
61587
|
}
|
|
61558
61588
|
}
|
|
61559
|
-
}, content$1, continuationConstruct, definition2, titleBefore, hardBreakEscape, headingAtx, htmlBlockNames, htmlRawNames, htmlFlow, blankLineBefore, nonLazyContinuationStart, htmlText, labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct, labelStartImage, labelStartLink, lineEnding, thematicBreak2, list2, listItemPrefixWhitespaceConstruct, indentConstruct, setextUnderline, flow, resolver, string, text3, constructs_exports, document$2, contentInitial, flowInitial, flow$1, string$1, text$1, insideSpan, attentionMarkers, disable, search, own3, FULL_WIDTH_TABLE_PCT = 5000, HEADING_STYLE_MAP, FENCE_OPEN_RE, INDENTED_CODE_RE, MAX_BORDER_SCAN = 100, MIN_BORDER_WIDTH_RATIO = 0.4, defaultBooleans, MAX_INLINE_NAVIGATION_ITERATIONS = 8, computeChangeRange = (original, suggested) => {
|
|
61589
|
+
}, content$1, continuationConstruct, definition2, titleBefore, hardBreakEscape, headingAtx, htmlBlockNames, htmlRawNames, htmlFlow, blankLineBefore, nonLazyContinuationStart, htmlText, labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct, labelStartImage, labelStartLink, lineEnding, thematicBreak2, list2, listItemPrefixWhitespaceConstruct, indentConstruct, setextUnderline, flow, resolver, string, text3, constructs_exports, document$2, contentInitial, flowInitial, flow$1, string$1, text$1, insideSpan, attentionMarkers, disable, search, own3, FULL_WIDTH_TABLE_PCT = 5000, imageDocPrIdsByContext, HEADING_STYLE_MAP, FENCE_OPEN_RE, INDENTED_CODE_RE, MAX_BORDER_SCAN = 100, MIN_BORDER_WIDTH_RATIO = 0.4, defaultBooleans, MAX_INLINE_NAVIGATION_ITERATIONS = 8, computeChangeRange = (original, suggested) => {
|
|
61560
61590
|
const origLen = original.length;
|
|
61561
61591
|
const suggLen = suggested.length;
|
|
61562
61592
|
let prefix = 0;
|
|
@@ -65053,7 +65083,7 @@ var isRegExp = (value) => {
|
|
|
65053
65083
|
state.kern = kernNode.attributes["w:val"];
|
|
65054
65084
|
}
|
|
65055
65085
|
}, SuperConverter;
|
|
65056
|
-
var
|
|
65086
|
+
var init_SuperConverter_CU5DAsJr_es = __esm(() => {
|
|
65057
65087
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
65058
65088
|
init_jszip_ChlR43oI_es();
|
|
65059
65089
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -89214,6 +89244,7 @@ var init_SuperConverter_WVv8Qhfn_es = __esm(() => {
|
|
|
89214
89244
|
disable = { null: [] };
|
|
89215
89245
|
search = /[\0\t\n\r]/g;
|
|
89216
89246
|
own3 = {}.hasOwnProperty;
|
|
89247
|
+
imageDocPrIdsByContext = /* @__PURE__ */ new WeakMap;
|
|
89217
89248
|
HEADING_STYLE_MAP = {
|
|
89218
89249
|
1: "Heading1",
|
|
89219
89250
|
2: "Heading2",
|
|
@@ -121801,9 +121832,9 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
121801
121832
|
init_remark_gfm_z_sDF4ss_es();
|
|
121802
121833
|
});
|
|
121803
121834
|
|
|
121804
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
121805
|
-
var
|
|
121806
|
-
__export(
|
|
121835
|
+
// ../../packages/superdoc/dist/chunks/src-Cy7tFeUI.es.js
|
|
121836
|
+
var exports_src_Cy7tFeUI_es = {};
|
|
121837
|
+
__export(exports_src_Cy7tFeUI_es, {
|
|
121807
121838
|
zt: () => defineMark,
|
|
121808
121839
|
z: () => cM,
|
|
121809
121840
|
yt: () => removeAwarenessStates,
|
|
@@ -133087,6 +133118,26 @@ function editorHasDom(editor) {
|
|
|
133087
133118
|
const opts = editor.options;
|
|
133088
133119
|
return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
|
|
133089
133120
|
}
|
|
133121
|
+
function isJsonObject(value) {
|
|
133122
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
133123
|
+
}
|
|
133124
|
+
function ensureMarkdownImageIds(nodes) {
|
|
133125
|
+
const visit2 = (node3) => {
|
|
133126
|
+
if (node3.type === "image") {
|
|
133127
|
+
const attrs = isJsonObject(node3.attrs) ? { ...node3.attrs } : {};
|
|
133128
|
+
if (!(typeof attrs.sdImageId === "string" && attrs.sdImageId.length > 0))
|
|
133129
|
+
attrs.sdImageId = v4_default();
|
|
133130
|
+
node3.attrs = attrs;
|
|
133131
|
+
}
|
|
133132
|
+
if (!Array.isArray(node3.content))
|
|
133133
|
+
return;
|
|
133134
|
+
for (const child of node3.content)
|
|
133135
|
+
if (isJsonObject(child))
|
|
133136
|
+
visit2(child);
|
|
133137
|
+
};
|
|
133138
|
+
for (const node3 of nodes)
|
|
133139
|
+
visit2(node3);
|
|
133140
|
+
}
|
|
133090
133141
|
function ensureTableSeparators(jsonNodes) {
|
|
133091
133142
|
for (let i$1 = jsonNodes.length - 2;i$1 >= 0; i$1--)
|
|
133092
133143
|
if (jsonNodes[i$1].type === "table" && jsonNodes[i$1 + 1].type === "table")
|
|
@@ -133553,6 +133604,7 @@ function insertStructuredWrapper(editor, input2, options) {
|
|
|
133553
133604
|
}
|
|
133554
133605
|
const jsonNodes = [];
|
|
133555
133606
|
fragment.forEach((node3) => jsonNodes.push(node3.toJSON()));
|
|
133607
|
+
ensureMarkdownImageIds(jsonNodes);
|
|
133556
133608
|
ensureTableSeparators(jsonNodes);
|
|
133557
133609
|
if (from$12 === to) {
|
|
133558
133610
|
const $pos = editor.state.doc.resolve(from$12);
|
|
@@ -198889,9 +198941,9 @@ var Node$13 = class Node$14 {
|
|
|
198889
198941
|
trackedChanges: context.trackedChanges ?? []
|
|
198890
198942
|
});
|
|
198891
198943
|
}, _hoisted_1$6, _hoisted_2$2, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, _hoisted_2$1, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_HEIGHT_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, POPOVER_VERTICAL_OFFSET_PX = 15, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
198892
|
-
var
|
|
198944
|
+
var init_src_Cy7tFeUI_es = __esm(() => {
|
|
198893
198945
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
198894
|
-
|
|
198946
|
+
init_SuperConverter_CU5DAsJr_es();
|
|
198895
198947
|
init_jszip_ChlR43oI_es();
|
|
198896
198948
|
init_uuid_qzgm05fK_es();
|
|
198897
198949
|
init_constants_CMPtQbp7_es();
|
|
@@ -230622,8 +230674,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230622
230674
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
230623
230675
|
};
|
|
230624
230676
|
stubFalse_default = stubFalse;
|
|
230625
|
-
freeExports$2 = typeof
|
|
230626
|
-
freeModule$2 = freeExports$2 && typeof
|
|
230677
|
+
freeExports$2 = typeof exports_src_Cy7tFeUI_es == "object" && exports_src_Cy7tFeUI_es && !exports_src_Cy7tFeUI_es.nodeType && exports_src_Cy7tFeUI_es;
|
|
230678
|
+
freeModule$2 = freeExports$2 && typeof module_src_Cy7tFeUI_es == "object" && module_src_Cy7tFeUI_es && !module_src_Cy7tFeUI_es.nodeType && module_src_Cy7tFeUI_es;
|
|
230627
230679
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
230628
230680
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
230629
230681
|
typedArrayTags = {};
|
|
@@ -230631,8 +230683,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230631
230683
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
230632
230684
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
230633
230685
|
_baseUnary_default = baseUnary;
|
|
230634
|
-
freeExports$1 = typeof
|
|
230635
|
-
freeModule$1 = freeExports$1 && typeof
|
|
230686
|
+
freeExports$1 = typeof exports_src_Cy7tFeUI_es == "object" && exports_src_Cy7tFeUI_es && !exports_src_Cy7tFeUI_es.nodeType && exports_src_Cy7tFeUI_es;
|
|
230687
|
+
freeModule$1 = freeExports$1 && typeof module_src_Cy7tFeUI_es == "object" && module_src_Cy7tFeUI_es && !module_src_Cy7tFeUI_es.nodeType && module_src_Cy7tFeUI_es;
|
|
230636
230688
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
230637
230689
|
_nodeUtil_default = function() {
|
|
230638
230690
|
try {
|
|
@@ -230737,8 +230789,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
230737
230789
|
Stack.prototype.has = _stackHas_default;
|
|
230738
230790
|
Stack.prototype.set = _stackSet_default;
|
|
230739
230791
|
_Stack_default = Stack;
|
|
230740
|
-
freeExports = typeof
|
|
230741
|
-
freeModule = freeExports && typeof
|
|
230792
|
+
freeExports = typeof exports_src_Cy7tFeUI_es == "object" && exports_src_Cy7tFeUI_es && !exports_src_Cy7tFeUI_es.nodeType && exports_src_Cy7tFeUI_es;
|
|
230793
|
+
freeModule = freeExports && typeof module_src_Cy7tFeUI_es == "object" && module_src_Cy7tFeUI_es && !module_src_Cy7tFeUI_es.nodeType && module_src_Cy7tFeUI_es;
|
|
230742
230794
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
230743
230795
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
230744
230796
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -238818,8 +238870,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
238818
238870
|
|
|
238819
238871
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
238820
238872
|
var init_super_editor_es = __esm(() => {
|
|
238821
|
-
|
|
238822
|
-
|
|
238873
|
+
init_src_Cy7tFeUI_es();
|
|
238874
|
+
init_SuperConverter_CU5DAsJr_es();
|
|
238823
238875
|
init_jszip_ChlR43oI_es();
|
|
238824
238876
|
init_xml_js_DLE8mr0n_es();
|
|
238825
238877
|
init_constants_CMPtQbp7_es();
|
|
@@ -299211,14 +299263,7 @@ function convertImageBlock2(node4, ctx2) {
|
|
|
299211
299263
|
addDiagnostic4(ctx2, "warning", "image", "Image with empty URL — skipped.", node4);
|
|
299212
299264
|
return makeParagraph2([]);
|
|
299213
299265
|
}
|
|
299214
|
-
const imageNode = {
|
|
299215
|
-
type: "image",
|
|
299216
|
-
attrs: {
|
|
299217
|
-
src: node4.url,
|
|
299218
|
-
alt: node4.alt ?? null,
|
|
299219
|
-
title: node4.title ?? null
|
|
299220
|
-
}
|
|
299221
|
-
};
|
|
299266
|
+
const imageNode = { type: "image", attrs: buildImageAttrs2(node4, ctx2) };
|
|
299222
299267
|
return {
|
|
299223
299268
|
type: "paragraph",
|
|
299224
299269
|
content: [imageNode]
|
|
@@ -299298,14 +299343,50 @@ function convertInlineImage2(node4, ctx2) {
|
|
|
299298
299343
|
return [
|
|
299299
299344
|
{
|
|
299300
299345
|
type: "image",
|
|
299301
|
-
attrs:
|
|
299302
|
-
src: node4.url,
|
|
299303
|
-
alt: node4.alt ?? null,
|
|
299304
|
-
title: node4.title ?? null
|
|
299305
|
-
}
|
|
299346
|
+
attrs: buildImageAttrs2(node4, ctx2)
|
|
299306
299347
|
}
|
|
299307
299348
|
];
|
|
299308
299349
|
}
|
|
299350
|
+
function buildImageAttrs2(node4, ctx2) {
|
|
299351
|
+
const attrs = {
|
|
299352
|
+
src: node4.url,
|
|
299353
|
+
alt: node4.alt ?? null,
|
|
299354
|
+
title: node4.title ?? null,
|
|
299355
|
+
sdImageId: v42(),
|
|
299356
|
+
id: generateUniqueImageDocPrId2(ctx2)
|
|
299357
|
+
};
|
|
299358
|
+
const dimensions = readImageDimensionsFromDataUri2(node4.url);
|
|
299359
|
+
if (dimensions) {
|
|
299360
|
+
attrs.size = dimensions;
|
|
299361
|
+
}
|
|
299362
|
+
return attrs;
|
|
299363
|
+
}
|
|
299364
|
+
function generateUniqueImageDocPrId2(ctx2) {
|
|
299365
|
+
const existingIds = getOrCreateImageDocPrIdSet2(ctx2);
|
|
299366
|
+
let candidate = "";
|
|
299367
|
+
do {
|
|
299368
|
+
const hex2 = generateDocxRandomId2();
|
|
299369
|
+
candidate = String(parseInt(hex2, 16));
|
|
299370
|
+
} while (!candidate || existingIds.has(candidate));
|
|
299371
|
+
existingIds.add(candidate);
|
|
299372
|
+
return candidate;
|
|
299373
|
+
}
|
|
299374
|
+
function getOrCreateImageDocPrIdSet2(ctx2) {
|
|
299375
|
+
const cached = imageDocPrIdsByContext2.get(ctx2);
|
|
299376
|
+
if (cached)
|
|
299377
|
+
return cached;
|
|
299378
|
+
const existingIds = new Set;
|
|
299379
|
+
ctx2.editor?.state?.doc?.descendants((node4) => {
|
|
299380
|
+
if (node4.type.name !== "image")
|
|
299381
|
+
return true;
|
|
299382
|
+
if (node4.attrs.id !== undefined && node4.attrs.id !== null) {
|
|
299383
|
+
existingIds.add(String(node4.attrs.id));
|
|
299384
|
+
}
|
|
299385
|
+
return true;
|
|
299386
|
+
});
|
|
299387
|
+
imageDocPrIdsByContext2.set(ctx2, existingIds);
|
|
299388
|
+
return existingIds;
|
|
299389
|
+
}
|
|
299309
299390
|
function makeParagraph2(content5, extraParagraphProps) {
|
|
299310
299391
|
const paragraphProperties = extraParagraphProps ? { ...extraParagraphProps } : undefined;
|
|
299311
299392
|
const attrs = {};
|
|
@@ -299354,9 +299435,12 @@ function addDiagnostic4(ctx2, severity, nodeType, message, node4) {
|
|
|
299354
299435
|
}
|
|
299355
299436
|
ctx2.diagnostics.push(diagnostic);
|
|
299356
299437
|
}
|
|
299357
|
-
var FULL_WIDTH_TABLE_PCT2 = 5000, HEADING_STYLE_MAP2;
|
|
299438
|
+
var FULL_WIDTH_TABLE_PCT2 = 5000, imageDocPrIdsByContext2, HEADING_STYLE_MAP2;
|
|
299358
299439
|
var init_mdastToProseMirror = __esm(() => {
|
|
299440
|
+
init_wrapper();
|
|
299359
299441
|
init_list_numbering_helpers();
|
|
299442
|
+
init_image_dimensions();
|
|
299443
|
+
imageDocPrIdsByContext2 = new WeakMap;
|
|
299360
299444
|
HEADING_STYLE_MAP2 = {
|
|
299361
299445
|
1: "Heading1",
|
|
299362
299446
|
2: "Heading2",
|
|
@@ -303784,6 +303868,30 @@ function editorHasDom2(editor) {
|
|
|
303784
303868
|
const opts = editor.options;
|
|
303785
303869
|
return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
|
|
303786
303870
|
}
|
|
303871
|
+
function isJsonObject2(value) {
|
|
303872
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
303873
|
+
}
|
|
303874
|
+
function ensureMarkdownImageIds2(nodes) {
|
|
303875
|
+
const visit3 = (node4) => {
|
|
303876
|
+
if (node4.type === "image") {
|
|
303877
|
+
const attrs = isJsonObject2(node4.attrs) ? { ...node4.attrs } : {};
|
|
303878
|
+
const hasStableId = typeof attrs.sdImageId === "string" && attrs.sdImageId.length > 0;
|
|
303879
|
+
if (!hasStableId) {
|
|
303880
|
+
attrs.sdImageId = v42();
|
|
303881
|
+
}
|
|
303882
|
+
node4.attrs = attrs;
|
|
303883
|
+
}
|
|
303884
|
+
if (!Array.isArray(node4.content))
|
|
303885
|
+
return;
|
|
303886
|
+
for (const child of node4.content) {
|
|
303887
|
+
if (isJsonObject2(child))
|
|
303888
|
+
visit3(child);
|
|
303889
|
+
}
|
|
303890
|
+
};
|
|
303891
|
+
for (const node4 of nodes) {
|
|
303892
|
+
visit3(node4);
|
|
303893
|
+
}
|
|
303894
|
+
}
|
|
303787
303895
|
function ensureTableSeparators2(jsonNodes) {
|
|
303788
303896
|
for (let i4 = jsonNodes.length - 2;i4 >= 0; i4--) {
|
|
303789
303897
|
if (jsonNodes[i4].type === "table" && jsonNodes[i4 + 1].type === "table") {
|
|
@@ -304185,6 +304293,7 @@ function insertStructuredWrapper2(editor, input2, options) {
|
|
|
304185
304293
|
}
|
|
304186
304294
|
const jsonNodes = [];
|
|
304187
304295
|
fragment.forEach((node4) => jsonNodes.push(node4.toJSON()));
|
|
304296
|
+
ensureMarkdownImageIds2(jsonNodes);
|
|
304188
304297
|
ensureTableSeparators2(jsonNodes);
|
|
304189
304298
|
if (from4 === to) {
|
|
304190
304299
|
const $pos = editor.state.doc.resolve(from4);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.91",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"@types/node": "22.19.2",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
23
|
"@superdoc/pm-adapter": "0.0.0",
|
|
24
|
-
"@superdoc/super-editor": "0.0.1",
|
|
25
24
|
"superdoc": "1.17.0",
|
|
26
|
-
"@superdoc/document-api": "0.0.1"
|
|
25
|
+
"@superdoc/document-api": "0.0.1",
|
|
26
|
+
"@superdoc/super-editor": "0.0.1"
|
|
27
27
|
},
|
|
28
28
|
"module": "src/index.ts",
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
35
|
-
"@superdoc-dev/cli-linux-
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.91",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.91",
|
|
35
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.91",
|
|
36
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.91",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.91"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|