@harbour-enterprises/superdoc 1.0.0-beta.82 → 1.0.0-beta.83
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-gQqtBsXT.es.js → PdfViewer-BKSYQF4A.es.js} +1 -1
- package/dist/chunks/{PdfViewer-kLZVOUbz.cjs → PdfViewer-CHGHNfNo.cjs} +1 -1
- package/dist/chunks/{index-CNPZHNDf.es.js → index-CwqkdTTS.es.js} +3 -3
- package/dist/chunks/{index-cUgy4sJN.cjs → index-Dh6EUBba.cjs} +3 -3
- package/dist/chunks/{index-GF5Urhpn-LFkKkWot.es.js → index-YXzWgyNJ-Tc_oVxxj.es.js} +1 -1
- package/dist/chunks/{index-GF5Urhpn-BNFw-VyP.cjs → index-YXzWgyNJ-pYe0a6fD.cjs} +1 -1
- package/dist/chunks/{super-editor.es-DfLaDbHA.es.js → super-editor.es-C3DMEtqC.es.js} +422 -54
- package/dist/chunks/{super-editor.es-44RL9-Ca.cjs → super-editor.es-CmeSTVH2.cjs} +422 -54
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Bfu1F5pk.js → converter-BjVEidKj.js} +1 -1
- package/dist/super-editor/chunks/{docx-zipper-Cl08Z_S_.js → docx-zipper-_rraiG3i.js} +1 -1
- package/dist/super-editor/chunks/{editor-CwTMBaym.js → editor-pX9cGnu1.js} +423 -55
- package/dist/super-editor/chunks/{index-GF5Urhpn.js → index-YXzWgyNJ.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-DZTp7DIF.js → toolbar-B2ca6SPN.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 +424 -56
- 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-BjVEidKj.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-_rraiG3i.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.83";
|
|
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-YXzWgyNJ.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.83");
|
|
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
|
};
|
|
@@ -21594,14 +21638,29 @@ const computeParagraphAttrs = (para, styleContext, listCounterContext, converter
|
|
|
21594
21638
|
paragraphAttrs.frame = frame;
|
|
21595
21639
|
}
|
|
21596
21640
|
}
|
|
21641
|
+
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
21597
21642
|
const numberingSource = attrs.numberingProperties ?? paragraphProps.numberingProperties ?? hydrated?.numberingProperties;
|
|
21598
|
-
|
|
21643
|
+
let rawNumberingProps = toAdapterNumberingProps(numberingSource);
|
|
21644
|
+
if (!rawNumberingProps && listRendering) {
|
|
21645
|
+
const path = listRendering.path;
|
|
21646
|
+
const counterFromPath = path && path.length ? path[path.length - 1] : void 0;
|
|
21647
|
+
const ilvl = path && path.length > 1 ? path.length - 1 : 0;
|
|
21648
|
+
rawNumberingProps = {
|
|
21649
|
+
numId: -1,
|
|
21650
|
+
ilvl,
|
|
21651
|
+
path,
|
|
21652
|
+
counterValue: Number.isFinite(counterFromPath) ? Number(counterFromPath) : void 0,
|
|
21653
|
+
markerText: listRendering.markerText,
|
|
21654
|
+
format: listRendering.numberingType,
|
|
21655
|
+
lvlJc: listRendering.justification,
|
|
21656
|
+
suffix: listRendering.suffix
|
|
21657
|
+
};
|
|
21658
|
+
}
|
|
21599
21659
|
const hasValidNumbering = rawNumberingProps && isValidNumberingId(rawNumberingProps.numId);
|
|
21600
21660
|
if (hasValidNumbering) {
|
|
21601
21661
|
const numberingProps = rawNumberingProps;
|
|
21602
21662
|
const numId = numberingProps.numId;
|
|
21603
21663
|
const ilvl = Number.isFinite(numberingProps.ilvl) ? Math.max(0, Math.floor(Number(numberingProps.ilvl))) : 0;
|
|
21604
|
-
const listRendering = normalizeListRenderingAttrs(attrs.listRendering);
|
|
21605
21664
|
const numericNumId = typeof numId === "number" ? numId : void 0;
|
|
21606
21665
|
const resolvedLevel = resolveNumberingFromContext(numId, ilvl, converterContext?.numbering);
|
|
21607
21666
|
if (resolvedLevel) {
|
|
@@ -23652,30 +23711,130 @@ const parseTableCell = (args) => {
|
|
|
23652
23711
|
...context.converterContext,
|
|
23653
23712
|
tableStyleParagraphProps
|
|
23654
23713
|
} : context.converterContext;
|
|
23714
|
+
const paragraphToFlowBlocks2 = context.converters?.paragraphToFlowBlocks ?? context.paragraphToFlowBlocks;
|
|
23715
|
+
const listCounterContext = context.listCounterContext;
|
|
23655
23716
|
for (const childNode of cellNode.content) {
|
|
23656
23717
|
if (childNode.type === "paragraph") {
|
|
23657
|
-
|
|
23718
|
+
if (!paragraphToFlowBlocks2) continue;
|
|
23719
|
+
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
23658
23720
|
childNode,
|
|
23659
23721
|
context.nextBlockId,
|
|
23660
23722
|
context.positions,
|
|
23661
23723
|
context.defaultFont,
|
|
23662
23724
|
context.defaultSize,
|
|
23663
23725
|
context.styleContext,
|
|
23664
|
-
|
|
23665
|
-
// listCounterContext
|
|
23726
|
+
listCounterContext,
|
|
23666
23727
|
context.trackedChanges,
|
|
23667
23728
|
context.bookmarks,
|
|
23668
23729
|
context.hyperlinkConfig,
|
|
23669
23730
|
context.themeColors,
|
|
23670
23731
|
cellConverterContext
|
|
23671
|
-
// converterContext at position 12
|
|
23672
23732
|
);
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23733
|
+
paragraphBlocks.forEach((block) => {
|
|
23734
|
+
if (block.kind === "paragraph" || block.kind === "image" || block.kind === "drawing") {
|
|
23735
|
+
blocks.push(block);
|
|
23736
|
+
}
|
|
23737
|
+
});
|
|
23738
|
+
continue;
|
|
23739
|
+
}
|
|
23740
|
+
if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
|
|
23741
|
+
const mergedMarks = [...childNode.marks ?? []];
|
|
23742
|
+
const trackedMeta = context.trackedChanges ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
23743
|
+
if (shouldHideTrackedNode(trackedMeta, context.trackedChanges)) {
|
|
23744
|
+
continue;
|
|
23745
|
+
}
|
|
23746
|
+
const imageBlock = context.converters.imageNodeToBlock(
|
|
23747
|
+
childNode,
|
|
23748
|
+
context.nextBlockId,
|
|
23749
|
+
context.positions,
|
|
23750
|
+
trackedMeta,
|
|
23751
|
+
context.trackedChanges
|
|
23752
|
+
);
|
|
23753
|
+
if (imageBlock && imageBlock.kind === "image") {
|
|
23754
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChanges);
|
|
23755
|
+
blocks.push(imageBlock);
|
|
23756
|
+
}
|
|
23757
|
+
continue;
|
|
23758
|
+
}
|
|
23759
|
+
if (childNode.type === "vectorShape" && context.converters?.vectorShapeNodeToDrawingBlock) {
|
|
23760
|
+
const drawingBlock = context.converters.vectorShapeNodeToDrawingBlock(
|
|
23761
|
+
childNode,
|
|
23762
|
+
context.nextBlockId,
|
|
23763
|
+
context.positions
|
|
23764
|
+
);
|
|
23765
|
+
if (drawingBlock) {
|
|
23766
|
+
blocks.push(drawingBlock);
|
|
23767
|
+
}
|
|
23768
|
+
continue;
|
|
23769
|
+
}
|
|
23770
|
+
if (childNode.type === "shapeGroup" && context.converters?.shapeGroupNodeToDrawingBlock) {
|
|
23771
|
+
const drawingBlock = context.converters.shapeGroupNodeToDrawingBlock(
|
|
23772
|
+
childNode,
|
|
23773
|
+
context.nextBlockId,
|
|
23774
|
+
context.positions
|
|
23775
|
+
);
|
|
23776
|
+
if (drawingBlock) {
|
|
23777
|
+
blocks.push(drawingBlock);
|
|
23778
|
+
}
|
|
23779
|
+
continue;
|
|
23780
|
+
}
|
|
23781
|
+
if (childNode.type === "shapeContainer" && context.converters?.shapeContainerNodeToDrawingBlock) {
|
|
23782
|
+
const drawingBlock = context.converters.shapeContainerNodeToDrawingBlock(
|
|
23783
|
+
childNode,
|
|
23784
|
+
context.nextBlockId,
|
|
23785
|
+
context.positions
|
|
23786
|
+
);
|
|
23787
|
+
if (drawingBlock) {
|
|
23788
|
+
blocks.push(drawingBlock);
|
|
23789
|
+
}
|
|
23790
|
+
continue;
|
|
23791
|
+
}
|
|
23792
|
+
if (childNode.type === "shapeTextbox" && context.converters?.shapeTextboxNodeToDrawingBlock) {
|
|
23793
|
+
const drawingBlock = context.converters.shapeTextboxNodeToDrawingBlock(
|
|
23794
|
+
childNode,
|
|
23795
|
+
context.nextBlockId,
|
|
23796
|
+
context.positions
|
|
23797
|
+
);
|
|
23798
|
+
if (drawingBlock) {
|
|
23799
|
+
blocks.push(drawingBlock);
|
|
23676
23800
|
}
|
|
23677
23801
|
}
|
|
23678
23802
|
}
|
|
23803
|
+
try {
|
|
23804
|
+
const blockSummaries = blocks.map((b) => {
|
|
23805
|
+
if (b.kind === "paragraph") {
|
|
23806
|
+
const runs = b.runs ?? [];
|
|
23807
|
+
const attrs = b.attrs ?? {};
|
|
23808
|
+
return {
|
|
23809
|
+
kind: "paragraph",
|
|
23810
|
+
runKinds: runs.map((r2) => r2.kind ?? "text"),
|
|
23811
|
+
runCount: runs.length,
|
|
23812
|
+
runPreview: runs.map((r2) => {
|
|
23813
|
+
const kind = r2.kind ?? "text";
|
|
23814
|
+
if (kind === "image") {
|
|
23815
|
+
const img = r2;
|
|
23816
|
+
return { kind, src: img.src, width: img.width, height: img.height };
|
|
23817
|
+
}
|
|
23818
|
+
return { kind };
|
|
23819
|
+
}),
|
|
23820
|
+
hasNumbering: Boolean(attrs.numberingProperties),
|
|
23821
|
+
markerText: attrs.wordLayout?.marker?.markerText
|
|
23822
|
+
};
|
|
23823
|
+
}
|
|
23824
|
+
return { kind: b.kind };
|
|
23825
|
+
});
|
|
23826
|
+
console.log(
|
|
23827
|
+
"[tableNodeToBlock.parseTableCell] cell contents",
|
|
23828
|
+
JSON.stringify({
|
|
23829
|
+
cellIndex,
|
|
23830
|
+
rowIndex,
|
|
23831
|
+
cellIdPreview: `cell-${rowIndex}-${cellIndex}`,
|
|
23832
|
+
childTypes: cellNode.content.map((c) => c?.type),
|
|
23833
|
+
blocks: blockSummaries
|
|
23834
|
+
})
|
|
23835
|
+
);
|
|
23836
|
+
} catch {
|
|
23837
|
+
}
|
|
23679
23838
|
if (blocks.length === 0) {
|
|
23680
23839
|
return null;
|
|
23681
23840
|
}
|
|
@@ -23814,9 +23973,10 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
23814
23973
|
}
|
|
23815
23974
|
return { anchor, wrap };
|
|
23816
23975
|
}
|
|
23817
|
-
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext) {
|
|
23976
|
+
function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSize, _styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, paragraphToFlowBlocks2, converterContext, options) {
|
|
23818
23977
|
if (!Array.isArray(node.content) || node.content.length === 0) return null;
|
|
23819
|
-
|
|
23978
|
+
const paragraphConverter = paragraphToFlowBlocks2 ?? options?.converters?.paragraphToFlowBlocks;
|
|
23979
|
+
if (!paragraphConverter) return null;
|
|
23820
23980
|
const parserDeps = {
|
|
23821
23981
|
nextBlockId,
|
|
23822
23982
|
positions,
|
|
@@ -23827,8 +23987,10 @@ function tableNodeToBlock$1(node, nextBlockId, positions, defaultFont, defaultSi
|
|
|
23827
23987
|
bookmarks,
|
|
23828
23988
|
hyperlinkConfig,
|
|
23829
23989
|
themeColors,
|
|
23830
|
-
|
|
23831
|
-
|
|
23990
|
+
listCounterContext: options?.listCounterContext,
|
|
23991
|
+
paragraphToFlowBlocks: paragraphConverter,
|
|
23992
|
+
converterContext,
|
|
23993
|
+
converters: options?.converters
|
|
23832
23994
|
};
|
|
23833
23995
|
const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
|
|
23834
23996
|
const defaultCellPadding = hydratedTableStyle?.cellPadding;
|
|
@@ -23948,6 +24110,7 @@ function handleTableNode(node, context) {
|
|
|
23948
24110
|
defaultFont,
|
|
23949
24111
|
defaultSize,
|
|
23950
24112
|
styleContext,
|
|
24113
|
+
listCounterContext,
|
|
23951
24114
|
trackedChangesConfig,
|
|
23952
24115
|
bookmarks,
|
|
23953
24116
|
hyperlinkConfig,
|
|
@@ -23967,7 +24130,8 @@ function handleTableNode(node, context) {
|
|
|
23967
24130
|
void 0,
|
|
23968
24131
|
// themeColors
|
|
23969
24132
|
converters?.paragraphToFlowBlocks,
|
|
23970
|
-
converterContext
|
|
24133
|
+
converterContext,
|
|
24134
|
+
{ listCounterContext, converters }
|
|
23971
24135
|
);
|
|
23972
24136
|
if (tableBlock) {
|
|
23973
24137
|
blocks.push(tableBlock);
|
|
@@ -24121,7 +24285,7 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
24121
24285
|
bookmarks2,
|
|
24122
24286
|
hyperlinkConfig2,
|
|
24123
24287
|
themeColorsParam ?? themeColors,
|
|
24124
|
-
|
|
24288
|
+
paragraphConverter
|
|
24125
24289
|
);
|
|
24126
24290
|
const handlerContext = {
|
|
24127
24291
|
blocks,
|
|
@@ -24144,7 +24308,11 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
24144
24308
|
converters: {
|
|
24145
24309
|
paragraphToFlowBlocks: paragraphConverter,
|
|
24146
24310
|
tableNodeToBlock: tableConverter,
|
|
24147
|
-
imageNodeToBlock
|
|
24311
|
+
imageNodeToBlock,
|
|
24312
|
+
vectorShapeNodeToDrawingBlock,
|
|
24313
|
+
shapeGroupNodeToDrawingBlock,
|
|
24314
|
+
shapeContainerNodeToDrawingBlock,
|
|
24315
|
+
shapeTextboxNodeToDrawingBlock
|
|
24148
24316
|
}
|
|
24149
24317
|
};
|
|
24150
24318
|
doc2.content.forEach((node) => {
|
|
@@ -24229,7 +24397,18 @@ function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaul
|
|
|
24229
24397
|
hyperlinkConfig2,
|
|
24230
24398
|
themeColors2,
|
|
24231
24399
|
paragraphToFlowBlocks,
|
|
24232
|
-
converterCtx ?? converterContext
|
|
24400
|
+
converterCtx ?? converterContext,
|
|
24401
|
+
{
|
|
24402
|
+
listCounterContext,
|
|
24403
|
+
converters: {
|
|
24404
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
24405
|
+
imageNodeToBlock,
|
|
24406
|
+
vectorShapeNodeToDrawingBlock,
|
|
24407
|
+
shapeGroupNodeToDrawingBlock,
|
|
24408
|
+
shapeContainerNodeToDrawingBlock,
|
|
24409
|
+
shapeTextboxNodeToDrawingBlock
|
|
24410
|
+
}
|
|
24411
|
+
}
|
|
24233
24412
|
)
|
|
24234
24413
|
},
|
|
24235
24414
|
converterContext
|
|
@@ -24248,7 +24427,17 @@ function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize
|
|
|
24248
24427
|
hyperlinkConfig,
|
|
24249
24428
|
themeColors,
|
|
24250
24429
|
paragraphToFlowBlocks,
|
|
24251
|
-
converterContext
|
|
24430
|
+
converterContext,
|
|
24431
|
+
{
|
|
24432
|
+
converters: {
|
|
24433
|
+
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
24434
|
+
imageNodeToBlock,
|
|
24435
|
+
vectorShapeNodeToDrawingBlock,
|
|
24436
|
+
shapeGroupNodeToDrawingBlock,
|
|
24437
|
+
shapeContainerNodeToDrawingBlock,
|
|
24438
|
+
shapeTextboxNodeToDrawingBlock
|
|
24439
|
+
}
|
|
24440
|
+
}
|
|
24252
24441
|
);
|
|
24253
24442
|
}
|
|
24254
24443
|
let measurementCanvas = null;
|
|
@@ -27431,6 +27620,43 @@ const resolveTableCellBorders = (tableBorders, rowIndex, colIndex, totalRows, to
|
|
|
27431
27620
|
right: borderValueToSpec(isLastCol ? tableBorders?.right : null)
|
|
27432
27621
|
};
|
|
27433
27622
|
};
|
|
27623
|
+
const LIST_MARKER_GAP$2 = 8;
|
|
27624
|
+
function renderListMarker(params2) {
|
|
27625
|
+
const { doc: doc2, lineEl, markerLayout, markerMeasure, indentLeftPx } = params2;
|
|
27626
|
+
const markerJustification = markerLayout?.justification ?? "left";
|
|
27627
|
+
const markerBoxWidth = (typeof markerLayout?.markerBoxWidthPx === "number" ? markerLayout.markerBoxWidthPx : void 0) ?? markerMeasure?.markerWidth ?? 0;
|
|
27628
|
+
const gutter = (typeof markerLayout?.gutterWidthPx === "number" ? markerLayout.gutterWidthPx : void 0) ?? markerMeasure?.gutterWidth ?? LIST_MARKER_GAP$2;
|
|
27629
|
+
const markerStartPos = markerJustification === "left" ? indentLeftPx : (typeof markerLayout?.markerX === "number" ? markerLayout.markerX : void 0) ?? indentLeftPx;
|
|
27630
|
+
const markerLeftPos = markerStartPos - markerBoxWidth;
|
|
27631
|
+
const lineContainer = doc2.createElement("div");
|
|
27632
|
+
lineContainer.style.position = "relative";
|
|
27633
|
+
lineContainer.style.width = "100%";
|
|
27634
|
+
const markerEl = doc2.createElement("span");
|
|
27635
|
+
markerEl.classList.add("superdoc-paragraph-marker");
|
|
27636
|
+
markerEl.textContent = markerLayout?.markerText ?? "";
|
|
27637
|
+
markerEl.style.display = "inline-block";
|
|
27638
|
+
markerEl.style.fontFamily = markerLayout?.run?.fontFamily ?? "";
|
|
27639
|
+
if (markerLayout?.run?.fontSize != null) {
|
|
27640
|
+
markerEl.style.fontSize = `${markerLayout.run.fontSize}px`;
|
|
27641
|
+
}
|
|
27642
|
+
markerEl.style.fontWeight = markerLayout?.run?.bold ? "bold" : "";
|
|
27643
|
+
markerEl.style.fontStyle = markerLayout?.run?.italic ? "italic" : "";
|
|
27644
|
+
if (markerLayout?.run?.color) {
|
|
27645
|
+
markerEl.style.color = markerLayout.run.color;
|
|
27646
|
+
}
|
|
27647
|
+
if (markerLayout?.run?.letterSpacing != null) {
|
|
27648
|
+
markerEl.style.letterSpacing = `${markerLayout.run.letterSpacing}px`;
|
|
27649
|
+
}
|
|
27650
|
+
markerEl.style.position = "absolute";
|
|
27651
|
+
markerEl.style.left = `${markerLeftPos}px`;
|
|
27652
|
+
markerEl.style.width = `${markerBoxWidth}px`;
|
|
27653
|
+
markerEl.style.textAlign = markerJustification;
|
|
27654
|
+
markerEl.style.paddingRight = `${gutter}px`;
|
|
27655
|
+
lineEl.style.paddingLeft = `${markerStartPos}px`;
|
|
27656
|
+
lineContainer.appendChild(markerEl);
|
|
27657
|
+
lineContainer.appendChild(lineEl);
|
|
27658
|
+
return lineContainer;
|
|
27659
|
+
}
|
|
27434
27660
|
const renderTableCell = (deps) => {
|
|
27435
27661
|
const {
|
|
27436
27662
|
doc: doc2,
|
|
@@ -27472,6 +27698,20 @@ const renderTableCell = (deps) => {
|
|
|
27472
27698
|
}
|
|
27473
27699
|
const cellBlocks = cell?.blocks ?? (cell?.paragraph ? [cell.paragraph] : []);
|
|
27474
27700
|
const blockMeasures = cellMeasure?.blocks ?? (cellMeasure?.paragraph ? [cellMeasure.paragraph] : []);
|
|
27701
|
+
try {
|
|
27702
|
+
console.log(
|
|
27703
|
+
"[DomPainter.renderTableCell] cell render input",
|
|
27704
|
+
JSON.stringify({
|
|
27705
|
+
cellId: cell?.id,
|
|
27706
|
+
blockKinds: cellBlocks.map((b) => b.kind),
|
|
27707
|
+
measureKinds: blockMeasures.map((m) => m.kind),
|
|
27708
|
+
width: cellMeasure?.width,
|
|
27709
|
+
height: cellMeasure?.height,
|
|
27710
|
+
rowHeight
|
|
27711
|
+
})
|
|
27712
|
+
);
|
|
27713
|
+
} catch {
|
|
27714
|
+
}
|
|
27475
27715
|
if (cellBlocks.length > 0 && blockMeasures.length > 0) {
|
|
27476
27716
|
const content = doc2.createElement("div");
|
|
27477
27717
|
content.style.position = "relative";
|
|
@@ -27503,9 +27743,106 @@ const renderTableCell = (deps) => {
|
|
|
27503
27743
|
for (let i = 0; i < Math.min(blockMeasures.length, cellBlocks.length); i++) {
|
|
27504
27744
|
const blockMeasure = blockMeasures[i];
|
|
27505
27745
|
const block = cellBlocks[i];
|
|
27746
|
+
if (blockMeasure.kind === "image" && block?.kind === "image") {
|
|
27747
|
+
console.log(
|
|
27748
|
+
"[DomPainter.renderTableCell] rendering image block in cell",
|
|
27749
|
+
JSON.stringify({
|
|
27750
|
+
cellId: cell?.id,
|
|
27751
|
+
blockId: block.id,
|
|
27752
|
+
width: blockMeasure.width,
|
|
27753
|
+
height: blockMeasure.height
|
|
27754
|
+
})
|
|
27755
|
+
);
|
|
27756
|
+
const imageWrapper = doc2.createElement("div");
|
|
27757
|
+
imageWrapper.style.position = "relative";
|
|
27758
|
+
imageWrapper.style.width = `${blockMeasure.width}px`;
|
|
27759
|
+
imageWrapper.style.height = `${blockMeasure.height}px`;
|
|
27760
|
+
imageWrapper.style.maxWidth = "100%";
|
|
27761
|
+
imageWrapper.style.boxSizing = "border-box";
|
|
27762
|
+
applySdtDataset(imageWrapper, block.attrs?.sdt);
|
|
27763
|
+
const imgEl = doc2.createElement("img");
|
|
27764
|
+
imgEl.classList.add("superdoc-table-image");
|
|
27765
|
+
if (block.src) {
|
|
27766
|
+
imgEl.src = block.src;
|
|
27767
|
+
}
|
|
27768
|
+
imgEl.alt = block.alt ?? "";
|
|
27769
|
+
imgEl.style.width = "100%";
|
|
27770
|
+
imgEl.style.height = "100%";
|
|
27771
|
+
imgEl.style.objectFit = block.objectFit ?? "contain";
|
|
27772
|
+
imgEl.style.display = "block";
|
|
27773
|
+
imageWrapper.appendChild(imgEl);
|
|
27774
|
+
content.appendChild(imageWrapper);
|
|
27775
|
+
continue;
|
|
27776
|
+
}
|
|
27777
|
+
if (blockMeasure.kind === "drawing" && block?.kind === "drawing") {
|
|
27778
|
+
console.log(
|
|
27779
|
+
"[DomPainter.renderTableCell] rendering drawing block in cell",
|
|
27780
|
+
JSON.stringify({
|
|
27781
|
+
cellId: cell?.id,
|
|
27782
|
+
blockId: block.id,
|
|
27783
|
+
drawingKind: block.drawingKind,
|
|
27784
|
+
width: blockMeasure.width,
|
|
27785
|
+
height: blockMeasure.height
|
|
27786
|
+
})
|
|
27787
|
+
);
|
|
27788
|
+
const drawingWrapper = doc2.createElement("div");
|
|
27789
|
+
drawingWrapper.style.position = "relative";
|
|
27790
|
+
drawingWrapper.style.width = `${blockMeasure.width}px`;
|
|
27791
|
+
drawingWrapper.style.height = `${blockMeasure.height}px`;
|
|
27792
|
+
drawingWrapper.style.maxWidth = "100%";
|
|
27793
|
+
drawingWrapper.style.boxSizing = "border-box";
|
|
27794
|
+
applySdtDataset(drawingWrapper, block.attrs);
|
|
27795
|
+
const drawingInner = doc2.createElement("div");
|
|
27796
|
+
drawingInner.classList.add("superdoc-table-drawing");
|
|
27797
|
+
drawingInner.style.width = "100%";
|
|
27798
|
+
drawingInner.style.height = "100%";
|
|
27799
|
+
drawingInner.style.display = "flex";
|
|
27800
|
+
drawingInner.style.alignItems = "center";
|
|
27801
|
+
drawingInner.style.justifyContent = "center";
|
|
27802
|
+
drawingInner.style.overflow = "hidden";
|
|
27803
|
+
if (block.drawingKind === "image" && "src" in block && block.src) {
|
|
27804
|
+
const img = doc2.createElement("img");
|
|
27805
|
+
img.classList.add("superdoc-drawing-image");
|
|
27806
|
+
img.src = block.src;
|
|
27807
|
+
img.alt = block.alt ?? "";
|
|
27808
|
+
img.style.width = "100%";
|
|
27809
|
+
img.style.height = "100%";
|
|
27810
|
+
img.style.objectFit = block.objectFit ?? "contain";
|
|
27811
|
+
drawingInner.appendChild(img);
|
|
27812
|
+
} else {
|
|
27813
|
+
const placeholder = doc2.createElement("div");
|
|
27814
|
+
placeholder.style.width = "100%";
|
|
27815
|
+
placeholder.style.height = "100%";
|
|
27816
|
+
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)";
|
|
27817
|
+
placeholder.style.border = "1px dashed rgba(15, 23, 42, 0.3)";
|
|
27818
|
+
drawingInner.appendChild(placeholder);
|
|
27819
|
+
}
|
|
27820
|
+
drawingWrapper.appendChild(drawingInner);
|
|
27821
|
+
content.appendChild(drawingWrapper);
|
|
27822
|
+
continue;
|
|
27823
|
+
}
|
|
27506
27824
|
if (blockMeasure.kind === "paragraph" && block?.kind === "paragraph") {
|
|
27507
|
-
|
|
27825
|
+
try {
|
|
27826
|
+
const runKinds = (block.runs ?? []).map((r2) => r2.kind ?? "text");
|
|
27827
|
+
const imageRuns = (block.runs ?? []).filter((r2) => r2.kind === "image").map((r2) => ({ src: r2.src }));
|
|
27828
|
+
console.log(
|
|
27829
|
+
"[DomPainter.renderTableCell] rendering paragraph block in cell",
|
|
27830
|
+
JSON.stringify({
|
|
27831
|
+
cellId: cell?.id,
|
|
27832
|
+
blockId: block.id,
|
|
27833
|
+
runKinds,
|
|
27834
|
+
imageRuns
|
|
27835
|
+
})
|
|
27836
|
+
);
|
|
27837
|
+
} catch {
|
|
27838
|
+
}
|
|
27839
|
+
const paragraphMeasure = blockMeasure;
|
|
27840
|
+
const lines = paragraphMeasure.lines;
|
|
27508
27841
|
const blockLineCount = lines?.length || 0;
|
|
27842
|
+
const wordLayout = block.attrs?.wordLayout ?? null;
|
|
27843
|
+
const markerLayout = wordLayout?.marker;
|
|
27844
|
+
const markerMeasure = paragraphMeasure.marker;
|
|
27845
|
+
const indentLeftPx = markerMeasure?.indentLeft ?? wordLayout?.indentLeftPx ?? (block.attrs?.indent && typeof block.attrs.indent.left === "number" ? block.attrs.indent.left : 0);
|
|
27509
27846
|
const blockStartGlobal = cumulativeLineCount;
|
|
27510
27847
|
const blockEndGlobal = cumulativeLineCount + blockLineCount;
|
|
27511
27848
|
if (blockEndGlobal <= globalFromLine) {
|
|
@@ -27527,7 +27864,38 @@ const renderTableCell = (deps) => {
|
|
|
27527
27864
|
for (let lineIdx = localStartLine; lineIdx < localEndLine && lineIdx < lines.length; lineIdx++) {
|
|
27528
27865
|
const line = lines[lineIdx];
|
|
27529
27866
|
const lineEl = renderLine(block, line, { ...context, section: "body" });
|
|
27530
|
-
|
|
27867
|
+
lineEl.style.paddingLeft = "";
|
|
27868
|
+
lineEl.style.paddingRight = "";
|
|
27869
|
+
lineEl.style.textIndent = "";
|
|
27870
|
+
const shouldRenderMarker = markerLayout && markerMeasure && lineIdx === 0 && localStartLine === 0 && markerMeasure.markerWidth > 0;
|
|
27871
|
+
if (shouldRenderMarker) {
|
|
27872
|
+
const lineContainer = renderListMarker({
|
|
27873
|
+
doc: doc2,
|
|
27874
|
+
lineEl,
|
|
27875
|
+
markerLayout,
|
|
27876
|
+
markerMeasure,
|
|
27877
|
+
indentLeftPx
|
|
27878
|
+
});
|
|
27879
|
+
paraWrapper.appendChild(lineContainer);
|
|
27880
|
+
} else {
|
|
27881
|
+
if (markerLayout && indentLeftPx) {
|
|
27882
|
+
lineEl.style.paddingLeft = `${indentLeftPx}px`;
|
|
27883
|
+
} else {
|
|
27884
|
+
const indent = block.attrs?.indent;
|
|
27885
|
+
if (indent) {
|
|
27886
|
+
if (typeof indent.left === "number" && indent.left > 0) {
|
|
27887
|
+
lineEl.style.paddingLeft = `${indent.left}px`;
|
|
27888
|
+
}
|
|
27889
|
+
if (typeof indent.right === "number" && indent.right > 0) {
|
|
27890
|
+
lineEl.style.paddingRight = `${indent.right}px`;
|
|
27891
|
+
}
|
|
27892
|
+
if (lineIdx === 0 && typeof indent.firstLine === "number" && indent.firstLine !== 0) {
|
|
27893
|
+
lineEl.style.textIndent = `${indent.firstLine}px`;
|
|
27894
|
+
}
|
|
27895
|
+
}
|
|
27896
|
+
}
|
|
27897
|
+
paraWrapper.appendChild(lineEl);
|
|
27898
|
+
}
|
|
27531
27899
|
renderedHeight += line.lineHeight;
|
|
27532
27900
|
}
|
|
27533
27901
|
const renderedEntireBlock = localStartLine === 0 && localEndLine >= blockLineCount;
|