oasis-editor 0.0.137 → 0.0.138
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/{OasisEditorApp-32ewgFUr.js → OasisEditorApp-DMI2ZfOd.js} +561 -115
- package/dist/app/controllers/animationFrame.d.ts +2 -0
- package/dist/app/controllers/tableResize/tableResizeDom.d.ts +3 -3
- package/dist/app/controllers/tableResize/tableResizeHitTest.d.ts +1 -1
- package/dist/app/controllers/tableResize/tableResizeTypes.d.ts +1 -0
- package/dist/app/controllers/useEditorTableCornerResize.d.ts +1 -0
- package/dist/app/controllers/useEditorTableDrag.d.ts +2 -0
- package/dist/assets/{importDocxWorker-B0cSSI12.js → importDocxWorker-DBjcGf-C.js} +1 -1
- package/dist/core/commands/table/tableCellStyleCommands.d.ts +3 -0
- package/dist/core/commands/table/tableRowCommands.d.ts +1 -0
- package/dist/core/editorState/defaultStyles.d.ts +1 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/nodes.d.ts +123 -5
- package/dist/export/docx/text/sdtXml.d.ts +10 -0
- package/dist/i18n/locales/en.d.ts +4 -0
- package/dist/i18n/locales/pt-BR.d.ts +4 -0
- package/dist/import/docx/contentControls.d.ts +9 -0
- package/dist/import/docx/tableProperties.d.ts +1 -14
- package/dist/{index-Djyuogou.js → index-M7h7REmM.js} +660 -444
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/OasisEditorEditorProps.d.ts +0 -1
- package/dist/ui/app/EditorWorkspace.d.ts +0 -1
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
- package/dist/ui/components/Toolbar/presets/defaultToolbar/buttonSpecs.d.ts +1 -0
- package/dist/ui/components/Toolbar/primitives/useSurfaceRect.d.ts +2 -2
- package/dist/ui/editorHistory.d.ts +2 -0
- package/dist/ui/shells/DocumentShell.d.ts +1 -2
- package/package.json +1 -1
- package/dist/ui/components/FloatingToolbar/FloatingTableToolbar.d.ts +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as
|
|
4
|
+
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as resolveEffectiveTableStyle, cP as createDefaultToolbarPreset, cQ as MenuRegistry, cR as createToolbarRegistry, cS as Editor, cT as resolveCommandRef, cU as commandRefName, cV as createOasisEditorClient, cW as createEditorZoom, cX as startLongTaskObserver, cY as installGlobalReport, cZ as applyStoredPreciseFontPreference, c_ as getWelcomeSeen, c$ as isLocalFontAccessSupported, d0 as EDITOR_SCROLL_PADDING_PX, d1 as Toolbar, d2 as OasisEditorLoading, d3 as I18nProvider, d4 as createTranslator, d5 as registerDomStatsSurface, d6 as createEditorLogger } from "./index-M7h7REmM.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -29513,8 +29513,12 @@ const DEFAULT_TABLE_BORDER = {
|
|
|
29513
29513
|
type: "solid",
|
|
29514
29514
|
color: "#000000"
|
|
29515
29515
|
};
|
|
29516
|
-
|
|
29517
|
-
|
|
29516
|
+
const NO_TABLE_BORDER = {
|
|
29517
|
+
width: 0,
|
|
29518
|
+
type: "none",
|
|
29519
|
+
color: "transparent"
|
|
29520
|
+
};
|
|
29521
|
+
function resolveTableBorderSelection(state) {
|
|
29518
29522
|
const activeSectionIndex = getActiveSectionIndex(state);
|
|
29519
29523
|
const anchorLoc = findParagraphTableLocation(
|
|
29520
29524
|
state.document,
|
|
@@ -29527,27 +29531,23 @@ function collectTableSelectedParagraphIds(state) {
|
|
|
29527
29531
|
activeSectionIndex
|
|
29528
29532
|
);
|
|
29529
29533
|
if (!anchorLoc || !focusLoc || anchorLoc.blockIndex !== focusLoc.blockIndex || anchorLoc.zone !== focusLoc.zone) {
|
|
29530
|
-
return
|
|
29534
|
+
return null;
|
|
29531
29535
|
}
|
|
29532
29536
|
const blocks = getBlocksForZone(
|
|
29533
29537
|
state.document,
|
|
29534
29538
|
activeSectionIndex,
|
|
29535
29539
|
anchorLoc.zone
|
|
29536
29540
|
);
|
|
29537
|
-
const
|
|
29538
|
-
if (!
|
|
29539
|
-
|
|
29540
|
-
|
|
29541
|
-
const tableLayout = buildTableCellLayout(tableBlock);
|
|
29542
|
-
const anchorCell = tableLayout.find(
|
|
29541
|
+
const table = blocks == null ? void 0 : blocks[anchorLoc.blockIndex];
|
|
29542
|
+
if (!table || table.type !== "table") return null;
|
|
29543
|
+
const entries = buildTableCellLayout(table);
|
|
29544
|
+
const anchorCell = entries.find(
|
|
29543
29545
|
(entry) => entry.rowIndex === anchorLoc.rowIndex && entry.cellIndex === anchorLoc.cellIndex
|
|
29544
29546
|
);
|
|
29545
|
-
const focusCell =
|
|
29547
|
+
const focusCell = entries.find(
|
|
29546
29548
|
(entry) => entry.rowIndex === focusLoc.rowIndex && entry.cellIndex === focusLoc.cellIndex
|
|
29547
29549
|
);
|
|
29548
|
-
if (!anchorCell || !focusCell)
|
|
29549
|
-
return selectedParagraphIds;
|
|
29550
|
-
}
|
|
29550
|
+
if (!anchorCell || !focusCell) return null;
|
|
29551
29551
|
const startRow = Math.min(
|
|
29552
29552
|
anchorCell.visualRowIndex,
|
|
29553
29553
|
focusCell.visualRowIndex
|
|
@@ -29564,10 +29564,16 @@ function collectTableSelectedParagraphIds(state) {
|
|
|
29564
29564
|
anchorCell.visualColumnIndex + anchorCell.colSpan - 1,
|
|
29565
29565
|
focusCell.visualColumnIndex + focusCell.colSpan - 1
|
|
29566
29566
|
);
|
|
29567
|
-
const
|
|
29567
|
+
const selectedEntries = entries.filter(
|
|
29568
29568
|
(entry) => entry.visualRowIndex <= endRow && entry.visualRowIndex + entry.rowSpan - 1 >= startRow && entry.visualColumnIndex <= endCol && entry.visualColumnIndex + entry.colSpan - 1 >= startCol
|
|
29569
29569
|
);
|
|
29570
|
-
|
|
29570
|
+
return { entries, selectedEntries, startRow, endRow, startCol, endCol };
|
|
29571
|
+
}
|
|
29572
|
+
function collectTableSelectedParagraphIds(state) {
|
|
29573
|
+
const selectedParagraphIds = /* @__PURE__ */ new Set();
|
|
29574
|
+
const selection = resolveTableBorderSelection(state);
|
|
29575
|
+
if (!selection) return selectedParagraphIds;
|
|
29576
|
+
for (const entry of selection.selectedEntries) {
|
|
29571
29577
|
for (const paragraph of entry.cell.blocks) {
|
|
29572
29578
|
selectedParagraphIds.add(paragraph.id);
|
|
29573
29579
|
}
|
|
@@ -29641,37 +29647,195 @@ function setTableCellBorders(state, border) {
|
|
|
29641
29647
|
return nextState;
|
|
29642
29648
|
}
|
|
29643
29649
|
function applyTableBorderPreset(state, preset, border = DEFAULT_TABLE_BORDER) {
|
|
29644
|
-
const
|
|
29645
|
-
|
|
29646
|
-
|
|
29647
|
-
|
|
29648
|
-
|
|
29649
|
-
|
|
29650
|
-
|
|
29651
|
-
|
|
29652
|
-
|
|
29653
|
-
|
|
29654
|
-
|
|
29650
|
+
const selection = resolveTableBorderSelection(state);
|
|
29651
|
+
if (!selection) return state;
|
|
29652
|
+
const patches = /* @__PURE__ */ new Map();
|
|
29653
|
+
const selectedIds = new Set(
|
|
29654
|
+
selection.selectedEntries.map((entry) => entry.cell.id)
|
|
29655
|
+
);
|
|
29656
|
+
const occupancy = /* @__PURE__ */ new Map();
|
|
29657
|
+
for (const entry of selection.entries) {
|
|
29658
|
+
for (let row = entry.visualRowIndex; row < entry.visualRowIndex + entry.rowSpan; row += 1) {
|
|
29659
|
+
for (let col = entry.visualColumnIndex; col < entry.visualColumnIndex + entry.colSpan; col += 1) {
|
|
29660
|
+
occupancy.set(`${row}:${col}`, entry);
|
|
29661
|
+
}
|
|
29662
|
+
}
|
|
29663
|
+
}
|
|
29664
|
+
const set = (entry, key, value = border) => {
|
|
29665
|
+
if (!entry) return;
|
|
29666
|
+
const patch = patches.get(entry.cell.id) ?? {};
|
|
29667
|
+
patch[key] = value;
|
|
29668
|
+
patches.set(entry.cell.id, patch);
|
|
29669
|
+
};
|
|
29670
|
+
const setPair = (first, firstKey, second, secondKey, value = border) => {
|
|
29671
|
+
set(first, firstKey, value);
|
|
29672
|
+
if (second && second.cell.id !== (first == null ? void 0 : first.cell.id))
|
|
29673
|
+
set(second, secondKey, value);
|
|
29674
|
+
};
|
|
29675
|
+
const applySide = (side, value = border) => {
|
|
29676
|
+
if (side === "top" || side === "bottom") {
|
|
29677
|
+
const row = side === "top" ? selection.startRow : selection.endRow;
|
|
29678
|
+
const outsideRow = row + (side === "top" ? -1 : 1);
|
|
29679
|
+
for (let col2 = selection.startCol; col2 <= selection.endCol; col2 += 1) {
|
|
29680
|
+
const owner = occupancy.get(`${row}:${col2}`);
|
|
29681
|
+
if (!owner || !selectedIds.has(owner.cell.id)) continue;
|
|
29682
|
+
setPair(
|
|
29683
|
+
owner,
|
|
29684
|
+
side === "top" ? "borderTop" : "borderBottom",
|
|
29685
|
+
occupancy.get(`${outsideRow}:${col2}`),
|
|
29686
|
+
side === "top" ? "borderBottom" : "borderTop",
|
|
29687
|
+
value
|
|
29688
|
+
);
|
|
29689
|
+
}
|
|
29690
|
+
return;
|
|
29691
|
+
}
|
|
29692
|
+
const col = side === "left" ? selection.startCol : selection.endCol;
|
|
29693
|
+
const outsideCol = col + (side === "left" ? -1 : 1);
|
|
29694
|
+
for (let row = selection.startRow; row <= selection.endRow; row += 1) {
|
|
29695
|
+
const owner = occupancy.get(`${row}:${col}`);
|
|
29696
|
+
if (!owner || !selectedIds.has(owner.cell.id)) continue;
|
|
29697
|
+
setPair(
|
|
29698
|
+
owner,
|
|
29699
|
+
side === "left" ? "borderLeft" : "borderRight",
|
|
29700
|
+
occupancy.get(`${row}:${outsideCol}`),
|
|
29701
|
+
side === "left" ? "borderRight" : "borderLeft",
|
|
29702
|
+
value
|
|
29655
29703
|
);
|
|
29656
|
-
|
|
29657
|
-
|
|
29704
|
+
}
|
|
29705
|
+
};
|
|
29706
|
+
const applyInsideHorizontal = () => {
|
|
29707
|
+
for (let row = selection.startRow + 1; row <= selection.endRow; row += 1) {
|
|
29708
|
+
for (let col = selection.startCol; col <= selection.endCol; col += 1) {
|
|
29709
|
+
const above = occupancy.get(`${row - 1}:${col}`);
|
|
29710
|
+
const below = occupancy.get(`${row}:${col}`);
|
|
29711
|
+
if (above && below && above.cell.id !== below.cell.id && selectedIds.has(above.cell.id) && selectedIds.has(below.cell.id)) {
|
|
29712
|
+
setPair(above, "borderBottom", below, "borderTop");
|
|
29713
|
+
}
|
|
29714
|
+
}
|
|
29715
|
+
}
|
|
29716
|
+
};
|
|
29717
|
+
const applyInsideVertical = () => {
|
|
29718
|
+
for (let col = selection.startCol + 1; col <= selection.endCol; col += 1) {
|
|
29719
|
+
for (let row = selection.startRow; row <= selection.endRow; row += 1) {
|
|
29720
|
+
const left = occupancy.get(`${row}:${col - 1}`);
|
|
29721
|
+
const right = occupancy.get(`${row}:${col}`);
|
|
29722
|
+
if (left && right && left.cell.id !== right.cell.id && selectedIds.has(left.cell.id) && selectedIds.has(right.cell.id)) {
|
|
29723
|
+
setPair(left, "borderRight", right, "borderLeft");
|
|
29724
|
+
}
|
|
29725
|
+
}
|
|
29726
|
+
}
|
|
29727
|
+
};
|
|
29728
|
+
switch (preset) {
|
|
29729
|
+
case "none": {
|
|
29730
|
+
for (const entry of selection.selectedEntries) {
|
|
29731
|
+
for (const key of [
|
|
29732
|
+
"borderTop",
|
|
29733
|
+
"borderRight",
|
|
29734
|
+
"borderBottom",
|
|
29735
|
+
"borderLeft",
|
|
29736
|
+
"borderStart",
|
|
29737
|
+
"borderEnd",
|
|
29738
|
+
"borderTopLeftToBottomRight",
|
|
29739
|
+
"borderTopRightToBottomLeft"
|
|
29740
|
+
])
|
|
29741
|
+
set(entry, key, NO_TABLE_BORDER);
|
|
29742
|
+
}
|
|
29743
|
+
applySide("top", NO_TABLE_BORDER);
|
|
29744
|
+
applySide("right", NO_TABLE_BORDER);
|
|
29745
|
+
applySide("bottom", NO_TABLE_BORDER);
|
|
29746
|
+
applySide("left", NO_TABLE_BORDER);
|
|
29747
|
+
break;
|
|
29748
|
+
}
|
|
29658
29749
|
case "top":
|
|
29659
|
-
|
|
29660
|
-
|
|
29661
|
-
return apply(state, ["borderLeft"], border);
|
|
29750
|
+
applySide("top");
|
|
29751
|
+
break;
|
|
29662
29752
|
case "right":
|
|
29663
|
-
|
|
29664
|
-
|
|
29665
|
-
|
|
29666
|
-
|
|
29667
|
-
|
|
29668
|
-
case "
|
|
29753
|
+
applySide("right");
|
|
29754
|
+
break;
|
|
29755
|
+
case "bottom":
|
|
29756
|
+
applySide("bottom");
|
|
29757
|
+
break;
|
|
29758
|
+
case "left":
|
|
29759
|
+
applySide("left");
|
|
29760
|
+
break;
|
|
29669
29761
|
case "outside":
|
|
29670
|
-
|
|
29762
|
+
applySide("top");
|
|
29763
|
+
applySide("right");
|
|
29764
|
+
applySide("bottom");
|
|
29765
|
+
applySide("left");
|
|
29766
|
+
break;
|
|
29671
29767
|
case "insideHorizontal":
|
|
29768
|
+
applyInsideHorizontal();
|
|
29769
|
+
break;
|
|
29672
29770
|
case "insideVertical":
|
|
29673
|
-
|
|
29771
|
+
applyInsideVertical();
|
|
29772
|
+
break;
|
|
29773
|
+
case "inside":
|
|
29774
|
+
applyInsideHorizontal();
|
|
29775
|
+
applyInsideVertical();
|
|
29776
|
+
break;
|
|
29777
|
+
case "all":
|
|
29778
|
+
applySide("top");
|
|
29779
|
+
applySide("right");
|
|
29780
|
+
applySide("bottom");
|
|
29781
|
+
applySide("left");
|
|
29782
|
+
applyInsideHorizontal();
|
|
29783
|
+
applyInsideVertical();
|
|
29784
|
+
break;
|
|
29785
|
+
case "diagonalDown":
|
|
29786
|
+
for (const entry of selection.selectedEntries)
|
|
29787
|
+
set(entry, "borderTopLeftToBottomRight");
|
|
29788
|
+
break;
|
|
29789
|
+
case "diagonalUp":
|
|
29790
|
+
for (const entry of selection.selectedEntries)
|
|
29791
|
+
set(entry, "borderTopRightToBottomLeft");
|
|
29792
|
+
break;
|
|
29674
29793
|
}
|
|
29794
|
+
if (patches.size === 0) return state;
|
|
29795
|
+
const touchedParagraphIds = /* @__PURE__ */ new Set();
|
|
29796
|
+
for (const entry of selection.entries) {
|
|
29797
|
+
if (!patches.has(entry.cell.id)) continue;
|
|
29798
|
+
for (const paragraph of entry.cell.blocks)
|
|
29799
|
+
touchedParagraphIds.add(paragraph.id);
|
|
29800
|
+
}
|
|
29801
|
+
const updateCell = (cell) => {
|
|
29802
|
+
const patch = patches.get(cell.id);
|
|
29803
|
+
if (!patch) return cell;
|
|
29804
|
+
let style2 = cell.style;
|
|
29805
|
+
if (state.trackChangesEnabled && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
29806
|
+
style2 = {
|
|
29807
|
+
...style2 ?? {},
|
|
29808
|
+
propertyRevision: {
|
|
29809
|
+
...createTableRevisionMetadata(),
|
|
29810
|
+
type: "property",
|
|
29811
|
+
previous: { ...style2 ?? {} }
|
|
29812
|
+
}
|
|
29813
|
+
};
|
|
29814
|
+
}
|
|
29815
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
29816
|
+
style2 = patchStyleValue(style2, key, value);
|
|
29817
|
+
}
|
|
29818
|
+
return { ...cell, style: style2 };
|
|
29819
|
+
};
|
|
29820
|
+
const nextSections = getDocumentSections(state.document).map((section) => ({
|
|
29821
|
+
...section,
|
|
29822
|
+
blocks: updateTableCellsInBlocks(
|
|
29823
|
+
section.blocks,
|
|
29824
|
+
touchedParagraphIds,
|
|
29825
|
+
updateCell
|
|
29826
|
+
),
|
|
29827
|
+
header: section.header ? updateTableCellsInBlocks(
|
|
29828
|
+
section.header,
|
|
29829
|
+
touchedParagraphIds,
|
|
29830
|
+
updateCell
|
|
29831
|
+
) : void 0,
|
|
29832
|
+
footer: section.footer ? updateTableCellsInBlocks(
|
|
29833
|
+
section.footer,
|
|
29834
|
+
touchedParagraphIds,
|
|
29835
|
+
updateCell
|
|
29836
|
+
) : void 0
|
|
29837
|
+
}));
|
|
29838
|
+
return { ...state, document: { ...state.document, sections: nextSections } };
|
|
29675
29839
|
}
|
|
29676
29840
|
function collectLinearSelectedParagraphIds(state) {
|
|
29677
29841
|
const normalized = normalizeSelection(state);
|
|
@@ -29795,11 +29959,14 @@ function setSelectedTableRowHeader(state, value) {
|
|
|
29795
29959
|
return updateActiveTableBlocks(state, updateTable);
|
|
29796
29960
|
}
|
|
29797
29961
|
function setTableRowHeight(state, tableId, rowIndex, height) {
|
|
29962
|
+
return setTableRowHeights(state, tableId, { [rowIndex]: height });
|
|
29963
|
+
}
|
|
29964
|
+
function setTableRowHeights(state, tableId, rowHeights) {
|
|
29798
29965
|
const updateTable = (table) => {
|
|
29799
29966
|
if (table.id !== tableId) return table;
|
|
29800
|
-
const nextRows =
|
|
29801
|
-
|
|
29802
|
-
|
|
29967
|
+
const nextRows = table.rows.map((row, rowIndex) => {
|
|
29968
|
+
if (!Object.prototype.hasOwnProperty.call(rowHeights, rowIndex))
|
|
29969
|
+
return row;
|
|
29803
29970
|
let style2 = row.style;
|
|
29804
29971
|
if (state.trackChangesEnabled && !(style2 == null ? void 0 : style2.propertyRevision)) {
|
|
29805
29972
|
style2 = {
|
|
@@ -29811,11 +29978,11 @@ function setTableRowHeight(state, tableId, rowIndex, height) {
|
|
|
29811
29978
|
}
|
|
29812
29979
|
};
|
|
29813
29980
|
}
|
|
29814
|
-
|
|
29981
|
+
return {
|
|
29815
29982
|
...row,
|
|
29816
|
-
style: patchStyleValue(style2, "height",
|
|
29983
|
+
style: patchStyleValue(style2, "height", rowHeights[rowIndex])
|
|
29817
29984
|
};
|
|
29818
|
-
}
|
|
29985
|
+
});
|
|
29819
29986
|
return { ...table, rows: nextRows };
|
|
29820
29987
|
};
|
|
29821
29988
|
return updateStateSections(
|
|
@@ -29878,6 +30045,12 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
29878
30045
|
var _a;
|
|
29879
30046
|
if (table.id !== tableId) return table;
|
|
29880
30047
|
const tableLayout = buildTableCellLayout(table);
|
|
30048
|
+
const layoutByRowAndCell = new Map(
|
|
30049
|
+
tableLayout.map((entry) => [
|
|
30050
|
+
`${entry.rowIndex}:${entry.cellIndex}`,
|
|
30051
|
+
entry
|
|
30052
|
+
])
|
|
30053
|
+
);
|
|
29881
30054
|
const visualColumnCount = Math.max(
|
|
29882
30055
|
1,
|
|
29883
30056
|
...tableLayout.map(
|
|
@@ -29906,9 +30079,7 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
29906
30079
|
const nextCells = row.cells.map(
|
|
29907
30080
|
(cell, cellIndex) => {
|
|
29908
30081
|
var _a2, _b;
|
|
29909
|
-
const entry =
|
|
29910
|
-
(item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
|
|
29911
|
-
);
|
|
30082
|
+
const entry = layoutByRowAndCell.get(`${rowIndex}:${cellIndex}`);
|
|
29912
30083
|
if (!entry) return cell;
|
|
29913
30084
|
const rightVisualColumnIndex = entry.visualColumnIndex + entry.colSpan - 1;
|
|
29914
30085
|
const newWidth = columnWidths[rightVisualColumnIndex];
|
|
@@ -36113,9 +36284,6 @@ function EditorWorkspace(props) {
|
|
|
36113
36284
|
get viewportHeight() {
|
|
36114
36285
|
return view2.viewportHeight;
|
|
36115
36286
|
},
|
|
36116
|
-
get showFloatingTableToolbar() {
|
|
36117
|
-
return runtime.showFloatingTableToolbar;
|
|
36118
|
-
},
|
|
36119
36287
|
get layout() {
|
|
36120
36288
|
return view2.layout;
|
|
36121
36289
|
},
|
|
@@ -36171,8 +36339,7 @@ function EditorWorkspace(props) {
|
|
|
36171
36339
|
return {
|
|
36172
36340
|
...props.view.overlays,
|
|
36173
36341
|
toolbarHost: props.runtime.toolbarHost,
|
|
36174
|
-
persistenceStatus: props.runtime.persistenceStatus
|
|
36175
|
-
showFloatingTableToolbar: props.runtime.showFloatingTableToolbar
|
|
36342
|
+
persistenceStatus: props.runtime.persistenceStatus
|
|
36176
36343
|
};
|
|
36177
36344
|
},
|
|
36178
36345
|
get refs() {
|
|
@@ -37943,6 +38110,142 @@ function serializeRunWithRelationships(run, context, paragraphStyleId, styles, s
|
|
|
37943
38110
|
}
|
|
37944
38111
|
return wrapRunWithHyperlink(runXml, href, context);
|
|
37945
38112
|
}
|
|
38113
|
+
function serializeSdtPrXml(sdtPr) {
|
|
38114
|
+
const hasAnyField = sdtPr.alias !== void 0 || sdtPr.tag !== void 0 || sdtPr.id !== void 0 || sdtPr.lock !== void 0 || sdtPr.appearance !== void 0 || sdtPr.showingPlcHdr !== void 0 || sdtPr.temporary !== void 0 || sdtPr.color !== void 0 || sdtPr.placeholderDocPart !== void 0 || sdtPr.dataBinding !== void 0 || sdtPr.subtype !== void 0 || (sdtPr.unknownXml ?? "").length > 0;
|
|
38115
|
+
if (!hasAnyField) {
|
|
38116
|
+
return "<w:sdtPr/>";
|
|
38117
|
+
}
|
|
38118
|
+
let inner = "";
|
|
38119
|
+
if (sdtPr.alias !== void 0) {
|
|
38120
|
+
inner += `<w:alias w:val="${escapeXml(sdtPr.alias)}"/>`;
|
|
38121
|
+
}
|
|
38122
|
+
if (sdtPr.tag !== void 0) {
|
|
38123
|
+
inner += `<w:tag w:val="${escapeXml(sdtPr.tag)}"/>`;
|
|
38124
|
+
}
|
|
38125
|
+
if (sdtPr.id !== void 0) {
|
|
38126
|
+
inner += `<w:id w:val="${escapeXml(sdtPr.id)}"/>`;
|
|
38127
|
+
}
|
|
38128
|
+
if (sdtPr.lock !== void 0) {
|
|
38129
|
+
inner += `<w:lock w:val="${escapeXml(sdtPr.lock)}"/>`;
|
|
38130
|
+
}
|
|
38131
|
+
if (sdtPr.placeholderDocPart !== void 0) {
|
|
38132
|
+
inner += `<w:placeholder><w:docPart w:val="${escapeXml(
|
|
38133
|
+
sdtPr.placeholderDocPart
|
|
38134
|
+
)}"/></w:placeholder>`;
|
|
38135
|
+
}
|
|
38136
|
+
if (sdtPr.dataBinding !== void 0) {
|
|
38137
|
+
inner += serializeSdtDataBindingXml(sdtPr.dataBinding);
|
|
38138
|
+
}
|
|
38139
|
+
if (sdtPr.temporary !== void 0) {
|
|
38140
|
+
inner += `<w:temporary w:val="${sdtPr.temporary ? "true" : "false"}"/>`;
|
|
38141
|
+
}
|
|
38142
|
+
if (sdtPr.subtype !== void 0) {
|
|
38143
|
+
inner += serializeSdtSubtypeXml(sdtPr.subtype);
|
|
38144
|
+
}
|
|
38145
|
+
if (sdtPr.appearance !== void 0) {
|
|
38146
|
+
inner += `<w:appearance w:val="${escapeXml(sdtPr.appearance)}"/>`;
|
|
38147
|
+
}
|
|
38148
|
+
if (sdtPr.showingPlcHdr !== void 0) {
|
|
38149
|
+
inner += `<w:showingPlcHdr w:val="${sdtPr.showingPlcHdr ? "true" : "false"}"/>`;
|
|
38150
|
+
}
|
|
38151
|
+
if (sdtPr.color !== void 0) {
|
|
38152
|
+
inner += `<w:color w:val="${escapeXml(sdtPr.color)}"/>`;
|
|
38153
|
+
}
|
|
38154
|
+
if (sdtPr.unknownXml) {
|
|
38155
|
+
inner += sdtPr.unknownXml;
|
|
38156
|
+
}
|
|
38157
|
+
return `<w:sdtPr>${inner}</w:sdtPr>`;
|
|
38158
|
+
}
|
|
38159
|
+
function serializeSdtDataBindingXml(dataBinding) {
|
|
38160
|
+
let inner = "";
|
|
38161
|
+
if (dataBinding.prefixMappings !== void 0) {
|
|
38162
|
+
inner += `<w:prefixMappings w:val="${escapeXml(
|
|
38163
|
+
dataBinding.prefixMappings
|
|
38164
|
+
)}"/>`;
|
|
38165
|
+
}
|
|
38166
|
+
if (dataBinding.xpath !== void 0) {
|
|
38167
|
+
inner += `<w:xpath w:val="${escapeXml(dataBinding.xpath)}"/>`;
|
|
38168
|
+
}
|
|
38169
|
+
if (dataBinding.storeItemID !== void 0) {
|
|
38170
|
+
inner += `<w:storeItemID w:val="${escapeXml(dataBinding.storeItemID)}"/>`;
|
|
38171
|
+
}
|
|
38172
|
+
return inner ? `<w:dataBinding>${inner}</w:dataBinding>` : "";
|
|
38173
|
+
}
|
|
38174
|
+
function serializeSdtListItemXml(item) {
|
|
38175
|
+
const displayTextAttr = item.displayText !== void 0 ? ` w:displayText="${escapeXml(item.displayText)}"` : "";
|
|
38176
|
+
const valueAttr = item.value !== void 0 ? ` w:value="${escapeXml(item.value)}"` : "";
|
|
38177
|
+
return `<w:listItem${displayTextAttr}${valueAttr}/>`;
|
|
38178
|
+
}
|
|
38179
|
+
function serializeSdtSubtypeXml(subtype) {
|
|
38180
|
+
switch (subtype.kind) {
|
|
38181
|
+
case "text":
|
|
38182
|
+
return "<w:text/>";
|
|
38183
|
+
case "richText":
|
|
38184
|
+
return "<w:richText/>";
|
|
38185
|
+
case "picture":
|
|
38186
|
+
return "<w:picture/>";
|
|
38187
|
+
case "group":
|
|
38188
|
+
return "<w:group/>";
|
|
38189
|
+
case "equation":
|
|
38190
|
+
return "<w:equation/>";
|
|
38191
|
+
case "citation":
|
|
38192
|
+
return "<w:citation/>";
|
|
38193
|
+
case "bibliography":
|
|
38194
|
+
return "<w:bibliography/>";
|
|
38195
|
+
case "repeatingSection":
|
|
38196
|
+
return "<w:repeatingSection/>";
|
|
38197
|
+
case "repeatingSectionItem":
|
|
38198
|
+
return "<w:repeatingSectionItem/>";
|
|
38199
|
+
case "comboBox":
|
|
38200
|
+
case "dropDownList": {
|
|
38201
|
+
const items = (subtype.listItems ?? []).map(serializeSdtListItemXml).join("");
|
|
38202
|
+
const lastSelected = subtype.lastSelectedValue !== void 0 ? `<w:lastSelectedValue w:val="${escapeXml(
|
|
38203
|
+
subtype.lastSelectedValue
|
|
38204
|
+
)}"/>` : "";
|
|
38205
|
+
return `<w:${subtype.kind}>${items}${lastSelected}</w:${subtype.kind}>`;
|
|
38206
|
+
}
|
|
38207
|
+
case "date": {
|
|
38208
|
+
const fullDateAttr = subtype.fullDate !== void 0 ? ` w:fullDate="${escapeXml(subtype.fullDate)}"` : "";
|
|
38209
|
+
let children = "";
|
|
38210
|
+
if (subtype.dateFormat !== void 0) {
|
|
38211
|
+
children += `<w:dateFormat w:val="${escapeXml(subtype.dateFormat)}"/>`;
|
|
38212
|
+
}
|
|
38213
|
+
if (subtype.lid !== void 0) {
|
|
38214
|
+
children += `<w:lid w:val="${escapeXml(subtype.lid)}"/>`;
|
|
38215
|
+
}
|
|
38216
|
+
if (subtype.calendar !== void 0) {
|
|
38217
|
+
children += `<w:calendar w:val="${escapeXml(subtype.calendar)}"/>`;
|
|
38218
|
+
}
|
|
38219
|
+
if (subtype.storeMappedDataAs !== void 0) {
|
|
38220
|
+
children += `<w:storeMappedDataAs w:val="${escapeXml(
|
|
38221
|
+
subtype.storeMappedDataAs
|
|
38222
|
+
)}"/>`;
|
|
38223
|
+
}
|
|
38224
|
+
return `<w:date${fullDateAttr}>${children}</w:date>`;
|
|
38225
|
+
}
|
|
38226
|
+
case "checkbox": {
|
|
38227
|
+
let children = "";
|
|
38228
|
+
if (subtype.checked !== void 0) {
|
|
38229
|
+
children += `<w14:checked w14:val="${subtype.checked ? "1" : "0"}"/>`;
|
|
38230
|
+
}
|
|
38231
|
+
if (subtype.checkedStateFont !== void 0 || subtype.checkedStateChar !== void 0) {
|
|
38232
|
+
const fontAttr = subtype.checkedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.checkedStateFont)}"` : "";
|
|
38233
|
+
const charAttr = subtype.checkedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.checkedStateChar)}"` : "";
|
|
38234
|
+
children += `<w14:checkedState${fontAttr}${charAttr}/>`;
|
|
38235
|
+
}
|
|
38236
|
+
if (subtype.uncheckedStateFont !== void 0 || subtype.uncheckedStateChar !== void 0) {
|
|
38237
|
+
const fontAttr = subtype.uncheckedStateFont !== void 0 ? ` w14:font="${escapeXml(subtype.uncheckedStateFont)}"` : "";
|
|
38238
|
+
const charAttr = subtype.uncheckedStateChar !== void 0 ? ` w14:char="${escapeXml(subtype.uncheckedStateChar)}"` : "";
|
|
38239
|
+
children += `<w14:uncheckedState${fontAttr}${charAttr}/>`;
|
|
38240
|
+
}
|
|
38241
|
+
return `<w14:checkbox>${children}</w14:checkbox>`;
|
|
38242
|
+
}
|
|
38243
|
+
default: {
|
|
38244
|
+
const _exhaustive = subtype;
|
|
38245
|
+
return _exhaustive;
|
|
38246
|
+
}
|
|
38247
|
+
}
|
|
38248
|
+
}
|
|
37946
38249
|
function serializeDropCapFrameParagraph(dropCap) {
|
|
37947
38250
|
const runProps = serializeRunProperties(dropCap.style);
|
|
37948
38251
|
const framePr = `<w:framePr w:dropCap="${dropCap.type}" w:lines="${dropCap.lines}" w:wrap="around" w:vAnchor="text" w:hAnchor="text"/>`;
|
|
@@ -38059,7 +38362,7 @@ function serializeBlocksXml(blocks, context, styles) {
|
|
|
38059
38362
|
j += 1;
|
|
38060
38363
|
}
|
|
38061
38364
|
const inner = serializeBlocksXml(group, context, styles);
|
|
38062
|
-
out += `<w:sdt>${wrapper.
|
|
38365
|
+
out += `<w:sdt>${serializeSdtPrXml(wrapper.sdtPr)}${wrapper.sdtEndPrXml ?? ""}<w:sdtContent>${inner}</w:sdtContent></w:sdt>`;
|
|
38063
38366
|
i = j;
|
|
38064
38367
|
}
|
|
38065
38368
|
return out;
|
|
@@ -45213,6 +45516,12 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45213
45516
|
});
|
|
45214
45517
|
return { status };
|
|
45215
45518
|
}
|
|
45519
|
+
const MAX_EDITOR_HISTORY_ENTRIES = 250;
|
|
45520
|
+
function appendEditorHistoryEntry(stack, state) {
|
|
45521
|
+
const retained = Math.max(0, MAX_EDITOR_HISTORY_ENTRIES - 1);
|
|
45522
|
+
const start = Math.max(0, stack.length - retained);
|
|
45523
|
+
return [...stack.slice(start), state];
|
|
45524
|
+
}
|
|
45216
45525
|
function createEmptyEditorHistoryState() {
|
|
45217
45526
|
return {
|
|
45218
45527
|
undoStack: [],
|
|
@@ -45224,7 +45533,7 @@ function applyEditorHistoryTransaction(history, previous, next, options, now = D
|
|
|
45224
45533
|
var _a;
|
|
45225
45534
|
const canMerge = (options == null ? void 0 : options.mergeKey) !== void 0 && ((_a = history.lastTransactionMeta) == null ? void 0 : _a.mergeKey) === options.mergeKey && now - history.lastTransactionMeta.timestamp < 1e3;
|
|
45226
45535
|
return {
|
|
45227
|
-
undoStack: canMerge ? history.undoStack :
|
|
45536
|
+
undoStack: canMerge ? history.undoStack : appendEditorHistoryEntry(history.undoStack, previous),
|
|
45228
45537
|
redoStack: [],
|
|
45229
45538
|
lastTransactionMeta: (options == null ? void 0 : options.mergeKey) ? { mergeKey: options.mergeKey, timestamp: now } : null
|
|
45230
45539
|
};
|
|
@@ -45242,7 +45551,7 @@ function takeEditorUndoStep(history, current) {
|
|
|
45242
45551
|
return {
|
|
45243
45552
|
history: {
|
|
45244
45553
|
undoStack: history.undoStack.slice(0, -1),
|
|
45245
|
-
redoStack:
|
|
45554
|
+
redoStack: appendEditorHistoryEntry(history.redoStack, current),
|
|
45246
45555
|
lastTransactionMeta: null
|
|
45247
45556
|
},
|
|
45248
45557
|
nextState: history.undoStack[history.undoStack.length - 1]
|
|
@@ -45254,7 +45563,7 @@ function takeEditorRedoStep(history, current) {
|
|
|
45254
45563
|
}
|
|
45255
45564
|
return {
|
|
45256
45565
|
history: {
|
|
45257
|
-
undoStack:
|
|
45566
|
+
undoStack: appendEditorHistoryEntry(history.undoStack, current),
|
|
45258
45567
|
redoStack: history.redoStack.slice(0, -1),
|
|
45259
45568
|
lastTransactionMeta: null
|
|
45260
45569
|
},
|
|
@@ -47437,7 +47746,10 @@ function createResizeSession(adapter, deps) {
|
|
|
47437
47746
|
if (resize) {
|
|
47438
47747
|
deps.updateHistoryState((current) => ({
|
|
47439
47748
|
...current,
|
|
47440
|
-
undoStack:
|
|
47749
|
+
undoStack: appendEditorHistoryEntry(
|
|
47750
|
+
current.undoStack,
|
|
47751
|
+
deps.cloneState(resize.initialState)
|
|
47752
|
+
),
|
|
47441
47753
|
redoStack: []
|
|
47442
47754
|
}));
|
|
47443
47755
|
}
|
|
@@ -47533,7 +47845,10 @@ function createRotateSession(adapter, deps) {
|
|
|
47533
47845
|
if (rotate) {
|
|
47534
47846
|
deps.updateHistoryState((current) => ({
|
|
47535
47847
|
...current,
|
|
47536
|
-
undoStack:
|
|
47848
|
+
undoStack: appendEditorHistoryEntry(
|
|
47849
|
+
current.undoStack,
|
|
47850
|
+
deps.cloneState(rotate.initialState)
|
|
47851
|
+
),
|
|
47537
47852
|
redoStack: []
|
|
47538
47853
|
}));
|
|
47539
47854
|
}
|
|
@@ -47663,7 +47978,10 @@ function createCropSession(deps) {
|
|
|
47663
47978
|
if (crop) {
|
|
47664
47979
|
deps.updateHistoryState((current) => ({
|
|
47665
47980
|
...current,
|
|
47666
|
-
undoStack:
|
|
47981
|
+
undoStack: appendEditorHistoryEntry(
|
|
47982
|
+
current.undoStack,
|
|
47983
|
+
deps.cloneState(crop.initialState)
|
|
47984
|
+
),
|
|
47667
47985
|
redoStack: []
|
|
47668
47986
|
}));
|
|
47669
47987
|
}
|
|
@@ -49065,6 +49383,7 @@ function createEditorClipboardControllerImpl(deps) {
|
|
|
49065
49383
|
handleDrop
|
|
49066
49384
|
};
|
|
49067
49385
|
}
|
|
49386
|
+
const geometryCache = /* @__PURE__ */ new WeakMap();
|
|
49068
49387
|
function getAllBlocks(state) {
|
|
49069
49388
|
return getDocumentSectionsCanonical(state.document).flatMap(
|
|
49070
49389
|
(section) => [
|
|
@@ -49090,6 +49409,10 @@ function buildTableGeometries(surface, state, documentLayout, canvasSnapshotProv
|
|
|
49090
49409
|
if (!snapshot) {
|
|
49091
49410
|
return [];
|
|
49092
49411
|
}
|
|
49412
|
+
const cached = geometryCache.get(snapshot);
|
|
49413
|
+
if (cached) {
|
|
49414
|
+
return cached;
|
|
49415
|
+
}
|
|
49093
49416
|
const byTable = /* @__PURE__ */ new Map();
|
|
49094
49417
|
const contentBoundsByCell = /* @__PURE__ */ new Map();
|
|
49095
49418
|
for (const paragraph of snapshot.paragraphs) {
|
|
@@ -49177,6 +49500,7 @@ function buildTableGeometries(surface, state, documentLayout, canvasSnapshotProv
|
|
|
49177
49500
|
}
|
|
49178
49501
|
});
|
|
49179
49502
|
}
|
|
49503
|
+
geometryCache.set(snapshot, result);
|
|
49180
49504
|
return result;
|
|
49181
49505
|
}
|
|
49182
49506
|
const EDGE_THRESHOLD_COLUMN_PX = 4;
|
|
@@ -49194,6 +49518,9 @@ function findTableResizeHoverInfo(event, surface, state, documentLayout, canvasS
|
|
|
49194
49518
|
}
|
|
49195
49519
|
let best = null;
|
|
49196
49520
|
for (const geometry of geometries) {
|
|
49521
|
+
if (event.clientX < geometry.bounds.left - EDGE_THRESHOLD_COLUMN_PX || event.clientX > geometry.bounds.right + EDGE_THRESHOLD_COLUMN_PX || event.clientY < geometry.bounds.top - EDGE_THRESHOLD_ROW_PX || event.clientY > geometry.bounds.bottom + EDGE_THRESHOLD_ROW_PX) {
|
|
49522
|
+
continue;
|
|
49523
|
+
}
|
|
49197
49524
|
for (const cell of geometry.cells) {
|
|
49198
49525
|
const verticallyAligned = event.clientY >= cell.top - EDGE_THRESHOLD_COLUMN_PX && event.clientY <= cell.bottom + EDGE_THRESHOLD_COLUMN_PX;
|
|
49199
49526
|
const horizontallyAligned = event.clientX >= cell.left - EDGE_THRESHOLD_ROW_PX && event.clientX <= cell.right + EDGE_THRESHOLD_ROW_PX;
|
|
@@ -49507,7 +49834,9 @@ function getGuideBounds(viewportRef) {
|
|
|
49507
49834
|
height: Math.max(0, rect.height)
|
|
49508
49835
|
};
|
|
49509
49836
|
}
|
|
49510
|
-
|
|
49837
|
+
let resizeCursorOwner = null;
|
|
49838
|
+
function setResizeCursorClass(isCol, owner) {
|
|
49839
|
+
resizeCursorOwner = owner;
|
|
49511
49840
|
if (isCol) {
|
|
49512
49841
|
document.body.classList.add("oasis-editor-hover-col-resize");
|
|
49513
49842
|
document.body.classList.remove("oasis-editor-hover-row-resize");
|
|
@@ -49516,32 +49845,52 @@ function setResizeCursorClass(isCol) {
|
|
|
49516
49845
|
document.body.classList.remove("oasis-editor-hover-col-resize");
|
|
49517
49846
|
}
|
|
49518
49847
|
}
|
|
49519
|
-
function clearResizeCursorClasses() {
|
|
49848
|
+
function clearResizeCursorClasses(owner) {
|
|
49849
|
+
if (owner && resizeCursorOwner !== owner) return;
|
|
49850
|
+
resizeCursorOwner = null;
|
|
49520
49851
|
document.body.classList.remove("oasis-editor-hover-col-resize");
|
|
49521
49852
|
document.body.classList.remove("oasis-editor-hover-row-resize");
|
|
49522
49853
|
}
|
|
49523
|
-
function setHoverCursorClass(isCol) {
|
|
49524
|
-
setResizeCursorClass(isCol);
|
|
49854
|
+
function setHoverCursorClass(isCol, owner) {
|
|
49855
|
+
setResizeCursorClass(isCol, owner);
|
|
49525
49856
|
}
|
|
49526
|
-
function setActiveCursorClass(isCol) {
|
|
49527
|
-
setResizeCursorClass(isCol);
|
|
49857
|
+
function setActiveCursorClass(isCol, owner) {
|
|
49858
|
+
setResizeCursorClass(isCol, owner);
|
|
49859
|
+
}
|
|
49860
|
+
function scheduleAnimationFrame(callback) {
|
|
49861
|
+
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
|
|
49862
|
+
return window.requestAnimationFrame(callback);
|
|
49863
|
+
}
|
|
49864
|
+
return globalThis.setTimeout(callback, 16);
|
|
49865
|
+
}
|
|
49866
|
+
function cancelScheduledAnimationFrame(handle) {
|
|
49867
|
+
if (typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function") {
|
|
49868
|
+
window.cancelAnimationFrame(handle);
|
|
49869
|
+
return;
|
|
49870
|
+
}
|
|
49871
|
+
globalThis.clearTimeout(handle);
|
|
49528
49872
|
}
|
|
49529
49873
|
const DRAG_THRESHOLD_PX$1 = 2;
|
|
49530
49874
|
function createEditorTableResize(deps) {
|
|
49531
49875
|
const [resizing, setResizing] = createSignal(null);
|
|
49532
|
-
|
|
49876
|
+
let hoverFrameHandle = null;
|
|
49877
|
+
let hoverPendingPoint = null;
|
|
49878
|
+
let resizeFrameHandle = null;
|
|
49879
|
+
let resizePendingPoint = null;
|
|
49880
|
+
const cursorOwner = {};
|
|
49881
|
+
const processHoverFrame = () => {
|
|
49533
49882
|
var _a;
|
|
49534
|
-
|
|
49535
|
-
|
|
49536
|
-
|
|
49537
|
-
|
|
49883
|
+
hoverFrameHandle = null;
|
|
49884
|
+
const point = hoverPendingPoint;
|
|
49885
|
+
hoverPendingPoint = null;
|
|
49886
|
+
if (!point || resizing()) return;
|
|
49538
49887
|
const surface = deps.surfaceRef();
|
|
49539
49888
|
if (!surface) {
|
|
49540
49889
|
clearResizeCursorClasses();
|
|
49541
49890
|
return;
|
|
49542
49891
|
}
|
|
49543
49892
|
const info = findTableResizeHoverInfo(
|
|
49544
|
-
|
|
49893
|
+
point,
|
|
49545
49894
|
surface,
|
|
49546
49895
|
deps.state(),
|
|
49547
49896
|
deps.documentLayout(),
|
|
@@ -49552,10 +49901,26 @@ function createEditorTableResize(deps) {
|
|
|
49552
49901
|
clearResizeCursorClasses();
|
|
49553
49902
|
return;
|
|
49554
49903
|
}
|
|
49555
|
-
setHoverCursorClass(
|
|
49904
|
+
setHoverCursorClass(
|
|
49905
|
+
info.side === "left" || info.side === "right",
|
|
49906
|
+
cursorOwner
|
|
49907
|
+
);
|
|
49908
|
+
};
|
|
49909
|
+
const handleMouseMove = (event) => {
|
|
49910
|
+
if (resizing()) return;
|
|
49911
|
+
hoverPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
49912
|
+
if (hoverFrameHandle === null) {
|
|
49913
|
+
hoverFrameHandle = scheduleAnimationFrame(processHoverFrame);
|
|
49914
|
+
}
|
|
49556
49915
|
};
|
|
49557
49916
|
const handleMouseDown = (event) => {
|
|
49558
49917
|
var _a, _b;
|
|
49918
|
+
hoverPendingPoint = null;
|
|
49919
|
+
if (hoverFrameHandle !== null) {
|
|
49920
|
+
cancelScheduledAnimationFrame(hoverFrameHandle);
|
|
49921
|
+
hoverFrameHandle = null;
|
|
49922
|
+
}
|
|
49923
|
+
clearResizeCursorClasses();
|
|
49559
49924
|
const surface = deps.surfaceRef();
|
|
49560
49925
|
if (!surface) return false;
|
|
49561
49926
|
const info = findTableResizeHoverInfo(
|
|
@@ -49599,7 +49964,7 @@ function createEditorTableResize(deps) {
|
|
|
49599
49964
|
initialTableIndentLeftPt: parseSizeToPt((_b = info.tableNode.style) == null ? void 0 : _b.indentLeft) ?? 0,
|
|
49600
49965
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49601
49966
|
});
|
|
49602
|
-
setActiveCursorClass(true);
|
|
49967
|
+
setActiveCursorClass(true, cursorOwner);
|
|
49603
49968
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49604
49969
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49605
49970
|
event.preventDefault();
|
|
@@ -49632,7 +49997,7 @@ function createEditorTableResize(deps) {
|
|
|
49632
49997
|
minRowHeightPx,
|
|
49633
49998
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49634
49999
|
});
|
|
49635
|
-
setActiveCursorClass(false);
|
|
50000
|
+
setActiveCursorClass(false, cursorOwner);
|
|
49636
50001
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49637
50002
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49638
50003
|
event.preventDefault();
|
|
@@ -49640,14 +50005,39 @@ function createEditorTableResize(deps) {
|
|
|
49640
50005
|
return true;
|
|
49641
50006
|
};
|
|
49642
50007
|
const handleWindowMouseMove = (event) => {
|
|
50008
|
+
if (!resizing()) return;
|
|
50009
|
+
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50010
|
+
if (resizeFrameHandle === null) {
|
|
50011
|
+
resizeFrameHandle = scheduleAnimationFrame(processResizeFrame);
|
|
50012
|
+
}
|
|
50013
|
+
};
|
|
50014
|
+
const processResizeFrame = () => {
|
|
50015
|
+
resizeFrameHandle = null;
|
|
50016
|
+
const point = resizePendingPoint;
|
|
50017
|
+
resizePendingPoint = null;
|
|
49643
50018
|
const currentResizing = resizing();
|
|
49644
|
-
if (!currentResizing) return;
|
|
50019
|
+
if (!point || !currentResizing) return;
|
|
49645
50020
|
setResizing({
|
|
49646
50021
|
...currentResizing,
|
|
49647
|
-
currentPos: currentResizing.type === "column" ?
|
|
50022
|
+
currentPos: currentResizing.type === "column" ? point.clientX : point.clientY,
|
|
49648
50023
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49649
50024
|
});
|
|
49650
|
-
|
|
50025
|
+
};
|
|
50026
|
+
const stop = () => {
|
|
50027
|
+
hoverPendingPoint = null;
|
|
50028
|
+
resizePendingPoint = null;
|
|
50029
|
+
if (hoverFrameHandle !== null) {
|
|
50030
|
+
cancelScheduledAnimationFrame(hoverFrameHandle);
|
|
50031
|
+
hoverFrameHandle = null;
|
|
50032
|
+
}
|
|
50033
|
+
if (resizeFrameHandle !== null) {
|
|
50034
|
+
cancelScheduledAnimationFrame(resizeFrameHandle);
|
|
50035
|
+
resizeFrameHandle = null;
|
|
50036
|
+
}
|
|
50037
|
+
setResizing(null);
|
|
50038
|
+
clearResizeCursorClasses(cursorOwner);
|
|
50039
|
+
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
50040
|
+
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
49651
50041
|
};
|
|
49652
50042
|
const handleWindowMouseUp = (event) => {
|
|
49653
50043
|
var _a;
|
|
@@ -49663,18 +50053,17 @@ function createEditorTableResize(deps) {
|
|
|
49663
50053
|
return applyColumnResize(current, currentResizing, delta);
|
|
49664
50054
|
});
|
|
49665
50055
|
}
|
|
49666
|
-
|
|
49667
|
-
clearResizeCursorClasses();
|
|
49668
|
-
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
49669
|
-
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
50056
|
+
stop();
|
|
49670
50057
|
};
|
|
49671
50058
|
return {
|
|
49672
50059
|
resizing,
|
|
49673
50060
|
handleMouseMove,
|
|
49674
|
-
handleMouseDown
|
|
50061
|
+
handleMouseDown,
|
|
50062
|
+
stop
|
|
49675
50063
|
};
|
|
49676
50064
|
}
|
|
49677
50065
|
const DRAG_THRESHOLD_PX = 2;
|
|
50066
|
+
let tableCornerResizeCursorOwner = null;
|
|
49678
50067
|
function computeCornerScales(resize) {
|
|
49679
50068
|
const rawX = (resize.bounds.width + (resize.currentClientX - resize.startClientX)) / resize.bounds.width;
|
|
49680
50069
|
const rawY = (resize.bounds.height + (resize.currentClientY - resize.startClientY)) / resize.bounds.height;
|
|
@@ -49702,22 +50091,28 @@ function applyTableCornerResize(state, resize, scaleX, scaleY) {
|
|
|
49702
50091
|
(sum, value) => sum + value,
|
|
49703
50092
|
0
|
|
49704
50093
|
);
|
|
49705
|
-
|
|
50094
|
+
const next = setTableColumnWidths(
|
|
49706
50095
|
state,
|
|
49707
50096
|
resize.tableId,
|
|
49708
50097
|
nextWidths,
|
|
49709
50098
|
nextTotalPt
|
|
49710
50099
|
);
|
|
50100
|
+
const nextRowHeights = {};
|
|
49711
50101
|
resize.rowHeightsPx.forEach((heightPx, index) => {
|
|
49712
|
-
|
|
49713
|
-
|
|
50102
|
+
nextRowHeights[index] = Math.max(
|
|
50103
|
+
MIN_TABLE_SIZE_PT,
|
|
50104
|
+
pxToPt(heightPx * scaleY)
|
|
50105
|
+
);
|
|
49714
50106
|
});
|
|
49715
|
-
return next;
|
|
50107
|
+
return setTableRowHeights(next, resize.tableId, nextRowHeights);
|
|
49716
50108
|
}
|
|
49717
50109
|
function createEditorTableCornerResize(deps) {
|
|
49718
50110
|
const [resizing, setResizing] = createSignal(
|
|
49719
50111
|
null
|
|
49720
50112
|
);
|
|
50113
|
+
let resizeFrameHandle = null;
|
|
50114
|
+
let resizePendingPoint = null;
|
|
50115
|
+
const cursorOwner = {};
|
|
49721
50116
|
const previewRect = () => {
|
|
49722
50117
|
const current = resizing();
|
|
49723
50118
|
if (!current) return null;
|
|
@@ -49730,19 +50125,40 @@ function createEditorTableCornerResize(deps) {
|
|
|
49730
50125
|
};
|
|
49731
50126
|
};
|
|
49732
50127
|
const handleWindowMouseMove = (event) => {
|
|
50128
|
+
if (!resizing()) return;
|
|
50129
|
+
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50130
|
+
if (resizeFrameHandle === null) {
|
|
50131
|
+
resizeFrameHandle = scheduleAnimationFrame(processResizeFrame);
|
|
50132
|
+
}
|
|
50133
|
+
};
|
|
50134
|
+
const processResizeFrame = () => {
|
|
50135
|
+
resizeFrameHandle = null;
|
|
50136
|
+
const point = resizePendingPoint;
|
|
50137
|
+
resizePendingPoint = null;
|
|
50138
|
+
if (!point) return;
|
|
49733
50139
|
setResizing(
|
|
49734
50140
|
(current) => current ? {
|
|
49735
50141
|
...current,
|
|
49736
|
-
currentClientX:
|
|
49737
|
-
currentClientY:
|
|
50142
|
+
currentClientX: point.clientX,
|
|
50143
|
+
currentClientY: point.clientY
|
|
49738
50144
|
} : null
|
|
49739
50145
|
);
|
|
49740
50146
|
};
|
|
49741
50147
|
const stop = () => {
|
|
50148
|
+
resizePendingPoint = null;
|
|
50149
|
+
if (resizeFrameHandle !== null) {
|
|
50150
|
+
cancelScheduledAnimationFrame(resizeFrameHandle);
|
|
50151
|
+
resizeFrameHandle = null;
|
|
50152
|
+
}
|
|
49742
50153
|
setResizing(null);
|
|
49743
50154
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
49744
50155
|
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
49745
|
-
|
|
50156
|
+
if (tableCornerResizeCursorOwner === cursorOwner) {
|
|
50157
|
+
tableCornerResizeCursorOwner = null;
|
|
50158
|
+
if (document.body.style.cursor === "nwse-resize") {
|
|
50159
|
+
document.body.style.cursor = "";
|
|
50160
|
+
}
|
|
50161
|
+
}
|
|
49746
50162
|
};
|
|
49747
50163
|
const handleWindowMouseUp = (event) => {
|
|
49748
50164
|
const current = resizing();
|
|
@@ -49806,14 +50222,16 @@ function createEditorTableCornerResize(deps) {
|
|
|
49806
50222
|
totalWidthPt,
|
|
49807
50223
|
rowHeightsPx
|
|
49808
50224
|
});
|
|
50225
|
+
tableCornerResizeCursorOwner = cursorOwner;
|
|
49809
50226
|
document.body.style.cursor = "nwse-resize";
|
|
49810
50227
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49811
50228
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49812
50229
|
event.preventDefault();
|
|
49813
50230
|
event.stopPropagation();
|
|
49814
50231
|
};
|
|
49815
|
-
return { resizing, previewRect, handleMouseDown };
|
|
50232
|
+
return { resizing, previewRect, handleMouseDown, stop };
|
|
49816
50233
|
}
|
|
50234
|
+
let tableDragCursorOwner = null;
|
|
49817
50235
|
function createEditorTableDrag(deps) {
|
|
49818
50236
|
return createEditorTableDragImpl(deps);
|
|
49819
50237
|
}
|
|
@@ -49826,30 +50244,43 @@ function createEditorTableDragImpl(deps) {
|
|
|
49826
50244
|
const [startClientY, setStartClientY] = createSignal(0);
|
|
49827
50245
|
const [startClientX, setStartClientX] = createSignal(0);
|
|
49828
50246
|
const [mousePos, setMousePos] = createSignal({ x: 0, y: 0 });
|
|
50247
|
+
let dragFrameHandle = null;
|
|
50248
|
+
let dragPendingPoint = null;
|
|
50249
|
+
const cursorOwner = {};
|
|
50250
|
+
const positionsEqual = (left, right) => left === right || left !== null && right !== null && left.paragraphId === right.paragraphId && left.runId === right.runId && left.offset === right.offset;
|
|
50251
|
+
const updateDropTarget = (next) => {
|
|
50252
|
+
setDropTargetPos(
|
|
50253
|
+
(current) => positionsEqual(current, next) ? current : next
|
|
50254
|
+
);
|
|
50255
|
+
};
|
|
49829
50256
|
const stopDrag = () => {
|
|
50257
|
+
dragPendingPoint = null;
|
|
50258
|
+
if (dragFrameHandle !== null) {
|
|
50259
|
+
cancelScheduledAnimationFrame(dragFrameHandle);
|
|
50260
|
+
dragFrameHandle = null;
|
|
50261
|
+
}
|
|
49830
50262
|
setDragging(false);
|
|
49831
50263
|
setDraggedTableInfo(null);
|
|
49832
50264
|
setDropTargetPos(null);
|
|
49833
50265
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
49834
50266
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
49835
|
-
|
|
49836
|
-
|
|
49837
|
-
|
|
49838
|
-
|
|
49839
|
-
setMousePos({ x: event.clientX, y: event.clientY });
|
|
49840
|
-
if (!dragging()) {
|
|
49841
|
-
const delta = Math.abs(event.clientY - startClientY());
|
|
49842
|
-
if (delta > 4) {
|
|
49843
|
-
setDragging(true);
|
|
49844
|
-
document.body.style.cursor = "grabbing";
|
|
49845
|
-
} else {
|
|
49846
|
-
return;
|
|
50267
|
+
if (tableDragCursorOwner === cursorOwner) {
|
|
50268
|
+
tableDragCursorOwner = null;
|
|
50269
|
+
if (document.body.style.cursor === "grabbing") {
|
|
50270
|
+
document.body.style.cursor = "";
|
|
49847
50271
|
}
|
|
49848
50272
|
}
|
|
49849
|
-
|
|
50273
|
+
};
|
|
50274
|
+
const processDragFrame = () => {
|
|
50275
|
+
var _a;
|
|
50276
|
+
dragFrameHandle = null;
|
|
50277
|
+
const point = dragPendingPoint;
|
|
50278
|
+
dragPendingPoint = null;
|
|
50279
|
+
if (!point || !dragging()) return;
|
|
50280
|
+
setMousePos({ x: point.clientX, y: point.clientY });
|
|
49850
50281
|
const pos = deps.resolvePositionAtSurfacePoint(
|
|
49851
|
-
|
|
49852
|
-
|
|
50282
|
+
point.clientX,
|
|
50283
|
+
point.clientY
|
|
49853
50284
|
);
|
|
49854
50285
|
const tableId = (_a = draggedTableInfo()) == null ? void 0 : _a.tableId;
|
|
49855
50286
|
if (pos && tableId) {
|
|
@@ -49863,12 +50294,25 @@ function createEditorTableDragImpl(deps) {
|
|
|
49863
50294
|
const blocks = getEditableBlocksForZone(state, location.zone);
|
|
49864
50295
|
const tableBlock = blocks[location.blockIndex];
|
|
49865
50296
|
if (tableBlock && tableBlock.type === "table" && tableBlock.id === tableId) {
|
|
49866
|
-
|
|
50297
|
+
updateDropTarget(null);
|
|
49867
50298
|
return;
|
|
49868
50299
|
}
|
|
49869
50300
|
}
|
|
49870
50301
|
}
|
|
49871
|
-
|
|
50302
|
+
updateDropTarget(pos);
|
|
50303
|
+
};
|
|
50304
|
+
const handleMouseMove = (event) => {
|
|
50305
|
+
if (!dragging()) {
|
|
50306
|
+
const delta = Math.abs(event.clientY - startClientY());
|
|
50307
|
+
if (delta <= 4) return;
|
|
50308
|
+
setDragging(true);
|
|
50309
|
+
tableDragCursorOwner = cursorOwner;
|
|
50310
|
+
document.body.style.cursor = "grabbing";
|
|
50311
|
+
}
|
|
50312
|
+
dragPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50313
|
+
if (dragFrameHandle === null) {
|
|
50314
|
+
dragFrameHandle = scheduleAnimationFrame(processDragFrame);
|
|
50315
|
+
}
|
|
49872
50316
|
};
|
|
49873
50317
|
const handleMouseUp = (event) => {
|
|
49874
50318
|
const info = draggedTableInfo();
|
|
@@ -49935,7 +50379,8 @@ function createEditorTableDragImpl(deps) {
|
|
|
49935
50379
|
draggedTableInfo,
|
|
49936
50380
|
mousePos,
|
|
49937
50381
|
dropTargetPos,
|
|
49938
|
-
handleMouseDown
|
|
50382
|
+
handleMouseDown,
|
|
50383
|
+
stop: stopDrag
|
|
49939
50384
|
};
|
|
49940
50385
|
}
|
|
49941
50386
|
function isWordCharacter(char) {
|
|
@@ -54503,10 +54948,10 @@ function buildEssentialsTable(options) {
|
|
|
54503
54948
|
return table && table.type === "table" ? table : null;
|
|
54504
54949
|
};
|
|
54505
54950
|
const rawTblLookIn = (state) => {
|
|
54506
|
-
var _a;
|
|
54507
54951
|
const table = selectedTableIn(state);
|
|
54508
54952
|
if (!table) return null;
|
|
54509
|
-
|
|
54953
|
+
const effective = resolveEffectiveTableStyle(table, state.document.styles);
|
|
54954
|
+
return { ...RAW_TBL_LOOK_DEFAULTS, ...effective.tblLook ?? {} };
|
|
54510
54955
|
};
|
|
54511
54956
|
const selectionLabel = () => {
|
|
54512
54957
|
const normalized = normalizeSelection(options.state());
|
|
@@ -55555,7 +56000,6 @@ function OasisEditorApp(props = {}) {
|
|
|
55555
56000
|
commandsController,
|
|
55556
56001
|
runtimeReady,
|
|
55557
56002
|
runtimeEditor,
|
|
55558
|
-
commandStateOf,
|
|
55559
56003
|
toolbarHost,
|
|
55560
56004
|
toolbarRegistry,
|
|
55561
56005
|
menuRegistry,
|
|
@@ -55670,6 +56114,9 @@ function OasisEditorApp(props = {}) {
|
|
|
55670
56114
|
onCleanupHook();
|
|
55671
56115
|
surfaceEventsWithTextDrag.stopDragging();
|
|
55672
56116
|
textDrag.stopDrag();
|
|
56117
|
+
tableResize.stop();
|
|
56118
|
+
tableCornerResize.stop();
|
|
56119
|
+
tableDrag.stop();
|
|
55673
56120
|
imageOps.stopImageDrag();
|
|
55674
56121
|
imageOps.stopImageResize();
|
|
55675
56122
|
imageOps.stopImageCrop();
|
|
@@ -55744,8 +56191,7 @@ function OasisEditorApp(props = {}) {
|
|
|
55744
56191
|
runtimeEditor,
|
|
55745
56192
|
persistenceStatus,
|
|
55746
56193
|
toolbarRegistry,
|
|
55747
|
-
menuRegistry
|
|
55748
|
-
showFloatingTableToolbar: () => !isReadOnly() && commandStateOf("tableContext").value !== null
|
|
56194
|
+
menuRegistry
|
|
55749
56195
|
},
|
|
55750
56196
|
chrome: {
|
|
55751
56197
|
showChrome,
|