@harbour-enterprises/superdoc 1.0.0-beta.82 → 1.0.0-beta.84
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-kLZVOUbz.cjs → PdfViewer-CAaNRs-k.cjs} +1 -1
- package/dist/chunks/{PdfViewer-gQqtBsXT.es.js → PdfViewer-CN5I0v21.es.js} +1 -1
- package/dist/chunks/{index-GF5Urhpn-BNFw-VyP.cjs → index-ByDo0rez-DTbakkgE.cjs} +1 -1
- package/dist/chunks/{index-GF5Urhpn-LFkKkWot.es.js → index-ByDo0rez-Dddj1OPE.es.js} +1 -1
- package/dist/chunks/{index-cUgy4sJN.cjs → index-CXX12ADx.cjs} +3 -3
- package/dist/chunks/{index-CNPZHNDf.es.js → index-D6mF0NAB.es.js} +3 -3
- package/dist/chunks/{super-editor.es-DfLaDbHA.es.js → super-editor.es-B-ix_3cI.es.js} +469 -74
- package/dist/chunks/{super-editor.es-44RL9-Ca.cjs → super-editor.es-C89GPNG4.cjs} +469 -74
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Bfu1F5pk.js → converter-CWmKgkFT.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Cl08Z_S_.js → docx-zipper-CFgPPujz.js} +1 -1
- package/dist/super-editor/chunks/{editor-CwTMBaym.js → editor-Dmk80b6P.js} +470 -75
- package/dist/super-editor/chunks/{index-GF5Urhpn.js → index-ByDo0rez.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DZTp7DIF.js → toolbar-Bi5YCv48.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 +471 -76
- 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, _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, 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-CWmKgkFT.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-CFgPPujz.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() {
|
|
@@ -13923,7 +13923,7 @@ const isHeadless = (editor) => {
|
|
|
13923
13923
|
const shouldSkipNodeView = (editor) => {
|
|
13924
13924
|
return isHeadless(editor);
|
|
13925
13925
|
};
|
|
13926
|
-
const summaryVersion = "1.0.0-beta.
|
|
13926
|
+
const summaryVersion = "1.0.0-beta.84";
|
|
13927
13927
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
13928
13928
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
13929
13929
|
function mapAttributes(attrs) {
|
|
@@ -14715,7 +14715,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14715
14715
|
{ default: remarkStringify },
|
|
14716
14716
|
{ default: remarkGfm }
|
|
14717
14717
|
] = await Promise.all([
|
|
14718
|
-
import("./index-
|
|
14718
|
+
import("./index-ByDo0rez.js"),
|
|
14719
14719
|
import("./index-DRCvimau.js"),
|
|
14720
14720
|
import("./index-C_x_N6Uh.js"),
|
|
14721
14721
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14920,7 +14920,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14920
14920
|
* Process collaboration migrations
|
|
14921
14921
|
*/
|
|
14922
14922
|
processCollaborationMigrations() {
|
|
14923
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.
|
|
14923
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.84");
|
|
14924
14924
|
if (!this.options.ydoc) return;
|
|
14925
14925
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14926
14926
|
let docVersion = metaMap.get("version");
|
|
@@ -18052,32 +18052,76 @@ function hydrateImageBlocks(blocks, mediaFiles) {
|
|
|
18052
18052
|
return hasChanges ? hydratedRuns : runs;
|
|
18053
18053
|
};
|
|
18054
18054
|
return blocks.map((block) => {
|
|
18055
|
-
|
|
18056
|
-
if (
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18055
|
+
const hydrateBlock = (blk) => {
|
|
18056
|
+
if (blk.kind === "image") {
|
|
18057
|
+
if (!blk.src || blk.src.startsWith("data:")) {
|
|
18058
|
+
return blk;
|
|
18059
|
+
}
|
|
18060
|
+
const attrs = blk.attrs ?? {};
|
|
18061
|
+
const relId = typeof attrs.rId === "string" ? attrs.rId : void 0;
|
|
18062
|
+
const attrSrc = typeof attrs.src === "string" ? attrs.src : void 0;
|
|
18063
|
+
const extension = typeof attrs.extension === "string" ? attrs.extension.toLowerCase() : void 0;
|
|
18064
|
+
const resolvedSrc = resolveImageSrc(blk.src, relId, attrSrc, extension);
|
|
18065
|
+
if (resolvedSrc) {
|
|
18066
|
+
return { ...blk, src: resolvedSrc };
|
|
18067
|
+
}
|
|
18068
|
+
return blk;
|
|
18069
|
+
}
|
|
18070
|
+
if (blk.kind === "paragraph") {
|
|
18071
|
+
const paragraphBlock = blk;
|
|
18072
|
+
if (!paragraphBlock.runs || paragraphBlock.runs.length === 0) {
|
|
18073
|
+
return blk;
|
|
18074
|
+
}
|
|
18075
|
+
const hydratedRuns = hydrateRuns(paragraphBlock.runs);
|
|
18076
|
+
if (hydratedRuns !== paragraphBlock.runs) {
|
|
18077
|
+
return { ...paragraphBlock, runs: hydratedRuns };
|
|
18078
|
+
}
|
|
18079
|
+
return blk;
|
|
18080
|
+
}
|
|
18081
|
+
if (blk.kind === "table") {
|
|
18082
|
+
let rowsChanged = false;
|
|
18083
|
+
const newRows = blk.rows.map((row) => {
|
|
18084
|
+
let cellsChanged = false;
|
|
18085
|
+
const newCells = row.cells.map((cell) => {
|
|
18086
|
+
let cellChanged = false;
|
|
18087
|
+
const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map((cb) => hydrateBlock(cb));
|
|
18088
|
+
if (cell.blocks && hydratedBlocks !== cell.blocks) {
|
|
18089
|
+
cellChanged = true;
|
|
18090
|
+
}
|
|
18091
|
+
let hydratedParagraph = cell.paragraph;
|
|
18092
|
+
if (!cell.blocks && cell.paragraph && cell.paragraph.kind === "paragraph") {
|
|
18093
|
+
const hydratedPara = hydrateBlock(cell.paragraph);
|
|
18094
|
+
if (hydratedPara !== cell.paragraph) {
|
|
18095
|
+
hydratedParagraph = hydratedPara;
|
|
18096
|
+
cellChanged = true;
|
|
18097
|
+
}
|
|
18098
|
+
}
|
|
18099
|
+
if (cellChanged) {
|
|
18100
|
+
return {
|
|
18101
|
+
...cell,
|
|
18102
|
+
blocks: hydratedBlocks.length > 0 ? hydratedBlocks : cell.blocks,
|
|
18103
|
+
paragraph: hydratedParagraph
|
|
18104
|
+
};
|
|
18105
|
+
}
|
|
18106
|
+
return cell;
|
|
18107
|
+
});
|
|
18108
|
+
if (newCells.some((c, idx) => c !== row.cells[idx])) {
|
|
18109
|
+
cellsChanged = true;
|
|
18110
|
+
}
|
|
18111
|
+
if (cellsChanged) {
|
|
18112
|
+
rowsChanged = true;
|
|
18113
|
+
return { ...row, cells: newCells };
|
|
18114
|
+
}
|
|
18115
|
+
return row;
|
|
18116
|
+
});
|
|
18117
|
+
if (rowsChanged) {
|
|
18118
|
+
return { ...blk, rows: newRows };
|
|
18119
|
+
}
|
|
18120
|
+
return blk;
|
|
18077
18121
|
}
|
|
18078
|
-
return
|
|
18079
|
-
}
|
|
18080
|
-
return block;
|
|
18122
|
+
return blk;
|
|
18123
|
+
};
|
|
18124
|
+
return hydrateBlock(block);
|
|
18081
18125
|
});
|
|
18082
18126
|
}
|
|
18083
18127
|
function isGradientFill(value) {
|
|
@@ -19792,7 +19836,7 @@ function buildSdtCacheKey(nodeType, attrs, explicitKey) {
|
|
|
19792
19836
|
return void 0;
|
|
19793
19837
|
}
|
|
19794
19838
|
const DEFAULT_LIST_HANGING_PX$1 = 18;
|
|
19795
|
-
const LIST_MARKER_GAP$
|
|
19839
|
+
const LIST_MARKER_GAP$3 = 8;
|
|
19796
19840
|
const DEFAULT_BULLET_GLYPH = "•";
|
|
19797
19841
|
const DEFAULT_DECIMAL_PATTERN = "%1.";
|
|
19798
19842
|
const ASCII_UPPERCASE_A = 65;
|
|
@@ -20203,7 +20247,7 @@ function computeWordParagraphLayout(input) {
|
|
|
20203
20247
|
let markerBoxWidthPx;
|
|
20204
20248
|
let markerX;
|
|
20205
20249
|
if (hasFirstLineIndent) {
|
|
20206
|
-
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$
|
|
20250
|
+
markerBoxWidthPx = glyphWidthPx != null && glyphWidthPx > 0 ? glyphWidthPx + LIST_MARKER_GAP$3 : DEFAULT_LIST_HANGING_PX$1;
|
|
20207
20251
|
markerX = indentLeftPx + (firstLinePx ?? 0);
|
|
20208
20252
|
layout.textStartPx = markerX + markerBoxWidthPx;
|
|
20209
20253
|
layout.hangingPx = 0;
|
|
@@ -20303,12 +20347,12 @@ const resolveMarkerBoxWidth = (hangingPxRaw, glyphWidthPx) => {
|
|
|
20303
20347
|
let markerBox = Math.max(hangingPxRaw || 0, 0);
|
|
20304
20348
|
if (markerBox <= 0) {
|
|
20305
20349
|
if (glyphWidthPx != null && glyphWidthPx > 0) {
|
|
20306
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
20350
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
20307
20351
|
} else {
|
|
20308
20352
|
markerBox = DEFAULT_LIST_HANGING_PX$1;
|
|
20309
20353
|
}
|
|
20310
|
-
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$
|
|
20311
|
-
markerBox = glyphWidthPx + LIST_MARKER_GAP$
|
|
20354
|
+
} else if (glyphWidthPx != null && glyphWidthPx + LIST_MARKER_GAP$3 > markerBox) {
|
|
20355
|
+
markerBox = glyphWidthPx + LIST_MARKER_GAP$3;
|
|
20312
20356
|
}
|
|
20313
20357
|
return markerBox;
|
|
20314
20358
|
};
|
|
@@ -20930,13 +20974,21 @@ const findNumFmtElement = (lvl) => {
|
|
|
20930
20974
|
const resolveNumberingFromContext = (numId, ilvl, numbering) => {
|
|
20931
20975
|
const definitions = numbering?.definitions;
|
|
20932
20976
|
const abstracts = numbering?.abstracts;
|
|
20933
|
-
if (!definitions || !abstracts)
|
|
20977
|
+
if (!definitions || !abstracts) {
|
|
20978
|
+
return void 0;
|
|
20979
|
+
}
|
|
20934
20980
|
const numDef = asOoxmlElement(definitions[String(numId)]);
|
|
20935
|
-
if (!numDef)
|
|
20981
|
+
if (!numDef) {
|
|
20982
|
+
return void 0;
|
|
20983
|
+
}
|
|
20936
20984
|
const abstractId = getAttribute(findChild(numDef, "w:abstractNumId"), "w:val");
|
|
20937
|
-
if (abstractId == null)
|
|
20985
|
+
if (abstractId == null) {
|
|
20986
|
+
return void 0;
|
|
20987
|
+
}
|
|
20938
20988
|
const abstract = asOoxmlElement(abstracts[String(abstractId)]);
|
|
20939
|
-
if (!abstract)
|
|
20989
|
+
if (!abstract) {
|
|
20990
|
+
return void 0;
|
|
20991
|
+
}
|
|
20940
20992
|
let levelDef = abstract.elements?.find(
|
|
20941
20993
|
(el) => el?.name === "w:lvl" && parseNumberAttr(el.attributes?.["w:ilvl"]) === ilvl
|
|
20942
20994
|
);
|
|
@@ -20948,7 +21000,9 @@ const resolveNumberingFromContext = (numId, ilvl, numbering) => {
|
|
|
20948
21000
|
levelDef = overrideLvl;
|
|
20949
21001
|
}
|
|
20950
21002
|
const startOverride = parseNumberAttr(getAttribute(findChild(override, "w:startOverride"), "w:val"));
|
|
20951
|
-
if (!levelDef)
|
|
21003
|
+
if (!levelDef) {
|
|
21004
|
+
return void 0;
|
|
21005
|
+
}
|
|
20952
21006
|
const numFmtEl = findNumFmtElement(levelDef);
|
|
20953
21007
|
const lvlText = getAttribute(findChild(levelDef, "w:lvlText"), "w:val");
|
|
20954
21008
|
const start2 = startOverride ?? parseNumberAttr(getAttribute(findChild(levelDef, "w:start"), "w:val"));
|
|
@@ -21594,14 +21648,29 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
21594
21648
|
paragraphAttrs.frame = frame;
|
|
21595
21649
|
}
|
|
21596
21650
|
}
|
|
21651
|
+
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
21597
21652
|
const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
|
|
21598
|
-
|
|
21653
|
+
let rawNumberingProps = toAdapterNumberingProps(numberingSource);
|
|
21654
|
+
if (!rawNumberingProps && listRendering) {
|
|
21655
|
+
const path = listRendering.path;
|
|
21656
|
+
const counterFromPath = path && path.length ? path[path.length - 1] : void 0;
|
|
21657
|
+
const ilvl = path && path.length > 1 ? path.length - 1 : 0;
|
|
21658
|
+
rawNumberingProps = {
|
|
21659
|
+
numId: -1,
|
|
21660
|
+
ilvl,
|
|
21661
|
+
path,
|
|
21662
|
+
counterValue: Number.isFinite(counterFromPath) ? Number(counterFromPath) : void 0,
|
|
21663
|
+
markerText: listRendering.markerText,
|
|
21664
|
+
format: listRendering.numberingType,
|
|
21665
|
+
lvlJc: listRendering.justification,
|
|
21666
|
+
suffix: listRendering.suffix
|
|
21667
|
+
};
|
|
21668
|
+
}
|
|
21599
21669
|
const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
|
|
21600
21670
|
if (hasValidNumbering) {
|
|
21601
21671
|
const numberingProps = rawNumberingProps;
|
|
21602
21672
|
const numId = numberingProps.numId;
|
|
21603
21673
|
const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
|
|
21604
|
-
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
21605
21674
|
const numericNumId = typeof numId === "number" ? numId : void 0;
|
|
21606
21675
|
const resolvedLevel = resolveNumberingFromContext(numId, ilvl, converterContext?.numbering);
|
|
21607
21676
|
if (resolvedLevel) {
|
|
@@ -21676,13 +21745,18 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
21676
21745
|
}
|
|
21677
21746
|
}
|
|
21678
21747
|
paragraphAttrs.wordLayout = wordLayout;
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
}
|
|
21748
|
+
}
|
|
21749
|
+
if (enrichedNumberingProps.resolvedLevelIndent) {
|
|
21750
|
+
const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
|
|
21751
|
+
const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
|
|
21752
|
+
paragraphAttrs.indent = {
|
|
21753
|
+
...baseIndent,
|
|
21754
|
+
...normalizedIndent ?? {}
|
|
21755
|
+
};
|
|
21756
|
+
if (normalizedIndent?.firstLine !== void 0) {
|
|
21757
|
+
delete paragraphAttrs.indent.hanging;
|
|
21758
|
+
} else if (normalizedIndent?.hanging !== void 0) {
|
|
21759
|
+
delete paragraphAttrs.indent.firstLine;
|
|
21686
21760
|
}
|
|
21687
21761
|
}
|
|
21688
21762
|
paragraphAttrs.numberingProperties = enrichedNumberingProps;
|
|
@@ -23652,29 +23726,129 @@ const parseTableCell = (args) => {
|
|
|
23652
23726
|
...context.converterContext,
|
|
23653
23727
|
tableStyleParagraphProps
|
|
23654
23728
|
} : context.converterContext;
|
|
23729
|
+
const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
|
|
23730
|
+
const listCounterContext = context.listCounterContext;
|
|
23655
23731
|
for (const childNode of cellNode.content) {
|
|
23656
23732
|
if (childNode.type === "paragraph") {
|
|
23657
|
-
|
|
23733
|
+
if (!paragraphToFlowBlocks2) continue;
|
|
23734
|
+
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
23658
23735
|
childNode,
|
|
23659
23736
|
context.nextBlockId,
|
|
23660
23737
|
context.positions,
|
|
23661
23738
|
context.defaultFont,
|
|
23662
23739
|
context.defaultSize,
|
|
23663
23740
|
context.styleContext,
|
|
23664
|
-
|
|
23665
|
-
// listCounterContext
|
|
23741
|
+
listCounterContext,
|
|
23666
23742
|
context.trackedChanges,
|
|
23667
23743
|
context.bookmarks,
|
|
23668
23744
|
context.hyperlinkConfig,
|
|
23669
23745
|
context.themeColors,
|
|
23670
23746
|
cellConverterContext
|
|
23671
|
-
// converterContext at position 12
|
|
23672
23747
|
);
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23748
|
+
paragraphBlocks.forEach((block) => {
|
|
23749
|
+
if (block.kind === "paragraph" || block.kind === "image" || block.kind === "drawing") {
|
|
23750
|
+
blocks.push(block);
|
|
23751
|
+
}
|
|
23752
|
+
});
|
|
23753
|
+
continue;
|
|
23754
|
+
}
|
|
23755
|
+
if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
|
|
23756
|
+
const mergedMarks = [...childNode.marks ?? []];
|
|
23757
|
+
const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
23758
|
+
if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
|
|
23759
|
+
continue;
|
|
23760
|
+
}
|
|
23761
|
+
const imageBlock = context.converters.imageNodeToBlock(
|
|
23762
|
+
childNode,
|
|
23763
|
+
context.nextBlockId,
|
|
23764
|
+
context.positions,
|
|
23765
|
+
trackedMeta,
|
|
23766
|
+
context.trackedChanges
|
|
23767
|
+
);
|
|
23768
|
+
if (imageBlock && imageBlock.kind === "image") {
|
|
23769
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
|
|
23770
|
+
blocks.push(imageBlock);
|
|
23771
|
+
}
|
|
23772
|
+
continue;
|
|
23773
|
+
}
|
|
23774
|
+
if (childNode.type === "vectorShape" && context.converters?.vectorShapeNodeToDrawingBlock) {
|
|
23775
|
+
const drawingBlock = context.converters.vectorShapeNodeToDrawingBlock(
|
|
23776
|
+
childNode,
|
|
23777
|
+
context.nextBlockId,
|
|
23778
|
+
context.positions
|
|
23779
|
+
);
|
|
23780
|
+
if (drawingBlock) {
|
|
23781
|
+
blocks.push(drawingBlock);
|
|
23782
|
+
}
|
|
23783
|
+
continue;
|
|
23784
|
+
}
|
|
23785
|
+
if (childNode.type === "shapeGroup" && context.converters?.shapeGroupNodeToDrawingBlock) {
|
|
23786
|
+
const drawingBlock = context.converters.shapeGroupNodeToDrawingBlock(
|
|
23787
|
+
childNode,
|
|
23788
|
+
context.nextBlockId,
|
|
23789
|
+
context.positions
|
|
23790
|
+
);
|
|
23791
|
+
if (drawingBlock) {
|
|
23792
|
+
blocks.push(drawingBlock);
|
|
23676
23793
|
}
|
|
23794
|
+
continue;
|
|
23677
23795
|
}
|
|
23796
|
+
if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
|
|
23797
|
+
const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(
|
|
23798
|
+
childNode,
|
|
23799
|
+
context.nextBlockId,
|
|
23800
|
+
context.positions
|
|
23801
|
+
);
|
|
23802
|
+
if (drawingBlock) {
|
|
23803
|
+
blocks.push(drawingBlock);
|
|
23804
|
+
}
|
|
23805
|
+
continue;
|
|
23806
|
+
}
|
|
23807
|
+
if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
|
|
23808
|
+
const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(
|
|
23809
|
+
childNode,
|
|
23810
|
+
context.nextBlockId,
|
|
23811
|
+
context.positions
|
|
23812
|
+
);
|
|
23813
|
+
if (drawingBlock) {
|
|
23814
|
+
blocks.push(drawingBlock);
|
|
23815
|
+
}
|
|
23816
|
+
}
|
|
23817
|
+
}
|
|
23818
|
+
try {
|
|
23819
|
+
const blockSummaries = blocks.map((b) => {
|
|
23820
|
+
if (b.kind === "paragraph") {
|
|
23821
|
+
const runs = b.runs ?? [];
|
|
23822
|
+
const attrs = b.attrs ?? {};
|
|
23823
|
+
return {
|
|
23824
|
+
kind: "paragraph",
|
|
23825
|
+
runKinds: runs.map((r2) => r2.kind ?? "text"),
|
|
23826
|
+
runCount: runs.length,
|
|
23827
|
+
runPreview: runs.map((r2) => {
|
|
23828
|
+
const kind = r2.kind ?? "text";
|
|
23829
|
+
if (kind === "image") {
|
|
23830
|
+
const img = r2;
|
|
23831
|
+
return { kind, src: img.src, width: img.width, height: img.height };
|
|
23832
|
+
}
|
|
23833
|
+
return { kind };
|
|
23834
|
+
}),
|
|
23835
|
+
hasNumbering: Boolean(attrs.numberingProperties),
|
|
23836
|
+
markerText: attrs.wordLayout?.marker?.markerText
|
|
23837
|
+
};
|
|
23838
|
+
}
|
|
23839
|
+
return { kind: b.kind };
|
|
23840
|
+
});
|
|
23841
|
+
console.log(
|
|
23842
|
+
"[tableNodeToBlock.parseTableCell] cell contents",
|
|
23843
|
+
JSON.stringify({
|
|
23844
|
+
cellIndex,
|
|
23845
|
+
rowIndex,
|
|
23846
|
+
cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
|
|
23847
|
+
childTypes: cellNode.content.map((c) => c?.type),
|
|
23848
|
+
blocks: blockSummaries
|
|
23849
|
+
})
|
|
23850
|
+
);
|
|
23851
|
+
} catch {
|
|
23678
23852
|
}
|
|
23679
23853
|
if (blocks.length === 0) {
|
|
23680
23854
|
return null;
|
|
@@ -23814,9 +23988,10 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
23814
23988
|
}
|
|
23815
23989
|
return { anchor, wrap };
|
|
23816
23990
|
}
|
|
23817
|
-
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext) {
|
|
23991
|
+
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
|
|
23818
23992
|
if (!Array.isArray(node.content) || node.content.length === 0) return null;
|
|
23819
|
-
|
|
23993
|
+
const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
|
|
23994
|
+
if (!paragraphConverter) return null;
|
|
23820
23995
|
const parserDeps = {
|
|
23821
23996
|
nextBlockId,
|
|
23822
23997
|
positions,
|
|
@@ -23827,8 +24002,10 @@ function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSi
|
|
|
23827
24002
|
bookmarks,
|
|
23828
24003
|
hyperlinkConfig,
|
|
23829
24004
|
themeColors,
|
|
23830
|
-
|
|
23831
|
-
|
|
24005
|
+
listCounterContext: options?.listCounterContext,
|
|
24006
|
+
paragraphToFlowBlocks: paragraphConverter,
|
|
24007
|
+
converterContext,
|
|
24008
|
+
converters: options?.converters
|
|
23832
24009
|
};
|
|
23833
24010
|
const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
|
|
23834
24011
|
const defaultCellPadding = hydratedTableStyle?.cellPadding;
|
|
@@ -23948,6 +24125,7 @@ function handleTableNode(node, context) {
|
|
|
23948
24125
|
defaultFont,
|
|
23949
24126
|
defaultSize,
|
|
23950
24127
|
styleContext,
|
|
24128
|
+
listCounterContext,
|
|
23951
24129
|
trackedChangesConfig,
|
|
23952
24130
|
bookmarks,
|
|
23953
24131
|
hyperlinkConfig,
|
|
@@ -23967,7 +24145,8 @@ function handleTableNode(node, context) {
|
|
|
23967
24145
|
void 0,
|
|
23968
24146
|
// themeColors
|
|
23969
24147
|
converters?.paragraphToFlowBlocks,
|
|
23970
|
-
converterContext
|
|
24148
|
+
converterContext,
|
|
24149
|
+
{ listCounterContext, converters }
|
|
23971
24150
|
);
|
|
23972
24151
|
if (tableBlock) {
|
|
23973
24152
|
blocks.push(tableBlock);
|
|
@@ -24121,7 +24300,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
24121
24300
|
bookmarks2,
|
|
24122
24301
|
hyperlinkConfig2,
|
|
24123
24302
|
themeColorsParam ?? themeColors,
|
|
24124
|
-
|
|
24303
|
+
paragraphConverter
|
|
24125
24304
|
);
|
|
24126
24305
|
const handlerContext = {
|
|
24127
24306
|
blocks,
|
|
@@ -24144,7 +24323,11 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
24144
24323
|
converters: {
|
|
24145
24324
|
paragraphToFlowBlocks: paragraphConverter,
|
|
24146
24325
|
tableNodeToBlock: tableConverter,
|
|
24147
|
-
imageNodeToBlock
|
|
24326
|
+
imageNodeToBlock,
|
|
24327
|
+
vectorShapeNodeToDrawingBlock,
|
|
24328
|
+
shapeGroupNodeToDrawingBlock,
|
|
24329
|
+
shapeContainerNodeToDrawingBlock,
|
|
24330
|
+
shapeTextboxNodeToDrawingBlock
|
|
24148
24331
|
}
|
|
24149
24332
|
};
|
|
24150
24333
|
doc2.content.forEach((node) => {
|
|
@@ -24229,7 +24412,18 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
|
|
|
24229
24412
|
hyperlinkConfig2,
|
|
24230
24413
|
themeColors2,
|
|
24231
24414
|
paragraphToFlowBlocks,
|
|
24232
|
-
converterCtx ?? converterContext
|
|
24415
|
+
converterCtx ?? converterContext,
|
|
24416
|
+
{
|
|
24417
|
+
listCounterContext,
|
|
24418
|
+
converters: {
|
|
24419
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
24420
|
+
imageNodeToBlock,
|
|
24421
|
+
vectorShapeNodeToDrawingBlock,
|
|
24422
|
+
shapeGroupNodeToDrawingBlock,
|
|
24423
|
+
shapeContainerNodeToDrawingBlock,
|
|
24424
|
+
shapeTextboxNodeToDrawingBlock
|
|
24425
|
+
}
|
|
24426
|
+
}
|
|
24233
24427
|
)
|
|
24234
24428
|
},
|
|
24235
24429
|
converterContext
|
|
@@ -24248,7 +24442,17 @@ function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize
|
|
|
24248
24442
|
hyperlinkConfig,
|
|
24249
24443
|
themeColors,
|
|
24250
24444
|
paragraphToFlowBlocks,
|
|
24251
|
-
converterContext
|
|
24445
|
+
converterContext,
|
|
24446
|
+
{
|
|
24447
|
+
converters: {
|
|
24448
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
24449
|
+
imageNodeToBlock,
|
|
24450
|
+
vectorShapeNodeToDrawingBlock,
|
|
24451
|
+
shapeGroupNodeToDrawingBlock,
|
|
24452
|
+
shapeContainerNodeToDrawingBlock,
|
|
24453
|
+
shapeTextboxNodeToDrawingBlock
|
|
24454
|
+
}
|
|
24455
|
+
}
|
|
24252
24456
|
);
|
|
24253
24457
|
}
|
|
24254
24458
|
let measurementCanvas = null;
|
|
@@ -27431,6 +27635,43 @@ const resolveTableCellBorders = (tableBorders, rowIndex, colIndex, totalRows, to
|
|
|
27431
27635
|
right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
|
|
27432
27636
|
};
|
|
27433
27637
|
};
|
|
27638
|
+
const LIST_MARKER_GAP$2 = 8;
|
|
27639
|
+
function renderListMarker(params2) {
|
|
27640
|
+
const { doc: doc2, lineEl, markerLayout, markerMeasure, indentLeftPx } = params2;
|
|
27641
|
+
const markerJustification = markerLayout?.justification ?? "left";
|
|
27642
|
+
const markerBoxWidth = (typeof markerLayout?.markerBoxWidthPx === "number" ? markerLayout.markerBoxWidthPx : void 0) ?? markerMeasure?.markerWidth ?? 0;
|
|
27643
|
+
const gutter = (typeof markerLayout?.gutterWidthPx === "number" ? markerLayout.gutterWidthPx : void 0) ?? markerMeasure?.gutterWidth ?? LIST_MARKER_GAP$2;
|
|
27644
|
+
const markerStartPos = markerJustification === "left" ? indentLeftPx : (typeof markerLayout?.markerX === "number" ? markerLayout.markerX : void 0) ?? indentLeftPx;
|
|
27645
|
+
const markerLeftPos = markerStartPos - markerBoxWidth;
|
|
27646
|
+
const lineContainer = doc2.createElement("div");
|
|
27647
|
+
lineContainer.style.position = "relative";
|
|
27648
|
+
lineContainer.style.width = "100%";
|
|
27649
|
+
const markerEl = doc2.createElement("span");
|
|
27650
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
27651
|
+
markerEl.textContent = markerLayout?.markerText ?? "";
|
|
27652
|
+
markerEl.style.display = "inline-block";
|
|
27653
|
+
markerEl.style.fontFamily = markerLayout?.run?.fontFamily ?? "";
|
|
27654
|
+
if (markerLayout?.run?.fontSize != null) {
|
|
27655
|
+
markerEl.style.fontSize = `${markerLayout.run.fontSize}px`;
|
|
27656
|
+
}
|
|
27657
|
+
markerEl.style.fontWeight = markerLayout?.run?.bold ? "bold" : "";
|
|
27658
|
+
markerEl.style.fontStyle = markerLayout?.run?.italic ? "italic" : "";
|
|
27659
|
+
if (markerLayout?.run?.color) {
|
|
27660
|
+
markerEl.style.color = markerLayout.run.color;
|
|
27661
|
+
}
|
|
27662
|
+
if (markerLayout?.run?.letterSpacing != null) {
|
|
27663
|
+
markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
|
|
27664
|
+
}
|
|
27665
|
+
markerEl.style.position = "absolute";
|
|
27666
|
+
markerEl.style.left = `${markerLeftPos}px`;
|
|
27667
|
+
markerEl.style.width = `${markerBoxWidth}px`;
|
|
27668
|
+
markerEl.style.textAlign = markerJustification;
|
|
27669
|
+
markerEl.style.paddingRight = `${gutter}px`;
|
|
27670
|
+
lineEl.style.paddingLeft = `${markerStartPos}px`;
|
|
27671
|
+
lineContainer.appendChild(markerEl);
|
|
27672
|
+
lineContainer.appendChild(lineEl);
|
|
27673
|
+
return lineContainer;
|
|
27674
|
+
}
|
|
27434
27675
|
const renderTableCell = (deps) => {
|
|
27435
27676
|
const {
|
|
27436
27677
|
doc: doc2,
|
|
@@ -27472,6 +27713,20 @@ const renderTableCell = (deps) => {
|
|
|
27472
27713
|
}
|
|
27473
27714
|
const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
|
|
27474
27715
|
const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
|
|
27716
|
+
try {
|
|
27717
|
+
console.log(
|
|
27718
|
+
"[DomPainter.renderTableCell] cell render input",
|
|
27719
|
+
JSON.stringify({
|
|
27720
|
+
cellId: cell?.id,
|
|
27721
|
+
blockKinds: cellBlocks.map((b) => b.kind),
|
|
27722
|
+
measureKinds: blockMeasures.map((m) => m.kind),
|
|
27723
|
+
width: cellMeasure?.width,
|
|
27724
|
+
height: cellMeasure?.height,
|
|
27725
|
+
rowHeight
|
|
27726
|
+
})
|
|
27727
|
+
);
|
|
27728
|
+
} catch {
|
|
27729
|
+
}
|
|
27475
27730
|
if (cellBlocks.length > 0 && blockMeasures.length > 0) {
|
|
27476
27731
|
const content = doc2.createElement("div");
|
|
27477
27732
|
content.style.position = "relative";
|
|
@@ -27503,9 +27758,106 @@ const renderTableCell = (deps) => {
|
|
|
27503
27758
|
for (let i = 0; i < Math.min(blockMeasures.length, cellBlocks.length); i++) {
|
|
27504
27759
|
const blockMeasure = blockMeasures[i];
|
|
27505
27760
|
const block = cellBlocks[i];
|
|
27761
|
+
if (blockMeasure.kind === "image" && block?.kind === "image") {
|
|
27762
|
+
console.log(
|
|
27763
|
+
"[DomPainter.renderTableCell] rendering image block in cell",
|
|
27764
|
+
JSON.stringify({
|
|
27765
|
+
cellId: cell?.id,
|
|
27766
|
+
blockId: block.id,
|
|
27767
|
+
width: blockMeasure.width,
|
|
27768
|
+
height: blockMeasure.height
|
|
27769
|
+
})
|
|
27770
|
+
);
|
|
27771
|
+
const imageWrapper = doc2.createElement("div");
|
|
27772
|
+
imageWrapper.style.position = "relative";
|
|
27773
|
+
imageWrapper.style.width = `${blockMeasure.width}px`;
|
|
27774
|
+
imageWrapper.style.height = `${blockMeasure.height}px`;
|
|
27775
|
+
imageWrapper.style.maxWidth = "100%";
|
|
27776
|
+
imageWrapper.style.boxSizing = "border-box";
|
|
27777
|
+
applySdtDataset(imageWrapper, block.attrs?.sdt);
|
|
27778
|
+
const imgEl = doc2.createElement("img");
|
|
27779
|
+
imgEl.classList.add("superdoc-table-image");
|
|
27780
|
+
if (block.src) {
|
|
27781
|
+
imgEl.src = block.src;
|
|
27782
|
+
}
|
|
27783
|
+
imgEl.alt = block.alt ?? "";
|
|
27784
|
+
imgEl.style.width = "100%";
|
|
27785
|
+
imgEl.style.height = "100%";
|
|
27786
|
+
imgEl.style.objectFit = block.objectFit ?? "contain";
|
|
27787
|
+
imgEl.style.display = "block";
|
|
27788
|
+
imageWrapper.appendChild(imgEl);
|
|
27789
|
+
content.appendChild(imageWrapper);
|
|
27790
|
+
continue;
|
|
27791
|
+
}
|
|
27792
|
+
if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
|
|
27793
|
+
console.log(
|
|
27794
|
+
"[DomPainter.renderTableCell] rendering drawing block in cell",
|
|
27795
|
+
JSON.stringify({
|
|
27796
|
+
cellId: cell?.id,
|
|
27797
|
+
blockId: block.id,
|
|
27798
|
+
drawingKind: block.drawingKind,
|
|
27799
|
+
width: blockMeasure.width,
|
|
27800
|
+
height: blockMeasure.height
|
|
27801
|
+
})
|
|
27802
|
+
);
|
|
27803
|
+
const drawingWrapper = doc2.createElement("div");
|
|
27804
|
+
drawingWrapper.style.position = "relative";
|
|
27805
|
+
drawingWrapper.style.width = `${blockMeasure.width}px`;
|
|
27806
|
+
drawingWrapper.style.height = `${blockMeasure.height}px`;
|
|
27807
|
+
drawingWrapper.style.maxWidth = "100%";
|
|
27808
|
+
drawingWrapper.style.boxSizing = "border-box";
|
|
27809
|
+
applySdtDataset(drawingWrapper, block.attrs);
|
|
27810
|
+
const drawingInner = doc2.createElement("div");
|
|
27811
|
+
drawingInner.classList.add("superdoc-table-drawing");
|
|
27812
|
+
drawingInner.style.width = "100%";
|
|
27813
|
+
drawingInner.style.height = "100%";
|
|
27814
|
+
drawingInner.style.display = "flex";
|
|
27815
|
+
drawingInner.style.alignItems = "center";
|
|
27816
|
+
drawingInner.style.justifyContent = "center";
|
|
27817
|
+
drawingInner.style.overflow = "hidden";
|
|
27818
|
+
if (block.drawingKind === "image" && "src" in block && block.src) {
|
|
27819
|
+
const img = doc2.createElement("img");
|
|
27820
|
+
img.classList.add("superdoc-drawing-image");
|
|
27821
|
+
img.src = block.src;
|
|
27822
|
+
img.alt = block.alt ?? "";
|
|
27823
|
+
img.style.width = "100%";
|
|
27824
|
+
img.style.height = "100%";
|
|
27825
|
+
img.style.objectFit = block.objectFit ?? "contain";
|
|
27826
|
+
drawingInner.appendChild(img);
|
|
27827
|
+
} else {
|
|
27828
|
+
const placeholder = doc2.createElement("div");
|
|
27829
|
+
placeholder.style.width = "100%";
|
|
27830
|
+
placeholder.style.height = "100%";
|
|
27831
|
+
placeholder.style.background = "repeating-linear-gradient(45deg, rgba(15,23,42,0.1), rgba(15,23,42,0.1) 6px, rgba(15,23,42,0.2) 6px, rgba(15,23,42,0.2) 12px)";
|
|
27832
|
+
placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
|
|
27833
|
+
drawingInner.appendChild(placeholder);
|
|
27834
|
+
}
|
|
27835
|
+
drawingWrapper.appendChild(drawingInner);
|
|
27836
|
+
content.appendChild(drawingWrapper);
|
|
27837
|
+
continue;
|
|
27838
|
+
}
|
|
27506
27839
|
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
27507
|
-
|
|
27840
|
+
try {
|
|
27841
|
+
const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
|
|
27842
|
+
const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
|
|
27843
|
+
console.log(
|
|
27844
|
+
"[DomPainter.renderTableCell] rendering paragraph block in cell",
|
|
27845
|
+
JSON.stringify({
|
|
27846
|
+
cellId: cell?.id,
|
|
27847
|
+
blockId: block.id,
|
|
27848
|
+
runKinds,
|
|
27849
|
+
imageRuns
|
|
27850
|
+
})
|
|
27851
|
+
);
|
|
27852
|
+
} catch {
|
|
27853
|
+
}
|
|
27854
|
+
const paragraphMeasure = blockMeasure;
|
|
27855
|
+
const lines = paragraphMeasure.lines;
|
|
27508
27856
|
const blockLineCount = lines?.length || 0;
|
|
27857
|
+
const wordLayout = block.attrs?.wordLayout ?? null;
|
|
27858
|
+
const markerLayout = wordLayout?.marker;
|
|
27859
|
+
const markerMeasure = paragraphMeasure.marker;
|
|
27860
|
+
const indentLeftPx = markerMeasure?.indentLeft ?? wordLayout?.indentLeftPx ?? (block.attrs?.indent && typeof block.attrs.indent.left === "number" ? block.attrs.indent.left : 0);
|
|
27509
27861
|
const blockStartGlobal = cumulativeLineCount;
|
|
27510
27862
|
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
27511
27863
|
if (blockEndGlobal <= globalFromLine) {
|
|
@@ -27527,7 +27879,38 @@ const renderTableCell = (deps) => {
|
|
|
27527
27879
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
27528
27880
|
const line = lines[lineIdx];
|
|
27529
27881
|
const lineEl = renderLine(block, line, { ...context, section: "body" });
|
|
27530
|
-
|
|
27882
|
+
lineEl.style.paddingLeft = "";
|
|
27883
|
+
lineEl.style.paddingRight = "";
|
|
27884
|
+
lineEl.style.textIndent = "";
|
|
27885
|
+
const shouldRenderMarker = markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;
|
|
27886
|
+
if (shouldRenderMarker) {
|
|
27887
|
+
const lineContainer = renderListMarker({
|
|
27888
|
+
doc: doc2,
|
|
27889
|
+
lineEl,
|
|
27890
|
+
markerLayout,
|
|
27891
|
+
markerMeasure,
|
|
27892
|
+
indentLeftPx
|
|
27893
|
+
});
|
|
27894
|
+
paraWrapper.appendChild(lineContainer);
|
|
27895
|
+
} else {
|
|
27896
|
+
if (markerLayout && indentLeftPx) {
|
|
27897
|
+
lineEl.style.paddingLeft = `${indentLeftPx}px`;
|
|
27898
|
+
} else {
|
|
27899
|
+
const indent = block.attrs?.indent;
|
|
27900
|
+
if (indent) {
|
|
27901
|
+
if (typeof indent.left === "number" && indent.left > 0) {
|
|
27902
|
+
lineEl.style.paddingLeft = `${indent.left}px`;
|
|
27903
|
+
}
|
|
27904
|
+
if (typeof indent.right === "number" && indent.right > 0) {
|
|
27905
|
+
lineEl.style.paddingRight = `${indent.right}px`;
|
|
27906
|
+
}
|
|
27907
|
+
if (lineIdx === 0 && typeof indent.firstLine === "number" && indent.firstLine !== 0) {
|
|
27908
|
+
lineEl.style.textIndent = `${indent.firstLine}px`;
|
|
27909
|
+
}
|
|
27910
|
+
}
|
|
27911
|
+
}
|
|
27912
|
+
paraWrapper.appendChild(lineEl);
|
|
27913
|
+
}
|
|
27531
27914
|
renderedHeight += line.lineHeight;
|
|
27532
27915
|
}
|
|
27533
27916
|
const renderedEntireBlock = localStartLine === 0 && localEndLine >= blockLineCount;
|
|
@@ -29337,10 +29720,10 @@ const _DomPainter = class _DomPainter {
|
|
|
29337
29720
|
let markerStartPos;
|
|
29338
29721
|
if (isFirstLineIndentMode && wordLayout.marker.markerX !== void 0 && Number.isFinite(wordLayout.marker.markerX)) {
|
|
29339
29722
|
markerStartPos = wordLayout.marker.markerX;
|
|
29340
|
-
} else if (isFirstLineIndentMode) {
|
|
29341
|
-
markerStartPos = paraIndentLeft + (paraIndent?.firstLine ?? 0);
|
|
29342
29723
|
} else {
|
|
29343
|
-
|
|
29724
|
+
const hanging = paraIndent?.hanging ?? 0;
|
|
29725
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
29726
|
+
markerStartPos = paraIndentLeft - hanging + firstLine;
|
|
29344
29727
|
}
|
|
29345
29728
|
const validMarkerStartPos = Number.isFinite(markerStartPos) ? markerStartPos : 0;
|
|
29346
29729
|
lineEl.style.paddingLeft = `${validMarkerStartPos}px`;
|
|
@@ -29408,15 +29791,27 @@ const _DomPainter = class _DomPainter {
|
|
|
29408
29791
|
tabWidth = LIST_MARKER_GAP$1;
|
|
29409
29792
|
}
|
|
29410
29793
|
} else {
|
|
29411
|
-
const
|
|
29412
|
-
|
|
29413
|
-
|
|
29794
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
29795
|
+
const textStart = paraIndentLeft + firstLine;
|
|
29796
|
+
tabWidth = textStart - currentPos;
|
|
29797
|
+
if (tabWidth <= 0) {
|
|
29414
29798
|
tabWidth = DEFAULT_TAB_INTERVAL_PX$1 - currentPos % DEFAULT_TAB_INTERVAL_PX$1;
|
|
29415
|
-
|
|
29799
|
+
} else if (tabWidth < LIST_MARKER_GAP$1) {
|
|
29800
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
29416
29801
|
}
|
|
29417
29802
|
}
|
|
29418
29803
|
} else {
|
|
29419
|
-
|
|
29804
|
+
const gutterWidth = fragment.markerGutter ?? wordLayout.marker.gutterWidthPx;
|
|
29805
|
+
if (gutterWidth !== void 0 && Number.isFinite(gutterWidth) && gutterWidth > 0) {
|
|
29806
|
+
tabWidth = gutterWidth;
|
|
29807
|
+
} else {
|
|
29808
|
+
const firstLine = paraIndent?.firstLine ?? 0;
|
|
29809
|
+
const textStart = paraIndentLeft + firstLine;
|
|
29810
|
+
tabWidth = textStart - validMarkerStartPos;
|
|
29811
|
+
}
|
|
29812
|
+
if (tabWidth < LIST_MARKER_GAP$1) {
|
|
29813
|
+
tabWidth = LIST_MARKER_GAP$1;
|
|
29814
|
+
}
|
|
29420
29815
|
}
|
|
29421
29816
|
tabEl.style.display = "inline-block";
|
|
29422
29817
|
tabEl.style.width = `${tabWidth}px`;
|