oasis-editor 0.0.137 → 0.0.139
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-B1x9P0Ua.js} +610 -122
- package/dist/adapters/mountController.d.ts +11 -0
- package/dist/adapters/react.d.ts +8 -0
- package/dist/adapters/ui.d.ts +1 -1
- package/dist/adapters/vue.d.ts +10 -0
- package/dist/app/bootstrap/createOasisEditorApp.d.ts +9 -0
- package/dist/app/bootstrap/createOasisEditorContainer.d.ts +9 -0
- package/dist/app/client/OasisEditorClient.d.ts +254 -1
- package/dist/app/client/publicDocumentApi.d.ts +223 -0
- package/dist/app/controllers/animationFrame.d.ts +2 -0
- package/dist/app/controllers/documentIO/DocumentExporter.d.ts +10 -2
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +6 -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/useEditorDocumentIO.d.ts +4 -2
- package/dist/app/controllers/useEditorFindReplace.d.ts +7 -0
- package/dist/app/controllers/useEditorPersistence.d.ts +10 -0
- package/dist/app/controllers/useEditorTableCornerResize.d.ts +1 -0
- package/dist/app/controllers/useEditorTableDrag.d.ts +2 -0
- package/dist/app/services/FindReplaceService.d.ts +9 -0
- package/dist/app/services/indexedDbPersistence.d.ts +10 -1
- package/dist/app/services/tablePropertiesService.d.ts +12 -3
- package/dist/app/services/userPreferences.d.ts +4 -0
- package/dist/assets/{importDocxWorker-B0cSSI12.js → importDocxWorker-B1vHeo5L.js} +1 -1
- package/dist/core/Editor.d.ts +33 -1
- package/dist/core/commands/CommandBus.d.ts +26 -0
- package/dist/core/commands/publicCommandTypes.d.ts +53 -0
- 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/document.d.ts +2 -0
- package/dist/core/model/types/nodes.d.ts +123 -5
- package/dist/core/plugin.d.ts +60 -0
- 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/DocumentFormatImporter.d.ts +20 -4
- package/dist/import/documentImporterRegistry.d.ts +6 -2
- package/dist/import/docx/contentControls.d.ts +9 -0
- package/dist/import/docx/tableProperties.d.ts +1 -14
- package/dist/{index-Djyuogou.js → index-BVWzLonI.js} +2005 -1367
- package/dist/index.d.ts +3 -1
- package/dist/mountController.d.ts +11 -0
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +57 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/react.d.ts +8 -0
- package/dist/ui/OasisEditorAppProps.d.ts +8 -4
- package/dist/ui/OasisEditorEditorProps.d.ts +0 -1
- package/dist/ui/app/EditorWorkspace.d.ts +0 -1
- package/dist/ui/app/connectEditorClientHost.d.ts +12 -2
- package/dist/ui/app/createEditorCommandRuntime.d.ts +8 -1
- package/dist/ui/app/createEditorDocumentRuntime.d.ts +4 -2
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +1 -0
- package/dist/ui/canvas/CanvasDebug.d.ts +15 -1
- package/dist/ui/components/Menubar/menuRegistry.d.ts +11 -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/components/Toolbar/registry/ToolbarRegistry.d.ts +43 -7
- package/dist/ui/components/Toolbar/schema/items.d.ts +39 -7
- package/dist/ui/components/Toolbar/state/createToolbarApi.d.ts +8 -4
- package/dist/ui/editorHistory.d.ts +2 -0
- package/dist/ui/shells/DocumentShell.d.ts +1 -2
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +29 -30
- package/dist/vue.d.ts +10 -0
- 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-BVWzLonI.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;
|
|
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);
|
|
29674
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;
|
|
@@ -43607,15 +43910,21 @@ function createDocumentExporter(deps) {
|
|
|
43607
43910
|
const blob = await exportEditorDocumentToDocxBlob(deps.document());
|
|
43608
43911
|
download(blob, "oasis-editor.docx");
|
|
43609
43912
|
deps.focusInput();
|
|
43913
|
+
return blob;
|
|
43610
43914
|
};
|
|
43611
43915
|
const handleExportPdf = async () => {
|
|
43612
43916
|
const blob = await exportEditorDocumentToPdfBlob(deps.document());
|
|
43613
43917
|
download(blob, "oasis-editor.pdf");
|
|
43614
43918
|
deps.focusInput();
|
|
43919
|
+
return blob;
|
|
43615
43920
|
};
|
|
43921
|
+
const exportDocxBlob = () => exportEditorDocumentToDocxBlob(deps.document());
|
|
43922
|
+
const exportPdfBlob = () => exportEditorDocumentToPdfBlob(deps.document());
|
|
43616
43923
|
return {
|
|
43617
43924
|
handleExportDocx,
|
|
43618
|
-
handleExportPdf
|
|
43925
|
+
handleExportPdf,
|
|
43926
|
+
exportDocxBlob,
|
|
43927
|
+
exportPdfBlob
|
|
43619
43928
|
};
|
|
43620
43929
|
}
|
|
43621
43930
|
async function readFileBuffer(file) {
|
|
@@ -44450,16 +44759,18 @@ function createEditorDocumentIOImpl(deps) {
|
|
|
44450
44759
|
deps.focusInput();
|
|
44451
44760
|
};
|
|
44452
44761
|
const handleExportDocx = async () => {
|
|
44453
|
-
|
|
44762
|
+
return exporter.handleExportDocx();
|
|
44454
44763
|
};
|
|
44455
44764
|
const handleExportPdf = async () => {
|
|
44456
|
-
|
|
44765
|
+
return exporter.handleExportPdf();
|
|
44457
44766
|
};
|
|
44458
44767
|
return {
|
|
44459
44768
|
importProgress,
|
|
44460
44769
|
handleImportFile,
|
|
44461
44770
|
handleExportDocx,
|
|
44462
44771
|
handleExportPdf,
|
|
44772
|
+
exportDocxBlob: exporter.exportDocxBlob,
|
|
44773
|
+
exportPdfBlob: exporter.exportPdfBlob,
|
|
44463
44774
|
insertImageFromFile,
|
|
44464
44775
|
handleInsertImage
|
|
44465
44776
|
};
|
|
@@ -45213,6 +45524,12 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45213
45524
|
});
|
|
45214
45525
|
return { status };
|
|
45215
45526
|
}
|
|
45527
|
+
const MAX_EDITOR_HISTORY_ENTRIES = 250;
|
|
45528
|
+
function appendEditorHistoryEntry(stack, state) {
|
|
45529
|
+
const retained = Math.max(0, MAX_EDITOR_HISTORY_ENTRIES - 1);
|
|
45530
|
+
const start = Math.max(0, stack.length - retained);
|
|
45531
|
+
return [...stack.slice(start), state];
|
|
45532
|
+
}
|
|
45216
45533
|
function createEmptyEditorHistoryState() {
|
|
45217
45534
|
return {
|
|
45218
45535
|
undoStack: [],
|
|
@@ -45224,7 +45541,7 @@ function applyEditorHistoryTransaction(history, previous, next, options, now = D
|
|
|
45224
45541
|
var _a;
|
|
45225
45542
|
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
45543
|
return {
|
|
45227
|
-
undoStack: canMerge ? history.undoStack :
|
|
45544
|
+
undoStack: canMerge ? history.undoStack : appendEditorHistoryEntry(history.undoStack, previous),
|
|
45228
45545
|
redoStack: [],
|
|
45229
45546
|
lastTransactionMeta: (options == null ? void 0 : options.mergeKey) ? { mergeKey: options.mergeKey, timestamp: now } : null
|
|
45230
45547
|
};
|
|
@@ -45242,7 +45559,7 @@ function takeEditorUndoStep(history, current) {
|
|
|
45242
45559
|
return {
|
|
45243
45560
|
history: {
|
|
45244
45561
|
undoStack: history.undoStack.slice(0, -1),
|
|
45245
|
-
redoStack:
|
|
45562
|
+
redoStack: appendEditorHistoryEntry(history.redoStack, current),
|
|
45246
45563
|
lastTransactionMeta: null
|
|
45247
45564
|
},
|
|
45248
45565
|
nextState: history.undoStack[history.undoStack.length - 1]
|
|
@@ -45254,7 +45571,7 @@ function takeEditorRedoStep(history, current) {
|
|
|
45254
45571
|
}
|
|
45255
45572
|
return {
|
|
45256
45573
|
history: {
|
|
45257
|
-
undoStack:
|
|
45574
|
+
undoStack: appendEditorHistoryEntry(history.undoStack, current),
|
|
45258
45575
|
redoStack: history.redoStack.slice(0, -1),
|
|
45259
45576
|
lastTransactionMeta: null
|
|
45260
45577
|
},
|
|
@@ -47437,7 +47754,10 @@ function createResizeSession(adapter, deps) {
|
|
|
47437
47754
|
if (resize) {
|
|
47438
47755
|
deps.updateHistoryState((current) => ({
|
|
47439
47756
|
...current,
|
|
47440
|
-
undoStack:
|
|
47757
|
+
undoStack: appendEditorHistoryEntry(
|
|
47758
|
+
current.undoStack,
|
|
47759
|
+
deps.cloneState(resize.initialState)
|
|
47760
|
+
),
|
|
47441
47761
|
redoStack: []
|
|
47442
47762
|
}));
|
|
47443
47763
|
}
|
|
@@ -47533,7 +47853,10 @@ function createRotateSession(adapter, deps) {
|
|
|
47533
47853
|
if (rotate) {
|
|
47534
47854
|
deps.updateHistoryState((current) => ({
|
|
47535
47855
|
...current,
|
|
47536
|
-
undoStack:
|
|
47856
|
+
undoStack: appendEditorHistoryEntry(
|
|
47857
|
+
current.undoStack,
|
|
47858
|
+
deps.cloneState(rotate.initialState)
|
|
47859
|
+
),
|
|
47537
47860
|
redoStack: []
|
|
47538
47861
|
}));
|
|
47539
47862
|
}
|
|
@@ -47663,7 +47986,10 @@ function createCropSession(deps) {
|
|
|
47663
47986
|
if (crop) {
|
|
47664
47987
|
deps.updateHistoryState((current) => ({
|
|
47665
47988
|
...current,
|
|
47666
|
-
undoStack:
|
|
47989
|
+
undoStack: appendEditorHistoryEntry(
|
|
47990
|
+
current.undoStack,
|
|
47991
|
+
deps.cloneState(crop.initialState)
|
|
47992
|
+
),
|
|
47667
47993
|
redoStack: []
|
|
47668
47994
|
}));
|
|
47669
47995
|
}
|
|
@@ -49065,6 +49391,7 @@ function createEditorClipboardControllerImpl(deps) {
|
|
|
49065
49391
|
handleDrop
|
|
49066
49392
|
};
|
|
49067
49393
|
}
|
|
49394
|
+
const geometryCache = /* @__PURE__ */ new WeakMap();
|
|
49068
49395
|
function getAllBlocks(state) {
|
|
49069
49396
|
return getDocumentSectionsCanonical(state.document).flatMap(
|
|
49070
49397
|
(section) => [
|
|
@@ -49090,6 +49417,10 @@ function buildTableGeometries(surface, state, documentLayout, canvasSnapshotProv
|
|
|
49090
49417
|
if (!snapshot) {
|
|
49091
49418
|
return [];
|
|
49092
49419
|
}
|
|
49420
|
+
const cached = geometryCache.get(snapshot);
|
|
49421
|
+
if (cached) {
|
|
49422
|
+
return cached;
|
|
49423
|
+
}
|
|
49093
49424
|
const byTable = /* @__PURE__ */ new Map();
|
|
49094
49425
|
const contentBoundsByCell = /* @__PURE__ */ new Map();
|
|
49095
49426
|
for (const paragraph of snapshot.paragraphs) {
|
|
@@ -49177,6 +49508,7 @@ function buildTableGeometries(surface, state, documentLayout, canvasSnapshotProv
|
|
|
49177
49508
|
}
|
|
49178
49509
|
});
|
|
49179
49510
|
}
|
|
49511
|
+
geometryCache.set(snapshot, result);
|
|
49180
49512
|
return result;
|
|
49181
49513
|
}
|
|
49182
49514
|
const EDGE_THRESHOLD_COLUMN_PX = 4;
|
|
@@ -49194,6 +49526,9 @@ function findTableResizeHoverInfo(event, surface, state, documentLayout, canvasS
|
|
|
49194
49526
|
}
|
|
49195
49527
|
let best = null;
|
|
49196
49528
|
for (const geometry of geometries) {
|
|
49529
|
+
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) {
|
|
49530
|
+
continue;
|
|
49531
|
+
}
|
|
49197
49532
|
for (const cell of geometry.cells) {
|
|
49198
49533
|
const verticallyAligned = event.clientY >= cell.top - EDGE_THRESHOLD_COLUMN_PX && event.clientY <= cell.bottom + EDGE_THRESHOLD_COLUMN_PX;
|
|
49199
49534
|
const horizontallyAligned = event.clientX >= cell.left - EDGE_THRESHOLD_ROW_PX && event.clientX <= cell.right + EDGE_THRESHOLD_ROW_PX;
|
|
@@ -49507,7 +49842,9 @@ function getGuideBounds(viewportRef) {
|
|
|
49507
49842
|
height: Math.max(0, rect.height)
|
|
49508
49843
|
};
|
|
49509
49844
|
}
|
|
49510
|
-
|
|
49845
|
+
let resizeCursorOwner = null;
|
|
49846
|
+
function setResizeCursorClass(isCol, owner) {
|
|
49847
|
+
resizeCursorOwner = owner;
|
|
49511
49848
|
if (isCol) {
|
|
49512
49849
|
document.body.classList.add("oasis-editor-hover-col-resize");
|
|
49513
49850
|
document.body.classList.remove("oasis-editor-hover-row-resize");
|
|
@@ -49516,32 +49853,52 @@ function setResizeCursorClass(isCol) {
|
|
|
49516
49853
|
document.body.classList.remove("oasis-editor-hover-col-resize");
|
|
49517
49854
|
}
|
|
49518
49855
|
}
|
|
49519
|
-
function clearResizeCursorClasses() {
|
|
49856
|
+
function clearResizeCursorClasses(owner) {
|
|
49857
|
+
if (owner && resizeCursorOwner !== owner) return;
|
|
49858
|
+
resizeCursorOwner = null;
|
|
49520
49859
|
document.body.classList.remove("oasis-editor-hover-col-resize");
|
|
49521
49860
|
document.body.classList.remove("oasis-editor-hover-row-resize");
|
|
49522
49861
|
}
|
|
49523
|
-
function setHoverCursorClass(isCol) {
|
|
49524
|
-
setResizeCursorClass(isCol);
|
|
49862
|
+
function setHoverCursorClass(isCol, owner) {
|
|
49863
|
+
setResizeCursorClass(isCol, owner);
|
|
49525
49864
|
}
|
|
49526
|
-
function setActiveCursorClass(isCol) {
|
|
49527
|
-
setResizeCursorClass(isCol);
|
|
49865
|
+
function setActiveCursorClass(isCol, owner) {
|
|
49866
|
+
setResizeCursorClass(isCol, owner);
|
|
49867
|
+
}
|
|
49868
|
+
function scheduleAnimationFrame(callback) {
|
|
49869
|
+
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
|
|
49870
|
+
return window.requestAnimationFrame(callback);
|
|
49871
|
+
}
|
|
49872
|
+
return globalThis.setTimeout(callback, 16);
|
|
49873
|
+
}
|
|
49874
|
+
function cancelScheduledAnimationFrame(handle) {
|
|
49875
|
+
if (typeof window !== "undefined" && typeof window.cancelAnimationFrame === "function") {
|
|
49876
|
+
window.cancelAnimationFrame(handle);
|
|
49877
|
+
return;
|
|
49878
|
+
}
|
|
49879
|
+
globalThis.clearTimeout(handle);
|
|
49528
49880
|
}
|
|
49529
49881
|
const DRAG_THRESHOLD_PX$1 = 2;
|
|
49530
49882
|
function createEditorTableResize(deps) {
|
|
49531
49883
|
const [resizing, setResizing] = createSignal(null);
|
|
49532
|
-
|
|
49884
|
+
let hoverFrameHandle = null;
|
|
49885
|
+
let hoverPendingPoint = null;
|
|
49886
|
+
let resizeFrameHandle = null;
|
|
49887
|
+
let resizePendingPoint = null;
|
|
49888
|
+
const cursorOwner = {};
|
|
49889
|
+
const processHoverFrame = () => {
|
|
49533
49890
|
var _a;
|
|
49534
|
-
|
|
49535
|
-
|
|
49536
|
-
|
|
49537
|
-
|
|
49891
|
+
hoverFrameHandle = null;
|
|
49892
|
+
const point = hoverPendingPoint;
|
|
49893
|
+
hoverPendingPoint = null;
|
|
49894
|
+
if (!point || resizing()) return;
|
|
49538
49895
|
const surface = deps.surfaceRef();
|
|
49539
49896
|
if (!surface) {
|
|
49540
49897
|
clearResizeCursorClasses();
|
|
49541
49898
|
return;
|
|
49542
49899
|
}
|
|
49543
49900
|
const info = findTableResizeHoverInfo(
|
|
49544
|
-
|
|
49901
|
+
point,
|
|
49545
49902
|
surface,
|
|
49546
49903
|
deps.state(),
|
|
49547
49904
|
deps.documentLayout(),
|
|
@@ -49552,10 +49909,26 @@ function createEditorTableResize(deps) {
|
|
|
49552
49909
|
clearResizeCursorClasses();
|
|
49553
49910
|
return;
|
|
49554
49911
|
}
|
|
49555
|
-
setHoverCursorClass(
|
|
49912
|
+
setHoverCursorClass(
|
|
49913
|
+
info.side === "left" || info.side === "right",
|
|
49914
|
+
cursorOwner
|
|
49915
|
+
);
|
|
49916
|
+
};
|
|
49917
|
+
const handleMouseMove = (event) => {
|
|
49918
|
+
if (resizing()) return;
|
|
49919
|
+
hoverPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
49920
|
+
if (hoverFrameHandle === null) {
|
|
49921
|
+
hoverFrameHandle = scheduleAnimationFrame(processHoverFrame);
|
|
49922
|
+
}
|
|
49556
49923
|
};
|
|
49557
49924
|
const handleMouseDown = (event) => {
|
|
49558
49925
|
var _a, _b;
|
|
49926
|
+
hoverPendingPoint = null;
|
|
49927
|
+
if (hoverFrameHandle !== null) {
|
|
49928
|
+
cancelScheduledAnimationFrame(hoverFrameHandle);
|
|
49929
|
+
hoverFrameHandle = null;
|
|
49930
|
+
}
|
|
49931
|
+
clearResizeCursorClasses();
|
|
49559
49932
|
const surface = deps.surfaceRef();
|
|
49560
49933
|
if (!surface) return false;
|
|
49561
49934
|
const info = findTableResizeHoverInfo(
|
|
@@ -49599,7 +49972,7 @@ function createEditorTableResize(deps) {
|
|
|
49599
49972
|
initialTableIndentLeftPt: parseSizeToPt((_b = info.tableNode.style) == null ? void 0 : _b.indentLeft) ?? 0,
|
|
49600
49973
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49601
49974
|
});
|
|
49602
|
-
setActiveCursorClass(true);
|
|
49975
|
+
setActiveCursorClass(true, cursorOwner);
|
|
49603
49976
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49604
49977
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49605
49978
|
event.preventDefault();
|
|
@@ -49632,7 +50005,7 @@ function createEditorTableResize(deps) {
|
|
|
49632
50005
|
minRowHeightPx,
|
|
49633
50006
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49634
50007
|
});
|
|
49635
|
-
setActiveCursorClass(false);
|
|
50008
|
+
setActiveCursorClass(false, cursorOwner);
|
|
49636
50009
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49637
50010
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49638
50011
|
event.preventDefault();
|
|
@@ -49640,14 +50013,39 @@ function createEditorTableResize(deps) {
|
|
|
49640
50013
|
return true;
|
|
49641
50014
|
};
|
|
49642
50015
|
const handleWindowMouseMove = (event) => {
|
|
50016
|
+
if (!resizing()) return;
|
|
50017
|
+
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50018
|
+
if (resizeFrameHandle === null) {
|
|
50019
|
+
resizeFrameHandle = scheduleAnimationFrame(processResizeFrame);
|
|
50020
|
+
}
|
|
50021
|
+
};
|
|
50022
|
+
const processResizeFrame = () => {
|
|
50023
|
+
resizeFrameHandle = null;
|
|
50024
|
+
const point = resizePendingPoint;
|
|
50025
|
+
resizePendingPoint = null;
|
|
49643
50026
|
const currentResizing = resizing();
|
|
49644
|
-
if (!currentResizing) return;
|
|
50027
|
+
if (!point || !currentResizing) return;
|
|
49645
50028
|
setResizing({
|
|
49646
50029
|
...currentResizing,
|
|
49647
|
-
currentPos: currentResizing.type === "column" ?
|
|
50030
|
+
currentPos: currentResizing.type === "column" ? point.clientX : point.clientY,
|
|
49648
50031
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49649
50032
|
});
|
|
49650
|
-
|
|
50033
|
+
};
|
|
50034
|
+
const stop = () => {
|
|
50035
|
+
hoverPendingPoint = null;
|
|
50036
|
+
resizePendingPoint = null;
|
|
50037
|
+
if (hoverFrameHandle !== null) {
|
|
50038
|
+
cancelScheduledAnimationFrame(hoverFrameHandle);
|
|
50039
|
+
hoverFrameHandle = null;
|
|
50040
|
+
}
|
|
50041
|
+
if (resizeFrameHandle !== null) {
|
|
50042
|
+
cancelScheduledAnimationFrame(resizeFrameHandle);
|
|
50043
|
+
resizeFrameHandle = null;
|
|
50044
|
+
}
|
|
50045
|
+
setResizing(null);
|
|
50046
|
+
clearResizeCursorClasses(cursorOwner);
|
|
50047
|
+
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
50048
|
+
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
49651
50049
|
};
|
|
49652
50050
|
const handleWindowMouseUp = (event) => {
|
|
49653
50051
|
var _a;
|
|
@@ -49663,18 +50061,17 @@ function createEditorTableResize(deps) {
|
|
|
49663
50061
|
return applyColumnResize(current, currentResizing, delta);
|
|
49664
50062
|
});
|
|
49665
50063
|
}
|
|
49666
|
-
|
|
49667
|
-
clearResizeCursorClasses();
|
|
49668
|
-
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
49669
|
-
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
50064
|
+
stop();
|
|
49670
50065
|
};
|
|
49671
50066
|
return {
|
|
49672
50067
|
resizing,
|
|
49673
50068
|
handleMouseMove,
|
|
49674
|
-
handleMouseDown
|
|
50069
|
+
handleMouseDown,
|
|
50070
|
+
stop
|
|
49675
50071
|
};
|
|
49676
50072
|
}
|
|
49677
50073
|
const DRAG_THRESHOLD_PX = 2;
|
|
50074
|
+
let tableCornerResizeCursorOwner = null;
|
|
49678
50075
|
function computeCornerScales(resize) {
|
|
49679
50076
|
const rawX = (resize.bounds.width + (resize.currentClientX - resize.startClientX)) / resize.bounds.width;
|
|
49680
50077
|
const rawY = (resize.bounds.height + (resize.currentClientY - resize.startClientY)) / resize.bounds.height;
|
|
@@ -49702,22 +50099,28 @@ function applyTableCornerResize(state, resize, scaleX, scaleY) {
|
|
|
49702
50099
|
(sum, value) => sum + value,
|
|
49703
50100
|
0
|
|
49704
50101
|
);
|
|
49705
|
-
|
|
50102
|
+
const next = setTableColumnWidths(
|
|
49706
50103
|
state,
|
|
49707
50104
|
resize.tableId,
|
|
49708
50105
|
nextWidths,
|
|
49709
50106
|
nextTotalPt
|
|
49710
50107
|
);
|
|
50108
|
+
const nextRowHeights = {};
|
|
49711
50109
|
resize.rowHeightsPx.forEach((heightPx, index) => {
|
|
49712
|
-
|
|
49713
|
-
|
|
50110
|
+
nextRowHeights[index] = Math.max(
|
|
50111
|
+
MIN_TABLE_SIZE_PT,
|
|
50112
|
+
pxToPt(heightPx * scaleY)
|
|
50113
|
+
);
|
|
49714
50114
|
});
|
|
49715
|
-
return next;
|
|
50115
|
+
return setTableRowHeights(next, resize.tableId, nextRowHeights);
|
|
49716
50116
|
}
|
|
49717
50117
|
function createEditorTableCornerResize(deps) {
|
|
49718
50118
|
const [resizing, setResizing] = createSignal(
|
|
49719
50119
|
null
|
|
49720
50120
|
);
|
|
50121
|
+
let resizeFrameHandle = null;
|
|
50122
|
+
let resizePendingPoint = null;
|
|
50123
|
+
const cursorOwner = {};
|
|
49721
50124
|
const previewRect = () => {
|
|
49722
50125
|
const current = resizing();
|
|
49723
50126
|
if (!current) return null;
|
|
@@ -49730,19 +50133,40 @@ function createEditorTableCornerResize(deps) {
|
|
|
49730
50133
|
};
|
|
49731
50134
|
};
|
|
49732
50135
|
const handleWindowMouseMove = (event) => {
|
|
50136
|
+
if (!resizing()) return;
|
|
50137
|
+
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50138
|
+
if (resizeFrameHandle === null) {
|
|
50139
|
+
resizeFrameHandle = scheduleAnimationFrame(processResizeFrame);
|
|
50140
|
+
}
|
|
50141
|
+
};
|
|
50142
|
+
const processResizeFrame = () => {
|
|
50143
|
+
resizeFrameHandle = null;
|
|
50144
|
+
const point = resizePendingPoint;
|
|
50145
|
+
resizePendingPoint = null;
|
|
50146
|
+
if (!point) return;
|
|
49733
50147
|
setResizing(
|
|
49734
50148
|
(current) => current ? {
|
|
49735
50149
|
...current,
|
|
49736
|
-
currentClientX:
|
|
49737
|
-
currentClientY:
|
|
50150
|
+
currentClientX: point.clientX,
|
|
50151
|
+
currentClientY: point.clientY
|
|
49738
50152
|
} : null
|
|
49739
50153
|
);
|
|
49740
50154
|
};
|
|
49741
50155
|
const stop = () => {
|
|
50156
|
+
resizePendingPoint = null;
|
|
50157
|
+
if (resizeFrameHandle !== null) {
|
|
50158
|
+
cancelScheduledAnimationFrame(resizeFrameHandle);
|
|
50159
|
+
resizeFrameHandle = null;
|
|
50160
|
+
}
|
|
49742
50161
|
setResizing(null);
|
|
49743
50162
|
window.removeEventListener("mousemove", handleWindowMouseMove);
|
|
49744
50163
|
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
49745
|
-
|
|
50164
|
+
if (tableCornerResizeCursorOwner === cursorOwner) {
|
|
50165
|
+
tableCornerResizeCursorOwner = null;
|
|
50166
|
+
if (document.body.style.cursor === "nwse-resize") {
|
|
50167
|
+
document.body.style.cursor = "";
|
|
50168
|
+
}
|
|
50169
|
+
}
|
|
49746
50170
|
};
|
|
49747
50171
|
const handleWindowMouseUp = (event) => {
|
|
49748
50172
|
const current = resizing();
|
|
@@ -49806,14 +50230,16 @@ function createEditorTableCornerResize(deps) {
|
|
|
49806
50230
|
totalWidthPt,
|
|
49807
50231
|
rowHeightsPx
|
|
49808
50232
|
});
|
|
50233
|
+
tableCornerResizeCursorOwner = cursorOwner;
|
|
49809
50234
|
document.body.style.cursor = "nwse-resize";
|
|
49810
50235
|
window.addEventListener("mousemove", handleWindowMouseMove);
|
|
49811
50236
|
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
49812
50237
|
event.preventDefault();
|
|
49813
50238
|
event.stopPropagation();
|
|
49814
50239
|
};
|
|
49815
|
-
return { resizing, previewRect, handleMouseDown };
|
|
50240
|
+
return { resizing, previewRect, handleMouseDown, stop };
|
|
49816
50241
|
}
|
|
50242
|
+
let tableDragCursorOwner = null;
|
|
49817
50243
|
function createEditorTableDrag(deps) {
|
|
49818
50244
|
return createEditorTableDragImpl(deps);
|
|
49819
50245
|
}
|
|
@@ -49826,30 +50252,43 @@ function createEditorTableDragImpl(deps) {
|
|
|
49826
50252
|
const [startClientY, setStartClientY] = createSignal(0);
|
|
49827
50253
|
const [startClientX, setStartClientX] = createSignal(0);
|
|
49828
50254
|
const [mousePos, setMousePos] = createSignal({ x: 0, y: 0 });
|
|
50255
|
+
let dragFrameHandle = null;
|
|
50256
|
+
let dragPendingPoint = null;
|
|
50257
|
+
const cursorOwner = {};
|
|
50258
|
+
const positionsEqual = (left, right) => left === right || left !== null && right !== null && left.paragraphId === right.paragraphId && left.runId === right.runId && left.offset === right.offset;
|
|
50259
|
+
const updateDropTarget = (next) => {
|
|
50260
|
+
setDropTargetPos(
|
|
50261
|
+
(current) => positionsEqual(current, next) ? current : next
|
|
50262
|
+
);
|
|
50263
|
+
};
|
|
49829
50264
|
const stopDrag = () => {
|
|
50265
|
+
dragPendingPoint = null;
|
|
50266
|
+
if (dragFrameHandle !== null) {
|
|
50267
|
+
cancelScheduledAnimationFrame(dragFrameHandle);
|
|
50268
|
+
dragFrameHandle = null;
|
|
50269
|
+
}
|
|
49830
50270
|
setDragging(false);
|
|
49831
50271
|
setDraggedTableInfo(null);
|
|
49832
50272
|
setDropTargetPos(null);
|
|
49833
50273
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
49834
50274
|
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;
|
|
50275
|
+
if (tableDragCursorOwner === cursorOwner) {
|
|
50276
|
+
tableDragCursorOwner = null;
|
|
50277
|
+
if (document.body.style.cursor === "grabbing") {
|
|
50278
|
+
document.body.style.cursor = "";
|
|
49847
50279
|
}
|
|
49848
50280
|
}
|
|
49849
|
-
|
|
50281
|
+
};
|
|
50282
|
+
const processDragFrame = () => {
|
|
50283
|
+
var _a;
|
|
50284
|
+
dragFrameHandle = null;
|
|
50285
|
+
const point = dragPendingPoint;
|
|
50286
|
+
dragPendingPoint = null;
|
|
50287
|
+
if (!point || !dragging()) return;
|
|
50288
|
+
setMousePos({ x: point.clientX, y: point.clientY });
|
|
49850
50289
|
const pos = deps.resolvePositionAtSurfacePoint(
|
|
49851
|
-
|
|
49852
|
-
|
|
50290
|
+
point.clientX,
|
|
50291
|
+
point.clientY
|
|
49853
50292
|
);
|
|
49854
50293
|
const tableId = (_a = draggedTableInfo()) == null ? void 0 : _a.tableId;
|
|
49855
50294
|
if (pos && tableId) {
|
|
@@ -49863,12 +50302,25 @@ function createEditorTableDragImpl(deps) {
|
|
|
49863
50302
|
const blocks = getEditableBlocksForZone(state, location.zone);
|
|
49864
50303
|
const tableBlock = blocks[location.blockIndex];
|
|
49865
50304
|
if (tableBlock && tableBlock.type === "table" && tableBlock.id === tableId) {
|
|
49866
|
-
|
|
50305
|
+
updateDropTarget(null);
|
|
49867
50306
|
return;
|
|
49868
50307
|
}
|
|
49869
50308
|
}
|
|
49870
50309
|
}
|
|
49871
|
-
|
|
50310
|
+
updateDropTarget(pos);
|
|
50311
|
+
};
|
|
50312
|
+
const handleMouseMove = (event) => {
|
|
50313
|
+
if (!dragging()) {
|
|
50314
|
+
const delta = Math.abs(event.clientY - startClientY());
|
|
50315
|
+
if (delta <= 4) return;
|
|
50316
|
+
setDragging(true);
|
|
50317
|
+
tableDragCursorOwner = cursorOwner;
|
|
50318
|
+
document.body.style.cursor = "grabbing";
|
|
50319
|
+
}
|
|
50320
|
+
dragPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
50321
|
+
if (dragFrameHandle === null) {
|
|
50322
|
+
dragFrameHandle = scheduleAnimationFrame(processDragFrame);
|
|
50323
|
+
}
|
|
49872
50324
|
};
|
|
49873
50325
|
const handleMouseUp = (event) => {
|
|
49874
50326
|
const info = draggedTableInfo();
|
|
@@ -49935,7 +50387,8 @@ function createEditorTableDragImpl(deps) {
|
|
|
49935
50387
|
draggedTableInfo,
|
|
49936
50388
|
mousePos,
|
|
49937
50389
|
dropTargetPos,
|
|
49938
|
-
handleMouseDown
|
|
50390
|
+
handleMouseDown,
|
|
50391
|
+
stop: stopDrag
|
|
49939
50392
|
};
|
|
49940
50393
|
}
|
|
49941
50394
|
function isWordCharacter(char) {
|
|
@@ -53092,6 +53545,7 @@ function connectEditorClientHost(controller, deps) {
|
|
|
53092
53545
|
deps.resetEditorChromeState();
|
|
53093
53546
|
deps.focusInput();
|
|
53094
53547
|
},
|
|
53548
|
+
applyTransactionalState: deps.applyTransactionalState,
|
|
53095
53549
|
resetDocument: () => {
|
|
53096
53550
|
deps.applyState(createInitialEditorState());
|
|
53097
53551
|
deps.resetEditorChromeState();
|
|
@@ -53118,7 +53572,16 @@ function connectEditorClientHost(controller, deps) {
|
|
|
53118
53572
|
clearHistory: () => deps.clearHistory(),
|
|
53119
53573
|
importDocx: (file) => deps.docIO.handleImportFile(file),
|
|
53120
53574
|
exportDocx: () => Promise.resolve(deps.docIO.handleExportDocx()),
|
|
53121
|
-
exportPdf: () => Promise.resolve(deps.docIO.handleExportPdf())
|
|
53575
|
+
exportPdf: () => Promise.resolve(deps.docIO.handleExportPdf()),
|
|
53576
|
+
exportDocxBlob: () => deps.docIO.exportDocxBlob(),
|
|
53577
|
+
exportPdfBlob: () => deps.docIO.exportPdfBlob(),
|
|
53578
|
+
getUiState: deps.getUiState,
|
|
53579
|
+
updateUiState: deps.updateUiState,
|
|
53580
|
+
getZoom: deps.getZoom,
|
|
53581
|
+
setZoom: deps.setZoom,
|
|
53582
|
+
adjustZoom: deps.adjustZoom,
|
|
53583
|
+
toolbarRegistry: deps.toolbarRegistry,
|
|
53584
|
+
menuRegistry: deps.menuRegistry
|
|
53122
53585
|
});
|
|
53123
53586
|
}
|
|
53124
53587
|
function createCommandBuilder(isCommandEnabled) {
|
|
@@ -54503,10 +54966,10 @@ function buildEssentialsTable(options) {
|
|
|
54503
54966
|
return table && table.type === "table" ? table : null;
|
|
54504
54967
|
};
|
|
54505
54968
|
const rawTblLookIn = (state) => {
|
|
54506
|
-
var _a;
|
|
54507
54969
|
const table = selectedTableIn(state);
|
|
54508
54970
|
if (!table) return null;
|
|
54509
|
-
|
|
54971
|
+
const effective = resolveEffectiveTableStyle(table, state.document.styles);
|
|
54972
|
+
return { ...RAW_TBL_LOOK_DEFAULTS, ...effective.tblLook ?? {} };
|
|
54510
54973
|
};
|
|
54511
54974
|
const selectionLabel = () => {
|
|
54512
54975
|
const normalized = normalizeSelection(options.state());
|
|
@@ -55325,12 +55788,20 @@ function createEditorCommandRuntimeImpl(deps) {
|
|
|
55325
55788
|
getStateSnapshot: deps.getStateSnapshot,
|
|
55326
55789
|
cloneState: deps.cloneState,
|
|
55327
55790
|
applyState: deps.applyState,
|
|
55791
|
+
applyTransactionalState: doc.applyTransactionalState,
|
|
55328
55792
|
resetEditorChromeState: doc.resetEditorChromeState,
|
|
55329
55793
|
focusInput: deps.focusInput,
|
|
55330
55794
|
setFocused: deps.setFocused,
|
|
55331
55795
|
clearHistory: doc.clearHistory,
|
|
55332
55796
|
getPersistence: () => deps.documentOptions().persistence ?? doc.fallbackPersistence,
|
|
55333
|
-
docIO: doc.docIO
|
|
55797
|
+
docIO: doc.docIO,
|
|
55798
|
+
getUiState: deps.getUiState,
|
|
55799
|
+
updateUiState: deps.updateUiState,
|
|
55800
|
+
getZoom: deps.zoom.zoomPercent,
|
|
55801
|
+
setZoom: deps.zoom.setZoomPercent,
|
|
55802
|
+
adjustZoom: deps.zoom.adjustZoom,
|
|
55803
|
+
toolbarRegistry,
|
|
55804
|
+
menuRegistry
|
|
55334
55805
|
});
|
|
55335
55806
|
createEffect(() => {
|
|
55336
55807
|
if (!runtimeReady()) return;
|
|
@@ -55375,8 +55846,24 @@ var _tmpl$ = /* @__PURE__ */ template(`<div class="oasis-editor-shell oasis-edit
|
|
|
55375
55846
|
function OasisEditorApp(props = {}) {
|
|
55376
55847
|
var _a;
|
|
55377
55848
|
const runtimeClient = ((_a = props.runtime) == null ? void 0 : _a.client) ?? createOasisEditorClient();
|
|
55378
|
-
const
|
|
55379
|
-
const
|
|
55849
|
+
const [uiOverrides] = createSignal({});
|
|
55850
|
+
const ui = () => {
|
|
55851
|
+
var _a2;
|
|
55852
|
+
return {
|
|
55853
|
+
...props.ui ?? {},
|
|
55854
|
+
...uiOverrides(),
|
|
55855
|
+
toolbar: {
|
|
55856
|
+
...((_a2 = props.ui) == null ? void 0 : _a2.toolbar) ?? {},
|
|
55857
|
+
...uiOverrides().toolbar ?? {}
|
|
55858
|
+
}
|
|
55859
|
+
};
|
|
55860
|
+
};
|
|
55861
|
+
const documentOptions = () => ({
|
|
55862
|
+
...props.document ?? {},
|
|
55863
|
+
...uiOverrides().readOnly === void 0 ? {} : {
|
|
55864
|
+
readOnly: uiOverrides().readOnly
|
|
55865
|
+
}
|
|
55866
|
+
});
|
|
55380
55867
|
const runtimeOptions = () => props.runtime ?? {};
|
|
55381
55868
|
syncCanvasDebugApiVisibility();
|
|
55382
55869
|
const translator = createTranslator(() => ui().locale ?? "pt-BR");
|
|
@@ -55555,7 +56042,6 @@ function OasisEditorApp(props = {}) {
|
|
|
55555
56042
|
commandsController,
|
|
55556
56043
|
runtimeReady,
|
|
55557
56044
|
runtimeEditor,
|
|
55558
|
-
commandStateOf,
|
|
55559
56045
|
toolbarHost,
|
|
55560
56046
|
toolbarRegistry,
|
|
55561
56047
|
menuRegistry,
|
|
@@ -55670,6 +56156,9 @@ function OasisEditorApp(props = {}) {
|
|
|
55670
56156
|
onCleanupHook();
|
|
55671
56157
|
surfaceEventsWithTextDrag.stopDragging();
|
|
55672
56158
|
textDrag.stopDrag();
|
|
56159
|
+
tableResize.stop();
|
|
56160
|
+
tableCornerResize.stop();
|
|
56161
|
+
tableDrag.stop();
|
|
55673
56162
|
imageOps.stopImageDrag();
|
|
55674
56163
|
imageOps.stopImageResize();
|
|
55675
56164
|
imageOps.stopImageCrop();
|
|
@@ -55744,8 +56233,7 @@ function OasisEditorApp(props = {}) {
|
|
|
55744
56233
|
runtimeEditor,
|
|
55745
56234
|
persistenceStatus,
|
|
55746
56235
|
toolbarRegistry,
|
|
55747
|
-
menuRegistry
|
|
55748
|
-
showFloatingTableToolbar: () => !isReadOnly() && commandStateOf("tableContext").value !== null
|
|
56236
|
+
menuRegistry
|
|
55749
56237
|
},
|
|
55750
56238
|
chrome: {
|
|
55751
56239
|
showChrome,
|