@harbour-enterprises/superdoc 1.0.0-next.5 → 1.0.0-next.7
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-BQ7d08ku.es.js → PdfViewer-CCU0Mzny.es.js} +1 -1
- package/dist/chunks/{PdfViewer-D8FKTxiO.cjs → PdfViewer-Ca1KqMaU.cjs} +1 -1
- package/dist/chunks/{index-BOkSE8Li.cjs → index-DfbOKJbz.cjs} +96 -95
- package/dist/chunks/{index-BUoOdDUj-CLmpIPsb.es.js → index-IZySkMqb-BRW0f_kL.es.js} +1 -1
- package/dist/chunks/{index-BUoOdDUj-CF4U3xYL.cjs → index-IZySkMqb-OvIaFsnt.cjs} +1 -1
- package/dist/chunks/{index-D3wrs960.es.js → index-q8FicN0U.es.js} +96 -95
- package/dist/chunks/{super-editor.es-vynpc_1U.es.js → super-editor.es--rLTKCxc.es.js} +330 -252
- package/dist/chunks/{super-editor.es-Bj_Ga0sp.cjs → super-editor.es-D_13cWx3.cjs} +330 -252
- package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts +3 -3
- package/dist/packages/superdoc/src/core/collaboration/collaboration-comments.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/collaboration/helpers.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-D6Kvbivo.js → converter-BUHD74_1.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DAS45uKP.js → docx-zipper-CtdkK288.js} +1 -1
- package/dist/super-editor/chunks/{editor-BMEPaiVS.js → editor-BV718qjr.js} +331 -253
- package/dist/super-editor/chunks/{index-BUoOdDUj.js → index-IZySkMqb.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-CUWKY5Cx.js → toolbar-CnlEeYqx.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +426 -347
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -42428,7 +42428,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
42428
42428
|
static getStoredSuperdocVersion(docx) {
|
|
42429
42429
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42430
42430
|
}
|
|
42431
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42431
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.7") {
|
|
42432
42432
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42433
42433
|
}
|
|
42434
42434
|
/**
|
|
@@ -62681,11 +62681,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
62681
62681
|
const selectAll = () => ({ state: state2, dispatch }) => selectAll$1(state2, dispatch);
|
|
62682
62682
|
const deleteSelection = () => ({ state: state2, tr, dispatch }) => {
|
|
62683
62683
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
62684
|
-
if (
|
|
62684
|
+
if (document && document.getSelection) {
|
|
62685
62685
|
const currentDomSelection = document.getSelection();
|
|
62686
|
-
|
|
62687
|
-
const isCollapsed = currentDomSelection?.isCollapsed;
|
|
62688
|
-
if (!isCollapsed && selectedLength === 1) {
|
|
62686
|
+
if (currentDomSelection?.baseNode?.data?.length == 1) {
|
|
62689
62687
|
return false;
|
|
62690
62688
|
}
|
|
62691
62689
|
}
|
|
@@ -67513,7 +67511,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67513
67511
|
const shouldSkipNodeView = (editor) => {
|
|
67514
67512
|
return isHeadless(editor);
|
|
67515
67513
|
};
|
|
67516
|
-
const summaryVersion = "1.0.0-next.
|
|
67514
|
+
const summaryVersion = "1.0.0-next.7";
|
|
67517
67515
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
67518
67516
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
67519
67517
|
function mapAttributes(attrs) {
|
|
@@ -68302,7 +68300,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68302
68300
|
{ default: remarkStringify2 },
|
|
68303
68301
|
{ default: remarkGfm2 }
|
|
68304
68302
|
] = await Promise.all([
|
|
68305
|
-
Promise.resolve().then(() =>
|
|
68303
|
+
Promise.resolve().then(() => indexIZySkMqb),
|
|
68306
68304
|
Promise.resolve().then(() => indexDRCvimau),
|
|
68307
68305
|
Promise.resolve().then(() => indexC_x_N6Uh),
|
|
68308
68306
|
Promise.resolve().then(() => indexD_sWOSiG),
|
|
@@ -68507,7 +68505,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68507
68505
|
* Process collaboration migrations
|
|
68508
68506
|
*/
|
|
68509
68507
|
processCollaborationMigrations() {
|
|
68510
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
68508
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.7");
|
|
68511
68509
|
if (!this.options.ydoc) return;
|
|
68512
68510
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
68513
68511
|
let docVersion = metaMap.get("version");
|
|
@@ -75869,6 +75867,271 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
75869
75867
|
}
|
|
75870
75868
|
}
|
|
75871
75869
|
}
|
|
75870
|
+
const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
75871
|
+
const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
75872
|
+
const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
75873
|
+
const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
75874
|
+
const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
75875
|
+
const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
75876
|
+
const getAttrs$1 = (node2) => {
|
|
75877
|
+
return isPlainObject$2$1(node2.attrs) ? node2.attrs : {};
|
|
75878
|
+
};
|
|
75879
|
+
const normalizeWrapType$1 = (value) => {
|
|
75880
|
+
if (typeof value !== "string") return void 0;
|
|
75881
|
+
return WRAP_TYPES$1.has(value) ? value : void 0;
|
|
75882
|
+
};
|
|
75883
|
+
const normalizeWrapText$1 = (value) => {
|
|
75884
|
+
if (typeof value !== "string") return void 0;
|
|
75885
|
+
return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
|
|
75886
|
+
};
|
|
75887
|
+
const normalizePolygon$1 = (value) => {
|
|
75888
|
+
if (!Array.isArray(value)) return void 0;
|
|
75889
|
+
const polygon = [];
|
|
75890
|
+
value.forEach((point2) => {
|
|
75891
|
+
if (!Array.isArray(point2) || point2.length < 2) return;
|
|
75892
|
+
const x2 = pickNumber(point2[0]);
|
|
75893
|
+
const y2 = pickNumber(point2[1]);
|
|
75894
|
+
if (x2 == null || y2 == null) return;
|
|
75895
|
+
polygon.push([x2, y2]);
|
|
75896
|
+
});
|
|
75897
|
+
return polygon.length > 0 ? polygon : void 0;
|
|
75898
|
+
};
|
|
75899
|
+
const normalizeWrap$2 = (value) => {
|
|
75900
|
+
if (!isPlainObject$2$1(value)) {
|
|
75901
|
+
return void 0;
|
|
75902
|
+
}
|
|
75903
|
+
const type2 = normalizeWrapType$1(value.type);
|
|
75904
|
+
if (!type2 || type2 === "Inline") {
|
|
75905
|
+
return void 0;
|
|
75906
|
+
}
|
|
75907
|
+
const wrap2 = { type: type2 };
|
|
75908
|
+
const attrs = isPlainObject$2$1(value.attrs) ? value.attrs : {};
|
|
75909
|
+
const wrapText = normalizeWrapText$1(attrs.wrapText);
|
|
75910
|
+
if (wrapText) {
|
|
75911
|
+
wrap2.wrapText = wrapText;
|
|
75912
|
+
}
|
|
75913
|
+
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
75914
|
+
if (distTop != null) wrap2.distTop = distTop;
|
|
75915
|
+
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
75916
|
+
if (distBottom != null) wrap2.distBottom = distBottom;
|
|
75917
|
+
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
75918
|
+
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
75919
|
+
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
75920
|
+
if (distRight != null) wrap2.distRight = distRight;
|
|
75921
|
+
const polygon = normalizePolygon$1(attrs.polygon);
|
|
75922
|
+
if (polygon) {
|
|
75923
|
+
wrap2.polygon = polygon;
|
|
75924
|
+
}
|
|
75925
|
+
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
75926
|
+
if (behindDoc != null) {
|
|
75927
|
+
wrap2.behindDoc = behindDoc;
|
|
75928
|
+
}
|
|
75929
|
+
return wrap2;
|
|
75930
|
+
};
|
|
75931
|
+
const normalizeAnchorRelative$1 = (value, allowed) => {
|
|
75932
|
+
if (typeof value !== "string") return void 0;
|
|
75933
|
+
return allowed.has(value) ? value : void 0;
|
|
75934
|
+
};
|
|
75935
|
+
const normalizeAnchorAlign$1 = (value, allowed) => {
|
|
75936
|
+
if (typeof value !== "string") return void 0;
|
|
75937
|
+
return allowed.has(value) ? value : void 0;
|
|
75938
|
+
};
|
|
75939
|
+
const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
|
|
75940
|
+
const raw = isPlainObject$2$1(value) ? value : void 0;
|
|
75941
|
+
const marginOffset = isPlainObject$2$1(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
75942
|
+
const simplePos = isPlainObject$2$1(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
75943
|
+
const originalAttrs = isPlainObject$2$1(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
75944
|
+
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
75945
|
+
const anchor = {};
|
|
75946
|
+
if (isAnchored) {
|
|
75947
|
+
anchor.isAnchored = true;
|
|
75948
|
+
}
|
|
75949
|
+
const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
|
|
75950
|
+
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
75951
|
+
const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
|
|
75952
|
+
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
75953
|
+
const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
|
|
75954
|
+
if (alignH) anchor.alignH = alignH;
|
|
75955
|
+
const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
|
|
75956
|
+
if (alignV) anchor.alignV = alignV;
|
|
75957
|
+
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
75958
|
+
if (offsetH != null) anchor.offsetH = offsetH;
|
|
75959
|
+
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
75960
|
+
if (offsetV != null) anchor.offsetV = offsetV;
|
|
75961
|
+
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
75962
|
+
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
75963
|
+
const hasData = anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null;
|
|
75964
|
+
return hasData ? anchor : void 0;
|
|
75965
|
+
};
|
|
75966
|
+
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
|
|
75967
|
+
const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
|
|
75968
|
+
const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
75969
|
+
const pos = positions.get(node2);
|
|
75970
|
+
const attrsWithPm = { ...rawAttrs };
|
|
75971
|
+
if (pos) {
|
|
75972
|
+
attrsWithPm.pmStart = pos.start;
|
|
75973
|
+
attrsWithPm.pmEnd = pos.end;
|
|
75974
|
+
}
|
|
75975
|
+
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
75976
|
+
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
75977
|
+
return {
|
|
75978
|
+
kind: "drawing",
|
|
75979
|
+
id: nextBlockId("drawing"),
|
|
75980
|
+
drawingKind,
|
|
75981
|
+
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
75982
|
+
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
75983
|
+
anchor: baseAnchor,
|
|
75984
|
+
wrap: normalizedWrap,
|
|
75985
|
+
zIndex: finalZIndex,
|
|
75986
|
+
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
75987
|
+
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
75988
|
+
attrs: attrsWithPm,
|
|
75989
|
+
geometry,
|
|
75990
|
+
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
75991
|
+
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
75992
|
+
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
75993
|
+
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
75994
|
+
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
75995
|
+
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
75996
|
+
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
75997
|
+
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
75998
|
+
...extraProps
|
|
75999
|
+
};
|
|
76000
|
+
};
|
|
76001
|
+
function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
76002
|
+
const rawAttrs = getAttrs$1(node2);
|
|
76003
|
+
const geometry = {
|
|
76004
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
76005
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
76006
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
76007
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
76008
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
76009
|
+
};
|
|
76010
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
76011
|
+
}
|
|
76012
|
+
function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
76013
|
+
const rawAttrs = getAttrs$1(node2);
|
|
76014
|
+
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
76015
|
+
const size2 = normalizeShapeSize(rawAttrs.size);
|
|
76016
|
+
const width = size2?.width ?? groupTransform?.width ?? 1;
|
|
76017
|
+
const height = size2?.height ?? groupTransform?.height ?? 1;
|
|
76018
|
+
const geometry = {
|
|
76019
|
+
width: coercePositiveNumber(width, 1),
|
|
76020
|
+
height: coercePositiveNumber(height, 1),
|
|
76021
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
76022
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
76023
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
76024
|
+
};
|
|
76025
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "shapeGroup", {
|
|
76026
|
+
groupTransform,
|
|
76027
|
+
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
76028
|
+
size: size2
|
|
76029
|
+
});
|
|
76030
|
+
}
|
|
76031
|
+
function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
76032
|
+
const rawAttrs = getAttrs$1(node2);
|
|
76033
|
+
const geometry = {
|
|
76034
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
76035
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
76036
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
76037
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
76038
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
76039
|
+
};
|
|
76040
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
76041
|
+
}
|
|
76042
|
+
function shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
76043
|
+
const rawAttrs = getAttrs$1(node2);
|
|
76044
|
+
const geometry = {
|
|
76045
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
76046
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
76047
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
76048
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
76049
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
76050
|
+
};
|
|
76051
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
76052
|
+
}
|
|
76053
|
+
function handleVectorShapeNode(node2, context) {
|
|
76054
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
76055
|
+
const drawingBlock = vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
76056
|
+
if (drawingBlock) {
|
|
76057
|
+
blocks2.push(drawingBlock);
|
|
76058
|
+
recordBlockKind(drawingBlock.kind);
|
|
76059
|
+
}
|
|
76060
|
+
}
|
|
76061
|
+
function handleShapeGroupNode(node2, context) {
|
|
76062
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
76063
|
+
const drawingBlock = shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
76064
|
+
if (drawingBlock) {
|
|
76065
|
+
blocks2.push(drawingBlock);
|
|
76066
|
+
recordBlockKind(drawingBlock.kind);
|
|
76067
|
+
}
|
|
76068
|
+
}
|
|
76069
|
+
function handleShapeContainerNode(node2, context) {
|
|
76070
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
76071
|
+
const drawingBlock = shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
76072
|
+
if (drawingBlock) {
|
|
76073
|
+
blocks2.push(drawingBlock);
|
|
76074
|
+
recordBlockKind(drawingBlock.kind);
|
|
76075
|
+
}
|
|
76076
|
+
}
|
|
76077
|
+
function handleShapeTextboxNode(node2, context) {
|
|
76078
|
+
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
76079
|
+
const drawingBlock = shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
76080
|
+
if (drawingBlock) {
|
|
76081
|
+
blocks2.push(drawingBlock);
|
|
76082
|
+
recordBlockKind(drawingBlock.kind);
|
|
76083
|
+
}
|
|
76084
|
+
}
|
|
76085
|
+
const getAttrs = (node2) => {
|
|
76086
|
+
return isPlainObject$2$1(node2.attrs) ? { ...node2.attrs } : {};
|
|
76087
|
+
};
|
|
76088
|
+
const parseFullWidth = (value) => {
|
|
76089
|
+
if (typeof value === "string") {
|
|
76090
|
+
const trimmed = value.trim();
|
|
76091
|
+
if (trimmed.endsWith("%")) {
|
|
76092
|
+
return { width: trimmed === "100%" ? 1 : null, isFullWidth: trimmed === "100%" };
|
|
76093
|
+
}
|
|
76094
|
+
return { width: pickNumber(trimmed) ?? null, isFullWidth: false };
|
|
76095
|
+
}
|
|
76096
|
+
return { width: pickNumber(value) ?? null, isFullWidth: false };
|
|
76097
|
+
};
|
|
76098
|
+
function contentBlockNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
76099
|
+
const rawAttrs = getAttrs(node2);
|
|
76100
|
+
const indentLeft = pickNumber(rawAttrs.hrIndentLeft);
|
|
76101
|
+
const indentRight = pickNumber(rawAttrs.hrIndentRight);
|
|
76102
|
+
if (rawAttrs.horizontalRule !== true) {
|
|
76103
|
+
return null;
|
|
76104
|
+
}
|
|
76105
|
+
const size2 = isPlainObject$2$1(rawAttrs.size) ? rawAttrs.size : void 0;
|
|
76106
|
+
const { width, isFullWidth } = parseFullWidth(size2?.width);
|
|
76107
|
+
const height = pickNumber(size2?.height);
|
|
76108
|
+
if (!height || height <= 0) {
|
|
76109
|
+
return null;
|
|
76110
|
+
}
|
|
76111
|
+
if (!isFullWidth && (!width || width <= 0)) {
|
|
76112
|
+
return null;
|
|
76113
|
+
}
|
|
76114
|
+
if (isFullWidth) {
|
|
76115
|
+
rawAttrs.isFullWidth = true;
|
|
76116
|
+
}
|
|
76117
|
+
if (indentLeft != null || indentRight != null) {
|
|
76118
|
+
rawAttrs.hrIndentLeft = indentLeft;
|
|
76119
|
+
rawAttrs.hrIndentRight = indentRight;
|
|
76120
|
+
}
|
|
76121
|
+
if (typeof rawAttrs.background === "string" && rawAttrs.background.trim()) {
|
|
76122
|
+
rawAttrs.fillColor = rawAttrs.background;
|
|
76123
|
+
}
|
|
76124
|
+
const geometry = {
|
|
76125
|
+
width: isFullWidth ? 1 : width ?? 1,
|
|
76126
|
+
height,
|
|
76127
|
+
rotation: 0,
|
|
76128
|
+
flipH: false,
|
|
76129
|
+
flipV: false
|
|
76130
|
+
};
|
|
76131
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape", {
|
|
76132
|
+
strokeColor: null
|
|
76133
|
+
});
|
|
76134
|
+
}
|
|
75872
76135
|
const extractValue = (value) => {
|
|
75873
76136
|
if (value && typeof value === "object" && "value" in value) {
|
|
75874
76137
|
return value.value;
|
|
@@ -76592,6 +76855,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76592
76855
|
}
|
|
76593
76856
|
return;
|
|
76594
76857
|
}
|
|
76858
|
+
if (node2.type === "contentBlock") {
|
|
76859
|
+
const attrs = node2.attrs ?? {};
|
|
76860
|
+
if (attrs.horizontalRule === true) {
|
|
76861
|
+
flushParagraph();
|
|
76862
|
+
const indent2 = paragraphAttrs?.indent;
|
|
76863
|
+
const hrIndentLeft = typeof indent2?.left === "number" ? indent2.left : void 0;
|
|
76864
|
+
const hrIndentRight = typeof indent2?.right === "number" ? indent2.right : void 0;
|
|
76865
|
+
const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
|
|
76866
|
+
const hrNode = hasIndent ? { ...node2, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node2;
|
|
76867
|
+
const convert2 = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
|
|
76868
|
+
const drawingBlock = convert2(hrNode, nextBlockId, positions);
|
|
76869
|
+
if (drawingBlock) {
|
|
76870
|
+
blocks2.push(drawingBlock);
|
|
76871
|
+
}
|
|
76872
|
+
}
|
|
76873
|
+
return;
|
|
76874
|
+
}
|
|
76595
76875
|
if (node2.type === "vectorShape") {
|
|
76596
76876
|
flushParagraph();
|
|
76597
76877
|
if (converters?.vectorShapeNodeToDrawingBlock) {
|
|
@@ -76804,12 +77084,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76804
77084
|
});
|
|
76805
77085
|
sectionState.currentParagraphIndex++;
|
|
76806
77086
|
}
|
|
76807
|
-
const WRAP_TYPES
|
|
76808
|
-
const WRAP_TEXT_VALUES
|
|
76809
|
-
const H_RELATIVE_VALUES
|
|
76810
|
-
const V_RELATIVE_VALUES
|
|
76811
|
-
const H_ALIGN_VALUES
|
|
76812
|
-
const V_ALIGN_VALUES
|
|
77087
|
+
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
77088
|
+
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
77089
|
+
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
77090
|
+
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
77091
|
+
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
77092
|
+
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
76813
77093
|
const isPlainObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
76814
77094
|
const isAllowedObjectFit = (value) => {
|
|
76815
77095
|
return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
|
|
@@ -76827,15 +77107,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76827
77107
|
});
|
|
76828
77108
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
76829
77109
|
}
|
|
76830
|
-
const normalizeWrapType
|
|
77110
|
+
const normalizeWrapType = (value) => {
|
|
76831
77111
|
if (typeof value !== "string") return void 0;
|
|
76832
|
-
return WRAP_TYPES
|
|
77112
|
+
return WRAP_TYPES.has(value) ? value : void 0;
|
|
76833
77113
|
};
|
|
76834
|
-
const normalizeWrapText
|
|
77114
|
+
const normalizeWrapText = (value) => {
|
|
76835
77115
|
if (typeof value !== "string") return void 0;
|
|
76836
|
-
return WRAP_TEXT_VALUES
|
|
77116
|
+
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
76837
77117
|
};
|
|
76838
|
-
const normalizePolygon
|
|
77118
|
+
const normalizePolygon = (value) => {
|
|
76839
77119
|
if (!Array.isArray(value)) return void 0;
|
|
76840
77120
|
const polygon = [];
|
|
76841
77121
|
value.forEach((point2) => {
|
|
@@ -76861,17 +77141,17 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76861
77141
|
}
|
|
76862
77142
|
return void 0;
|
|
76863
77143
|
};
|
|
76864
|
-
const normalizeWrap$
|
|
77144
|
+
const normalizeWrap$1 = (value) => {
|
|
76865
77145
|
if (!isPlainObject$4(value)) {
|
|
76866
77146
|
return void 0;
|
|
76867
77147
|
}
|
|
76868
|
-
const type2 = normalizeWrapType
|
|
77148
|
+
const type2 = normalizeWrapType(value.type);
|
|
76869
77149
|
if (!type2) {
|
|
76870
77150
|
return void 0;
|
|
76871
77151
|
}
|
|
76872
77152
|
const wrap2 = { type: type2 };
|
|
76873
77153
|
const attrs = isPlainObject$4(value.attrs) ? value.attrs : {};
|
|
76874
|
-
const wrapText = normalizeWrapText
|
|
77154
|
+
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
76875
77155
|
if (wrapText) {
|
|
76876
77156
|
wrap2.wrapText = wrapText;
|
|
76877
77157
|
}
|
|
@@ -76883,7 +77163,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76883
77163
|
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
76884
77164
|
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
76885
77165
|
if (distRight != null) wrap2.distRight = distRight;
|
|
76886
|
-
const polygon = normalizePolygon
|
|
77166
|
+
const polygon = normalizePolygon(attrs.polygon);
|
|
76887
77167
|
if (polygon) {
|
|
76888
77168
|
wrap2.polygon = polygon;
|
|
76889
77169
|
}
|
|
@@ -76893,15 +77173,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76893
77173
|
}
|
|
76894
77174
|
return wrap2;
|
|
76895
77175
|
};
|
|
76896
|
-
const normalizeAnchorRelative
|
|
77176
|
+
const normalizeAnchorRelative = (value, allowed) => {
|
|
76897
77177
|
if (typeof value !== "string") return void 0;
|
|
76898
77178
|
return allowed.has(value) ? value : void 0;
|
|
76899
77179
|
};
|
|
76900
|
-
const normalizeAnchorAlign
|
|
77180
|
+
const normalizeAnchorAlign = (value, allowed) => {
|
|
76901
77181
|
if (typeof value !== "string") return void 0;
|
|
76902
77182
|
return allowed.has(value) ? value : void 0;
|
|
76903
77183
|
};
|
|
76904
|
-
const normalizeAnchorData
|
|
77184
|
+
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
76905
77185
|
const raw = isPlainObject$4(value) ? value : void 0;
|
|
76906
77186
|
const marginOffset = isPlainObject$4(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
76907
77187
|
const simplePos = isPlainObject$4(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
@@ -76911,13 +77191,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76911
77191
|
if (isAnchored) {
|
|
76912
77192
|
anchor.isAnchored = true;
|
|
76913
77193
|
}
|
|
76914
|
-
const hRelative = normalizeAnchorRelative
|
|
77194
|
+
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
76915
77195
|
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
76916
|
-
const vRelative = normalizeAnchorRelative
|
|
77196
|
+
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
76917
77197
|
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
76918
|
-
const alignH = normalizeAnchorAlign
|
|
77198
|
+
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
76919
77199
|
if (alignH) anchor.alignH = alignH;
|
|
76920
|
-
const alignV = normalizeAnchorAlign
|
|
77200
|
+
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
76921
77201
|
if (alignV) anchor.alignV = alignV;
|
|
76922
77202
|
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
76923
77203
|
if (offsetH != null) anchor.offsetH = offsetH;
|
|
@@ -76943,8 +77223,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76943
77223
|
const width = typeof size2.width === "number" && Number.isFinite(size2.width) ? size2.width : void 0;
|
|
76944
77224
|
const height = typeof size2.height === "number" && Number.isFinite(size2.height) ? size2.height : void 0;
|
|
76945
77225
|
const explicitDisplay = typeof attrs.display === "string" ? attrs.display : void 0;
|
|
76946
|
-
const normalizedWrap = normalizeWrap$
|
|
76947
|
-
let anchor = normalizeAnchorData
|
|
77226
|
+
const normalizedWrap = normalizeWrap$1(attrs.wrap);
|
|
77227
|
+
let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
|
|
76948
77228
|
if (!anchor && normalizedWrap) {
|
|
76949
77229
|
anchor = { isAnchored: true };
|
|
76950
77230
|
if (normalizedWrap.behindDoc != null) {
|
|
@@ -76986,221 +77266,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
76986
77266
|
recordBlockKind(imageBlock.kind);
|
|
76987
77267
|
}
|
|
76988
77268
|
}
|
|
76989
|
-
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
76990
|
-
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
76991
|
-
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
76992
|
-
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
76993
|
-
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
76994
|
-
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
76995
|
-
const getAttrs = (node2) => {
|
|
76996
|
-
return isPlainObject$2$1(node2.attrs) ? node2.attrs : {};
|
|
76997
|
-
};
|
|
76998
|
-
const normalizeWrapType = (value) => {
|
|
76999
|
-
if (typeof value !== "string") return void 0;
|
|
77000
|
-
return WRAP_TYPES.has(value) ? value : void 0;
|
|
77001
|
-
};
|
|
77002
|
-
const normalizeWrapText = (value) => {
|
|
77003
|
-
if (typeof value !== "string") return void 0;
|
|
77004
|
-
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
77005
|
-
};
|
|
77006
|
-
const normalizePolygon = (value) => {
|
|
77007
|
-
if (!Array.isArray(value)) return void 0;
|
|
77008
|
-
const polygon = [];
|
|
77009
|
-
value.forEach((point2) => {
|
|
77010
|
-
if (!Array.isArray(point2) || point2.length < 2) return;
|
|
77011
|
-
const x2 = pickNumber(point2[0]);
|
|
77012
|
-
const y2 = pickNumber(point2[1]);
|
|
77013
|
-
if (x2 == null || y2 == null) return;
|
|
77014
|
-
polygon.push([x2, y2]);
|
|
77015
|
-
});
|
|
77016
|
-
return polygon.length > 0 ? polygon : void 0;
|
|
77017
|
-
};
|
|
77018
|
-
const normalizeWrap$1 = (value) => {
|
|
77019
|
-
if (!isPlainObject$2$1(value)) {
|
|
77020
|
-
return void 0;
|
|
77021
|
-
}
|
|
77022
|
-
const type2 = normalizeWrapType(value.type);
|
|
77023
|
-
if (!type2 || type2 === "Inline") {
|
|
77024
|
-
return void 0;
|
|
77025
|
-
}
|
|
77026
|
-
const wrap2 = { type: type2 };
|
|
77027
|
-
const attrs = isPlainObject$2$1(value.attrs) ? value.attrs : {};
|
|
77028
|
-
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
77029
|
-
if (wrapText) {
|
|
77030
|
-
wrap2.wrapText = wrapText;
|
|
77031
|
-
}
|
|
77032
|
-
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
77033
|
-
if (distTop != null) wrap2.distTop = distTop;
|
|
77034
|
-
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
77035
|
-
if (distBottom != null) wrap2.distBottom = distBottom;
|
|
77036
|
-
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
77037
|
-
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
77038
|
-
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
77039
|
-
if (distRight != null) wrap2.distRight = distRight;
|
|
77040
|
-
const polygon = normalizePolygon(attrs.polygon);
|
|
77041
|
-
if (polygon) {
|
|
77042
|
-
wrap2.polygon = polygon;
|
|
77043
|
-
}
|
|
77044
|
-
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
77045
|
-
if (behindDoc != null) {
|
|
77046
|
-
wrap2.behindDoc = behindDoc;
|
|
77047
|
-
}
|
|
77048
|
-
return wrap2;
|
|
77049
|
-
};
|
|
77050
|
-
const normalizeAnchorRelative = (value, allowed) => {
|
|
77051
|
-
if (typeof value !== "string") return void 0;
|
|
77052
|
-
return allowed.has(value) ? value : void 0;
|
|
77053
|
-
};
|
|
77054
|
-
const normalizeAnchorAlign = (value, allowed) => {
|
|
77055
|
-
if (typeof value !== "string") return void 0;
|
|
77056
|
-
return allowed.has(value) ? value : void 0;
|
|
77057
|
-
};
|
|
77058
|
-
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
77059
|
-
const raw = isPlainObject$2$1(value) ? value : void 0;
|
|
77060
|
-
const marginOffset = isPlainObject$2$1(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
77061
|
-
const simplePos = isPlainObject$2$1(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
77062
|
-
const originalAttrs = isPlainObject$2$1(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
77063
|
-
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
77064
|
-
const anchor = {};
|
|
77065
|
-
if (isAnchored) {
|
|
77066
|
-
anchor.isAnchored = true;
|
|
77067
|
-
}
|
|
77068
|
-
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
77069
|
-
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
77070
|
-
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
77071
|
-
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
77072
|
-
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
77073
|
-
if (alignH) anchor.alignH = alignH;
|
|
77074
|
-
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
77075
|
-
if (alignV) anchor.alignV = alignV;
|
|
77076
|
-
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
77077
|
-
if (offsetH != null) anchor.offsetH = offsetH;
|
|
77078
|
-
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
77079
|
-
if (offsetV != null) anchor.offsetV = offsetV;
|
|
77080
|
-
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
77081
|
-
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
77082
|
-
const hasData = anchor.isAnchored || anchor.hRelativeFrom != null || anchor.vRelativeFrom != null || anchor.alignH != null || anchor.alignV != null || anchor.offsetH != null || anchor.offsetV != null || anchor.behindDoc != null;
|
|
77083
|
-
return hasData ? anchor : void 0;
|
|
77084
|
-
};
|
|
77085
|
-
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node2, geometry, drawingKind, extraProps) => {
|
|
77086
|
-
const normalizedWrap = normalizeWrap$1(rawAttrs.wrap);
|
|
77087
|
-
const baseAnchor = normalizeAnchorData(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
77088
|
-
const pos = positions.get(node2);
|
|
77089
|
-
const attrsWithPm = { ...rawAttrs };
|
|
77090
|
-
if (pos) {
|
|
77091
|
-
attrsWithPm.pmStart = pos.start;
|
|
77092
|
-
attrsWithPm.pmEnd = pos.end;
|
|
77093
|
-
}
|
|
77094
|
-
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
77095
|
-
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
77096
|
-
return {
|
|
77097
|
-
kind: "drawing",
|
|
77098
|
-
id: nextBlockId("drawing"),
|
|
77099
|
-
drawingKind,
|
|
77100
|
-
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
77101
|
-
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
77102
|
-
anchor: baseAnchor,
|
|
77103
|
-
wrap: normalizedWrap,
|
|
77104
|
-
zIndex: finalZIndex,
|
|
77105
|
-
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
77106
|
-
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
77107
|
-
attrs: attrsWithPm,
|
|
77108
|
-
geometry,
|
|
77109
|
-
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
77110
|
-
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
77111
|
-
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
77112
|
-
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
77113
|
-
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
77114
|
-
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
77115
|
-
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
77116
|
-
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
77117
|
-
...extraProps
|
|
77118
|
-
};
|
|
77119
|
-
};
|
|
77120
|
-
function vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
77121
|
-
const rawAttrs = getAttrs(node2);
|
|
77122
|
-
const geometry = {
|
|
77123
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
77124
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
77125
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
77126
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
77127
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
77128
|
-
};
|
|
77129
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
77130
|
-
}
|
|
77131
|
-
function shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
77132
|
-
const rawAttrs = getAttrs(node2);
|
|
77133
|
-
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
77134
|
-
const size2 = normalizeShapeSize(rawAttrs.size);
|
|
77135
|
-
const width = size2?.width ?? groupTransform?.width ?? 1;
|
|
77136
|
-
const height = size2?.height ?? groupTransform?.height ?? 1;
|
|
77137
|
-
const geometry = {
|
|
77138
|
-
width: coercePositiveNumber(width, 1),
|
|
77139
|
-
height: coercePositiveNumber(height, 1),
|
|
77140
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
77141
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
77142
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
77143
|
-
};
|
|
77144
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "shapeGroup", {
|
|
77145
|
-
groupTransform,
|
|
77146
|
-
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
77147
|
-
size: size2
|
|
77148
|
-
});
|
|
77149
|
-
}
|
|
77150
|
-
function shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
77151
|
-
const rawAttrs = getAttrs(node2);
|
|
77152
|
-
const geometry = {
|
|
77153
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
77154
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
77155
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
77156
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
77157
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
77158
|
-
};
|
|
77159
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
77160
|
-
}
|
|
77161
|
-
function shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions) {
|
|
77162
|
-
const rawAttrs = getAttrs(node2);
|
|
77163
|
-
const geometry = {
|
|
77164
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
77165
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
77166
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
77167
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
77168
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
77169
|
-
};
|
|
77170
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node2, geometry, "vectorShape");
|
|
77171
|
-
}
|
|
77172
|
-
function handleVectorShapeNode(node2, context) {
|
|
77173
|
-
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
77174
|
-
const drawingBlock = vectorShapeNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
77175
|
-
if (drawingBlock) {
|
|
77176
|
-
blocks2.push(drawingBlock);
|
|
77177
|
-
recordBlockKind(drawingBlock.kind);
|
|
77178
|
-
}
|
|
77179
|
-
}
|
|
77180
|
-
function handleShapeGroupNode(node2, context) {
|
|
77181
|
-
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
77182
|
-
const drawingBlock = shapeGroupNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
77183
|
-
if (drawingBlock) {
|
|
77184
|
-
blocks2.push(drawingBlock);
|
|
77185
|
-
recordBlockKind(drawingBlock.kind);
|
|
77186
|
-
}
|
|
77187
|
-
}
|
|
77188
|
-
function handleShapeContainerNode(node2, context) {
|
|
77189
|
-
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
77190
|
-
const drawingBlock = shapeContainerNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
77191
|
-
if (drawingBlock) {
|
|
77192
|
-
blocks2.push(drawingBlock);
|
|
77193
|
-
recordBlockKind(drawingBlock.kind);
|
|
77194
|
-
}
|
|
77195
|
-
}
|
|
77196
|
-
function handleShapeTextboxNode(node2, context) {
|
|
77197
|
-
const { blocks: blocks2, recordBlockKind, nextBlockId, positions } = context;
|
|
77198
|
-
const drawingBlock = shapeTextboxNodeToDrawingBlock(node2, nextBlockId, positions);
|
|
77199
|
-
if (drawingBlock) {
|
|
77200
|
-
blocks2.push(drawingBlock);
|
|
77201
|
-
recordBlockKind(drawingBlock.kind);
|
|
77202
|
-
}
|
|
77203
|
-
}
|
|
77204
77269
|
const hydrateTableStyleAttrs = (tableNode, context) => {
|
|
77205
77270
|
const hydration = {};
|
|
77206
77271
|
const tableProps = tableNode.attrs?.tableProperties ?? null;
|
|
@@ -78006,6 +78071,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
78006
78071
|
hyperlinkConfig,
|
|
78007
78072
|
themeColors,
|
|
78008
78073
|
{
|
|
78074
|
+
contentBlockNodeToDrawingBlock,
|
|
78009
78075
|
imageNodeToBlock,
|
|
78010
78076
|
vectorShapeNodeToDrawingBlock,
|
|
78011
78077
|
shapeGroupNodeToDrawingBlock,
|
|
@@ -87790,9 +87856,13 @@ ${l}
|
|
|
87790
87856
|
const maxWidth = Math.max(0, columns.width - (marginLeft + marginRight));
|
|
87791
87857
|
let width = measure.width;
|
|
87792
87858
|
let height = measure.height;
|
|
87793
|
-
|
|
87794
|
-
|
|
87795
|
-
|
|
87859
|
+
const attrs = block.attrs;
|
|
87860
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
87861
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
87862
|
+
const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
|
|
87863
|
+
if (width > maxWidthForBlock && maxWidthForBlock > 0) {
|
|
87864
|
+
const scale = maxWidthForBlock / width;
|
|
87865
|
+
width = maxWidthForBlock;
|
|
87796
87866
|
height *= scale;
|
|
87797
87867
|
}
|
|
87798
87868
|
let state2 = ensurePage();
|
|
@@ -87811,7 +87881,7 @@ ${l}
|
|
|
87811
87881
|
kind: "drawing",
|
|
87812
87882
|
blockId: block.id,
|
|
87813
87883
|
drawingKind: block.drawingKind,
|
|
87814
|
-
x: columnX(state2.columnIndex) + marginLeft,
|
|
87884
|
+
x: columnX(state2.columnIndex) + marginLeft + indentLeft,
|
|
87815
87885
|
y: state2.cursorY + marginTop,
|
|
87816
87886
|
width,
|
|
87817
87887
|
height,
|
|
@@ -94653,10 +94723,18 @@ ${l}
|
|
|
94653
94723
|
};
|
|
94654
94724
|
}
|
|
94655
94725
|
const geometry = ensureDrawingGeometry(block.geometry);
|
|
94726
|
+
const attrs = block.attrs;
|
|
94727
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
94728
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
94729
|
+
const hasFullWidth = attrs?.isFullWidth === true && constraints.maxWidth > 0;
|
|
94730
|
+
const fullWidthMax = hasFullWidth ? Math.max(1, constraints.maxWidth - indentLeft - indentRight) : void 0;
|
|
94731
|
+
if (fullWidthMax != null) {
|
|
94732
|
+
geometry.width = fullWidthMax;
|
|
94733
|
+
}
|
|
94656
94734
|
const rotatedBounds = calculateRotatedBounds(geometry);
|
|
94657
94735
|
const naturalWidth = Math.max(1, rotatedBounds.width);
|
|
94658
94736
|
const naturalHeight = Math.max(1, rotatedBounds.height);
|
|
94659
|
-
const maxWidth = constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth;
|
|
94737
|
+
const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth);
|
|
94660
94738
|
const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
|
|
94661
94739
|
const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
94662
94740
|
const widthScale = maxWidth / naturalWidth;
|
|
@@ -138518,17 +138596,17 @@ ${reason}`);
|
|
|
138518
138596
|
});
|
|
138519
138597
|
});
|
|
138520
138598
|
}
|
|
138521
|
-
const addYComment = (yArray, ydoc, event) => {
|
|
138599
|
+
const addYComment = (yArray, ydoc, event, user) => {
|
|
138522
138600
|
const { comment: comment2 } = event;
|
|
138523
138601
|
const yComment = new Y.Map(Object.entries(comment2));
|
|
138524
138602
|
ydoc.transact(
|
|
138525
138603
|
() => {
|
|
138526
138604
|
yArray.push([yComment]);
|
|
138527
138605
|
},
|
|
138528
|
-
{ user
|
|
138606
|
+
{ user }
|
|
138529
138607
|
);
|
|
138530
138608
|
};
|
|
138531
|
-
const updateYComment = (yArray, ydoc, event) => {
|
|
138609
|
+
const updateYComment = (yArray, ydoc, event, user) => {
|
|
138532
138610
|
const { comment: comment2 } = event;
|
|
138533
138611
|
const yComment = new Y.Map(Object.entries(comment2));
|
|
138534
138612
|
const commentIndex = getCommentIndex(yArray, comment2);
|
|
@@ -138538,10 +138616,10 @@ ${reason}`);
|
|
|
138538
138616
|
yArray.delete(commentIndex, 1);
|
|
138539
138617
|
yArray.insert(commentIndex, [yComment]);
|
|
138540
138618
|
},
|
|
138541
|
-
{ user
|
|
138619
|
+
{ user }
|
|
138542
138620
|
);
|
|
138543
138621
|
};
|
|
138544
|
-
const deleteYComment = (yArray, ydoc, event) => {
|
|
138622
|
+
const deleteYComment = (yArray, ydoc, event, user) => {
|
|
138545
138623
|
const { comment: comment2 } = event;
|
|
138546
138624
|
const commentIndex = getCommentIndex(yArray, comment2);
|
|
138547
138625
|
if (commentIndex === -1) return;
|
|
@@ -138549,26 +138627,26 @@ ${reason}`);
|
|
|
138549
138627
|
() => {
|
|
138550
138628
|
yArray.delete(commentIndex, 1);
|
|
138551
138629
|
},
|
|
138552
|
-
{ user
|
|
138630
|
+
{ user }
|
|
138553
138631
|
);
|
|
138554
138632
|
};
|
|
138555
138633
|
const getCommentIndex = (yArray, comment2) => {
|
|
138556
138634
|
const baseArray = yArray.toJSON();
|
|
138557
138635
|
return baseArray.findIndex((c2) => c2.commentId === comment2.commentId);
|
|
138558
138636
|
};
|
|
138559
|
-
const initCollaborationComments = (
|
|
138560
|
-
if (!
|
|
138637
|
+
const initCollaborationComments = (superdoc) => {
|
|
138638
|
+
if (!superdoc.config.modules.comments || !superdoc.provider) return;
|
|
138561
138639
|
const onSuperDocYdocSynced = () => {
|
|
138562
|
-
const parent =
|
|
138563
|
-
const ids =
|
|
138564
|
-
|
|
138565
|
-
|
|
138566
|
-
|
|
138567
|
-
};
|
|
138568
|
-
|
|
138569
|
-
const commentsArray =
|
|
138640
|
+
const parent = superdoc.commentsStore.commentsParentElement;
|
|
138641
|
+
const ids = superdoc.commentsStore.editorCommentIds;
|
|
138642
|
+
superdoc.commentsStore.handleEditorLocationsUpdate(parent, ids);
|
|
138643
|
+
superdoc.commentsStore.hasSyncedCollaborationComments = true;
|
|
138644
|
+
superdoc.provider.off("synced", onSuperDocYdocSynced);
|
|
138645
|
+
};
|
|
138646
|
+
superdoc.provider.on("synced", onSuperDocYdocSynced);
|
|
138647
|
+
const commentsArray = superdoc.ydoc.getArray("comments");
|
|
138570
138648
|
commentsArray.observe((event) => {
|
|
138571
|
-
const currentUser =
|
|
138649
|
+
const currentUser = superdoc.config.user;
|
|
138572
138650
|
const { user = {} } = event.transaction.origin;
|
|
138573
138651
|
if (currentUser.name === user.name && currentUser.email === user.email) return;
|
|
138574
138652
|
const comments = commentsArray.toJSON();
|
|
@@ -138580,59 +138658,60 @@ ${reason}`);
|
|
|
138580
138658
|
filtered.push(c2);
|
|
138581
138659
|
}
|
|
138582
138660
|
});
|
|
138583
|
-
|
|
138661
|
+
superdoc.commentsStore.commentsList = filtered.map((c2) => useComment(c2));
|
|
138584
138662
|
});
|
|
138585
138663
|
};
|
|
138586
|
-
const initSuperdocYdoc = (
|
|
138587
|
-
const { isInternal } =
|
|
138588
|
-
const baseName = `${
|
|
138589
|
-
if (!
|
|
138664
|
+
const initSuperdocYdoc = (superdoc) => {
|
|
138665
|
+
const { isInternal } = superdoc.config;
|
|
138666
|
+
const baseName = `${superdoc.config.superdocId}-superdoc`;
|
|
138667
|
+
if (!superdoc.config.superdocId) return;
|
|
138590
138668
|
const documentId = isInternal ? baseName : `${baseName}-external`;
|
|
138591
138669
|
const superdocCollaborationOptions = {
|
|
138592
|
-
config:
|
|
138593
|
-
user:
|
|
138670
|
+
config: superdoc.config.modules.collaboration,
|
|
138671
|
+
user: superdoc.config.user,
|
|
138594
138672
|
documentId,
|
|
138595
|
-
socket:
|
|
138596
|
-
superdocInstance:
|
|
138673
|
+
socket: superdoc.config.socket,
|
|
138674
|
+
superdocInstance: superdoc
|
|
138597
138675
|
};
|
|
138598
138676
|
const { provider: superdocProvider, ydoc: superdocYdoc } = createProvider(superdocCollaborationOptions);
|
|
138599
138677
|
return { ydoc: superdocYdoc, provider: superdocProvider };
|
|
138600
138678
|
};
|
|
138601
|
-
const makeDocumentsCollaborative = (
|
|
138679
|
+
const makeDocumentsCollaborative = (superdoc) => {
|
|
138602
138680
|
const processedDocuments = [];
|
|
138603
|
-
|
|
138604
|
-
|
|
138681
|
+
superdoc.config.documents.forEach((doc2) => {
|
|
138682
|
+
superdoc.config.user.color = superdoc.colors[0];
|
|
138605
138683
|
const options = {
|
|
138606
|
-
config:
|
|
138607
|
-
user:
|
|
138684
|
+
config: superdoc.config.modules.collaboration,
|
|
138685
|
+
user: superdoc.config.user,
|
|
138608
138686
|
documentId: doc2.id,
|
|
138609
|
-
socket:
|
|
138610
|
-
superdocInstance:
|
|
138687
|
+
socket: superdoc.config.socket,
|
|
138688
|
+
superdocInstance: superdoc
|
|
138611
138689
|
};
|
|
138612
138690
|
const { provider: provider2, ydoc } = createProvider(options);
|
|
138613
138691
|
doc2.provider = provider2;
|
|
138614
|
-
doc2.socket =
|
|
138692
|
+
doc2.socket = superdoc.config.socket;
|
|
138615
138693
|
doc2.ydoc = ydoc;
|
|
138616
|
-
doc2.role =
|
|
138694
|
+
doc2.role = superdoc.config.role;
|
|
138617
138695
|
processedDocuments.push(doc2);
|
|
138618
138696
|
});
|
|
138619
138697
|
return processedDocuments;
|
|
138620
138698
|
};
|
|
138621
|
-
const syncCommentsToClients = (
|
|
138622
|
-
if (!
|
|
138623
|
-
const yArray =
|
|
138699
|
+
const syncCommentsToClients = (superdoc, event) => {
|
|
138700
|
+
if (!superdoc.isCollaborative || !superdoc.config.modules.comments) return;
|
|
138701
|
+
const yArray = superdoc.ydoc.getArray("comments");
|
|
138702
|
+
const user = superdoc.config.user;
|
|
138624
138703
|
switch (event.type) {
|
|
138625
138704
|
case "add":
|
|
138626
|
-
addYComment(yArray,
|
|
138705
|
+
addYComment(yArray, superdoc.ydoc, event, user);
|
|
138627
138706
|
break;
|
|
138628
138707
|
case "update":
|
|
138629
|
-
updateYComment(yArray,
|
|
138708
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
138630
138709
|
break;
|
|
138631
138710
|
case "resolved":
|
|
138632
|
-
updateYComment(yArray,
|
|
138711
|
+
updateYComment(yArray, superdoc.ydoc, event, user);
|
|
138633
138712
|
break;
|
|
138634
138713
|
case "deleted":
|
|
138635
|
-
deleteYComment(yArray,
|
|
138714
|
+
deleteYComment(yArray, superdoc.ydoc, event, user);
|
|
138636
138715
|
break;
|
|
138637
138716
|
}
|
|
138638
138717
|
};
|
|
@@ -138707,22 +138786,22 @@ ${reason}`);
|
|
|
138707
138786
|
const resolvedTime = ref(params2.resolvedTime || null);
|
|
138708
138787
|
const resolvedByEmail = ref(params2.resolvedByEmail || null);
|
|
138709
138788
|
const resolvedByName = ref(params2.resolvedByName || null);
|
|
138710
|
-
const resolveComment = ({ email, name, superdoc
|
|
138789
|
+
const resolveComment = ({ email, name, superdoc }) => {
|
|
138711
138790
|
if (resolvedTime.value) return;
|
|
138712
138791
|
resolvedTime.value = Date.now();
|
|
138713
138792
|
resolvedByEmail.value = email;
|
|
138714
138793
|
resolvedByName.value = name;
|
|
138715
138794
|
if (trackedChange.value) {
|
|
138716
138795
|
const emitData2 = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
138717
|
-
propagateUpdate(
|
|
138718
|
-
|
|
138796
|
+
propagateUpdate(superdoc, emitData2);
|
|
138797
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
138719
138798
|
return;
|
|
138720
138799
|
}
|
|
138721
138800
|
const emitData = { type: comments_module_events.RESOLVED, comment: getValues() };
|
|
138722
|
-
propagateUpdate(
|
|
138723
|
-
|
|
138801
|
+
propagateUpdate(superdoc, emitData);
|
|
138802
|
+
superdoc.activeEditor?.commands?.resolveComment({ commentId, importedId });
|
|
138724
138803
|
};
|
|
138725
|
-
const setIsInternal = ({ isInternal: newIsInternal, superdoc
|
|
138804
|
+
const setIsInternal = ({ isInternal: newIsInternal, superdoc }) => {
|
|
138726
138805
|
const previousValue = isInternal.value;
|
|
138727
138806
|
if (previousValue === newIsInternal) return;
|
|
138728
138807
|
isInternal.value = newIsInternal;
|
|
@@ -138731,16 +138810,16 @@ ${reason}`);
|
|
|
138731
138810
|
changes: [{ key: "isInternal", value: newIsInternal, previousValue }],
|
|
138732
138811
|
comment: getValues()
|
|
138733
138812
|
};
|
|
138734
|
-
propagateUpdate(
|
|
138735
|
-
const activeEditor =
|
|
138813
|
+
propagateUpdate(superdoc, emitData);
|
|
138814
|
+
const activeEditor = superdoc.activeEditor;
|
|
138736
138815
|
if (!activeEditor) return;
|
|
138737
138816
|
activeEditor.commands.setCommentInternal({ commentId, importedId, isInternal: newIsInternal });
|
|
138738
138817
|
};
|
|
138739
|
-
const setActive = (
|
|
138740
|
-
const { activeEditor } =
|
|
138818
|
+
const setActive = (superdoc) => {
|
|
138819
|
+
const { activeEditor } = superdoc;
|
|
138741
138820
|
activeEditor?.commands.setActiveComment({ commentId, importedId });
|
|
138742
138821
|
};
|
|
138743
|
-
const setText = ({ text: text2, superdoc
|
|
138822
|
+
const setText = ({ text: text2, superdoc, suppressUpdate }) => {
|
|
138744
138823
|
commentText.value = text2;
|
|
138745
138824
|
mentions.value = extractMentions(text2);
|
|
138746
138825
|
if (suppressUpdate) return;
|
|
@@ -138749,7 +138828,7 @@ ${reason}`);
|
|
|
138749
138828
|
changes: [{ key: "text", value: text2 }],
|
|
138750
138829
|
comment: getValues()
|
|
138751
138830
|
};
|
|
138752
|
-
propagateUpdate(
|
|
138831
|
+
propagateUpdate(superdoc, emitData);
|
|
138753
138832
|
};
|
|
138754
138833
|
const extractMentions = (htmlString) => {
|
|
138755
138834
|
const parser = new DOMParser();
|
|
@@ -138786,9 +138865,9 @@ ${reason}`);
|
|
|
138786
138865
|
const user = importedAuthor.value ? { name: importedAuthor.value.name || "(Imported)", email: importedAuthor.value.email } : { name: creatorName, email: creatorEmail, image: creatorImage };
|
|
138787
138866
|
return user;
|
|
138788
138867
|
};
|
|
138789
|
-
const propagateUpdate = (
|
|
138790
|
-
|
|
138791
|
-
syncCommentsToClients(
|
|
138868
|
+
const propagateUpdate = (superdoc, event) => {
|
|
138869
|
+
superdoc.emit("comments-update", event);
|
|
138870
|
+
syncCommentsToClients(superdoc, event);
|
|
138792
138871
|
};
|
|
138793
138872
|
const getValues = () => {
|
|
138794
138873
|
return {
|
|
@@ -139213,21 +139292,21 @@ ${reason}`);
|
|
|
139213
139292
|
if (id === void 0 || id === null) return null;
|
|
139214
139293
|
return commentsList.value.find((c2) => c2.commentId == id || c2.importedId == id);
|
|
139215
139294
|
};
|
|
139216
|
-
const setActiveComment = (
|
|
139295
|
+
const setActiveComment = (superdoc, id) => {
|
|
139217
139296
|
if (id === void 0 || id === null) {
|
|
139218
139297
|
activeComment.value = null;
|
|
139219
|
-
if (
|
|
139220
|
-
|
|
139298
|
+
if (superdoc.activeEditor) {
|
|
139299
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: null });
|
|
139221
139300
|
}
|
|
139222
139301
|
return;
|
|
139223
139302
|
}
|
|
139224
139303
|
const comment2 = getComment(id);
|
|
139225
139304
|
if (comment2) activeComment.value = comment2.commentId;
|
|
139226
|
-
if (
|
|
139227
|
-
|
|
139305
|
+
if (superdoc.activeEditor) {
|
|
139306
|
+
superdoc.activeEditor.commands?.setActiveComment({ commentId: activeComment.value });
|
|
139228
139307
|
}
|
|
139229
139308
|
};
|
|
139230
|
-
const handleTrackedChangeUpdate = ({ superdoc
|
|
139309
|
+
const handleTrackedChangeUpdate = ({ superdoc, params: params2 }) => {
|
|
139231
139310
|
const {
|
|
139232
139311
|
event,
|
|
139233
139312
|
changeId,
|
|
@@ -139260,7 +139339,7 @@ ${reason}`);
|
|
|
139260
139339
|
}
|
|
139261
139340
|
});
|
|
139262
139341
|
if (event === "add") {
|
|
139263
|
-
addComment({ superdoc
|
|
139342
|
+
addComment({ superdoc, comment: comment2 });
|
|
139264
139343
|
} else if (event === "update") {
|
|
139265
139344
|
const existingTrackedChange = commentsList.value.find((comment22) => comment22.commentId === changeId);
|
|
139266
139345
|
if (!existingTrackedChange) return;
|
|
@@ -139272,33 +139351,33 @@ ${reason}`);
|
|
|
139272
139351
|
type: COMMENT_EVENTS.UPDATE,
|
|
139273
139352
|
comment: existingTrackedChange.getValues()
|
|
139274
139353
|
};
|
|
139275
|
-
syncCommentsToClients(
|
|
139276
|
-
debounceEmit(changeId, emitData,
|
|
139354
|
+
syncCommentsToClients(superdoc, emitData);
|
|
139355
|
+
debounceEmit(changeId, emitData, superdoc);
|
|
139277
139356
|
}
|
|
139278
139357
|
};
|
|
139279
|
-
const debounceEmit = (commentId, event,
|
|
139358
|
+
const debounceEmit = (commentId, event, superdoc, delay = 1e3) => {
|
|
139280
139359
|
if (debounceTimers[commentId]) {
|
|
139281
139360
|
clearTimeout(debounceTimers[commentId]);
|
|
139282
139361
|
}
|
|
139283
139362
|
debounceTimers[commentId] = setTimeout(() => {
|
|
139284
|
-
if (
|
|
139285
|
-
|
|
139363
|
+
if (superdoc) {
|
|
139364
|
+
superdoc.emit("comments-update", event);
|
|
139286
139365
|
}
|
|
139287
139366
|
delete debounceTimers[commentId];
|
|
139288
139367
|
}, delay);
|
|
139289
139368
|
};
|
|
139290
|
-
const showAddComment = (
|
|
139369
|
+
const showAddComment = (superdoc) => {
|
|
139291
139370
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
139292
|
-
|
|
139371
|
+
superdoc.emit("comments-update", event);
|
|
139293
139372
|
const selection = { ...superdocStore.activeSelection };
|
|
139294
139373
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
139295
139374
|
if (superdocStore.selectionPosition?.source) {
|
|
139296
139375
|
superdocStore.selectionPosition.source = null;
|
|
139297
139376
|
}
|
|
139298
139377
|
pendingComment.value = getPendingComment({ selection, documentId: selection.documentId, parentCommentId: null });
|
|
139299
|
-
if (!
|
|
139300
|
-
if (
|
|
139301
|
-
|
|
139378
|
+
if (!superdoc.config.isInternal) pendingComment.value.isInternal = false;
|
|
139379
|
+
if (superdoc.activeEditor?.commands) {
|
|
139380
|
+
superdoc.activeEditor.commands.insertComment({
|
|
139302
139381
|
...pendingComment.value.getValues(),
|
|
139303
139382
|
commentId: "pending",
|
|
139304
139383
|
skipEmit: true
|
|
@@ -139368,14 +139447,14 @@ ${reason}`);
|
|
|
139368
139447
|
...options
|
|
139369
139448
|
});
|
|
139370
139449
|
};
|
|
139371
|
-
const removePendingComment = (
|
|
139450
|
+
const removePendingComment = (superdoc) => {
|
|
139372
139451
|
currentCommentText.value = "";
|
|
139373
139452
|
pendingComment.value = null;
|
|
139374
139453
|
activeComment.value = null;
|
|
139375
139454
|
superdocStore.selectionPosition = null;
|
|
139376
|
-
|
|
139455
|
+
superdoc.activeEditor?.commands.removeComment({ commentId: "pending" });
|
|
139377
139456
|
};
|
|
139378
|
-
const addComment = ({ superdoc
|
|
139457
|
+
const addComment = ({ superdoc, comment: comment2, skipEditorUpdate = false }) => {
|
|
139379
139458
|
let parentComment = commentsList.value.find((c2) => c2.commentId === activeComment.value);
|
|
139380
139459
|
if (!parentComment) parentComment = comment2;
|
|
139381
139460
|
const newComment = useComment(comment2.getValues());
|
|
@@ -139386,22 +139465,22 @@ ${reason}`);
|
|
|
139386
139465
|
const isParentInternal = parentComment.isInternal;
|
|
139387
139466
|
newComment.isInternal = isParentInternal;
|
|
139388
139467
|
}
|
|
139389
|
-
if (!
|
|
139468
|
+
if (!superdoc.config.isInternal) newComment.isInternal = false;
|
|
139390
139469
|
commentsList.value.push(newComment);
|
|
139391
|
-
removePendingComment(
|
|
139392
|
-
if (!skipEditorUpdate && !comment2.trackedChange &&
|
|
139393
|
-
|
|
139470
|
+
removePendingComment(superdoc);
|
|
139471
|
+
if (!skipEditorUpdate && !comment2.trackedChange && superdoc.activeEditor?.commands && !comment2.parentCommentId) {
|
|
139472
|
+
superdoc.activeEditor.commands.insertComment({ ...newComment.getValues(), skipEmit: true });
|
|
139394
139473
|
}
|
|
139395
139474
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
139396
|
-
syncCommentsToClients(
|
|
139397
|
-
|
|
139475
|
+
syncCommentsToClients(superdoc, event);
|
|
139476
|
+
superdoc.emit("comments-update", event);
|
|
139398
139477
|
};
|
|
139399
|
-
const deleteComment = ({ commentId: commentIdToDelete, superdoc
|
|
139478
|
+
const deleteComment = ({ commentId: commentIdToDelete, superdoc }) => {
|
|
139400
139479
|
const commentIndex = commentsList.value.findIndex((c2) => c2.commentId === commentIdToDelete);
|
|
139401
139480
|
const comment2 = commentsList.value[commentIndex];
|
|
139402
139481
|
const { commentId, importedId } = comment2;
|
|
139403
139482
|
const { fileId } = comment2;
|
|
139404
|
-
|
|
139483
|
+
superdoc.activeEditor?.commands?.removeComment({ commentId, importedId });
|
|
139405
139484
|
commentsList.value.splice(commentIndex, 1);
|
|
139406
139485
|
const childCommentIds = commentsList.value.filter((c2) => c2.parentCommentId === commentId).map((c2) => c2.commentId || c2.importedId);
|
|
139407
139486
|
commentsList.value = commentsList.value.filter((c2) => !childCommentIds.includes(c2.commentId));
|
|
@@ -139410,13 +139489,13 @@ ${reason}`);
|
|
|
139410
139489
|
comment: comment2.getValues(),
|
|
139411
139490
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
139412
139491
|
};
|
|
139413
|
-
|
|
139414
|
-
syncCommentsToClients(
|
|
139492
|
+
superdoc.emit("comments-update", event);
|
|
139493
|
+
syncCommentsToClients(superdoc, event);
|
|
139415
139494
|
};
|
|
139416
|
-
const cancelComment = (
|
|
139417
|
-
removePendingComment(
|
|
139495
|
+
const cancelComment = (superdoc) => {
|
|
139496
|
+
removePendingComment(superdoc);
|
|
139418
139497
|
};
|
|
139419
|
-
const processLoadedDocxComments = async ({ superdoc
|
|
139498
|
+
const processLoadedDocxComments = async ({ superdoc, editor, comments, documentId }) => {
|
|
139420
139499
|
const document2 = superdocStore.getDocument(documentId);
|
|
139421
139500
|
comments.forEach((comment2) => {
|
|
139422
139501
|
const htmlContent = getHtmlFromComment(comment2.textJson);
|
|
@@ -139448,7 +139527,7 @@ ${reason}`);
|
|
|
139448
139527
|
trackedChangeType: comment2.trackedChangeType,
|
|
139449
139528
|
deletedText: comment2.trackedDeletedText
|
|
139450
139529
|
});
|
|
139451
|
-
addComment({ superdoc
|
|
139530
|
+
addComment({ superdoc, comment: newComment });
|
|
139452
139531
|
});
|
|
139453
139532
|
setTimeout(() => {
|
|
139454
139533
|
createCommentForTrackChanges(editor);
|
|
@@ -151896,12 +151975,12 @@ ${style2}
|
|
|
151896
151975
|
element: null,
|
|
151897
151976
|
commentsStore: null
|
|
151898
151977
|
};
|
|
151899
|
-
constructor(options,
|
|
151978
|
+
constructor(options, superdoc) {
|
|
151900
151979
|
super();
|
|
151901
151980
|
this.config = { ...this.config, ...options };
|
|
151902
151981
|
this.element = this.config.element;
|
|
151903
151982
|
this.app = null;
|
|
151904
|
-
this.superdoc =
|
|
151983
|
+
this.superdoc = superdoc;
|
|
151905
151984
|
this.open();
|
|
151906
151985
|
}
|
|
151907
151986
|
createVueApp() {
|
|
@@ -153744,7 +153823,7 @@ ${style2}
|
|
|
153744
153823
|
this.config.colors = shuffleArray(this.config.colors);
|
|
153745
153824
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
153746
153825
|
this.colorIndex = 0;
|
|
153747
|
-
this.version = "1.0.0-next.
|
|
153826
|
+
this.version = "1.0.0-next.7";
|
|
153748
153827
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
153749
153828
|
this.superdocId = config2.superdocId || v4();
|
|
153750
153829
|
this.colors = this.config.colors;
|
|
@@ -156217,7 +156296,7 @@ ${style2}
|
|
|
156217
156296
|
value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
|
|
156218
156297
|
);
|
|
156219
156298
|
}
|
|
156220
|
-
const
|
|
156299
|
+
const indexIZySkMqb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
156221
156300
|
__proto__: null,
|
|
156222
156301
|
unified
|
|
156223
156302
|
}, Symbol.toStringTag, { value: "Module" }));
|