oasis-editor 0.0.78 → 0.0.79

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.
@@ -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 { a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, v as isSelectionCollapsed, w as parseFontSizePtToPx, x as formatFontSizePt, y as createEditorParagraph, z as getBlockParagraphs, A as findParagraphTableLocation, B as buildTableCellLayout, P as PT_PER_PX, C as createEditorTableCell, D as createEditorTableRow, E as createEditorTable, F as underlineStyleToCssDecorationStyle, G as resolveImageSrc, H as listKindForTag, I as isParagraphTag, J as collectInlineRuns, K as parseParagraphStyle, L as InlineShell, M as BalloonShell, N as DocumentShell, O as createMemo, Q as buildCanvasLayoutSnapshot, R as getCaretRectFromSnapshot, T as getParagraphRectFromSnapshot, U as createComponent, V as CaretOverlay, W as Show, X as createRenderEffect, Y as style, Z as setAttribute, _ as setStyleProperty, $ as memo, a0 as template, a1 as useI18n, a2 as createEffect, a3 as insert, a4 as use, a5 as addEventListener, a6 as Dialog, a7 as delegateEvents, a8 as className, a9 as For, aa as UNDERLINE_STYLE_OPTIONS, ab as Tabs, ac as onMount, ad as onCleanup, ae as PluginUiHost, af as OasisEditorEditor, ag as OasisBrandMark, ah as setPreciseFontPreference, ai as setWelcomeSeen, aj as enablePreciseFontMode, ak as TWIPS_PER_POINT, al as PX_PER_INCH, am as TWIPS_PER_INCH, an as resolveEffectiveParagraphStyle, ao as resolveEffectiveTextStyleForParagraph, ap as EMU_PER_PX, aq as EMU_PER_PT, ar as iterateFootnoteReferenceRuns, as as iterateEndnoteReferenceRuns, at as imageContentTypeDefaults, au as createEditorRun, av as JSZip, aw as imageExtensionFromMime, ax as pxToPt$1, ay as resolveFloatingObjectRect, az as getTextBoxFloatingGeometry, aA as getPresetPathSegments, aB as projectBlocksLayout, aC as buildListLabels, aD as textStyleToFontSizePt, aE as PX_PER_POINT, aF as DEFAULT_FONT_SIZE_PX, aG as isDoubleUnderlineStyle, aH as isWavyUnderlineStyle, aI as underlineStyleLineWidthPx, aJ as underlineStyleDashArray, aK as resolveListLabel, aL as getListLabelInset, aM as getAlignedListLabelInset, aN as getParagraphBorderInsets, aO as buildSegmentTable, aP as buildCanvasTableLayout, aQ as normalizeFamily, aR as ROBOTO_FONT_FILES, aS as loadFontAsset, aT as OFFICE_COMPAT_FONT_FAMILIES, aU as buildSfnt, aV as defaultFontDecoderRegistry, aW as SfntFontProgram, aX as collectPdfFontFamilies, aY as projectDocumentLayout, aZ as getPageContentWidth, a_ as getPageHeaderZoneTop, a$ as getPageBodyTop, b0 as getPageColumnRects, b1 as findFootnoteReference, b2 as FOOTNOTE_MARKER_GUTTER_PX, b3 as resolveImporterForFile, b4 as getDocumentSectionsCanonical, b5 as getDocumentParagraphsCanonical, b6 as getDocumentParagraphs, b7 as getDocumentPageSettings, b8 as getTableCellContentWidthForParagraph, b9 as on, ba as debounce, bb as unwrap, bc as perfTimer, bd as createEditorDocument, be as resolveResizedDimensions, bf as resolveTextBoxRenderHeight, bg as getToolbarStyleState, bh as getCachedCanvasImage, bi as measureParagraphMinContentWidthPx, bj as getEditableBlocksForZone, bk as findParagraphLocation, bl as createSectionBoundaryParagraph, bm as normalizePageSettings, bn as DEFAULT_EDITOR_PAGE_SETTINGS, bo as markStart, bp as markEnd, bq as getParagraphEntries, br as getParagraphById, bs as createEditorFootnote, bt as createFootnoteReferenceRun, bu as renumberFootnotes, bv as getFootnoteDisplayMarker, bw as getHeadingLevel, bx as preciseFontModeVersion, by as isPreciseFontModeEnabled, bz as togglePreciseFontMode, bA as nextFontSizePt, bB as previousFontSizePt, bC as fontSizePtToPx, bD as createDefaultToolbarPreset, bE as MenuRegistry, bF as createToolbarRegistry, bG as Editor, bH as resolveCommandRef, bI as commandRefName, bJ as createOasisEditorClient, bK as createEditorZoom, bL as startLongTaskObserver, bM as installGlobalReport, bN as applyStoredPreciseFontPreference, bO as getWelcomeSeen, bP as isLocalFontAccessSupported, bQ as EDITOR_SCROLL_PADDING_PX, bR as Toolbar, bS as OasisEditorLoading, bT as I18nProvider, bU as createTranslator, bV as createEditorLogger, bW as registerDomStatsSurface } from "./index-CqVqLWyO.js";
4
+ import { a as assertNever, c as createSignal, b as createEditorStateFromDocument, d as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, f as fontSizePxToPt, p as probeLocalFontFamilies, e as createEditorParagraphFromRuns, i as isInlineObjectRun, g as createEditorStyledRun, h as getParagraphLength, j as getParagraphText, k as getActiveZone, l as getDocumentSections, m as getActiveSectionIndex, n as getParagraphs, o as normalizeSelection, q as positionToParagraphOffset, r as paragraphOffsetToPosition, s as clampPosition, t as findParagraphIndex, u as createCollapsedSelection, v as isSelectionCollapsed, w as parseFontSizePtToPx, x as formatFontSizePt, y as createEditorParagraph, z as getBlockParagraphs, A as findParagraphTableLocation, B as buildTableCellLayout, P as PT_PER_PX, C as createEditorTableCell, D as createEditorTableRow, E as createEditorTable, F as underlineStyleToCssDecorationStyle, G as resolveImageSrc, H as listKindForTag, I as isParagraphTag, J as collectInlineRuns, K as parseParagraphStyle, L as InlineShell, M as BalloonShell, N as DocumentShell, O as createMemo, Q as buildCanvasLayoutSnapshot, R as getCaretRectFromSnapshot, T as getParagraphRectFromSnapshot, U as createComponent, V as CaretOverlay, W as Show, X as createRenderEffect, Y as style, Z as setAttribute, _ as setStyleProperty, $ as memo, a0 as template, a1 as useI18n, a2 as createEffect, a3 as insert, a4 as use, a5 as addEventListener, a6 as Dialog, a7 as delegateEvents, a8 as className, a9 as For, aa as UNDERLINE_STYLE_OPTIONS, ab as Tabs, ac as onMount, ad as onCleanup, ae as PluginUiHost, af as OasisEditorEditor, ag as OasisBrandMark, ah as setPreciseFontPreference, ai as setWelcomeSeen, aj as enablePreciseFontMode, ak as TWIPS_PER_POINT, al as PX_PER_INCH, am as TWIPS_PER_INCH, an as resolveEffectiveParagraphStyle, ao as resolveEffectiveTextStyleForParagraph, ap as EMU_PER_PX, aq as EMU_PER_PT, ar as iterateFootnoteReferenceRuns, as as iterateEndnoteReferenceRuns, at as imageContentTypeDefaults, au as createEditorRun, av as JSZip, aw as imageExtensionFromMime, ax as pxToPt$1, ay as resolveFloatingObjectRect, az as getTextBoxFloatingGeometry, aA as getPresetPathSegments, aB as projectBlocksLayout, aC as buildListLabels, aD as textStyleToFontSizePt, aE as PX_PER_POINT, aF as DEFAULT_FONT_SIZE_PX, aG as isDoubleUnderlineStyle, aH as isWavyUnderlineStyle, aI as underlineStyleLineWidthPx, aJ as underlineStyleDashArray, aK as resolveListLabel, aL as getListLabelInset, aM as getAlignedListLabelInset, aN as getParagraphBorderInsets, aO as buildSegmentTable, aP as buildCanvasTableLayout, aQ as normalizeFamily, aR as ROBOTO_FONT_FILES, aS as loadFontAsset, aT as OFFICE_COMPAT_FONT_FAMILIES, aU as buildSfnt, aV as defaultFontDecoderRegistry, aW as SfntFontProgram, aX as collectPdfFontFamilies, aY as projectDocumentLayout, aZ as getPageContentWidth, a_ as getPageHeaderZoneTop, a$ as getPageBodyTop, b0 as getPageColumnRects, b1 as findFootnoteReference, b2 as FOOTNOTE_MARKER_GUTTER_PX, b3 as resolveImporterForFile, b4 as getDocumentSectionsCanonical, b5 as getDocumentParagraphsCanonical, b6 as getDocumentParagraphs, b7 as getDocumentPageSettings, b8 as getTableCellContentWidthForParagraph, b9 as on, ba as debounce, bb as unwrap, bc as perfTimer, bd as createEditorDocument, be as resolveResizedDimensions, bf as resolveTextBoxRenderHeight, bg as getToolbarStyleState, bh as getCachedCanvasImage, bi as measureParagraphMinContentWidthPx, bj as getEditableBlocksForZone, bk as findParagraphLocation, bl as createSectionBoundaryParagraph, bm as normalizePageSettings, bn as DEFAULT_EDITOR_PAGE_SETTINGS, bo as markStart, bp as markEnd, bq as getParagraphEntries, br as getParagraphById, bs as createEditorFootnote, bt as createFootnoteReferenceRun, bu as renumberFootnotes, bv as getFootnoteDisplayMarker, bw as getHeadingLevel, bx as preciseFontModeVersion, by as isPreciseFontModeEnabled, bz as togglePreciseFontMode, bA as nextFontSizePt, bB as previousFontSizePt, bC as fontSizePtToPx, bD as createDefaultToolbarPreset, bE as MenuRegistry, bF as createToolbarRegistry, bG as Editor, bH as resolveCommandRef, bI as commandRefName, bJ as createOasisEditorClient, bK as createEditorZoom, bL as startLongTaskObserver, bM as installGlobalReport, bN as applyStoredPreciseFontPreference, bO as getWelcomeSeen, bP as isLocalFontAccessSupported, bQ as EDITOR_SCROLL_PADDING_PX, bR as Toolbar, bS as OasisEditorLoading, bT as I18nProvider, bU as createTranslator, bV as createEditorLogger, bW as registerDomStatsSurface } from "./index-4tUDVrZ1.js";
5
5
  function cloneBlock(block) {
6
6
  switch (block.type) {
7
7
  case "paragraph":
@@ -29133,93 +29133,84 @@ function buildInitialValues(ctx, activeTab = "table") {
29133
29133
  function setCellStyle(state, key, value) {
29134
29134
  return setTableCellStyleValue(state, key, value);
29135
29135
  }
29136
+ function hasActiveTable(state) {
29137
+ return Boolean(resolveActiveTableContext(state));
29138
+ }
29139
+ function readTableProperties(state, activeTab = "table") {
29140
+ const ctx = resolveActiveTableContext(state);
29141
+ if (!ctx) return null;
29142
+ return buildInitialValues(ctx, activeTab);
29143
+ }
29144
+ function applyTableProperties(state, values) {
29145
+ const ctx = resolveActiveTableContext(state);
29146
+ if (!ctx) return state;
29147
+ let next = state;
29148
+ next = setActiveTableStyleValue(next, ctx.tableId, "width", values.tableWidth);
29149
+ next = setActiveTableStyleValue(next, ctx.tableId, "align", values.tableAlign);
29150
+ next = setActiveTableStyleValue(
29151
+ next,
29152
+ ctx.tableId,
29153
+ "indentLeft",
29154
+ values.tableIndentLeft
29155
+ );
29156
+ next = setActiveTableStyleValue(
29157
+ next,
29158
+ ctx.tableId,
29159
+ "altTitle",
29160
+ values.altTitle
29161
+ );
29162
+ next = setActiveTableStyleValue(
29163
+ next,
29164
+ ctx.tableId,
29165
+ "altDescription",
29166
+ values.altDescription
29167
+ );
29168
+ next = setSelectedTableRowHeader(next, values.repeatHeader);
29169
+ next = setSelectedTableRowStyleValue(next, "height", values.rowHeight);
29170
+ next = setSelectedTableRowStyleValue(
29171
+ next,
29172
+ "heightRule",
29173
+ values.rowHeightRule
29174
+ );
29175
+ next = setSelectedTableRowStyleValue(next, "cantSplit", values.cantSplit);
29176
+ next = setSelectedTableRowStyleValue(next, "hidden", values.hiddenRow);
29177
+ if (values.columnWidth !== null) {
29178
+ next = setTableColumnWidths(next, ctx.tableId, {
29179
+ [ctx.visualColumnIndex]: values.columnWidth
29180
+ });
29181
+ }
29182
+ next = setCellStyle(next, "width", values.cellWidth);
29183
+ next = setCellStyle(next, "verticalAlign", values.cellVerticalAlign);
29184
+ next = setCellStyle(next, "textDirection", values.cellTextDirection);
29185
+ next = setCellStyle(next, "noWrap", values.cellNoWrap);
29186
+ next = setCellStyle(next, "fitText", values.cellFitText);
29187
+ next = setCellStyle(next, "hideMark", values.cellHideMark);
29188
+ next = setCellStyle(next, "paddingTop", values.margins.top);
29189
+ next = setCellStyle(next, "paddingRight", values.margins.right);
29190
+ next = setCellStyle(next, "paddingBottom", values.margins.bottom);
29191
+ next = setCellStyle(next, "paddingLeft", values.margins.left);
29192
+ next = setCellStyle(next, "borderTop", values.borders.top);
29193
+ next = setCellStyle(next, "borderRight", values.borders.right);
29194
+ next = setCellStyle(next, "borderBottom", values.borders.bottom);
29195
+ next = setCellStyle(next, "borderLeft", values.borders.left);
29196
+ next = setCellStyle(next, "shading", values.shading);
29197
+ return next;
29198
+ }
29136
29199
  function createTablePropertiesDialogBridge(deps) {
29137
- const isInsideTable = () => Boolean(resolveActiveTableContext(deps.state()));
29200
+ const isInsideTable = () => hasActiveTable(deps.state());
29138
29201
  const openTablePropertiesDialog = (activeTab = "table") => {
29139
- const ctx = resolveActiveTableContext(deps.state());
29140
- if (!ctx) return;
29202
+ const initial = readTableProperties(deps.state(), activeTab);
29203
+ if (!initial) return;
29141
29204
  deps.setContextMenu({ isOpen: false, x: 0, y: 0 });
29142
- deps.setTablePropertiesDialog({
29143
- isOpen: true,
29144
- initial: buildInitialValues(ctx, activeTab)
29145
- });
29205
+ deps.setTablePropertiesDialog({ isOpen: true, initial });
29146
29206
  };
29147
29207
  const applyTablePropertiesDialogValues = (values) => {
29148
29208
  if (deps.isReadOnly()) return;
29149
- const ctx = resolveActiveTableContext(deps.state());
29150
- if (!ctx) return;
29209
+ if (!isInsideTable()) return;
29151
29210
  deps.clearPreferredColumn();
29152
29211
  deps.resetTransactionGrouping();
29153
29212
  deps.applyTransactionalState(
29154
- (current) => {
29155
- const currentCtx = resolveActiveTableContext(current);
29156
- if (!currentCtx) return current;
29157
- let next = current;
29158
- next = setActiveTableStyleValue(
29159
- next,
29160
- currentCtx.tableId,
29161
- "width",
29162
- values.tableWidth
29163
- );
29164
- next = setActiveTableStyleValue(
29165
- next,
29166
- currentCtx.tableId,
29167
- "align",
29168
- values.tableAlign
29169
- );
29170
- next = setActiveTableStyleValue(
29171
- next,
29172
- currentCtx.tableId,
29173
- "indentLeft",
29174
- values.tableIndentLeft
29175
- );
29176
- next = setActiveTableStyleValue(
29177
- next,
29178
- currentCtx.tableId,
29179
- "altTitle",
29180
- values.altTitle
29181
- );
29182
- next = setActiveTableStyleValue(
29183
- next,
29184
- currentCtx.tableId,
29185
- "altDescription",
29186
- values.altDescription
29187
- );
29188
- next = setSelectedTableRowHeader(next, values.repeatHeader);
29189
- next = setSelectedTableRowStyleValue(next, "height", values.rowHeight);
29190
- next = setSelectedTableRowStyleValue(
29191
- next,
29192
- "heightRule",
29193
- values.rowHeightRule
29194
- );
29195
- next = setSelectedTableRowStyleValue(
29196
- next,
29197
- "cantSplit",
29198
- values.cantSplit
29199
- );
29200
- next = setSelectedTableRowStyleValue(next, "hidden", values.hiddenRow);
29201
- if (values.columnWidth !== null) {
29202
- next = setTableColumnWidths(next, currentCtx.tableId, {
29203
- [currentCtx.visualColumnIndex]: values.columnWidth
29204
- });
29205
- }
29206
- next = setCellStyle(next, "width", values.cellWidth);
29207
- next = setCellStyle(next, "verticalAlign", values.cellVerticalAlign);
29208
- next = setCellStyle(next, "textDirection", values.cellTextDirection);
29209
- next = setCellStyle(next, "noWrap", values.cellNoWrap);
29210
- next = setCellStyle(next, "fitText", values.cellFitText);
29211
- next = setCellStyle(next, "hideMark", values.cellHideMark);
29212
- next = setCellStyle(next, "paddingTop", values.margins.top);
29213
- next = setCellStyle(next, "paddingRight", values.margins.right);
29214
- next = setCellStyle(next, "paddingBottom", values.margins.bottom);
29215
- next = setCellStyle(next, "paddingLeft", values.margins.left);
29216
- next = setCellStyle(next, "borderTop", values.borders.top);
29217
- next = setCellStyle(next, "borderRight", values.borders.right);
29218
- next = setCellStyle(next, "borderBottom", values.borders.bottom);
29219
- next = setCellStyle(next, "borderLeft", values.borders.left);
29220
- next = setCellStyle(next, "shading", values.shading);
29221
- return next;
29222
- },
29213
+ (current) => applyTableProperties(current, values),
29223
29214
  { mergeKey: "tableProperties" }
29224
29215
  );
29225
29216
  deps.focusInput();
@@ -0,0 +1,15 @@
1
+ import { EditorState } from '../../core/model.js';
2
+ import { TablePropertiesDialogApplyValues, TablePropertiesDialogInitialValues } from '../../ui/components/Dialogs/TablePropertiesDialog.js';
3
+
4
+ /** Whether the current selection sits inside a table. */
5
+ export declare function hasActiveTable(state: EditorState): boolean;
6
+ /**
7
+ * Reads the active table/cell into the dialog's initial values, or `null` when
8
+ * the selection is not inside a table.
9
+ */
10
+ export declare function readTableProperties(state: EditorState, activeTab?: TablePropertiesDialogInitialValues["activeTab"]): TablePropertiesDialogInitialValues | null;
11
+ /**
12
+ * Applies the dialog's submitted values to the active table/cell, returning the
13
+ * next state. A no-op when the selection is no longer inside a table.
14
+ */
15
+ export declare function applyTableProperties(state: EditorState, values: TablePropertiesDialogApplyValues): EditorState;
@@ -2483,7 +2483,7 @@ function OasisEditorAppLazy(props = {}) {
2483
2483
  onCleanup(() => {
2484
2484
  cancelled = true;
2485
2485
  });
2486
- import("./OasisEditorApp-C3VK8dmM.js").then((m) => {
2486
+ import("./OasisEditorApp-Cl-Q12TJ.js").then((m) => {
2487
2487
  cancelled = true;
2488
2488
  setProgress(1);
2489
2489
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -1,4 +1,4 @@
1
- import { M, bX, bY, bZ, b_, b$, a6, c0, N, bG, c1, c2, c3, L, c4, bE, c5, c6, c7, c8, c9, bS, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, ab, cl, bR, cm, bZ as bZ2, c2 as c22, c4 as c42, cd as cd2, cf as cf2, ck as ck2, cn, bI, bD, co, cp, cq, bF, cr, cs, bH } from "./index-CqVqLWyO.js";
1
+ import { M, bX, bY, bZ, b_, b$, a6, c0, N, bG, c1, c2, c3, L, c4, bE, c5, c6, c7, c8, c9, bS, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, ab, cl, bR, cm, bZ as bZ2, c2 as c22, c4 as c42, cd as cd2, cf as cf2, ck as ck2, cn, bI, bD, co, cp, cq, bF, cr, cs, bH } from "./index-4tUDVrZ1.js";
2
2
  export {
3
3
  M as BalloonShell,
4
4
  bX as Button,