@harbour-enterprises/superdoc 1.0.0-next.6 → 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-BYeEi4Kx.es.js → PdfViewer-CCU0Mzny.es.js} +1 -1
- package/dist/chunks/{PdfViewer-CF4W_li8.cjs → PdfViewer-Ca1KqMaU.cjs} +1 -1
- package/dist/chunks/{index-BcHbK1Ip.cjs → index-DfbOKJbz.cjs} +3 -3
- package/dist/chunks/{index-CKb2zoi7-aboErZCf.es.js → index-IZySkMqb-BRW0f_kL.es.js} +1 -1
- package/dist/chunks/{index-CKb2zoi7-BEMsbmpK.cjs → index-IZySkMqb-OvIaFsnt.cjs} +1 -1
- package/dist/chunks/{index-CocFivpQ.es.js → index-q8FicN0U.es.js} +3 -3
- package/dist/chunks/{super-editor.es-C7JZxENm.es.js → super-editor.es--rLTKCxc.es.js} +330 -252
- package/dist/chunks/{super-editor.es-TXxmZOAu.cjs → super-editor.es-D_13cWx3.cjs} +330 -252
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CyZvCMe8.js → converter-BUHD74_1.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-DPV5rnMJ.js → docx-zipper-CtdkK288.js} +1 -1
- package/dist/super-editor/chunks/{editor-uiCiCr8n.js → editor-BV718qjr.js} +331 -253
- package/dist/super-editor/chunks/{index-CKb2zoi7.js → index-IZySkMqb.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Icc3CdW0.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 +332 -254
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, dispatchWithFallback_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, getPluginKeyName_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _map, _editor2, _descriptors, _collections, _editorEntries, _maxCachedEditors, _editorAccessOrder, _pendingCreations, _cacheHits, _cacheMisses, _evictions, _HeaderFooterEditorManager_instances, hasConverter_fn, extractCollections_fn, collectDescriptors_fn, teardownMissingEditors_fn, teardownEditors_fn, createEditor_fn, createEditorContainer_fn, registerConverterEditor_fn, unregisterConverterEditor_fn, updateAccessOrder_fn, enforceCacheSizeLimit_fn, _manager, _mediaFiles, _blockCache, _HeaderFooterLayoutAdapter_instances, getBlocks_fn, getConverterContext_fn, _selectionOverlay, _activeEditorHost, _activeDecorationContainer, _activeRegion, _borderLine, _dimmingOverlay, _EditorOverlayManager_instances, findDecorationContainer_fn, ensureEditorHost_fn, positionEditorHost_fn, hideDimmingOverlay_fn, showHeaderFooterBorder_fn, hideHeaderFooterBorder_fn, _instances, _options, _editor3, _visibleHost, _viewportHost, _painterHost, _selectionOverlay2, _hiddenHost, _layoutOptions, _layoutState, _domPainter, _pageGeometryHelper, _dragHandlerCleanup, _layoutError, _layoutErrorState, _errorBanner, _errorBannerMessage, _telemetryEmitter, _renderScheduled, _pendingDocChange, _isRerendering, _selectionUpdateScheduled, _remoteCursorUpdateScheduled, _rafHandle, _editorListeners, _sectionMetadata, _documentMode, _inputBridge, _trackedChangesMode, _trackedChangesEnabled, _trackedChangesOverrides, _headerFooterManager, _headerFooterAdapter, _headerFooterIdentifier, _multiSectionIdentifier, _headerLayoutResults, _footerLayoutResults, _headerLayoutsByRId, _footerLayoutsByRId, _headerDecorationProvider, _footerDecorationProvider, _headerFooterManagerCleanups, _headerRegions, _footerRegions, _session, _activeHeaderFooterEditor, _overlayManager, _hoverOverlay, _hoverTooltip, _modeBanner, _ariaLiveRegion, _hoverRegion, _clickCount, _lastClickTime, _lastClickPosition, _lastSelectedImageBlockId, _dragAnchor, _isDragging, _dragExtensionMode, _cellAnchor, _cellDragMode, _remoteCursorState, _remoteCursorElements, _remoteCursorDirty, _remoteCursorOverlay, _localSelectionLayer, _awarenessCleanup, _scrollCleanup, _scrollTimeout, _lastRemoteCursorRenderTime, _remoteCursorThrottleTimeout, _PresentationEditor_instances, collectCommentPositions_fn, aggregateLayoutBounds_fn, safeCleanup_fn, setupEditorListeners_fn, setupCollaborationCursors_fn, updateLocalAwarenessCursor_fn, normalizeAwarenessStates_fn, getFallbackColor_fn, getValidatedColor_fn, scheduleRemoteCursorUpdate_fn, scheduleRemoteCursorReRender_fn, updateRemoteCursors_fn, renderRemoteCursors_fn, renderRemoteCaret_fn, renderRemoteCursorLabel_fn, renderRemoteSelection_fn, setupPointerHandlers_fn, setupDragHandlers_fn, focusEditorAfterImageSelection_fn, setupInputBridge_fn, initHeaderFooterRegistry_fn, _handlePointerDown, getFirstTextPosition_fn, registerPointerClick_fn, getCellPosFromTableHit_fn, getTablePosFromHit_fn, shouldUseCellSelection_fn, setCellAnchor_fn, clearCellAnchor_fn, hitTestTable_fn, selectWordAt_fn, selectParagraphAt_fn, calculateExtendedSelection_fn, isWordCharacter_fn, _handlePointerMove, _handlePointerLeave, _handlePointerUp, _handleDragOver, _handleDrop, _handleDoubleClick, _handleKeyDown, focusHeaderFooterShortcut_fn, scheduleRerender_fn, flushRerenderQueue_fn, rerender_fn, ensurePainter_fn, scheduleSelectionUpdate_fn, updateSelection_fn, resolveLayoutOptions_fn, buildHeaderFooterInput_fn, computeHeaderFooterConstraints_fn, layoutPerRIdHeaderFooters_fn, updateDecorationProviders_fn, createDecorationProvider_fn, findHeaderFooterPageForPageNumber_fn, computeDecorationBox_fn, computeExpectedSectionType_fn, rebuildHeaderFooterRegions_fn, hitTestHeaderFooterRegion_fn, pointInRegion_fn, activateHeaderFooterRegion_fn, enterHeaderFooterMode_fn, exitHeaderFooterMode_fn, getActiveDomTarget_fn, emitHeaderFooterModeChanged_fn, emitHeaderFooterEditingContext_fn, updateAwarenessSession_fn, updateModeBanner_fn, announce_fn, validateHeaderFooterEditPermission_fn, emitHeaderFooterEditBlocked_fn, resolveDescriptorForRegion_fn, createDefaultHeaderFooter_fn, getPageElement_fn, scrollPageIntoView_fn, computeAnchorMap_fn, waitForPageMount_fn, getEffectivePageGap_fn, getBodyPageHeight_fn, getHeaderFooterPageHeight_fn, applyDomCorrectionToRects_fn, renderCellSelectionOverlay_fn, renderSelectionRects_fn, renderHoverRegion_fn, clearHoverRegion_fn, renderCaretOverlay_fn, getHeaderFooterContext_fn, computeHeaderFooterSelectionRects_fn, syncTrackedChangesPreferences_fn, deriveTrackedChangesMode_fn, deriveTrackedChangesEnabled_fn, getTrackChangesPluginState_fn, computeDefaultLayoutDefaults_fn, parseColumns_fn, inchesToPx_fn, applyZoom_fn, createLayoutMetrics_fn, getPageOffsetX_fn, convertPageLocalToOverlayCoords_fn, computeDomCaretPageLocal_fn, normalizeClientPoint_fn, computeCaretLayoutRectGeometry_fn, computeCaretLayoutRect_fn, computeCaretLayoutRectFromDOM_fn, computeTableCaretLayoutRect_fn, findLineContainingPos_fn, lineHeightBeforeIndex_fn, getCurrentPageIndex_fn, findRegionForPage_fn, handleLayoutError_fn, decorateError_fn, showLayoutErrorBanner_fn, dismissErrorBanner_fn, createHiddenHost_fn, _windowRoot, _layoutSurfaces, _getTargetDom, _isEditable, _onTargetChanged, _listeners, _currentTarget, _destroyed, _useWindowFallback, _PresentationInputBridge_instances, addListener_fn, dispatchToTarget_fn, forwardKeyboardEvent_fn, forwardTextEvent_fn, forwardCompositionEvent_fn, forwardContextMenu_fn, isEventOnActiveTarget_fn, shouldSkipSurface_fn, isInLayoutSurface_fn, getListenerTargets_fn, isPlainCharacterKey_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ParagraphNodeView_instances, checkShouldUpdate_fn, updateHTMLAttributes_fn, updateDOMStyles_fn, resolveNeighborParagraphProperties_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _VectorShapeView_instances, ensureParentPositioned_fn, _ShapeGroupView_instances, ensureParentPositioned_fn2;
|
|
13
13
|
import * as Y from "yjs";
|
|
14
14
|
import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
15
|
-
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
15
|
+
import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as htmlHandler, E as ReplaceStep, G as twipsToInches, H as inchesToTwips, I as ptToTwips, J as getResolvedParagraphProperties, K as linesToTwips, L as changeListLevel, O as findParentNode, Q as isList, U as updateNumberingProperties, V as ListHelpers, W as isMacOS, X as isIOS, Y as getSchemaTypeByName, Z as inputRulesPlugin, _ as TrackDeleteMarkName$1, $ as TrackInsertMarkName$1, a0 as v4, a1 as TrackFormatMarkName$1, a2 as comments_module_events, a3 as findMark, a4 as objectIncludes, a5 as AddMarkStep, a6 as RemoveMarkStep, a7 as twipsToLines, a8 as pixelsToTwips, a9 as helpers, aa as posToDOMRect, ab as CommandService, ac as SuperConverter, ad as createDocument, ae as createDocFromMarkdown, af as createDocFromHTML, ag as EditorState, ah as isActive, ai as unflattenListsInHtml, aj as SelectionRange, ak as Transform, al as resolveParagraphProperties, am as _getReferencedTableStyles, an as parseSizeUnit, ao as minMax, ap as updateDOMAttributes, aq as findChildren$5, ar as generateRandomSigned32BitIntStrId, as as decodeRPrFromMarks, at as calculateResolvedParagraphProperties, au as resolveRunProperties, av as encodeCSSFromPPr, aw as twipsToPixels$2, ax as encodeCSSFromRPr, ay as generateOrderedListIndex, az as docxNumberingHelpers, aA as InputRule, aB as convertSizeToCSS, aC as findParentNodeClosestToPos, aD as isInTable$1, aE as generateDocxRandomId, aF as insertNewRelationship, aG as inchesToPixels, aH as kebabCase, aI as getUnderlineCssString } from "./converter-BUHD74_1.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-CtdkK288.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -9098,11 +9098,9 @@ const toggleNode = (typeOrName, toggleTypeOrName, attrs = {}) => ({ state, comma
|
|
|
9098
9098
|
const selectAll = () => ({ state, dispatch }) => selectAll$1(state, dispatch);
|
|
9099
9099
|
const deleteSelection = () => ({ state, tr, dispatch }) => {
|
|
9100
9100
|
const { from: from2, to, empty: empty2 } = state.selection;
|
|
9101
|
-
if (
|
|
9101
|
+
if (document && document.getSelection) {
|
|
9102
9102
|
const currentDomSelection = document.getSelection();
|
|
9103
|
-
|
|
9104
|
-
const isCollapsed = currentDomSelection?.isCollapsed;
|
|
9105
|
-
if (!isCollapsed && selectedLength === 1) {
|
|
9103
|
+
if (currentDomSelection?.baseNode?.data?.length == 1) {
|
|
9106
9104
|
return false;
|
|
9107
9105
|
}
|
|
9108
9106
|
}
|
|
@@ -13962,7 +13960,7 @@ const isHeadless = (editor) => {
|
|
|
13962
13960
|
const shouldSkipNodeView = (editor) => {
|
|
13963
13961
|
return isHeadless(editor);
|
|
13964
13962
|
};
|
|
13965
|
-
const summaryVersion = "1.0.0-next.
|
|
13963
|
+
const summaryVersion = "1.0.0-next.7";
|
|
13966
13964
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13967
13965
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13968
13966
|
function mapAttributes(attrs) {
|
|
@@ -14754,7 +14752,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14754
14752
|
{ default: remarkStringify },
|
|
14755
14753
|
{ default: remarkGfm }
|
|
14756
14754
|
] = await Promise.all([
|
|
14757
|
-
import("./index-
|
|
14755
|
+
import("./index-IZySkMqb.js"),
|
|
14758
14756
|
import("./index-DRCvimau.js"),
|
|
14759
14757
|
import("./index-C_x_N6Uh.js"),
|
|
14760
14758
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14959,7 +14957,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14959
14957
|
* Process collaboration migrations
|
|
14960
14958
|
*/
|
|
14961
14959
|
processCollaborationMigrations() {
|
|
14962
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.
|
|
14960
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-next.7");
|
|
14963
14961
|
if (!this.options.ydoc) return;
|
|
14964
14962
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14965
14963
|
let docVersion = metaMap.get("version");
|
|
@@ -22409,6 +22407,271 @@ function handleDocumentPartObjectNode(node, context) {
|
|
|
22409
22407
|
}
|
|
22410
22408
|
}
|
|
22411
22409
|
}
|
|
22410
|
+
const WRAP_TYPES$1 = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
22411
|
+
const WRAP_TEXT_VALUES$1 = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
22412
|
+
const H_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
22413
|
+
const V_RELATIVE_VALUES$1 = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
22414
|
+
const H_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
22415
|
+
const V_ALIGN_VALUES$1 = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
22416
|
+
const getAttrs$1 = (node) => {
|
|
22417
|
+
return isPlainObject$2(node.attrs) ? node.attrs : {};
|
|
22418
|
+
};
|
|
22419
|
+
const normalizeWrapType$1 = (value) => {
|
|
22420
|
+
if (typeof value !== "string") return void 0;
|
|
22421
|
+
return WRAP_TYPES$1.has(value) ? value : void 0;
|
|
22422
|
+
};
|
|
22423
|
+
const normalizeWrapText$1 = (value) => {
|
|
22424
|
+
if (typeof value !== "string") return void 0;
|
|
22425
|
+
return WRAP_TEXT_VALUES$1.has(value) ? value : void 0;
|
|
22426
|
+
};
|
|
22427
|
+
const normalizePolygon$1 = (value) => {
|
|
22428
|
+
if (!Array.isArray(value)) return void 0;
|
|
22429
|
+
const polygon = [];
|
|
22430
|
+
value.forEach((point) => {
|
|
22431
|
+
if (!Array.isArray(point) || point.length < 2) return;
|
|
22432
|
+
const x = pickNumber(point[0]);
|
|
22433
|
+
const y = pickNumber(point[1]);
|
|
22434
|
+
if (x == null || y == null) return;
|
|
22435
|
+
polygon.push([x, y]);
|
|
22436
|
+
});
|
|
22437
|
+
return polygon.length > 0 ? polygon : void 0;
|
|
22438
|
+
};
|
|
22439
|
+
const normalizeWrap$2 = (value) => {
|
|
22440
|
+
if (!isPlainObject$2(value)) {
|
|
22441
|
+
return void 0;
|
|
22442
|
+
}
|
|
22443
|
+
const type = normalizeWrapType$1(value.type);
|
|
22444
|
+
if (!type || type === "Inline") {
|
|
22445
|
+
return void 0;
|
|
22446
|
+
}
|
|
22447
|
+
const wrap = { type };
|
|
22448
|
+
const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
|
|
22449
|
+
const wrapText = normalizeWrapText$1(attrs.wrapText);
|
|
22450
|
+
if (wrapText) {
|
|
22451
|
+
wrap.wrapText = wrapText;
|
|
22452
|
+
}
|
|
22453
|
+
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
22454
|
+
if (distTop != null) wrap.distTop = distTop;
|
|
22455
|
+
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
22456
|
+
if (distBottom != null) wrap.distBottom = distBottom;
|
|
22457
|
+
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
22458
|
+
if (distLeft != null) wrap.distLeft = distLeft;
|
|
22459
|
+
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
22460
|
+
if (distRight != null) wrap.distRight = distRight;
|
|
22461
|
+
const polygon = normalizePolygon$1(attrs.polygon);
|
|
22462
|
+
if (polygon) {
|
|
22463
|
+
wrap.polygon = polygon;
|
|
22464
|
+
}
|
|
22465
|
+
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
22466
|
+
if (behindDoc != null) {
|
|
22467
|
+
wrap.behindDoc = behindDoc;
|
|
22468
|
+
}
|
|
22469
|
+
return wrap;
|
|
22470
|
+
};
|
|
22471
|
+
const normalizeAnchorRelative$1 = (value, allowed) => {
|
|
22472
|
+
if (typeof value !== "string") return void 0;
|
|
22473
|
+
return allowed.has(value) ? value : void 0;
|
|
22474
|
+
};
|
|
22475
|
+
const normalizeAnchorAlign$1 = (value, allowed) => {
|
|
22476
|
+
if (typeof value !== "string") return void 0;
|
|
22477
|
+
return allowed.has(value) ? value : void 0;
|
|
22478
|
+
};
|
|
22479
|
+
const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
|
|
22480
|
+
const raw = isPlainObject$2(value) ? value : void 0;
|
|
22481
|
+
const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
22482
|
+
const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
22483
|
+
const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
22484
|
+
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
22485
|
+
const anchor = {};
|
|
22486
|
+
if (isAnchored) {
|
|
22487
|
+
anchor.isAnchored = true;
|
|
22488
|
+
}
|
|
22489
|
+
const hRelative = normalizeAnchorRelative$1(raw?.hRelativeFrom, H_RELATIVE_VALUES$1);
|
|
22490
|
+
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
22491
|
+
const vRelative = normalizeAnchorRelative$1(raw?.vRelativeFrom, V_RELATIVE_VALUES$1);
|
|
22492
|
+
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
22493
|
+
const alignH = normalizeAnchorAlign$1(raw?.alignH, H_ALIGN_VALUES$1);
|
|
22494
|
+
if (alignH) anchor.alignH = alignH;
|
|
22495
|
+
const alignV = normalizeAnchorAlign$1(raw?.alignV, V_ALIGN_VALUES$1);
|
|
22496
|
+
if (alignV) anchor.alignV = alignV;
|
|
22497
|
+
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
22498
|
+
if (offsetH != null) anchor.offsetH = offsetH;
|
|
22499
|
+
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
22500
|
+
if (offsetV != null) anchor.offsetV = offsetV;
|
|
22501
|
+
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
22502
|
+
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
22503
|
+
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;
|
|
22504
|
+
return hasData ? anchor : void 0;
|
|
22505
|
+
};
|
|
22506
|
+
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
|
|
22507
|
+
const normalizedWrap = normalizeWrap$2(rawAttrs.wrap);
|
|
22508
|
+
const baseAnchor = normalizeAnchorData$1(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
22509
|
+
const pos = positions.get(node);
|
|
22510
|
+
const attrsWithPm = { ...rawAttrs };
|
|
22511
|
+
if (pos) {
|
|
22512
|
+
attrsWithPm.pmStart = pos.start;
|
|
22513
|
+
attrsWithPm.pmEnd = pos.end;
|
|
22514
|
+
}
|
|
22515
|
+
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
22516
|
+
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
22517
|
+
return {
|
|
22518
|
+
kind: "drawing",
|
|
22519
|
+
id: nextBlockId("drawing"),
|
|
22520
|
+
drawingKind,
|
|
22521
|
+
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
22522
|
+
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
22523
|
+
anchor: baseAnchor,
|
|
22524
|
+
wrap: normalizedWrap,
|
|
22525
|
+
zIndex: finalZIndex,
|
|
22526
|
+
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
22527
|
+
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
22528
|
+
attrs: attrsWithPm,
|
|
22529
|
+
geometry,
|
|
22530
|
+
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
22531
|
+
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
22532
|
+
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
22533
|
+
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
22534
|
+
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
22535
|
+
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
22536
|
+
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
22537
|
+
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
22538
|
+
...extraProps
|
|
22539
|
+
};
|
|
22540
|
+
};
|
|
22541
|
+
function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
22542
|
+
const rawAttrs = getAttrs$1(node);
|
|
22543
|
+
const geometry = {
|
|
22544
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
22545
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
22546
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
22547
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
22548
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
22549
|
+
};
|
|
22550
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
22551
|
+
}
|
|
22552
|
+
function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
22553
|
+
const rawAttrs = getAttrs$1(node);
|
|
22554
|
+
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
22555
|
+
const size = normalizeShapeSize(rawAttrs.size);
|
|
22556
|
+
const width = size?.width ?? groupTransform?.width ?? 1;
|
|
22557
|
+
const height = size?.height ?? groupTransform?.height ?? 1;
|
|
22558
|
+
const geometry = {
|
|
22559
|
+
width: coercePositiveNumber(width, 1),
|
|
22560
|
+
height: coercePositiveNumber(height, 1),
|
|
22561
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
22562
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
22563
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
22564
|
+
};
|
|
22565
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
|
|
22566
|
+
groupTransform,
|
|
22567
|
+
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
22568
|
+
size
|
|
22569
|
+
});
|
|
22570
|
+
}
|
|
22571
|
+
function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
22572
|
+
const rawAttrs = getAttrs$1(node);
|
|
22573
|
+
const geometry = {
|
|
22574
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
22575
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
22576
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
22577
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
22578
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
22579
|
+
};
|
|
22580
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
22581
|
+
}
|
|
22582
|
+
function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
22583
|
+
const rawAttrs = getAttrs$1(node);
|
|
22584
|
+
const geometry = {
|
|
22585
|
+
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
22586
|
+
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
22587
|
+
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
22588
|
+
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
22589
|
+
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
22590
|
+
};
|
|
22591
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
22592
|
+
}
|
|
22593
|
+
function handleVectorShapeNode(node, context) {
|
|
22594
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
22595
|
+
const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
22596
|
+
if (drawingBlock) {
|
|
22597
|
+
blocks.push(drawingBlock);
|
|
22598
|
+
recordBlockKind(drawingBlock.kind);
|
|
22599
|
+
}
|
|
22600
|
+
}
|
|
22601
|
+
function handleShapeGroupNode(node, context) {
|
|
22602
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
22603
|
+
const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
22604
|
+
if (drawingBlock) {
|
|
22605
|
+
blocks.push(drawingBlock);
|
|
22606
|
+
recordBlockKind(drawingBlock.kind);
|
|
22607
|
+
}
|
|
22608
|
+
}
|
|
22609
|
+
function handleShapeContainerNode(node, context) {
|
|
22610
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
22611
|
+
const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
22612
|
+
if (drawingBlock) {
|
|
22613
|
+
blocks.push(drawingBlock);
|
|
22614
|
+
recordBlockKind(drawingBlock.kind);
|
|
22615
|
+
}
|
|
22616
|
+
}
|
|
22617
|
+
function handleShapeTextboxNode(node, context) {
|
|
22618
|
+
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
22619
|
+
const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
22620
|
+
if (drawingBlock) {
|
|
22621
|
+
blocks.push(drawingBlock);
|
|
22622
|
+
recordBlockKind(drawingBlock.kind);
|
|
22623
|
+
}
|
|
22624
|
+
}
|
|
22625
|
+
const getAttrs = (node) => {
|
|
22626
|
+
return isPlainObject$2(node.attrs) ? { ...node.attrs } : {};
|
|
22627
|
+
};
|
|
22628
|
+
const parseFullWidth = (value) => {
|
|
22629
|
+
if (typeof value === "string") {
|
|
22630
|
+
const trimmed = value.trim();
|
|
22631
|
+
if (trimmed.endsWith("%")) {
|
|
22632
|
+
return { width: trimmed === "100%" ? 1 : null, isFullWidth: trimmed === "100%" };
|
|
22633
|
+
}
|
|
22634
|
+
return { width: pickNumber(trimmed) ?? null, isFullWidth: false };
|
|
22635
|
+
}
|
|
22636
|
+
return { width: pickNumber(value) ?? null, isFullWidth: false };
|
|
22637
|
+
};
|
|
22638
|
+
function contentBlockNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
22639
|
+
const rawAttrs = getAttrs(node);
|
|
22640
|
+
const indentLeft = pickNumber(rawAttrs.hrIndentLeft);
|
|
22641
|
+
const indentRight = pickNumber(rawAttrs.hrIndentRight);
|
|
22642
|
+
if (rawAttrs.horizontalRule !== true) {
|
|
22643
|
+
return null;
|
|
22644
|
+
}
|
|
22645
|
+
const size = isPlainObject$2(rawAttrs.size) ? rawAttrs.size : void 0;
|
|
22646
|
+
const { width, isFullWidth } = parseFullWidth(size?.width);
|
|
22647
|
+
const height = pickNumber(size?.height);
|
|
22648
|
+
if (!height || height <= 0) {
|
|
22649
|
+
return null;
|
|
22650
|
+
}
|
|
22651
|
+
if (!isFullWidth && (!width || width <= 0)) {
|
|
22652
|
+
return null;
|
|
22653
|
+
}
|
|
22654
|
+
if (isFullWidth) {
|
|
22655
|
+
rawAttrs.isFullWidth = true;
|
|
22656
|
+
}
|
|
22657
|
+
if (indentLeft != null || indentRight != null) {
|
|
22658
|
+
rawAttrs.hrIndentLeft = indentLeft;
|
|
22659
|
+
rawAttrs.hrIndentRight = indentRight;
|
|
22660
|
+
}
|
|
22661
|
+
if (typeof rawAttrs.background === "string" && rawAttrs.background.trim()) {
|
|
22662
|
+
rawAttrs.fillColor = rawAttrs.background;
|
|
22663
|
+
}
|
|
22664
|
+
const geometry = {
|
|
22665
|
+
width: isFullWidth ? 1 : width ?? 1,
|
|
22666
|
+
height,
|
|
22667
|
+
rotation: 0,
|
|
22668
|
+
flipH: false,
|
|
22669
|
+
flipV: false
|
|
22670
|
+
};
|
|
22671
|
+
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape", {
|
|
22672
|
+
strokeColor: null
|
|
22673
|
+
});
|
|
22674
|
+
}
|
|
22412
22675
|
const extractValue = (value) => {
|
|
22413
22676
|
if (value && typeof value === "object" && "value" in value) {
|
|
22414
22677
|
return value.value;
|
|
@@ -23132,6 +23395,23 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
23132
23395
|
}
|
|
23133
23396
|
return;
|
|
23134
23397
|
}
|
|
23398
|
+
if (node.type === "contentBlock") {
|
|
23399
|
+
const attrs = node.attrs ?? {};
|
|
23400
|
+
if (attrs.horizontalRule === true) {
|
|
23401
|
+
flushParagraph();
|
|
23402
|
+
const indent = paragraphAttrs?.indent;
|
|
23403
|
+
const hrIndentLeft = typeof indent?.left === "number" ? indent.left : void 0;
|
|
23404
|
+
const hrIndentRight = typeof indent?.right === "number" ? indent.right : void 0;
|
|
23405
|
+
const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
|
|
23406
|
+
const hrNode = hasIndent ? { ...node, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node;
|
|
23407
|
+
const convert = converters?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
|
|
23408
|
+
const drawingBlock = convert(hrNode, nextBlockId, positions);
|
|
23409
|
+
if (drawingBlock) {
|
|
23410
|
+
blocks.push(drawingBlock);
|
|
23411
|
+
}
|
|
23412
|
+
}
|
|
23413
|
+
return;
|
|
23414
|
+
}
|
|
23135
23415
|
if (node.type === "vectorShape") {
|
|
23136
23416
|
flushParagraph();
|
|
23137
23417
|
if (converters?.vectorShapeNodeToDrawingBlock) {
|
|
@@ -23344,12 +23624,12 @@ function handleParagraphNode(node, context) {
|
|
|
23344
23624
|
});
|
|
23345
23625
|
sectionState.currentParagraphIndex++;
|
|
23346
23626
|
}
|
|
23347
|
-
const WRAP_TYPES
|
|
23348
|
-
const WRAP_TEXT_VALUES
|
|
23349
|
-
const H_RELATIVE_VALUES
|
|
23350
|
-
const V_RELATIVE_VALUES
|
|
23351
|
-
const H_ALIGN_VALUES
|
|
23352
|
-
const V_ALIGN_VALUES
|
|
23627
|
+
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
23628
|
+
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
23629
|
+
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
23630
|
+
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
23631
|
+
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
23632
|
+
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
23353
23633
|
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23354
23634
|
const isAllowedObjectFit = (value) => {
|
|
23355
23635
|
return value === "contain" || value === "cover" || value === "fill" || value === "scale-down";
|
|
@@ -23367,15 +23647,15 @@ function toBoxSpacing(spacing) {
|
|
|
23367
23647
|
});
|
|
23368
23648
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
23369
23649
|
}
|
|
23370
|
-
const normalizeWrapType
|
|
23650
|
+
const normalizeWrapType = (value) => {
|
|
23371
23651
|
if (typeof value !== "string") return void 0;
|
|
23372
|
-
return WRAP_TYPES
|
|
23652
|
+
return WRAP_TYPES.has(value) ? value : void 0;
|
|
23373
23653
|
};
|
|
23374
|
-
const normalizeWrapText
|
|
23654
|
+
const normalizeWrapText = (value) => {
|
|
23375
23655
|
if (typeof value !== "string") return void 0;
|
|
23376
|
-
return WRAP_TEXT_VALUES
|
|
23656
|
+
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
23377
23657
|
};
|
|
23378
|
-
const normalizePolygon
|
|
23658
|
+
const normalizePolygon = (value) => {
|
|
23379
23659
|
if (!Array.isArray(value)) return void 0;
|
|
23380
23660
|
const polygon = [];
|
|
23381
23661
|
value.forEach((point) => {
|
|
@@ -23401,17 +23681,17 @@ const toBoolean = (value) => {
|
|
|
23401
23681
|
}
|
|
23402
23682
|
return void 0;
|
|
23403
23683
|
};
|
|
23404
|
-
const normalizeWrap$
|
|
23684
|
+
const normalizeWrap$1 = (value) => {
|
|
23405
23685
|
if (!isPlainObject(value)) {
|
|
23406
23686
|
return void 0;
|
|
23407
23687
|
}
|
|
23408
|
-
const type = normalizeWrapType
|
|
23688
|
+
const type = normalizeWrapType(value.type);
|
|
23409
23689
|
if (!type) {
|
|
23410
23690
|
return void 0;
|
|
23411
23691
|
}
|
|
23412
23692
|
const wrap = { type };
|
|
23413
23693
|
const attrs = isPlainObject(value.attrs) ? value.attrs : {};
|
|
23414
|
-
const wrapText = normalizeWrapText
|
|
23694
|
+
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
23415
23695
|
if (wrapText) {
|
|
23416
23696
|
wrap.wrapText = wrapText;
|
|
23417
23697
|
}
|
|
@@ -23423,7 +23703,7 @@ const normalizeWrap$2 = (value) => {
|
|
|
23423
23703
|
if (distLeft != null) wrap.distLeft = distLeft;
|
|
23424
23704
|
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
23425
23705
|
if (distRight != null) wrap.distRight = distRight;
|
|
23426
|
-
const polygon = normalizePolygon
|
|
23706
|
+
const polygon = normalizePolygon(attrs.polygon);
|
|
23427
23707
|
if (polygon) {
|
|
23428
23708
|
wrap.polygon = polygon;
|
|
23429
23709
|
}
|
|
@@ -23433,15 +23713,15 @@ const normalizeWrap$2 = (value) => {
|
|
|
23433
23713
|
}
|
|
23434
23714
|
return wrap;
|
|
23435
23715
|
};
|
|
23436
|
-
const normalizeAnchorRelative
|
|
23716
|
+
const normalizeAnchorRelative = (value, allowed) => {
|
|
23437
23717
|
if (typeof value !== "string") return void 0;
|
|
23438
23718
|
return allowed.has(value) ? value : void 0;
|
|
23439
23719
|
};
|
|
23440
|
-
const normalizeAnchorAlign
|
|
23720
|
+
const normalizeAnchorAlign = (value, allowed) => {
|
|
23441
23721
|
if (typeof value !== "string") return void 0;
|
|
23442
23722
|
return allowed.has(value) ? value : void 0;
|
|
23443
23723
|
};
|
|
23444
|
-
const normalizeAnchorData
|
|
23724
|
+
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
23445
23725
|
const raw = isPlainObject(value) ? value : void 0;
|
|
23446
23726
|
const marginOffset = isPlainObject(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
23447
23727
|
const simplePos = isPlainObject(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
@@ -23451,13 +23731,13 @@ const normalizeAnchorData$1 = (value, attrs, wrapBehindDoc) => {
|
|
|
23451
23731
|
if (isAnchored) {
|
|
23452
23732
|
anchor.isAnchored = true;
|
|
23453
23733
|
}
|
|
23454
|
-
const hRelative = normalizeAnchorRelative
|
|
23734
|
+
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
23455
23735
|
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
23456
|
-
const vRelative = normalizeAnchorRelative
|
|
23736
|
+
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
23457
23737
|
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
23458
|
-
const alignH = normalizeAnchorAlign
|
|
23738
|
+
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
23459
23739
|
if (alignH) anchor.alignH = alignH;
|
|
23460
|
-
const alignV = normalizeAnchorAlign
|
|
23740
|
+
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
23461
23741
|
if (alignV) anchor.alignV = alignV;
|
|
23462
23742
|
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
23463
23743
|
if (offsetH != null) anchor.offsetH = offsetH;
|
|
@@ -23483,8 +23763,8 @@ function imageNodeToBlock(node, nextBlockId, positions, _trackedMeta, _trackedCh
|
|
|
23483
23763
|
const width = typeof size.width === "number" && Number.isFinite(size.width) ? size.width : void 0;
|
|
23484
23764
|
const height = typeof size.height === "number" && Number.isFinite(size.height) ? size.height : void 0;
|
|
23485
23765
|
const explicitDisplay = typeof attrs.display === "string" ? attrs.display : void 0;
|
|
23486
|
-
const normalizedWrap = normalizeWrap$
|
|
23487
|
-
let anchor = normalizeAnchorData
|
|
23766
|
+
const normalizedWrap = normalizeWrap$1(attrs.wrap);
|
|
23767
|
+
let anchor = normalizeAnchorData(attrs.anchorData, attrs, normalizedWrap?.behindDoc);
|
|
23488
23768
|
if (!anchor && normalizedWrap) {
|
|
23489
23769
|
anchor = { isAnchored: true };
|
|
23490
23770
|
if (normalizedWrap.behindDoc != null) {
|
|
@@ -23526,221 +23806,6 @@ function handleImageNode(node, context) {
|
|
|
23526
23806
|
recordBlockKind(imageBlock.kind);
|
|
23527
23807
|
}
|
|
23528
23808
|
}
|
|
23529
|
-
const WRAP_TYPES = /* @__PURE__ */ new Set(["None", "Square", "Tight", "Through", "TopAndBottom", "Inline"]);
|
|
23530
|
-
const WRAP_TEXT_VALUES = /* @__PURE__ */ new Set(["bothSides", "left", "right", "largest"]);
|
|
23531
|
-
const H_RELATIVE_VALUES = /* @__PURE__ */ new Set(["column", "page", "margin"]);
|
|
23532
|
-
const V_RELATIVE_VALUES = /* @__PURE__ */ new Set(["paragraph", "page", "margin"]);
|
|
23533
|
-
const H_ALIGN_VALUES = /* @__PURE__ */ new Set(["left", "center", "right"]);
|
|
23534
|
-
const V_ALIGN_VALUES = /* @__PURE__ */ new Set(["top", "center", "bottom"]);
|
|
23535
|
-
const getAttrs = (node) => {
|
|
23536
|
-
return isPlainObject$2(node.attrs) ? node.attrs : {};
|
|
23537
|
-
};
|
|
23538
|
-
const normalizeWrapType = (value) => {
|
|
23539
|
-
if (typeof value !== "string") return void 0;
|
|
23540
|
-
return WRAP_TYPES.has(value) ? value : void 0;
|
|
23541
|
-
};
|
|
23542
|
-
const normalizeWrapText = (value) => {
|
|
23543
|
-
if (typeof value !== "string") return void 0;
|
|
23544
|
-
return WRAP_TEXT_VALUES.has(value) ? value : void 0;
|
|
23545
|
-
};
|
|
23546
|
-
const normalizePolygon = (value) => {
|
|
23547
|
-
if (!Array.isArray(value)) return void 0;
|
|
23548
|
-
const polygon = [];
|
|
23549
|
-
value.forEach((point) => {
|
|
23550
|
-
if (!Array.isArray(point) || point.length < 2) return;
|
|
23551
|
-
const x = pickNumber(point[0]);
|
|
23552
|
-
const y = pickNumber(point[1]);
|
|
23553
|
-
if (x == null || y == null) return;
|
|
23554
|
-
polygon.push([x, y]);
|
|
23555
|
-
});
|
|
23556
|
-
return polygon.length > 0 ? polygon : void 0;
|
|
23557
|
-
};
|
|
23558
|
-
const normalizeWrap$1 = (value) => {
|
|
23559
|
-
if (!isPlainObject$2(value)) {
|
|
23560
|
-
return void 0;
|
|
23561
|
-
}
|
|
23562
|
-
const type = normalizeWrapType(value.type);
|
|
23563
|
-
if (!type || type === "Inline") {
|
|
23564
|
-
return void 0;
|
|
23565
|
-
}
|
|
23566
|
-
const wrap = { type };
|
|
23567
|
-
const attrs = isPlainObject$2(value.attrs) ? value.attrs : {};
|
|
23568
|
-
const wrapText = normalizeWrapText(attrs.wrapText);
|
|
23569
|
-
if (wrapText) {
|
|
23570
|
-
wrap.wrapText = wrapText;
|
|
23571
|
-
}
|
|
23572
|
-
const distTop = pickNumber(attrs.distTop ?? attrs.distT);
|
|
23573
|
-
if (distTop != null) wrap.distTop = distTop;
|
|
23574
|
-
const distBottom = pickNumber(attrs.distBottom ?? attrs.distB);
|
|
23575
|
-
if (distBottom != null) wrap.distBottom = distBottom;
|
|
23576
|
-
const distLeft = pickNumber(attrs.distLeft ?? attrs.distL);
|
|
23577
|
-
if (distLeft != null) wrap.distLeft = distLeft;
|
|
23578
|
-
const distRight = pickNumber(attrs.distRight ?? attrs.distR);
|
|
23579
|
-
if (distRight != null) wrap.distRight = distRight;
|
|
23580
|
-
const polygon = normalizePolygon(attrs.polygon);
|
|
23581
|
-
if (polygon) {
|
|
23582
|
-
wrap.polygon = polygon;
|
|
23583
|
-
}
|
|
23584
|
-
const behindDoc = toBoolean$3(attrs.behindDoc);
|
|
23585
|
-
if (behindDoc != null) {
|
|
23586
|
-
wrap.behindDoc = behindDoc;
|
|
23587
|
-
}
|
|
23588
|
-
return wrap;
|
|
23589
|
-
};
|
|
23590
|
-
const normalizeAnchorRelative = (value, allowed) => {
|
|
23591
|
-
if (typeof value !== "string") return void 0;
|
|
23592
|
-
return allowed.has(value) ? value : void 0;
|
|
23593
|
-
};
|
|
23594
|
-
const normalizeAnchorAlign = (value, allowed) => {
|
|
23595
|
-
if (typeof value !== "string") return void 0;
|
|
23596
|
-
return allowed.has(value) ? value : void 0;
|
|
23597
|
-
};
|
|
23598
|
-
const normalizeAnchorData = (value, attrs, wrapBehindDoc) => {
|
|
23599
|
-
const raw = isPlainObject$2(value) ? value : void 0;
|
|
23600
|
-
const marginOffset = isPlainObject$2(attrs.marginOffset) ? attrs.marginOffset : void 0;
|
|
23601
|
-
const simplePos = isPlainObject$2(attrs.simplePos) ? attrs.simplePos : void 0;
|
|
23602
|
-
const originalAttrs = isPlainObject$2(attrs.originalAttributes) ? attrs.originalAttributes : void 0;
|
|
23603
|
-
const isAnchored = attrs.isAnchor === true || Boolean(raw);
|
|
23604
|
-
const anchor = {};
|
|
23605
|
-
if (isAnchored) {
|
|
23606
|
-
anchor.isAnchored = true;
|
|
23607
|
-
}
|
|
23608
|
-
const hRelative = normalizeAnchorRelative(raw?.hRelativeFrom, H_RELATIVE_VALUES);
|
|
23609
|
-
if (hRelative) anchor.hRelativeFrom = hRelative;
|
|
23610
|
-
const vRelative = normalizeAnchorRelative(raw?.vRelativeFrom, V_RELATIVE_VALUES);
|
|
23611
|
-
if (vRelative) anchor.vRelativeFrom = vRelative;
|
|
23612
|
-
const alignH = normalizeAnchorAlign(raw?.alignH, H_ALIGN_VALUES);
|
|
23613
|
-
if (alignH) anchor.alignH = alignH;
|
|
23614
|
-
const alignV = normalizeAnchorAlign(raw?.alignV, V_ALIGN_VALUES);
|
|
23615
|
-
if (alignV) anchor.alignV = alignV;
|
|
23616
|
-
const offsetH = pickNumber(marginOffset?.horizontal ?? marginOffset?.left ?? raw?.offsetH ?? simplePos?.x);
|
|
23617
|
-
if (offsetH != null) anchor.offsetH = offsetH;
|
|
23618
|
-
const offsetV = pickNumber(marginOffset?.top ?? marginOffset?.vertical ?? raw?.offsetV ?? simplePos?.y);
|
|
23619
|
-
if (offsetV != null) anchor.offsetV = offsetV;
|
|
23620
|
-
const behindDoc = toBoolean$3(raw?.behindDoc ?? wrapBehindDoc ?? originalAttrs?.behindDoc);
|
|
23621
|
-
if (behindDoc != null) anchor.behindDoc = behindDoc;
|
|
23622
|
-
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;
|
|
23623
|
-
return hasData ? anchor : void 0;
|
|
23624
|
-
};
|
|
23625
|
-
const buildDrawingBlock = (rawAttrs, nextBlockId, positions, node, geometry, drawingKind, extraProps) => {
|
|
23626
|
-
const normalizedWrap = normalizeWrap$1(rawAttrs.wrap);
|
|
23627
|
-
const baseAnchor = normalizeAnchorData(rawAttrs.anchorData, rawAttrs, normalizedWrap?.behindDoc);
|
|
23628
|
-
const pos = positions.get(node);
|
|
23629
|
-
const attrsWithPm = { ...rawAttrs };
|
|
23630
|
-
if (pos) {
|
|
23631
|
-
attrsWithPm.pmStart = pos.start;
|
|
23632
|
-
attrsWithPm.pmEnd = pos.end;
|
|
23633
|
-
}
|
|
23634
|
-
const zIndexFromRelativeHeight = normalizeZIndex(rawAttrs.originalAttributes);
|
|
23635
|
-
const finalZIndex = zIndexFromRelativeHeight ?? coerceNumber(rawAttrs.zIndex);
|
|
23636
|
-
return {
|
|
23637
|
-
kind: "drawing",
|
|
23638
|
-
id: nextBlockId("drawing"),
|
|
23639
|
-
drawingKind,
|
|
23640
|
-
padding: toBoxSpacing$1(rawAttrs.padding),
|
|
23641
|
-
margin: toBoxSpacing$1(rawAttrs.marginOffset) ?? toBoxSpacing$1(rawAttrs.margin),
|
|
23642
|
-
anchor: baseAnchor,
|
|
23643
|
-
wrap: normalizedWrap,
|
|
23644
|
-
zIndex: finalZIndex,
|
|
23645
|
-
drawingContentId: typeof rawAttrs.drawingContentId === "string" ? rawAttrs.drawingContentId : void 0,
|
|
23646
|
-
drawingContent: toDrawingContentSnapshot(rawAttrs.drawingContent),
|
|
23647
|
-
attrs: attrsWithPm,
|
|
23648
|
-
geometry,
|
|
23649
|
-
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : void 0,
|
|
23650
|
-
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
23651
|
-
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
23652
|
-
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
23653
|
-
textContent: normalizeTextContent(rawAttrs.textContent),
|
|
23654
|
-
textAlign: typeof rawAttrs.textAlign === "string" ? rawAttrs.textAlign : void 0,
|
|
23655
|
-
textVerticalAlign: normalizeTextVerticalAlign(rawAttrs.textVerticalAlign),
|
|
23656
|
-
textInsets: normalizeTextInsets(rawAttrs.textInsets),
|
|
23657
|
-
...extraProps
|
|
23658
|
-
};
|
|
23659
|
-
};
|
|
23660
|
-
function vectorShapeNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
23661
|
-
const rawAttrs = getAttrs(node);
|
|
23662
|
-
const geometry = {
|
|
23663
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
23664
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
23665
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
23666
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
23667
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
23668
|
-
};
|
|
23669
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
23670
|
-
}
|
|
23671
|
-
function shapeGroupNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
23672
|
-
const rawAttrs = getAttrs(node);
|
|
23673
|
-
const groupTransform = isShapeGroupTransform(rawAttrs.groupTransform) ? { ...rawAttrs.groupTransform } : void 0;
|
|
23674
|
-
const size = normalizeShapeSize(rawAttrs.size);
|
|
23675
|
-
const width = size?.width ?? groupTransform?.width ?? 1;
|
|
23676
|
-
const height = size?.height ?? groupTransform?.height ?? 1;
|
|
23677
|
-
const geometry = {
|
|
23678
|
-
width: coercePositiveNumber(width, 1),
|
|
23679
|
-
height: coercePositiveNumber(height, 1),
|
|
23680
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
23681
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
23682
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
23683
|
-
};
|
|
23684
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "shapeGroup", {
|
|
23685
|
-
groupTransform,
|
|
23686
|
-
shapes: normalizeShapeGroupChildren(rawAttrs.shapes),
|
|
23687
|
-
size
|
|
23688
|
-
});
|
|
23689
|
-
}
|
|
23690
|
-
function shapeContainerNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
23691
|
-
const rawAttrs = getAttrs(node);
|
|
23692
|
-
const geometry = {
|
|
23693
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
23694
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
23695
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
23696
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
23697
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
23698
|
-
};
|
|
23699
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
23700
|
-
}
|
|
23701
|
-
function shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions) {
|
|
23702
|
-
const rawAttrs = getAttrs(node);
|
|
23703
|
-
const geometry = {
|
|
23704
|
-
width: coercePositiveNumber(rawAttrs.width, 1),
|
|
23705
|
-
height: coercePositiveNumber(rawAttrs.height, 1),
|
|
23706
|
-
rotation: coerceNumber(rawAttrs.rotation) ?? 0,
|
|
23707
|
-
flipH: coerceBoolean(rawAttrs.flipH) ?? false,
|
|
23708
|
-
flipV: coerceBoolean(rawAttrs.flipV) ?? false
|
|
23709
|
-
};
|
|
23710
|
-
return buildDrawingBlock(rawAttrs, nextBlockId, positions, node, geometry, "vectorShape");
|
|
23711
|
-
}
|
|
23712
|
-
function handleVectorShapeNode(node, context) {
|
|
23713
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
23714
|
-
const drawingBlock = vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
23715
|
-
if (drawingBlock) {
|
|
23716
|
-
blocks.push(drawingBlock);
|
|
23717
|
-
recordBlockKind(drawingBlock.kind);
|
|
23718
|
-
}
|
|
23719
|
-
}
|
|
23720
|
-
function handleShapeGroupNode(node, context) {
|
|
23721
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
23722
|
-
const drawingBlock = shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
23723
|
-
if (drawingBlock) {
|
|
23724
|
-
blocks.push(drawingBlock);
|
|
23725
|
-
recordBlockKind(drawingBlock.kind);
|
|
23726
|
-
}
|
|
23727
|
-
}
|
|
23728
|
-
function handleShapeContainerNode(node, context) {
|
|
23729
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
23730
|
-
const drawingBlock = shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
23731
|
-
if (drawingBlock) {
|
|
23732
|
-
blocks.push(drawingBlock);
|
|
23733
|
-
recordBlockKind(drawingBlock.kind);
|
|
23734
|
-
}
|
|
23735
|
-
}
|
|
23736
|
-
function handleShapeTextboxNode(node, context) {
|
|
23737
|
-
const { blocks, recordBlockKind, nextBlockId, positions } = context;
|
|
23738
|
-
const drawingBlock = shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
23739
|
-
if (drawingBlock) {
|
|
23740
|
-
blocks.push(drawingBlock);
|
|
23741
|
-
recordBlockKind(drawingBlock.kind);
|
|
23742
|
-
}
|
|
23743
|
-
}
|
|
23744
23809
|
const hydrateTableStyleAttrs = (tableNode, context) => {
|
|
23745
23810
|
const hydration = {};
|
|
23746
23811
|
const tableProps = tableNode.attrs?.tableProperties ?? null;
|
|
@@ -24546,6 +24611,7 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
|
|
|
24546
24611
|
hyperlinkConfig,
|
|
24547
24612
|
themeColors,
|
|
24548
24613
|
{
|
|
24614
|
+
contentBlockNodeToDrawingBlock,
|
|
24549
24615
|
imageNodeToBlock,
|
|
24550
24616
|
vectorShapeNodeToDrawingBlock,
|
|
24551
24617
|
shapeGroupNodeToDrawingBlock,
|
|
@@ -34330,9 +34396,13 @@ function layoutDrawingBlock({
|
|
|
34330
34396
|
const maxWidth = Math.max(0, columns.width - (marginLeft + marginRight));
|
|
34331
34397
|
let width = measure.width;
|
|
34332
34398
|
let height = measure.height;
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
|
|
34399
|
+
const attrs = block.attrs;
|
|
34400
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
34401
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
34402
|
+
const maxWidthForBlock = attrs?.isFullWidth === true && maxWidth > 0 ? Math.max(1, maxWidth - indentLeft - indentRight) : maxWidth;
|
|
34403
|
+
if (width > maxWidthForBlock && maxWidthForBlock > 0) {
|
|
34404
|
+
const scale = maxWidthForBlock / width;
|
|
34405
|
+
width = maxWidthForBlock;
|
|
34336
34406
|
height *= scale;
|
|
34337
34407
|
}
|
|
34338
34408
|
let state = ensurePage();
|
|
@@ -34351,7 +34421,7 @@ function layoutDrawingBlock({
|
|
|
34351
34421
|
kind: "drawing",
|
|
34352
34422
|
blockId: block.id,
|
|
34353
34423
|
drawingKind: block.drawingKind,
|
|
34354
|
-
x: columnX(state.columnIndex) + marginLeft,
|
|
34424
|
+
x: columnX(state.columnIndex) + marginLeft + indentLeft,
|
|
34355
34425
|
y: state.cursorY + marginTop,
|
|
34356
34426
|
width,
|
|
34357
34427
|
height,
|
|
@@ -41193,10 +41263,18 @@ async function measureDrawingBlock(block, constraints) {
|
|
|
41193
41263
|
};
|
|
41194
41264
|
}
|
|
41195
41265
|
const geometry = ensureDrawingGeometry(block.geometry);
|
|
41266
|
+
const attrs = block.attrs;
|
|
41267
|
+
const indentLeft = typeof attrs?.hrIndentLeft === "number" ? attrs.hrIndentLeft : 0;
|
|
41268
|
+
const indentRight = typeof attrs?.hrIndentRight === "number" ? attrs.hrIndentRight : 0;
|
|
41269
|
+
const hasFullWidth = attrs?.isFullWidth === true && constraints.maxWidth > 0;
|
|
41270
|
+
const fullWidthMax = hasFullWidth ? Math.max(1, constraints.maxWidth - indentLeft - indentRight) : void 0;
|
|
41271
|
+
if (fullWidthMax != null) {
|
|
41272
|
+
geometry.width = fullWidthMax;
|
|
41273
|
+
}
|
|
41196
41274
|
const rotatedBounds = calculateRotatedBounds(geometry);
|
|
41197
41275
|
const naturalWidth = Math.max(1, rotatedBounds.width);
|
|
41198
41276
|
const naturalHeight = Math.max(1, rotatedBounds.height);
|
|
41199
|
-
const maxWidth = constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth;
|
|
41277
|
+
const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 ? constraints.maxWidth : naturalWidth);
|
|
41200
41278
|
const hasNegativeVerticalPosition = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0);
|
|
41201
41279
|
const maxHeight = hasNegativeVerticalPosition || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
41202
41280
|
const widthScale = maxWidth / naturalWidth;
|