@harbour-enterprises/superdoc 1.0.0-next.6 → 1.0.0-next.8
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-BYeEi4Kx.es.js → PdfViewer-BpJTAUeT.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CF4W_li8.cjs → PdfViewer-DVL0SRPs.cjs} +1 -1
- package/dist/chunks/{index-BcHbK1Ip.cjs → index-D-MAmimV.cjs} +3 -3
- package/dist/chunks/{index-CKb2zoi7-BEMsbmpK.cjs → index-DQd4iefd-BfbLCMZZ.cjs} +1 -1
- package/dist/chunks/{index-CKb2zoi7-aboErZCf.es.js → index-DQd4iefd-qCZ-Mcie.es.js} +1 -1
- package/dist/chunks/{index-CocFivpQ.es.js → index-WYp7dt-q.es.js} +3 -3
- package/dist/chunks/{super-editor.es-C7JZxENm.es.js → super-editor.es-BDJ97wfW.es.js} +363 -264
- package/dist/chunks/{super-editor.es-TXxmZOAu.cjs → super-editor.es-DzMe-1gi.cjs} +363 -264
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CyZvCMe8.js → converter-BH40Zd-y.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DPV5rnMJ.js → docx-zipper-DP41TnQj.js} +1 -1
- package/dist/super-editor/chunks/{editor-uiCiCr8n.js → editor-C81JiIaN.js} +330 -252
- package/dist/super-editor/chunks/{index-CKb2zoi7.js → index-DQd4iefd.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Icc3CdW0.js → toolbar-BmUYOo96.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 +40 -19
- 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 +365 -266
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -42410,7 +42410,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
42410
42410
|
static getStoredSuperdocVersion(docx) {
|
|
42411
42411
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
42412
42412
|
}
|
|
42413
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.
|
|
42413
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-next.8") {
|
|
42414
42414
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
42415
42415
|
}
|
|
42416
42416
|
/**
|
|
@@ -54808,9 +54808,7 @@ const deleteSelection = () => ({ state: state2, tr, dispatch }) => {
|
|
|
54808
54808
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
54809
54809
|
if (typeof document !== "undefined" && document.getSelection) {
|
|
54810
54810
|
const currentDomSelection = document.getSelection();
|
|
54811
|
-
|
|
54812
|
-
const isCollapsed = currentDomSelection?.isCollapsed;
|
|
54813
|
-
if (!isCollapsed && selectedLength === 1) {
|
|
54811
|
+
if (currentDomSelection?.baseNode?.data?.length === 1) {
|
|
54814
54812
|
return false;
|
|
54815
54813
|
}
|
|
54816
54814
|
}
|
|
@@ -59638,7 +59636,7 @@ const isHeadless = (editor) => {
|
|
|
59638
59636
|
const shouldSkipNodeView = (editor) => {
|
|
59639
59637
|
return isHeadless(editor);
|
|
59640
59638
|
};
|
|
59641
|
-
const summaryVersion = "1.0.0-next.
|
|
59639
|
+
const summaryVersion = "1.0.0-next.8";
|
|
59642
59640
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
59643
59641
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
59644
59642
|
function mapAttributes(attrs) {
|
|
@@ -60427,7 +60425,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60427
60425
|
{ default: remarkStringify },
|
|
60428
60426
|
{ default: remarkGfm }
|
|
60429
60427
|
] = await Promise.all([
|
|
60430
|
-
import("./index-
|
|
60428
|
+
import("./index-DQd4iefd-qCZ-Mcie.es.js"),
|
|
60431
60429
|
import("./index-DRCvimau-Cw339678.es.js"),
|
|
60432
60430
|
import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
|
|
60433
60431
|
import("./index-D_sWOSiG-DE96TaT5.es.js"),
|
|
@@ -60632,7 +60630,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
60632
60630
|
* Process collaboration migrations
|
|
60633
60631
|
*/
|
|
60634
60632
|
processCollaborationMigrations() {
|
|
60635
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
60633
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.8");
|
|
60636
60634
|
if (!this.options.ydoc) return;
|
|
60637
60635
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
60638
60636
|
let docVersion = metaMap.get("version");
|
|
@@ -67994,6 +67992,271 @@ function handleDocumentPartObjectNode(node, context) {
|
|
|
67994
67992
|
}
|
|
67995
67993
|
}
|
|
67996
67994
|
}
|
|
67995
|
+
const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
67996
|
+
const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
67997
|
+
const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
67998
|
+
const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
67999
|
+
const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
68000
|
+
const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
68001
|
+
const getAttrs$1 = (node) => {
|
|
68002
|
+
return isPlainObject$2(node.attrs) ? node.attrs : {};
|
|
68003
|
+
};
|
|
68004
|
+
const normalizeWrapType$1 = (value) => {
|
|
68005
|
+
if (typeof value !== "string") return void 0;
|
|
68006
|
+
return WRAP_TYPES$1.has(value) ? value : void 0;
|
|
68007
|
+
};
|
|
68008
|
+
const normalizeWrapText$1 = (value) => {
|
|
68009
|
+
if (typeof value !== "string") return void 0;
|
|
68010
|
+
return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
|
|
68011
|
+
};
|
|
68012
|
+
const normalizePolygon$1 = (value) => {
|
|
68013
|
+
if (!Array.isArray(value)) return void 0;
|
|
68014
|
+
const polygon = [];
|
|
68015
|
+
value.forEach((point) => {
|
|
68016
|
+
if (!Array.isArray(point) || point.length < 2) return;
|
|
68017
|
+
const x2 = pickNumber(point[0]);
|
|
68018
|
+
const y2 = pickNumber(point[1]);
|
|
68019
|
+
if (x2 == null || y2 == null) return;
|
|
68020
|
+
polygon.push([x2, y2]);
|
|
68021
|
+
});
|
|
68022
|
+
return polygon.length > 0 ? polygon : void 0;
|
|
68023
|
+
};
|
|
68024
|
+
const normalizeWrap$2 = (value) => {
|
|
68025
|
+
if (!isPlainObject$2(value)) {
|
|
68026
|
+
return void 0;
|
|
68027
|
+
}
|
|
68028
|
+
const type2 = normalizeWrapType$1(value.type);
|
|
68029
|
+
if (!type2 || type2 === "Inline") {
|
|
68030
|
+
return void 0;
|
|
68031
|
+
}
|
|
68032
|
+
const wrap2 = { type: type2 };
|
|
68033
|
+
const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
|
|
68034
|
+
const wrapText = normalizeWrapText$1(attrs.wrapText);
|
|
68035
|
+
if (wrapText) {
|
|
68036
|
+
wrap2.wrapText = wrapText;
|
|
68037
|
+
}
|
|
68038
|
+
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
68039
|
+
if (distTop != null) wrap2.distTop = distTop;
|
|
68040
|
+
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
68041
|
+
if (distBottom != null) wrap2.distBottom = distBottom;
|
|
68042
|
+
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
68043
|
+
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
68044
|
+
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
68045
|
+
if (distRight != null) wrap2.distRight = distRight;
|
|
68046
|
+
const polygon = normalizePolygon$1(attrs.polygon);
|
|
68047
|
+
if (polygon) {
|
|
68048
|
+
wrap2.polygon = polygon;
|
|
68049
|
+
}
|
|
68050
|
+
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
68051
|
+
if (behindDoc != null) {
|
|
68052
|
+
wrap2.behindDoc = behindDoc;
|
|
68053
|
+
}
|
|
68054
|
+
return wrap2;
|
|
68055
|
+
};
|
|
68056
|
+
const normalizeAnchorRelative$1 = (value, allowed) => {
|
|
68057
|
+
if (typeof value !== "string") return void 0;
|
|
68058
|
+
return allowed.has(value) ? value : void 0;
|
|
68059
|
+
};
|
|
68060
|
+
const normalizeAnchorAlign$1 = (value, allowed) => {
|
|
68061
|
+
if (typeof value !== "string") return void 0;
|
|
68062
|
+
return allowed.has(value) ? value : void 0;
|
|
68063
|
+
};
|
|
68064
|
+
const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
|
|
68065
|
+
const raw = isPlainObject$2(value) ? value : void 0;
|
|
68066
|
+
const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
68067
|
+
const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
68068
|
+
const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
68069
|
+
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
68070
|
+
const anchor = {};
|
|
68071
|
+
if (isAnchored) {
|
|
68072
|
+
anchor.isAnchored = true;
|
|
68073
|
+
}
|
|
68074
|
+
const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
|
|
68075
|
+
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
68076
|
+
const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
|
|
68077
|
+
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
68078
|
+
const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
|
|
68079
|
+
if (alignH) anchor.alignH = alignH;
|
|
68080
|
+
const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
|
|
68081
|
+
if (alignV) anchor.alignV = alignV;
|
|
68082
|
+
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
68083
|
+
if (offsetH != null) anchor.offsetH = offsetH;
|
|
68084
|
+
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
68085
|
+
if (offsetV != null) anchor.offsetV = offsetV;
|
|
68086
|
+
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
68087
|
+
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
68088
|
+
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;
|
|
68089
|
+
return hasData ? anchor : void 0;
|
|
68090
|
+
};
|
|
68091
|
+
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
|
|
68092
|
+
const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
|
|
68093
|
+
const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
68094
|
+
const pos = positions.get(node);
|
|
68095
|
+
const attrsWithPm = { ...rawAttrs };
|
|
68096
|
+
if (pos) {
|
|
68097
|
+
attrsWithPm.pmStart = pos.start;
|
|
68098
|
+
attrsWithPm.pmEnd = pos.end;
|
|
68099
|
+
}
|
|
68100
|
+
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
68101
|
+
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
68102
|
+
return {
|
|
68103
|
+
kind: "drawing",
|
|
68104
|
+
id: nextBlockId("drawing"),
|
|
68105
|
+
drawingKind,
|
|
68106
|
+
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
68107
|
+
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
68108
|
+
anchor: baseAnchor,
|
|
68109
|
+
wrap: normalizedWrap,
|
|
68110
|
+
zIndex: finalZIndex,
|
|
68111
|
+
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
68112
|
+
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
68113
|
+
attrs: attrsWithPm,
|
|
68114
|
+
geometry,
|
|
68115
|
+
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
68116
|
+
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
68117
|
+
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
68118
|
+
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
68119
|
+
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
68120
|
+
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
68121
|
+
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
68122
|
+
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
68123
|
+
...extraProps
|
|
68124
|
+
};
|
|
68125
|
+
};
|
|
68126
|
+
function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
68127
|
+
const rawAttrs = getAttrs$1(node);
|
|
68128
|
+
const geometry = {
|
|
68129
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
68130
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
68131
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
68132
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
68133
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
68134
|
+
};
|
|
68135
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
68136
|
+
}
|
|
68137
|
+
function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
68138
|
+
const rawAttrs = getAttrs$1(node);
|
|
68139
|
+
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
68140
|
+
const size2 = normalizeShapeSize(rawAttrs.size);
|
|
68141
|
+
const width = size2?.width ?? groupTransform?.width ?? 1;
|
|
68142
|
+
const height = size2?.height ?? groupTransform?.height ?? 1;
|
|
68143
|
+
const geometry = {
|
|
68144
|
+
width: coercePositiveNumber(width, 1),
|
|
68145
|
+
height: coercePositiveNumber(height, 1),
|
|
68146
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
68147
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
68148
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
68149
|
+
};
|
|
68150
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
|
|
68151
|
+
groupTransform,
|
|
68152
|
+
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
68153
|
+
size: size2
|
|
68154
|
+
});
|
|
68155
|
+
}
|
|
68156
|
+
function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
68157
|
+
const rawAttrs = getAttrs$1(node);
|
|
68158
|
+
const geometry = {
|
|
68159
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
68160
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
68161
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
68162
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
68163
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
68164
|
+
};
|
|
68165
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
68166
|
+
}
|
|
68167
|
+
function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
68168
|
+
const rawAttrs = getAttrs$1(node);
|
|
68169
|
+
const geometry = {
|
|
68170
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
68171
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
68172
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
68173
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
68174
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
68175
|
+
};
|
|
68176
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
68177
|
+
}
|
|
68178
|
+
function handleVectorShapeNode(node, context) {
|
|
68179
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
68180
|
+
const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
68181
|
+
if (drawingBlock) {
|
|
68182
|
+
blocks.push(drawingBlock);
|
|
68183
|
+
recordBlockKind(drawingBlock.kind);
|
|
68184
|
+
}
|
|
68185
|
+
}
|
|
68186
|
+
function handleShapeGroupNode(node, context) {
|
|
68187
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
68188
|
+
const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
68189
|
+
if (drawingBlock) {
|
|
68190
|
+
blocks.push(drawingBlock);
|
|
68191
|
+
recordBlockKind(drawingBlock.kind);
|
|
68192
|
+
}
|
|
68193
|
+
}
|
|
68194
|
+
function handleShapeContainerNode(node, context) {
|
|
68195
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
68196
|
+
const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
68197
|
+
if (drawingBlock) {
|
|
68198
|
+
blocks.push(drawingBlock);
|
|
68199
|
+
recordBlockKind(drawingBlock.kind);
|
|
68200
|
+
}
|
|
68201
|
+
}
|
|
68202
|
+
function handleShapeTextboxNode(node, context) {
|
|
68203
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
68204
|
+
const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
68205
|
+
if (drawingBlock) {
|
|
68206
|
+
blocks.push(drawingBlock);
|
|
68207
|
+
recordBlockKind(drawingBlock.kind);
|
|
68208
|
+
}
|
|
68209
|
+
}
|
|
68210
|
+
const getAttrs = (node) => {
|
|
68211
|
+
return isPlainObject$2(node.attrs) ? { ...node.attrs } : {};
|
|
68212
|
+
};
|
|
68213
|
+
const parseFullWidth = (value) => {
|
|
68214
|
+
if (typeof value === "string") {
|
|
68215
|
+
const trimmed = value.trim();
|
|
68216
|
+
if (trimmed.endsWith("%")) {
|
|
68217
|
+
return { width: trimmed === "100%" ? 1 : null, isFullWidth: trimmed === "100%" };
|
|
68218
|
+
}
|
|
68219
|
+
return { width: pickNumber(trimmed) ?? null, isFullWidth: false };
|
|
68220
|
+
}
|
|
68221
|
+
return { width: pickNumber(value) ?? null, isFullWidth: false };
|
|
68222
|
+
};
|
|
68223
|
+
function contentBlockNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
68224
|
+
const rawAttrs = getAttrs(node);
|
|
68225
|
+
const indentLeft = pickNumber(rawAttrs.hrIndentLeft);
|
|
68226
|
+
const indentRight = pickNumber(rawAttrs.hrIndentRight);
|
|
68227
|
+
if (rawAttrs.horizontalRule !== true) {
|
|
68228
|
+
return null;
|
|
68229
|
+
}
|
|
68230
|
+
const size2 = isPlainObject$2(rawAttrs.size) ? rawAttrs.size : void 0;
|
|
68231
|
+
const { width, isFullWidth } = parseFullWidth(size2?.width);
|
|
68232
|
+
const height = pickNumber(size2?.height);
|
|
68233
|
+
if (!height || height <= 0) {
|
|
68234
|
+
return null;
|
|
68235
|
+
}
|
|
68236
|
+
if (!isFullWidth && (!width || width <= 0)) {
|
|
68237
|
+
return null;
|
|
68238
|
+
}
|
|
68239
|
+
if (isFullWidth) {
|
|
68240
|
+
rawAttrs.isFullWidth = true;
|
|
68241
|
+
}
|
|
68242
|
+
if (indentLeft != null || indentRight != null) {
|
|
68243
|
+
rawAttrs.hrIndentLeft = indentLeft;
|
|
68244
|
+
rawAttrs.hrIndentRight = indentRight;
|
|
68245
|
+
}
|
|
68246
|
+
if (typeof rawAttrs.background === "string" && rawAttrs.background.trim()) {
|
|
68247
|
+
rawAttrs.fillColor = rawAttrs.background;
|
|
68248
|
+
}
|
|
68249
|
+
const geometry = {
|
|
68250
|
+
width: isFullWidth ? 1 : width ?? 1,
|
|
68251
|
+
height,
|
|
68252
|
+
rotation: 0,
|
|
68253
|
+
flipH: false,
|
|
68254
|
+
flipV: false
|
|
68255
|
+
};
|
|
68256
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape", {
|
|
68257
|
+
strokeColor: null
|
|
68258
|
+
});
|
|
68259
|
+
}
|
|
67997
68260
|
const extractValue = (value) => {
|
|
67998
68261
|
if (value && typeof value === "object" && "value" in value) {
|
|
67999
68262
|
return value.value;
|
|
@@ -68717,6 +68980,23 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
68717
68980
|
}
|
|
68718
68981
|
return;
|
|
68719
68982
|
}
|
|
68983
|
+
if (node.type === "contentBlock") {
|
|
68984
|
+
const attrs = node.attrs ?? {};
|
|
68985
|
+
if (attrs.horizontalRule === true) {
|
|
68986
|
+
flushParagraph();
|
|
68987
|
+
const indent = paragraphAttrs?.indent;
|
|
68988
|
+
const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
|
|
68989
|
+
const hrIndentRight = typeof indent?.right === "number" ? indent.right : void 0;
|
|
68990
|
+
const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
|
|
68991
|
+
const hrNode = hasIndent ? { ...node, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node;
|
|
68992
|
+
const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
|
|
68993
|
+
const drawingBlock = convert(hrNode, nextBlockId, positions);
|
|
68994
|
+
if (drawingBlock) {
|
|
68995
|
+
blocks.push(drawingBlock);
|
|
68996
|
+
}
|
|
68997
|
+
}
|
|
68998
|
+
return;
|
|
68999
|
+
}
|
|
68720
69000
|
if (node.type === "vectorShape") {
|
|
68721
69001
|
flushParagraph();
|
|
68722
69002
|
if (converters?.vectorShapeNodeToDrawingBlock) {
|
|
@@ -68929,12 +69209,12 @@ function handleParagraphNode(node, context) {
|
|
|
68929
69209
|
});
|
|
68930
69210
|
sectionState.currentParagraphIndex++;
|
|
68931
69211
|
}
|
|
68932
|
-
const WRAP_TYPES
|
|
68933
|
-
const WRAP_TEXT_VALUES
|
|
68934
|
-
const H_RELATIVE_VALUES
|
|
68935
|
-
const V_RELATIVE_VALUES
|
|
68936
|
-
const H_ALIGN_VALUES
|
|
68937
|
-
const V_ALIGN_VALUES
|
|
69212
|
+
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
69213
|
+
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
69214
|
+
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
69215
|
+
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
69216
|
+
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
69217
|
+
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
68938
69218
|
const isPlainObject$4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
68939
69219
|
const isAllowedObjectFit = (value) => {
|
|
68940
69220
|
return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
|
|
@@ -68952,15 +69232,15 @@ function toBoxSpacing(spacing) {
|
|
|
68952
69232
|
});
|
|
68953
69233
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
68954
69234
|
}
|
|
68955
|
-
const normalizeWrapType
|
|
69235
|
+
const normalizeWrapType = (value) => {
|
|
68956
69236
|
if (typeof value !== "string") return void 0;
|
|
68957
|
-
return WRAP_TYPES
|
|
69237
|
+
return WRAP_TYPES.has(value) ? value : void 0;
|
|
68958
69238
|
};
|
|
68959
|
-
const normalizeWrapText
|
|
69239
|
+
const normalizeWrapText = (value) => {
|
|
68960
69240
|
if (typeof value !== "string") return void 0;
|
|
68961
|
-
return WRAP_TEXT_VALUES
|
|
69241
|
+
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
68962
69242
|
};
|
|
68963
|
-
const normalizePolygon
|
|
69243
|
+
const normalizePolygon = (value) => {
|
|
68964
69244
|
if (!Array.isArray(value)) return void 0;
|
|
68965
69245
|
const polygon = [];
|
|
68966
69246
|
value.forEach((point) => {
|
|
@@ -68986,17 +69266,17 @@ const toBoolean = (value) => {
|
|
|
68986
69266
|
}
|
|
68987
69267
|
return void 0;
|
|
68988
69268
|
};
|
|
68989
|
-
const normalizeWrap$
|
|
69269
|
+
const normalizeWrap$1 = (value) => {
|
|
68990
69270
|
if (!isPlainObject$4(value)) {
|
|
68991
69271
|
return void 0;
|
|
68992
69272
|
}
|
|
68993
|
-
const type2 = normalizeWrapType
|
|
69273
|
+
const type2 = normalizeWrapType(value.type);
|
|
68994
69274
|
if (!type2) {
|
|
68995
69275
|
return void 0;
|
|
68996
69276
|
}
|
|
68997
69277
|
const wrap2 = { type: type2 };
|
|
68998
69278
|
const attrs = isPlainObject$4(value.attrs) ? value.attrs : {};
|
|
68999
|
-
const wrapText = normalizeWrapText
|
|
69279
|
+
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
69000
69280
|
if (wrapText) {
|
|
69001
69281
|
wrap2.wrapText = wrapText;
|
|
69002
69282
|
}
|
|
@@ -69008,7 +69288,7 @@ const normalizeWrap$2 = (value) => {
|
|
|
69008
69288
|
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
69009
69289
|
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
69010
69290
|
if (distRight != null) wrap2.distRight = distRight;
|
|
69011
|
-
const polygon = normalizePolygon
|
|
69291
|
+
const polygon = normalizePolygon(attrs.polygon);
|
|
69012
69292
|
if (polygon) {
|
|
69013
69293
|
wrap2.polygon = polygon;
|
|
69014
69294
|
}
|
|
@@ -69018,15 +69298,15 @@ const normalizeWrap$2 = (value) => {
|
|
|
69018
69298
|
}
|
|
69019
69299
|
return wrap2;
|
|
69020
69300
|
};
|
|
69021
|
-
const normalizeAnchorRelative
|
|
69301
|
+
const normalizeAnchorRelative = (value, allowed) => {
|
|
69022
69302
|
if (typeof value !== "string") return void 0;
|
|
69023
69303
|
return allowed.has(value) ? value : void 0;
|
|
69024
69304
|
};
|
|
69025
|
-
const normalizeAnchorAlign
|
|
69305
|
+
const normalizeAnchorAlign = (value, allowed) => {
|
|
69026
69306
|
if (typeof value !== "string") return void 0;
|
|
69027
69307
|
return allowed.has(value) ? value : void 0;
|
|
69028
69308
|
};
|
|
69029
|
-
const normalizeAnchorData
|
|
69309
|
+
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
69030
69310
|
const raw = isPlainObject$4(value) ? value : void 0;
|
|
69031
69311
|
const marginOffset = isPlainObject$4(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
69032
69312
|
const simplePos = isPlainObject$4(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
@@ -69036,13 +69316,13 @@ const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
|
|
|
69036
69316
|
if (isAnchored) {
|
|
69037
69317
|
anchor.isAnchored = true;
|
|
69038
69318
|
}
|
|
69039
|
-
const hRelative = normalizeAnchorRelative
|
|
69319
|
+
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
69040
69320
|
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
69041
|
-
const vRelative = normalizeAnchorRelative
|
|
69321
|
+
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
69042
69322
|
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
69043
|
-
const alignH = normalizeAnchorAlign
|
|
69323
|
+
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
69044
69324
|
if (alignH) anchor.alignH = alignH;
|
|
69045
|
-
const alignV = normalizeAnchorAlign
|
|
69325
|
+
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
69046
69326
|
if (alignV) anchor.alignV = alignV;
|
|
69047
69327
|
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
69048
69328
|
if (offsetH != null) anchor.offsetH = offsetH;
|
|
@@ -69068,8 +69348,8 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
|
|
|
69068
69348
|
const width = typeof size2.width === "number" && Number.isFinite(size2.width) ? size2.width : void 0;
|
|
69069
69349
|
const height = typeof size2.height === "number" && Number.isFinite(size2.height) ? size2.height : void 0;
|
|
69070
69350
|
const explicitDisplay = typeof attrs.display === "string" ? attrs.display : void 0;
|
|
69071
|
-
const normalizedWrap = normalizeWrap$
|
|
69072
|
-
let anchor = normalizeAnchorData
|
|
69351
|
+
const normalizedWrap = normalizeWrap$1(attrs.wrap);
|
|
69352
|
+
let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
|
|
69073
69353
|
if (!anchor && normalizedWrap) {
|
|
69074
69354
|
anchor = { isAnchored: true };
|
|
69075
69355
|
if (normalizedWrap.behindDoc != null) {
|
|
@@ -69111,221 +69391,6 @@ function handleImageNode(node, context) {
|
|
|
69111
69391
|
recordBlockKind(imageBlock.kind);
|
|
69112
69392
|
}
|
|
69113
69393
|
}
|
|
69114
|
-
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
69115
|
-
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
69116
|
-
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
69117
|
-
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
69118
|
-
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
69119
|
-
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
69120
|
-
const getAttrs = (node) => {
|
|
69121
|
-
return isPlainObject$2(node.attrs) ? node.attrs : {};
|
|
69122
|
-
};
|
|
69123
|
-
const normalizeWrapType = (value) => {
|
|
69124
|
-
if (typeof value !== "string") return void 0;
|
|
69125
|
-
return WRAP_TYPES.has(value) ? value : void 0;
|
|
69126
|
-
};
|
|
69127
|
-
const normalizeWrapText = (value) => {
|
|
69128
|
-
if (typeof value !== "string") return void 0;
|
|
69129
|
-
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
69130
|
-
};
|
|
69131
|
-
const normalizePolygon = (value) => {
|
|
69132
|
-
if (!Array.isArray(value)) return void 0;
|
|
69133
|
-
const polygon = [];
|
|
69134
|
-
value.forEach((point) => {
|
|
69135
|
-
if (!Array.isArray(point) || point.length < 2) return;
|
|
69136
|
-
const x2 = pickNumber(point[0]);
|
|
69137
|
-
const y2 = pickNumber(point[1]);
|
|
69138
|
-
if (x2 == null || y2 == null) return;
|
|
69139
|
-
polygon.push([x2, y2]);
|
|
69140
|
-
});
|
|
69141
|
-
return polygon.length > 0 ? polygon : void 0;
|
|
69142
|
-
};
|
|
69143
|
-
const normalizeWrap$1 = (value) => {
|
|
69144
|
-
if (!isPlainObject$2(value)) {
|
|
69145
|
-
return void 0;
|
|
69146
|
-
}
|
|
69147
|
-
const type2 = normalizeWrapType(value.type);
|
|
69148
|
-
if (!type2 || type2 === "Inline") {
|
|
69149
|
-
return void 0;
|
|
69150
|
-
}
|
|
69151
|
-
const wrap2 = { type: type2 };
|
|
69152
|
-
const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
|
|
69153
|
-
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
69154
|
-
if (wrapText) {
|
|
69155
|
-
wrap2.wrapText = wrapText;
|
|
69156
|
-
}
|
|
69157
|
-
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
69158
|
-
if (distTop != null) wrap2.distTop = distTop;
|
|
69159
|
-
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
69160
|
-
if (distBottom != null) wrap2.distBottom = distBottom;
|
|
69161
|
-
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
69162
|
-
if (distLeft != null) wrap2.distLeft = distLeft;
|
|
69163
|
-
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
69164
|
-
if (distRight != null) wrap2.distRight = distRight;
|
|
69165
|
-
const polygon = normalizePolygon(attrs.polygon);
|
|
69166
|
-
if (polygon) {
|
|
69167
|
-
wrap2.polygon = polygon;
|
|
69168
|
-
}
|
|
69169
|
-
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
69170
|
-
if (behindDoc != null) {
|
|
69171
|
-
wrap2.behindDoc = behindDoc;
|
|
69172
|
-
}
|
|
69173
|
-
return wrap2;
|
|
69174
|
-
};
|
|
69175
|
-
const normalizeAnchorRelative = (value, allowed) => {
|
|
69176
|
-
if (typeof value !== "string") return void 0;
|
|
69177
|
-
return allowed.has(value) ? value : void 0;
|
|
69178
|
-
};
|
|
69179
|
-
const normalizeAnchorAlign = (value, allowed) => {
|
|
69180
|
-
if (typeof value !== "string") return void 0;
|
|
69181
|
-
return allowed.has(value) ? value : void 0;
|
|
69182
|
-
};
|
|
69183
|
-
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
69184
|
-
const raw = isPlainObject$2(value) ? value : void 0;
|
|
69185
|
-
const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
69186
|
-
const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
69187
|
-
const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
69188
|
-
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
69189
|
-
const anchor = {};
|
|
69190
|
-
if (isAnchored) {
|
|
69191
|
-
anchor.isAnchored = true;
|
|
69192
|
-
}
|
|
69193
|
-
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
69194
|
-
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
69195
|
-
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
69196
|
-
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
69197
|
-
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
69198
|
-
if (alignH) anchor.alignH = alignH;
|
|
69199
|
-
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
69200
|
-
if (alignV) anchor.alignV = alignV;
|
|
69201
|
-
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
69202
|
-
if (offsetH != null) anchor.offsetH = offsetH;
|
|
69203
|
-
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
69204
|
-
if (offsetV != null) anchor.offsetV = offsetV;
|
|
69205
|
-
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
69206
|
-
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
69207
|
-
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;
|
|
69208
|
-
return hasData ? anchor : void 0;
|
|
69209
|
-
};
|
|
69210
|
-
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
|
|
69211
|
-
const normalizedWrap = normalizeWrap$1(rawAttrs.wrap);
|
|
69212
|
-
const baseAnchor = normalizeAnchorData(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
69213
|
-
const pos = positions.get(node);
|
|
69214
|
-
const attrsWithPm = { ...rawAttrs };
|
|
69215
|
-
if (pos) {
|
|
69216
|
-
attrsWithPm.pmStart = pos.start;
|
|
69217
|
-
attrsWithPm.pmEnd = pos.end;
|
|
69218
|
-
}
|
|
69219
|
-
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
69220
|
-
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
69221
|
-
return {
|
|
69222
|
-
kind: "drawing",
|
|
69223
|
-
id: nextBlockId("drawing"),
|
|
69224
|
-
drawingKind,
|
|
69225
|
-
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
69226
|
-
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
69227
|
-
anchor: baseAnchor,
|
|
69228
|
-
wrap: normalizedWrap,
|
|
69229
|
-
zIndex: finalZIndex,
|
|
69230
|
-
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
69231
|
-
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
69232
|
-
attrs: attrsWithPm,
|
|
69233
|
-
geometry,
|
|
69234
|
-
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
69235
|
-
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
69236
|
-
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
69237
|
-
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
69238
|
-
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
69239
|
-
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
69240
|
-
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
69241
|
-
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
69242
|
-
...extraProps
|
|
69243
|
-
};
|
|
69244
|
-
};
|
|
69245
|
-
function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
69246
|
-
const rawAttrs = getAttrs(node);
|
|
69247
|
-
const geometry = {
|
|
69248
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
69249
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
69250
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
69251
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
69252
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
69253
|
-
};
|
|
69254
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
69255
|
-
}
|
|
69256
|
-
function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
69257
|
-
const rawAttrs = getAttrs(node);
|
|
69258
|
-
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
69259
|
-
const size2 = normalizeShapeSize(rawAttrs.size);
|
|
69260
|
-
const width = size2?.width ?? groupTransform?.width ?? 1;
|
|
69261
|
-
const height = size2?.height ?? groupTransform?.height ?? 1;
|
|
69262
|
-
const geometry = {
|
|
69263
|
-
width: coercePositiveNumber(width, 1),
|
|
69264
|
-
height: coercePositiveNumber(height, 1),
|
|
69265
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
69266
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
69267
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
69268
|
-
};
|
|
69269
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
|
|
69270
|
-
groupTransform,
|
|
69271
|
-
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
69272
|
-
size: size2
|
|
69273
|
-
});
|
|
69274
|
-
}
|
|
69275
|
-
function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
69276
|
-
const rawAttrs = getAttrs(node);
|
|
69277
|
-
const geometry = {
|
|
69278
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
69279
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
69280
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
69281
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
69282
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
69283
|
-
};
|
|
69284
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
69285
|
-
}
|
|
69286
|
-
function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
69287
|
-
const rawAttrs = getAttrs(node);
|
|
69288
|
-
const geometry = {
|
|
69289
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
69290
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
69291
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
69292
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
69293
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
69294
|
-
};
|
|
69295
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
69296
|
-
}
|
|
69297
|
-
function handleVectorShapeNode(node, context) {
|
|
69298
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
69299
|
-
const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
69300
|
-
if (drawingBlock) {
|
|
69301
|
-
blocks.push(drawingBlock);
|
|
69302
|
-
recordBlockKind(drawingBlock.kind);
|
|
69303
|
-
}
|
|
69304
|
-
}
|
|
69305
|
-
function handleShapeGroupNode(node, context) {
|
|
69306
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
69307
|
-
const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
69308
|
-
if (drawingBlock) {
|
|
69309
|
-
blocks.push(drawingBlock);
|
|
69310
|
-
recordBlockKind(drawingBlock.kind);
|
|
69311
|
-
}
|
|
69312
|
-
}
|
|
69313
|
-
function handleShapeContainerNode(node, context) {
|
|
69314
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
69315
|
-
const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
69316
|
-
if (drawingBlock) {
|
|
69317
|
-
blocks.push(drawingBlock);
|
|
69318
|
-
recordBlockKind(drawingBlock.kind);
|
|
69319
|
-
}
|
|
69320
|
-
}
|
|
69321
|
-
function handleShapeTextboxNode(node, context) {
|
|
69322
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
69323
|
-
const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
69324
|
-
if (drawingBlock) {
|
|
69325
|
-
blocks.push(drawingBlock);
|
|
69326
|
-
recordBlockKind(drawingBlock.kind);
|
|
69327
|
-
}
|
|
69328
|
-
}
|
|
69329
69394
|
const hydrateTableStyleAttrs = (tableNode, context) => {
|
|
69330
69395
|
const hydration = {};
|
|
69331
69396
|
const tableProps = tableNode.attrs?.tableProperties ?? null;
|
|
@@ -70131,6 +70196,7 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
|
|
|
70131
70196
|
hyperlinkConfig,
|
|
70132
70197
|
themeColors,
|
|
70133
70198
|
{
|
|
70199
|
+
contentBlockNodeToDrawingBlock,
|
|
70134
70200
|
imageNodeToBlock,
|
|
70135
70201
|
vectorShapeNodeToDrawingBlock,
|
|
70136
70202
|
shapeGroupNodeToDrawingBlock,
|
|
@@ -79915,9 +79981,13 @@ function layoutDrawingBlock({
|
|
|
79915
79981
|
const maxWidth = Math.max(0, columns.width - (marginLeft + marginRight));
|
|
79916
79982
|
let width = measure.width;
|
|
79917
79983
|
let height = measure.height;
|
|
79918
|
-
|
|
79919
|
-
|
|
79920
|
-
|
|
79984
|
+
const attrs = block.attrs;
|
|
79985
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
79986
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
79987
|
+
const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
|
|
79988
|
+
if (width > maxWidthForBlock && maxWidthForBlock > 0) {
|
|
79989
|
+
const scale = maxWidthForBlock / width;
|
|
79990
|
+
width = maxWidthForBlock;
|
|
79921
79991
|
height *= scale;
|
|
79922
79992
|
}
|
|
79923
79993
|
let state2 = ensurePage();
|
|
@@ -79936,7 +80006,7 @@ function layoutDrawingBlock({
|
|
|
79936
80006
|
kind: "drawing",
|
|
79937
80007
|
blockId: block.id,
|
|
79938
80008
|
drawingKind: block.drawingKind,
|
|
79939
|
-
x: columnX(state2.columnIndex) + marginLeft,
|
|
80009
|
+
x: columnX(state2.columnIndex) + marginLeft + indentLeft,
|
|
79940
80010
|
y: state2.cursorY + marginTop,
|
|
79941
80011
|
width,
|
|
79942
80012
|
height,
|
|
@@ -86778,10 +86848,18 @@ async function measureDrawingBlock(block, constraints) {
|
|
|
86778
86848
|
};
|
|
86779
86849
|
}
|
|
86780
86850
|
const geometry = ensureDrawingGeometry(block.geometry);
|
|
86851
|
+
const attrs = block.attrs;
|
|
86852
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
86853
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
86854
|
+
const hasFullWidth = attrs?.isFullWidth === true && constraints.maxWidth > 0;
|
|
86855
|
+
const fullWidthMax = hasFullWidth ? Math.max(1, constraints.maxWidth - indentLeft - indentRight) : void 0;
|
|
86856
|
+
if (fullWidthMax != null) {
|
|
86857
|
+
geometry.width = fullWidthMax;
|
|
86858
|
+
}
|
|
86781
86859
|
const rotatedBounds = calculateRotatedBounds(geometry);
|
|
86782
86860
|
const naturalWidth = Math.max(1, rotatedBounds.width);
|
|
86783
86861
|
const naturalHeight = Math.max(1, rotatedBounds.height);
|
|
86784
|
-
const maxWidth = constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth;
|
|
86862
|
+
const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth);
|
|
86785
86863
|
const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
|
|
86786
86864
|
const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
86787
86865
|
const widthScale = maxWidth / naturalWidth;
|
|
@@ -125895,9 +125973,9 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
|
|
|
125895
125973
|
action: (editor2) => {
|
|
125896
125974
|
editor2.commands.createDocumentSection();
|
|
125897
125975
|
},
|
|
125898
|
-
|
|
125899
|
-
|
|
125900
|
-
return
|
|
125976
|
+
// TODO: Temporarily disabled - restore original: `return trigger === TRIGGERS.click;`
|
|
125977
|
+
showWhen: () => {
|
|
125978
|
+
return false;
|
|
125901
125979
|
}
|
|
125902
125980
|
},
|
|
125903
125981
|
{
|
|
@@ -126235,19 +126313,31 @@ const _sfc_main$8 = {
|
|
|
126235
126313
|
return;
|
|
126236
126314
|
}
|
|
126237
126315
|
event.preventDefault();
|
|
126238
|
-
|
|
126316
|
+
const editorState = props.editor?.state;
|
|
126317
|
+
const hasRangeSelection = editorState?.selection?.from !== editorState?.selection?.to;
|
|
126318
|
+
let isClickInsideSelection = false;
|
|
126319
|
+
if (hasRangeSelection && Number.isFinite(event.clientX) && Number.isFinite(event.clientY)) {
|
|
126320
|
+
const hit = props.editor?.posAtCoords?.({ left: event.clientX, top: event.clientY });
|
|
126321
|
+
if (typeof hit?.pos === "number") {
|
|
126322
|
+
const { from: from2, to } = editorState.selection;
|
|
126323
|
+
isClickInsideSelection = hit.pos >= from2 && hit.pos <= to;
|
|
126324
|
+
}
|
|
126325
|
+
}
|
|
126326
|
+
if (!isClickInsideSelection) {
|
|
126327
|
+
moveCursorToMouseEvent(event, props.editor);
|
|
126328
|
+
}
|
|
126239
126329
|
try {
|
|
126240
126330
|
const context = await getEditorContext(props.editor, event);
|
|
126241
126331
|
currentContext.value = context;
|
|
126242
126332
|
sections.value = getItems({ ...context, trigger: "click" });
|
|
126243
126333
|
selectedId.value = flattenedItems.value[0]?.id || null;
|
|
126244
126334
|
searchQuery.value = "";
|
|
126245
|
-
const
|
|
126246
|
-
if (!
|
|
126335
|
+
const currentState = props.editor.state;
|
|
126336
|
+
if (!currentState) return;
|
|
126247
126337
|
props.editor.dispatch(
|
|
126248
|
-
|
|
126338
|
+
currentState.tr.setMeta(SlashMenuPluginKey, {
|
|
126249
126339
|
type: "open",
|
|
126250
|
-
pos: context?.pos ??
|
|
126340
|
+
pos: context?.pos ?? currentState.selection.from,
|
|
126251
126341
|
clientX: event.clientX,
|
|
126252
126342
|
clientY: event.clientY
|
|
126253
126343
|
})
|
|
@@ -126260,12 +126350,21 @@ const _sfc_main$8 = {
|
|
|
126260
126350
|
if (props.editor) {
|
|
126261
126351
|
item.action ? await item.action(props.editor, currentContext.value) : null;
|
|
126262
126352
|
if (item.component) {
|
|
126263
|
-
menuRef.value;
|
|
126353
|
+
const menuElement = menuRef.value;
|
|
126264
126354
|
const componentProps = getPropsByItemId(item.id, props);
|
|
126265
|
-
|
|
126266
|
-
|
|
126267
|
-
|
|
126268
|
-
|
|
126355
|
+
let popoverPosition = { left: menuPosition.value.left, top: menuPosition.value.top };
|
|
126356
|
+
if (menuElement) {
|
|
126357
|
+
const menuRect = menuElement.getBoundingClientRect();
|
|
126358
|
+
const container = menuElement.closest(".super-editor");
|
|
126359
|
+
if (container) {
|
|
126360
|
+
const containerRect = container.getBoundingClientRect();
|
|
126361
|
+
popoverPosition = {
|
|
126362
|
+
left: `${menuRect.left - containerRect.left}px`,
|
|
126363
|
+
top: `${menuRect.top - containerRect.top}px`
|
|
126364
|
+
};
|
|
126365
|
+
}
|
|
126366
|
+
}
|
|
126367
|
+
props.openPopover(markRaw(item.component), componentProps, popoverPosition);
|
|
126269
126368
|
closeMenu({ restoreCursor: false });
|
|
126270
126369
|
} else {
|
|
126271
126370
|
const shouldRestoreCursor = item.id !== "paste";
|