oasis-editor 0.0.185 → 0.0.187
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-WP25r3Sz.js → OasisEditorApp-c25tbt9o.js} +423 -159
- package/dist/app/controllers/createCropSession.d.ts +2 -2
- package/dist/app/controllers/createResizeSession.d.ts +1 -1
- package/dist/app/controllers/createRotateSession.d.ts +1 -1
- package/dist/app/controllers/pointerGesture.d.ts +17 -0
- package/dist/app/controllers/tableResize/tableResizeTypes.d.ts +2 -2
- package/dist/app/controllers/useEditorImageOperations.d.ts +6 -6
- package/dist/app/controllers/useEditorSurfaceEvents.d.ts +7 -5
- package/dist/app/controllers/useEditorTableCornerResize.d.ts +1 -1
- package/dist/app/controllers/useEditorTableDrag.d.ts +2 -2
- package/dist/app/controllers/useEditorTextBoxOperations.d.ts +2 -2
- package/dist/app/controllers/useEditorTextDrag.d.ts +1 -1
- 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-CdeBKnqS.js → index-sfDgngZ-.js} +99 -65
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +2 -2
- package/dist/ui/OasisEditorEditorProps.d.ts +16 -13
- package/dist/ui/app/buildEditorViewProps.d.ts +8 -8
- package/dist/ui/app/createEditorInteractionRuntime.d.ts +18 -13
- package/dist/ui/app/useEditorFocus.d.ts +1 -0
- package/dist/ui/app/useEditorInteractionWiring.d.ts +1 -0
- package/dist/ui/editorUiTypes.d.ts +8 -8
- package/dist/ui/overlays/ResizeHandlesOverlay.d.ts +3 -3
- package/dist/ui/overlays/TableHandlesOverlay.d.ts +2 -2
- package/package.json +2 -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-sfDgngZ-.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -26817,11 +26817,20 @@ function createEditorFocusController() {
|
|
|
26817
26817
|
});
|
|
26818
26818
|
});
|
|
26819
26819
|
};
|
|
26820
|
+
const focusInputSync = () => {
|
|
26821
|
+
setFocused(true);
|
|
26822
|
+
textareaRef == null ? void 0 : textareaRef.focus({ preventScroll: true });
|
|
26823
|
+
if (textareaRef) {
|
|
26824
|
+
textareaRef.selectionStart = textareaRef.value.length;
|
|
26825
|
+
textareaRef.selectionEnd = textareaRef.value.length;
|
|
26826
|
+
}
|
|
26827
|
+
};
|
|
26820
26828
|
return {
|
|
26821
26829
|
focused,
|
|
26822
26830
|
setFocused,
|
|
26823
26831
|
focusInput,
|
|
26824
26832
|
focusInputAfterPointerSelection,
|
|
26833
|
+
focusInputSync,
|
|
26825
26834
|
get viewportRef() {
|
|
26826
26835
|
return viewportRef;
|
|
26827
26836
|
},
|
|
@@ -27165,6 +27174,7 @@ function createEditorFontOptionsImpl(ctx) {
|
|
|
27165
27174
|
}
|
|
27166
27175
|
const MERGE_KEYS = {
|
|
27167
27176
|
insertText: "insertText",
|
|
27177
|
+
composition: "composition",
|
|
27168
27178
|
insertImage: "insertImage",
|
|
27169
27179
|
insertTable: "insertTable",
|
|
27170
27180
|
moveImage: "moveImage",
|
|
@@ -28086,6 +28096,33 @@ function insertPlainTextAtSelection(state, text, styleOverride) {
|
|
|
28086
28096
|
)
|
|
28087
28097
|
);
|
|
28088
28098
|
}
|
|
28099
|
+
function deleteCharsBackwardRaw(state, count) {
|
|
28100
|
+
if (count <= 0) {
|
|
28101
|
+
return state;
|
|
28102
|
+
}
|
|
28103
|
+
const { paragraph, index, offset } = getFocusParagraph(state);
|
|
28104
|
+
if (offset < count) {
|
|
28105
|
+
return state;
|
|
28106
|
+
}
|
|
28107
|
+
const paragraphs = getParagraphs(state);
|
|
28108
|
+
const start = offset - count;
|
|
28109
|
+
const nextParagraph = buildParagraphFromRuns(
|
|
28110
|
+
paragraph,
|
|
28111
|
+
[
|
|
28112
|
+
...sliceRuns(paragraph, 0, start),
|
|
28113
|
+
...sliceRuns(paragraph, offset, getParagraphLength(paragraph))
|
|
28114
|
+
],
|
|
28115
|
+
getStyleAtOffset(paragraph, start)
|
|
28116
|
+
);
|
|
28117
|
+
const nextParagraphs = paragraphs.map(
|
|
28118
|
+
(candidate, candidateIndex) => candidateIndex === index ? nextParagraph : candidate
|
|
28119
|
+
);
|
|
28120
|
+
return cloneStateWithParagraphs(
|
|
28121
|
+
state,
|
|
28122
|
+
nextParagraphs,
|
|
28123
|
+
withSelection(paragraphOffsetToPosition(nextParagraph, start))
|
|
28124
|
+
);
|
|
28125
|
+
}
|
|
28089
28126
|
function deleteBackward(state) {
|
|
28090
28127
|
var _a;
|
|
28091
28128
|
if (!isSelectionCollapsed(state.selection)) {
|
|
@@ -36462,21 +36499,21 @@ function buildEditorViewProps(ctx) {
|
|
|
36462
36499
|
const surfaceHandlers = {
|
|
36463
36500
|
onDragOver: (event) => event.preventDefault(),
|
|
36464
36501
|
onDrop: surface.handleDrop,
|
|
36465
|
-
|
|
36466
|
-
|
|
36502
|
+
onEditorPointerDown: surface.onEditorPointerDown,
|
|
36503
|
+
onSurfacePointerDown: surface.surfaceEvents.handleSurfacePointerDown,
|
|
36467
36504
|
onSurfaceClick: surface.surfaceEvents.handleSurfaceClick,
|
|
36468
|
-
|
|
36505
|
+
onSurfacePointerMove: surface.tableResize.handlePointerMove,
|
|
36469
36506
|
onSurfaceDblClick: surface.surfaceEvents.handleSurfaceDblClick,
|
|
36470
|
-
|
|
36471
|
-
|
|
36472
|
-
|
|
36473
|
-
|
|
36474
|
-
|
|
36475
|
-
|
|
36476
|
-
|
|
36477
|
-
|
|
36478
|
-
|
|
36479
|
-
|
|
36507
|
+
onParagraphPointerDown: surface.surfaceEvents.handleParagraphPointerDown,
|
|
36508
|
+
onImagePointerDown: surface.handleImagePointerDown,
|
|
36509
|
+
onImageResizeHandlePointerDown: surface.handleImageResizeHandlePointerDown,
|
|
36510
|
+
onTextBoxResizeHandlePointerDown: surface.handleTextBoxResizeHandlePointerDown,
|
|
36511
|
+
onImageRotateHandlePointerDown: surface.handleImageRotateHandlePointerDown,
|
|
36512
|
+
onImageCropHandlePointerDown: surface.handleImageCropHandlePointerDown,
|
|
36513
|
+
onImageCropBodyPointerDown: surface.handleImageCropBodyPointerDown,
|
|
36514
|
+
onTextBoxRotateHandlePointerDown: surface.handleTextBoxRotateHandlePointerDown,
|
|
36515
|
+
onTableDragHandlePointerDown: surface.tableDrag.handlePointerDown,
|
|
36516
|
+
onTableCornerResizeHandlePointerDown: surface.tableCornerResize.handlePointerDown,
|
|
36480
36517
|
onRevisionMouseEnter: surface.revisionController.handleRevisionMouseEnter,
|
|
36481
36518
|
onRevisionMouseLeave: surface.revisionController.handleRevisionMouseLeave,
|
|
36482
36519
|
onEditorContextMenu: (event) => surface.handleEditorContextMenu(event)
|
|
@@ -36486,6 +36523,7 @@ function buildEditorViewProps(ctx) {
|
|
|
36486
36523
|
onInputFocus: () => input.setFocused(true),
|
|
36487
36524
|
onCompositionEnd: input.textInput.handleCompositionEnd,
|
|
36488
36525
|
onCompositionStart: input.textInput.handleCompositionStart,
|
|
36526
|
+
onCompositionUpdate: input.textInput.handleCompositionUpdate,
|
|
36489
36527
|
onCopy: input.handleCopy,
|
|
36490
36528
|
onCut: input.handleCut,
|
|
36491
36529
|
onInput: input.textInput.handleTextInput,
|
|
@@ -40522,7 +40560,7 @@ function parsePrefixMappings(value) {
|
|
|
40522
40560
|
return result;
|
|
40523
40561
|
}
|
|
40524
40562
|
function parseStep(step) {
|
|
40525
|
-
const match = /^(([
|
|
40563
|
+
const match = /^(([^:[]+):)?([^[]+?)(?:\[(\d+)\])?$/.exec(step);
|
|
40526
40564
|
if (!match) return null;
|
|
40527
40565
|
const index = match[4] ? Number.parseInt(match[4], 10) : 1;
|
|
40528
40566
|
if (!Number.isFinite(index) || index < 1) return null;
|
|
@@ -49495,6 +49533,20 @@ function createEditorTableOperationsImpl(deps) {
|
|
|
49495
49533
|
insertTableCommand
|
|
49496
49534
|
};
|
|
49497
49535
|
}
|
|
49536
|
+
function createPointerGesture() {
|
|
49537
|
+
let pointerId = null;
|
|
49538
|
+
return {
|
|
49539
|
+
claim: (event) => {
|
|
49540
|
+
pointerId = event.pointerId ?? null;
|
|
49541
|
+
},
|
|
49542
|
+
// An unclaimed gesture owns everything: sessions driven by synthetic events
|
|
49543
|
+
// that carry no pointerId must keep working.
|
|
49544
|
+
owns: (event) => pointerId === null || event.pointerId === pointerId,
|
|
49545
|
+
release: () => {
|
|
49546
|
+
pointerId = null;
|
|
49547
|
+
}
|
|
49548
|
+
};
|
|
49549
|
+
}
|
|
49498
49550
|
function createResizeSession(adapter, deps) {
|
|
49499
49551
|
let active = null;
|
|
49500
49552
|
const selectionForObject = (state, paragraphId, paragraphOffset) => {
|
|
@@ -49516,8 +49568,10 @@ function createResizeSession(adapter, deps) {
|
|
|
49516
49568
|
focus: { ...selection.focus }
|
|
49517
49569
|
}
|
|
49518
49570
|
});
|
|
49571
|
+
const gesture = createPointerGesture();
|
|
49519
49572
|
const handleMouseMove = (event) => {
|
|
49520
49573
|
var _a;
|
|
49574
|
+
if (!gesture.owns(event)) return;
|
|
49521
49575
|
const resize = active;
|
|
49522
49576
|
if (!resize) {
|
|
49523
49577
|
return;
|
|
@@ -49568,8 +49622,10 @@ function createResizeSession(adapter, deps) {
|
|
|
49568
49622
|
};
|
|
49569
49623
|
const stop = () => {
|
|
49570
49624
|
active = null;
|
|
49571
|
-
|
|
49572
|
-
window.removeEventListener("
|
|
49625
|
+
gesture.release();
|
|
49626
|
+
window.removeEventListener("pointermove", handleMouseMove);
|
|
49627
|
+
window.removeEventListener("pointerup", handleMouseUp);
|
|
49628
|
+
window.removeEventListener("pointercancel", handleMouseUp);
|
|
49573
49629
|
};
|
|
49574
49630
|
const start = (paragraphId, paragraphOffset, handleDirection, event, initialState) => {
|
|
49575
49631
|
const selection = selectionForObject(
|
|
@@ -49597,8 +49653,10 @@ function createResizeSession(adapter, deps) {
|
|
|
49597
49653
|
aspectRatio: selected.width / selected.height,
|
|
49598
49654
|
initialState: deps.cloneState(initialState)
|
|
49599
49655
|
};
|
|
49600
|
-
|
|
49601
|
-
window.addEventListener("
|
|
49656
|
+
gesture.claim(event);
|
|
49657
|
+
window.addEventListener("pointermove", handleMouseMove);
|
|
49658
|
+
window.addEventListener("pointerup", handleMouseUp);
|
|
49659
|
+
window.addEventListener("pointercancel", handleMouseUp);
|
|
49602
49660
|
};
|
|
49603
49661
|
return { start, stop };
|
|
49604
49662
|
}
|
|
@@ -49624,7 +49682,9 @@ function createRotateSession(adapter, deps) {
|
|
|
49624
49682
|
focus: { ...selection.focus }
|
|
49625
49683
|
}
|
|
49626
49684
|
});
|
|
49685
|
+
const gesture = createPointerGesture();
|
|
49627
49686
|
const handleMouseMove = (event) => {
|
|
49687
|
+
if (!gesture.owns(event)) return;
|
|
49628
49688
|
const rotate = active;
|
|
49629
49689
|
if (!rotate) {
|
|
49630
49690
|
return;
|
|
@@ -49667,8 +49727,10 @@ function createRotateSession(adapter, deps) {
|
|
|
49667
49727
|
};
|
|
49668
49728
|
const stop = () => {
|
|
49669
49729
|
active = null;
|
|
49670
|
-
|
|
49671
|
-
window.removeEventListener("
|
|
49730
|
+
gesture.release();
|
|
49731
|
+
window.removeEventListener("pointermove", handleMouseMove);
|
|
49732
|
+
window.removeEventListener("pointerup", handleMouseUp);
|
|
49733
|
+
window.removeEventListener("pointercancel", handleMouseUp);
|
|
49672
49734
|
};
|
|
49673
49735
|
const start = (paragraphId, paragraphOffset, event, initialState) => {
|
|
49674
49736
|
const overlay = event.currentTarget.closest(
|
|
@@ -49685,8 +49747,10 @@ function createRotateSession(adapter, deps) {
|
|
|
49685
49747
|
centerY: rect.top + rect.height / 2,
|
|
49686
49748
|
initialState: deps.cloneState(initialState)
|
|
49687
49749
|
};
|
|
49688
|
-
|
|
49689
|
-
window.addEventListener("
|
|
49750
|
+
gesture.claim(event);
|
|
49751
|
+
window.addEventListener("pointermove", handleMouseMove);
|
|
49752
|
+
window.addEventListener("pointerup", handleMouseUp);
|
|
49753
|
+
window.addEventListener("pointercancel", handleMouseUp);
|
|
49690
49754
|
};
|
|
49691
49755
|
return { start, stop };
|
|
49692
49756
|
}
|
|
@@ -49798,8 +49862,10 @@ function createCropSession(deps) {
|
|
|
49798
49862
|
focus: { ...selection.focus }
|
|
49799
49863
|
}
|
|
49800
49864
|
});
|
|
49865
|
+
const gesture = createPointerGesture();
|
|
49801
49866
|
const handleMouseMove = (event) => {
|
|
49802
49867
|
var _a;
|
|
49868
|
+
if (!gesture.owns(event)) return;
|
|
49803
49869
|
const crop = active;
|
|
49804
49870
|
if (!crop) {
|
|
49805
49871
|
return;
|
|
@@ -49842,8 +49908,10 @@ function createCropSession(deps) {
|
|
|
49842
49908
|
};
|
|
49843
49909
|
const stop = () => {
|
|
49844
49910
|
active = null;
|
|
49845
|
-
|
|
49846
|
-
window.removeEventListener("
|
|
49911
|
+
gesture.release();
|
|
49912
|
+
window.removeEventListener("pointermove", handleMouseMove);
|
|
49913
|
+
window.removeEventListener("pointerup", handleMouseUp);
|
|
49914
|
+
window.removeEventListener("pointercancel", handleMouseUp);
|
|
49847
49915
|
};
|
|
49848
49916
|
const begin = (paragraphId, paragraphOffset, handleDirection, event, initialState, mode) => {
|
|
49849
49917
|
const selection = selectionForObject(
|
|
@@ -49874,8 +49942,10 @@ function createCropSession(deps) {
|
|
|
49874
49942
|
initialState: deps.cloneState(initialState),
|
|
49875
49943
|
mode
|
|
49876
49944
|
};
|
|
49877
|
-
|
|
49878
|
-
window.addEventListener("
|
|
49945
|
+
gesture.claim(event);
|
|
49946
|
+
window.addEventListener("pointermove", handleMouseMove);
|
|
49947
|
+
window.addEventListener("pointerup", handleMouseUp);
|
|
49948
|
+
window.addEventListener("pointercancel", handleMouseUp);
|
|
49879
49949
|
};
|
|
49880
49950
|
const start = (paragraphId, paragraphOffset, handleDirection, event, initialState) => begin(
|
|
49881
49951
|
paragraphId,
|
|
@@ -49959,6 +50029,7 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
49959
50029
|
}
|
|
49960
50030
|
document.body.style.cursor = "";
|
|
49961
50031
|
};
|
|
50032
|
+
const gesture = createPointerGesture();
|
|
49962
50033
|
const clearImagePointerTracking = () => {
|
|
49963
50034
|
hideImageDragCursor();
|
|
49964
50035
|
pendingImagePointer = null;
|
|
@@ -49966,8 +50037,10 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
49966
50037
|
setDragging(false);
|
|
49967
50038
|
setDraggedImageInfo(null);
|
|
49968
50039
|
setDropTargetPos(null);
|
|
49969
|
-
|
|
49970
|
-
window.removeEventListener("
|
|
50040
|
+
gesture.release();
|
|
50041
|
+
window.removeEventListener("pointermove", handleImageDragMouseMove);
|
|
50042
|
+
window.removeEventListener("pointerup", handleImageDragMouseUp);
|
|
50043
|
+
window.removeEventListener("pointercancel", handleImageDragMouseUp);
|
|
49971
50044
|
};
|
|
49972
50045
|
const stopImageDrag = () => {
|
|
49973
50046
|
clearImagePointerTracking();
|
|
@@ -50018,6 +50091,7 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50018
50091
|
zoomFactor: deps.zoomFactor
|
|
50019
50092
|
});
|
|
50020
50093
|
const handleImageDragMouseMove = (event) => {
|
|
50094
|
+
if (!gesture.owns(event)) return;
|
|
50021
50095
|
let dragState = activeImageDrag;
|
|
50022
50096
|
if (!dragState) {
|
|
50023
50097
|
const pendingState = pendingImagePointer;
|
|
@@ -50053,6 +50127,7 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50053
50127
|
);
|
|
50054
50128
|
};
|
|
50055
50129
|
const handleImageDragMouseUp = (event) => {
|
|
50130
|
+
if (!gesture.owns(event)) return;
|
|
50056
50131
|
const pendingState = pendingImagePointer;
|
|
50057
50132
|
const dragState = activeImageDrag;
|
|
50058
50133
|
if (!dragState && !pendingState) {
|
|
@@ -50109,10 +50184,12 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50109
50184
|
setDragging(false);
|
|
50110
50185
|
setDraggedImageInfo(null);
|
|
50111
50186
|
setDropTargetPos(null);
|
|
50112
|
-
|
|
50113
|
-
window.addEventListener("
|
|
50187
|
+
gesture.claim(event);
|
|
50188
|
+
window.addEventListener("pointermove", handleImageDragMouseMove);
|
|
50189
|
+
window.addEventListener("pointerup", handleImageDragMouseUp);
|
|
50190
|
+
window.addEventListener("pointercancel", handleImageDragMouseUp);
|
|
50114
50191
|
};
|
|
50115
|
-
const
|
|
50192
|
+
const handleImagePointerDown = (paragraphId, paragraphOffset, event) => {
|
|
50116
50193
|
event.preventDefault();
|
|
50117
50194
|
event.stopPropagation();
|
|
50118
50195
|
const paragraph = getDocumentParagraphs(deps.state.document).find(
|
|
@@ -50129,7 +50206,7 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50129
50206
|
startImageDrag(paragraphId, paragraphOffset, event);
|
|
50130
50207
|
deps.focusInputAfterPointerSelection();
|
|
50131
50208
|
};
|
|
50132
|
-
const
|
|
50209
|
+
const handleImageResizeHandlePointerDown = (paragraphId, paragraphOffset, direction, event) => {
|
|
50133
50210
|
event.preventDefault();
|
|
50134
50211
|
event.stopPropagation();
|
|
50135
50212
|
imageResizeSession.start(
|
|
@@ -50140,12 +50217,12 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50140
50217
|
deps.state
|
|
50141
50218
|
);
|
|
50142
50219
|
};
|
|
50143
|
-
const
|
|
50220
|
+
const handleImageRotateHandlePointerDown = (paragraphId, paragraphOffset, event) => {
|
|
50144
50221
|
event.preventDefault();
|
|
50145
50222
|
event.stopPropagation();
|
|
50146
50223
|
imageRotateSession.start(paragraphId, paragraphOffset, event, deps.state);
|
|
50147
50224
|
};
|
|
50148
|
-
const
|
|
50225
|
+
const handleImageCropHandlePointerDown = (paragraphId, paragraphOffset, direction, event) => {
|
|
50149
50226
|
event.preventDefault();
|
|
50150
50227
|
event.stopPropagation();
|
|
50151
50228
|
imageCropSession.start(
|
|
@@ -50156,7 +50233,7 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50156
50233
|
deps.state
|
|
50157
50234
|
);
|
|
50158
50235
|
};
|
|
50159
|
-
const
|
|
50236
|
+
const handleImageCropBodyPointerDown = (paragraphId, paragraphOffset, event) => {
|
|
50160
50237
|
event.preventDefault();
|
|
50161
50238
|
event.stopPropagation();
|
|
50162
50239
|
imageCropSession.startMove(paragraphId, paragraphOffset, event, deps.state);
|
|
@@ -50175,11 +50252,11 @@ function createEditorImageOperationsImpl(deps) {
|
|
|
50175
50252
|
stopImageResize: imageResizeSession.stop,
|
|
50176
50253
|
stopImageRotate: imageRotateSession.stop,
|
|
50177
50254
|
stopImageCrop: imageCropSession.stop,
|
|
50178
|
-
|
|
50179
|
-
|
|
50180
|
-
|
|
50181
|
-
|
|
50182
|
-
|
|
50255
|
+
handleImagePointerDown,
|
|
50256
|
+
handleImageResizeHandlePointerDown,
|
|
50257
|
+
handleImageRotateHandlePointerDown,
|
|
50258
|
+
handleImageCropHandlePointerDown,
|
|
50259
|
+
handleImageCropBodyPointerDown
|
|
50183
50260
|
};
|
|
50184
50261
|
}
|
|
50185
50262
|
function createEditorTextBoxOperations(deps) {
|
|
@@ -50245,7 +50322,7 @@ function createEditorTextBoxOperationsImpl(deps) {
|
|
|
50245
50322
|
logger: deps.logger
|
|
50246
50323
|
}
|
|
50247
50324
|
);
|
|
50248
|
-
const
|
|
50325
|
+
const handleTextBoxResizeHandlePointerDown = (paragraphId, paragraphOffset, direction, event) => {
|
|
50249
50326
|
event.preventDefault();
|
|
50250
50327
|
event.stopPropagation();
|
|
50251
50328
|
resizeSession.start(
|
|
@@ -50256,14 +50333,14 @@ function createEditorTextBoxOperationsImpl(deps) {
|
|
|
50256
50333
|
deps.state
|
|
50257
50334
|
);
|
|
50258
50335
|
};
|
|
50259
|
-
const
|
|
50336
|
+
const handleTextBoxRotateHandlePointerDown = (paragraphId, paragraphOffset, event) => {
|
|
50260
50337
|
event.preventDefault();
|
|
50261
50338
|
event.stopPropagation();
|
|
50262
50339
|
rotateSession.start(paragraphId, paragraphOffset, event, deps.state);
|
|
50263
50340
|
};
|
|
50264
50341
|
return {
|
|
50265
|
-
|
|
50266
|
-
|
|
50342
|
+
handleTextBoxResizeHandlePointerDown,
|
|
50343
|
+
handleTextBoxRotateHandlePointerDown,
|
|
50267
50344
|
stopTextBoxResize: resizeSession.stop,
|
|
50268
50345
|
stopTextBoxRotate: rotateSession.stop
|
|
50269
50346
|
};
|
|
@@ -51775,14 +51852,16 @@ function createEditorTableResize(deps) {
|
|
|
51775
51852
|
cursorOwner
|
|
51776
51853
|
);
|
|
51777
51854
|
};
|
|
51778
|
-
const
|
|
51855
|
+
const gesture = createPointerGesture();
|
|
51856
|
+
const handlePointerMove = (event) => {
|
|
51857
|
+
if (!gesture.owns(event)) return;
|
|
51779
51858
|
if (resizing()) return;
|
|
51780
51859
|
hoverPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
51781
51860
|
if (hoverFrameHandle === null) {
|
|
51782
51861
|
hoverFrameHandle = scheduleAnimationFrame(processHoverFrame);
|
|
51783
51862
|
}
|
|
51784
51863
|
};
|
|
51785
|
-
const
|
|
51864
|
+
const handlePointerDown = (event) => {
|
|
51786
51865
|
var _a, _b;
|
|
51787
51866
|
hoverPendingPoint = null;
|
|
51788
51867
|
if (hoverFrameHandle !== null) {
|
|
@@ -51834,8 +51913,10 @@ function createEditorTableResize(deps) {
|
|
|
51834
51913
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
51835
51914
|
});
|
|
51836
51915
|
setActiveCursorClass(true, cursorOwner);
|
|
51837
|
-
|
|
51838
|
-
window.addEventListener("
|
|
51916
|
+
gesture.claim(event);
|
|
51917
|
+
window.addEventListener("pointermove", handleWindowMouseMove);
|
|
51918
|
+
window.addEventListener("pointerup", handleWindowMouseUp);
|
|
51919
|
+
window.addEventListener("pointercancel", handleWindowMouseUp);
|
|
51839
51920
|
event.preventDefault();
|
|
51840
51921
|
event.stopPropagation();
|
|
51841
51922
|
return true;
|
|
@@ -51867,13 +51948,16 @@ function createEditorTableResize(deps) {
|
|
|
51867
51948
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
51868
51949
|
});
|
|
51869
51950
|
setActiveCursorClass(false, cursorOwner);
|
|
51870
|
-
|
|
51871
|
-
window.addEventListener("
|
|
51951
|
+
gesture.claim(event);
|
|
51952
|
+
window.addEventListener("pointermove", handleWindowMouseMove);
|
|
51953
|
+
window.addEventListener("pointerup", handleWindowMouseUp);
|
|
51954
|
+
window.addEventListener("pointercancel", handleWindowMouseUp);
|
|
51872
51955
|
event.preventDefault();
|
|
51873
51956
|
event.stopPropagation();
|
|
51874
51957
|
return true;
|
|
51875
51958
|
};
|
|
51876
51959
|
const handleWindowMouseMove = (event) => {
|
|
51960
|
+
if (!gesture.owns(event)) return;
|
|
51877
51961
|
if (!resizing()) return;
|
|
51878
51962
|
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
51879
51963
|
if (resizeFrameHandle === null) {
|
|
@@ -51905,11 +51989,14 @@ function createEditorTableResize(deps) {
|
|
|
51905
51989
|
}
|
|
51906
51990
|
setResizing(null);
|
|
51907
51991
|
clearResizeCursorClasses(cursorOwner);
|
|
51908
|
-
|
|
51909
|
-
window.removeEventListener("
|
|
51992
|
+
gesture.release();
|
|
51993
|
+
window.removeEventListener("pointermove", handleWindowMouseMove);
|
|
51994
|
+
window.removeEventListener("pointerup", handleWindowMouseUp);
|
|
51995
|
+
window.removeEventListener("pointercancel", handleWindowMouseUp);
|
|
51910
51996
|
};
|
|
51911
51997
|
const handleWindowMouseUp = (event) => {
|
|
51912
51998
|
var _a;
|
|
51999
|
+
if (!gesture.owns(event)) return;
|
|
51913
52000
|
const currentResizing = resizing();
|
|
51914
52001
|
if (!currentResizing) return;
|
|
51915
52002
|
const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
|
|
@@ -51926,8 +52013,8 @@ function createEditorTableResize(deps) {
|
|
|
51926
52013
|
};
|
|
51927
52014
|
return {
|
|
51928
52015
|
resizing,
|
|
51929
|
-
|
|
51930
|
-
|
|
52016
|
+
handlePointerMove,
|
|
52017
|
+
handlePointerDown,
|
|
51931
52018
|
stop
|
|
51932
52019
|
};
|
|
51933
52020
|
}
|
|
@@ -51993,7 +52080,9 @@ function createEditorTableCornerResize(deps) {
|
|
|
51993
52080
|
height: current.bounds.height * scaleY
|
|
51994
52081
|
};
|
|
51995
52082
|
};
|
|
52083
|
+
const gesture = createPointerGesture();
|
|
51996
52084
|
const handleWindowMouseMove = (event) => {
|
|
52085
|
+
if (!gesture.owns(event)) return;
|
|
51997
52086
|
if (!resizing()) return;
|
|
51998
52087
|
resizePendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
51999
52088
|
if (resizeFrameHandle === null) {
|
|
@@ -52020,8 +52109,10 @@ function createEditorTableCornerResize(deps) {
|
|
|
52020
52109
|
resizeFrameHandle = null;
|
|
52021
52110
|
}
|
|
52022
52111
|
setResizing(null);
|
|
52023
|
-
|
|
52024
|
-
window.removeEventListener("
|
|
52112
|
+
gesture.release();
|
|
52113
|
+
window.removeEventListener("pointermove", handleWindowMouseMove);
|
|
52114
|
+
window.removeEventListener("pointerup", handleWindowMouseUp);
|
|
52115
|
+
window.removeEventListener("pointercancel", handleWindowMouseUp);
|
|
52025
52116
|
if (tableCornerResizeCursorOwner === cursorOwner) {
|
|
52026
52117
|
tableCornerResizeCursorOwner = null;
|
|
52027
52118
|
if (document.body.style.cursor === "nwse-resize") {
|
|
@@ -52030,6 +52121,7 @@ function createEditorTableCornerResize(deps) {
|
|
|
52030
52121
|
}
|
|
52031
52122
|
};
|
|
52032
52123
|
const handleWindowMouseUp = (event) => {
|
|
52124
|
+
if (!gesture.owns(event)) return;
|
|
52033
52125
|
const current = resizing();
|
|
52034
52126
|
if (current) {
|
|
52035
52127
|
const movedX = Math.abs(event.clientX - current.startClientX);
|
|
@@ -52048,7 +52140,7 @@ function createEditorTableCornerResize(deps) {
|
|
|
52048
52140
|
}
|
|
52049
52141
|
stop();
|
|
52050
52142
|
};
|
|
52051
|
-
const
|
|
52143
|
+
const handlePointerDown = (tableId, event) => {
|
|
52052
52144
|
var _a;
|
|
52053
52145
|
const surface = deps.surfaceRef();
|
|
52054
52146
|
if (!surface) return;
|
|
@@ -52093,12 +52185,14 @@ function createEditorTableCornerResize(deps) {
|
|
|
52093
52185
|
});
|
|
52094
52186
|
tableCornerResizeCursorOwner = cursorOwner;
|
|
52095
52187
|
document.body.style.cursor = "nwse-resize";
|
|
52096
|
-
|
|
52097
|
-
window.addEventListener("
|
|
52188
|
+
gesture.claim(event);
|
|
52189
|
+
window.addEventListener("pointermove", handleWindowMouseMove);
|
|
52190
|
+
window.addEventListener("pointerup", handleWindowMouseUp);
|
|
52191
|
+
window.addEventListener("pointercancel", handleWindowMouseUp);
|
|
52098
52192
|
event.preventDefault();
|
|
52099
52193
|
event.stopPropagation();
|
|
52100
52194
|
};
|
|
52101
|
-
return { resizing, previewRect,
|
|
52195
|
+
return { resizing, previewRect, handlePointerDown, stop };
|
|
52102
52196
|
}
|
|
52103
52197
|
let tableDragCursorOwner = null;
|
|
52104
52198
|
function findTableInBlocks(blocks, tableId, nested, movableTopLevelStory) {
|
|
@@ -52173,6 +52267,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
52173
52267
|
(current) => positionsEqual(current, next) ? current : next
|
|
52174
52268
|
);
|
|
52175
52269
|
};
|
|
52270
|
+
const gesture = createPointerGesture();
|
|
52176
52271
|
const stopDrag = () => {
|
|
52177
52272
|
dragPendingPoint = null;
|
|
52178
52273
|
if (dragFrameHandle !== null) {
|
|
@@ -52182,8 +52277,10 @@ function createEditorTableDragImpl(deps) {
|
|
|
52182
52277
|
setDragging(false);
|
|
52183
52278
|
setDraggedTableInfo(null);
|
|
52184
52279
|
setDropTargetPos(null);
|
|
52185
|
-
|
|
52186
|
-
window.removeEventListener("
|
|
52280
|
+
gesture.release();
|
|
52281
|
+
window.removeEventListener("pointermove", handleMouseMove);
|
|
52282
|
+
window.removeEventListener("pointerup", handleMouseUp);
|
|
52283
|
+
window.removeEventListener("pointercancel", handleMouseUp);
|
|
52187
52284
|
if (tableDragCursorOwner === cursorOwner) {
|
|
52188
52285
|
tableDragCursorOwner = null;
|
|
52189
52286
|
if (document.body.style.cursor === "grabbing") {
|
|
@@ -52210,6 +52307,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
52210
52307
|
updateDropTarget(pos);
|
|
52211
52308
|
};
|
|
52212
52309
|
const handleMouseMove = (event) => {
|
|
52310
|
+
if (!gesture.owns(event)) return;
|
|
52213
52311
|
if (!dragging()) {
|
|
52214
52312
|
const delta = Math.abs(event.clientY - startClientY());
|
|
52215
52313
|
if (delta <= 4) return;
|
|
@@ -52223,6 +52321,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
52223
52321
|
}
|
|
52224
52322
|
};
|
|
52225
52323
|
const handleMouseUp = (event) => {
|
|
52324
|
+
if (!gesture.owns(event)) return;
|
|
52226
52325
|
const info = draggedTableInfo();
|
|
52227
52326
|
if (dragging()) {
|
|
52228
52327
|
const pos = deps.resolvePositionAtSurfacePoint(
|
|
@@ -52255,7 +52354,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
52255
52354
|
stopDrag();
|
|
52256
52355
|
deps.focusInput();
|
|
52257
52356
|
};
|
|
52258
|
-
const
|
|
52357
|
+
const handlePointerDown = (tableId, event) => {
|
|
52259
52358
|
event.preventDefault();
|
|
52260
52359
|
event.stopPropagation();
|
|
52261
52360
|
const handle = event.currentTarget;
|
|
@@ -52273,15 +52372,17 @@ function createEditorTableDragImpl(deps) {
|
|
|
52273
52372
|
setMousePos({ x: event.clientX, y: event.clientY });
|
|
52274
52373
|
setDragging(false);
|
|
52275
52374
|
setDropTargetPos(null);
|
|
52276
|
-
|
|
52277
|
-
window.addEventListener("
|
|
52375
|
+
gesture.claim(event);
|
|
52376
|
+
window.addEventListener("pointermove", handleMouseMove);
|
|
52377
|
+
window.addEventListener("pointerup", handleMouseUp);
|
|
52378
|
+
window.addEventListener("pointercancel", handleMouseUp);
|
|
52278
52379
|
};
|
|
52279
52380
|
return {
|
|
52280
52381
|
dragging,
|
|
52281
52382
|
draggedTableInfo,
|
|
52282
52383
|
mousePos,
|
|
52283
52384
|
dropTargetPos,
|
|
52284
|
-
|
|
52385
|
+
handlePointerDown,
|
|
52285
52386
|
stop: stopDrag
|
|
52286
52387
|
};
|
|
52287
52388
|
}
|
|
@@ -52357,6 +52458,11 @@ function findNextWordBoundary(text, offset) {
|
|
|
52357
52458
|
}
|
|
52358
52459
|
const REUSE_MOUSE_DOWN_HIT_MAX_AGE_MS = 600;
|
|
52359
52460
|
const REUSE_MOUSE_DOWN_HIT_MAX_DISTANCE_PX = 8;
|
|
52461
|
+
const TOUCH_SLOP_PX = 20;
|
|
52462
|
+
const LONG_PRESS_MS = 500;
|
|
52463
|
+
const TAP_MAX_DURATION_MS = 500;
|
|
52464
|
+
const isTouch = (event) => event.pointerType === "touch";
|
|
52465
|
+
const slopFor = (event, mouseSlop) => isTouch(event) ? TOUCH_SLOP_PX : mouseSlop;
|
|
52360
52466
|
function resolveZoneFirstParagraph(blocks, zone) {
|
|
52361
52467
|
if (!blocks || blocks.length === 0) {
|
|
52362
52468
|
const paragraph2 = createSectionBoundaryParagraph(zone);
|
|
@@ -52397,6 +52503,8 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52397
52503
|
let lastMouseDownAt = 0;
|
|
52398
52504
|
let lastMouseDownX = 0;
|
|
52399
52505
|
let lastMouseDownY = 0;
|
|
52506
|
+
let activePointerId = null;
|
|
52507
|
+
let pendingTouch = null;
|
|
52400
52508
|
const scheduleFrame2 = (callback) => {
|
|
52401
52509
|
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
|
|
52402
52510
|
return window.requestAnimationFrame(() => callback());
|
|
@@ -52493,15 +52601,30 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52493
52601
|
`${label} ${sel.anchor.paragraphId}[${sel.anchor.offset}]→${sel.focus.paragraphId}[${sel.focus.offset}] [${anchorLoc}→${focusLoc}]`
|
|
52494
52602
|
);
|
|
52495
52603
|
};
|
|
52604
|
+
const cancelPendingTouch = () => {
|
|
52605
|
+
if (pendingTouch == null ? void 0 : pendingTouch.longPressHandle) {
|
|
52606
|
+
clearTimeout(pendingTouch.longPressHandle);
|
|
52607
|
+
}
|
|
52608
|
+
pendingTouch = null;
|
|
52609
|
+
};
|
|
52496
52610
|
const stopDragging = () => {
|
|
52497
52611
|
dragAnchor = null;
|
|
52498
52612
|
dragPendingPoint = null;
|
|
52613
|
+
activePointerId = null;
|
|
52614
|
+
cancelPendingTouch();
|
|
52499
52615
|
if (dragFrameHandle !== null) {
|
|
52500
52616
|
cancelFrame(dragFrameHandle);
|
|
52501
52617
|
dragFrameHandle = null;
|
|
52502
52618
|
}
|
|
52503
|
-
window.removeEventListener("
|
|
52504
|
-
window.removeEventListener("
|
|
52619
|
+
window.removeEventListener("pointermove", handleWindowPointerMove);
|
|
52620
|
+
window.removeEventListener("pointerup", handleWindowPointerUp);
|
|
52621
|
+
window.removeEventListener("pointercancel", handleWindowPointerCancel);
|
|
52622
|
+
};
|
|
52623
|
+
const startTrackingPointer = (pointerId) => {
|
|
52624
|
+
activePointerId = pointerId;
|
|
52625
|
+
window.addEventListener("pointermove", handleWindowPointerMove);
|
|
52626
|
+
window.addEventListener("pointerup", handleWindowPointerUp);
|
|
52627
|
+
window.addEventListener("pointercancel", handleWindowPointerCancel);
|
|
52505
52628
|
};
|
|
52506
52629
|
const processDragFrame = () => {
|
|
52507
52630
|
dragFrameHandle = null;
|
|
@@ -52527,18 +52650,54 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52527
52650
|
applyWithZone(state, hit.zone, next, hit.position);
|
|
52528
52651
|
logSelection("selection:drag");
|
|
52529
52652
|
};
|
|
52530
|
-
const
|
|
52653
|
+
const handleWindowPointerMove = (event) => {
|
|
52654
|
+
if (activePointerId !== null && event.pointerId !== activePointerId) {
|
|
52655
|
+
return;
|
|
52656
|
+
}
|
|
52657
|
+
if (pendingTouch && !pendingTouch.longPressFired) {
|
|
52658
|
+
const moved = Math.hypot(
|
|
52659
|
+
event.clientX - pendingTouch.clientX,
|
|
52660
|
+
event.clientY - pendingTouch.clientY
|
|
52661
|
+
);
|
|
52662
|
+
if (moved > TOUCH_SLOP_PX) {
|
|
52663
|
+
stopDragging();
|
|
52664
|
+
}
|
|
52665
|
+
return;
|
|
52666
|
+
}
|
|
52531
52667
|
if (!dragAnchor) return;
|
|
52532
52668
|
dragPendingPoint = { clientX: event.clientX, clientY: event.clientY };
|
|
52533
52669
|
if (dragFrameHandle === null) {
|
|
52534
52670
|
dragFrameHandle = scheduleFrame2(processDragFrame);
|
|
52535
52671
|
}
|
|
52536
52672
|
};
|
|
52537
|
-
const
|
|
52673
|
+
const handleWindowPointerUp = (event) => {
|
|
52674
|
+
if (activePointerId !== null && event.pointerId !== activePointerId) {
|
|
52675
|
+
return;
|
|
52676
|
+
}
|
|
52677
|
+
if (pendingTouch && !pendingTouch.longPressFired) {
|
|
52678
|
+
const touch = pendingTouch;
|
|
52679
|
+
const moved = Math.hypot(
|
|
52680
|
+
event.clientX - touch.clientX,
|
|
52681
|
+
event.clientY - touch.clientY
|
|
52682
|
+
);
|
|
52683
|
+
const isTap = moved <= TOUCH_SLOP_PX && Date.now() - touch.startedAt <= TAP_MAX_DURATION_MS;
|
|
52684
|
+
cancelPendingTouch();
|
|
52685
|
+
stopDragging();
|
|
52686
|
+
if (isTap) {
|
|
52687
|
+
commitTouchTap(touch.hit, touch.clickDetail, event);
|
|
52688
|
+
}
|
|
52689
|
+
return;
|
|
52690
|
+
}
|
|
52538
52691
|
logSelection("selection:end");
|
|
52539
52692
|
stopDragging();
|
|
52540
52693
|
deps.focusInputAfterPointerSelection();
|
|
52541
52694
|
};
|
|
52695
|
+
const handleWindowPointerCancel = (event) => {
|
|
52696
|
+
if (activePointerId !== null && event.pointerId !== activePointerId) {
|
|
52697
|
+
return;
|
|
52698
|
+
}
|
|
52699
|
+
stopDragging();
|
|
52700
|
+
};
|
|
52542
52701
|
const handleZoneTransitionDown = (state, hit, clickDetail) => {
|
|
52543
52702
|
if (clickDetail < 2) {
|
|
52544
52703
|
dragAnchor = null;
|
|
@@ -52615,20 +52774,22 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52615
52774
|
start
|
|
52616
52775
|
);
|
|
52617
52776
|
stopDragging();
|
|
52618
|
-
|
|
52619
|
-
|
|
52620
|
-
|
|
52621
|
-
|
|
52622
|
-
|
|
52623
|
-
|
|
52624
|
-
|
|
52625
|
-
|
|
52626
|
-
|
|
52627
|
-
|
|
52628
|
-
|
|
52777
|
+
if (!isTouch(event)) {
|
|
52778
|
+
deps.imageOps.startImageDrag(
|
|
52779
|
+
hit.image.paragraphId,
|
|
52780
|
+
hit.image.startOffset,
|
|
52781
|
+
event,
|
|
52782
|
+
{
|
|
52783
|
+
left: hit.image.left,
|
|
52784
|
+
top: hit.image.top,
|
|
52785
|
+
width: hit.image.width,
|
|
52786
|
+
height: hit.image.height
|
|
52787
|
+
}
|
|
52788
|
+
);
|
|
52789
|
+
}
|
|
52629
52790
|
deps.focusInputAfterPointerSelection();
|
|
52630
52791
|
};
|
|
52631
|
-
const handleShiftClickDown = (state, hit) => {
|
|
52792
|
+
const handleShiftClickDown = (state, hit, pointerId) => {
|
|
52632
52793
|
dragAnchor = state.selection.anchor;
|
|
52633
52794
|
applyWithZone(
|
|
52634
52795
|
state,
|
|
@@ -52639,8 +52800,7 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52639
52800
|
}),
|
|
52640
52801
|
hit.position
|
|
52641
52802
|
);
|
|
52642
|
-
|
|
52643
|
-
window.addEventListener("mouseup", handleWindowMouseUp);
|
|
52803
|
+
startTrackingPointer(pointerId);
|
|
52644
52804
|
deps.focusInputAfterPointerSelection();
|
|
52645
52805
|
};
|
|
52646
52806
|
const handleTripleClickDown = (state, hit, paragraph) => {
|
|
@@ -52693,43 +52853,17 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52693
52853
|
stopDragging();
|
|
52694
52854
|
deps.focusInputAfterPointerSelection();
|
|
52695
52855
|
};
|
|
52696
|
-
const
|
|
52856
|
+
const dispatchSurfaceDown = (state, hit, clickDetail, event) => {
|
|
52697
52857
|
var _a;
|
|
52698
|
-
if (event.button !== 0) {
|
|
52699
|
-
return;
|
|
52700
|
-
}
|
|
52701
|
-
const now = Date.now();
|
|
52702
|
-
const distance = Math.hypot(
|
|
52703
|
-
event.clientX - lastClickX,
|
|
52704
|
-
event.clientY - lastClickY
|
|
52705
|
-
);
|
|
52706
|
-
const withinStreakWindow = now - lastClickAt <= 450 && distance <= 6 && event.button === lastClickButton;
|
|
52707
|
-
clickStreak = withinStreakWindow ? clickStreak + 1 : 1;
|
|
52708
|
-
lastClickAt = now;
|
|
52709
|
-
lastClickX = event.clientX;
|
|
52710
|
-
lastClickY = event.clientY;
|
|
52711
|
-
lastClickButton = event.button;
|
|
52712
|
-
const clickDetail = Math.max(event.detail, clickStreak);
|
|
52713
|
-
const state = deps.state();
|
|
52714
|
-
deps.clearPendingCaretTextStyle();
|
|
52715
|
-
if (deps.tableResize.handleMouseDown(event)) return;
|
|
52716
|
-
event.preventDefault();
|
|
52717
52858
|
deps.imageOps.stopImageDrag();
|
|
52718
52859
|
deps.imageOps.stopImageResize();
|
|
52719
52860
|
deps.clearPreferredColumn();
|
|
52720
52861
|
deps.resetTransactionGrouping();
|
|
52721
|
-
const hit = deps.resolveSurfaceHitAtPoint(event.clientX, event.clientY, {
|
|
52722
|
-
pierce: event.altKey
|
|
52723
|
-
});
|
|
52724
|
-
lastMouseDownHit = hit;
|
|
52725
|
-
lastMouseDownAt = now;
|
|
52726
|
-
lastMouseDownX = event.clientX;
|
|
52727
|
-
lastMouseDownY = event.clientY;
|
|
52728
52862
|
if (!hit) {
|
|
52729
52863
|
deps.focusInputAfterPointerSelection();
|
|
52730
52864
|
return;
|
|
52731
52865
|
}
|
|
52732
|
-
if ((_a = deps.textDrag) == null ? void 0 : _a.tryStartTextDrag(event, hit)) {
|
|
52866
|
+
if (!isTouch(event) && ((_a = deps.textDrag) == null ? void 0 : _a.tryStartTextDrag(event, hit))) {
|
|
52733
52867
|
dragAnchor = null;
|
|
52734
52868
|
stopDragging();
|
|
52735
52869
|
deps.focusInputAfterPointerSelection();
|
|
@@ -52750,7 +52884,7 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52750
52884
|
return;
|
|
52751
52885
|
}
|
|
52752
52886
|
if (event.shiftKey && hit.resolvedFromParagraph) {
|
|
52753
|
-
handleShiftClickDown(state, hit);
|
|
52887
|
+
handleShiftClickDown(state, hit, event.pointerId);
|
|
52754
52888
|
return;
|
|
52755
52889
|
}
|
|
52756
52890
|
if (clickDetail >= 3 && paragraph) {
|
|
@@ -52778,10 +52912,87 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52778
52912
|
},
|
|
52779
52913
|
hit.position
|
|
52780
52914
|
);
|
|
52781
|
-
|
|
52782
|
-
|
|
52915
|
+
if (!isTouch(event)) {
|
|
52916
|
+
startTrackingPointer(event.pointerId);
|
|
52917
|
+
}
|
|
52783
52918
|
deps.focusInputAfterPointerSelection();
|
|
52784
52919
|
};
|
|
52920
|
+
const commitTouchTap = (hit, clickDetail, event) => {
|
|
52921
|
+
dispatchSurfaceDown(deps.state(), hit, clickDetail, event);
|
|
52922
|
+
deps.focusInputSync();
|
|
52923
|
+
};
|
|
52924
|
+
const beginTouchLongPress = () => {
|
|
52925
|
+
const touch = pendingTouch;
|
|
52926
|
+
if (!touch) return;
|
|
52927
|
+
touch.longPressHandle = null;
|
|
52928
|
+
touch.longPressFired = true;
|
|
52929
|
+
const hit = touch.hit;
|
|
52930
|
+
if (!(hit == null ? void 0 : hit.resolvedFromParagraph)) return;
|
|
52931
|
+
const state = deps.state();
|
|
52932
|
+
const paragraph = deps.getParagraphById(state.document, hit.paragraphId);
|
|
52933
|
+
if (!paragraph) return;
|
|
52934
|
+
const word = resolveWordSelection(
|
|
52935
|
+
getParagraphText(paragraph),
|
|
52936
|
+
hit.paragraphOffset
|
|
52937
|
+
);
|
|
52938
|
+
const startPos = paragraphOffsetToPosition(paragraph, word.start);
|
|
52939
|
+
const endPos = paragraphOffsetToPosition(paragraph, word.end);
|
|
52940
|
+
applyWithZone(
|
|
52941
|
+
state,
|
|
52942
|
+
hit.zone,
|
|
52943
|
+
setSelection(state, { anchor: startPos, focus: endPos }),
|
|
52944
|
+
startPos
|
|
52945
|
+
);
|
|
52946
|
+
dragAnchor = startPos;
|
|
52947
|
+
deps.focusInputSync();
|
|
52948
|
+
};
|
|
52949
|
+
const handleSurfacePointerDown = (event) => {
|
|
52950
|
+
if (event.button !== 0) {
|
|
52951
|
+
return;
|
|
52952
|
+
}
|
|
52953
|
+
const now = Date.now();
|
|
52954
|
+
const distance = Math.hypot(
|
|
52955
|
+
event.clientX - lastClickX,
|
|
52956
|
+
event.clientY - lastClickY
|
|
52957
|
+
);
|
|
52958
|
+
const withinStreakWindow = now - lastClickAt <= 450 && distance <= slopFor(event, 6) && event.button === lastClickButton;
|
|
52959
|
+
clickStreak = withinStreakWindow ? clickStreak + 1 : 1;
|
|
52960
|
+
lastClickAt = now;
|
|
52961
|
+
lastClickX = event.clientX;
|
|
52962
|
+
lastClickY = event.clientY;
|
|
52963
|
+
lastClickButton = event.button;
|
|
52964
|
+
const clickDetail = Math.max(event.detail, clickStreak);
|
|
52965
|
+
const state = deps.state();
|
|
52966
|
+
deps.clearPendingCaretTextStyle();
|
|
52967
|
+
if (deps.tableResize.handlePointerDown(event)) {
|
|
52968
|
+
event.preventDefault();
|
|
52969
|
+
return;
|
|
52970
|
+
}
|
|
52971
|
+
const hit = deps.resolveSurfaceHitAtPoint(event.clientX, event.clientY, {
|
|
52972
|
+
pierce: event.altKey
|
|
52973
|
+
});
|
|
52974
|
+
lastMouseDownHit = hit;
|
|
52975
|
+
lastMouseDownAt = now;
|
|
52976
|
+
lastMouseDownX = event.clientX;
|
|
52977
|
+
lastMouseDownY = event.clientY;
|
|
52978
|
+
if (isTouch(event)) {
|
|
52979
|
+
cancelPendingTouch();
|
|
52980
|
+
pendingTouch = {
|
|
52981
|
+
pointerId: event.pointerId,
|
|
52982
|
+
clientX: event.clientX,
|
|
52983
|
+
clientY: event.clientY,
|
|
52984
|
+
startedAt: now,
|
|
52985
|
+
hit,
|
|
52986
|
+
clickDetail,
|
|
52987
|
+
longPressHandle: setTimeout(beginTouchLongPress, LONG_PRESS_MS),
|
|
52988
|
+
longPressFired: false
|
|
52989
|
+
};
|
|
52990
|
+
startTrackingPointer(event.pointerId);
|
|
52991
|
+
return;
|
|
52992
|
+
}
|
|
52993
|
+
event.preventDefault();
|
|
52994
|
+
dispatchSurfaceDown(state, hit, clickDetail, event);
|
|
52995
|
+
};
|
|
52785
52996
|
const handleSurfaceDblClick = (event) => {
|
|
52786
52997
|
event.preventDefault();
|
|
52787
52998
|
};
|
|
@@ -52817,18 +53028,20 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
52817
53028
|
stopDragging();
|
|
52818
53029
|
deps.focusInputAfterPointerSelection();
|
|
52819
53030
|
};
|
|
52820
|
-
const
|
|
53031
|
+
const handleParagraphPointerDown = (_paragraphId, event) => {
|
|
52821
53032
|
if (event.button !== 0) {
|
|
52822
53033
|
return;
|
|
52823
53034
|
}
|
|
52824
|
-
event
|
|
52825
|
-
|
|
53035
|
+
if (!isTouch(event)) {
|
|
53036
|
+
event.preventDefault();
|
|
53037
|
+
}
|
|
53038
|
+
handleSurfacePointerDown(event);
|
|
52826
53039
|
};
|
|
52827
53040
|
return {
|
|
52828
|
-
|
|
53041
|
+
handleSurfacePointerDown,
|
|
52829
53042
|
handleSurfaceClick,
|
|
52830
53043
|
handleSurfaceDblClick,
|
|
52831
|
-
|
|
53044
|
+
handleParagraphPointerDown,
|
|
52832
53045
|
stopDragging
|
|
52833
53046
|
};
|
|
52834
53047
|
}
|
|
@@ -52837,7 +53050,43 @@ function createEditorTextInput(deps) {
|
|
|
52837
53050
|
}
|
|
52838
53051
|
function createEditorTextInputImpl(deps) {
|
|
52839
53052
|
const [composing, setComposing] = createSignal(false);
|
|
52840
|
-
let
|
|
53053
|
+
let previewLength = 0;
|
|
53054
|
+
let previewText = "";
|
|
53055
|
+
let compositionStyle;
|
|
53056
|
+
let justCommitted = null;
|
|
53057
|
+
const resetComposition = () => {
|
|
53058
|
+
previewLength = 0;
|
|
53059
|
+
previewText = "";
|
|
53060
|
+
compositionStyle = void 0;
|
|
53061
|
+
};
|
|
53062
|
+
const applyCompositionText = (text, isFinal) => {
|
|
53063
|
+
if (!isFinal && text === previewText) {
|
|
53064
|
+
return;
|
|
53065
|
+
}
|
|
53066
|
+
if (previewLength === 0 && text.length === 0) {
|
|
53067
|
+
if (isFinal) {
|
|
53068
|
+
resetComposition();
|
|
53069
|
+
}
|
|
53070
|
+
return;
|
|
53071
|
+
}
|
|
53072
|
+
const retracted = previewLength;
|
|
53073
|
+
const pendingStyle = cloneStyle(compositionStyle);
|
|
53074
|
+
deps.clearPreferredColumn();
|
|
53075
|
+
deps.applyTransactionalState(
|
|
53076
|
+
(current) => deps.applyTableAwareParagraphEdit(current, (temp) => {
|
|
53077
|
+
const cleared = deleteCharsBackwardRaw(temp, retracted);
|
|
53078
|
+
return text.length > 0 ? insertTextAtSelection(cleared, text, pendingStyle) : cleared;
|
|
53079
|
+
}),
|
|
53080
|
+
{ mergeKey: MERGE_KEYS.composition }
|
|
53081
|
+
);
|
|
53082
|
+
if (isFinal) {
|
|
53083
|
+
resetComposition();
|
|
53084
|
+
justCommitted = text.length > 0 ? text : null;
|
|
53085
|
+
} else {
|
|
53086
|
+
previewLength = text.length;
|
|
53087
|
+
previewText = text;
|
|
53088
|
+
}
|
|
53089
|
+
};
|
|
52841
53090
|
const handleTextInput = (event) => {
|
|
52842
53091
|
var _a, _b, _c, _d;
|
|
52843
53092
|
markStart("input:text");
|
|
@@ -52846,6 +53095,7 @@ function createEditorTextInputImpl(deps) {
|
|
|
52846
53095
|
`input:readonly ignored value=${JSON.stringify(event.currentTarget.value)}`
|
|
52847
53096
|
);
|
|
52848
53097
|
event.currentTarget.value = "";
|
|
53098
|
+
resetComposition();
|
|
52849
53099
|
return;
|
|
52850
53100
|
}
|
|
52851
53101
|
const text = event.currentTarget.value;
|
|
@@ -52854,13 +53104,17 @@ function createEditorTextInputImpl(deps) {
|
|
|
52854
53104
|
}
|
|
52855
53105
|
if (composing()) {
|
|
52856
53106
|
deps.logger.debug(`input:composing buffer=${JSON.stringify(text)}`);
|
|
53107
|
+
applyCompositionText(text, false);
|
|
52857
53108
|
return;
|
|
52858
53109
|
}
|
|
52859
|
-
if (
|
|
52860
|
-
|
|
52861
|
-
|
|
52862
|
-
|
|
52863
|
-
|
|
53110
|
+
if (justCommitted !== null) {
|
|
53111
|
+
const wasCommitted = text === justCommitted;
|
|
53112
|
+
justCommitted = null;
|
|
53113
|
+
if (wasCommitted) {
|
|
53114
|
+
deps.logger.debug(`input:suppressed text=${JSON.stringify(text)}`);
|
|
53115
|
+
event.currentTarget.value = "";
|
|
53116
|
+
return;
|
|
53117
|
+
}
|
|
52864
53118
|
}
|
|
52865
53119
|
const state = deps.state();
|
|
52866
53120
|
const sel = state.selection;
|
|
@@ -52890,43 +53144,38 @@ function createEditorTextInputImpl(deps) {
|
|
|
52890
53144
|
};
|
|
52891
53145
|
const handleCompositionStart = () => {
|
|
52892
53146
|
deps.logger.debug("input:composition start");
|
|
53147
|
+
resetComposition();
|
|
53148
|
+
justCommitted = null;
|
|
53149
|
+
compositionStyle = cloneStyle(deps.pendingCaretTextStyle());
|
|
52893
53150
|
setComposing(true);
|
|
52894
53151
|
};
|
|
52895
|
-
const
|
|
53152
|
+
const handleCompositionUpdate = (event) => {
|
|
52896
53153
|
if (deps.isReadOnly()) {
|
|
52897
|
-
event.currentTarget.value = "";
|
|
52898
|
-
setComposing(false);
|
|
52899
53154
|
return;
|
|
52900
53155
|
}
|
|
52901
|
-
|
|
53156
|
+
applyCompositionText(event.data ?? "", false);
|
|
53157
|
+
};
|
|
53158
|
+
const handleCompositionEnd = (event) => {
|
|
52902
53159
|
setComposing(false);
|
|
52903
|
-
if (
|
|
53160
|
+
if (deps.isReadOnly()) {
|
|
52904
53161
|
event.currentTarget.value = "";
|
|
53162
|
+
resetComposition();
|
|
52905
53163
|
return;
|
|
52906
53164
|
}
|
|
53165
|
+
const text = event.data ?? event.currentTarget.value;
|
|
52907
53166
|
const state = deps.state();
|
|
52908
53167
|
const sel = state.selection;
|
|
52909
53168
|
deps.logger.info(
|
|
52910
53169
|
`input:composition end ${JSON.stringify(text)} (len=${text.length}) at ${sel.anchor.paragraphId}:${sel.anchor.runId}[${sel.anchor.offset}]`
|
|
52911
53170
|
);
|
|
52912
|
-
|
|
52913
|
-
deps.clearPreferredColumn();
|
|
52914
|
-
const pendingStyle = cloneStyle(deps.pendingCaretTextStyle());
|
|
52915
|
-
deps.applyTransactionalState(
|
|
52916
|
-
(current) => deps.applyTableAwareParagraphEdit(
|
|
52917
|
-
current,
|
|
52918
|
-
(temp) => insertTextAtSelection(temp, text, pendingStyle)
|
|
52919
|
-
),
|
|
52920
|
-
{
|
|
52921
|
-
mergeKey: MERGE_KEYS.insertText
|
|
52922
|
-
}
|
|
52923
|
-
);
|
|
53171
|
+
applyCompositionText(text, true);
|
|
52924
53172
|
event.currentTarget.value = "";
|
|
52925
53173
|
deps.focusInput();
|
|
52926
53174
|
};
|
|
52927
53175
|
return {
|
|
52928
53176
|
handleTextInput,
|
|
52929
53177
|
handleCompositionStart,
|
|
53178
|
+
handleCompositionUpdate,
|
|
52930
53179
|
handleCompositionEnd,
|
|
52931
53180
|
composing
|
|
52932
53181
|
};
|
|
@@ -52984,6 +53233,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
52984
53233
|
cursorStyleEl.textContent = `*, *::before, *::after { cursor: ${WORD_LIKE_DRAG_CURSOR} !important; }`;
|
|
52985
53234
|
document.head.appendChild(cursorStyleEl);
|
|
52986
53235
|
};
|
|
53236
|
+
const gesture = createPointerGesture();
|
|
52987
53237
|
const stopDrag = () => {
|
|
52988
53238
|
var _a;
|
|
52989
53239
|
(_a = deps.logger) == null ? void 0 : _a.info("text-drag:stop", {
|
|
@@ -52999,11 +53249,14 @@ function createEditorTextDragImpl(deps) {
|
|
|
52999
53249
|
setPointerPos(null);
|
|
53000
53250
|
setCaretViewport(null);
|
|
53001
53251
|
hideCursor();
|
|
53002
|
-
|
|
53003
|
-
window.removeEventListener("
|
|
53252
|
+
gesture.release();
|
|
53253
|
+
window.removeEventListener("pointermove", handleWindowMouseMove);
|
|
53254
|
+
window.removeEventListener("pointerup", handleWindowMouseUp);
|
|
53255
|
+
window.removeEventListener("pointercancel", handleWindowMouseUp);
|
|
53004
53256
|
};
|
|
53005
53257
|
const handleWindowMouseMove = (event) => {
|
|
53006
53258
|
var _a, _b, _c;
|
|
53259
|
+
if (!gesture.owns(event)) return;
|
|
53007
53260
|
if (!pendingStart) {
|
|
53008
53261
|
return;
|
|
53009
53262
|
}
|
|
@@ -53056,6 +53309,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
53056
53309
|
};
|
|
53057
53310
|
const handleWindowMouseUp = (event) => {
|
|
53058
53311
|
var _a, _b, _c;
|
|
53312
|
+
if (!gesture.owns(event)) return;
|
|
53059
53313
|
(_a = deps.logger) == null ? void 0 : _a.info("text-drag:mouseup", {
|
|
53060
53314
|
x: event.clientX,
|
|
53061
53315
|
y: event.clientY,
|
|
@@ -53138,8 +53392,10 @@ function createEditorTextDragImpl(deps) {
|
|
|
53138
53392
|
setDropTargetPos(null);
|
|
53139
53393
|
setCaretViewport(hit.caretViewport ?? null);
|
|
53140
53394
|
setDragging(false);
|
|
53141
|
-
|
|
53142
|
-
window.addEventListener("
|
|
53395
|
+
gesture.claim(event);
|
|
53396
|
+
window.addEventListener("pointermove", handleWindowMouseMove);
|
|
53397
|
+
window.addEventListener("pointerup", handleWindowMouseUp);
|
|
53398
|
+
window.addEventListener("pointercancel", handleWindowMouseUp);
|
|
53143
53399
|
return true;
|
|
53144
53400
|
};
|
|
53145
53401
|
return {
|
|
@@ -53537,6 +53793,7 @@ function useEditorInteractionWiring(ctx) {
|
|
|
53537
53793
|
clearPreferredColumn: ctx.clearPreferredColumn,
|
|
53538
53794
|
resetTransactionGrouping: ctx.resetTransactionGrouping,
|
|
53539
53795
|
focusInputAfterPointerSelection: ctx.focusInputAfterPointerSelection,
|
|
53796
|
+
focusInputSync: ctx.focusInputSync,
|
|
53540
53797
|
resolveSurfaceHitAtPoint: ctx.resolveSurfaceHitAtPoint,
|
|
53541
53798
|
getParagraphById,
|
|
53542
53799
|
textDrag: {
|
|
@@ -53610,6 +53867,7 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
53610
53867
|
cloneState,
|
|
53611
53868
|
focusInput,
|
|
53612
53869
|
focusInputAfterPointerSelection,
|
|
53870
|
+
focusInputSync,
|
|
53613
53871
|
surfaceRef,
|
|
53614
53872
|
viewportRef,
|
|
53615
53873
|
zoomFactor,
|
|
@@ -53703,6 +53961,7 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
53703
53961
|
logger,
|
|
53704
53962
|
focusInput,
|
|
53705
53963
|
focusInputAfterPointerSelection,
|
|
53964
|
+
focusInputSync,
|
|
53706
53965
|
clearPreferredColumn,
|
|
53707
53966
|
resetTransactionGrouping,
|
|
53708
53967
|
surfaceRef,
|
|
@@ -53723,7 +53982,7 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
53723
53982
|
insertImageFromFile,
|
|
53724
53983
|
openEquationDialog: deps.openEquationDialog
|
|
53725
53984
|
});
|
|
53726
|
-
const
|
|
53985
|
+
const onEditorPointerDown = (event) => {
|
|
53727
53986
|
if (event.button !== 0) {
|
|
53728
53987
|
return;
|
|
53729
53988
|
}
|
|
@@ -53742,7 +54001,7 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
53742
54001
|
imageOps,
|
|
53743
54002
|
textBoxOps,
|
|
53744
54003
|
styleController,
|
|
53745
|
-
|
|
54004
|
+
onEditorPointerDown,
|
|
53746
54005
|
tableResize: wiring.tableResize,
|
|
53747
54006
|
tableCornerResize: wiring.tableCornerResize,
|
|
53748
54007
|
tableDrag: wiring.tableDrag,
|
|
@@ -55183,6 +55442,9 @@ function createEditorKeyboardControllerImpl(deps) {
|
|
|
55183
55442
|
}
|
|
55184
55443
|
return;
|
|
55185
55444
|
}
|
|
55445
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
55446
|
+
return;
|
|
55447
|
+
}
|
|
55186
55448
|
const commandExecutor = deps.executeCommand ? {
|
|
55187
55449
|
executeCommand: (commandName, payload) => {
|
|
55188
55450
|
var _a;
|
|
@@ -58435,6 +58697,7 @@ function OasisEditorApp(props = {}) {
|
|
|
58435
58697
|
const setFocused = focusController.setFocused;
|
|
58436
58698
|
const focusInput = focusController.focusInput;
|
|
58437
58699
|
const focusInputAfterPointerSelection = focusController.focusInputAfterPointerSelection;
|
|
58700
|
+
const focusInputSync = focusController.focusInputSync;
|
|
58438
58701
|
const [initialLoading, setInitialLoading] = createSignal(ui().loading !== false);
|
|
58439
58702
|
const zoom = createEditorZoom();
|
|
58440
58703
|
const {
|
|
@@ -58510,6 +58773,7 @@ function OasisEditorApp(props = {}) {
|
|
|
58510
58773
|
cloneState,
|
|
58511
58774
|
focusInput,
|
|
58512
58775
|
focusInputAfterPointerSelection,
|
|
58776
|
+
focusInputSync,
|
|
58513
58777
|
surfaceRef,
|
|
58514
58778
|
viewportRef,
|
|
58515
58779
|
zoomFactor: zoom.zoomFactor,
|
|
@@ -58543,7 +58807,7 @@ function OasisEditorApp(props = {}) {
|
|
|
58543
58807
|
imageOps,
|
|
58544
58808
|
textBoxOps,
|
|
58545
58809
|
styleController,
|
|
58546
|
-
|
|
58810
|
+
onEditorPointerDown,
|
|
58547
58811
|
tableResize,
|
|
58548
58812
|
tableCornerResize,
|
|
58549
58813
|
tableDrag,
|
|
@@ -58675,14 +58939,14 @@ function OasisEditorApp(props = {}) {
|
|
|
58675
58939
|
tableDrag,
|
|
58676
58940
|
revisionController,
|
|
58677
58941
|
handleDrop,
|
|
58678
|
-
|
|
58679
|
-
|
|
58680
|
-
|
|
58681
|
-
|
|
58682
|
-
|
|
58683
|
-
|
|
58684
|
-
|
|
58685
|
-
|
|
58942
|
+
onEditorPointerDown,
|
|
58943
|
+
handleImagePointerDown: imageOps.handleImagePointerDown,
|
|
58944
|
+
handleImageResizeHandlePointerDown: imageOps.handleImageResizeHandlePointerDown,
|
|
58945
|
+
handleTextBoxResizeHandlePointerDown: textBoxOps.handleTextBoxResizeHandlePointerDown,
|
|
58946
|
+
handleImageRotateHandlePointerDown: imageOps.handleImageRotateHandlePointerDown,
|
|
58947
|
+
handleImageCropHandlePointerDown: imageOps.handleImageCropHandlePointerDown,
|
|
58948
|
+
handleImageCropBodyPointerDown: imageOps.handleImageCropBodyPointerDown,
|
|
58949
|
+
handleTextBoxRotateHandlePointerDown: textBoxOps.handleTextBoxRotateHandlePointerDown,
|
|
58686
58950
|
handleEditorContextMenu
|
|
58687
58951
|
},
|
|
58688
58952
|
input: {
|