oasis-editor 0.0.120 → 0.0.122

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.
Files changed (93) hide show
  1. package/dist/{OasisEditorApp-1pwk-3zw.js → OasisEditorApp-Dwc5ee9G.js} +1995 -920
  2. package/dist/adapters/vue.d.ts +5 -4
  3. package/dist/app/controllers/EditorCommandsController.d.ts +3 -1
  4. package/dist/app/controllers/tableOpsCellSpanCommands.d.ts +2 -1
  5. package/dist/app/controllers/tableOpsGuards.d.ts +2 -1
  6. package/dist/app/controllers/tableOpsRowColumnCommands.d.ts +2 -1
  7. package/dist/app/controllers/tableOpsSelectionAwareCommands.d.ts +2 -1
  8. package/dist/app/controllers/tableOpsSelectionRanges.d.ts +2 -1
  9. package/dist/app/controllers/useEditorClipboard.d.ts +3 -1
  10. package/dist/app/controllers/useEditorDocumentIO.d.ts +2 -1
  11. package/dist/app/controllers/useEditorHistoryActions.d.ts +3 -1
  12. package/dist/app/controllers/useEditorImageOperations.d.ts +7 -7
  13. package/dist/app/controllers/useEditorKeyboard.d.ts +2 -1
  14. package/dist/app/controllers/useEditorLayout.d.ts +4 -3
  15. package/dist/app/controllers/useEditorNavigation.d.ts +3 -1
  16. package/dist/app/controllers/useEditorRevision.d.ts +3 -1
  17. package/dist/app/controllers/useEditorStyle.d.ts +2 -1
  18. package/dist/app/controllers/useEditorSurfaceEvents.d.ts +3 -1
  19. package/dist/app/controllers/useEditorTableDrag.d.ts +7 -0
  20. package/dist/app/controllers/useEditorTableOperations.d.ts +3 -1
  21. package/dist/app/controllers/useEditorTextBoxOperations.d.ts +3 -1
  22. package/dist/app/controllers/useEditorTextDrag.d.ts +3 -1
  23. package/dist/app/controllers/useEditorTextInput.d.ts +3 -1
  24. package/dist/assets/{importDocxWorker-nIS-zjkj.js → importDocxWorker-A73eR_fM.js} +1 -1
  25. package/dist/core/model/types/styles.d.ts +2 -0
  26. package/dist/core/textStyle/textStyleKeys.d.ts +1 -1
  27. package/dist/i18n/locales/en.d.ts +42 -0
  28. package/dist/i18n/locales/pt-BR.d.ts +42 -0
  29. package/dist/{index-rlmjHSGT.js → index-YMlNF1Ya.js} +757 -466
  30. package/dist/oasis-editor.css +1 -1
  31. package/dist/oasis-editor.js +71 -71
  32. package/dist/oasis-editor.umd.cjs +4 -4
  33. package/dist/ui/OasisEditorApp.d.ts +2 -1
  34. package/dist/ui/OasisEditorAppLazy.d.ts +2 -1
  35. package/dist/ui/OasisEditorContainer.d.ts +2 -1
  36. package/dist/ui/app/EditorDialogsLayer.d.ts +3 -2
  37. package/dist/ui/app/EditorDragLayers.d.ts +2 -1
  38. package/dist/ui/app/EditorWorkspace.d.ts +2 -2
  39. package/dist/ui/app/createAppCommandsController.d.ts +2 -1
  40. package/dist/ui/app/createEditorChrome.d.ts +3 -1
  41. package/dist/ui/app/createEditorCommandRuntime.d.ts +2 -1
  42. package/dist/ui/app/createEditorDocumentRuntime.d.ts +2 -1
  43. package/dist/ui/app/createEditorEssentialsPlugin.d.ts +2 -1
  44. package/dist/ui/app/createEditorInteractionRuntime.d.ts +6 -7
  45. package/dist/ui/app/useEditorAppState.d.ts +2 -1
  46. package/dist/ui/app/useEditorContextMenuClipboard.d.ts +2 -1
  47. package/dist/ui/app/useEditorDialogs.d.ts +18 -16
  48. package/dist/ui/app/useEditorFocus.d.ts +7 -4
  49. package/dist/ui/app/useEditorFontOptions.d.ts +3 -1
  50. package/dist/ui/app/useEditorTransactions.d.ts +3 -1
  51. package/dist/ui/app/useEditorUiOptions.d.ts +3 -3
  52. package/dist/ui/app/useParagraphDialogBridge.d.ts +1 -0
  53. package/dist/ui/components/CanvasEditorSurface.d.ts +2 -1
  54. package/dist/ui/components/CaretOverlay.d.ts +3 -1
  55. package/dist/ui/components/CommentHighlightOverlay.d.ts +2 -2
  56. package/dist/ui/components/ContextMenu/ContextMenu.d.ts +2 -1
  57. package/dist/ui/components/Dialogs/FontDialog.d.ts +2 -1
  58. package/dist/ui/components/Dialogs/ImageAltDialog.d.ts +3 -1
  59. package/dist/ui/components/Dialogs/ImageCaptionDialog.d.ts +3 -1
  60. package/dist/ui/components/Dialogs/LineSpacingDialog.d.ts +3 -1
  61. package/dist/ui/components/Dialogs/LinkDialog.d.ts +3 -1
  62. package/dist/ui/components/Dialogs/ParagraphDialog.d.ts +25 -2
  63. package/dist/ui/components/Dialogs/TabStopsDialog.d.ts +10 -0
  64. package/dist/ui/components/Dialogs/TablePropertiesDialog.d.ts +2 -1
  65. package/dist/ui/components/Dialogs/TextInputDialog.d.ts +3 -1
  66. package/dist/ui/components/Dialogs/font-dialog/AdvancedFontTab.d.ts +2 -1
  67. package/dist/ui/components/Dialogs/font-dialog/FontPreview.d.ts +3 -1
  68. package/dist/ui/components/Dialogs/table-properties/AltTextTabPanel.d.ts +2 -1
  69. package/dist/ui/components/Dialogs/table-properties/CellTabPanel.d.ts +2 -1
  70. package/dist/ui/components/Dialogs/table-properties/ColumnTabPanel.d.ts +2 -1
  71. package/dist/ui/components/Dialogs/table-properties/RowTabPanel.d.ts +2 -1
  72. package/dist/ui/components/Dialogs/table-properties/TableTabPanel.d.ts +2 -1
  73. package/dist/ui/components/DropCaret.d.ts +2 -1
  74. package/dist/ui/components/FindReplace/FindReplaceDialog.d.ts +2 -1
  75. package/dist/ui/components/Menubar/Menubar.d.ts +2 -1
  76. package/dist/ui/components/Outline/OutlinePanel.d.ts +2 -1
  77. package/dist/ui/components/PageBreak.d.ts +3 -1
  78. package/dist/ui/components/RevisionOverlay.d.ts +2 -1
  79. package/dist/ui/components/Ruler/HorizontalRuler.d.ts +2 -2
  80. package/dist/ui/components/SelectionOverlay.d.ts +3 -1
  81. package/dist/ui/components/Toolbar/LineSpacingButton.d.ts +2 -1
  82. package/dist/ui/components/Toolbar/groups/MetricGroup.d.ts +2 -1
  83. package/dist/ui/components/Toolbar/groups/TableGroup.d.ts +2 -1
  84. package/dist/ui/components/Toolbar/ribbon/RibbonRow.d.ts +2 -1
  85. package/dist/ui/components/Toolbar/ribbon/RibbonTabs.d.ts +2 -2
  86. package/dist/ui/components/WelcomeOverlay.d.ts +3 -1
  87. package/dist/ui/overlays/ResizeHandlesOverlay.d.ts +2 -1
  88. package/dist/ui/shells/BalloonShell.d.ts +2 -1
  89. package/dist/ui/shells/DocumentShell.d.ts +2 -2
  90. package/dist/ui/shells/InlineShell.d.ts +2 -1
  91. package/dist/ui/toolbarStyleState.d.ts +9 -2
  92. package/dist/vue.d.ts +5 -4
  93. package/package.json +1 -1
@@ -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 findParagraphTableLocation, R as buildTableCellLayout, T as PT_PER_PX, U as createEditorTableCell, V as createEditorTableRow, W as createEditorTable, X as PX_PER_POINT, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as Button, aj as useI18n, ak as createEffect, al as TextField, am as Dialog, an as insert, ao as className, ap as Grid, aq as SelectField, ar as StatusText, as as ColorField, at as UNDERLINE_STYLE_OPTIONS, au as Stack, av as For, aw as ToggleChip, ax as FormField, ay as Checkbox, az as FieldGroup, aA as Tabs, aB as NumberField, aC as createStore, aD as reconcile, aE as RadioGroup, aF as Radio$1, aG as TextAreaField, aH as Text, aI as SurfaceButton, aJ as delegateEvents, aK as onMount, aL as onCleanup, aM as use, aN as PluginUiHost, aO as OasisEditorEditor, aP as OasisBrandMark, aQ as setPreciseFontPreference, aR as setWelcomeSeen, aS as enablePreciseFontMode, aT as TWIPS_PER_POINT, aU as PX_PER_INCH, aV as TWIPS_PER_INCH, aW as normalizeHex6, aX as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aY as TABLE_BORDER_EDGE_KEYS, aZ as resolveEffectiveParagraphStyle, a_ as resolveEffectiveTextStyleForParagraph, a$ as EMU_PER_PT, b0 as OOXML_ROTATION_UNITS, b1 as OOXML_PERCENT_DENOMINATOR, b2 as parseHexColorToRgb255, b3 as EMU_PER_PX, b4 as getRunEndnoteReference, b5 as iterateFootnoteReferenceRuns, b6 as iterateEndnoteReferenceRuns, b7 as imageContentTypeDefaults, b8 as getRunFieldChar, b9 as getRunFieldInstruction, ba as createEditorRun, bb as JSZip, bc as imageExtensionFromMime, bd as pxToPt$1, be as resolveFloatingObjectRect, bf as getTextBoxFloatingGeometry, bg as getPresetPathSegments, bh as buildListLabels, bi as DEFAULT_FONT_SIZE_PX, bj as resolveGradientAxis, bk as isDoubleUnderlineStyle, bl as isWavyUnderlineStyle, bm as underlineStyleLineWidthPx, bn as WAVY_UNDERLINE_WAVELENGTH_PX, bo as WAVY_UNDERLINE_AMPLITUDE_PX, bp as DOUBLE_UNDERLINE_OFFSET_PX, bq as underlineStyleDashArray, br as EMPHASIS_GLYPH, bs as rgb255ToHex, bt as getImageFloatingGeometry, bu as textStyleToFontSizePt, bv as TEXT_BASELINE_RATIO, bw as resolveOpenTypeFeatureTags, bx as resolveDecorationLineY, by as DOUBLE_STRIKE_OFFSET_PX, bz as resolveListLabel, bA as getListLabelInset, bB as getAlignedListLabelInset, bC as getParagraphBorderInsets, bD as buildSegmentTable, bE as buildCanvasTableLayout, bF as resolveCanvasTableWidth, bG as resolveFloatingTableRect, bH as normalizeFamily, bI as ROBOTO_FONT_FILES, bJ as loadFontAsset, bK as OFFICE_COMPAT_FONT_FAMILIES, bL as BinaryReader, bM as buildSfnt, bN as defaultFontDecoderRegistry, bO as SfntFontProgram, bP as collectPdfFontFamilies, bQ as outlineFrom, bR as getPageHeaderZoneTop, bS as getPageColumnRects, bT as findFootnoteReference, bU as resolveImporterForFile, bV as roundTo, bW as getDocumentSectionsCanonical, bX as getDocumentParagraphsCanonical, bY as getDocumentParagraphs, bZ as getDocumentPageSettings, b_ as getTableCellContentWidthForParagraph, b$ as layoutMetricsEpoch, c0 as bumpLayoutMetricsEpoch, c1 as createCanvasLayoutSnapshotProvider, c2 as on, c3 as debounce, c4 as unwrap, c5 as perfTimer, c6 as getRunTextBox, c7 as createEditorDocument, c8 as resolveResizedDimensions, c9 as resolveTextBoxRenderHeight, ca as getToolbarStyleState, cb as VERTICAL_HIT_WEIGHT, cc as getCachedCanvasImage, cd as measureParagraphMinContentWidthPx, ce as getEditableBlocksForZone, cf as findParagraphLocation, cg as createSectionBoundaryParagraph, ch as normalizePageSettings, ci as DEFAULT_EDITOR_PAGE_SETTINGS, cj as markStart, ck as markEnd, cl as getParagraphEntries, cm as getParagraphById, cn as createEditorFootnote, co as createFootnoteReferenceRun, cp as renumberFootnotes, cq as getHeadingLevel, cr as preciseFontModeVersion, cs as isPreciseFontModeEnabled, ct as resolveNamedTextStyle, cu as togglePreciseFontMode, cv as nextFontSizePt, cw as previousFontSizePt, cx as fontSizePtToPx, cy as createDefaultToolbarPreset, cz as MenuRegistry, cA as createToolbarRegistry, cB as Editor, cC as resolveCommandRef, cD as commandRefName, cE as createOasisEditorClient, cF as createEditorZoom, cG as startLongTaskObserver, cH as installGlobalReport, cI as applyStoredPreciseFontPreference, cJ as getWelcomeSeen, cK as isLocalFontAccessSupported, cL as EDITOR_SCROLL_PADDING_PX, cM as Toolbar, cN as OasisEditorLoading, cO as I18nProvider, cP as createTranslator, cQ as createEditorLogger, cR as registerDomStatsSurface } from "./index-rlmjHSGT.js";
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 setAttribute, ag as setStyleProperty, 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 createStore, aE as reconcile, aF as RadioGroup, aG as Radio$1, aH as TextAreaField, aI as Text, aJ as SurfaceButton, aK as delegateEvents, aL as onMount, aM as onCleanup, aN as use, aO as PluginUiHost, aP as OasisEditorEditor, aQ as OasisBrandMark, aR as setPreciseFontPreference, aS as setWelcomeSeen, aT as enablePreciseFontMode, aU as TWIPS_PER_POINT, aV as PX_PER_INCH, aW as TWIPS_PER_INCH, aX as normalizeHex6, aY as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aZ as TABLE_BORDER_EDGE_KEYS, a_ as resolveEffectiveParagraphStyle, a$ as resolveEffectiveTextStyleForParagraph, b0 as EMU_PER_PT, b1 as OOXML_ROTATION_UNITS, b2 as OOXML_PERCENT_DENOMINATOR, b3 as parseHexColorToRgb255, b4 as EMU_PER_PX, b5 as getRunEndnoteReference, b6 as iterateFootnoteReferenceRuns, b7 as iterateEndnoteReferenceRuns, b8 as imageContentTypeDefaults, b9 as getRunFieldChar, ba as getRunFieldInstruction, bb as createEditorRun, bc as JSZip, bd as imageExtensionFromMime, be as pxToPt$1, bf as resolveFloatingObjectRect, bg as getTextBoxFloatingGeometry, bh as getPresetPathSegments, bi as buildListLabels, bj as DEFAULT_FONT_SIZE_PX, bk as resolveGradientAxis, bl as isDoubleUnderlineStyle, bm as isWavyUnderlineStyle, bn as underlineStyleLineWidthPx, bo as WAVY_UNDERLINE_WAVELENGTH_PX, bp as WAVY_UNDERLINE_AMPLITUDE_PX, bq as DOUBLE_UNDERLINE_OFFSET_PX, br as underlineStyleDashArray, bs as EMPHASIS_GLYPH, bt as rgb255ToHex, bu as getImageFloatingGeometry, bv as textStyleToFontSizePt, bw as TEXT_BASELINE_RATIO, bx as resolveOpenTypeFeatureTags, by as resolveDecorationLineY, bz as DOUBLE_STRIKE_OFFSET_PX, bA as resolveListLabel, bB as getListLabelInset, bC as getAlignedListLabelInset, bD as getParagraphBorderInsets, bE as buildSegmentTable, bF as buildCanvasTableLayout, bG as resolveCanvasTableWidth, bH as resolveFloatingTableRect, bI as normalizeFamily, bJ as ROBOTO_FONT_FILES, bK as loadFontAsset, bL as OFFICE_COMPAT_FONT_FAMILIES, bM as BinaryReader, bN as buildSfnt, bO as defaultFontDecoderRegistry, bP as SfntFontProgram, bQ as collectPdfFontFamilies, bR as outlineFrom, bS as getPageHeaderZoneTop, bT as getPageColumnRects, bU as findFootnoteReference, bV as resolveImporterForFile, bW as roundTo, bX as getDocumentSectionsCanonical, bY as getDocumentParagraphsCanonical, bZ as getDocumentParagraphs, b_ as getDocumentPageSettings, b$ as getTableCellContentWidthForParagraph, c0 as layoutMetricsEpoch, c1 as bumpLayoutMetricsEpoch, c2 as createCanvasLayoutSnapshotProvider, c3 as on, c4 as debounce, c5 as unwrap, c6 as perfTimer, c7 as getRunTextBox, c8 as createEditorDocument, c9 as resolveResizedDimensions, ca as resolveTextBoxRenderHeight, cb as getToolbarStyleState, cc as VERTICAL_HIT_WEIGHT, cd as getCachedCanvasImage, ce as measureParagraphMinContentWidthPx, cf as getEditableBlocksForZone, cg as findParagraphLocation, ch as createSectionBoundaryParagraph, ci as normalizePageSettings, cj as DEFAULT_EDITOR_PAGE_SETTINGS, ck as markStart, cl as markEnd, cm as getParagraphEntries, cn as getParagraphById, co as createEditorFootnote, cp as createFootnoteReferenceRun, cq as renumberFootnotes, cr as getHeadingLevel, cs as preciseFontModeVersion, ct as isPreciseFontModeEnabled, cu as resolveNamedTextStyle, cv as togglePreciseFontMode, cw as nextFontSizePt, cx as previousFontSizePt, cy as fontSizePtToPx, cz as createDefaultToolbarPreset, cA as MenuRegistry, cB as createToolbarRegistry, cC as Editor, cD as resolveCommandRef, cE as commandRefName, cF as createOasisEditorClient, cG as createEditorZoom, cH as startLongTaskObserver, cI as installGlobalReport, cJ as applyStoredPreciseFontPreference, cK as getWelcomeSeen, cL as isLocalFontAccessSupported, cM as EDITOR_SCROLL_PADDING_PX, cN as Toolbar, cO as OasisEditorLoading, cP as I18nProvider, cQ as createTranslator, cR as registerDomStatsSurface, cS as createEditorLogger } from "./index-YMlNF1Ya.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -287,7 +287,9 @@ function projectTallestHeaderVariant(section, contentWidth, projectHeaderFooterV
287
287
  section.header,
288
288
  section.firstPageHeader,
289
289
  section.evenPageHeader
290
- ].map((blocks) => projectHeaderFooterVariant(blocks, contentWidth)).filter((blocks) => !!blocks);
290
+ ].map(
291
+ (blocks) => projectHeaderFooterVariant(blocks, contentWidth)
292
+ ).filter((blocks) => !!blocks);
291
293
  return variants.sort(
292
294
  (a, b) => getProjectedBlocksHeight(b) - getProjectedBlocksHeight(a)
293
295
  )[0];
@@ -297,7 +299,9 @@ function projectTallestFooterVariant(section, contentWidth, projectHeaderFooterV
297
299
  section.footer,
298
300
  section.firstPageFooter,
299
301
  section.evenPageFooter
300
- ].map((blocks) => projectHeaderFooterVariant(blocks, contentWidth)).filter((blocks) => !!blocks);
302
+ ].map(
303
+ (blocks) => projectHeaderFooterVariant(blocks, contentWidth)
304
+ ).filter((blocks) => !!blocks);
301
305
  return variants.sort(
302
306
  (a, b) => getProjectedBlocksHeight(b) - getProjectedBlocksHeight(a)
303
307
  )[0];
@@ -528,13 +532,17 @@ function injectEndnotesIntoDocument(document2) {
528
532
  }
529
533
  function blockContainsNumPagesField(block) {
530
534
  if (block.type === "paragraph") {
531
- return block.runs.some((run) => {
532
- var _a2;
533
- return ((_a2 = getRunField(run)) == null ? void 0 : _a2.type) === "NUMPAGES";
534
- });
535
+ return block.runs.some(
536
+ (run) => {
537
+ var _a2;
538
+ return ((_a2 = getRunField(run)) == null ? void 0 : _a2.type) === "NUMPAGES";
539
+ }
540
+ );
535
541
  }
536
542
  return block.rows.some(
537
- (row) => row.cells.some((cell) => cell.blocks.some(blockContainsNumPagesField))
543
+ (row) => row.cells.some(
544
+ (cell) => cell.blocks.some(blockContainsNumPagesField)
545
+ )
538
546
  );
539
547
  }
540
548
  function documentContainsNumPagesField(document2) {
@@ -26895,12 +26903,14 @@ let lastLayoutSnapshot = null;
26895
26903
  let lastSelectionSnapshot = null;
26896
26904
  let missEvents = [];
26897
26905
  function cloneSlots(slots) {
26898
- return slots.map((slot) => ({
26899
- offset: slot.offset,
26900
- left: slot.left,
26901
- top: slot.top,
26902
- height: slot.height
26903
- }));
26906
+ return slots.map(
26907
+ (slot) => ({
26908
+ offset: slot.offset,
26909
+ left: slot.left,
26910
+ top: slot.top,
26911
+ height: slot.height
26912
+ })
26913
+ );
26904
26914
  }
26905
26915
  function cloneLines(lines) {
26906
26916
  return lines.map((line) => ({
@@ -27004,7 +27014,9 @@ function buildApi() {
27004
27014
  ...paragraph,
27005
27015
  lines: paragraph.lines.map((line) => ({
27006
27016
  ...line,
27007
- slots: line.slots.map((slot) => ({ ...slot }))
27017
+ slots: line.slots.map(
27018
+ (slot) => ({ ...slot })
27019
+ )
27008
27020
  })),
27009
27021
  tableCell: paragraph.tableCell ? { ...paragraph.tableCell } : void 0
27010
27022
  })),
@@ -27026,7 +27038,9 @@ function buildApi() {
27026
27038
  activeZone: lastSelectionSnapshot.activeZone,
27027
27039
  activeSectionIndex: lastSelectionSnapshot.activeSectionIndex
27028
27040
  } : null,
27029
- getMissEvents: () => missEvents.map((entry) => ({ ...entry })),
27041
+ getMissEvents: () => missEvents.map(
27042
+ (entry) => ({ ...entry })
27043
+ ),
27030
27044
  clearMissEvents: () => {
27031
27045
  missEvents = [];
27032
27046
  }
@@ -27207,9 +27221,13 @@ function createEditorDialogs() {
27207
27221
  indentRight: "",
27208
27222
  indentFirstLine: "",
27209
27223
  indentHanging: "",
27224
+ mirrorIndents: false,
27210
27225
  spacingBefore: "",
27211
27226
  spacingAfter: "",
27212
27227
  lineHeight: "",
27228
+ lineRule: "",
27229
+ contextualSpacing: false,
27230
+ outlineLevel: "",
27213
27231
  shading: "",
27214
27232
  borderStyle: "",
27215
27233
  borderWidth: "",
@@ -27217,7 +27235,12 @@ function createEditorDialogs() {
27217
27235
  borderSideTop: false,
27218
27236
  borderSideRight: false,
27219
27237
  borderSideBottom: false,
27220
- borderSideLeft: false
27238
+ borderSideLeft: false,
27239
+ pageBreakBefore: false,
27240
+ keepWithNext: false,
27241
+ keepLinesTogether: false,
27242
+ widowControl: true,
27243
+ tabs: []
27221
27244
  }
27222
27245
  });
27223
27246
  const [tablePropertiesDialog, setTablePropertiesDialog] = createSignal({
@@ -27419,6 +27442,9 @@ function computeFontSizeOptions(document2, toolbarStyleState) {
27419
27442
  return Array.from(values).sort((a, b) => a - b);
27420
27443
  }
27421
27444
  function createEditorFontOptions(ctx) {
27445
+ return createEditorFontOptionsImpl(ctx);
27446
+ }
27447
+ function createEditorFontOptionsImpl(ctx) {
27422
27448
  const [localFontFamilyOptions, setLocalFontFamilyOptions] = createSignal([]);
27423
27449
  const computeFontFamilyOptions$1 = () => computeFontFamilyOptions(
27424
27450
  ctx.state().document,
@@ -27947,23 +27973,25 @@ function deleteSelectionRange(state) {
27947
27973
  const revisionId = `rev:${Math.random().toString(36).slice(2, 9)}`;
27948
27974
  const author = "User";
27949
27975
  const date = Date.now();
27950
- const nextParagraphs2 = paragraphs.map((paragraph, paragraphIndex) => {
27951
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
27952
- return cloneParagraph(paragraph);
27953
- }
27954
- const startOffset2 = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
27955
- const endOffset2 = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
27956
- return mapRunsInRange(paragraph, startOffset2, endOffset2, (run) => {
27957
- var _a2;
27958
- if (((_a2 = run.revision) == null ? void 0 : _a2.type) === "insert") {
27959
- return { ...run, text: "" };
27976
+ const nextParagraphs2 = paragraphs.map(
27977
+ (paragraph, paragraphIndex) => {
27978
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
27979
+ return cloneParagraph(paragraph);
27960
27980
  }
27961
- return {
27962
- ...run,
27963
- revision: { id: revisionId, type: "delete", author, date }
27964
- };
27965
- });
27966
- });
27981
+ const startOffset2 = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
27982
+ const endOffset2 = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
27983
+ return mapRunsInRange(paragraph, startOffset2, endOffset2, (run) => {
27984
+ var _a2;
27985
+ if (((_a2 = run.revision) == null ? void 0 : _a2.type) === "insert") {
27986
+ return { ...run, text: "" };
27987
+ }
27988
+ return {
27989
+ ...run,
27990
+ revision: { id: revisionId, type: "delete", author, date }
27991
+ };
27992
+ });
27993
+ }
27994
+ );
27967
27995
  return cloneStateWithParagraphs(
27968
27996
  state,
27969
27997
  nextParagraphs2,
@@ -28256,7 +28284,12 @@ function insertPlainTextAtSelection(state, text, styleOverride) {
28256
28284
  );
28257
28285
  const lastParagraph = createParagraphFromRuns([
28258
28286
  { text: lines[lines.length - 1], styles: insertionStyles },
28259
- ...tailRuns.map((run) => ({ text: run.text, styles: run.styles }))
28287
+ ...tailRuns.map(
28288
+ (run) => ({
28289
+ text: run.text,
28290
+ styles: run.styles
28291
+ })
28292
+ )
28260
28293
  ]);
28261
28294
  const paragraphs = getParagraphs(collapsedState);
28262
28295
  const nextParagraphs = [
@@ -28506,21 +28539,25 @@ function toggleTextStyle(state, key) {
28506
28539
  if (touchedRuns.length === 0) {
28507
28540
  return state;
28508
28541
  }
28509
- const shouldEnable = !touchedRuns.every((run) => {
28510
- var _a2;
28511
- return Boolean((_a2 = run.styles) == null ? void 0 : _a2[key]);
28512
- });
28513
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
28514
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28515
- return paragraph;
28542
+ const shouldEnable = !touchedRuns.every(
28543
+ (run) => {
28544
+ var _a2;
28545
+ return Boolean((_a2 = run.styles) == null ? void 0 : _a2[key]);
28516
28546
  }
28517
- const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28518
- const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28519
- return mapRunsInRange(paragraph, startOffset, endOffset, (run) => ({
28520
- ...run,
28521
- styles: setBooleanStyle(run.styles, key, shouldEnable)
28522
- }));
28523
- });
28547
+ );
28548
+ const nextParagraphs = paragraphs.map(
28549
+ (paragraph, paragraphIndex) => {
28550
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28551
+ return paragraph;
28552
+ }
28553
+ const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28554
+ const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28555
+ return mapRunsInRange(paragraph, startOffset, endOffset, (run) => ({
28556
+ ...run,
28557
+ styles: setBooleanStyle(run.styles, key, shouldEnable)
28558
+ }));
28559
+ }
28560
+ );
28524
28561
  return cloneStateWithParagraphs(
28525
28562
  state,
28526
28563
  nextParagraphs,
@@ -28533,19 +28570,21 @@ function clearSelectedTextFormatting(state) {
28533
28570
  return state;
28534
28571
  }
28535
28572
  const paragraphs = getParagraphs(state);
28536
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
28537
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28538
- return paragraph;
28573
+ const nextParagraphs = paragraphs.map(
28574
+ (paragraph, paragraphIndex) => {
28575
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28576
+ return paragraph;
28577
+ }
28578
+ const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28579
+ const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28580
+ return mapRunsInRange(paragraph, startOffset, endOffset, (run) => {
28581
+ var _a2;
28582
+ const link = (_a2 = run.styles) == null ? void 0 : _a2.link;
28583
+ const styles = link != null && link !== "" ? { link } : {};
28584
+ return { ...run, styles };
28585
+ });
28539
28586
  }
28540
- const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28541
- const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28542
- return mapRunsInRange(paragraph, startOffset, endOffset, (run) => {
28543
- var _a2;
28544
- const link = (_a2 = run.styles) == null ? void 0 : _a2.link;
28545
- const styles = link != null && link !== "" ? { link } : {};
28546
- return { ...run, styles };
28547
- });
28548
- });
28587
+ );
28549
28588
  return cloneStateWithParagraphs(
28550
28589
  state,
28551
28590
  nextParagraphs,
@@ -28558,17 +28597,19 @@ function setTextStyleValue(state, key, value) {
28558
28597
  return state;
28559
28598
  }
28560
28599
  const paragraphs = getParagraphs(state);
28561
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
28562
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28563
- return paragraph;
28600
+ const nextParagraphs = paragraphs.map(
28601
+ (paragraph, paragraphIndex) => {
28602
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28603
+ return paragraph;
28604
+ }
28605
+ const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28606
+ const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28607
+ return mapRunsInRange(paragraph, startOffset, endOffset, (run) => ({
28608
+ ...run,
28609
+ styles: setValueStyle(run.styles, key, value)
28610
+ }));
28564
28611
  }
28565
- const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28566
- const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28567
- return mapRunsInRange(paragraph, startOffset, endOffset, (run) => ({
28568
- ...run,
28569
- styles: setValueStyle(run.styles, key, value)
28570
- }));
28571
- });
28612
+ );
28572
28613
  return cloneStateWithParagraphs(
28573
28614
  state,
28574
28615
  nextParagraphs,
@@ -28640,22 +28681,24 @@ function transformSelectedText(state, transform) {
28640
28681
  return state;
28641
28682
  }
28642
28683
  const paragraphs = getParagraphs(state);
28643
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
28644
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28645
- return paragraph;
28684
+ const nextParagraphs = paragraphs.map(
28685
+ (paragraph, paragraphIndex) => {
28686
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
28687
+ return paragraph;
28688
+ }
28689
+ const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28690
+ const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28691
+ const selectedText = sliceRuns(paragraph, startOffset, endOffset).map((run) => run.text).join("");
28692
+ const transformed = transform(selectedText);
28693
+ let cursor = 0;
28694
+ return mapRunsInRange(paragraph, startOffset, endOffset, (run) => {
28695
+ const length = run.text.length;
28696
+ const nextText = transformed.slice(cursor, cursor + length);
28697
+ cursor += length;
28698
+ return { ...run, text: nextText };
28699
+ });
28646
28700
  }
28647
- const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
28648
- const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
28649
- const selectedText = sliceRuns(paragraph, startOffset, endOffset).map((run) => run.text).join("");
28650
- const transformed = transform(selectedText);
28651
- let cursor = 0;
28652
- return mapRunsInRange(paragraph, startOffset, endOffset, (run) => {
28653
- const length = run.text.length;
28654
- const nextText = transformed.slice(cursor, cursor + length);
28655
- cursor += length;
28656
- return { ...run, text: nextText };
28657
- });
28658
- });
28701
+ );
28659
28702
  return cloneStateWithParagraphs(
28660
28703
  state,
28661
28704
  nextParagraphs,
@@ -28663,7 +28706,10 @@ function transformSelectedText(state, transform) {
28663
28706
  );
28664
28707
  }
28665
28708
  function changeSelectedTextCase(state, mode) {
28666
- return transformSelectedText(state, (text) => applyCaseTransform(text, mode));
28709
+ return transformSelectedText(
28710
+ state,
28711
+ (text) => applyCaseTransform(text, mode)
28712
+ );
28667
28713
  }
28668
28714
  function createInitialValues$1(styleState) {
28669
28715
  return {
@@ -28935,7 +28981,12 @@ function splitBlockAtSelection(state) {
28935
28981
  );
28936
28982
  const nextParagraph = secondRuns.length > 0 ? createParagraphFromRunsLike(
28937
28983
  paragraph,
28938
- secondRuns.map((run) => ({ text: run.text, styles: run.styles }))
28984
+ secondRuns.map(
28985
+ (run) => ({
28986
+ text: run.text,
28987
+ styles: run.styles
28988
+ })
28989
+ )
28939
28990
  ) : (() => {
28940
28991
  const emptyParagraph = createEditorParagraph("");
28941
28992
  emptyParagraph.style = paragraph.style ? { ...paragraph.style } : void 0;
@@ -28970,7 +29021,12 @@ function insertPageBreakAtSelection(state) {
28970
29021
  );
28971
29022
  const nextParagraph = secondRuns.length > 0 ? createParagraphFromRunsLike(
28972
29023
  paragraph,
28973
- secondRuns.map((run) => ({ text: run.text, styles: run.styles }))
29024
+ secondRuns.map(
29025
+ (run) => ({
29026
+ text: run.text,
29027
+ styles: run.styles
29028
+ })
29029
+ )
28974
29030
  ) : (() => {
28975
29031
  const emptyParagraph = createEditorParagraph("");
28976
29032
  emptyParagraph.style = paragraph.style ? { ...paragraph.style } : void 0;
@@ -29030,7 +29086,12 @@ function insertSectionBreakAtSelection(state, breakType) {
29030
29086
  );
29031
29087
  const secondParagraph = secondRuns.length > 0 ? createParagraphFromRunsLike(
29032
29088
  paragraph,
29033
- secondRuns.map((run) => ({ text: run.text, styles: run.styles }))
29089
+ secondRuns.map(
29090
+ (run) => ({
29091
+ text: run.text,
29092
+ styles: run.styles
29093
+ })
29094
+ )
29034
29095
  ) : (() => {
29035
29096
  const emptyParagraph = createEditorParagraph("");
29036
29097
  emptyParagraph.style = paragraph.style ? { ...paragraph.style } : void 0;
@@ -29101,21 +29162,53 @@ function setParagraphStyle(state, key, value) {
29101
29162
  const paragraphs = getParagraphs(state);
29102
29163
  const startIndex = normalized.startIndex;
29103
29164
  const endIndex = normalized.endIndex;
29104
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
29105
- if (paragraphIndex < startIndex || paragraphIndex > endIndex) {
29106
- return cloneParagraph(paragraph);
29165
+ const nextParagraphs = paragraphs.map(
29166
+ (paragraph, paragraphIndex) => {
29167
+ if (paragraphIndex < startIndex || paragraphIndex > endIndex) {
29168
+ return cloneParagraph(paragraph);
29169
+ }
29170
+ return {
29171
+ ...cloneParagraph(paragraph),
29172
+ style: setParagraphStyleValue(paragraph.style, key, value)
29173
+ };
29107
29174
  }
29108
- return {
29109
- ...cloneParagraph(paragraph),
29110
- style: setParagraphStyleValue(paragraph.style, key, value)
29111
- };
29112
- });
29175
+ );
29113
29176
  return cloneStateWithParagraphs(
29114
29177
  state,
29115
29178
  nextParagraphs,
29116
29179
  preserveSelectionByParagraphOffsets(nextParagraphs, normalized)
29117
29180
  );
29118
29181
  }
29182
+ function applyValuesToParagraphStyle(base, values) {
29183
+ const next = { ...base };
29184
+ const setOrDelete = (key, value) => {
29185
+ if (value === null || value === void 0) delete next[key];
29186
+ else next[key] = value;
29187
+ };
29188
+ setOrDelete("align", values.align);
29189
+ setOrDelete("indentLeft", values.indentLeft);
29190
+ setOrDelete("indentRight", values.indentRight);
29191
+ setOrDelete("indentFirstLine", values.indentFirstLine);
29192
+ setOrDelete("indentHanging", values.indentHanging);
29193
+ next.mirrorIndents = values.mirrorIndents;
29194
+ setOrDelete("spacingBefore", values.spacingBefore);
29195
+ setOrDelete("spacingAfter", values.spacingAfter);
29196
+ setOrDelete("lineHeight", values.lineHeight);
29197
+ setOrDelete("lineRule", values.lineRule);
29198
+ next.contextualSpacing = values.contextualSpacing;
29199
+ setOrDelete("outlineLevel", values.outlineLevel);
29200
+ setOrDelete("shading", values.shading);
29201
+ setOrDelete("borderTop", values.borders.top);
29202
+ setOrDelete("borderRight", values.borders.right);
29203
+ setOrDelete("borderBottom", values.borders.bottom);
29204
+ setOrDelete("borderLeft", values.borders.left);
29205
+ next.pageBreakBefore = values.pageBreakBefore;
29206
+ next.keepWithNext = values.keepWithNext;
29207
+ next.keepLinesTogether = values.keepLinesTogether;
29208
+ next.widowControl = values.widowControl;
29209
+ setOrDelete("tabs", values.tabs.length > 0 ? values.tabs : null);
29210
+ return next;
29211
+ }
29119
29212
  function createInitialValues(styleState) {
29120
29213
  return {
29121
29214
  align: styleState.align ?? "",
@@ -29123,9 +29216,13 @@ function createInitialValues(styleState) {
29123
29216
  indentRight: styleState.indentRight ?? "",
29124
29217
  indentFirstLine: styleState.indentFirstLine ?? "",
29125
29218
  indentHanging: styleState.indentHanging ?? "",
29219
+ mirrorIndents: styleState.mirrorIndents ?? false,
29126
29220
  spacingBefore: styleState.spacingBefore ?? "",
29127
29221
  spacingAfter: styleState.spacingAfter ?? "",
29128
29222
  lineHeight: styleState.lineHeight ?? "",
29223
+ lineRule: styleState.lineRule ?? "",
29224
+ contextualSpacing: styleState.contextualSpacing ?? false,
29225
+ outlineLevel: styleState.outlineLevel ?? "",
29129
29226
  shading: styleState.shading ?? "",
29130
29227
  borderStyle: styleState.borderStyle ?? "",
29131
29228
  borderWidth: styleState.borderWidth ?? "",
@@ -29133,7 +29230,12 @@ function createInitialValues(styleState) {
29133
29230
  borderSideTop: styleState.borderSideTop ?? false,
29134
29231
  borderSideRight: styleState.borderSideRight ?? false,
29135
29232
  borderSideBottom: styleState.borderSideBottom ?? false,
29136
- borderSideLeft: styleState.borderSideLeft ?? false
29233
+ borderSideLeft: styleState.borderSideLeft ?? false,
29234
+ pageBreakBefore: styleState.pageBreakBefore ?? false,
29235
+ keepWithNext: styleState.keepWithNext ?? false,
29236
+ keepLinesTogether: styleState.keepLinesTogether ?? false,
29237
+ widowControl: styleState.widowControl ?? true,
29238
+ tabs: styleState.tabs ?? []
29137
29239
  };
29138
29240
  }
29139
29241
  function createParagraphDialogBridge(deps) {
@@ -29184,9 +29286,54 @@ function createParagraphDialogBridge(deps) {
29184
29286
  if (values.lineHeight !== originalNumber(original.lineHeight)) {
29185
29287
  next = setParagraphStyle(next, "lineHeight", values.lineHeight);
29186
29288
  }
29289
+ const originalRule = original.lineRule || null;
29290
+ if (values.lineRule !== originalRule) {
29291
+ next = setParagraphStyle(next, "lineRule", values.lineRule);
29292
+ }
29187
29293
  if (values.shading !== (original.shading || null)) {
29188
29294
  next = setParagraphStyle(next, "shading", values.shading);
29189
29295
  }
29296
+ if (values.mirrorIndents !== (original.mirrorIndents ?? false)) {
29297
+ next = setParagraphStyle(next, "mirrorIndents", values.mirrorIndents);
29298
+ }
29299
+ if (values.contextualSpacing !== (original.contextualSpacing ?? false)) {
29300
+ next = setParagraphStyle(
29301
+ next,
29302
+ "contextualSpacing",
29303
+ values.contextualSpacing
29304
+ );
29305
+ }
29306
+ const originalOutline = original.outlineLevel.trim() === "" ? null : Number(original.outlineLevel);
29307
+ if (values.outlineLevel !== originalOutline) {
29308
+ next = setParagraphStyle(next, "outlineLevel", values.outlineLevel);
29309
+ }
29310
+ if (values.pageBreakBefore !== (original.pageBreakBefore ?? false)) {
29311
+ next = setParagraphStyle(
29312
+ next,
29313
+ "pageBreakBefore",
29314
+ values.pageBreakBefore
29315
+ );
29316
+ }
29317
+ if (values.keepWithNext !== (original.keepWithNext ?? false)) {
29318
+ next = setParagraphStyle(next, "keepWithNext", values.keepWithNext);
29319
+ }
29320
+ if (values.keepLinesTogether !== (original.keepLinesTogether ?? false)) {
29321
+ next = setParagraphStyle(
29322
+ next,
29323
+ "keepLinesTogether",
29324
+ values.keepLinesTogether
29325
+ );
29326
+ }
29327
+ if (values.widowControl !== (original.widowControl ?? true)) {
29328
+ next = setParagraphStyle(next, "widowControl", values.widowControl);
29329
+ }
29330
+ if (JSON.stringify(values.tabs) !== JSON.stringify(original.tabs ?? [])) {
29331
+ next = setParagraphStyle(
29332
+ next,
29333
+ "tabs",
29334
+ values.tabs.length > 0 ? values.tabs : null
29335
+ );
29336
+ }
29190
29337
  const originalShared = original.borderStyle === "solid" || original.borderStyle === "dashed" || original.borderStyle === "dotted" ? {
29191
29338
  type: original.borderStyle,
29192
29339
  width: Number(original.borderWidth) || 0,
@@ -29220,9 +29367,37 @@ function createParagraphDialogBridge(deps) {
29220
29367
  );
29221
29368
  deps.focusInput();
29222
29369
  };
29370
+ const setParagraphDialogDefault = (values) => {
29371
+ if (deps.isReadOnly()) return;
29372
+ deps.resetTransactionGrouping();
29373
+ deps.applyTransactionalState((current) => {
29374
+ const styles = current.document.styles;
29375
+ const defaultId = resolveDefaultParagraphStyleId(styles);
29376
+ if (!defaultId || !(styles == null ? void 0 : styles[defaultId])) return current;
29377
+ const target = styles[defaultId];
29378
+ return {
29379
+ ...current,
29380
+ document: {
29381
+ ...current.document,
29382
+ styles: {
29383
+ ...styles,
29384
+ [defaultId]: {
29385
+ ...target,
29386
+ paragraphStyle: applyValuesToParagraphStyle(
29387
+ target.paragraphStyle ?? {},
29388
+ values
29389
+ )
29390
+ }
29391
+ }
29392
+ }
29393
+ };
29394
+ });
29395
+ deps.focusInput();
29396
+ };
29223
29397
  return {
29224
29398
  openParagraphDialog,
29225
- applyParagraphDialogValues
29399
+ applyParagraphDialogValues,
29400
+ setParagraphDialogDefault
29226
29401
  };
29227
29402
  }
29228
29403
  function createTableRevisionMetadata() {
@@ -29661,31 +29836,33 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
29661
29836
  break;
29662
29837
  }
29663
29838
  const nextRows = table.rows.map((row, rowIndex) => {
29664
- const nextCells = row.cells.map((cell, cellIndex) => {
29665
- var _a3, _b2;
29666
- const entry = tableLayout.find(
29667
- (item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
29668
- );
29669
- if (!entry) return cell;
29670
- const rightVisualColumnIndex = entry.visualColumnIndex + entry.colSpan - 1;
29671
- const newWidth = columnWidths[rightVisualColumnIndex];
29672
- if (newWidth !== void 0 && entry.colSpan === 1) {
29673
- const propertyRevision = state.trackChangesEnabled && !((_a3 = cell.style) == null ? void 0 : _a3.propertyRevision) ? {
29674
- ...createTableRevisionMetadata(),
29675
- type: "property",
29676
- previous: { ...cell.style ?? {} }
29677
- } : (_b2 = cell.style) == null ? void 0 : _b2.propertyRevision;
29678
- return {
29679
- ...cell,
29680
- style: {
29681
- ...cell.style ?? {},
29682
- width: typeof newWidth === "number" ? newWidth : newWidth,
29683
- ...propertyRevision ? { propertyRevision } : {}
29684
- }
29685
- };
29839
+ const nextCells = row.cells.map(
29840
+ (cell, cellIndex) => {
29841
+ var _a3, _b2;
29842
+ const entry = tableLayout.find(
29843
+ (item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
29844
+ );
29845
+ if (!entry) return cell;
29846
+ const rightVisualColumnIndex = entry.visualColumnIndex + entry.colSpan - 1;
29847
+ const newWidth = columnWidths[rightVisualColumnIndex];
29848
+ if (newWidth !== void 0 && entry.colSpan === 1) {
29849
+ const propertyRevision = state.trackChangesEnabled && !((_a3 = cell.style) == null ? void 0 : _a3.propertyRevision) ? {
29850
+ ...createTableRevisionMetadata(),
29851
+ type: "property",
29852
+ previous: { ...cell.style ?? {} }
29853
+ } : (_b2 = cell.style) == null ? void 0 : _b2.propertyRevision;
29854
+ return {
29855
+ ...cell,
29856
+ style: {
29857
+ ...cell.style ?? {},
29858
+ width: typeof newWidth === "number" ? newWidth : newWidth,
29859
+ ...propertyRevision ? { propertyRevision } : {}
29860
+ }
29861
+ };
29862
+ }
29863
+ return cell;
29686
29864
  }
29687
- return cell;
29688
- });
29865
+ );
29689
29866
  return { ...row, cells: nextCells };
29690
29867
  });
29691
29868
  const nextStyle = { ...table.style ?? {} };
@@ -30769,6 +30946,9 @@ function parseEditorClipboardHtmlWithDom(html) {
30769
30946
  return paragraphs;
30770
30947
  }
30771
30948
  function createEditorContextMenuClipboard(deps) {
30949
+ return createEditorContextMenuClipboardImpl(deps);
30950
+ }
30951
+ function createEditorContextMenuClipboardImpl(deps) {
30772
30952
  const t = deps.t;
30773
30953
  const programmaticCopy = async () => {
30774
30954
  var _a2;
@@ -31076,6 +31256,9 @@ function createEditorTableContextMenuActions(deps) {
31076
31256
  };
31077
31257
  }
31078
31258
  function createEditorChrome(deps) {
31259
+ return createEditorChromeImpl(deps);
31260
+ }
31261
+ function createEditorChromeImpl(deps) {
31079
31262
  const {
31080
31263
  computeFontFamilyOptions: computeFontFamilyOptions2,
31081
31264
  computeFontSizeOptions: computeFontSizeOptions2,
@@ -31150,6 +31333,7 @@ function createEditorChrome(deps) {
31150
31333
  computeFontSizeOptions: computeFontSizeOptions2,
31151
31334
  applyFontDialogValues: fontDialogBridge.applyFontDialogValues,
31152
31335
  applyParagraphDialogValues: paragraphDialogBridge.applyParagraphDialogValues,
31336
+ setParagraphDialogDefault: paragraphDialogBridge.setParagraphDialogDefault,
31153
31337
  applyTablePropertiesDialogValues: tablePropertiesDialogBridge.applyTablePropertiesDialogValues,
31154
31338
  buildContextMenuItems: contextMenuClipboard.buildContextMenuItems,
31155
31339
  handleEditorContextMenu: contextMenuClipboard.handleEditorContextMenu,
@@ -31291,14 +31475,14 @@ function DropCaret(props) {
31291
31475
  })
31292
31476
  });
31293
31477
  }
31294
- var _tmpl$$e = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$2 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31478
+ var _tmpl$$f = /* @__PURE__ */ template(`<div class=oasis-editor-table-resize-guide>`), _tmpl$2$5 = /* @__PURE__ */ template(`<img class=oasis-editor-image-ghost>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class=oasis-editor-table-ghost>`);
31295
31479
  function EditorDragLayers(props) {
31296
31480
  return [createComponent(Show, {
31297
31481
  get when() {
31298
31482
  return props.tableResize.resizing();
31299
31483
  },
31300
31484
  children: (resizing) => (() => {
31301
- var _el$ = _tmpl$$e();
31485
+ var _el$ = _tmpl$$f();
31302
31486
  createRenderEffect((_p$) => {
31303
31487
  var _v$ = !!(resizing().type === "column"), _v$2 = !!(resizing().type === "row"), _v$3 = {
31304
31488
  ...resizing().type === "column" ? {
@@ -31329,7 +31513,7 @@ function EditorDragLayers(props) {
31329
31513
  return memo(() => !!props.imageOps.dragging())() && props.imageOps.draggedImageInfo();
31330
31514
  },
31331
31515
  children: (info) => (() => {
31332
- var _el$2 = _tmpl$2$2();
31516
+ var _el$2 = _tmpl$2$5();
31333
31517
  createRenderEffect((_p$) => {
31334
31518
  var _v$4 = info().src, _v$5 = `${info().width}px`, _v$6 = `${info().height}px`, _v$7 = `${props.imageOps.mousePos().x - info().offsetX}px`, _v$8 = `${props.imageOps.mousePos().y - info().offsetY}px`;
31335
31519
  _v$4 !== _p$.e && setAttribute(_el$2, "src", _p$.e = _v$4);
@@ -31352,7 +31536,7 @@ function EditorDragLayers(props) {
31352
31536
  return memo(() => !!props.tableDrag.dragging())() && props.tableDrag.draggedTableInfo();
31353
31537
  },
31354
31538
  children: (info) => (() => {
31355
- var _el$3 = _tmpl$3$1();
31539
+ var _el$3 = _tmpl$3$2();
31356
31540
  createRenderEffect((_p$) => {
31357
31541
  var _v$9 = `${info().width}px`, _v$0 = `${info().height}px`, _v$1 = `${props.tableDrag.mousePos().x - info().offsetX}px`, _v$10 = `${props.tableDrag.mousePos().y - info().offsetY}px`;
31358
31542
  _v$9 !== _p$.e && setStyleProperty(_el$3, "width", _p$.e = _v$9);
@@ -31948,11 +32132,11 @@ function useFontDialogController(props) {
31948
32132
  handleApply
31949
32133
  };
31950
32134
  }
31951
- var _tmpl$$d = /* @__PURE__ */ template(`<div>`);
32135
+ var _tmpl$$e = /* @__PURE__ */ template(`<div>`);
31952
32136
  function FontPreview(props) {
31953
32137
  const t = useI18n();
31954
32138
  return (() => {
31955
- var _el$ = _tmpl$$d();
32139
+ var _el$ = _tmpl$$e();
31956
32140
  insert(_el$, () => t("dialog.font.previewText"));
31957
32141
  createRenderEffect((_p$) => {
31958
32142
  var _v$ = props.class ?? "oasis-editor-dialog-preview", _v$2 = props.testId, _v$3 = props.style;
@@ -31968,7 +32152,7 @@ function FontPreview(props) {
31968
32152
  return _el$;
31969
32153
  })();
31970
32154
  }
31971
- var _tmpl$$c = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel">`);
32155
+ var _tmpl$$d = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-font-panel">`);
31972
32156
  function FontTab(props) {
31973
32157
  const t = useI18n();
31974
32158
  const {
@@ -32058,7 +32242,7 @@ function FontTab(props) {
32058
32242
  onChange: (checked) => ctrl.updateFontTab("hidden", checked)
32059
32243
  }];
32060
32244
  return (() => {
32061
- var _el$ = _tmpl$$c();
32245
+ var _el$ = _tmpl$$d();
32062
32246
  insert(_el$, createComponent(Grid, {
32063
32247
  container: true,
32064
32248
  spacing: 1.5,
@@ -32110,7 +32294,6 @@ function FontTab(props) {
32110
32294
  },
32111
32295
  get children() {
32112
32296
  return createComponent(SelectField, {
32113
- "class": "oasis-editor-font-dialog-size-group",
32114
32297
  get label() {
32115
32298
  return t("dialog.font.size");
32116
32299
  },
@@ -32137,7 +32320,6 @@ function FontTab(props) {
32137
32320
  },
32138
32321
  get children() {
32139
32322
  return [createComponent(TextField, {
32140
- "class": "oasis-editor-font-dialog-custom-size-group",
32141
32323
  get label() {
32142
32324
  return t("dialog.font.customSize");
32143
32325
  },
@@ -32160,7 +32342,6 @@ function FontTab(props) {
32160
32342
  },
32161
32343
  get children() {
32162
32344
  return createComponent(SelectField, {
32163
- "class": "oasis-editor-font-dialog-style-list-group",
32164
32345
  get label() {
32165
32346
  return t("dialog.font.styleList");
32166
32347
  },
@@ -32201,7 +32382,6 @@ function FontTab(props) {
32201
32382
  },
32202
32383
  get children() {
32203
32384
  return createComponent(SelectField, {
32204
- "class": "oasis-editor-font-dialog-color-mode-group",
32205
32385
  get label() {
32206
32386
  return t("dialog.font.color");
32207
32387
  },
@@ -32396,14 +32576,14 @@ function FontTab(props) {
32396
32576
  return _el$;
32397
32577
  })();
32398
32578
  }
32399
- var _tmpl$$b = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel">`);
32579
+ var _tmpl$$c = /* @__PURE__ */ template(`<div class=oasis-editor-font-dialog-kerning-line>`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class="oasis-editor-font-dialog-panel oasis-editor-font-dialog-advanced-panel">`);
32400
32580
  function AdvancedFontTab(props) {
32401
32581
  const t = useI18n();
32402
32582
  const {
32403
32583
  ctrl
32404
32584
  } = props;
32405
32585
  return (() => {
32406
- var _el$ = _tmpl$$b();
32586
+ var _el$ = _tmpl$2$4();
32407
32587
  insert(_el$, createComponent(FieldGroup, {
32408
32588
  "class": "oasis-editor-font-dialog-fieldset",
32409
32589
  get legend() {
@@ -32552,12 +32732,10 @@ function AdvancedFontTab(props) {
32552
32732
  });
32553
32733
  }
32554
32734
  }), createComponent(Grid, {
32555
- size: {
32556
- xs: 12,
32557
- md: 4
32558
- },
32735
+ size: 12,
32559
32736
  get children() {
32560
- return createComponent(Checkbox, {
32737
+ var _el$2 = _tmpl$$c();
32738
+ insert(_el$2, createComponent(Checkbox, {
32561
32739
  "class": "oasis-editor-font-dialog-kerning-toggle",
32562
32740
  get label() {
32563
32741
  return t("dialog.font.advancedKerning");
@@ -32571,15 +32749,8 @@ function AdvancedFontTab(props) {
32571
32749
  kerningThreshold: checked ? current.kerningThreshold || "1" : current.kerningThreshold
32572
32750
  })),
32573
32751
  "data-testid": "editor-font-dialog-advanced-kerning-enabled"
32574
- });
32575
- }
32576
- }), createComponent(Grid, {
32577
- size: {
32578
- xs: 12,
32579
- md: 4
32580
- },
32581
- get children() {
32582
- return createComponent(TextField, {
32752
+ }), null);
32753
+ insert(_el$2, createComponent(TextField, {
32583
32754
  "class": "oasis-editor-font-dialog-kerning-input",
32584
32755
  get value() {
32585
32756
  return ctrl.advancedTabValues().kerningThreshold;
@@ -32589,20 +32760,14 @@ function AdvancedFontTab(props) {
32589
32760
  },
32590
32761
  onChange: (value) => ctrl.updateAdvancedTab("kerningThreshold", value),
32591
32762
  "data-testid": "editor-font-dialog-advanced-kerning"
32592
- });
32593
- }
32594
- }), createComponent(Grid, {
32595
- size: {
32596
- xs: 12,
32597
- md: 4
32598
- },
32599
- get children() {
32600
- return createComponent(StatusText, {
32763
+ }), null);
32764
+ insert(_el$2, createComponent(StatusText, {
32601
32765
  "class": "oasis-editor-dialog-help-text oasis-editor-font-dialog-kerning-suffix",
32602
32766
  get children() {
32603
32767
  return t("dialog.font.advancedKerningAbove");
32604
32768
  }
32605
- });
32769
+ }), null);
32770
+ return _el$2;
32606
32771
  }
32607
32772
  })];
32608
32773
  }
@@ -32849,24 +33014,288 @@ function FontDialog(props) {
32849
33014
  }
32850
33015
  });
32851
33016
  }
32852
- var _tmpl$$a = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`);
33017
+ var _tmpl$$b = /* @__PURE__ */ template(`<div class=oasis-editor-tab-stops><div class=oasis-editor-tab-stops-actions>`), _tmpl$2$3 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33018
+ function toDraft(stop) {
33019
+ return {
33020
+ position: stop.position,
33021
+ type: stop.type,
33022
+ leader: stop.leader ?? "none"
33023
+ };
33024
+ }
33025
+ function TabStopsDialog(props) {
33026
+ const t = useI18n();
33027
+ const [stops, setStops] = createSignal([]);
33028
+ createEffect(() => {
33029
+ if (props.isOpen) {
33030
+ setStops(props.initial.map(toDraft));
33031
+ }
33032
+ });
33033
+ const updateStop = (index, patch) => {
33034
+ setStops((current) => current.map((stop, stopIndex) => stopIndex === index ? {
33035
+ ...stop,
33036
+ ...patch
33037
+ } : stop));
33038
+ };
33039
+ const addStop = () => {
33040
+ setStops((current) => [...current, {
33041
+ position: null,
33042
+ type: "left",
33043
+ leader: "none"
33044
+ }]);
33045
+ };
33046
+ const removeStop = (index) => {
33047
+ setStops((current) => current.filter((_, stopIndex) => stopIndex !== index));
33048
+ };
33049
+ const handleApply = () => {
33050
+ const tabs = stops().filter((stop) => stop.position !== null).map((stop) => ({
33051
+ position: stop.position,
33052
+ type: stop.type,
33053
+ ...stop.leader !== "none" ? {
33054
+ leader: stop.leader
33055
+ } : {}
33056
+ })).sort((a, b) => a.position - b.position);
33057
+ props.onApply(tabs);
33058
+ props.onClose();
33059
+ };
33060
+ const typeOptions = () => [{
33061
+ value: "left",
33062
+ label: t("paragraph.tabAlignLeft")
33063
+ }, {
33064
+ value: "center",
33065
+ label: t("paragraph.tabAlignCenter")
33066
+ }, {
33067
+ value: "right",
33068
+ label: t("paragraph.tabAlignRight")
33069
+ }, {
33070
+ value: "decimal",
33071
+ label: t("paragraph.tabAlignDecimal")
33072
+ }, {
33073
+ value: "bar",
33074
+ label: t("paragraph.tabAlignBar")
33075
+ }];
33076
+ const leaderOptions = () => [{
33077
+ value: "none",
33078
+ label: t("paragraph.tabLeaderNone")
33079
+ }, {
33080
+ value: "dot",
33081
+ label: t("paragraph.tabLeaderDot")
33082
+ }, {
33083
+ value: "hyphen",
33084
+ label: t("paragraph.tabLeaderHyphen")
33085
+ }, {
33086
+ value: "underscore",
33087
+ label: t("paragraph.tabLeaderUnderscore")
33088
+ }];
33089
+ return createComponent(Dialog, {
33090
+ get isOpen() {
33091
+ return props.isOpen;
33092
+ },
33093
+ get title() {
33094
+ return t("paragraph.tabsTitle");
33095
+ },
33096
+ get onClose() {
33097
+ return props.onClose;
33098
+ },
33099
+ get footer() {
33100
+ return (() => {
33101
+ var _el$3 = _tmpl$2$3(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling;
33102
+ insert(_el$4, createComponent(Button, {
33103
+ variant: "secondary",
33104
+ onClick: () => {
33105
+ setStops([]);
33106
+ },
33107
+ "data-testid": "editor-tab-stops-clear",
33108
+ get children() {
33109
+ return t("paragraph.tabsClearAll");
33110
+ }
33111
+ }));
33112
+ insert(_el$5, createComponent(Button, {
33113
+ variant: "secondary",
33114
+ get onClick() {
33115
+ return props.onClose;
33116
+ },
33117
+ "data-testid": "editor-tab-stops-cancel",
33118
+ get children() {
33119
+ return t("generic.cancel");
33120
+ }
33121
+ }), null);
33122
+ insert(_el$5, createComponent(Button, {
33123
+ variant: "primary",
33124
+ onClick: handleApply,
33125
+ "data-testid": "editor-tab-stops-apply",
33126
+ get children() {
33127
+ return t("generic.apply");
33128
+ }
33129
+ }), null);
33130
+ return _el$3;
33131
+ })();
33132
+ },
33133
+ get children() {
33134
+ var _el$ = _tmpl$$b(), _el$2 = _el$.firstChild;
33135
+ insert(_el$, createComponent(For, {
33136
+ get each() {
33137
+ return stops();
33138
+ },
33139
+ get fallback() {
33140
+ return createComponent(StatusText, {
33141
+ as: "p",
33142
+ "class": "oasis-editor-dialog-help-text",
33143
+ get children() {
33144
+ return t("paragraph.tabsEmpty");
33145
+ }
33146
+ });
33147
+ },
33148
+ children: (stop, index) => createComponent(Grid, {
33149
+ container: true,
33150
+ spacing: 1.5,
33151
+ alignItems: "flex-end",
33152
+ get children() {
33153
+ return [createComponent(Grid, {
33154
+ size: {
33155
+ xs: 12,
33156
+ md: 4
33157
+ },
33158
+ get children() {
33159
+ return createComponent(NumberField, {
33160
+ get label() {
33161
+ return t("paragraph.tabsPosition");
33162
+ },
33163
+ step: "1",
33164
+ get value() {
33165
+ return stop.position ?? "";
33166
+ },
33167
+ onChange: (value) => updateStop(index(), {
33168
+ position: value
33169
+ })
33170
+ });
33171
+ }
33172
+ }), createComponent(Grid, {
33173
+ size: {
33174
+ xs: 6,
33175
+ md: 3
33176
+ },
33177
+ get children() {
33178
+ return createComponent(SelectField, {
33179
+ get label() {
33180
+ return t("paragraph.tabsAlignment");
33181
+ },
33182
+ get value() {
33183
+ return stop.type;
33184
+ },
33185
+ onChange: (value) => updateStop(index(), {
33186
+ type: value
33187
+ }),
33188
+ get options() {
33189
+ return typeOptions();
33190
+ }
33191
+ });
33192
+ }
33193
+ }), createComponent(Grid, {
33194
+ size: {
33195
+ xs: 6,
33196
+ md: 3
33197
+ },
33198
+ get children() {
33199
+ return createComponent(SelectField, {
33200
+ get label() {
33201
+ return t("paragraph.tabsLeader");
33202
+ },
33203
+ get value() {
33204
+ return stop.leader;
33205
+ },
33206
+ onChange: (value) => updateStop(index(), {
33207
+ leader: value
33208
+ }),
33209
+ get options() {
33210
+ return leaderOptions();
33211
+ }
33212
+ });
33213
+ }
33214
+ }), createComponent(Grid, {
33215
+ size: {
33216
+ xs: 12,
33217
+ md: 2
33218
+ },
33219
+ get children() {
33220
+ return createComponent(Button, {
33221
+ variant: "ghost",
33222
+ onClick: () => removeStop(index()),
33223
+ "data-testid": "editor-tab-stops-remove",
33224
+ get children() {
33225
+ return t("paragraph.tabsRemove");
33226
+ }
33227
+ });
33228
+ }
33229
+ })];
33230
+ }
33231
+ })
33232
+ }), _el$2);
33233
+ insert(_el$2, createComponent(Button, {
33234
+ variant: "secondary",
33235
+ icon: "plus",
33236
+ onClick: addStop,
33237
+ "data-testid": "editor-tab-stops-add",
33238
+ get children() {
33239
+ return t("paragraph.tabsAdd");
33240
+ }
33241
+ }));
33242
+ return _el$;
33243
+ }
33244
+ });
33245
+ }
33246
+ var _tmpl$$a = /* @__PURE__ */ template(`<div class=oasis-editor-paragraph-dialog-panel>`), _tmpl$2$2 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-preview data-testid=editor-paragraph-dialog-preview>`), _tmpl$3$1 = /* @__PURE__ */ template(`<div class=oasis-editor-dialog-footer-split><div class=oasis-editor-dialog-footer-start></div><div class=oasis-editor-dialog-footer-end>`);
33247
+ const PT_TO_PX = 96 / 72;
32853
33248
  const DEFAULT_BORDER_WIDTH_PT$1 = 0.5;
32854
33249
  const DEFAULT_BORDER_COLOR$1 = "#000000";
33250
+ const OUTLINE_BODY = "";
32855
33251
  function parseNumber$1(value) {
32856
33252
  if (value.trim() === "") return null;
32857
33253
  const num = Number(value);
32858
33254
  return Number.isFinite(num) ? num : null;
32859
33255
  }
33256
+ function deriveLineSpacing(lineRule, lineHeight) {
33257
+ if (lineRule === "exact" || lineRule === "atLeast") {
33258
+ const pt = lineHeight !== null ? Math.round(lineHeight / PT_TO_PX) : null;
33259
+ return {
33260
+ mode: lineRule,
33261
+ at: pt
33262
+ };
33263
+ }
33264
+ if (lineHeight === null) return {
33265
+ mode: "multiple",
33266
+ at: null
33267
+ };
33268
+ if (lineHeight === 1) return {
33269
+ mode: "single",
33270
+ at: null
33271
+ };
33272
+ if (lineHeight === 1.5) return {
33273
+ mode: "onePointFive",
33274
+ at: null
33275
+ };
33276
+ if (lineHeight === 2) return {
33277
+ mode: "double",
33278
+ at: null
33279
+ };
33280
+ return {
33281
+ mode: "multiple",
33282
+ at: lineHeight
33283
+ };
33284
+ }
32860
33285
  function ParagraphDialog(props) {
32861
33286
  const t = useI18n();
32862
33287
  const [align, setAlign] = createSignal("");
33288
+ const [outlineLevel, setOutlineLevel] = createSignal(OUTLINE_BODY);
32863
33289
  const [indentLeft, setIndentLeft] = createSignal(null);
32864
33290
  const [indentRight, setIndentRight] = createSignal(null);
32865
33291
  const [special, setSpecial] = createSignal("none");
32866
33292
  const [specialBy, setSpecialBy] = createSignal(null);
33293
+ const [mirrorIndents, setMirrorIndents] = createSignal(false);
32867
33294
  const [spacingBefore, setSpacingBefore] = createSignal(null);
32868
33295
  const [spacingAfter, setSpacingAfter] = createSignal(null);
32869
- const [lineHeight, setLineHeight] = createSignal(null);
33296
+ const [lineMode, setLineMode] = createSignal("multiple");
33297
+ const [lineAt, setLineAt] = createSignal(null);
33298
+ const [contextualSpacing, setContextualSpacing] = createSignal(false);
32870
33299
  const [shading, setShading] = createSignal("");
32871
33300
  const [borderStyle, setBorderStyle] = createSignal("none");
32872
33301
  const [borderWidth, setBorderWidth] = createSignal(null);
@@ -32875,15 +33304,29 @@ function ParagraphDialog(props) {
32875
33304
  const [sideRight, setSideRight] = createSignal(false);
32876
33305
  const [sideBottom, setSideBottom] = createSignal(false);
32877
33306
  const [sideLeft, setSideLeft] = createSignal(false);
33307
+ const [pageBreakBefore, setPageBreakBefore] = createSignal(false);
33308
+ const [keepWithNext, setKeepWithNext] = createSignal(false);
33309
+ const [keepLinesTogether, setKeepLinesTogether] = createSignal(false);
33310
+ const [widowControl, setWidowControl] = createSignal(true);
33311
+ const [tabs, setTabs] = createSignal([]);
33312
+ const [tabsDialogOpen, setTabsDialogOpen] = createSignal(false);
32878
33313
  createEffect(() => {
32879
33314
  if (props.isOpen) {
32880
33315
  setAlign(props.initial.align ?? "");
33316
+ setOutlineLevel(props.initial.outlineLevel ?? OUTLINE_BODY);
32881
33317
  setIndentLeft(parseNumber$1(props.initial.indentLeft ?? ""));
32882
33318
  setIndentRight(parseNumber$1(props.initial.indentRight ?? ""));
33319
+ setMirrorIndents(props.initial.mirrorIndents ?? false);
32883
33320
  setSpacingBefore(parseNumber$1(props.initial.spacingBefore ?? ""));
32884
33321
  setSpacingAfter(parseNumber$1(props.initial.spacingAfter ?? ""));
32885
- setLineHeight(parseNumber$1(props.initial.lineHeight ?? ""));
33322
+ setContextualSpacing(props.initial.contextualSpacing ?? false);
32886
33323
  setShading(props.initial.shading ?? "");
33324
+ const {
33325
+ mode,
33326
+ at
33327
+ } = deriveLineSpacing(props.initial.lineRule ?? "", parseNumber$1(props.initial.lineHeight ?? ""));
33328
+ setLineMode(mode);
33329
+ setLineAt(at);
32887
33330
  const initialBorderStyle = props.initial.borderStyle;
32888
33331
  setBorderStyle(initialBorderStyle === "solid" || initialBorderStyle === "dashed" || initialBorderStyle === "dotted" ? initialBorderStyle : "none");
32889
33332
  setBorderWidth(parseNumber$1(props.initial.borderWidth ?? ""));
@@ -32892,6 +33335,11 @@ function ParagraphDialog(props) {
32892
33335
  setSideRight(props.initial.borderSideRight ?? false);
32893
33336
  setSideBottom(props.initial.borderSideBottom ?? false);
32894
33337
  setSideLeft(props.initial.borderSideLeft ?? false);
33338
+ setPageBreakBefore(props.initial.pageBreakBefore ?? false);
33339
+ setKeepWithNext(props.initial.keepWithNext ?? false);
33340
+ setKeepLinesTogether(props.initial.keepLinesTogether ?? false);
33341
+ setWidowControl(props.initial.widowControl ?? true);
33342
+ setTabs(props.initial.tabs ?? []);
32895
33343
  const firstLine = parseNumber$1(props.initial.indentFirstLine ?? "");
32896
33344
  const hanging = parseNumber$1(props.initial.indentHanging ?? "");
32897
33345
  if (hanging !== null && hanging > 0) {
@@ -32906,17 +33354,56 @@ function ParagraphDialog(props) {
32906
33354
  }
32907
33355
  }
32908
33356
  });
33357
+ const atEnabled = () => lineMode() === "multiple" || lineMode() === "atLeast" || lineMode() === "exact";
33358
+ const resolveLineSpacing = () => {
33359
+ switch (lineMode()) {
33360
+ case "single":
33361
+ return {
33362
+ lineHeight: 1,
33363
+ lineRule: null
33364
+ };
33365
+ case "onePointFive":
33366
+ return {
33367
+ lineHeight: 1.5,
33368
+ lineRule: null
33369
+ };
33370
+ case "double":
33371
+ return {
33372
+ lineHeight: 2,
33373
+ lineRule: null
33374
+ };
33375
+ case "multiple":
33376
+ return {
33377
+ lineHeight: lineAt(),
33378
+ lineRule: null
33379
+ };
33380
+ case "atLeast":
33381
+ return {
33382
+ lineHeight: lineAt() !== null ? lineAt() * PT_TO_PX : null,
33383
+ lineRule: "atLeast"
33384
+ };
33385
+ case "exact":
33386
+ return {
33387
+ lineHeight: lineAt() !== null ? lineAt() * PT_TO_PX : null,
33388
+ lineRule: "exact"
33389
+ };
33390
+ }
33391
+ };
32909
33392
  const previewStyle = createMemo(() => {
32910
- const lh = lineHeight();
32911
33393
  const left = indentLeft();
32912
33394
  const right = indentRight();
32913
33395
  const firstLine = special() === "firstLine" ? specialBy() : null;
32914
33396
  const hanging = special() === "hanging" ? specialBy() : null;
32915
33397
  const textIndent = firstLine !== null ? firstLine : hanging !== null ? -hanging : null;
32916
33398
  const borderCss = borderStyle() !== "none" ? `${borderWidth() ?? DEFAULT_BORDER_WIDTH_PT$1}pt ${borderStyle()} ${borderColor().trim() || DEFAULT_BORDER_COLOR$1}` : void 0;
33399
+ const {
33400
+ lineHeight,
33401
+ lineRule
33402
+ } = resolveLineSpacing();
33403
+ const lineHeightCss = lineHeight === null ? void 0 : lineRule === "exact" || lineRule === "atLeast" ? `${lineHeight}px` : String(lineHeight);
32917
33404
  return {
32918
33405
  "text-align": align() || void 0,
32919
- "line-height": lh !== null && lh > 0 ? String(lh) : void 0,
33406
+ "line-height": lineHeightCss,
32920
33407
  "padding-left": left !== null ? `${left + (hanging ?? 0)}pt` : void 0,
32921
33408
  "padding-right": right !== null ? `${right}pt` : void 0,
32922
33409
  "text-indent": textIndent !== null ? `${textIndent}pt` : void 0,
@@ -32950,23 +33437,616 @@ function ParagraphDialog(props) {
32950
33437
  left: sideLeft() ? border : null
32951
33438
  };
32952
33439
  };
32953
- const handleApply = () => {
33440
+ const collectValues = () => {
32954
33441
  const by = specialBy();
32955
- props.onApply({
33442
+ const {
33443
+ lineHeight,
33444
+ lineRule
33445
+ } = resolveLineSpacing();
33446
+ const outline = outlineLevel();
33447
+ return {
32956
33448
  align: align() || null,
32957
33449
  indentLeft: indentLeft(),
32958
33450
  indentRight: indentRight(),
32959
33451
  indentFirstLine: special() === "firstLine" ? by : null,
32960
33452
  indentHanging: special() === "hanging" ? by : null,
33453
+ mirrorIndents: mirrorIndents(),
32961
33454
  spacingBefore: spacingBefore(),
32962
33455
  spacingAfter: spacingAfter(),
32963
- lineHeight: lineHeight(),
33456
+ lineHeight,
33457
+ lineRule,
33458
+ contextualSpacing: contextualSpacing(),
33459
+ outlineLevel: outline === OUTLINE_BODY ? null : Number(outline),
32964
33460
  shading: shading().trim() || null,
32965
- borders: resolveBorders()
32966
- }, props.initial);
33461
+ borders: resolveBorders(),
33462
+ pageBreakBefore: pageBreakBefore(),
33463
+ keepWithNext: keepWithNext(),
33464
+ keepLinesTogether: keepLinesTogether(),
33465
+ widowControl: widowControl(),
33466
+ tabs: tabs()
33467
+ };
33468
+ };
33469
+ const handleApply = () => {
33470
+ props.onApply(collectValues(), props.initial);
32967
33471
  props.onClose();
32968
33472
  };
32969
- return createComponent(Dialog, {
33473
+ const handleSetDefault = () => {
33474
+ var _a2;
33475
+ (_a2 = props.onSetDefault) == null ? void 0 : _a2.call(props, collectValues());
33476
+ props.onClose();
33477
+ };
33478
+ const alignField = createComponent(SelectField, {
33479
+ get label() {
33480
+ return t("paragraph.alignLabel");
33481
+ },
33482
+ get value() {
33483
+ return align();
33484
+ },
33485
+ onChange: setAlign,
33486
+ "data-testid": "editor-paragraph-dialog-align",
33487
+ get options() {
33488
+ return [{
33489
+ value: "left",
33490
+ label: t("paragraph.alignLeft")
33491
+ }, {
33492
+ value: "center",
33493
+ label: t("paragraph.alignCenter")
33494
+ }, {
33495
+ value: "right",
33496
+ label: t("paragraph.alignRight")
33497
+ }, {
33498
+ value: "justify",
33499
+ label: t("paragraph.alignJustify")
33500
+ }];
33501
+ }
33502
+ });
33503
+ const outlineField = createComponent(SelectField, {
33504
+ get label() {
33505
+ return t("paragraph.outlineLevelLabel");
33506
+ },
33507
+ get value() {
33508
+ return outlineLevel();
33509
+ },
33510
+ onChange: setOutlineLevel,
33511
+ "data-testid": "editor-paragraph-dialog-outline-level",
33512
+ get options() {
33513
+ return [{
33514
+ value: OUTLINE_BODY,
33515
+ label: t("paragraph.outlineBodyText")
33516
+ }, ...Array.from({
33517
+ length: 9
33518
+ }, (_, level) => ({
33519
+ value: String(level),
33520
+ label: t("paragraph.outlineLevelN", [level + 1])
33521
+ }))];
33522
+ }
33523
+ });
33524
+ const indentsAndSpacingPanel = (() => {
33525
+ var _el$ = _tmpl$$a();
33526
+ insert(_el$, createComponent(FieldGroup, {
33527
+ "class": "oasis-editor-dialog-fieldset",
33528
+ get legend() {
33529
+ return t("paragraph.groupGeneral");
33530
+ },
33531
+ get children() {
33532
+ return createComponent(Grid, {
33533
+ container: true,
33534
+ spacing: 1.5,
33535
+ get children() {
33536
+ return [createComponent(Grid, {
33537
+ size: {
33538
+ xs: 12,
33539
+ md: 6
33540
+ },
33541
+ children: alignField
33542
+ }), createComponent(Grid, {
33543
+ size: {
33544
+ xs: 12,
33545
+ md: 6
33546
+ },
33547
+ children: outlineField
33548
+ })];
33549
+ }
33550
+ });
33551
+ }
33552
+ }), null);
33553
+ insert(_el$, createComponent(FieldGroup, {
33554
+ "class": "oasis-editor-dialog-fieldset",
33555
+ get legend() {
33556
+ return t("paragraph.groupIndent");
33557
+ },
33558
+ get children() {
33559
+ return createComponent(Grid, {
33560
+ container: true,
33561
+ spacing: 1.5,
33562
+ get children() {
33563
+ return [createComponent(Grid, {
33564
+ size: {
33565
+ xs: 12,
33566
+ md: 6
33567
+ },
33568
+ get children() {
33569
+ return createComponent(NumberField, {
33570
+ get label() {
33571
+ return t("paragraph.indentLeftLabel");
33572
+ },
33573
+ step: "1",
33574
+ get value() {
33575
+ return indentLeft() ?? "";
33576
+ },
33577
+ onChange: setIndentLeft,
33578
+ "data-testid": "editor-paragraph-dialog-indent-left"
33579
+ });
33580
+ }
33581
+ }), createComponent(Grid, {
33582
+ size: {
33583
+ xs: 12,
33584
+ md: 6
33585
+ },
33586
+ get children() {
33587
+ return createComponent(NumberField, {
33588
+ get label() {
33589
+ return t("paragraph.indentRightLabel");
33590
+ },
33591
+ step: "1",
33592
+ get value() {
33593
+ return indentRight() ?? "";
33594
+ },
33595
+ onChange: setIndentRight,
33596
+ "data-testid": "editor-paragraph-dialog-indent-right"
33597
+ });
33598
+ }
33599
+ }), createComponent(Grid, {
33600
+ size: {
33601
+ xs: 12,
33602
+ md: 6
33603
+ },
33604
+ get children() {
33605
+ return createComponent(SelectField, {
33606
+ get label() {
33607
+ return t("paragraph.specialLabel");
33608
+ },
33609
+ get value() {
33610
+ return special();
33611
+ },
33612
+ onChange: (value) => {
33613
+ const next = value;
33614
+ setSpecial(next);
33615
+ if (next === "none") setSpecialBy(null);
33616
+ },
33617
+ "data-testid": "editor-paragraph-dialog-special",
33618
+ get options() {
33619
+ return [{
33620
+ value: "none",
33621
+ label: t("paragraph.specialNone")
33622
+ }, {
33623
+ value: "firstLine",
33624
+ label: t("paragraph.specialFirstLine")
33625
+ }, {
33626
+ value: "hanging",
33627
+ label: t("paragraph.specialHanging")
33628
+ }];
33629
+ }
33630
+ });
33631
+ }
33632
+ }), createComponent(Grid, {
33633
+ size: {
33634
+ xs: 12,
33635
+ md: 6
33636
+ },
33637
+ get children() {
33638
+ return createComponent(NumberField, {
33639
+ get label() {
33640
+ return t("paragraph.specialByLabel");
33641
+ },
33642
+ min: "0",
33643
+ step: "1",
33644
+ get disabled() {
33645
+ return special() === "none";
33646
+ },
33647
+ get value() {
33648
+ return specialBy() ?? "";
33649
+ },
33650
+ onChange: setSpecialBy,
33651
+ "data-testid": "editor-paragraph-dialog-special-by"
33652
+ });
33653
+ }
33654
+ }), createComponent(Grid, {
33655
+ size: 12,
33656
+ get children() {
33657
+ return createComponent(Checkbox, {
33658
+ get label() {
33659
+ return t("paragraph.mirrorIndentsLabel");
33660
+ },
33661
+ get checked() {
33662
+ return mirrorIndents();
33663
+ },
33664
+ onChange: setMirrorIndents,
33665
+ "data-testid": "editor-paragraph-dialog-mirror-indents"
33666
+ });
33667
+ }
33668
+ })];
33669
+ }
33670
+ });
33671
+ }
33672
+ }), null);
33673
+ insert(_el$, createComponent(FieldGroup, {
33674
+ "class": "oasis-editor-dialog-fieldset",
33675
+ get legend() {
33676
+ return t("paragraph.groupSpacing");
33677
+ },
33678
+ get children() {
33679
+ return createComponent(Grid, {
33680
+ container: true,
33681
+ spacing: 1.5,
33682
+ get children() {
33683
+ return [createComponent(Grid, {
33684
+ size: {
33685
+ xs: 12,
33686
+ md: 4
33687
+ },
33688
+ get children() {
33689
+ return createComponent(NumberField, {
33690
+ get label() {
33691
+ return t("paragraph.spacingBeforeLabel");
33692
+ },
33693
+ min: "0",
33694
+ step: "1",
33695
+ get value() {
33696
+ return spacingBefore() ?? "";
33697
+ },
33698
+ onChange: setSpacingBefore,
33699
+ "data-testid": "editor-paragraph-dialog-spacing-before"
33700
+ });
33701
+ }
33702
+ }), createComponent(Grid, {
33703
+ size: {
33704
+ xs: 12,
33705
+ md: 4
33706
+ },
33707
+ get children() {
33708
+ return createComponent(NumberField, {
33709
+ get label() {
33710
+ return t("paragraph.spacingAfterLabel");
33711
+ },
33712
+ min: "0",
33713
+ step: "1",
33714
+ get value() {
33715
+ return spacingAfter() ?? "";
33716
+ },
33717
+ onChange: setSpacingAfter,
33718
+ "data-testid": "editor-paragraph-dialog-spacing-after"
33719
+ });
33720
+ }
33721
+ }), createComponent(Grid, {
33722
+ size: {
33723
+ xs: 12,
33724
+ md: 4
33725
+ }
33726
+ }), createComponent(Grid, {
33727
+ size: {
33728
+ xs: 12,
33729
+ md: 8
33730
+ },
33731
+ get children() {
33732
+ return createComponent(SelectField, {
33733
+ get label() {
33734
+ return t("paragraph.lineSpacingLabel");
33735
+ },
33736
+ get value() {
33737
+ return lineMode();
33738
+ },
33739
+ onChange: (value) => {
33740
+ setLineMode(value);
33741
+ },
33742
+ "data-testid": "editor-paragraph-dialog-line-mode",
33743
+ get options() {
33744
+ return [{
33745
+ value: "single",
33746
+ label: t("paragraph.lineSpacingSingle")
33747
+ }, {
33748
+ value: "onePointFive",
33749
+ label: t("paragraph.lineSpacingOnePointFive")
33750
+ }, {
33751
+ value: "double",
33752
+ label: t("paragraph.lineSpacingDouble")
33753
+ }, {
33754
+ value: "atLeast",
33755
+ label: t("paragraph.lineSpacingAtLeast")
33756
+ }, {
33757
+ value: "exact",
33758
+ label: t("paragraph.lineSpacingExact")
33759
+ }, {
33760
+ value: "multiple",
33761
+ label: t("paragraph.lineSpacingMultiple")
33762
+ }];
33763
+ }
33764
+ });
33765
+ }
33766
+ }), createComponent(Grid, {
33767
+ size: {
33768
+ xs: 12,
33769
+ md: 4
33770
+ },
33771
+ get children() {
33772
+ return createComponent(NumberField, {
33773
+ get label() {
33774
+ return t("paragraph.lineSpacingAt");
33775
+ },
33776
+ min: "0",
33777
+ get step() {
33778
+ return lineMode() === "multiple" ? "0.05" : "1";
33779
+ },
33780
+ get disabled() {
33781
+ return !atEnabled();
33782
+ },
33783
+ get value() {
33784
+ return lineAt() ?? "";
33785
+ },
33786
+ onChange: setLineAt,
33787
+ "data-testid": "editor-paragraph-dialog-line-at"
33788
+ });
33789
+ }
33790
+ }), createComponent(Grid, {
33791
+ size: 12,
33792
+ get children() {
33793
+ return createComponent(Checkbox, {
33794
+ get label() {
33795
+ return t("paragraph.contextualSpacingLabel");
33796
+ },
33797
+ get checked() {
33798
+ return contextualSpacing();
33799
+ },
33800
+ onChange: setContextualSpacing,
33801
+ "data-testid": "editor-paragraph-dialog-contextual-spacing"
33802
+ });
33803
+ }
33804
+ })];
33805
+ }
33806
+ });
33807
+ }
33808
+ }), null);
33809
+ insert(_el$, createComponent(FieldGroup, {
33810
+ "class": "oasis-editor-dialog-fieldset",
33811
+ get legend() {
33812
+ return t("paragraph.groupBorders");
33813
+ },
33814
+ get children() {
33815
+ return [createComponent(Grid, {
33816
+ container: true,
33817
+ spacing: 1.5,
33818
+ get children() {
33819
+ return [createComponent(Grid, {
33820
+ size: {
33821
+ xs: 12,
33822
+ md: 3
33823
+ },
33824
+ get children() {
33825
+ return createComponent(SelectField, {
33826
+ get label() {
33827
+ return t("paragraph.borderStyleLabel");
33828
+ },
33829
+ get value() {
33830
+ return borderStyle();
33831
+ },
33832
+ onChange: (value) => {
33833
+ const next = value;
33834
+ setBorderStyle(next);
33835
+ if (next === "none") {
33836
+ setSideTop(false);
33837
+ setSideRight(false);
33838
+ setSideBottom(false);
33839
+ setSideLeft(false);
33840
+ } else if (!sideTop() && !sideRight() && !sideBottom() && !sideLeft()) {
33841
+ setSideTop(true);
33842
+ setSideRight(true);
33843
+ setSideBottom(true);
33844
+ setSideLeft(true);
33845
+ }
33846
+ },
33847
+ "data-testid": "editor-paragraph-dialog-border-style",
33848
+ get options() {
33849
+ return [{
33850
+ value: "none",
33851
+ label: t("paragraph.borderNone")
33852
+ }, {
33853
+ value: "solid",
33854
+ label: t("paragraph.borderSolid")
33855
+ }, {
33856
+ value: "dashed",
33857
+ label: t("paragraph.borderDashed")
33858
+ }, {
33859
+ value: "dotted",
33860
+ label: t("paragraph.borderDotted")
33861
+ }];
33862
+ }
33863
+ });
33864
+ }
33865
+ }), createComponent(Grid, {
33866
+ size: {
33867
+ xs: 12,
33868
+ md: 3
33869
+ },
33870
+ get children() {
33871
+ return createComponent(NumberField, {
33872
+ get label() {
33873
+ return t("paragraph.borderWidthLabel");
33874
+ },
33875
+ min: "0",
33876
+ step: "0.25",
33877
+ get disabled() {
33878
+ return borderStyle() === "none";
33879
+ },
33880
+ get value() {
33881
+ return borderWidth() ?? "";
33882
+ },
33883
+ onChange: setBorderWidth,
33884
+ "data-testid": "editor-paragraph-dialog-border-width"
33885
+ });
33886
+ }
33887
+ }), createComponent(Grid, {
33888
+ size: {
33889
+ xs: 12,
33890
+ md: 3
33891
+ },
33892
+ get children() {
33893
+ return createComponent(ColorField, {
33894
+ get label() {
33895
+ return t("paragraph.borderColorLabel");
33896
+ },
33897
+ get disabled() {
33898
+ return borderStyle() === "none";
33899
+ },
33900
+ get value() {
33901
+ return borderColor() || DEFAULT_BORDER_COLOR$1;
33902
+ },
33903
+ onChange: setBorderColor,
33904
+ "data-testid": "editor-paragraph-dialog-border-color"
33905
+ });
33906
+ }
33907
+ }), createComponent(Grid, {
33908
+ size: {
33909
+ xs: 12,
33910
+ md: 3
33911
+ },
33912
+ get children() {
33913
+ return createComponent(ColorField, {
33914
+ get label() {
33915
+ return t("paragraph.shadingLabel");
33916
+ },
33917
+ get value() {
33918
+ return shading() || "#ffffff";
33919
+ },
33920
+ onChange: setShading,
33921
+ "data-testid": "editor-paragraph-dialog-shading"
33922
+ });
33923
+ }
33924
+ })];
33925
+ }
33926
+ }), createComponent(FormField, {
33927
+ "class": "oasis-editor-dialog-input-group-grow",
33928
+ get label() {
33929
+ return t("paragraph.borderSidesLabel");
33930
+ },
33931
+ get children() {
33932
+ return createComponent(Stack, {
33933
+ "class": "oasis-editor-dialog-style-row",
33934
+ direction: "row",
33935
+ spacing: 1,
33936
+ get children() {
33937
+ return [createComponent(Checkbox, {
33938
+ get label() {
33939
+ return t("paragraph.borderSideTop");
33940
+ },
33941
+ get disabled() {
33942
+ return borderStyle() === "none";
33943
+ },
33944
+ get checked() {
33945
+ return sideTop();
33946
+ },
33947
+ onChange: setSideTop,
33948
+ "data-testid": "editor-paragraph-dialog-border-side-top"
33949
+ }), createComponent(Checkbox, {
33950
+ get label() {
33951
+ return t("paragraph.borderSideRight");
33952
+ },
33953
+ get disabled() {
33954
+ return borderStyle() === "none";
33955
+ },
33956
+ get checked() {
33957
+ return sideRight();
33958
+ },
33959
+ onChange: setSideRight,
33960
+ "data-testid": "editor-paragraph-dialog-border-side-right"
33961
+ }), createComponent(Checkbox, {
33962
+ get label() {
33963
+ return t("paragraph.borderSideBottom");
33964
+ },
33965
+ get disabled() {
33966
+ return borderStyle() === "none";
33967
+ },
33968
+ get checked() {
33969
+ return sideBottom();
33970
+ },
33971
+ onChange: setSideBottom,
33972
+ "data-testid": "editor-paragraph-dialog-border-side-bottom"
33973
+ }), createComponent(Checkbox, {
33974
+ get label() {
33975
+ return t("paragraph.borderSideLeft");
33976
+ },
33977
+ get disabled() {
33978
+ return borderStyle() === "none";
33979
+ },
33980
+ get checked() {
33981
+ return sideLeft();
33982
+ },
33983
+ onChange: setSideLeft,
33984
+ "data-testid": "editor-paragraph-dialog-border-side-left"
33985
+ })];
33986
+ }
33987
+ });
33988
+ }
33989
+ })];
33990
+ }
33991
+ }), null);
33992
+ return _el$;
33993
+ })();
33994
+ const lineAndPageBreaksPanel = (() => {
33995
+ var _el$2 = _tmpl$$a();
33996
+ insert(_el$2, createComponent(FieldGroup, {
33997
+ "class": "oasis-editor-dialog-fieldset",
33998
+ get legend() {
33999
+ return t("paragraph.groupPagination");
34000
+ },
34001
+ get children() {
34002
+ return createComponent(Stack, {
34003
+ direction: "column",
34004
+ spacing: 1,
34005
+ get children() {
34006
+ return [createComponent(Checkbox, {
34007
+ get label() {
34008
+ return t("paragraph.widowControlLabel");
34009
+ },
34010
+ get checked() {
34011
+ return widowControl();
34012
+ },
34013
+ onChange: setWidowControl,
34014
+ "data-testid": "editor-paragraph-dialog-widow-control"
34015
+ }), createComponent(Checkbox, {
34016
+ get label() {
34017
+ return t("paragraph.keepWithNextLabel");
34018
+ },
34019
+ get checked() {
34020
+ return keepWithNext();
34021
+ },
34022
+ onChange: setKeepWithNext,
34023
+ "data-testid": "editor-paragraph-dialog-keep-with-next"
34024
+ }), createComponent(Checkbox, {
34025
+ get label() {
34026
+ return t("paragraph.keepLinesTogetherLabel");
34027
+ },
34028
+ get checked() {
34029
+ return keepLinesTogether();
34030
+ },
34031
+ onChange: setKeepLinesTogether,
34032
+ "data-testid": "editor-paragraph-dialog-keep-lines-together"
34033
+ }), createComponent(Checkbox, {
34034
+ get label() {
34035
+ return t("paragraph.pageBreakBeforeLabel");
34036
+ },
34037
+ get checked() {
34038
+ return pageBreakBefore();
34039
+ },
34040
+ onChange: setPageBreakBefore,
34041
+ "data-testid": "editor-paragraph-dialog-page-break-before"
34042
+ })];
34043
+ }
34044
+ });
34045
+ }
34046
+ }));
34047
+ return _el$2;
34048
+ })();
34049
+ return [createComponent(Dialog, {
32970
34050
  get isOpen() {
32971
34051
  return props.isOpen;
32972
34052
  },
@@ -32976,414 +34056,91 @@ function ParagraphDialog(props) {
32976
34056
  get onClose() {
32977
34057
  return props.onClose;
32978
34058
  },
34059
+ size: "lg",
32979
34060
  get footer() {
32980
- return createComponent(DialogFooter, {
32981
- get onCancel() {
32982
- return props.onClose;
32983
- },
32984
- onConfirm: handleApply,
32985
- get cancelLabel() {
32986
- return t("generic.cancel");
32987
- },
32988
- get confirmLabel() {
32989
- return t("generic.apply");
32990
- },
32991
- cancelTestId: "editor-paragraph-dialog-cancel",
32992
- confirmTestId: "editor-paragraph-dialog-apply"
32993
- });
34061
+ return (() => {
34062
+ var _el$4 = _tmpl$3$1(), _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling;
34063
+ insert(_el$5, createComponent(Button, {
34064
+ variant: "secondary",
34065
+ onClick: () => {
34066
+ setTabsDialogOpen(true);
34067
+ },
34068
+ "data-testid": "editor-paragraph-dialog-tabs",
34069
+ get children() {
34070
+ return t("paragraph.tabsButton");
34071
+ }
34072
+ }), null);
34073
+ insert(_el$5, createComponent(Button, {
34074
+ variant: "secondary",
34075
+ onClick: handleSetDefault,
34076
+ "data-testid": "editor-paragraph-dialog-set-default",
34077
+ get children() {
34078
+ return t("paragraph.setAsDefault");
34079
+ }
34080
+ }), null);
34081
+ insert(_el$6, createComponent(Button, {
34082
+ variant: "secondary",
34083
+ get onClick() {
34084
+ return props.onClose;
34085
+ },
34086
+ "data-testid": "editor-paragraph-dialog-cancel",
34087
+ get children() {
34088
+ return t("generic.cancel");
34089
+ }
34090
+ }), null);
34091
+ insert(_el$6, createComponent(Button, {
34092
+ variant: "primary",
34093
+ onClick: handleApply,
34094
+ "data-testid": "editor-paragraph-dialog-apply",
34095
+ get children() {
34096
+ return t("generic.apply");
34097
+ }
34098
+ }), null);
34099
+ return _el$4;
34100
+ })();
32994
34101
  },
32995
34102
  get children() {
32996
- return [createComponent(Grid, {
32997
- container: true,
32998
- spacing: 1.5,
32999
- get children() {
33000
- return createComponent(Grid, {
33001
- size: {
33002
- xs: 12,
33003
- md: 6
33004
- },
33005
- get children() {
33006
- return createComponent(SelectField, {
33007
- get label() {
33008
- return t("paragraph.alignLabel");
33009
- },
33010
- get value() {
33011
- return align();
33012
- },
33013
- onChange: setAlign,
33014
- "data-testid": "editor-paragraph-dialog-align",
33015
- get options() {
33016
- return [{
33017
- value: "left",
33018
- label: t("paragraph.alignLeft")
33019
- }, {
33020
- value: "center",
33021
- label: t("paragraph.alignCenter")
33022
- }, {
33023
- value: "right",
33024
- label: t("paragraph.alignRight")
33025
- }, {
33026
- value: "justify",
33027
- label: t("paragraph.alignJustify")
33028
- }];
33029
- }
33030
- });
33031
- }
33032
- });
33033
- }
33034
- }), createComponent(Grid, {
33035
- container: true,
33036
- spacing: 1.5,
33037
- get children() {
33038
- return [createComponent(Grid, {
33039
- size: {
33040
- xs: 12,
33041
- md: 6
33042
- },
33043
- get children() {
33044
- return createComponent(NumberField, {
33045
- get label() {
33046
- return t("paragraph.indentLeftLabel");
33047
- },
33048
- step: "1",
33049
- get value() {
33050
- return indentLeft() ?? "";
33051
- },
33052
- onChange: setIndentLeft,
33053
- "data-testid": "editor-paragraph-dialog-indent-left"
33054
- });
33055
- }
33056
- }), createComponent(Grid, {
33057
- size: {
33058
- xs: 12,
33059
- md: 6
33060
- },
33061
- get children() {
33062
- return createComponent(NumberField, {
33063
- get label() {
33064
- return t("paragraph.indentRightLabel");
33065
- },
33066
- step: "1",
33067
- get value() {
33068
- return indentRight() ?? "";
33069
- },
33070
- onChange: setIndentRight,
33071
- "data-testid": "editor-paragraph-dialog-indent-right"
33072
- });
33073
- }
33074
- })];
33075
- }
33076
- }), createComponent(Grid, {
33077
- container: true,
33078
- spacing: 1.5,
33079
- get children() {
33080
- return [createComponent(Grid, {
33081
- size: {
33082
- xs: 12,
33083
- md: 6
33084
- },
33085
- get children() {
33086
- return createComponent(SelectField, {
33087
- get label() {
33088
- return t("paragraph.specialLabel");
33089
- },
33090
- get value() {
33091
- return special();
33092
- },
33093
- onChange: (value) => {
33094
- const next = value;
33095
- setSpecial(next);
33096
- if (next === "none") setSpecialBy(null);
33097
- },
33098
- "data-testid": "editor-paragraph-dialog-special",
33099
- get options() {
33100
- return [{
33101
- value: "none",
33102
- label: t("paragraph.specialNone")
33103
- }, {
33104
- value: "firstLine",
33105
- label: t("paragraph.specialFirstLine")
33106
- }, {
33107
- value: "hanging",
33108
- label: t("paragraph.specialHanging")
33109
- }];
33110
- }
33111
- });
33112
- }
33113
- }), createComponent(Grid, {
33114
- size: {
33115
- xs: 12,
33116
- md: 6
33117
- },
33118
- get children() {
33119
- return createComponent(NumberField, {
33120
- get label() {
33121
- return t("paragraph.specialByLabel");
33122
- },
33123
- min: "0",
33124
- step: "1",
33125
- get disabled() {
33126
- return special() === "none";
33127
- },
33128
- get value() {
33129
- return specialBy() ?? "";
33130
- },
33131
- onChange: setSpecialBy,
33132
- "data-testid": "editor-paragraph-dialog-special-by"
33133
- });
33134
- }
33135
- })];
33136
- }
33137
- }), createComponent(Grid, {
33138
- container: true,
33139
- spacing: 1.5,
33140
- get children() {
33141
- return [createComponent(Grid, {
33142
- size: {
33143
- xs: 12,
33144
- md: 4
33145
- },
33146
- get children() {
33147
- return createComponent(NumberField, {
33148
- get label() {
33149
- return t("paragraph.spacingBeforeLabel");
33150
- },
33151
- min: "0",
33152
- step: "1",
33153
- get value() {
33154
- return spacingBefore() ?? "";
33155
- },
33156
- onChange: setSpacingBefore,
33157
- "data-testid": "editor-paragraph-dialog-spacing-before"
33158
- });
33159
- }
33160
- }), createComponent(Grid, {
33161
- size: {
33162
- xs: 12,
33163
- md: 4
33164
- },
33165
- get children() {
33166
- return createComponent(NumberField, {
33167
- get label() {
33168
- return t("paragraph.spacingAfterLabel");
33169
- },
33170
- min: "0",
33171
- step: "1",
33172
- get value() {
33173
- return spacingAfter() ?? "";
33174
- },
33175
- onChange: setSpacingAfter,
33176
- "data-testid": "editor-paragraph-dialog-spacing-after"
33177
- });
33178
- }
33179
- }), createComponent(Grid, {
33180
- size: {
33181
- xs: 12,
33182
- md: 4
33183
- },
33184
- get children() {
33185
- return createComponent(NumberField, {
33186
- get label() {
33187
- return t("paragraph.lineSpacingLabel");
33188
- },
33189
- min: "0.5",
33190
- step: "0.05",
33191
- get value() {
33192
- return lineHeight() ?? "";
33193
- },
33194
- onChange: setLineHeight,
33195
- "data-testid": "editor-paragraph-dialog-line-height"
33196
- });
33197
- }
33198
- })];
33199
- }
33200
- }), createComponent(Grid, {
33201
- container: true,
33202
- spacing: 1.5,
33203
- get children() {
33204
- return [createComponent(Grid, {
33205
- size: {
33206
- xs: 12,
33207
- md: 3
33208
- },
33209
- get children() {
33210
- return createComponent(SelectField, {
33211
- get label() {
33212
- return t("paragraph.borderStyleLabel");
33213
- },
33214
- get value() {
33215
- return borderStyle();
33216
- },
33217
- onChange: (value) => {
33218
- const next = value;
33219
- setBorderStyle(next);
33220
- if (next === "none") {
33221
- setSideTop(false);
33222
- setSideRight(false);
33223
- setSideBottom(false);
33224
- setSideLeft(false);
33225
- } else if (!sideTop() && !sideRight() && !sideBottom() && !sideLeft()) {
33226
- setSideTop(true);
33227
- setSideRight(true);
33228
- setSideBottom(true);
33229
- setSideLeft(true);
33230
- }
33231
- },
33232
- "data-testid": "editor-paragraph-dialog-border-style",
33233
- get options() {
33234
- return [{
33235
- value: "none",
33236
- label: t("paragraph.borderNone")
33237
- }, {
33238
- value: "solid",
33239
- label: t("paragraph.borderSolid")
33240
- }, {
33241
- value: "dashed",
33242
- label: t("paragraph.borderDashed")
33243
- }, {
33244
- value: "dotted",
33245
- label: t("paragraph.borderDotted")
33246
- }];
33247
- }
33248
- });
33249
- }
33250
- }), createComponent(Grid, {
33251
- size: {
33252
- xs: 12,
33253
- md: 3
33254
- },
33255
- get children() {
33256
- return createComponent(NumberField, {
33257
- get label() {
33258
- return t("paragraph.borderWidthLabel");
33259
- },
33260
- min: "0",
33261
- step: "0.25",
33262
- get disabled() {
33263
- return borderStyle() === "none";
33264
- },
33265
- get value() {
33266
- return borderWidth() ?? "";
33267
- },
33268
- onChange: setBorderWidth,
33269
- "data-testid": "editor-paragraph-dialog-border-width"
33270
- });
33271
- }
33272
- }), createComponent(Grid, {
33273
- size: {
33274
- xs: 12,
33275
- md: 3
33276
- },
33277
- get children() {
33278
- return createComponent(ColorField, {
33279
- get label() {
33280
- return t("paragraph.borderColorLabel");
33281
- },
33282
- get disabled() {
33283
- return borderStyle() === "none";
33284
- },
33285
- get value() {
33286
- return borderColor() || DEFAULT_BORDER_COLOR$1;
33287
- },
33288
- onChange: setBorderColor,
33289
- "data-testid": "editor-paragraph-dialog-border-color"
33290
- });
33291
- }
33292
- }), createComponent(Grid, {
33293
- size: {
33294
- xs: 12,
33295
- md: 3
33296
- },
33297
- get children() {
33298
- return createComponent(ColorField, {
33299
- get label() {
33300
- return t("paragraph.shadingLabel");
33301
- },
33302
- get value() {
33303
- return shading() || "#ffffff";
33304
- },
33305
- onChange: setShading,
33306
- "data-testid": "editor-paragraph-dialog-shading"
33307
- });
33308
- }
33309
- })];
33310
- }
33311
- }), createComponent(FormField, {
33312
- "class": "oasis-editor-dialog-input-group-grow",
33313
- get label() {
33314
- return t("paragraph.borderSidesLabel");
34103
+ return [createComponent(Tabs, {
34104
+ get ariaLabel() {
34105
+ return t("paragraph.title");
33315
34106
  },
33316
- get children() {
33317
- return createComponent(Stack, {
33318
- "class": "oasis-editor-dialog-style-row",
33319
- direction: "row",
33320
- spacing: 1,
33321
- get children() {
33322
- return [createComponent(Checkbox, {
33323
- get label() {
33324
- return t("paragraph.borderSideTop");
33325
- },
33326
- get disabled() {
33327
- return borderStyle() === "none";
33328
- },
33329
- get checked() {
33330
- return sideTop();
33331
- },
33332
- onChange: setSideTop,
33333
- "data-testid": "editor-paragraph-dialog-border-side-top"
33334
- }), createComponent(Checkbox, {
33335
- get label() {
33336
- return t("paragraph.borderSideRight");
33337
- },
33338
- get disabled() {
33339
- return borderStyle() === "none";
33340
- },
33341
- get checked() {
33342
- return sideRight();
33343
- },
33344
- onChange: setSideRight,
33345
- "data-testid": "editor-paragraph-dialog-border-side-right"
33346
- }), createComponent(Checkbox, {
33347
- get label() {
33348
- return t("paragraph.borderSideBottom");
33349
- },
33350
- get disabled() {
33351
- return borderStyle() === "none";
33352
- },
33353
- get checked() {
33354
- return sideBottom();
33355
- },
33356
- onChange: setSideBottom,
33357
- "data-testid": "editor-paragraph-dialog-border-side-bottom"
33358
- }), createComponent(Checkbox, {
33359
- get label() {
33360
- return t("paragraph.borderSideLeft");
33361
- },
33362
- get disabled() {
33363
- return borderStyle() === "none";
33364
- },
33365
- get checked() {
33366
- return sideLeft();
33367
- },
33368
- onChange: setSideLeft,
33369
- "data-testid": "editor-paragraph-dialog-border-side-left"
33370
- })];
33371
- }
33372
- });
34107
+ get items() {
34108
+ return [{
34109
+ id: "indents",
34110
+ label: t("paragraph.tabIndentsSpacing"),
34111
+ panel: indentsAndSpacingPanel,
34112
+ testId: "editor-paragraph-dialog-tab-indents"
34113
+ }, {
34114
+ id: "breaks",
34115
+ label: t("paragraph.tabLineBreaks"),
34116
+ panel: lineAndPageBreaksPanel,
34117
+ testId: "editor-paragraph-dialog-tab-breaks"
34118
+ }];
33373
34119
  }
33374
34120
  }), createComponent(FormField, {
33375
34121
  get label() {
33376
34122
  return t("paragraph.preview");
33377
34123
  },
33378
34124
  get children() {
33379
- var _el$ = _tmpl$$a();
33380
- insert(_el$, () => t("paragraph.previewText"));
33381
- createRenderEffect((_$p) => style(_el$, previewStyle(), _$p));
33382
- return _el$;
34125
+ var _el$3 = _tmpl$2$2();
34126
+ insert(_el$3, () => t("paragraph.previewText"));
34127
+ createRenderEffect((_$p) => style(_el$3, previewStyle(), _$p));
34128
+ return _el$3;
33383
34129
  }
33384
34130
  })];
33385
34131
  }
33386
- });
34132
+ }), createComponent(TabStopsDialog, {
34133
+ get isOpen() {
34134
+ return tabsDialogOpen();
34135
+ },
34136
+ get initial() {
34137
+ return tabs();
34138
+ },
34139
+ onClose: () => {
34140
+ setTabsDialogOpen(false);
34141
+ },
34142
+ onApply: setTabs
34143
+ })];
33387
34144
  }
33388
34145
  const DEFAULT_BORDER_WIDTH_PT = 0.5;
33389
34146
  const DEFAULT_BORDER_COLOR = "#000000";
@@ -34949,6 +35706,9 @@ function EditorDialogsLayer(props) {
34949
35706
  },
34950
35707
  get onApply() {
34951
35708
  return props.applyParagraphDialogValues;
35709
+ },
35710
+ get onSetDefault() {
35711
+ return props.setParagraphDialogDefault;
34952
35712
  }
34953
35713
  }), createComponent(TablePropertiesDialog, {
34954
35714
  get isOpen() {
@@ -35494,7 +36254,9 @@ function serializeParagraphBorders(style2) {
35494
36254
  ["bottom", style2.borderBottom],
35495
36255
  ["right", style2.borderRight]
35496
36256
  ];
35497
- const parts = edges.filter((entry) => entry[1] != null).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`);
36257
+ const parts = edges.filter((entry) => entry[1] != null).map(
36258
+ ([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`
36259
+ );
35498
36260
  return parts.length > 0 ? `<w:pBdr>${parts.join("")}</w:pBdr>` : "";
35499
36261
  }
35500
36262
  const DEFAULT_TABLE_BORDER_COLOR = "6F6F6F";
@@ -35825,7 +36587,9 @@ function serializeTableBorders(style2) {
35825
36587
  if (!borders) return "";
35826
36588
  const xml = TABLE_BORDER_EDGE_KEYS.map(
35827
36589
  ([name, key]) => [name, borders[key]]
35828
- ).filter((entry) => !!entry[1]).map(([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`).join("");
36590
+ ).filter((entry) => !!entry[1]).map(
36591
+ ([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`
36592
+ ).join("");
35829
36593
  return xml ? `<w:tblBorders>${xml}</w:tblBorders>` : "";
35830
36594
  }
35831
36595
  function serializeTableProperties(table) {
@@ -35969,7 +36733,11 @@ function serializeTableXml(table, serializeParagraphXml2) {
35969
36733
  }).join("");
35970
36734
  return `<w:tr${serializeExtAttributes(row.extAttributes)}>${serializeTablePropertyExceptions(row.propertyExceptions, row.tblPrExChangeXml)}${serializeTableRowProperties(row)}${cellsXml}</w:tr>`;
35971
36735
  }).join("");
35972
- const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map((width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`).join("")}${table.gridRevision ? `<w:tblGridChange ${serializeRevisionAttrs(table.gridRevision)}><w:tblGrid>${table.gridRevision.previous.map((width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
36736
+ const gridXml = table.gridCols ? `<w:tblGrid>${table.gridCols.map(
36737
+ (width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`
36738
+ ).join("")}${table.gridRevision ? `<w:tblGridChange ${serializeRevisionAttrs(table.gridRevision)}><w:tblGrid>${table.gridRevision.previous.map(
36739
+ (width) => `<w:gridCol w:w="${pointsToTwips(width) ?? 0}"/>`
36740
+ ).join("")}</w:tblGrid></w:tblGridChange>` : ""}</w:tblGrid>` : "";
35973
36741
  return `<w:tbl>${serializeTableProperties(table)}${gridXml}${rowsXml}</w:tbl>`;
35974
36742
  }
35975
36743
  function materializeParagraphStyle(paragraph, styles) {
@@ -35985,6 +36753,7 @@ function materializeParagraphStyle(paragraph, styles) {
35985
36753
  indentRight: effective.indentRight,
35986
36754
  indentFirstLine: effective.indentFirstLine,
35987
36755
  indentHanging: effective.indentHanging,
36756
+ mirrorIndents: effective.mirrorIndents,
35988
36757
  pageBreakBefore: effective.pageBreakBefore,
35989
36758
  keepWithNext: effective.keepWithNext,
35990
36759
  keepLinesTogether: effective.keepLinesTogether,
@@ -36121,6 +36890,7 @@ function serializeParagraphStyleXml(style2) {
36121
36890
  if (style2.keepLinesTogether) parts.push("<w:keepLines/>");
36122
36891
  if (style2.widowControl === false) parts.push('<w:widowControl w:val="0"/>');
36123
36892
  if (style2.contextualSpacing) parts.push("<w:contextualSpacing/>");
36893
+ if (style2.mirrorIndents) parts.push("<w:mirrorIndents/>");
36124
36894
  const paragraphBorders = serializeParagraphBorders(style2);
36125
36895
  if (paragraphBorders) {
36126
36896
  parts.push(paragraphBorders);
@@ -36185,6 +36955,7 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
36185
36955
  if (style2.keepLinesTogether) parts.push("<w:keepLines/>");
36186
36956
  if (style2.widowControl === false) parts.push('<w:widowControl w:val="0"/>');
36187
36957
  if (style2.contextualSpacing) parts.push("<w:contextualSpacing/>");
36958
+ if (style2.mirrorIndents) parts.push("<w:mirrorIndents/>");
36188
36959
  const paragraphBorders = serializeParagraphBorders(style2);
36189
36960
  if (paragraphBorders) {
36190
36961
  parts.push(paragraphBorders);
@@ -37008,16 +37779,20 @@ function serializeParagraphXml(paragraph, context, styles, overrides) {
37008
37779
  const bookmarkEvents = (_a2 = context.bookmarkEventsByParagraph) == null ? void 0 : _a2.get(paragraph.id);
37009
37780
  const commentEvents = (_b2 = context.commentEventsByParagraph) == null ? void 0 : _b2.get(paragraph.id);
37010
37781
  const boundaryTokens = [
37011
- ...(bookmarkEvents ?? []).map((e) => ({
37012
- offset: e.offset,
37013
- seq: e.seq,
37014
- xml: serializeBookmarkEvent(e)
37015
- })),
37016
- ...(commentEvents ?? []).map((e) => ({
37017
- offset: e.offset,
37018
- seq: e.seq,
37019
- xml: serializeCommentRangeEvent(e)
37020
- }))
37782
+ ...(bookmarkEvents ?? []).map(
37783
+ (e) => ({
37784
+ offset: e.offset,
37785
+ seq: e.seq,
37786
+ xml: serializeBookmarkEvent(e)
37787
+ })
37788
+ ),
37789
+ ...(commentEvents ?? []).map(
37790
+ (e) => ({
37791
+ offset: e.offset,
37792
+ seq: e.seq,
37793
+ xml: serializeCommentRangeEvent(e)
37794
+ })
37795
+ )
37021
37796
  ];
37022
37797
  const runsXml = boundaryTokens.length > 0 ? serializeRunsWithBoundaries(
37023
37798
  runs,
@@ -37299,7 +38074,9 @@ function serializeTableStyleProperties(style2) {
37299
38074
  }
37300
38075
  if (style2.borders) {
37301
38076
  const { borders } = style2;
37302
- const xml = TABLE_BORDER_EDGE_KEYS.filter(([, key]) => !!borders[key]).map(
38077
+ const xml = TABLE_BORDER_EDGE_KEYS.filter(
38078
+ ([, key]) => !!borders[key]
38079
+ ).map(
37303
38080
  ([name, key]) => `<w:${name} ${serializeDocxBorderAttrs(borders[key])}`
37304
38081
  ).join("");
37305
38082
  if (xml) parts.push(`<w:tblBorders>${xml}</w:tblBorders>`);
@@ -37362,7 +38139,9 @@ function serializeNamedStyle(style2) {
37362
38139
  if (tblPr) parts.push(tblPr);
37363
38140
  if (ts.conditionalFormats) {
37364
38141
  const orderedKeys = [
37365
- ...CONDITIONAL_TYPE_ORDER.filter((k) => k in ts.conditionalFormats),
38142
+ ...CONDITIONAL_TYPE_ORDER.filter(
38143
+ (k) => k in ts.conditionalFormats
38144
+ ),
37366
38145
  ...Object.keys(ts.conditionalFormats).filter(
37367
38146
  (k) => !CONDITIONAL_TYPE_ORDER.includes(k)
37368
38147
  )
@@ -38070,10 +38849,12 @@ async function exportEditorDocumentToDocx(document2) {
38070
38849
  if (endnotesPart) {
38071
38850
  allImages.push(...endnotesPart.partContext.images);
38072
38851
  }
38073
- const imageExtensions = allImages.filter((img) => img.kind === "embedded").map((img) => {
38074
- var _a3;
38075
- return (_a3 = img.target.split(".").pop()) == null ? void 0 : _a3.toLowerCase();
38076
- }).filter((ext) => Boolean(ext));
38852
+ const imageExtensions = allImages.filter((img) => img.kind === "embedded").map(
38853
+ (img) => {
38854
+ var _a3;
38855
+ return (_a3 = img.target.split(".").pop()) == null ? void 0 : _a3.toLowerCase();
38856
+ }
38857
+ ).filter((ext) => Boolean(ext));
38077
38858
  const hasStyles = document2.styles != null && Object.keys(document2.styles).length > 0;
38078
38859
  const hasFontTable = (((_i = document2.fontTable) == null ? void 0 : _i.length) ?? 0) > 0;
38079
38860
  zip.file(
@@ -38352,7 +39133,9 @@ async function drawFloatingTextBoxesForParagraph(options) {
38352
39133
  } = options;
38353
39134
  for (const line of lines) {
38354
39135
  const slotByOffset = new Map(
38355
- line.slots.map((slot) => [slot.offset, slot])
39136
+ line.slots.map(
39137
+ (slot) => [slot.offset, slot]
39138
+ )
38356
39139
  );
38357
39140
  for (const fragment of line.fragments) {
38358
39141
  const textBox = fragment.textBox;
@@ -38420,9 +39203,10 @@ async function fetchAsDataUrl(src) {
38420
39203
  }
38421
39204
  const blob = await response.blob();
38422
39205
  const bytes = new Uint8Array(await blob.arrayBuffer());
38423
- const binary = Array.from(bytes, (byte) => String.fromCharCode(byte)).join(
38424
- ""
38425
- );
39206
+ const binary = Array.from(
39207
+ bytes,
39208
+ (byte) => String.fromCharCode(byte)
39209
+ ).join("");
38426
39210
  const base64 = typeof btoa === "function" ? btoa(binary) : Buffer.from(bytes).toString("base64");
38427
39211
  return `data:${blob.type || "application/octet-stream"};base64,${base64}`;
38428
39212
  }
@@ -38517,7 +39301,9 @@ async function registerPdfImageRun(writer, document2, image) {
38517
39301
  }
38518
39302
  function resolveFragmentSlots(line, fragment) {
38519
39303
  const slotByOffset = new Map(
38520
- line.slots.map((slot) => [slot.offset, slot])
39304
+ line.slots.map(
39305
+ (slot) => [slot.offset, slot]
39306
+ )
38521
39307
  );
38522
39308
  const result = [];
38523
39309
  for (const char of fragment.chars) {
@@ -38542,7 +39328,9 @@ function resolveFragmentBounds(line, fragment, fontSizePx) {
38542
39328
  return null;
38543
39329
  }
38544
39330
  const slotByOffset = new Map(
38545
- line.slots.map((slot) => [slot.offset, slot])
39331
+ line.slots.map(
39332
+ (slot) => [slot.offset, slot]
39333
+ )
38546
39334
  );
38547
39335
  const first = slots[0];
38548
39336
  const last = slots[slots.length - 1];
@@ -38683,7 +39471,9 @@ function drawFragmentEmphasis(writer, pageIndex, line, fragment, originX, origin
38683
39471
  function drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2, originX, baselineY, color) {
38684
39472
  var _a2;
38685
39473
  const slotByOffset = new Map(
38686
- line.slots.map((slot) => [slot.offset, slot])
39474
+ line.slots.map(
39475
+ (slot) => [slot.offset, slot]
39476
+ )
38687
39477
  );
38688
39478
  const paragraphStyle = resolveEffectiveParagraphStyle(
38689
39479
  paragraph.style,
@@ -38846,7 +39636,9 @@ function groupSlotChunksByOffsetGaps(chars) {
38846
39636
  }
38847
39637
  async function drawFloatingImagesForParagraph(options) {
38848
39638
  for (const line of options.lines) {
38849
- const slots = new Map(line.slots.map((slot) => [slot.offset, slot]));
39639
+ const slots = new Map(
39640
+ line.slots.map((slot) => [slot.offset, slot])
39641
+ );
38850
39642
  for (const fragment of line.fragments) {
38851
39643
  const image = fragment.image;
38852
39644
  if (!(image == null ? void 0 : image.floating)) continue;
@@ -39013,7 +39805,9 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
39013
39805
  const baselineShiftPx = (styles.baselineShift ?? 0) * PX_PER_POINT;
39014
39806
  const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO - baselineShiftPx;
39015
39807
  const chars = resolveFragmentSlots(line, fragment);
39016
- const text = chars.map((char) => styles.allCaps ? char.char.toUpperCase() : char.char).join("");
39808
+ const text = chars.map(
39809
+ (char) => styles.allCaps ? char.char.toUpperCase() : char.char
39810
+ ).join("");
39017
39811
  const firstChar = chars[0];
39018
39812
  if (!firstChar || text.length === 0) return;
39019
39813
  drawLinkAnnotation(
@@ -40296,13 +41090,15 @@ function parseFeatureList(reader, featureListOffset) {
40296
41090
  const offset = featureListOffset + reader.u16();
40297
41091
  records.push({ tag, offset });
40298
41092
  }
40299
- return records.map(({ tag, offset }) => {
40300
- reader.seek(offset);
40301
- reader.skip(2);
40302
- const lookupIndexCount = reader.u16();
40303
- const lookupIndices = readU16Array(reader, lookupIndexCount);
40304
- return { tag, lookupIndices };
40305
- });
41093
+ return records.map(
41094
+ ({ tag, offset }) => {
41095
+ reader.seek(offset);
41096
+ reader.skip(2);
41097
+ const lookupIndexCount = reader.u16();
41098
+ const lookupIndices = readU16Array(reader, lookupIndexCount);
41099
+ return { tag, lookupIndices };
41100
+ }
41101
+ );
40306
41102
  }
40307
41103
  function parseScriptList(reader, scriptListOffset) {
40308
41104
  reader.seek(scriptListOffset);
@@ -40360,25 +41156,27 @@ function parseLookupList(reader, lookupListOffset, parseSubtable2) {
40360
41156
  lookupCount,
40361
41157
  lookupListOffset
40362
41158
  );
40363
- return lookupOffsets.map((lookupOffset) => {
40364
- reader.seek(lookupOffset);
40365
- const lookupType = reader.u16();
40366
- reader.skip(2);
40367
- const subtableOffsets = readU16OffsetArray(
40368
- reader,
40369
- reader.u16(),
40370
- lookupOffset
40371
- );
40372
- const subtables = [];
40373
- for (const subtableOffset of subtableOffsets) {
40374
- try {
40375
- const subtable = parseSubtable2(reader, subtableOffset, lookupType);
40376
- if (subtable) subtables.push(subtable);
40377
- } catch {
41159
+ return lookupOffsets.map(
41160
+ (lookupOffset) => {
41161
+ reader.seek(lookupOffset);
41162
+ const lookupType = reader.u16();
41163
+ reader.skip(2);
41164
+ const subtableOffsets = readU16OffsetArray(
41165
+ reader,
41166
+ reader.u16(),
41167
+ lookupOffset
41168
+ );
41169
+ const subtables = [];
41170
+ for (const subtableOffset of subtableOffsets) {
41171
+ try {
41172
+ const subtable = parseSubtable2(reader, subtableOffset, lookupType);
41173
+ if (subtable) subtables.push(subtable);
41174
+ } catch {
41175
+ }
40378
41176
  }
41177
+ return { lookupType, subtables };
40379
41178
  }
40380
- return { lookupType, subtables };
40381
- });
41179
+ );
40382
41180
  }
40383
41181
  function collectLookupIndices(featureToLookups, tags) {
40384
41182
  const indices = /* @__PURE__ */ new Set();
@@ -40447,10 +41245,12 @@ function parseMultipleSubst(reader, offset) {
40447
41245
  const ids = sequences[index];
40448
41246
  if (ids.length === 0) return null;
40449
41247
  const codePoints = glyph.codePoints;
40450
- const replacement = ids.map((id, i) => ({
40451
- id,
40452
- codePoints: i === 0 ? codePoints : []
40453
- }));
41248
+ const replacement = ids.map(
41249
+ (id, i) => ({
41250
+ id,
41251
+ codePoints: i === 0 ? codePoints : []
41252
+ })
41253
+ );
40454
41254
  glyphs.splice(pos, 1, ...replacement);
40455
41255
  return ids.length;
40456
41256
  }
@@ -40480,17 +41280,24 @@ function parseLigatureSubst(reader, offset) {
40480
41280
  const coverageOffset = offset + reader.u16();
40481
41281
  const ligSetCount = reader.u16();
40482
41282
  const ligSetOffsets = readU16OffsetArray(reader, ligSetCount, offset);
40483
- const ligatureSets = ligSetOffsets.map((setOffset) => {
40484
- reader.seek(setOffset);
40485
- const ligOffsets = readU16OffsetArray(reader, reader.u16(), setOffset);
40486
- return ligOffsets.map((ligOffset) => {
40487
- reader.seek(ligOffset);
40488
- const ligatureGlyph = reader.u16();
40489
- const componentCount = reader.u16();
40490
- const components = readU16Array(reader, Math.max(0, componentCount - 1));
40491
- return { ligatureGlyph, components };
40492
- });
40493
- });
41283
+ const ligatureSets = ligSetOffsets.map(
41284
+ (setOffset) => {
41285
+ reader.seek(setOffset);
41286
+ const ligOffsets = readU16OffsetArray(reader, reader.u16(), setOffset);
41287
+ return ligOffsets.map(
41288
+ (ligOffset) => {
41289
+ reader.seek(ligOffset);
41290
+ const ligatureGlyph = reader.u16();
41291
+ const componentCount = reader.u16();
41292
+ const components = readU16Array(
41293
+ reader,
41294
+ Math.max(0, componentCount - 1)
41295
+ );
41296
+ return { ligatureGlyph, components };
41297
+ }
41298
+ );
41299
+ }
41300
+ );
40494
41301
  const coverage = parseCoverage(reader, coverageOffset);
40495
41302
  return {
40496
41303
  apply(glyphs, pos) {
@@ -40566,7 +41373,9 @@ function parseChainContextSubst(reader, offset) {
40566
41373
  const backtrack = backtrackCoverageOffsets.map(
40567
41374
  (o) => parseCoverage(reader, o)
40568
41375
  );
40569
- const input = inputCoverageOffsets.map((o) => parseCoverage(reader, o));
41376
+ const input = inputCoverageOffsets.map(
41377
+ (o) => parseCoverage(reader, o)
41378
+ );
40570
41379
  const lookahead = lookaheadCoverageOffsets.map(
40571
41380
  (o) => parseCoverage(reader, o)
40572
41381
  );
@@ -40648,14 +41457,16 @@ function parseChainRuleSet(reader, setOffset) {
40648
41457
  reader.seek(setOffset);
40649
41458
  const ruleCount = reader.u16();
40650
41459
  const ruleOffsets = readU16OffsetArray(reader, ruleCount, setOffset);
40651
- return ruleOffsets.map((ruleOffset) => {
40652
- reader.seek(ruleOffset);
40653
- const backtrack = readU16Array(reader, reader.u16());
40654
- const input = readU16Array(reader, Math.max(0, reader.u16() - 1));
40655
- const lookahead = readU16Array(reader, reader.u16());
40656
- const records = readSubstLookupRecords(reader, reader.u16());
40657
- return { backtrack, input, lookahead, records };
40658
- });
41460
+ return ruleOffsets.map(
41461
+ (ruleOffset) => {
41462
+ reader.seek(ruleOffset);
41463
+ const backtrack = readU16Array(reader, reader.u16());
41464
+ const input = readU16Array(reader, Math.max(0, reader.u16() - 1));
41465
+ const lookahead = readU16Array(reader, reader.u16());
41466
+ const records = readSubstLookupRecords(reader, reader.u16());
41467
+ return { backtrack, input, lookahead, records };
41468
+ }
41469
+ );
40659
41470
  }
40660
41471
  function applyChainRules(rules, glyphs, pos, engine, resolver) {
40661
41472
  const valueAt = (index, kind) => {
@@ -41100,7 +41911,10 @@ function pad4(length) {
41100
41911
  return length + 3 & -4;
41101
41912
  }
41102
41913
  function concat(chunks) {
41103
- const total = chunks.reduce((sum, chunk) => sum + pad4(chunk.byteLength), 0);
41914
+ const total = chunks.reduce(
41915
+ (sum, chunk) => sum + pad4(chunk.byteLength),
41916
+ 0
41917
+ );
41104
41918
  const result = new Uint8Array(total);
41105
41919
  let offset = 0;
41106
41920
  for (const chunk of chunks) {
@@ -41150,7 +41964,9 @@ function subsetClosure(font, initialGlyphs) {
41150
41964
  const loca = font.getRawTableData("loca");
41151
41965
  const head = font.getRawTableData("head");
41152
41966
  if (!glyf || !loca || !head) {
41153
- return Array.from(/* @__PURE__ */ new Set([0, ...initialGlyphs])).sort((a, b) => a - b);
41967
+ return Array.from(/* @__PURE__ */ new Set([0, ...initialGlyphs])).sort(
41968
+ (a, b) => a - b
41969
+ );
41154
41970
  }
41155
41971
  const offsets = readLoca(loca, u16$1(head, 50));
41156
41972
  const used = /* @__PURE__ */ new Set([0, ...initialGlyphs]);
@@ -41247,10 +42063,12 @@ class TrueTypePdfFontSubsetter {
41247
42063
  const fontFile = buildSfnt(
41248
42064
  65536,
41249
42065
  new Map(
41250
- Object.entries(tables).map(([tag, data]) => [
41251
- tag.charCodeAt(0) << 24 | tag.charCodeAt(1) << 16 | tag.charCodeAt(2) << 8 | tag.charCodeAt(3),
41252
- data
41253
- ])
42066
+ Object.entries(tables).map(
42067
+ ([tag, data]) => [
42068
+ tag.charCodeAt(0) << 24 | tag.charCodeAt(1) << 16 | tag.charCodeAt(2) << 8 | tag.charCodeAt(3),
42069
+ data
42070
+ ]
42071
+ )
41254
42072
  )
41255
42073
  ).ttf;
41256
42074
  const maxGlyphId = Math.max(0, ...glyphIds);
@@ -41357,7 +42175,9 @@ class PdfFontTable {
41357
42175
  }
41358
42176
  return addObject(fontResourceObjectBody(font));
41359
42177
  });
41360
- const resourceXml = fontResourceEntries.map((font, index) => `/${font.resourceName} ${fontObjectIds[index]} 0 R`).join(" ");
42178
+ const resourceXml = fontResourceEntries.map(
42179
+ (font, index) => `/${font.resourceName} ${fontObjectIds[index]} 0 R`
42180
+ ).join(" ");
41361
42181
  return { resourceXml };
41362
42182
  }
41363
42183
  layoutUnicodeText(state, text, features) {
@@ -41371,15 +42191,17 @@ class PdfFontTable {
41371
42191
  return run;
41372
42192
  }
41373
42193
  encodeUnicodeGlyphRun(state, run) {
41374
- return run.glyphs.map((glyph, index) => {
41375
- if (!state.usedGlyphs.has(glyph.id)) {
41376
- state.usedGlyphs.set(glyph.id, glyph);
41377
- }
41378
- const position = run.positions[index];
41379
- const nominalWidth = glyph.advanceWidth * state.scale;
41380
- const desiredAdvance = ((position == null ? void 0 : position.xAdvance) ?? glyph.advanceWidth) * state.scale;
41381
- return { glyphId: glyph.id, nominalWidth, desiredAdvance };
41382
- });
42194
+ return run.glyphs.map(
42195
+ (glyph, index) => {
42196
+ if (!state.usedGlyphs.has(glyph.id)) {
42197
+ state.usedGlyphs.set(glyph.id, glyph);
42198
+ }
42199
+ const position = run.positions[index];
42200
+ const nominalWidth = glyph.advanceWidth * state.scale;
42201
+ const desiredAdvance = ((position == null ? void 0 : position.xAdvance) ?? glyph.advanceWidth) * state.scale;
42202
+ return { glyphId: glyph.id, nominalWidth, desiredAdvance };
42203
+ }
42204
+ );
41383
42205
  }
41384
42206
  addUnicodeFontObjects(state, addObject) {
41385
42207
  const subset = state.font.subsetter.createSubset(
@@ -42114,7 +42936,10 @@ function chunkByteLength(chunk) {
42114
42936
  return typeof chunk === "string" ? byteLength(chunk) : chunk.length;
42115
42937
  }
42116
42938
  function concatChunks(chunks) {
42117
- const total = chunks.reduce((sum, chunk) => sum + chunkByteLength(chunk), 0);
42939
+ const total = chunks.reduce(
42940
+ (sum, chunk) => sum + chunkByteLength(chunk),
42941
+ 0
42942
+ );
42118
42943
  const out = new Uint8Array(total);
42119
42944
  let offset = 0;
42120
42945
  for (const chunk of chunks) {
@@ -42138,7 +42963,9 @@ function encodePdfLiteralString(value) {
42138
42963
  return value.replace(/[\\()]/g, (char) => `\\${char}`);
42139
42964
  }
42140
42965
  function encodePdfTextString(value) {
42141
- const codePoints = Array.from(value).map((ch) => ch.codePointAt(0) ?? 63);
42966
+ const codePoints = Array.from(value).map(
42967
+ (ch) => ch.codePointAt(0) ?? 63
42968
+ );
42142
42969
  return `<FEFF${encodePdfUtf16Hex(codePoints)}>`;
42143
42970
  }
42144
42971
  function formatPdfDate(date) {
@@ -42247,7 +43074,9 @@ function serializePdfDocument(pages, fonts, images, shadings, namedDestinations
42247
43074
  pageObjectIds.push(pageObjectId);
42248
43075
  }
42249
43076
  let namesObjectId;
42250
- const resolvedDestinations = namedDestinations.filter((dest) => pageObjectIds[dest.pageIndex] !== void 0).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
43077
+ const resolvedDestinations = namedDestinations.filter((dest) => pageObjectIds[dest.pageIndex] !== void 0).sort(
43078
+ (a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0
43079
+ );
42251
43080
  if (resolvedDestinations.length > 0) {
42252
43081
  const namesArray = resolvedDestinations.map((dest) => {
42253
43082
  const pageObjectId = pageObjectIds[dest.pageIndex];
@@ -42259,7 +43088,9 @@ function serializePdfDocument(pages, fonts, images, shadings, namedDestinations
42259
43088
  namesObjectId = addObject(`<< /Dests ${destsObjectId} 0 R >>`);
42260
43089
  }
42261
43090
  let outlineRootId;
42262
- const resolvedNames = new Set(resolvedDestinations.map((dest) => dest.name));
43091
+ const resolvedNames = new Set(
43092
+ resolvedDestinations.map((dest) => dest.name)
43093
+ );
42263
43094
  const outlineRoots = buildOutlineTree(
42264
43095
  outlineItems.filter((item) => resolvedNames.has(item.destName))
42265
43096
  );
@@ -42565,10 +43396,12 @@ async function exportEditorDocumentToPdf(document2) {
42565
43396
  const listOrdinals = getListOrdinals(document2);
42566
43397
  const bookmarkNamesByParagraph = collectBookmarkNamesByParagraph(document2);
42567
43398
  const headingByParagraph = new Map(
42568
- outlineFrom(document2).map((item) => [
42569
- item.id,
42570
- { level: item.level, title: item.text }
42571
- ])
43399
+ outlineFrom(document2).map(
43400
+ (item) => [
43401
+ item.id,
43402
+ { level: item.level, title: item.text }
43403
+ ]
43404
+ )
42572
43405
  );
42573
43406
  for (const page of layout.pages) {
42574
43407
  const width = Math.max(1, pxToPt$1(page.pageSettings.width));
@@ -42814,6 +43647,9 @@ function findImageFileFromTransfer(transfer) {
42814
43647
  return null;
42815
43648
  }
42816
43649
  function buildImportedDocumentDiagnostics(document2) {
43650
+ return buildImportedDocumentDiagnosticsImpl(document2);
43651
+ }
43652
+ function buildImportedDocumentDiagnosticsImpl(document2) {
42817
43653
  var _a2;
42818
43654
  const paragraphs = getDocumentParagraphs(document2);
42819
43655
  const fontCounts = /* @__PURE__ */ new Map();
@@ -43119,17 +43955,19 @@ function patchSelectedImage(state, updater) {
43119
43955
  }
43120
43956
  const paragraphs = getParagraphs(state);
43121
43957
  const { paragraphIndex, run: targetRun } = selectedImage;
43122
- const nextParagraphs = paragraphs.map((candidate, candidateIndex) => {
43123
- if (candidateIndex !== paragraphIndex) {
43124
- return cloneParagraph(candidate);
43958
+ const nextParagraphs = paragraphs.map(
43959
+ (candidate, candidateIndex) => {
43960
+ if (candidateIndex !== paragraphIndex) {
43961
+ return cloneParagraph(candidate);
43962
+ }
43963
+ return {
43964
+ ...cloneParagraph(candidate),
43965
+ runs: candidate.runs.map(
43966
+ (run) => run.id === targetRun.id && run.kind === "image" ? { ...run, image: updater(run.image) } : cloneRun(run)
43967
+ )
43968
+ };
43125
43969
  }
43126
- return {
43127
- ...cloneParagraph(candidate),
43128
- runs: candidate.runs.map(
43129
- (run) => run.id === targetRun.id && run.kind === "image" ? { ...run, image: updater(run.image) } : cloneRun(run)
43130
- )
43131
- };
43132
- });
43970
+ );
43133
43971
  return cloneStateWithParagraphs(
43134
43972
  state,
43135
43973
  nextParagraphs,
@@ -43163,7 +44001,9 @@ function setImageWrapPolygon(state, runId, polygon) {
43163
44001
  const paragraphs = getParagraphs(state);
43164
44002
  let matched = false;
43165
44003
  const nextParagraphs = paragraphs.map((candidate) => {
43166
- if (!candidate.runs.some((run) => run.id === runId && run.kind === "image")) {
44004
+ if (!candidate.runs.some(
44005
+ (run) => run.id === runId && run.kind === "image"
44006
+ )) {
43167
44007
  return cloneParagraph(candidate);
43168
44008
  }
43169
44009
  return {
@@ -43285,21 +44125,23 @@ function moveSelectedImageToPosition(state, targetPosition) {
43285
44125
  )
43286
44126
  ]
43287
44127
  );
43288
- const nextParagraphs = paragraphs.map((paragraph, index) => {
43289
- if (index === sourceIndex && index === targetIndex) {
43290
- return insertImageIntoParagraph(
43291
- removeImageFromParagraph(paragraph),
43292
- adjustedTargetOffset
43293
- );
43294
- }
43295
- if (index === sourceIndex) {
43296
- return removeImageFromParagraph(paragraph);
43297
- }
43298
- if (index === targetIndex) {
43299
- return insertImageIntoParagraph(paragraph, adjustedTargetOffset);
44128
+ const nextParagraphs = paragraphs.map(
44129
+ (paragraph, index) => {
44130
+ if (index === sourceIndex && index === targetIndex) {
44131
+ return insertImageIntoParagraph(
44132
+ removeImageFromParagraph(paragraph),
44133
+ adjustedTargetOffset
44134
+ );
44135
+ }
44136
+ if (index === sourceIndex) {
44137
+ return removeImageFromParagraph(paragraph);
44138
+ }
44139
+ if (index === targetIndex) {
44140
+ return insertImageIntoParagraph(paragraph, adjustedTargetOffset);
44141
+ }
44142
+ return cloneParagraphs([paragraph])[0];
43300
44143
  }
43301
- return cloneParagraphs([paragraph])[0];
43302
- });
44144
+ );
43303
44145
  const insertedParagraph = nextParagraphs[targetIndex];
43304
44146
  const insertedOffset = Math.max(
43305
44147
  0,
@@ -43386,6 +44228,9 @@ const PHASE_RANGES = {
43386
44228
  error: [100, 100]
43387
44229
  };
43388
44230
  function createEditorDocumentIO(deps) {
44231
+ return createEditorDocumentIOImpl(deps);
44232
+ }
44233
+ function createEditorDocumentIOImpl(deps) {
43389
44234
  const [importProgress, setImportProgress] = createSignal(null);
43390
44235
  const computeProgress = (phase, subProgress) => {
43391
44236
  const [min, max] = PHASE_RANGES[phase];
@@ -43505,7 +44350,9 @@ function resolveCaretSlot(paragraphs, focusOffset) {
43505
44350
  const containingSegment = paragraphs.find(
43506
44351
  (paragraph) => focusOffset >= paragraph.startOffset && focusOffset <= paragraph.endOffset
43507
44352
  ) ?? paragraphs[paragraphs.length - 1];
43508
- const slots = containingSegment.lines.flatMap((line) => line.slots);
44353
+ const slots = containingSegment.lines.flatMap(
44354
+ (line) => line.slots
44355
+ );
43509
44356
  if (slots.length === 0) {
43510
44357
  return {
43511
44358
  left: containingSegment.left,
@@ -43691,7 +44538,9 @@ function computeCanvasSelectionGeometry(snapshot, state) {
43691
44538
  lineEnd -= 1;
43692
44539
  }
43693
44540
  if (lineStart >= lineEnd) continue;
43694
- const startSlot = line.slots.find((slot) => slot.offset === lineStart);
44541
+ const startSlot = line.slots.find(
44542
+ (slot) => slot.offset === lineStart
44543
+ );
43695
44544
  const endSlot = line.slots.find((slot) => slot.offset === lineEnd) ?? line.slots[line.slots.length - 1];
43696
44545
  if (!startSlot || !endSlot) continue;
43697
44546
  const shouldIncludeSpacingBefore = paragraph.startOffset === 0 && line.startOffset === paragraph.startOffset && line.top > paragraph.top;
@@ -43771,7 +44620,9 @@ function computeCommentHighlights(snapshot, state) {
43771
44620
  if (lineStart >= lineEnd) {
43772
44621
  continue;
43773
44622
  }
43774
- const startSlot = line.slots.find((slot) => slot.offset === lineStart);
44623
+ const startSlot = line.slots.find(
44624
+ (slot) => slot.offset === lineStart
44625
+ );
43775
44626
  const endSlot = line.slots.find((slot) => slot.offset === lineEnd) ?? line.slots[line.slots.length - 1];
43776
44627
  if (!startSlot || !endSlot) {
43777
44628
  continue;
@@ -43827,7 +44678,9 @@ function canReuseLayoutBlock(previous, next) {
43827
44678
  }
43828
44679
  function sameNumberArray(left, right) {
43829
44680
  if (((left == null ? void 0 : left.length) ?? 0) !== ((right == null ? void 0 : right.length) ?? 0)) return false;
43830
- return (right ?? []).every((value, index) => (left == null ? void 0 : left[index]) === value);
44681
+ return (right ?? []).every(
44682
+ (value, index) => (left == null ? void 0 : left[index]) === value
44683
+ );
43831
44684
  }
43832
44685
  function sameTableCellBlockPositions(left, right) {
43833
44686
  if (((left == null ? void 0 : left.length) ?? 0) !== ((right == null ? void 0 : right.length) ?? 0)) return false;
@@ -43847,7 +44700,9 @@ function canReuseLayoutPage(previous, next) {
43847
44700
  if (((left == null ? void 0 : left.length) ?? 0) !== ((right == null ? void 0 : right.length) ?? 0)) {
43848
44701
  return false;
43849
44702
  }
43850
- return (right ?? []).every((block, index) => (left == null ? void 0 : left[index]) === block);
44703
+ return (right ?? []).every(
44704
+ (block, index) => (left == null ? void 0 : left[index]) === block
44705
+ );
43851
44706
  };
43852
44707
  const sameFootnoteReferences = (left, right) => {
43853
44708
  if (((left == null ? void 0 : left.length) ?? 0) !== ((right == null ? void 0 : right.length) ?? 0)) {
@@ -43888,7 +44743,9 @@ function createLayoutIdentityStabilizer() {
43888
44743
  return nextPage;
43889
44744
  });
43890
44745
  reusableLayoutBlocks = nextBlockCache;
43891
- reusableLayoutPages = new Map(pages.map((page) => [page.id, page]));
44746
+ reusableLayoutPages = new Map(
44747
+ pages.map((page) => [page.id, page])
44748
+ );
43892
44749
  return { pages };
43893
44750
  };
43894
44751
  }
@@ -43912,6 +44769,9 @@ function normalizeParagraphLayouts(current, dirtyParagraphIds) {
43912
44769
  return next ?? current;
43913
44770
  }
43914
44771
  function useEditorLayout(props) {
44772
+ return useEditorLayoutImpl(props);
44773
+ }
44774
+ function useEditorLayoutImpl(props) {
43915
44775
  const [measuredBlockHeights, setMeasuredBlockHeights] = createSignal({});
43916
44776
  const [measuredParagraphLayouts, setMeasuredParagraphLayouts] = createSignal({});
43917
44777
  const [inputBox, setInputBox] = createSignal({
@@ -43957,7 +44817,12 @@ function useEditorLayout(props) {
43957
44817
  setCommentHighlights([]);
43958
44818
  setSelectedImageBox(null);
43959
44819
  setSelectedTextBoxBox(null);
43960
- setCaretBox((current) => ({ ...current, visible: false }));
44820
+ setCaretBox(
44821
+ (current) => ({
44822
+ ...current,
44823
+ visible: false
44824
+ })
44825
+ );
43961
44826
  return;
43962
44827
  }
43963
44828
  const snapshot = canvasSnapshotProvider.getCanvasLayoutSnapshot({
@@ -43971,7 +44836,12 @@ function useEditorLayout(props) {
43971
44836
  setCommentHighlights([]);
43972
44837
  setSelectedImageBox(null);
43973
44838
  setSelectedTextBoxBox(null);
43974
- setCaretBox((current) => ({ ...current, visible: false }));
44839
+ setCaretBox(
44840
+ (current) => ({
44841
+ ...current,
44842
+ visible: false
44843
+ })
44844
+ );
43975
44845
  return;
43976
44846
  }
43977
44847
  const geometry = computeCanvasSelectionGeometry(snapshot, props.state);
@@ -44200,6 +45070,9 @@ function takeEditorRedoStep(history, current) {
44200
45070
  };
44201
45071
  }
44202
45072
  function createEditorHistoryActions(deps) {
45073
+ return createEditorHistoryActionsImpl(deps);
45074
+ }
45075
+ function createEditorHistoryActionsImpl(deps) {
44203
45076
  const insertParagraphAtZoneBoundary = (currentState, direction) => {
44204
45077
  const sections = getDocumentSectionsCanonical(currentState.document);
44205
45078
  const sectionIndex = Math.max(
@@ -44539,6 +45412,9 @@ function computeLayoutInvalidationFromTransaction(prev, next) {
44539
45412
  return { dirtyParagraphIds };
44540
45413
  }
44541
45414
  function useEditorTransactions(ctx) {
45415
+ return useEditorTransactionsImpl(ctx);
45416
+ }
45417
+ function useEditorTransactionsImpl(ctx) {
44542
45418
  const [undoStack, setUndoStack] = createSignal([]);
44543
45419
  const [redoStack, setRedoStack] = createSignal([]);
44544
45420
  let historyState = createEmptyEditorHistoryState();
@@ -44611,6 +45487,9 @@ function createEditorChangeBroadcast(deps) {
44611
45487
  });
44612
45488
  }
44613
45489
  function createEditorDocumentRuntime(deps) {
45490
+ return createEditorDocumentRuntimeImpl(deps);
45491
+ }
45492
+ function createEditorDocumentRuntimeImpl(deps) {
44614
45493
  const {
44615
45494
  documentOptions,
44616
45495
  logger,
@@ -44812,20 +45691,22 @@ function rotateSelectedTextBox(state, rotation) {
44812
45691
  const nextRotation = normalizeRotation(rotation);
44813
45692
  const { paragraphIndex, run: targetRun } = selected;
44814
45693
  const paragraphs = getParagraphs(state);
44815
- const nextParagraphs = paragraphs.map((candidate, candidateIndex) => {
44816
- if (candidateIndex !== paragraphIndex) {
44817
- return cloneParagraph(candidate);
45694
+ const nextParagraphs = paragraphs.map(
45695
+ (candidate, candidateIndex) => {
45696
+ if (candidateIndex !== paragraphIndex) {
45697
+ return cloneParagraph(candidate);
45698
+ }
45699
+ return {
45700
+ ...cloneParagraph(candidate),
45701
+ runs: candidate.runs.map(
45702
+ (run) => run.id === targetRun.id && run.kind === "textBox" ? {
45703
+ ...run,
45704
+ textBox: { ...run.textBox, rotation: nextRotation }
45705
+ } : cloneRun(run)
45706
+ )
45707
+ };
44818
45708
  }
44819
- return {
44820
- ...cloneParagraph(candidate),
44821
- runs: candidate.runs.map(
44822
- (run) => run.id === targetRun.id && run.kind === "textBox" ? {
44823
- ...run,
44824
- textBox: { ...run.textBox, rotation: nextRotation }
44825
- } : cloneRun(run)
44826
- )
44827
- };
44828
- });
45709
+ );
44829
45710
  return cloneStateWithParagraphs(
44830
45711
  state,
44831
45712
  nextParagraphs,
@@ -44855,27 +45736,29 @@ function patchSelectedTextBoxFloating(state, next) {
44855
45736
  }
44856
45737
  const { paragraphIndex, run: targetRun } = selected;
44857
45738
  const paragraphs = getParagraphs(state);
44858
- const nextParagraphs = paragraphs.map((candidate, candidateIndex) => {
44859
- if (candidateIndex !== paragraphIndex) {
44860
- return cloneParagraph(candidate);
45739
+ const nextParagraphs = paragraphs.map(
45740
+ (candidate, candidateIndex) => {
45741
+ if (candidateIndex !== paragraphIndex) {
45742
+ return cloneParagraph(candidate);
45743
+ }
45744
+ return {
45745
+ ...cloneParagraph(candidate),
45746
+ runs: candidate.runs.map((run) => {
45747
+ if (run.id !== targetRun.id || run.kind !== "textBox") {
45748
+ return cloneRun(run);
45749
+ }
45750
+ const floating = next(run.textBox.floating);
45751
+ const textBox = { ...run.textBox };
45752
+ if (floating) {
45753
+ textBox.floating = floating;
45754
+ } else {
45755
+ delete textBox.floating;
45756
+ }
45757
+ return { ...run, textBox };
45758
+ })
45759
+ };
44861
45760
  }
44862
- return {
44863
- ...cloneParagraph(candidate),
44864
- runs: candidate.runs.map((run) => {
44865
- if (run.id !== targetRun.id || run.kind !== "textBox") {
44866
- return cloneRun(run);
44867
- }
44868
- const floating = next(run.textBox.floating);
44869
- const textBox = { ...run.textBox };
44870
- if (floating) {
44871
- textBox.floating = floating;
44872
- } else {
44873
- delete textBox.floating;
44874
- }
44875
- return { ...run, textBox };
44876
- })
44877
- };
44878
- });
45761
+ );
44879
45762
  return cloneStateWithParagraphs(
44880
45763
  state,
44881
45764
  nextParagraphs,
@@ -44913,39 +45796,41 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
44913
45796
  const widthDelta = nextWidth - selectedTextBox.width;
44914
45797
  const heightDelta = nextHeight - selectedTextBox.height;
44915
45798
  const paragraphs = getParagraphs(state);
44916
- const nextParagraphs = paragraphs.map((candidate, candidateIndex) => {
44917
- if (candidateIndex !== paragraphIndex) {
44918
- return cloneParagraph(candidate);
45799
+ const nextParagraphs = paragraphs.map(
45800
+ (candidate, candidateIndex) => {
45801
+ if (candidateIndex !== paragraphIndex) {
45802
+ return cloneParagraph(candidate);
45803
+ }
45804
+ return {
45805
+ ...cloneParagraph(candidate),
45806
+ runs: candidate.runs.map((run) => {
45807
+ var _a2;
45808
+ if (run.id !== targetRun.id || run.kind !== "textBox") {
45809
+ return cloneRun(run);
45810
+ }
45811
+ const textBox = run.textBox;
45812
+ const nextTextBox = {
45813
+ ...textBox,
45814
+ width: nextWidth,
45815
+ height: nextHeight
45816
+ };
45817
+ if (changesHeight && ((_a2 = textBox.body) == null ? void 0 : _a2.autoFit)) {
45818
+ nextTextBox.body = { ...textBox.body, autoFit: false };
45819
+ }
45820
+ if (textBox.floating) {
45821
+ nextTextBox.floating = shiftFloatingForResize(
45822
+ textBox.floating,
45823
+ widthDelta,
45824
+ heightDelta,
45825
+ growsFromWest,
45826
+ growsFromNorth
45827
+ );
45828
+ }
45829
+ return { ...run, textBox: nextTextBox };
45830
+ })
45831
+ };
44919
45832
  }
44920
- return {
44921
- ...cloneParagraph(candidate),
44922
- runs: candidate.runs.map((run) => {
44923
- var _a2;
44924
- if (run.id !== targetRun.id || run.kind !== "textBox") {
44925
- return cloneRun(run);
44926
- }
44927
- const textBox = run.textBox;
44928
- const nextTextBox = {
44929
- ...textBox,
44930
- width: nextWidth,
44931
- height: nextHeight
44932
- };
44933
- if (changesHeight && ((_a2 = textBox.body) == null ? void 0 : _a2.autoFit)) {
44934
- nextTextBox.body = { ...textBox.body, autoFit: false };
44935
- }
44936
- if (textBox.floating) {
44937
- nextTextBox.floating = shiftFloatingForResize(
44938
- textBox.floating,
44939
- widthDelta,
44940
- heightDelta,
44941
- growsFromWest,
44942
- growsFromNorth
44943
- );
44944
- }
44945
- return { ...run, textBox: nextTextBox };
44946
- })
44947
- };
44948
- });
45833
+ );
44949
45834
  return cloneStateWithParagraphs(
44950
45835
  state,
44951
45836
  nextParagraphs,
@@ -44955,8 +45840,14 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
44955
45840
  )
44956
45841
  );
44957
45842
  }
44958
- const getRowVisualWidth = (row) => row.cells.reduce((sum, cell) => sum + Math.max(1, cell.colSpan ?? 1), 0);
44959
- const getTableVisualWidth = (table) => table.rows.reduce((max, row) => Math.max(max, getRowVisualWidth(row)), 0);
45843
+ const getRowVisualWidth = (row) => row.cells.reduce(
45844
+ (sum, cell) => sum + Math.max(1, cell.colSpan ?? 1),
45845
+ 0
45846
+ );
45847
+ const getTableVisualWidth = (table) => table.rows.reduce(
45848
+ (max, row) => Math.max(max, getRowVisualWidth(row)),
45849
+ 0
45850
+ );
44960
45851
  const findCellAtVisualColumn = (row, visualColumn) => {
44961
45852
  let visualCursor = 0;
44962
45853
  for (const cell of row.cells) {
@@ -45107,6 +45998,9 @@ function commitTableMutation(current, targetBlocks, zone, nextParagraph) {
45107
45998
  };
45108
45999
  }
45109
46000
  function createTableOpsGuards(deps) {
46001
+ return createTableOpsGuardsImpl(deps);
46002
+ }
46003
+ function createTableOpsGuardsImpl(deps) {
45110
46004
  const canMergeSelectedTableCells = (current) => {
45111
46005
  const range = deps.resolveHorizontalTableCellRange(current);
45112
46006
  return Boolean(range && range.endCellIndex > range.startCellIndex);
@@ -45222,6 +46116,9 @@ function compareCellLocations(left, right) {
45222
46116
  return 0;
45223
46117
  }
45224
46118
  function getSelectionTableContext(current, deps) {
46119
+ return getSelectionTableContextImpl(current, deps);
46120
+ }
46121
+ function getSelectionTableContextImpl(current, deps) {
45225
46122
  const selection = current.selection;
45226
46123
  const activeSectionIndex = getActiveSectionIndex(current);
45227
46124
  const anchorLocation = findParagraphTableLocation(
@@ -45262,6 +46159,9 @@ function getSelectionTableContext(current, deps) {
45262
46159
  };
45263
46160
  }
45264
46161
  function createTableSelectionResolvers(deps) {
46162
+ return createTableSelectionResolversImpl(deps);
46163
+ }
46164
+ function createTableSelectionResolversImpl(deps) {
45265
46165
  const resolveTableCellRangeSelection = (current) => {
45266
46166
  var _a2, _b2, _c, _d, _e;
45267
46167
  const selection = current.selection;
@@ -45391,6 +46291,9 @@ function createTableSelectionResolvers(deps) {
45391
46291
  };
45392
46292
  }
45393
46293
  function createTableCellSpanOperations(deps) {
46294
+ return createTableCellSpanOperationsImpl(deps);
46295
+ }
46296
+ function createTableCellSpanOperationsImpl(deps) {
45394
46297
  const cloneCellSnapshot = (cell) => ({
45395
46298
  ...cell,
45396
46299
  style: cell.style ? { ...cell.style } : void 0,
@@ -45585,11 +46488,14 @@ function createTableCellSpanOperations(deps) {
45585
46488
  currentCellCount: 1,
45586
46489
  previousCells: [
45587
46490
  previousCell,
45588
- ...Array.from({ length: span - 1 }, (_, offset) => {
45589
- var _a3;
45590
- const prior = (_a3 = tableBlock.rows[location.rowIndex + offset + 1]) == null ? void 0 : _a3.cells[location.cellIndex];
45591
- return prior ? cloneCellSnapshot(prior) : createEditorTableCell([], preservedColSpan);
45592
- })
46491
+ ...Array.from(
46492
+ { length: span - 1 },
46493
+ (_, offset) => {
46494
+ var _a3;
46495
+ const prior = (_a3 = tableBlock.rows[location.rowIndex + offset + 1]) == null ? void 0 : _a3.cells[location.cellIndex];
46496
+ return prior ? cloneCellSnapshot(prior) : createEditorTableCell([], preservedColSpan);
46497
+ }
46498
+ )
45593
46499
  ]
45594
46500
  };
45595
46501
  }
@@ -45692,6 +46598,9 @@ function createTableCellSpanOperations(deps) {
45692
46598
  };
45693
46599
  }
45694
46600
  function createTableRowColumnOperations(deps) {
46601
+ return createTableRowColumnOperationsImpl(deps);
46602
+ }
46603
+ function createTableRowColumnOperationsImpl(deps) {
45695
46604
  const insertSelectedTableRow = (current, direction) => {
45696
46605
  var _a2, _b2;
45697
46606
  const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
@@ -46071,6 +46980,9 @@ function createTableRowColumnOperations(deps) {
46071
46980
  };
46072
46981
  }
46073
46982
  function createTableSelectionAwareCommands(deps) {
46983
+ return createTableSelectionAwareCommandsImpl(deps);
46984
+ }
46985
+ function createTableSelectionAwareCommandsImpl(deps) {
46074
46986
  const withExpandedTableCellSelection = (current) => {
46075
46987
  const expandedSelection = deps.resolveTableCellRangeSelection(current);
46076
46988
  if (!expandedSelection) {
@@ -46168,6 +47080,9 @@ function createTableSelectionAwareCommands(deps) {
46168
47080
  };
46169
47081
  }
46170
47082
  function createEditorTableOperations(deps) {
47083
+ return createEditorTableOperationsImpl(deps);
47084
+ }
47085
+ function createEditorTableOperationsImpl(deps) {
46171
47086
  const getTargetBlocks = (state, zone) => {
46172
47087
  const sections = getDocumentSectionsCanonical(state.document);
46173
47088
  const activeSectionIndex = getActiveSectionIndex(state);
@@ -46288,7 +47203,9 @@ function createEditorTableOperations(deps) {
46288
47203
  function createResizeSession(adapter, deps) {
46289
47204
  let active = null;
46290
47205
  const selectionForObject = (state, paragraphId, paragraphOffset) => {
46291
- const paragraph = getParagraphs(state).find((p) => p.id === paragraphId);
47206
+ const paragraph = getParagraphs(state).find(
47207
+ (p) => p.id === paragraphId
47208
+ );
46292
47209
  if (!paragraph) {
46293
47210
  return null;
46294
47211
  }
@@ -46391,7 +47308,9 @@ const ROTATION_SNAP_DEGREES = 15;
46391
47308
  function createRotateSession(adapter, deps) {
46392
47309
  let active = null;
46393
47310
  const selectionForObject = (state, paragraphId, paragraphOffset) => {
46394
- const paragraph = getParagraphs(state).find((p) => p.id === paragraphId);
47311
+ const paragraph = getParagraphs(state).find(
47312
+ (p) => p.id === paragraphId
47313
+ );
46395
47314
  if (!paragraph) {
46396
47315
  return null;
46397
47316
  }
@@ -46471,6 +47390,9 @@ function createRotateSession(adapter, deps) {
46471
47390
  return { start, stop };
46472
47391
  }
46473
47392
  function createEditorImageOperations(deps) {
47393
+ return createEditorImageOperationsImpl(deps);
47394
+ }
47395
+ function createEditorImageOperationsImpl(deps) {
46474
47396
  const [dragging, setDragging] = createSignal(false);
46475
47397
  const [draggedImageInfo, setDraggedImageInfo] = createSignal(null);
46476
47398
  const [mousePos, setMousePos] = createSignal({ x: 0, y: 0 });
@@ -46718,6 +47640,9 @@ function createEditorImageOperations(deps) {
46718
47640
  };
46719
47641
  }
46720
47642
  function createEditorTextBoxOperations(deps) {
47643
+ return createEditorTextBoxOperationsImpl(deps);
47644
+ }
47645
+ function createEditorTextBoxOperationsImpl(deps) {
46721
47646
  const getSelectedTextBoxSize = (current) => {
46722
47647
  const selected = getSelectedTextBoxRun(current);
46723
47648
  const textBox = selected && getRunTextBox(selected.run);
@@ -46801,6 +47726,9 @@ function createEditorTextBoxOperations(deps) {
46801
47726
  };
46802
47727
  }
46803
47728
  function createEditorStyleController(deps) {
47729
+ return createEditorStyleControllerImpl(deps);
47730
+ }
47731
+ function createEditorStyleControllerImpl(deps) {
46804
47732
  const [pendingCaretTextStyle, setPendingCaretTextStyle] = createSignal(void 0);
46805
47733
  const clearPendingCaretTextStyle = () => {
46806
47734
  setPendingCaretTextStyle(void 0);
@@ -47362,6 +48290,9 @@ function resolveCanvasSurfaceHitAtPoint(options) {
47362
48290
  };
47363
48291
  }
47364
48292
  function createCanvasSurfaceHitResolver(deps) {
48293
+ return createCanvasSurfaceHitResolverImpl(deps);
48294
+ }
48295
+ function createCanvasSurfaceHitResolverImpl(deps) {
47365
48296
  const resolveSurfaceHitAtPoint = (clientX, clientY, context = {}) => {
47366
48297
  const currentSurfaceRef = deps.surfaceRef();
47367
48298
  if (!currentSurfaceRef) return null;
@@ -47589,7 +48520,9 @@ function createEditorLayoutOptionsController(deps) {
47589
48520
  const target = layoutOptionsTarget();
47590
48521
  if (!target) return;
47591
48522
  resetTransactionGrouping();
47592
- applyTransactionalState((current) => apply(current, target), { mergeKey });
48523
+ applyTransactionalState((current) => apply(current, target), {
48524
+ mergeKey
48525
+ });
47593
48526
  focusInput();
47594
48527
  };
47595
48528
  const ensureImageWrapContour = (runId, src) => {
@@ -47642,6 +48575,9 @@ function createEditorLayoutOptionsController(deps) {
47642
48575
  };
47643
48576
  }
47644
48577
  function createEditorClipboardController(deps) {
48578
+ return createEditorClipboardControllerImpl(deps);
48579
+ }
48580
+ function createEditorClipboardControllerImpl(deps) {
47645
48581
  const handleCopy = (event) => {
47646
48582
  var _a2, _b2;
47647
48583
  const text = getSelectedText(deps.state());
@@ -47773,11 +48709,13 @@ function createEditorClipboardController(deps) {
47773
48709
  };
47774
48710
  }
47775
48711
  function getAllBlocks(state) {
47776
- return getDocumentSectionsCanonical(state.document).flatMap((section) => [
47777
- ...section.header ?? [],
47778
- ...section.blocks,
47779
- ...section.footer ?? []
47780
- ]);
48712
+ return getDocumentSectionsCanonical(state.document).flatMap(
48713
+ (section) => [
48714
+ ...section.header ?? [],
48715
+ ...section.blocks,
48716
+ ...section.footer ?? []
48717
+ ]
48718
+ );
47781
48719
  }
47782
48720
  function getTableById(state, tableId) {
47783
48721
  const table = getAllBlocks(state).find(
@@ -48407,6 +49345,9 @@ function createEditorTableResize(deps) {
48407
49345
  };
48408
49346
  }
48409
49347
  function createEditorTableDrag(deps) {
49348
+ return createEditorTableDragImpl(deps);
49349
+ }
49350
+ function createEditorTableDragImpl(deps) {
48410
49351
  const [dragging, setDragging] = createSignal(false);
48411
49352
  const [draggedTableInfo, setDraggedTableInfo] = createSignal(null);
48412
49353
  const [dropTargetPos, setDropTargetPos] = createSignal(
@@ -48615,6 +49556,9 @@ function resolveTripleClickParagraphRange(state, paragraph, targetZone) {
48615
49556
  return { start, end };
48616
49557
  }
48617
49558
  function createEditorSurfaceEvents(deps) {
49559
+ return createEditorSurfaceEventsImpl(deps);
49560
+ }
49561
+ function createEditorSurfaceEventsImpl(deps) {
48618
49562
  let dragAnchor = null;
48619
49563
  let dragFrameHandle = null;
48620
49564
  let dragPendingPoint = null;
@@ -49050,6 +49994,9 @@ function createEditorSurfaceEvents(deps) {
49050
49994
  };
49051
49995
  }
49052
49996
  function createEditorTextInput(deps) {
49997
+ return createEditorTextInputImpl(deps);
49998
+ }
49999
+ function createEditorTextInputImpl(deps) {
49053
50000
  const [composing, setComposing] = createSignal(false);
49054
50001
  let suppressedInputText = null;
49055
50002
  const handleTextInput = (event) => {
@@ -49172,6 +50119,9 @@ function isPositionInsideSelection(state, position) {
49172
50119
  return true;
49173
50120
  }
49174
50121
  function createEditorTextDrag(deps) {
50122
+ return createEditorTextDragImpl(deps);
50123
+ }
50124
+ function createEditorTextDragImpl(deps) {
49175
50125
  const [dragging, setDragging] = createSignal(false);
49176
50126
  const [dropTargetPos, setDropTargetPos] = createSignal(
49177
50127
  null
@@ -49364,6 +50314,9 @@ function createEditorTextDrag(deps) {
49364
50314
  };
49365
50315
  }
49366
50316
  function createEditorNavigation(deps) {
50317
+ return createEditorNavigationImpl(deps);
50318
+ }
50319
+ function createEditorNavigationImpl(deps) {
49367
50320
  const moveSelectionToParagraphBoundary = (boundary, extend) => {
49368
50321
  const state = deps.state();
49369
50322
  const targetParagraph = getParagraphs(state).find(
@@ -49509,23 +50462,27 @@ function createEditorNavigation(deps) {
49509
50462
  if (rowCandidates.length === 0) {
49510
50463
  continue;
49511
50464
  }
49512
- const scoredCandidates = rowCandidates.map((entry) => {
49513
- var _a3, _b3;
49514
- const paragraphId = (_a3 = entry.cell.blocks[0]) == null ? void 0 : _a3.id;
49515
- const cellRect = paragraphId ? (_b3 = snapshot == null ? void 0 : snapshot.paragraphs.find(
49516
- (paragraph) => paragraph.paragraphId === paragraphId && paragraph.tableCell && paragraph.tableCell.tableId === block.id
49517
- )) == null ? void 0 : _b3.tableCell : null;
49518
- const left = (cellRect == null ? void 0 : cellRect.left) ?? desiredX;
49519
- const right = cellRect ? cellRect.left + cellRect.width : desiredX;
49520
- const distance = desiredX < left ? left - desiredX : desiredX > right ? desiredX - right : 0;
49521
- return { entry, distance };
49522
- }).sort((left, right) => left.distance - right.distance);
50465
+ const scoredCandidates = rowCandidates.map(
50466
+ (entry) => {
50467
+ var _a3, _b3;
50468
+ const paragraphId = (_a3 = entry.cell.blocks[0]) == null ? void 0 : _a3.id;
50469
+ const cellRect = paragraphId ? (_b3 = snapshot == null ? void 0 : snapshot.paragraphs.find(
50470
+ (paragraph) => paragraph.paragraphId === paragraphId && paragraph.tableCell && paragraph.tableCell.tableId === block.id
50471
+ )) == null ? void 0 : _b3.tableCell : null;
50472
+ const left = (cellRect == null ? void 0 : cellRect.left) ?? desiredX;
50473
+ const right = cellRect ? cellRect.left + cellRect.width : desiredX;
50474
+ const distance = desiredX < left ? left - desiredX : desiredX > right ? desiredX - right : 0;
50475
+ return { entry, distance };
50476
+ }
50477
+ ).sort((left, right) => left.distance - right.distance);
49523
50478
  const candidate = (_b2 = scoredCandidates[0]) == null ? void 0 : _b2.entry;
49524
50479
  if (!candidate) {
49525
50480
  continue;
49526
50481
  }
49527
50482
  const targetId = direction < 0 ? candidate.cell.blocks[candidate.cell.blocks.length - 1].id : candidate.cell.blocks[0].id;
49528
- targetIndex = paragraphs.findIndex((p) => p.id === targetId);
50483
+ targetIndex = paragraphs.findIndex(
50484
+ (p) => p.id === targetId
50485
+ );
49529
50486
  break;
49530
50487
  }
49531
50488
  } else {
@@ -49585,6 +50542,9 @@ function createEditorNavigation(deps) {
49585
50542
  };
49586
50543
  }
49587
50544
  function createEditorRevisionController(deps) {
50545
+ return createEditorRevisionControllerImpl(deps);
50546
+ }
50547
+ function createEditorRevisionControllerImpl(deps) {
49588
50548
  const [hoveredRevision, setHoveredRevision] = createSignal(null);
49589
50549
  const handleRevisionMouseEnter = (revisionId, event) => {
49590
50550
  var _a2, _b2, _c;
@@ -49769,6 +50729,9 @@ function useEditorInteractionWiring(ctx) {
49769
50729
  };
49770
50730
  }
49771
50731
  function createEditorInteractionRuntime(deps) {
50732
+ return createEditorInteractionRuntimeImpl(deps);
50733
+ }
50734
+ function createEditorInteractionRuntimeImpl(deps) {
49772
50735
  const {
49773
50736
  state,
49774
50737
  logger,
@@ -50215,7 +51178,9 @@ function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
50215
51178
  if (block.type === "paragraph") continue;
50216
51179
  const tableSelected = block.rows.some(
50217
51180
  (row) => row.cells.some(
50218
- (cell) => cell.blocks.some((paragraph) => selectedParagraphIds.has(paragraph.id))
51181
+ (cell) => cell.blocks.some(
51182
+ (paragraph) => selectedParagraphIds.has(paragraph.id)
51183
+ )
50219
51184
  )
50220
51185
  );
50221
51186
  if (tableSelected) {
@@ -50224,7 +51189,9 @@ function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
50224
51189
  }
50225
51190
  for (const row of block.rows) {
50226
51191
  const selectedCells = row.cells.filter(
50227
- (cell) => cell.blocks.some((paragraph) => selectedParagraphIds.has(paragraph.id))
51192
+ (cell) => cell.blocks.some(
51193
+ (paragraph) => selectedParagraphIds.has(paragraph.id)
51194
+ )
50228
51195
  );
50229
51196
  if (selectedCells.length > 0) {
50230
51197
  if ((_b2 = row.style) == null ? void 0 : _b2.revision) revisionIds.add(row.style.revision.id);
@@ -50401,7 +51368,12 @@ function splitListItemAtSelection(state) {
50401
51368
  );
50402
51369
  const nextParagraph = secondRuns.length > 0 ? createParagraphFromRunsLike(
50403
51370
  paragraph,
50404
- secondRuns.map((run) => ({ text: run.text, styles: run.styles }))
51371
+ secondRuns.map(
51372
+ (run) => ({
51373
+ text: run.text,
51374
+ styles: run.styles
51375
+ })
51376
+ )
50405
51377
  ) : (() => {
50406
51378
  const emptyParagraph = createEditorParagraph("");
50407
51379
  emptyParagraph.style = paragraph.style ? { ...paragraph.style } : void 0;
@@ -50424,12 +51396,14 @@ function splitListItemAtSelection(state) {
50424
51396
  function clearParagraphListAtSelection(state) {
50425
51397
  const normalized = normalizeSelection(state);
50426
51398
  const paragraphs = getParagraphs(state);
50427
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50428
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
50429
- return cloneParagraph(paragraph);
51399
+ const nextParagraphs = paragraphs.map(
51400
+ (paragraph, paragraphIndex) => {
51401
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
51402
+ return cloneParagraph(paragraph);
51403
+ }
51404
+ return clearParagraphList(paragraph);
50430
51405
  }
50431
- return clearParagraphList(paragraph);
50432
- });
51406
+ );
50433
51407
  return cloneStateWithParagraphs(
50434
51408
  state,
50435
51409
  nextParagraphs,
@@ -50439,18 +51413,20 @@ function clearParagraphListAtSelection(state) {
50439
51413
  function indentParagraphList(state) {
50440
51414
  const normalized = normalizeSelection(state);
50441
51415
  const paragraphs = getParagraphs(state);
50442
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50443
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
50444
- return cloneParagraph(paragraph);
50445
- }
50446
- if (!paragraph.list) {
50447
- return cloneParagraph(paragraph);
51416
+ const nextParagraphs = paragraphs.map(
51417
+ (paragraph, paragraphIndex) => {
51418
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
51419
+ return cloneParagraph(paragraph);
51420
+ }
51421
+ if (!paragraph.list) {
51422
+ return cloneParagraph(paragraph);
51423
+ }
51424
+ return cloneParagraphWithListLevel(
51425
+ paragraph,
51426
+ (paragraph.list.level ?? 0) + 1
51427
+ );
50448
51428
  }
50449
- return cloneParagraphWithListLevel(
50450
- paragraph,
50451
- (paragraph.list.level ?? 0) + 1
50452
- );
50453
- });
51429
+ );
50454
51430
  return cloneStateWithParagraphs(
50455
51431
  state,
50456
51432
  nextParagraphs,
@@ -50460,19 +51436,21 @@ function indentParagraphList(state) {
50460
51436
  function outdentParagraphList(state) {
50461
51437
  const normalized = normalizeSelection(state);
50462
51438
  const paragraphs = getParagraphs(state);
50463
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50464
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
50465
- return cloneParagraph(paragraph);
50466
- }
50467
- if (!paragraph.list) {
50468
- return cloneParagraph(paragraph);
50469
- }
50470
- const currentLevel = paragraph.list.level ?? 0;
50471
- if (currentLevel <= 0) {
50472
- return clearParagraphList(paragraph);
51439
+ const nextParagraphs = paragraphs.map(
51440
+ (paragraph, paragraphIndex) => {
51441
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
51442
+ return cloneParagraph(paragraph);
51443
+ }
51444
+ if (!paragraph.list) {
51445
+ return cloneParagraph(paragraph);
51446
+ }
51447
+ const currentLevel = paragraph.list.level ?? 0;
51448
+ if (currentLevel <= 0) {
51449
+ return clearParagraphList(paragraph);
51450
+ }
51451
+ return cloneParagraphWithListLevel(paragraph, currentLevel - 1);
50473
51452
  }
50474
- return cloneParagraphWithListLevel(paragraph, currentLevel - 1);
50475
- });
51453
+ );
50476
51454
  return cloneStateWithParagraphs(
50477
51455
  state,
50478
51456
  nextParagraphs,
@@ -50485,28 +51463,32 @@ function toggleParagraphList(state, kind) {
50485
51463
  const startIndex = normalized.startIndex;
50486
51464
  const endIndex = normalized.endIndex;
50487
51465
  const targetedParagraphs = paragraphs.slice(startIndex, endIndex + 1);
50488
- const shouldClear = targetedParagraphs.length > 0 && targetedParagraphs.every((paragraph) => {
50489
- var _a2;
50490
- return ((_a2 = paragraph.list) == null ? void 0 : _a2.kind) === kind;
50491
- });
50492
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50493
- var _a2, _b2, _c;
50494
- if (paragraphIndex < startIndex || paragraphIndex > endIndex) {
50495
- return cloneParagraph(paragraph);
51466
+ const shouldClear = targetedParagraphs.length > 0 && targetedParagraphs.every(
51467
+ (paragraph) => {
51468
+ var _a2;
51469
+ return ((_a2 = paragraph.list) == null ? void 0 : _a2.kind) === kind;
50496
51470
  }
50497
- const nextParagraph = cloneParagraph(paragraph);
50498
- if (shouldClear) {
50499
- delete nextParagraph.list;
51471
+ );
51472
+ const nextParagraphs = paragraphs.map(
51473
+ (paragraph, paragraphIndex) => {
51474
+ var _a2, _b2, _c;
51475
+ if (paragraphIndex < startIndex || paragraphIndex > endIndex) {
51476
+ return cloneParagraph(paragraph);
51477
+ }
51478
+ const nextParagraph = cloneParagraph(paragraph);
51479
+ if (shouldClear) {
51480
+ delete nextParagraph.list;
51481
+ return nextParagraph;
51482
+ }
51483
+ nextParagraph.list = {
51484
+ kind,
51485
+ level: ((_a2 = paragraph.list) == null ? void 0 : _a2.level) ?? 0,
51486
+ format: (_b2 = paragraph.list) == null ? void 0 : _b2.format,
51487
+ startAt: (_c = paragraph.list) == null ? void 0 : _c.startAt
51488
+ };
50500
51489
  return nextParagraph;
50501
51490
  }
50502
- nextParagraph.list = {
50503
- kind,
50504
- level: ((_a2 = paragraph.list) == null ? void 0 : _a2.level) ?? 0,
50505
- format: (_b2 = paragraph.list) == null ? void 0 : _b2.format,
50506
- startAt: (_c = paragraph.list) == null ? void 0 : _c.startAt
50507
- };
50508
- return nextParagraph;
50509
- });
51491
+ );
50510
51492
  return cloneStateWithParagraphs(
50511
51493
  state,
50512
51494
  nextParagraphs,
@@ -50516,21 +51498,23 @@ function toggleParagraphList(state, kind) {
50516
51498
  function setParagraphListFormat(state, format) {
50517
51499
  const normalized = normalizeSelection(state);
50518
51500
  const paragraphs = getParagraphs(state);
50519
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50520
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
50521
- return cloneParagraph(paragraph);
50522
- }
50523
- if (!paragraph.list) {
50524
- return cloneParagraph(paragraph);
50525
- }
50526
- return {
50527
- ...cloneParagraph(paragraph),
50528
- list: {
50529
- ...paragraph.list,
50530
- format: format || void 0
51501
+ const nextParagraphs = paragraphs.map(
51502
+ (paragraph, paragraphIndex) => {
51503
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
51504
+ return cloneParagraph(paragraph);
50531
51505
  }
50532
- };
50533
- });
51506
+ if (!paragraph.list) {
51507
+ return cloneParagraph(paragraph);
51508
+ }
51509
+ return {
51510
+ ...cloneParagraph(paragraph),
51511
+ list: {
51512
+ ...paragraph.list,
51513
+ format: format || void 0
51514
+ }
51515
+ };
51516
+ }
51517
+ );
50534
51518
  return cloneStateWithParagraphs(
50535
51519
  state,
50536
51520
  nextParagraphs,
@@ -50540,21 +51524,23 @@ function setParagraphListFormat(state, format) {
50540
51524
  function setParagraphListStartAt(state, startAt) {
50541
51525
  const normalized = normalizeSelection(state);
50542
51526
  const paragraphs = getParagraphs(state);
50543
- const nextParagraphs = paragraphs.map((paragraph, paragraphIndex) => {
50544
- if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
50545
- return cloneParagraph(paragraph);
50546
- }
50547
- if (!paragraph.list) {
50548
- return cloneParagraph(paragraph);
50549
- }
50550
- return {
50551
- ...cloneParagraph(paragraph),
50552
- list: {
50553
- ...paragraph.list,
50554
- startAt: startAt !== null ? startAt : void 0
51527
+ const nextParagraphs = paragraphs.map(
51528
+ (paragraph, paragraphIndex) => {
51529
+ if (paragraphIndex < normalized.startIndex || paragraphIndex > normalized.endIndex) {
51530
+ return cloneParagraph(paragraph);
50555
51531
  }
50556
- };
50557
- });
51532
+ if (!paragraph.list) {
51533
+ return cloneParagraph(paragraph);
51534
+ }
51535
+ return {
51536
+ ...cloneParagraph(paragraph),
51537
+ list: {
51538
+ ...paragraph.list,
51539
+ startAt: startAt !== null ? startAt : void 0
51540
+ }
51541
+ };
51542
+ }
51543
+ );
50558
51544
  return cloneStateWithParagraphs(
50559
51545
  state,
50560
51546
  nextParagraphs,
@@ -50562,6 +51548,9 @@ function setParagraphListStartAt(state, startAt) {
50562
51548
  );
50563
51549
  }
50564
51550
  function createEditorCommandsController(deps) {
51551
+ return createEditorCommandsControllerImpl(deps);
51552
+ }
51553
+ function createEditorCommandsControllerImpl(deps) {
50565
51554
  const {
50566
51555
  state,
50567
51556
  logger,
@@ -50608,7 +51597,9 @@ function createEditorCommandsController(deps) {
50608
51597
  normalized.endIndex + 1
50609
51598
  );
50610
51599
  };
50611
- const selectionTouchesList = () => getSelectedParagraphRange().some((paragraph) => Boolean(paragraph.list));
51600
+ const selectionTouchesList = () => getSelectedParagraphRange().some(
51601
+ (paragraph) => Boolean(paragraph.list)
51602
+ );
50612
51603
  const focusedParagraph = () => {
50613
51604
  const focusParagraphId = state.selection.focus.paragraphId;
50614
51605
  return getParagraphs(state).find(
@@ -50726,7 +51717,9 @@ function createEditorCommandsController(deps) {
50726
51717
  execText((current) => clearSelectedTextFormatting(current));
50727
51718
  };
50728
51719
  const applyParagraphStyleCommand = (key, value) => {
50729
- execParagraph((current) => setParagraphStyle(current, key, value));
51720
+ execParagraph(
51721
+ (current) => setParagraphStyle(current, key, value)
51722
+ );
50730
51723
  };
50731
51724
  const toggleParagraphFlagCommand = (key) => {
50732
51725
  const nextValue = !toolbarStyleState()[key];
@@ -50736,10 +51729,14 @@ function createEditorCommandsController(deps) {
50736
51729
  execParagraph((current) => toggleParagraphList(current, kind));
50737
51730
  };
50738
51731
  const handleListFormatChange = (format) => {
50739
- execParagraph((current) => setParagraphListFormat(current, format));
51732
+ execParagraph(
51733
+ (current) => setParagraphListFormat(current, format)
51734
+ );
50740
51735
  };
50741
51736
  const handleListStartAtChange = (startAt) => {
50742
- execParagraph((current) => setParagraphListStartAt(current, startAt));
51737
+ execParagraph(
51738
+ (current) => setParagraphListStartAt(current, startAt)
51739
+ );
50743
51740
  };
50744
51741
  const applyInsertSectionBreakCommand = (breakType) => {
50745
51742
  execState(insertSectionBreakAtSelection(state, breakType));
@@ -50789,9 +51786,12 @@ function createEditorCommandsController(deps) {
50789
51786
  if (selectionCollapsed() && !activeLink) {
50790
51787
  return;
50791
51788
  }
50792
- execTransactional((current) => setLinkAtSelection(current, href), {
50793
- mergeKey: MERGE_KEYS.link
50794
- });
51789
+ execTransactional(
51790
+ (current) => setLinkAtSelection(current, href),
51791
+ {
51792
+ mergeKey: MERGE_KEYS.link
51793
+ }
51794
+ );
50795
51795
  };
50796
51796
  const promptForLink = () => {
50797
51797
  const activeLink = getLinkAtSelection(state) ?? "";
@@ -50808,9 +51808,12 @@ function createEditorCommandsController(deps) {
50808
51808
  if (!run) {
50809
51809
  return;
50810
51810
  }
50811
- execTransactional((current) => setSelectedImageAlt(current, alt), {
50812
- mergeKey: MERGE_KEYS.imageAlt
50813
- });
51811
+ execTransactional(
51812
+ (current) => setSelectedImageAlt(current, alt),
51813
+ {
51814
+ mergeKey: MERGE_KEYS.imageAlt
51815
+ }
51816
+ );
50814
51817
  };
50815
51818
  const promptForImageAlt = () => {
50816
51819
  var _a2;
@@ -50872,6 +51875,9 @@ function createEditorCommandsController(deps) {
50872
51875
  };
50873
51876
  }
50874
51877
  function createAppCommandsController(deps) {
51878
+ return createAppCommandsControllerImpl(deps);
51879
+ }
51880
+ function createAppCommandsControllerImpl(deps) {
50875
51881
  const commandsController = createEditorCommandsController({
50876
51882
  state: deps.state,
50877
51883
  logger: deps.logger,
@@ -51169,8 +52175,13 @@ const defaultEditorKeyBindings = [
51169
52175
  }
51170
52176
  ];
51171
52177
  function createEditorKeyboardController(deps) {
52178
+ return createEditorKeyboardControllerImpl(deps);
52179
+ }
52180
+ function createEditorKeyboardControllerImpl(deps) {
51172
52181
  const registry = new EditorCommandRegistry();
51173
- defaultEditorKeyBindings.forEach((binding) => registry.register(binding));
52182
+ defaultEditorKeyBindings.forEach(
52183
+ (binding) => registry.register(binding)
52184
+ );
51174
52185
  const handleKeyDown = (event) => {
51175
52186
  const currentState = deps.state();
51176
52187
  if (deps.isReadOnly()) {
@@ -51263,8 +52274,14 @@ function createEditorKeyboardController(deps) {
51263
52274
  deps.applyTransactionalState(
51264
52275
  (current) => deps.applyTableAwareParagraphEdit(
51265
52276
  setSelection(current, {
51266
- anchor: paragraphOffsetToPosition(focusParagraph, word.start),
51267
- focus: paragraphOffsetToPosition(focusParagraph, focusOffset)
52277
+ anchor: paragraphOffsetToPosition(
52278
+ focusParagraph,
52279
+ word.start
52280
+ ),
52281
+ focus: paragraphOffsetToPosition(
52282
+ focusParagraph,
52283
+ focusOffset
52284
+ )
51268
52285
  }),
51269
52286
  (temp) => deleteBackward(temp)
51270
52287
  )
@@ -51281,7 +52298,10 @@ function createEditorKeyboardController(deps) {
51281
52298
  deps.applyTransactionalState(
51282
52299
  (current) => deps.applyTableAwareParagraphEdit(
51283
52300
  setSelection(current, {
51284
- anchor: paragraphOffsetToPosition(focusParagraph, focusOffset),
52301
+ anchor: paragraphOffsetToPosition(
52302
+ focusParagraph,
52303
+ focusOffset
52304
+ ),
51285
52305
  focus: paragraphOffsetToPosition(focusParagraph, word.end)
51286
52306
  }),
51287
52307
  (temp) => deleteBackward(temp)
@@ -51558,8 +52578,8 @@ function connectEditorClientHost(controller, deps) {
51558
52578
  },
51559
52579
  clearHistory: () => deps.clearHistory(),
51560
52580
  importDocx: (file) => deps.docIO.handleImportFile(file),
51561
- exportDocx: () => deps.docIO.handleExportDocx(),
51562
- exportPdf: () => deps.docIO.handleExportPdf()
52581
+ exportDocx: () => Promise.resolve(deps.docIO.handleExportDocx()),
52582
+ exportPdf: () => Promise.resolve(deps.docIO.handleExportPdf())
51563
52583
  });
51564
52584
  }
51565
52585
  const SHAPE_DEFAULT_WIDTH = 150;
@@ -51700,7 +52720,9 @@ function insertTableOfContents(state, resolvePage = () => void 0, maxLevel = DEF
51700
52720
  const blockIndex = section.blocks.findIndex((block) => {
51701
52721
  if (block.id === focus.paragraphId) return true;
51702
52722
  if (block.type === "paragraph") return false;
51703
- return getBlockParagraphs(block).some((p) => p.id === focus.paragraphId);
52723
+ return getBlockParagraphs(block).some(
52724
+ (p) => p.id === focus.paragraphId
52725
+ );
51704
52726
  });
51705
52727
  const insertAt = blockIndex === -1 ? section.blocks.length : blockIndex + 1;
51706
52728
  const nextBlocks = [
@@ -51833,18 +52855,30 @@ function buildCoreFormattingCommands({
51833
52855
  italic: command("italic", formatting.italic, () => ({
51834
52856
  isActive: Boolean(s().italic)
51835
52857
  })),
51836
- underline: command("underline", formatting.underline, () => ({
51837
- isActive: Boolean(s().underline)
51838
- })),
52858
+ underline: command(
52859
+ "underline",
52860
+ formatting.underline,
52861
+ () => ({
52862
+ isActive: Boolean(s().underline)
52863
+ })
52864
+ ),
51839
52865
  strike: command("strike", formatting.strike, () => ({
51840
52866
  isActive: Boolean(s().strike)
51841
52867
  })),
51842
- superscript: command("superscript", formatting.superscript, () => ({
51843
- isActive: Boolean(s().superscript)
51844
- })),
51845
- subscript: command("subscript", formatting.subscript, () => ({
51846
- isActive: Boolean(s().subscript)
51847
- })),
52868
+ superscript: command(
52869
+ "superscript",
52870
+ formatting.superscript,
52871
+ () => ({
52872
+ isActive: Boolean(s().superscript)
52873
+ })
52874
+ ),
52875
+ subscript: command(
52876
+ "subscript",
52877
+ formatting.subscript,
52878
+ () => ({
52879
+ isActive: Boolean(s().subscript)
52880
+ })
52881
+ ),
51848
52882
  link: command(
51849
52883
  "link",
51850
52884
  () => (link.prompt(), true),
@@ -51853,24 +52887,48 @@ function buildCoreFormattingCommands({
51853
52887
  isActive: Boolean(s().link)
51854
52888
  })
51855
52889
  ),
51856
- alignLeft: command("alignLeft", formatting.alignLeft, () => ({
51857
- isActive: s().align === "left"
51858
- })),
51859
- alignCenter: command("alignCenter", formatting.alignCenter, () => ({
51860
- isActive: s().align === "center"
51861
- })),
51862
- alignRight: command("alignRight", formatting.alignRight, () => ({
51863
- isActive: s().align === "right"
51864
- })),
51865
- alignJustify: command("alignJustify", formatting.alignJustify, () => ({
51866
- isActive: s().align === "justify"
51867
- })),
51868
- orderedList: command("orderedList", formatting.orderedList, () => ({
51869
- isActive: s().listKind === "ordered"
51870
- })),
51871
- bulletList: command("bulletList", formatting.bulletList, () => ({
51872
- isActive: s().listKind === "bullet"
51873
- })),
52890
+ alignLeft: command(
52891
+ "alignLeft",
52892
+ formatting.alignLeft,
52893
+ () => ({
52894
+ isActive: s().align === "left"
52895
+ })
52896
+ ),
52897
+ alignCenter: command(
52898
+ "alignCenter",
52899
+ formatting.alignCenter,
52900
+ () => ({
52901
+ isActive: s().align === "center"
52902
+ })
52903
+ ),
52904
+ alignRight: command(
52905
+ "alignRight",
52906
+ formatting.alignRight,
52907
+ () => ({
52908
+ isActive: s().align === "right"
52909
+ })
52910
+ ),
52911
+ alignJustify: command(
52912
+ "alignJustify",
52913
+ formatting.alignJustify,
52914
+ () => ({
52915
+ isActive: s().align === "justify"
52916
+ })
52917
+ ),
52918
+ orderedList: command(
52919
+ "orderedList",
52920
+ formatting.orderedList,
52921
+ () => ({
52922
+ isActive: s().listKind === "ordered"
52923
+ })
52924
+ ),
52925
+ bulletList: command(
52926
+ "bulletList",
52927
+ formatting.bulletList,
52928
+ () => ({
52929
+ isActive: s().listKind === "bullet"
52930
+ })
52931
+ ),
51874
52932
  find: command("find", formatting.find),
51875
52933
  replace: command("replace", formatting.replace),
51876
52934
  toggleTrackChanges: command(
@@ -52001,7 +53059,10 @@ function buildDocumentAndBrowserCommands({
52001
53059
  "importDocument",
52002
53060
  () => document2.importDocument()
52003
53061
  ),
52004
- insertImage: actionCommand("insertImage", () => document2.insertImage()),
53062
+ insertImage: actionCommand(
53063
+ "insertImage",
53064
+ () => document2.insertImage()
53065
+ ),
52005
53066
  insertShape: actionCommand(
52006
53067
  "insertShape",
52007
53068
  (p) => document2.insertShape(String(p))
@@ -52146,7 +53207,9 @@ function buildParagraphAndSectionCommands({
52146
53207
  (p) => {
52147
53208
  section.setPageMargins(p ?? {});
52148
53209
  },
52149
- () => ({ value: section.getMargins() })
53210
+ () => ({
53211
+ value: section.getMargins()
53212
+ })
52150
53213
  )
52151
53214
  };
52152
53215
  }
@@ -52235,12 +53298,18 @@ function buildTableCommands({
52235
53298
  () => table.cellNoBorders()
52236
53299
  ),
52237
53300
  tableWidth100: actionCommand("tableWidth100", () => table.width100()),
52238
- tableAlignLeft: actionCommand("tableAlignLeft", () => table.alignLeft()),
53301
+ tableAlignLeft: actionCommand(
53302
+ "tableAlignLeft",
53303
+ () => table.alignLeft()
53304
+ ),
52239
53305
  tableAlignCenter: actionCommand(
52240
53306
  "tableAlignCenter",
52241
53307
  () => table.alignCenter()
52242
53308
  ),
52243
- tableAlignRight: actionCommand("tableAlignRight", () => table.alignRight()),
53309
+ tableAlignRight: actionCommand(
53310
+ "tableAlignRight",
53311
+ () => table.alignRight()
53312
+ ),
52244
53313
  tableSetCellWidth: actionCommand(
52245
53314
  "tableSetCellWidth",
52246
53315
  (p) => table.setCellWidth(String(p))
@@ -52645,7 +53714,7 @@ function createEditorEssentialsRuntimePlugin(options) {
52645
53714
  });
52646
53715
  }
52647
53716
  };
52648
- const essentialsTable = /* @__PURE__ */ (() => {
53717
+ const buildEssentialsTable = () => {
52649
53718
  const insideTable = () => Boolean(
52650
53719
  findParagraphTableLocation(
52651
53720
  options.state().document,
@@ -52759,7 +53828,8 @@ function createEditorEssentialsRuntimePlugin(options) {
52759
53828
  ),
52760
53829
  insert: (rows, cols) => options.tableOps.insertTableCommand(rows, cols)
52761
53830
  };
52762
- })();
53831
+ };
53832
+ const essentialsTable = buildEssentialsTable();
52763
53833
  return createEssentialsPlugin({
52764
53834
  gate: essentialsGate,
52765
53835
  style: essentialsStyle,
@@ -53312,6 +54382,9 @@ function useEditorRuntimeBootstrap(ctx) {
53312
54382
  };
53313
54383
  }
53314
54384
  function createEditorCommandRuntime(deps) {
54385
+ return createEditorCommandRuntimeImpl(deps);
54386
+ }
54387
+ function createEditorCommandRuntimeImpl(deps) {
53315
54388
  const { document: doc, interaction, runtimeClient } = deps;
53316
54389
  const { commandsController, keyboardCommandsController } = createAppCommandsController({
53317
54390
  state: deps.state,
@@ -53627,6 +54700,7 @@ function OasisEditorApp(props = {}) {
53627
54700
  computeFontSizeOptions: computeFontSizeOptions2,
53628
54701
  applyFontDialogValues,
53629
54702
  applyParagraphDialogValues,
54703
+ setParagraphDialogDefault,
53630
54704
  applyTablePropertiesDialogValues,
53631
54705
  buildContextMenuItems,
53632
54706
  handleEditorContextMenu,
@@ -53784,6 +54858,7 @@ function OasisEditorApp(props = {}) {
53784
54858
  },
53785
54859
  applyFontDialogValues,
53786
54860
  applyParagraphDialogValues,
54861
+ setParagraphDialogDefault,
53787
54862
  applyTablePropertiesDialogValues,
53788
54863
  closeContextMenu
53789
54864
  }), null);