oasis-editor 0.0.140 → 0.0.141

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 { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as resolveEffectiveTableStyle, cP as createDefaultToolbarPreset, cQ as MenuRegistry, cR as createToolbarRegistry, cS as Editor, cT as resolveCommandRef, cU as commandRefName, cV as createOasisEditorClient, cW as createEditorZoom, cX as startLongTaskObserver, cY as installGlobalReport, cZ as applyStoredPreciseFontPreference, c_ as getWelcomeSeen, c$ as isLocalFontAccessSupported, d0 as EDITOR_SCROLL_PADDING_PX, d1 as Toolbar, d2 as OasisEditorLoading, d3 as I18nProvider, d4 as createTranslator, d5 as registerDomStatsSurface, d6 as createEditorLogger } from "./index-C_F1o38Z.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 findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, M as parseFontSizePtToPx, N as formatFontSizePt, O as createEditorParagraph, P as resolveDefaultParagraphStyleId, Q as findParagraphTableLocation, R as buildTableCellLayout, T as PT_PER_PX, U as createEditorTableCell, V as createEditorTableRow, W as createEditorTable, X as clampPosition, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as resolveEffectiveTableStyle, cP as createDefaultToolbarPreset, cQ as MenuRegistry, cR as createToolbarRegistry, cS as Editor, cT as resolveCommandRef, cU as commandRefName, cV as createOasisEditorClient, cW as createEditorZoom, cX as startLongTaskObserver, cY as installGlobalReport, cZ as applyStoredPreciseFontPreference, c_ as getWelcomeSeen, c$ as isLocalFontAccessSupported, d0 as EDITOR_SCROLL_PADDING_PX, d1 as Toolbar, d2 as OasisEditorLoading, d3 as I18nProvider, d4 as createTranslator, d5 as registerDomStatsSurface, d6 as createEditorLogger } from "./index-PWJQT9bT.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -27958,21 +27958,28 @@ function withSelection(position) {
27958
27958
  }
27959
27959
  function getFocusParagraph(state) {
27960
27960
  const paragraphs = getParagraphs(state);
27961
- const focus = clampPosition(state, state.selection.focus);
27962
- const index = findParagraphIndex(paragraphs, focus.paragraphId);
27961
+ const index = findParagraphIndex(
27962
+ paragraphs,
27963
+ state.selection.focus.paragraphId
27964
+ );
27963
27965
  const paragraph = paragraphs[index];
27966
+ const focus = paragraphOffsetToPosition(
27967
+ paragraph,
27968
+ positionToParagraphOffset(paragraph, state.selection.focus)
27969
+ );
27964
27970
  return {
27965
27971
  paragraph,
27972
+ paragraphs,
27966
27973
  index,
27967
27974
  offset: positionToParagraphOffset(paragraph, focus)
27968
27975
  };
27969
27976
  }
27970
27977
  function deleteSelectionRange(state) {
27971
- const normalized = normalizeSelection(state);
27978
+ const paragraphs = getParagraphs(state);
27979
+ const normalized = normalizeSelection(state, paragraphs);
27972
27980
  if (normalized.isCollapsed) {
27973
27981
  return state;
27974
27982
  }
27975
- const paragraphs = getParagraphs(state);
27976
27983
  if (state.trackChangesEnabled) {
27977
27984
  const revisionId = `rev:${Math.random().toString(36).slice(2, 9)}`;
27978
27985
  const author = "User";
@@ -30979,8 +30986,7 @@ function moveVertical(state, delta) {
30979
30986
  if (!isSelectionCollapsed(state.selection)) {
30980
30987
  return collapseToBoundary(state, delta < 0 ? "start" : "end");
30981
30988
  }
30982
- const { index, offset } = getFocusParagraph(state);
30983
- const paragraphs = getParagraphs(state);
30989
+ const { paragraphs, index, offset } = getFocusParagraph(state);
30984
30990
  const nextIndex = index + delta;
30985
30991
  if (nextIndex < 0 || nextIndex >= paragraphs.length) {
30986
30992
  return state;
@@ -30997,11 +31003,12 @@ function moveVertical(state, delta) {
30997
31003
  );
30998
31004
  }
30999
31005
  function moveFocusHorizontally(state, delta) {
31000
- const focus = clampPosition(state, state.selection.focus);
31001
- const paragraphs = getParagraphs(state);
31002
- const index = findParagraphIndex(paragraphs, focus.paragraphId);
31003
- const paragraph = paragraphs[index];
31004
- const paragraphOffset = positionToParagraphOffset(paragraph, focus);
31006
+ const {
31007
+ paragraphs,
31008
+ paragraph,
31009
+ index,
31010
+ offset: paragraphOffset
31011
+ } = getFocusParagraph(state);
31005
31012
  const paragraphLength = getParagraphLength(paragraph);
31006
31013
  if (delta < 0 && paragraphOffset > 0) {
31007
31014
  return setStateSelection(state, {
@@ -31035,11 +31042,11 @@ function moveFocusHorizontally(state, delta) {
31035
31042
  return state;
31036
31043
  }
31037
31044
  function moveFocusVertical(state, delta) {
31038
- const focus = clampPosition(state, state.selection.focus);
31039
- const paragraphs = getParagraphs(state);
31040
- const index = findParagraphIndex(paragraphs, focus.paragraphId);
31041
- const paragraph = paragraphs[index];
31042
- const paragraphOffset = positionToParagraphOffset(paragraph, focus);
31045
+ const {
31046
+ paragraphs,
31047
+ index,
31048
+ offset: paragraphOffset
31049
+ } = getFocusParagraph(state);
31043
31050
  const nextIndex = index + delta;
31044
31051
  if (nextIndex < 0 || nextIndex >= paragraphs.length) {
31045
31052
  return state;
@@ -4,6 +4,7 @@ import { normalizeSelection } from '../selection.js';
4
4
  export declare function withSelection(position: EditorPosition): EditorSelection;
5
5
  export declare function getFocusParagraph(state: EditorState): {
6
6
  paragraph: EditorParagraphNode;
7
+ paragraphs: EditorParagraphNode[];
7
8
  index: number;
8
9
  offset: number;
9
10
  };
@@ -2731,7 +2731,7 @@ function OasisEditorAppLazy(props = {}) {
2731
2731
  onCleanup(() => {
2732
2732
  cancelled = true;
2733
2733
  });
2734
- import("./OasisEditorApp-vqeSS8FT.js").then((m) => {
2734
+ import("./OasisEditorApp-DNiy9Yze.js").then((m) => {
2735
2735
  cancelled = true;
2736
2736
  setProgress(1);
2737
2737
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -3448,7 +3448,10 @@ function getParagraphText(paragraph) {
3448
3448
  return paragraph.runs.map((run) => run.text).join("");
3449
3449
  }
3450
3450
  function getParagraphLength(paragraph) {
3451
- return getParagraphText(paragraph).length;
3451
+ return paragraph.runs.reduce(
3452
+ (length, run) => length + run.text.length,
3453
+ 0
3454
+ );
3452
3455
  }
3453
3456
  function getRunIndex(paragraph, runId) {
3454
3457
  const index = paragraph.runs.findIndex((run) => run.id === runId);
@@ -17891,9 +17894,9 @@ function sliceFragmentToRange(fragment, startOffset, endOffset) {
17891
17894
  if (start >= end) {
17892
17895
  return null;
17893
17896
  }
17894
- const chars2 = fragment.chars.filter(
17895
- (char) => char.paragraphOffset >= start && char.paragraphOffset < end
17896
- );
17897
+ const firstCharIndex = findFirstCharAtOrAfter(fragment.chars, start);
17898
+ const lastCharIndex = findFirstCharAtOrAfter(fragment.chars, end);
17899
+ const chars2 = fragment.chars.slice(firstCharIndex, lastCharIndex);
17897
17900
  return {
17898
17901
  paragraphId: fragment.paragraphId,
17899
17902
  runId: fragment.runId,
@@ -17907,6 +17910,54 @@ function sliceFragmentToRange(fragment, startOffset, endOffset) {
17907
17910
  chars: chars2
17908
17911
  };
17909
17912
  }
17913
+ function findFirstCharAtOrAfter(chars2, offset) {
17914
+ let low = 0;
17915
+ let high = chars2.length;
17916
+ while (low < high) {
17917
+ const middle = low + Math.floor((high - low) / 2);
17918
+ if (chars2[middle].paragraphOffset < offset) {
17919
+ low = middle + 1;
17920
+ } else {
17921
+ high = middle;
17922
+ }
17923
+ }
17924
+ return low;
17925
+ }
17926
+ function sliceFragmentsToRanges(fragments, ranges) {
17927
+ const rangesAreOrdered = ranges.every(
17928
+ (range, index) => index === 0 || range.startOffset >= ranges[index - 1].startOffset
17929
+ );
17930
+ const fragmentsAreOrdered = fragments.every(
17931
+ (fragment, index) => index === 0 || fragment.startOffset >= fragments[index - 1].startOffset
17932
+ );
17933
+ if (!rangesAreOrdered || !fragmentsAreOrdered) {
17934
+ return ranges.map(
17935
+ (range) => fragments.map(
17936
+ (fragment) => sliceFragmentToRange(fragment, range.startOffset, range.endOffset)
17937
+ ).filter(
17938
+ (fragment) => fragment !== null
17939
+ )
17940
+ );
17941
+ }
17942
+ let firstCandidateIndex = 0;
17943
+ return ranges.map((range) => {
17944
+ while (firstCandidateIndex < fragments.length && fragments[firstCandidateIndex].endOffset <= range.startOffset) {
17945
+ firstCandidateIndex += 1;
17946
+ }
17947
+ const sliced = [];
17948
+ for (let index = firstCandidateIndex; index < fragments.length && fragments[index].startOffset < range.endOffset; index += 1) {
17949
+ const fragment = sliceFragmentToRange(
17950
+ fragments[index],
17951
+ range.startOffset,
17952
+ range.endOffset
17953
+ );
17954
+ if (fragment) {
17955
+ sliced.push(fragment);
17956
+ }
17957
+ }
17958
+ return sliced;
17959
+ });
17960
+ }
17910
17961
  let paragraphLayoutCache = /* @__PURE__ */ new WeakMap();
17911
17962
  const paragraphFieldDependenceCache = /* @__PURE__ */ new WeakMap();
17912
17963
  function clearProjectedParagraphLayoutCache() {
@@ -17985,21 +18036,19 @@ function projectParagraphLayout(paragraph, pageIndex, totalPages, styles, conten
17985
18036
  fontSize,
17986
18037
  styles
17987
18038
  );
17988
- const lines = measurer.composeMeasuredParagraphLines({
18039
+ const composedLines = measurer.composeMeasuredParagraphLines({
17989
18040
  paragraph,
17990
18041
  fragments,
17991
18042
  styles,
17992
18043
  contentWidth,
17993
18044
  defaultTabStop,
17994
18045
  hyphenation: context2.hyphenation
17995
- }).map((line) => ({
18046
+ });
18047
+ const fragmentsByLine = sliceFragmentsToRanges(fragments, composedLines);
18048
+ const lines = composedLines.map((line, index) => ({
17996
18049
  ...line,
17997
18050
  height: line.height || lineHeight,
17998
- fragments: fragments.map(
17999
- (fragment) => sliceFragmentToRange(fragment, line.startOffset, line.endOffset)
18000
- ).filter(
18001
- (fragment) => fragment !== null
18002
- )
18051
+ fragments: fragmentsByLine[index]
18003
18052
  }));
18004
18053
  return {
18005
18054
  paragraphId: paragraph.id,
@@ -18065,21 +18114,22 @@ function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWi
18065
18114
  if (exclusions.length === 0) {
18066
18115
  return preliminary;
18067
18116
  }
18068
- const lines = measurer.composeMeasuredParagraphLines({
18117
+ const composedLines = measurer.composeMeasuredParagraphLines({
18069
18118
  paragraph,
18070
18119
  fragments: preliminary.fragments,
18071
18120
  styles,
18072
18121
  contentWidth,
18073
18122
  defaultTabStop,
18074
18123
  exclusions
18075
- }).map((line) => ({
18124
+ });
18125
+ const fragmentsByLine = sliceFragmentsToRanges(
18126
+ preliminary.fragments,
18127
+ composedLines
18128
+ );
18129
+ const lines = composedLines.map((line, index) => ({
18076
18130
  ...line,
18077
18131
  height: line.height || lineHeight,
18078
- fragments: preliminary.fragments.map(
18079
- (fragment) => sliceFragmentToRange(fragment, line.startOffset, line.endOffset)
18080
- ).filter(
18081
- (fragment) => fragment !== null
18082
- )
18132
+ fragments: fragmentsByLine[index]
18083
18133
  }));
18084
18134
  return {
18085
18135
  paragraphId: paragraph.id,
@@ -18092,11 +18142,15 @@ function projectParagraphLayoutWithExclusions(paragraph, pageSettings, contentWi
18092
18142
  };
18093
18143
  }
18094
18144
  function applyMeasuredLineGeometry(projected, measured) {
18145
+ const fragmentsByLine = sliceFragmentsToRanges(
18146
+ projected.fragments,
18147
+ measured.lines
18148
+ );
18095
18149
  return {
18096
18150
  ...projected,
18097
18151
  startOffset: measured.startOffset ?? projected.startOffset,
18098
18152
  endOffset: measured.endOffset ?? projected.endOffset,
18099
- lines: measured.lines.map((line) => ({
18153
+ lines: measured.lines.map((line, index) => ({
18100
18154
  paragraphId: projected.paragraphId,
18101
18155
  index: line.index,
18102
18156
  startOffset: line.startOffset,
@@ -18112,11 +18166,7 @@ function applyMeasuredLineGeometry(projected, measured) {
18112
18166
  height: slot.height
18113
18167
  })
18114
18168
  ),
18115
- fragments: projected.fragments.map(
18116
- (fragment) => sliceFragmentToRange(fragment, line.startOffset, line.endOffset)
18117
- ).filter(
18118
- (fragment) => fragment !== null
18119
- )
18169
+ fragments: fragmentsByLine[index]
18120
18170
  }))
18121
18171
  };
18122
18172
  }
@@ -47340,21 +47390,21 @@ export {
47340
47390
  normalizeSelection as G,
47341
47391
  positionToParagraphOffset as H,
47342
47392
  paragraphOffsetToPosition as I,
47343
- clampPosition as J,
47344
- findParagraphIndex as K,
47345
- createCollapsedSelection as L,
47346
- isSelectionCollapsed as M,
47347
- parseFontSizePtToPx as N,
47348
- formatFontSizePt as O,
47349
- createEditorParagraph as P,
47350
- resolveDefaultParagraphStyleId as Q,
47351
- findParagraphTableLocation as R,
47393
+ findParagraphIndex as J,
47394
+ createCollapsedSelection as K,
47395
+ isSelectionCollapsed as L,
47396
+ parseFontSizePtToPx as M,
47397
+ formatFontSizePt as N,
47398
+ createEditorParagraph as O,
47399
+ resolveDefaultParagraphStyleId as P,
47400
+ findParagraphTableLocation as Q,
47401
+ buildTableCellLayout as R,
47352
47402
  STANDARD_FONT_SIZES_PT as S,
47353
- buildTableCellLayout as T,
47354
- PT_PER_PX as U,
47355
- createEditorTableCell as V,
47356
- createEditorTableRow as W,
47357
- createEditorTable as X,
47403
+ PT_PER_PX as T,
47404
+ createEditorTableCell as U,
47405
+ createEditorTableRow as V,
47406
+ createEditorTable as W,
47407
+ clampPosition as X,
47358
47408
  PX_PER_POINT as Y,
47359
47409
  underlineStyleToCssDecorationStyle as Z,
47360
47410
  resolveImageSrc as _,
@@ -1,4 +1,4 @@
1
- import { d7, a5, aj, az, at, d8, d9, da, an, db, a6, dc, cS, aA, dd, de, ay, aq, df, dg, dh, a4, di, cQ, aC, dj, dk, dl, dm, dn, d2, dp, dq, dr, aH, aG, ds, ar, dt, du, dv, dw, dx, dy, av, as, dz, aK, aB, aJ, aI, am, ax, d1, dA, d8 as d82, df as df2, di as di2, ds as ds2, dt as dt2, dy as dy2, dB, dC, cU, cP, dD, dE, dF, dG, dH, dI, dJ, cR, dK, dL, dM, cT, dN } from "./index-C_F1o38Z.js";
1
+ import { d7, a5, aj, az, at, d8, d9, da, an, db, a6, dc, cS, aA, dd, de, ay, aq, df, dg, dh, a4, di, cQ, aC, dj, dk, dl, dm, dn, d2, dp, dq, dr, aH, aG, ds, ar, dt, du, dv, dw, dx, dy, av, as, dz, aK, aB, aJ, aI, am, ax, d1, dA, d8 as d82, df as df2, di as di2, ds as ds2, dt as dt2, dy as dy2, dB, dC, cU, cP, dD, dE, dF, dG, dH, dI, dJ, cR, dK, dL, dM, cT, dN } from "./index-PWJQT9bT.js";
2
2
  export {
3
3
  d7 as ActionRow,
4
4
  a5 as BalloonShell,