oasis-editor 0.0.184 → 0.0.186
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OasisEditorApp-5Ov72yrU.js → OasisEditorApp-voAqwV96.js} +144 -34
- package/dist/app/controllers/tableOpsMutationCommands.d.ts +3 -4
- package/dist/app/controllers/useEditorTextInput.d.ts +3 -0
- package/dist/core/commands/text.d.ts +1 -1
- package/dist/core/commands/textDeletion.d.ts +9 -0
- package/dist/core/transactionMergeKeys.d.ts +1 -0
- package/dist/{index-vDrr-EGA.js → index-DazwB_Pd.js} +2 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +2 -2
- package/dist/ui/OasisEditorEditorProps.d.ts +3 -0
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
3
3
|
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, 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, q as createSignal, r as cloneEditorState, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, v as probeLocalFontFamilies, w as createEditorParagraphFromRuns, x as isInlineObjectRun, y as stylesEqual, z as cloneStyle, A as createEditorStyledRun, B as cloneParagraphList, C as cloneParagraph, D as getParagraphLength, G as cloneRun, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as getDocumentSectionsCanonical, bB as exportEditorDocumentToDocxBlob, bC as exportEditorDocumentToDocx, bD as pxToPt$1, bE as resolveFloatingObjectRect, bF as getTextBoxFloatingGeometry, bG as getPresetPathSegments, bH as buildListLabels, bI as assertNever, bJ as lineDashPatternPt, bK as DEFAULT_FONT_SIZE_PX, bL as resolveGradientAxis, bM as isDoubleUnderlineStyle, bN as isWavyUnderlineStyle, bO as underlineStyleLineWidthPx, bP as WAVY_UNDERLINE_WAVELENGTH_PX, bQ as WAVY_UNDERLINE_AMPLITUDE_PX, bR as DOUBLE_UNDERLINE_OFFSET_PX, bS as underlineStyleDashArray, bT as resolveEffectiveParagraphStyle, bU as EMPHASIS_GLYPH, bV as parseHexColorToRgb255, bW as rgb255ToHex, bX as getImageFloatingGeometry, bY as resolveEffectiveTextStyleForParagraph, bZ as textStyleToFontSizePt, b_ as mathDisplayText, b$ as TEXT_BASELINE_RATIO, c0 as resolveTextAlignmentBaselineOffset, c1 as resolveRenderedTextChar, c2 as resolveOpenTypeFeatureTags, c3 as isLowercaseSmallCapsChar, c4 as resolveDecorationLineY, c5 as DOUBLE_STRIKE_OFFSET_PX, c6 as resolveListLabel, c7 as getListLabelInset, c8 as getAlignedListLabelInset, c9 as getParagraphBorderInsets, ca as buildSegmentTable, cb as buildCanvasTableLayout, cc as resolveCanvasTableWidth, cd as resolveFloatingTableRect, ce as paragraphBetweenBorderMatches, cf as normalizeFamily, cg as ROBOTO_FONT_FILES, ch as loadFontAsset, ci as getRemotePdfFontFaces, cj as OFFICE_COMPAT_FONT_FAMILIES, ck as BinaryReader, cl as buildSfnt, cm as defaultFontDecoderRegistry, cn as SfntFontProgram, co as zlibSync, cp as renumberImageCaptionsInDocument, cq as collectPdfFontFamilies, cr as outlineFrom, cs as getPageHeaderZoneTop, ct as getPageColumnRects, cu as findFootnoteReference, cv as resolveImporterForFile, cw as roundTo, cx as getDocumentParagraphsCanonical, cy as getDocumentParagraphs, cz as getImageCaptionText, cA as isImageCaptionParagraph, cB as updateImageCaptionParagraph, cC as createImageCaptionParagraph, cD as renumberImageCaptionParagraphs, cE as getCaptionSelectionOffset, cF as PX_PER_CM, cG as getDocumentPageSettings, cH as getTableCellContentWidthForParagraph, cI as layoutMetricsEpoch, cJ as bumpLayoutMetricsEpoch, cK as createCanvasLayoutSnapshotProvider, cL as on, cM as debounce, cN as unwrap, cO as cloneSection, cP as perfTimer, cQ as prepareDocumentFonts, cR as getRunTextBox, cS as EMU_PER_PX, cT as createEditorDocument, cU as cloneBlock, cV as resolveResizedDimensions, cW as axisSignForDirection, cX as clamp$1, cY as MIN_RESIZE_SIZE_PX, cZ as resolveTextBoxRenderHeight, c_ as getToolbarStyleState, c$ as VERTICAL_HIT_WEIGHT, d0 as getCachedCanvasImage, d1 as measureParagraphMinContentWidthPx, d2 as createSectionBoundaryParagraph, d3 as normalizePageSettings, d4 as DEFAULT_EDITOR_PAGE_SETTINGS, d5 as markStart, d6 as markEnd, d7 as getParagraphEntries, d8 as getParagraphById, d9 as createEditorFootnote, da as createFootnoteReferenceRun, db as renumberFootnotes, dc as iterateFootnoteReferenceRuns, dd as preciseFontModeVersion, de as isPreciseFontModeEnabled, df as getRunFieldChar, dg as getRunFieldInstruction, dh as getHeadingLevel, di as createEditorRun, dj as TWIPS_PER_INCH, dk as PX_PER_INCH, dl as togglePreciseFontMode, dm as nextFontSizePt, dn as previousFontSizePt, dp as fontSizePtToPx, dq as resolveNamedTextStyle, dr as resolveNamedTableStyle, ds as resolveEffectiveTableStyle, dt as createDefaultToolbarPreset, du as MenuRegistry, dv as createToolbarRegistry, dw as Editor, dx as resolveCommandRef, dy as commandRefName, dz as createOasisEditorClient, dA as createEditorZoom, dB as startLongTaskObserver, dC as installGlobalReport, dD as applyStoredPreciseFontPreference, dE as getWelcomeSeen, dF as isLocalFontAccessSupported, dG as EDITOR_SCROLL_PADDING_PX, dH as Toolbar, dI as OasisEditorLoading, dJ as I18nProvider, dK as createTranslator, dL as registerDomStatsSurface, dM as createEditorLogger } from "./index-
|
|
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, q as createSignal, r as cloneEditorState, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, v as probeLocalFontFamilies, w as createEditorParagraphFromRuns, x as isInlineObjectRun, y as stylesEqual, z as cloneStyle, A as createEditorStyledRun, B as cloneParagraphList, C as cloneParagraph, D as getParagraphLength, G as cloneRun, H as getActiveZone, I as getActiveSectionIndex, J as getParagraphs, K as normalizeSelection, L as positionToParagraphOffset, M as cloneParagraphs, N as paragraphOffsetToPosition, O as findParagraphIndex, P as createCollapsedSelection, Q as isSelectionCollapsed, R as MATH_OBJECT_REPLACEMENT, T as setValueStyle, U as setBooleanStyle, V as parseFontSizePtToPx, W as formatFontSizePt, X as setParagraphStyleValue, Y as createEditorParagraph, Z as cloneBlocks, _ as resolveDefaultParagraphStyleId, $ as findParagraphTablePathLocation, a0 as findParagraphLocation, a1 as resolveTablePath, a2 as buildTableCellLayout, a3 as PT_PER_PX, a4 as createEditorTableCell, a5 as createEditorTableRow, a6 as createEditorTable, a7 as clampPosition, a8 as PX_PER_POINT, a9 as underlineStyleToCssDecorationStyle, aa as resolveImageSrc, ab as listKindForTag, ac as isParagraphTag, ad as collectInlineRuns, ae as parseParagraphStyle, af as getRunImage, ag as InlineShell, ah as BalloonShell, ai as DocumentShell, aj as findParagraphTableLocation, ak as createMemo, al as getCaretRectFromSnapshot, am as getParagraphRectFromSnapshot, an as createComponent, ao as CaretOverlay, ap as Show, aq as createRenderEffect, ar as style, as as setStyleProperty, at as setAttribute, au as memo, av as template, aw as Button, ax as useI18n, ay as createEffect, az as TextField, aA as Dialog, aB as insert, aC as className, aD as Grid, aE as SelectField, aF as StatusText, aG as ColorField, aH as UNDERLINE_STYLE_OPTIONS, aI as Stack, aJ as For, aK as ToggleChip, aL as FormField, aM as Checkbox, aN as FieldGroup, aO as Tabs, aP as NumberField, aQ as parseNumber, aR as createStore, aS as reconcile, aT as RadioGroup, aU as Radio$1, aV as TextAreaField, aW as COMMON_SYMBOLS, aX as getRecentSymbols, aY as SYMBOL_CATEGORIES, aZ as rememberSymbol, a_ as delegateEvents, a$ as EMPTY_EDITOR_MATH_EXPRESSION, b0 as serializeLinearMath, b1 as parseLinearMath, b2 as Text, b3 as SurfaceButton, b4 as onMount, b5 as onCleanup, b6 as CheckIcon, b7 as use, b8 as PluginUiHost, b9 as OasisEditorEditor, ba as OasisBrandMark, bb as setPreciseFontPreference, bc as setWelcomeSeen, bd as enablePreciseFontMode, be as WORD_NS$6, bf as XMLSerializer, bg as DOMParser, bh as WORD14_NS, bi as mergeNestedExtensionMarkup, bj as resolveOpcRelationships, bk as parseOpcRelationships, bl as JSZip, bm as normalizeOpcPartPath, bn as OPC_CONTENT_TYPES_PATH, bo as getOpcRelationshipOwnerPath, bp as serializeOpcRelationships, bq as OPC_ROOT_RELATIONSHIPS_PATH, br as hashDocxPartBytes, bs as parseOpcContentTypes, bt as serializeOpcContentTypes, bu as mergeParagraphPropertiesXmlSource, bv as setEditorRunOoxmlSource, bw as mergeRunOoxmlSourceIntoGeneratedXml, bx as mergeTableCellPropertiesXmlSource, by as mergeTableRowPropertiesXmlSource, bz as mergeTablePropertiesXmlSource, bA as getDocumentSectionsCanonical, bB as exportEditorDocumentToDocxBlob, bC as exportEditorDocumentToDocx, bD as pxToPt$1, bE as resolveFloatingObjectRect, bF as getTextBoxFloatingGeometry, bG as getPresetPathSegments, bH as buildListLabels, bI as assertNever, bJ as lineDashPatternPt, bK as DEFAULT_FONT_SIZE_PX, bL as resolveGradientAxis, bM as isDoubleUnderlineStyle, bN as isWavyUnderlineStyle, bO as underlineStyleLineWidthPx, bP as WAVY_UNDERLINE_WAVELENGTH_PX, bQ as WAVY_UNDERLINE_AMPLITUDE_PX, bR as DOUBLE_UNDERLINE_OFFSET_PX, bS as underlineStyleDashArray, bT as resolveEffectiveParagraphStyle, bU as EMPHASIS_GLYPH, bV as parseHexColorToRgb255, bW as rgb255ToHex, bX as getImageFloatingGeometry, bY as resolveEffectiveTextStyleForParagraph, bZ as textStyleToFontSizePt, b_ as mathDisplayText, b$ as TEXT_BASELINE_RATIO, c0 as resolveTextAlignmentBaselineOffset, c1 as resolveRenderedTextChar, c2 as resolveOpenTypeFeatureTags, c3 as isLowercaseSmallCapsChar, c4 as resolveDecorationLineY, c5 as DOUBLE_STRIKE_OFFSET_PX, c6 as resolveListLabel, c7 as getListLabelInset, c8 as getAlignedListLabelInset, c9 as getParagraphBorderInsets, ca as buildSegmentTable, cb as buildCanvasTableLayout, cc as resolveCanvasTableWidth, cd as resolveFloatingTableRect, ce as paragraphBetweenBorderMatches, cf as normalizeFamily, cg as ROBOTO_FONT_FILES, ch as loadFontAsset, ci as getRemotePdfFontFaces, cj as OFFICE_COMPAT_FONT_FAMILIES, ck as BinaryReader, cl as buildSfnt, cm as defaultFontDecoderRegistry, cn as SfntFontProgram, co as zlibSync, cp as renumberImageCaptionsInDocument, cq as collectPdfFontFamilies, cr as outlineFrom, cs as getPageHeaderZoneTop, ct as getPageColumnRects, cu as findFootnoteReference, cv as resolveImporterForFile, cw as roundTo, cx as getDocumentParagraphsCanonical, cy as getDocumentParagraphs, cz as getImageCaptionText, cA as isImageCaptionParagraph, cB as updateImageCaptionParagraph, cC as createImageCaptionParagraph, cD as renumberImageCaptionParagraphs, cE as getCaptionSelectionOffset, cF as PX_PER_CM, cG as getDocumentPageSettings, cH as getTableCellContentWidthForParagraph, cI as layoutMetricsEpoch, cJ as bumpLayoutMetricsEpoch, cK as createCanvasLayoutSnapshotProvider, cL as on, cM as debounce, cN as unwrap, cO as cloneSection, cP as perfTimer, cQ as prepareDocumentFonts, cR as getRunTextBox, cS as EMU_PER_PX, cT as createEditorDocument, cU as cloneBlock, cV as resolveResizedDimensions, cW as axisSignForDirection, cX as clamp$1, cY as MIN_RESIZE_SIZE_PX, cZ as resolveTextBoxRenderHeight, c_ as getToolbarStyleState, c$ as VERTICAL_HIT_WEIGHT, d0 as getCachedCanvasImage, d1 as measureParagraphMinContentWidthPx, d2 as createSectionBoundaryParagraph, d3 as normalizePageSettings, d4 as DEFAULT_EDITOR_PAGE_SETTINGS, d5 as markStart, d6 as markEnd, d7 as getParagraphEntries, d8 as getParagraphById, d9 as createEditorFootnote, da as createFootnoteReferenceRun, db as renumberFootnotes, dc as iterateFootnoteReferenceRuns, dd as preciseFontModeVersion, de as isPreciseFontModeEnabled, df as getRunFieldChar, dg as getRunFieldInstruction, dh as getHeadingLevel, di as createEditorRun, dj as TWIPS_PER_INCH, dk as PX_PER_INCH, dl as togglePreciseFontMode, dm as nextFontSizePt, dn as previousFontSizePt, dp as fontSizePtToPx, dq as resolveNamedTextStyle, dr as resolveNamedTableStyle, ds as resolveEffectiveTableStyle, dt as createDefaultToolbarPreset, du as MenuRegistry, dv as createToolbarRegistry, dw as Editor, dx as resolveCommandRef, dy as commandRefName, dz as createOasisEditorClient, dA as createEditorZoom, dB as startLongTaskObserver, dC as installGlobalReport, dD as applyStoredPreciseFontPreference, dE as getWelcomeSeen, dF as isLocalFontAccessSupported, dG as EDITOR_SCROLL_PADDING_PX, dH as Toolbar, dI as OasisEditorLoading, dJ as I18nProvider, dK as createTranslator, dL as registerDomStatsSurface, dM as createEditorLogger } from "./index-DazwB_Pd.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -27165,6 +27165,7 @@ function createEditorFontOptionsImpl(ctx) {
|
|
|
27165
27165
|
}
|
|
27166
27166
|
const MERGE_KEYS = {
|
|
27167
27167
|
insertText: "insertText",
|
|
27168
|
+
composition: "composition",
|
|
27168
27169
|
insertImage: "insertImage",
|
|
27169
27170
|
insertTable: "insertTable",
|
|
27170
27171
|
moveImage: "moveImage",
|
|
@@ -28086,6 +28087,33 @@ function insertPlainTextAtSelection(state, text, styleOverride) {
|
|
|
28086
28087
|
)
|
|
28087
28088
|
);
|
|
28088
28089
|
}
|
|
28090
|
+
function deleteCharsBackwardRaw(state, count) {
|
|
28091
|
+
if (count <= 0) {
|
|
28092
|
+
return state;
|
|
28093
|
+
}
|
|
28094
|
+
const { paragraph, index, offset } = getFocusParagraph(state);
|
|
28095
|
+
if (offset < count) {
|
|
28096
|
+
return state;
|
|
28097
|
+
}
|
|
28098
|
+
const paragraphs = getParagraphs(state);
|
|
28099
|
+
const start = offset - count;
|
|
28100
|
+
const nextParagraph = buildParagraphFromRuns(
|
|
28101
|
+
paragraph,
|
|
28102
|
+
[
|
|
28103
|
+
...sliceRuns(paragraph, 0, start),
|
|
28104
|
+
...sliceRuns(paragraph, offset, getParagraphLength(paragraph))
|
|
28105
|
+
],
|
|
28106
|
+
getStyleAtOffset(paragraph, start)
|
|
28107
|
+
);
|
|
28108
|
+
const nextParagraphs = paragraphs.map(
|
|
28109
|
+
(candidate, candidateIndex) => candidateIndex === index ? nextParagraph : candidate
|
|
28110
|
+
);
|
|
28111
|
+
return cloneStateWithParagraphs(
|
|
28112
|
+
state,
|
|
28113
|
+
nextParagraphs,
|
|
28114
|
+
withSelection(paragraphOffsetToPosition(nextParagraph, start))
|
|
28115
|
+
);
|
|
28116
|
+
}
|
|
28089
28117
|
function deleteBackward(state) {
|
|
28090
28118
|
var _a;
|
|
28091
28119
|
if (!isSelectionCollapsed(state.selection)) {
|
|
@@ -36486,6 +36514,7 @@ function buildEditorViewProps(ctx) {
|
|
|
36486
36514
|
onInputFocus: () => input.setFocused(true),
|
|
36487
36515
|
onCompositionEnd: input.textInput.handleCompositionEnd,
|
|
36488
36516
|
onCompositionStart: input.textInput.handleCompositionStart,
|
|
36517
|
+
onCompositionUpdate: input.textInput.handleCompositionUpdate,
|
|
36489
36518
|
onCopy: input.handleCopy,
|
|
36490
36519
|
onCut: input.handleCut,
|
|
36491
36520
|
onInput: input.textInput.handleTextInput,
|
|
@@ -48144,14 +48173,29 @@ function normalizeInnermostLocation$1(location) {
|
|
|
48144
48173
|
cellIndex: innermost.cellIndex
|
|
48145
48174
|
} : location;
|
|
48146
48175
|
}
|
|
48147
|
-
function
|
|
48148
|
-
const
|
|
48149
|
-
|
|
48150
|
-
|
|
48151
|
-
|
|
48152
|
-
|
|
48153
|
-
|
|
48154
|
-
|
|
48176
|
+
function cloneTablePath(blocks, tablePath) {
|
|
48177
|
+
const rootBlocks = [...blocks];
|
|
48178
|
+
let currentBlocks = rootBlocks;
|
|
48179
|
+
for (let i = 0; i < tablePath.length; i += 1) {
|
|
48180
|
+
const segment = tablePath[i];
|
|
48181
|
+
if (!segment) break;
|
|
48182
|
+
const table = currentBlocks[segment.tableBlockIndex];
|
|
48183
|
+
if (!table || table.type !== "table") break;
|
|
48184
|
+
const clonedTable = { ...table, rows: [...table.rows] };
|
|
48185
|
+
currentBlocks[segment.tableBlockIndex] = clonedTable;
|
|
48186
|
+
const row = clonedTable.rows[segment.rowIndex];
|
|
48187
|
+
if (!row) break;
|
|
48188
|
+
const clonedRow = { ...row, cells: [...row.cells] };
|
|
48189
|
+
clonedTable.rows[segment.rowIndex] = clonedRow;
|
|
48190
|
+
const cell = clonedRow.cells[segment.cellIndex];
|
|
48191
|
+
if (!cell) break;
|
|
48192
|
+
const clonedCell = { ...cell, blocks: [...cell.blocks] };
|
|
48193
|
+
clonedRow.cells[segment.cellIndex] = clonedCell;
|
|
48194
|
+
currentBlocks = clonedCell.blocks;
|
|
48195
|
+
}
|
|
48196
|
+
return rootBlocks;
|
|
48197
|
+
}
|
|
48198
|
+
function resolveClonedTablePath(targetBlocks, location) {
|
|
48155
48199
|
const resolvedPath = resolveTablePath(targetBlocks, location.tablePath);
|
|
48156
48200
|
const resolvedTarget = resolvedPath == null ? void 0 : resolvedPath[resolvedPath.length - 1];
|
|
48157
48201
|
if (!resolvedTarget) return null;
|
|
@@ -48162,6 +48206,27 @@ function resolveTablePathMutation(current, getTargetBlocks, location) {
|
|
|
48162
48206
|
targetBlocks
|
|
48163
48207
|
};
|
|
48164
48208
|
}
|
|
48209
|
+
function resolveTableParagraphEditMutation(current, getTargetBlocks, location) {
|
|
48210
|
+
const rootSegment = location.tablePath[0];
|
|
48211
|
+
if (!rootSegment) return null;
|
|
48212
|
+
const sourceBlocks = getTargetBlocks(current, location.zone);
|
|
48213
|
+
const sourceRoot = sourceBlocks[rootSegment.tableBlockIndex];
|
|
48214
|
+
if (!sourceRoot || sourceRoot.type !== "table") return null;
|
|
48215
|
+
return resolveClonedTablePath(
|
|
48216
|
+
cloneTablePath(sourceBlocks, location.tablePath),
|
|
48217
|
+
location
|
|
48218
|
+
);
|
|
48219
|
+
}
|
|
48220
|
+
function resolveTablePathMutation(current, getTargetBlocks, location) {
|
|
48221
|
+
const rootSegment = location.tablePath[0];
|
|
48222
|
+
if (!rootSegment) return null;
|
|
48223
|
+
const sourceBlocks = getTargetBlocks(current, location.zone);
|
|
48224
|
+
const sourceRoot = sourceBlocks[rootSegment.tableBlockIndex];
|
|
48225
|
+
if (!sourceRoot || sourceRoot.type !== "table") return null;
|
|
48226
|
+
const targetBlocks = [...sourceBlocks];
|
|
48227
|
+
targetBlocks[rootSegment.tableBlockIndex] = cloneBlock(sourceRoot);
|
|
48228
|
+
return resolveClonedTablePath(targetBlocks, location);
|
|
48229
|
+
}
|
|
48165
48230
|
const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
|
|
48166
48231
|
var _a;
|
|
48167
48232
|
const location = findParagraphTablePathLocation(
|
|
@@ -48172,12 +48237,18 @@ const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
|
|
|
48172
48237
|
if (!location || current.selection.anchor.paragraphId !== current.selection.focus.paragraphId) {
|
|
48173
48238
|
return edit(current);
|
|
48174
48239
|
}
|
|
48175
|
-
const mutation =
|
|
48240
|
+
const mutation = resolveTableParagraphEditMutation(
|
|
48241
|
+
current,
|
|
48242
|
+
getTargetBlocks,
|
|
48243
|
+
location
|
|
48244
|
+
);
|
|
48176
48245
|
if (!mutation) return edit(current);
|
|
48177
48246
|
const tempState = {
|
|
48178
48247
|
...current,
|
|
48179
48248
|
document: createEditorDocument(
|
|
48180
|
-
mutation.targetCell.blocks
|
|
48249
|
+
mutation.targetCell.blocks.map(
|
|
48250
|
+
(block) => block.type === "paragraph" ? cloneParagraph(block) : block
|
|
48251
|
+
),
|
|
48181
48252
|
void 0,
|
|
48182
48253
|
void 0,
|
|
48183
48254
|
void 0,
|
|
@@ -52795,7 +52866,43 @@ function createEditorTextInput(deps) {
|
|
|
52795
52866
|
}
|
|
52796
52867
|
function createEditorTextInputImpl(deps) {
|
|
52797
52868
|
const [composing, setComposing] = createSignal(false);
|
|
52798
|
-
let
|
|
52869
|
+
let previewLength = 0;
|
|
52870
|
+
let previewText = "";
|
|
52871
|
+
let compositionStyle;
|
|
52872
|
+
let justCommitted = null;
|
|
52873
|
+
const resetComposition = () => {
|
|
52874
|
+
previewLength = 0;
|
|
52875
|
+
previewText = "";
|
|
52876
|
+
compositionStyle = void 0;
|
|
52877
|
+
};
|
|
52878
|
+
const applyCompositionText = (text, isFinal) => {
|
|
52879
|
+
if (!isFinal && text === previewText) {
|
|
52880
|
+
return;
|
|
52881
|
+
}
|
|
52882
|
+
if (previewLength === 0 && text.length === 0) {
|
|
52883
|
+
if (isFinal) {
|
|
52884
|
+
resetComposition();
|
|
52885
|
+
}
|
|
52886
|
+
return;
|
|
52887
|
+
}
|
|
52888
|
+
const retracted = previewLength;
|
|
52889
|
+
const pendingStyle = cloneStyle(compositionStyle);
|
|
52890
|
+
deps.clearPreferredColumn();
|
|
52891
|
+
deps.applyTransactionalState(
|
|
52892
|
+
(current) => deps.applyTableAwareParagraphEdit(current, (temp) => {
|
|
52893
|
+
const cleared = deleteCharsBackwardRaw(temp, retracted);
|
|
52894
|
+
return text.length > 0 ? insertTextAtSelection(cleared, text, pendingStyle) : cleared;
|
|
52895
|
+
}),
|
|
52896
|
+
{ mergeKey: MERGE_KEYS.composition }
|
|
52897
|
+
);
|
|
52898
|
+
if (isFinal) {
|
|
52899
|
+
resetComposition();
|
|
52900
|
+
justCommitted = text.length > 0 ? text : null;
|
|
52901
|
+
} else {
|
|
52902
|
+
previewLength = text.length;
|
|
52903
|
+
previewText = text;
|
|
52904
|
+
}
|
|
52905
|
+
};
|
|
52799
52906
|
const handleTextInput = (event) => {
|
|
52800
52907
|
var _a, _b, _c, _d;
|
|
52801
52908
|
markStart("input:text");
|
|
@@ -52804,6 +52911,7 @@ function createEditorTextInputImpl(deps) {
|
|
|
52804
52911
|
`input:readonly ignored value=${JSON.stringify(event.currentTarget.value)}`
|
|
52805
52912
|
);
|
|
52806
52913
|
event.currentTarget.value = "";
|
|
52914
|
+
resetComposition();
|
|
52807
52915
|
return;
|
|
52808
52916
|
}
|
|
52809
52917
|
const text = event.currentTarget.value;
|
|
@@ -52812,13 +52920,17 @@ function createEditorTextInputImpl(deps) {
|
|
|
52812
52920
|
}
|
|
52813
52921
|
if (composing()) {
|
|
52814
52922
|
deps.logger.debug(`input:composing buffer=${JSON.stringify(text)}`);
|
|
52923
|
+
applyCompositionText(text, false);
|
|
52815
52924
|
return;
|
|
52816
52925
|
}
|
|
52817
|
-
if (
|
|
52818
|
-
|
|
52819
|
-
|
|
52820
|
-
|
|
52821
|
-
|
|
52926
|
+
if (justCommitted !== null) {
|
|
52927
|
+
const wasCommitted = text === justCommitted;
|
|
52928
|
+
justCommitted = null;
|
|
52929
|
+
if (wasCommitted) {
|
|
52930
|
+
deps.logger.debug(`input:suppressed text=${JSON.stringify(text)}`);
|
|
52931
|
+
event.currentTarget.value = "";
|
|
52932
|
+
return;
|
|
52933
|
+
}
|
|
52822
52934
|
}
|
|
52823
52935
|
const state = deps.state();
|
|
52824
52936
|
const sel = state.selection;
|
|
@@ -52848,43 +52960,38 @@ function createEditorTextInputImpl(deps) {
|
|
|
52848
52960
|
};
|
|
52849
52961
|
const handleCompositionStart = () => {
|
|
52850
52962
|
deps.logger.debug("input:composition start");
|
|
52963
|
+
resetComposition();
|
|
52964
|
+
justCommitted = null;
|
|
52965
|
+
compositionStyle = cloneStyle(deps.pendingCaretTextStyle());
|
|
52851
52966
|
setComposing(true);
|
|
52852
52967
|
};
|
|
52853
|
-
const
|
|
52968
|
+
const handleCompositionUpdate = (event) => {
|
|
52854
52969
|
if (deps.isReadOnly()) {
|
|
52855
|
-
event.currentTarget.value = "";
|
|
52856
|
-
setComposing(false);
|
|
52857
52970
|
return;
|
|
52858
52971
|
}
|
|
52859
|
-
|
|
52972
|
+
applyCompositionText(event.data ?? "", false);
|
|
52973
|
+
};
|
|
52974
|
+
const handleCompositionEnd = (event) => {
|
|
52860
52975
|
setComposing(false);
|
|
52861
|
-
if (
|
|
52976
|
+
if (deps.isReadOnly()) {
|
|
52862
52977
|
event.currentTarget.value = "";
|
|
52978
|
+
resetComposition();
|
|
52863
52979
|
return;
|
|
52864
52980
|
}
|
|
52981
|
+
const text = event.data ?? event.currentTarget.value;
|
|
52865
52982
|
const state = deps.state();
|
|
52866
52983
|
const sel = state.selection;
|
|
52867
52984
|
deps.logger.info(
|
|
52868
52985
|
`input:composition end ${JSON.stringify(text)} (len=${text.length}) at ${sel.anchor.paragraphId}:${sel.anchor.runId}[${sel.anchor.offset}]`
|
|
52869
52986
|
);
|
|
52870
|
-
|
|
52871
|
-
deps.clearPreferredColumn();
|
|
52872
|
-
const pendingStyle = cloneStyle(deps.pendingCaretTextStyle());
|
|
52873
|
-
deps.applyTransactionalState(
|
|
52874
|
-
(current) => deps.applyTableAwareParagraphEdit(
|
|
52875
|
-
current,
|
|
52876
|
-
(temp) => insertTextAtSelection(temp, text, pendingStyle)
|
|
52877
|
-
),
|
|
52878
|
-
{
|
|
52879
|
-
mergeKey: MERGE_KEYS.insertText
|
|
52880
|
-
}
|
|
52881
|
-
);
|
|
52987
|
+
applyCompositionText(text, true);
|
|
52882
52988
|
event.currentTarget.value = "";
|
|
52883
52989
|
deps.focusInput();
|
|
52884
52990
|
};
|
|
52885
52991
|
return {
|
|
52886
52992
|
handleTextInput,
|
|
52887
52993
|
handleCompositionStart,
|
|
52994
|
+
handleCompositionUpdate,
|
|
52888
52995
|
handleCompositionEnd,
|
|
52889
52996
|
composing
|
|
52890
52997
|
};
|
|
@@ -55141,6 +55248,9 @@ function createEditorKeyboardControllerImpl(deps) {
|
|
|
55141
55248
|
}
|
|
55142
55249
|
return;
|
|
55143
55250
|
}
|
|
55251
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
55252
|
+
return;
|
|
55253
|
+
}
|
|
55144
55254
|
const commandExecutor = deps.executeCommand ? {
|
|
55145
55255
|
executeCommand: (commandName, payload) => {
|
|
55146
55256
|
var _a;
|
|
@@ -10,10 +10,9 @@ export interface TableLocationMutation {
|
|
|
10
10
|
targetBlocks: EditorBlockNode[];
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* blocks retain structural sharing.
|
|
13
|
+
* Resolves a mutation-safe clone for structural table commands. These commands
|
|
14
|
+
* may update rows or cells outside the selected path, so the owning table must
|
|
15
|
+
* remain deeply cloned rather than sharing mutable descendants with history.
|
|
17
16
|
*/
|
|
18
17
|
export declare function resolveTablePathMutation(current: EditorState, getTargetBlocks: (state: EditorState, zone: EditorEditingZone) => EditorBlockNode[], location: TablePathLocation): TableLocationMutation | null;
|
|
19
18
|
export declare const applyTableAwareParagraphEdit: (current: EditorState, getTargetBlocks: (state: EditorState, zone: EditorEditingZone) => EditorBlockNode[], edit: (tempState: EditorState) => EditorState) => EditorState;
|
|
@@ -22,6 +22,9 @@ declare function createEditorTextInputImpl(deps: UseEditorTextInputProps): {
|
|
|
22
22
|
currentTarget: HTMLTextAreaElement;
|
|
23
23
|
}) => void;
|
|
24
24
|
handleCompositionStart: () => void;
|
|
25
|
+
handleCompositionUpdate: (event: CompositionEvent & {
|
|
26
|
+
currentTarget: HTMLTextAreaElement;
|
|
27
|
+
}) => void;
|
|
25
28
|
handleCompositionEnd: (event: CompositionEvent & {
|
|
26
29
|
currentTarget: HTMLTextAreaElement;
|
|
27
30
|
}) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { moveOrCopySelectionToPosition, insertTextAtSelection, insertPlainTextAtSelection, insertMathAtSelection, updateMathRun, } from './textEditing.js';
|
|
2
|
-
export { deleteBackward, deleteForward } from './textDeletion.js';
|
|
2
|
+
export { deleteBackward, deleteForward, deleteCharsBackwardRaw, } from './textDeletion.js';
|
|
3
3
|
export { toggleTextStyle, clearSelectedTextFormatting, setTextStyleValue, } from './textFormatting.js';
|
|
4
4
|
export { type TextCaseMode, transformSelectedText, changeSelectedTextCase, } from './textCase.js';
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { EditorState } from '../model.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Removes `count` UTF-16 code units immediately before the caret, inside the
|
|
5
|
+
* focused paragraph only.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `deleteBackward` this never marks revisions when track changes is on
|
|
8
|
+
* and never merges paragraphs: it exists to retract IME composition previews,
|
|
9
|
+
* which are provisional text the user has not committed yet.
|
|
10
|
+
*/
|
|
11
|
+
export declare function deleteCharsBackwardRaw(state: EditorState, count: number): EditorState;
|
|
3
12
|
export declare function deleteBackward(state: EditorState): EditorState;
|
|
4
13
|
export declare function deleteForward(state: EditorState): EditorState;
|
|
@@ -2863,7 +2863,7 @@ function OasisEditorAppLazy(props = {}) {
|
|
|
2863
2863
|
onCleanup(() => {
|
|
2864
2864
|
cancelled = true;
|
|
2865
2865
|
});
|
|
2866
|
-
import("./OasisEditorApp-
|
|
2866
|
+
import("./OasisEditorApp-voAqwV96.js").then((m) => {
|
|
2867
2867
|
cancelled = true;
|
|
2868
2868
|
setProgress(1);
|
|
2869
2869
|
setTimeout(() => setApp(() => m.OasisEditorApp), 180);
|
|
@@ -49465,6 +49465,7 @@ function OasisEditorEditor(props) {
|
|
|
49465
49465
|
addEventListener(_el$5, "focus", inputHandlers().onInputFocus);
|
|
49466
49466
|
addEventListener(_el$5, "cut", inputHandlers().onCut);
|
|
49467
49467
|
addEventListener(_el$5, "copy", inputHandlers().onCopy);
|
|
49468
|
+
addEventListener(_el$5, "compositionupdate", inputHandlers().onCompositionUpdate);
|
|
49468
49469
|
addEventListener(_el$5, "compositionstart", inputHandlers().onCompositionStart);
|
|
49469
49470
|
addEventListener(_el$5, "compositionend", inputHandlers().onCompositionEnd);
|
|
49470
49471
|
addEventListener(_el$5, "blur", inputHandlers().onInputBlur);
|
package/dist/oasis-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-
|
|
1
|
+
import { dN, ah, aw, aM, aG, dO, dP, dQ, aA, dR, ai, dS, dw, aN, dT, dU, aL, aD, dV, dW, dX, ag, dY, du, aP, dZ, d_, d$, e0, e1, dI, e2, e3, e4, aU, aT, e5, aE, e6, e7, e8, e9, ea, eb, aI, aF, ec, b3, aO, b2, aV, az, aK, dH, ed, dO as dO2, dV as dV2, dY as dY2, e5 as e52, e6 as e62, eb as eb2, ee, ef, dy, dt, eg, eh, ei, ej, ek, el, em, dv, en, eo, ep, eq, er, dx, es, et } from "./index-DazwB_Pd.js";
|
|
2
2
|
export {
|
|
3
3
|
dN as ActionRow,
|
|
4
4
|
ah as BalloonShell,
|