plitejs 54.0.0-beta.3 → 54.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/annotations/index.d.ts +1 -1
  2. package/dist/annotations/index.js +1 -1
  3. package/dist/authored/index.d.ts +2 -2
  4. package/dist/authored/index.js +168 -46
  5. package/dist/{authored-veto-DSnQcHGR.js → authored-veto-D_9wCJcK.js} +1 -1
  6. package/dist/{comparison-plan-CEQL0ooW.js → comparison-plan-DY_vuGPq.js} +1 -1
  7. package/dist/{comparison-types-Dt-unJZY.d.ts → comparison-types-DdwE6mYq.d.ts} +1 -1
  8. package/dist/{create-editor-CkHtPWXV.js → create-editor-CLQEkEZ1.js} +2 -1
  9. package/dist/diff/index.d.ts +2 -2
  10. package/dist/diff/index.js +2 -2
  11. package/dist/dom/index.d.ts +1 -1
  12. package/dist/dom/index.js +1 -1
  13. package/dist/{dom-Cgfscvnm.js → dom-CH2BXXj6.js} +2 -2
  14. package/dist/{editor-owner-IUmkTeXz.js → editor-owner-C9rVbMTs.js} +1 -1
  15. package/dist/history/index.d.ts +1 -1
  16. package/dist/history/index.js +2 -2
  17. package/dist/hyperscript/index.d.ts +1 -1
  18. package/dist/hyperscript/index.js +1 -1
  19. package/dist/{hyperscript-FPuoArEi.js → hyperscript-CeT83ZLB.js} +2 -2
  20. package/dist/{index-DPWyk3lG.d.ts → index-BWPcE4ac.d.ts} +7 -1
  21. package/dist/{index-DpltOCot.d.ts → index-BXjLmx1n.d.ts} +101 -27
  22. package/dist/{index-K0Za9YXc.d.ts → index-DVMNewDn.d.ts} +10 -13
  23. package/dist/{index-BpQx2UG4.d.ts → index-Db-ktCTE.d.ts} +5 -6
  24. package/dist/{index-HPYawTae.d.ts → index-Dq3Jlj8O.d.ts} +1 -1
  25. package/dist/{index-Cw-oC2ps.d.ts → index-UrB4jAwl.d.ts} +1 -1
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +4 -4
  28. package/dist/internal/index.d.ts +2 -2
  29. package/dist/internal/index.js +4 -4
  30. package/dist/{mapped-view-store-ld-6uxEU.js → mapped-view-store-CbWqba_1.js} +1 -1
  31. package/dist/{native-grouping-input-DMNcsIaW.js → native-grouping-input-DXNhlPHd.js} +1 -1
  32. package/dist/pagination/index.d.ts +1 -1
  33. package/dist/pagination/index.js +1 -1
  34. package/dist/pagination/react.d.ts +2 -2
  35. package/dist/pagination/react.js +5 -5
  36. package/dist/{pagination-D_A8iPJP.js → pagination-CBdYiOuR.js} +1 -1
  37. package/dist/{plugin-DWzkJbnJ.js → plugin-SR3HTH0j.js} +1458 -952
  38. package/dist/{range-geometry-BjeLHOnl.js → range-geometry-CdltxcH6.js} +2 -2
  39. package/dist/{range-geometry-BLAHRE11.d.ts → range-geometry-Dwp2oyCc.d.ts} +1 -1
  40. package/dist/react/index.d.ts +5 -5
  41. package/dist/react/index.js +6 -6
  42. package/dist/react/virtualized.d.ts +2 -2
  43. package/dist/react/virtualized.js +1 -1
  44. package/dist/{react-DZ15gmz2.js → react-CN-iBh1z.js} +8 -8
  45. package/dist/{retraction-BMem8Rfk.js → retraction-BmPJB9cE.js} +1 -1
  46. package/dist/{src-cT1OTKP_.js → src-B-zm0kz4.js} +128 -3
  47. package/dist/{store-Cz2mXyDe.js → store-51r4zpCR.js} +24 -11
  48. package/dist/testing/index.d.ts +2 -2
  49. package/dist/testing/index.js +3 -3
  50. package/dist/{use-editor-dom-scope-BbMDSCpW.js → use-editor-dom-scope-uDJQ692F.js} +184 -168
  51. package/dist/yjs/index.d.ts +1 -1
  52. package/dist/yjs/index.js +1 -1
  53. package/dist/yjs/react/index.d.ts +3 -3
  54. package/dist/yjs/react/index.js +3 -3
  55. package/dist/{yjs-DOK-m7kl.js → yjs-IGE0Al3n.js} +5 -2
  56. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { $n as getEditorReadDepth, Ar as isInTransaction, B as NodeApi, Ba as getRangeBreakCount, Bd as rootNodesOf, Bi as readRootViewPresentationRevision, Bn as getChildList, Bt as point, Ca as getWordSegments, Co as withMountedPresentation, Ct as isElementReadOnly, Cu as getEditorRuntime, Di as setTargetRuntime, Ds as sealsText, Du as hasEditorRuntime, Ei as withUpdateTagContext, Eo as isViewPresentationRetained, Et as isInline, Eu as getEditorSchema, Fa as clearCaretUnlessHeldElsewhere, Fc as isAuthoredPreview, Fd as DocumentIndex, Fn as getActiveEditorTransaction, Ft as move, Ga as mayClearCaret, Gi as subscribeRootTarget, Ha as holdsCaretAt, Hr as registerEditorSurface, Ic as readAuthoredView, Ii as readLatestShownWritableRootView, Io as getRootTransaction, Ir as readEditorCommitHistoryEntry, Ka as nextMintedGeneration, Ki as subscribeRootViewPresentation, Kn as getCurrentSelectionRoot, L as probeCommandNativeEquivalent, Ld as childAtPathIndex, Li as readLatestShownWritableView, Lr as readEditorHistoryHeadRoots, Lt as next, M as dispatchCommand, Mi as getSelectionStateCaret, Na as capturePlacement, Ni as markRootViewUsed, On as continueTransactionSpecOrDiscardPrefix, Oo as retainPresentation, Ou as setEditorRuntime, P as evaluateCommandWithState, Pi as mountRootView, Pn as flushEditorViewState, Qr as setCurrentMarks, Qu as createInternalDocumentChange, R as commandViewHides, Ra as getCaretOwner, Rc as requestAuthoredView, Ri as readNestedRootView, Rr as readEditorHistoryReplayReceipt, Sd as RootChange, Sn as applyTransactionSpec, Ss as mapSelectionThroughChange, St as isEditor, Tn as asSelectionMotion, Tu as getEditorRuntimeRoot, U as after, Ua as keepBookmark, Ui as readShownWritableRootViews, V as above, Va as holdsCaret, Vf as defineUpdateAnnotation, Vt as positions, W as before, Wa as liftShownTarget, Wd as PreparedTokenSlice, Wi as showsRootView, Wn as getCurrentMarks, Wt as range, Xa as resolveParkedCaret, Xc as toPublicRoot, Xd as isTextNode$1, Xi as assertEditorNotDestroyed, Ya as resolveLiveCaret, Yc as toInternalRoot, Yn as getEditorDocumentValue, Zf as countCoreWork, _a as exportContentSlice, _d as valueRootIndex, _n as withCompositionStamp, _o as mountViewPeer, al as reportEditorLifecycleError, ao as carryRootEditors, ar as getLiveNode, at as getNodeKey, au as ElementApi, bc as keyMovedAt, bs as isObjectSelectionTarget, bt as isBlock, bu as getReaderRange, cd as getInternalDocumentChangeRootKeys, co as createEditorViewRuntime, cr as getMutationVersion, ct as getSelection, dn as voidEditor, ei as setEditorComposing, eo as setSelectionAsView, er as getEditorRuntimeElementEntries, eu as failInvariant, fi as subscribeCaretTarget, fo as getOwnViewReadOnly, fr as getRestorableMarks, ft as hasPath, fu as LocationApi, gn as readWholeBlockDelete, go as matchesPresentationOf, gr as getSnapshotVersion, hc as getEditorCommitSnapshot, hi as syncImplicitTargetToCurrentSelection, hl as inheritPluginRegistry$1, hn as getRemovableTripleClickedBlock, ho as getViewPresentation, hu as PointApi, ia as rewriteContentRootReferences, if as getNodeKeyForNode, ii as setEditorReadOnly, in as subscribeSource, io as withoutPlacement, ip as getDefined, it as getLastCommit$1, iu as SelectionApi, jt as leaf, kt as isVoid, ld as getInternalDocumentRootChange, lt as getSnapshot, lu as TextApi, m as getInstalledPlugin, ma as readOnlyInlineAt, mn as editorCommands, mr as getSetSite, mu as RangeApi, ni as setEditorFocused, no as subscribeCommittedPlacement, ol as runEditorObserver, ot as getPathByNodeKey, pa as hasEdgeInReadOnlyInline, pi as subscribeEditorViewState, pn as deleteTripleClickedBlock, pr as getSelectionRoot$1, qa as placedSince, rc as ContentSlice, rf as getNodeKeyDOMValue, rn as string, ro as watchFirstPlacement, ru as readTextEdge, s as createEditorViewPluginApis, sa as dividesTextCell, sr as getLiveText, ti as setEditorCompositionPending, to as setShownSelectionAsView, tr as getEditorRuntimeRootKeys, ua as resolveDeletedRange, uo as getCarriedMount, vc as getEditorCommitValue, vo as projectEditorView, vt as insertText, wi as withEditorUpdateRootScope, wu as getEditorRuntimeOwner, xo as readViewPage, xr as hasEditorSurface, xu as PathApi, yn as afterOpenDrafts, ys as getSelectionDOMRange, za as getPlacementGeneration, zc as withAuthoredUpdateView, zi as readRootTarget, zn as getBaseCallRoot } from "./plugin-DWzkJbnJ.js";
2
- import { g as getScreenReaderAnnouncements, h as getTextRunBetweenAtomics, m as projectRangeInSnapshot } from "./create-editor-CkHtPWXV.js";
3
- import { n as startOwnedEditor, r as sameResult } from "./editor-owner-IUmkTeXz.js";
4
- import { r as createViewSourceFaultBoundary } from "./mapped-view-store-ld-6uxEU.js";
5
- import { $ as copyIntentOf, $n as EDITOR_TO_RUNTIME_ID_TO_ELEMENTS, $t as readDOMSelectionPoints, A as findDOMPointElementInRoot, An as getUsableRangeRects, At as isSoftLineEndBetween, B as setEditorDOMRootElement, Bn as setDOMTextFlowRecordIndex, Bt as findDOMRootRuntime, C as normalizeRange, Cn as getPliteStringEdgeOffset, Cr as isDOMElement, Ct as observeDataTransferInsertion, D as DOMEditor, Dn as getPliteTextHostBounds, Dr as isPlainTextOnlyPaste, E as verifyDiffState, En as getPliteStringPlacementDOMPoint$1, Er as isDOMText, F as resolveDOMPointInRoot, Fn as resolveDOMTextFlowEntry, Ft as recordSoftLineEnd, G as ensureFocusCaret, Gn as EDITOR_TO_FORCE_RENDER, Gt as isDOMSyncMutation, H as subscribeEditorDOMScope, I as resolveDOMRangeInRoot, In as resolveDOMTextFlowInsertTarget, It as resolveSoftLineEndDOMPoint, J as eventCarriesBlockFragment, Jn as EDITOR_TO_PENDING_DIFFS, Jt as scheduleEditorDOMPhase, K as liftCaretOutOfCollapsedSection, Kn as EDITOR_TO_KEY_TO_ELEMENT, Kt as markDOMSyncMutationTarget, L as resolveWrittenDOMRange, Ln as resolveDOMTextFlowOffset, Lt as findMountedDOMNodeByPath, M as getOrCreateDOMNodeKey, Mn as isDOMTextFlowSegmentSynchronized, Mt as noteAfterInsertCaret, N as isSelectableDOMSelection, Nn as readDOMTextFlowPaint, Nt as readAfterInsertCaret, On as getPliteTextHostStrings, Or as markPlainTextPaste, Ot as SOFT_LINE_FLAG, P as isTrackedMutation, Pn as releaseDOMTextFlowRecordIndex, Pt as readLowerSoftLineEnd, Qn as EDITOR_TO_ROOT_VIEW_EDITORS, Qt as getDOMRangeSelectionPoints, R as setEditableRootReveal, Rn as resolveDOMTextFlowRecordDOMText, Rt as resolvePliteNodePath, S as normalizePoint, Sn as getPliteStringDocumentOffset, T as targetRange, Tn as getPliteStringPlacementAtX, Tr as isDOMSelection, U as supersedeFocusRequest, Un as isCollapsedDOMCoverageBoundary, Ut as resolveDOMReach, V as setEditorDOMScrollElement, Vn as setDOMTextFlowRecordIndexes, Vt as findEditorDOMRootRuntime, W as writeViewSelectionPart, Wn as EDITOR_TO_ELEMENT, Wt as resolveDOMTargetView, X as getDragAutoScrollTarget, Xn as EDITOR_TO_PENDING_SELECTION, Xt as forgetDOMSelectionRecord, Y as resolveBlockFragmentDropRange, Yn as EDITOR_TO_PENDING_INSERTION_MARKS, Yt as changeDOMSelection, Zn as EDITOR_TO_PLACEHOLDER_ELEMENT, Zt as forgetDOMSelectionRecordWithin, _n as createDOMGeometryKernel, _r as getDefaultView, _t as domCommands, an as writeDOMSelection, ar as ELEMENT_TO_EDITOR, at as cancelDragRest, b as longestCommonPrefixLength, bn as getPliteStringCoordinatePlacement, cr as IS_FOCUSED, ct as isDragSessionClaimed, d as Hotkeys, dn as isAndroidDOMHost, dr as NODE_TO_ELEMENT, dt as settleDragSession, en as readDOMSelectionRange, er as EDITOR_TO_RUNTIME_ID_TO_KEY, et as indicateDOMDropTarget, f as getLineBoundaryKeyboardMove, fn as isBlinkDOMHost, fr as NODE_TO_INDEX, ft as takeDragSession, gn as usesAppleDOMHotkeys, gr as getActiveElement, hn as supportsDOMBeforeInput, hr as containsShadowAware, in as sameDOMSelectionPoints, ir as EDITOR_TO_WINDOW, it as beginDragSession, j as getEditorDOMHostScrollElement, jn as hasUsableDOMRect, jt as isSoftLineTextStale, k as createDOMEditorCapability, kn as getTextFlowPointAtCoordinates, kt as clearAfterInsertCaret, ln as getDOMHostLanguage, lr as IS_NODE_MAP_DIRTY, lt as readDragSession, mn as isWebKitDOMHost, nn as readsSelectionAsHost, nr as EDITOR_TO_USER_MARKS, nt as resolveDOMDropTarget, or as ELEMENT_TO_NODE, ot as clearDragScrollRepaint, p as isPasteWithoutFormatting, pn as isGeckoDOMHost, pr as NODE_TO_PARENT, pt as publishDropIndicator, q as resolveNextKeyCaret, qn as EDITOR_TO_PENDING_ACTION, qt as watchDOMSyncTextMarks, rn as recordDOMSelection, rr as EDITOR_TO_USER_SELECTION, rt as restDOMBlockDrag, sn as selectDOMInputDefaultActionPhase, sr as IS_COMPOSING, st as clearDragSession, tn as readDOMSelectionRecord, tr as EDITOR_TO_SCHEDULE_FLUSH, tt as pointAt, un as hasDOMHostQuirk, ur as IS_READ_ONLY, ut as setDragScrollRepaint, vn as getNearestPliteStringRect, vr as getFlatTreeParentElement, w as normalizeStringDiff, wn as getPliteStringLength, wr as isDOMNode, x as mergeStringDiffs, y as applyStringDiff, yn as getOwnedPliteTextStrings, yr as getSelection$1, yt as writeDOMDataTransferFragment, z as setEditorDOMEditableElement, zn as resolveDOMTextFlowRecordText, zt as DOMRootRuntime } from "./dom-Cgfscvnm.js";
6
- import { t as nativeGroupingInput } from "./native-grouping-input-DMNcsIaW.js";
7
- import { a as useRangeGeometryOwner, i as resolveRangeGeometry, o as useIsomorphicLayoutEffect, r as resolveDOMRangeGeometry, t as createRangeGeometryOwner } from "./range-geometry-BjeLHOnl.js";
1
+ import { $f as PathApi, $n as getEditorRuntimeElementEntries, Ao as withMountedPresentation, B as NodeApi, Ba as getCaretOwner, Bd as rootNodesOf, Bi as readRootViewPresentationRevision, Bt as point, Co as mountViewPeer, Ct as isElementReadOnly, Cu as getEditorRuntime, Di as setTargetRuntime, Dn as continueTransactionSpecOrDiscardPrefix, Do as readViewPage, Du as hasEditorRuntime, Ec as keyMovedAt, Ei as withUpdateTagContext, Es as isObjectSelectionTarget, Et as isInline, Eu as getEditorSchema, Fa as capturePlacement, Fd as DocumentIndex, Fr as readEditorCommitHistoryEntry, Ft as move, Ga as keepBookmark, Gf as RangeApi, Gi as subscribeRootViewPresentation, Gn as getCurrentSelectionRoot, Ha as getRangeBreakCount, Hc as requestAuthoredView, Ho as getRootTransaction, Hr as registerEditorSurface, Ii as readLatestShownWritableRootView, Ir as readEditorHistoryHeadRoots, Ja as nextMintedGeneration, Jf as PointApi, Jn as getEditorDocumentValue, Ka as liftShownTarget, Kf as LocationApi, L as probeCommandNativeEquivalent, La as clearCaretUnlessHeldElsewhere, Ld as childAtPathIndex, Li as readLatestShownWritableView, Lr as readEditorHistoryReplayReceipt, Lt as next, M as dispatchCommand, Mi as getSelectionStateCaret, Ni as markRootViewUsed, Nn as flushEditorViewState, Ns as sealsText, Os as mapSelectionThroughChange, Ou as setEditorRuntime, P as evaluateCommandWithState, Pi as mountRootView, Pn as getActiveEditorTransaction, Po as retainPresentation, Qa as resolveParkedCaret, Qf as getReaderRange, Qn as getEditorReadDepth, Qr as setCurrentMarks, Qu as createInternalDocumentChange, R as commandViewHides, Rc as isAuthoredPreview, Ri as readNestedRootView, Rn as getBaseCallRoot, Sd as RootChange, So as matchesPresentationOf, St as isEditor, Ta as getWordSegments, Tl as inheritPluginRegistry$1, Ts as getSelectionDOMRange, Tu as getEditorRuntimeRoot, U as after, Ua as holdsCaret, Uc as withAuthoredUpdateView, Ui as readShownWritableRootViews, Un as getCurrentMarks, V as above, Va as getPlacementGeneration, Vf as defineUpdateAnnotation, Vt as positions, W as before, Wa as holdsCaretAt, Wd as PreparedTokenSlice, Wf as readLastCommitAnnotation, Wi as subscribeRootTarget, Wt as range, Xd as isTextNode$1, Ya as placedSince, Yi as assertEditorNotDestroyed, Za as resolveLiveCaret, _d as valueRootIndex, aa as rewriteContentRootReferences, al as toInternalRoot, ao as watchFirstPlacement, at as getNodeKey, bo as joinViewLockScope, br as hasEditorSurface, bt as isBlock, cd as getInternalDocumentChangeRootKeys, cp as countCoreWork, ct as getSelection, dn as voidEditor, do as createViewLockScope, dr as getRestorableMarks, ei as setEditorComposing, er as getEditorRuntimeRootKeys, fa as resolveDeletedRange, fi as subscribeCaretTarget, fo as flushViewLockScope, fr as getSelectionRoot$1, ft as hasPath, ga as readOnlyInlineAt, gl as runEditorObserver, gn as withCompositionStamp, go as getOwnViewReadOnly, ha as hasEdgeInReadOnlyInline, hi as syncImplicitTargetToCurrentSelection, hl as reportEditorLifecycleError, hn as tripleClickedBlock, hp as getDefined, hr as getSnapshotVersion, hu as ElementApi, if as getNodeKeyForNode, ii as setEditorReadOnly, in as subscribeSource, io as subscribeCommittedPlacement, ir as getLiveNode, it as getLastCommit$1, jt as leaf, ko as setViewLockScopeLocked, kr as isInTransaction, kt as isVoid, la as dividesTextCell, lc as ContentSlice, ld as getInternalDocumentRootChange, lt as getSnapshot, m as getInstalledPlugin, mn as readWholeBlockLanding, mo as getCarriedMount, mu as SelectionApi, ni as setEditorFocused, no as setSelectionAsView, nr as getEditorUpdateRoot, ol as toPublicRoot, oo as withoutPlacement, or as getLiveText, ot as getPathByNodeKey, pi as subscribeEditorViewState, pn as editorCommands, pr as getSetSite, pu as readTextEdge, qa as mayClearCaret, rf as getNodeKeyDOMValue, rn as string, ro as setShownSelectionAsView, s as createEditorViewPluginApis, so as carryRootEditors, sr as getMutationVersion, ti as setEditorCompositionPending, uo as createEditorViewRuntime, uu as failInvariant, vn as afterOpenDrafts, vt as insertText, wc as getEditorCommitValue, wi as withEditorUpdateRootScope, wn as asSelectionMotion, wo as projectEditorView, wu as getEditorRuntimeOwner, xc as getEditorCommitSnapshot, xn as applyTransactionSpec, xo as linkViewLockScope, ya as exportContentSlice, yo as getViewPresentation, yu as TextApi, zc as readAuthoredView, zi as readRootTarget, zn as getChildList } from "./plugin-SR3HTH0j.js";
2
+ import { g as getScreenReaderAnnouncements, h as getTextRunBetweenAtomics, m as projectRangeInSnapshot } from "./create-editor-CLQEkEZ1.js";
3
+ import { n as startOwnedEditor, r as sameResult } from "./editor-owner-C9rVbMTs.js";
4
+ import { r as createViewSourceFaultBoundary } from "./mapped-view-store-CbWqba_1.js";
5
+ import { $ as copyIntentOf, $n as EDITOR_TO_RUNTIME_ID_TO_ELEMENTS, $t as readDOMSelectionPoints, A as findDOMPointElementInRoot, An as getUsableRangeRects, At as isSoftLineEndBetween, B as setEditorDOMRootElement, Bn as setDOMTextFlowRecordIndex, Bt as findDOMRootRuntime, C as normalizeRange, Cn as getPliteStringEdgeOffset, Cr as isDOMElement, Ct as observeDataTransferInsertion, D as DOMEditor, Dn as getPliteTextHostBounds, Dr as isPlainTextOnlyPaste, E as verifyDiffState, En as getPliteStringPlacementDOMPoint$1, Er as isDOMText, F as resolveDOMPointInRoot, Fn as resolveDOMTextFlowEntry, Ft as recordSoftLineEnd, G as ensureFocusCaret, Gn as EDITOR_TO_FORCE_RENDER, Gt as isDOMSyncMutation, H as subscribeEditorDOMScope, I as resolveDOMRangeInRoot, In as resolveDOMTextFlowInsertTarget, It as resolveSoftLineEndDOMPoint, J as eventCarriesBlockFragment, Jn as EDITOR_TO_PENDING_DIFFS, Jt as scheduleEditorDOMPhase, K as liftCaretOutOfCollapsedSection, Kn as EDITOR_TO_KEY_TO_ELEMENT, Kt as markDOMSyncMutationTarget, L as resolveWrittenDOMRange, Ln as resolveDOMTextFlowOffset, Lt as findMountedDOMNodeByPath, M as getOrCreateDOMNodeKey, Mn as isDOMTextFlowSegmentSynchronized, Mt as noteAfterInsertCaret, N as isSelectableDOMSelection, Nn as readDOMTextFlowPaint, Nt as readAfterInsertCaret, On as getPliteTextHostStrings, Or as markPlainTextPaste, Ot as SOFT_LINE_FLAG, P as isTrackedMutation, Pn as releaseDOMTextFlowRecordIndex, Pt as readLowerSoftLineEnd, Qn as EDITOR_TO_ROOT_VIEW_EDITORS, Qt as getDOMRangeSelectionPoints, R as setEditableRootReveal, Rn as resolveDOMTextFlowRecordDOMText, Rt as resolvePliteNodePath, S as normalizePoint, Sn as getPliteStringDocumentOffset, T as targetRange, Tn as getPliteStringPlacementAtX, Tr as isDOMSelection, U as supersedeFocusRequest, Un as isCollapsedDOMCoverageBoundary, Ut as resolveDOMReach, V as setEditorDOMScrollElement, Vn as setDOMTextFlowRecordIndexes, Vt as findEditorDOMRootRuntime, W as writeViewSelectionPart, Wn as EDITOR_TO_ELEMENT, Wt as resolveDOMTargetView, X as getDragAutoScrollTarget, Xn as EDITOR_TO_PENDING_SELECTION, Xt as forgetDOMSelectionRecord, Y as resolveBlockFragmentDropRange, Yn as EDITOR_TO_PENDING_INSERTION_MARKS, Yt as changeDOMSelection, Zn as EDITOR_TO_PLACEHOLDER_ELEMENT, Zt as forgetDOMSelectionRecordWithin, _n as createDOMGeometryKernel, _r as getDefaultView, _t as domCommands, an as writeDOMSelection, ar as ELEMENT_TO_EDITOR, at as cancelDragRest, b as longestCommonPrefixLength, bn as getPliteStringCoordinatePlacement, cr as IS_FOCUSED, ct as isDragSessionClaimed, d as Hotkeys, dn as isAndroidDOMHost, dr as NODE_TO_ELEMENT, dt as settleDragSession, en as readDOMSelectionRange, er as EDITOR_TO_RUNTIME_ID_TO_KEY, et as indicateDOMDropTarget, f as getLineBoundaryKeyboardMove, fn as isBlinkDOMHost, fr as NODE_TO_INDEX, ft as takeDragSession, gn as usesAppleDOMHotkeys, gr as getActiveElement, hn as supportsDOMBeforeInput, hr as containsShadowAware, in as sameDOMSelectionPoints, ir as EDITOR_TO_WINDOW, it as beginDragSession, j as getEditorDOMHostScrollElement, jn as hasUsableDOMRect, jt as isSoftLineTextStale, k as createDOMEditorCapability, kn as getTextFlowPointAtCoordinates, kt as clearAfterInsertCaret, ln as getDOMHostLanguage, lr as IS_NODE_MAP_DIRTY, lt as readDragSession, mn as isWebKitDOMHost, nn as readsSelectionAsHost, nr as EDITOR_TO_USER_MARKS, nt as resolveDOMDropTarget, or as ELEMENT_TO_NODE, ot as clearDragScrollRepaint, p as isPasteWithoutFormatting, pn as isGeckoDOMHost, pr as NODE_TO_PARENT, pt as publishDropIndicator, q as resolveNextKeyCaret, qn as EDITOR_TO_PENDING_ACTION, qt as watchDOMSyncTextMarks, rn as recordDOMSelection, rr as EDITOR_TO_USER_SELECTION, rt as restDOMBlockDrag, sn as selectDOMInputDefaultActionPhase, sr as IS_COMPOSING, st as clearDragSession, tn as readDOMSelectionRecord, tr as EDITOR_TO_SCHEDULE_FLUSH, tt as pointAt, un as hasDOMHostQuirk, ur as IS_READ_ONLY, ut as setDragScrollRepaint, vn as getNearestPliteStringRect, vr as getFlatTreeParentElement, w as normalizeStringDiff, wn as getPliteStringLength, wr as isDOMNode, x as mergeStringDiffs, y as applyStringDiff, yn as getOwnedPliteTextStrings, yr as getSelection$1, yt as writeDOMDataTransferFragment, z as setEditorDOMEditableElement, zn as resolveDOMTextFlowRecordText, zt as DOMRootRuntime } from "./dom-CH2BXXj6.js";
6
+ import { t as nativeGroupingInput } from "./native-grouping-input-DXNhlPHd.js";
7
+ import { a as useRangeGeometryOwner, i as resolveRangeGeometry, o as useIsomorphicLayoutEffect, r as resolveDOMRangeGeometry, t as createRangeGeometryOwner } from "./range-geometry-CdltxcH6.js";
8
8
  import { n as releaseEditorViewLifetime } from "./editor-view-lifetime-GJKa_QGh.js";
9
9
  import * as React$1 from "react";
10
10
  import React, { Component, createContext, createElement, use, useCallback, useContext, useEffect, useInsertionEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
@@ -50,11 +50,15 @@ const useEditorFocused = () => useContext(FocusedContext);
50
50
  //#endregion
51
51
  //#region src/react/hooks/use-editor-read-only.ts
52
52
  const ReadOnlyContext = createContext(void 0);
53
+ const ViewLockScopeContext = createContext(void 0);
53
54
  /**
54
55
  * Share editor read-only state with shell components that render outside a
55
56
  * concrete `<Plite>` root.
56
57
  */
57
- const EditorReadOnlyProvider = ({ children, readOnly }) => createElement(ReadOnlyContext.Provider, { value: readOnly }, children);
58
+ const EditorReadOnlyProvider = ({ children, readOnly }) => {
59
+ const enclosingLock = useContext(ViewLockScopeContext);
60
+ return createElement(ReadOnlyContext.Provider, { value: readOnly }, createElement(ViewLockScopeContext.Provider, { value: readOnly === void 0 ? enclosingLock : void 0 }, children));
61
+ };
58
62
  /**
59
63
  * Return the nearest editor read-only state, or `undefined` when no provider is
60
64
  * active yet.
@@ -4983,10 +4987,10 @@ const selectEditableVoidPath = ({ editor, inputController, path }) => {
4983
4987
  selectionSource: "model-owned"
4984
4988
  });
4985
4989
  inputController.state.selectionChangeOrigin = "programmatic-export";
4986
- const range$6 = range(editor, point(editor, path, { edge: "start" }));
4990
+ const range$5 = range(editor, point(editor, path, { edge: "start" }));
4987
4991
  ReactEditor.focus(editor);
4988
4992
  writePliteViewSelection(editor, null);
4989
- dispatchCommand(editor, editorCommands.select, { target: range$6 });
4993
+ dispatchCommand(editor, editorCommands.select, { target: range$5 });
4990
4994
  return path;
4991
4995
  };
4992
4996
  const selectEditableSelectableOwnerPath = ({ editor, inputController, path }) => {
@@ -8486,48 +8490,6 @@ const resolveProjectedSelectionTarget = (editor, viewSelection) => {
8486
8490
  } : { kind: "stale" };
8487
8491
  };
8488
8492
  //#endregion
8489
- //#region src/react/editable/selection-triple-click.ts
8490
- const tripleClickedBlock = defineUpdateAnnotation({ key: "selection.triple-clicked-block" });
8491
- const readSelectionAnnotation = (editor, annotation, selection) => {
8492
- const commit = editor.read.lastCommit();
8493
- const value = commit?.annotations[annotation.key];
8494
- return value !== void 0 && RangeApi.isRange(commit?.selectionAfter) && RangeApi.equals(commit.selectionAfter, selection) ? value : null;
8495
- };
8496
- const readTripleClickedBlock = (editor, selection) => readSelectionAnnotation(editor, tripleClickedBlock, selection);
8497
- const getTripleClickRange = (editor, [node, path], point) => {
8498
- const blockEntry = NodeApi.isElement(node) && isBlock(editor, node) ? [node, path] : above(editor, {
8499
- at: path,
8500
- match: (n) => NodeApi.isElement(n) && isBlock(editor, n)
8501
- });
8502
- const blockPath = blockEntry?.[1] ?? path.slice(0, 1);
8503
- const lineRange = blockEntry && point ? getInnerLineRange(editor, blockEntry, point) : null;
8504
- if (lineRange) return {
8505
- block: null,
8506
- range: lineRange
8507
- };
8508
- const range$5 = range(editor, blockPath);
8509
- return {
8510
- block: editor.read((state) => getRemovableTripleClickedBlock(state, range$5)),
8511
- range: range$5
8512
- };
8513
- };
8514
- const exportTripleClickSelectionToDOM = ({ domPhaseScheduler, editor, inputController, range }) => {
8515
- const editorElement = EDITOR_TO_ELEMENT.get(editor);
8516
- if (!editorElement) return;
8517
- const domRange = resolveWrittenDOMRange(editor, range);
8518
- if (!domRange) return;
8519
- const root = editorElement.getRootNode();
8520
- if (!getSelection$1(root)) return;
8521
- inputController.state.isUpdatingSelection = true;
8522
- inputController.state.selectionChangeOrigin = "programmatic-export";
8523
- writeDOMSelection(root, getDOMRangeSelectionPoints(domRange, RangeApi.isBackward(range)));
8524
- editorElement.ownerDocument.dispatchEvent(new Event("selectionchange", { bubbles: true }));
8525
- const resetUpdatingSelection = () => {
8526
- inputController.state.isUpdatingSelection = false;
8527
- };
8528
- domPhaseScheduler.schedule("selection-repair", "triple-click-selection-settle", resetUpdatingSelection, { timing: "timeout" });
8529
- };
8530
- //#endregion
8531
8493
  //#region src/react/editable/mutation-controller.ts
8532
8494
  const applyModelOwnedDeleteIntent = ({ direction, editor, unit }) => {
8533
8495
  dispatchCommand(editor, editorCommands.delete, {
@@ -8673,6 +8635,7 @@ const applyProjectedViewSelectionDataCommand = ({ data, editor }) => {
8673
8635
  return false;
8674
8636
  }
8675
8637
  const { target } = resolution;
8638
+ let replaced = false;
8676
8639
  const pasted = withAuthoredUpdateView(editor, editor, () => editor.read((state) => {
8677
8640
  const deletion = state.transaction(() => {
8678
8641
  deleteProjectedRangesToStart(editor, target, (range) => {
@@ -8682,6 +8645,7 @@ const applyProjectedViewSelectionDataCommand = ({ data, editor }) => {
8682
8645
  }).result);
8683
8646
  });
8684
8647
  });
8648
+ replaced = !deletion.changes.empty;
8685
8649
  return continueTransactionSpecOrDiscardPrefix(runtimeEditor, deletion, () => {
8686
8650
  const evaluation = {};
8687
8651
  const insertion = state.transaction(() => {
@@ -8692,7 +8656,7 @@ const applyProjectedViewSelectionDataCommand = ({ data, editor }) => {
8692
8656
  }));
8693
8657
  if (!pasted) return true;
8694
8658
  watchProjectedHistoryRanges(editor);
8695
- const landed = editor.update({ tags: "paste" }, () => {
8659
+ const landed = editor.update({ tags: replaced ? ["paste", "replace-range"] : "paste" }, () => {
8696
8660
  getDefined(getActiveEditorTransaction(editor)).annotations.set(projectedHistoryRange, viewSelection);
8697
8661
  applyTransactionSpec(runtimeEditor, pasted);
8698
8662
  return true;
@@ -8842,11 +8806,6 @@ const applyEditableCommand = ({ command, editor, element = null }) => {
8842
8806
  return true;
8843
8807
  }
8844
8808
  const expanded = selection && RangeApi.isRange(selection) && RangeApi.isExpanded(selection) ? selection : null;
8845
- const block = expanded && readTripleClickedBlock(editor, expanded);
8846
- if (block) {
8847
- editor.update((tx) => deleteTripleClickedBlock(tx, block, command.direction ?? "forward"));
8848
- return true;
8849
- }
8850
8809
  dispatchCommand(editor, editorCommands.deleteFragment, {
8851
8810
  ...expanded ? { at: expanded } : {},
8852
8811
  direction: command.direction ?? "forward"
@@ -13640,6 +13599,40 @@ const isPointInsideDOMSelection = ({ clientX, clientY, target }) => {
13640
13599
  const needsMouseUpDOMSelectionReplay = (target) => isGeckoDOMHost(target);
13641
13600
  const shouldReplayMouseUpDOMSelection = ({ hasExpandedDOMRange, isFirefox, nativeSelectedTextClick, pointerMoved }) => hasExpandedDOMRange && isFirefox && pointerMoved && !nativeSelectedTextClick;
13642
13601
  //#endregion
13602
+ //#region src/react/editable/selection-triple-click.ts
13603
+ const getTripleClickRange = (editor, [node, path], point) => {
13604
+ const blockEntry = NodeApi.isElement(node) && isBlock(editor, node) ? [node, path] : above(editor, {
13605
+ at: path,
13606
+ match: (n) => NodeApi.isElement(n) && isBlock(editor, n)
13607
+ });
13608
+ const blockPath = blockEntry?.[1] ?? path.slice(0, 1);
13609
+ const lineRange = blockEntry && point ? getInnerLineRange(editor, blockEntry, point) : null;
13610
+ if (lineRange) return {
13611
+ block: null,
13612
+ range: lineRange
13613
+ };
13614
+ return {
13615
+ block: editor.read((state) => state.key(blockPath)),
13616
+ range: range(editor, blockPath)
13617
+ };
13618
+ };
13619
+ const exportTripleClickSelectionToDOM = ({ domPhaseScheduler, editor, inputController, range }) => {
13620
+ const editorElement = EDITOR_TO_ELEMENT.get(editor);
13621
+ if (!editorElement) return;
13622
+ const domRange = resolveWrittenDOMRange(editor, range);
13623
+ if (!domRange) return;
13624
+ const root = editorElement.getRootNode();
13625
+ if (!getSelection$1(root)) return;
13626
+ inputController.state.isUpdatingSelection = true;
13627
+ inputController.state.selectionChangeOrigin = "programmatic-export";
13628
+ writeDOMSelection(root, getDOMRangeSelectionPoints(domRange, RangeApi.isBackward(range)));
13629
+ editorElement.ownerDocument.dispatchEvent(new Event("selectionchange", { bubbles: true }));
13630
+ const resetUpdatingSelection = () => {
13631
+ inputController.state.isUpdatingSelection = false;
13632
+ };
13633
+ domPhaseScheduler.schedule("selection-repair", "triple-click-selection-settle", resetUpdatingSelection, { timing: "timeout" });
13634
+ };
13635
+ //#endregion
13643
13636
  //#region src/react/editable/placed-drag.ts
13644
13637
  const isTapOnTextBlock = (event, target) => event.nativeEvent.sourceCapabilities?.firesTouchEvents === true && target instanceof HTMLElement && target.isContentEditable && !target.matches("[data-editor-void=\"true\"]") && target.querySelector("[data-editor-node=\"text\"]")?.closest("[data-editor-node=\"element\"]") === target;
13645
13638
  const isInsideVoid = (element) => element.closest("[data-editor-void=\"true\"]") !== null;
@@ -14823,7 +14816,7 @@ const useRootInteractionController = ({ disabled, editor, getMountedViewEditor,
14823
14816
  })?.focus : null;
14824
14817
  if (!placement || !point) return false;
14825
14818
  const gecko = isGeckoDOMHost(event.nativeEvent);
14826
- const word = shiftFrom ? readSelectionAnnotation(view, placedSelectionWord, shiftFrom) : null;
14819
+ const word = shiftFrom ? view.read((state) => readLastCommitAnnotation(state, placedSelectionWord, shiftFrom)) : null;
14827
14820
  const kind = word && !gecko ? "word" : press.kind;
14828
14821
  const spanFrom = shiftFrom ? getShiftSpanFrom({
14829
14822
  editor: view,
@@ -16062,66 +16055,20 @@ function useRootState(root, selector, { deferred, equalityFn, shouldUpdate } = {
16062
16055
  }
16063
16056
  const findRootViewEditor = ({ getMountedViewEditor, mountedEditor, presentation, runtime }, root) => (mountedEditor && presentation ? readNestedRootView(runtime, presentation, root, mountedEditor) : null) ?? getMountedViewEditor(root);
16064
16057
  function createPliteRootEditor(lookups, root, readOnly) {
16065
- const { getView, mountedEditor, presentation, runtime } = lookups;
16058
+ const { getView, mountedEditor, presentation } = lookups;
16066
16059
  const shownRoot = root ?? "main";
16067
- const owner = getEditorRuntimeOwner(runtime);
16068
- const caretPresentation = () => {
16069
- const caret = getCaretOwner(owner);
16070
- return caret && presentation && caret.presentation !== presentation && toInternalRoot(caret.root) === shownRoot && !showsRootView(runtime, presentation) ? caret.presentation : void 0;
16071
- };
16072
- const caretArea = () => {
16073
- const shownIn = caretPresentation();
16074
- const target = shownIn && readRootTarget(runtime, shownIn, shownRoot);
16075
- return target?.shown ? target.view : void 0;
16076
- };
16077
- const subscribeCaretArea = (listener) => {
16078
- let area = { stop: () => {} };
16079
- const follow = () => {
16080
- const shownIn = caretPresentation();
16081
- if (shownIn === area.shownIn) return false;
16082
- area.stop();
16083
- area = {
16084
- shownIn,
16085
- stop: shownIn ? subscribeRootTarget(runtime, shownIn, shownRoot, () => {
16086
- follow();
16087
- listener();
16088
- }) : () => {}
16089
- };
16090
- return true;
16091
- };
16092
- follow();
16093
- const stopCaret = subscribeCaretTarget(owner, () => {
16094
- if (!(area.shownIn && !isViewPresentationRetained(area.shownIn)) && follow()) listener();
16095
- });
16096
- return () => {
16097
- stopCaret();
16098
- area.stop();
16099
- };
16100
- };
16101
16060
  return createReactRuntimeViewEditor(getView({
16102
16061
  readOnly,
16103
16062
  root
16104
16063
  }, presentation ?? void 0, {
16105
- current: () => (mountedEditor?.read.view.isReadOnly() ? void 0 : caretArea()) ?? findRootViewEditor(lookups, shownRoot) ?? mountedEditor ?? void 0,
16064
+ current: () => findRootViewEditor(lookups, shownRoot) ?? mountedEditor ?? void 0,
16106
16065
  subscribe: (listener) => {
16107
16066
  const stopTarget = lookups.subscribeRootTarget(shownRoot, listener);
16108
16067
  if (!mountedEditor || !presentation) return stopTarget;
16109
- let stopCaretArea;
16110
- const followCaretArea = () => {
16111
- if (showsRootView(runtime, presentation)) {
16112
- stopCaretArea?.();
16113
- stopCaretArea = void 0;
16114
- } else stopCaretArea ??= subscribeCaretArea(listener);
16115
- };
16116
- const stopOwn = subscribeRootViewPresentation(presentation, () => {
16117
- followCaretArea();
16118
- listener();
16119
- });
16120
- followCaretArea();
16068
+ const stopOwn = subscribeRootViewPresentation(presentation, listener);
16121
16069
  return () => {
16122
16070
  stopTarget();
16123
16071
  stopOwn();
16124
- stopCaretArea?.();
16125
16072
  };
16126
16073
  }
16127
16074
  }));
@@ -16135,15 +16082,12 @@ function createPliteRootEditor(lookups, root, readOnly) {
16135
16082
  * It obeys the read-only state and the authored view of the mounted view that
16136
16083
  * shows its root, and of the view around the hook while none shows it. Inside
16137
16084
  * a view, that mounted view is the one this view mounts for the root, such as
16138
- * its own board when two editing areas show the same board. While its
16139
- * `EditorRoot` is writable, shows no editing area and the caret is in its
16140
- * root, it follows the editing area that holds the caret, for that area's DOM
16141
- * and the read-only state of that area's `EditorRoot`. It keeps its own
16142
- * `EditorRoot`'s authored view there, and a write that places the caret, even
16143
- * where the caret already is, moves the caret into its own `EditorRoot`, which
16144
- * ends the follow. Use it for root-specific toolbar/sidebar commands. Pass
16145
- * `readOnly: true` when UI only needs read APIs. Exact plugin capability comes
16146
- * from `editor.plugin(Plugin)`.
16085
+ * its own board when two editing areas show the same board. It acts only
16086
+ * under its own `EditorRoot`, so while that `EditorRoot` shows no editing
16087
+ * area for its root, `api.dom.editable()` returns `null`, even when an
16088
+ * editing area in another `EditorRoot` holds the caret. Use it for
16089
+ * root-specific toolbar/sidebar commands. Pass `readOnly: true` when UI only
16090
+ * needs read APIs. Exact plugin capability comes from `editor.plugin(Plugin)`.
16147
16091
  */
16148
16092
  function useRootEditor(root, options = {}) {
16149
16093
  if (root === "main") throw new Error("Omit root to create an editor for the primary document.");
@@ -22050,20 +21994,28 @@ const useRuntimeBeforeInputEvents = ({ androidInputManagerRef, deferNativeTextIn
22050
21994
  //#endregion
22051
21995
  //#region src/core/fragment-deleted-range.ts
22052
21996
  const resolveFragmentDeletedRange = (editor, range) => {
22053
- const wholeBlocks = editor.read((state) => readWholeBlockDelete(state, range, void 0));
22054
- if (!wholeBlocks || wholeBlocks.endsInFirst) return resolveDeletedRange(editor, range);
22055
- const [first] = getDefined(wholeBlocks.blocks[0]);
22056
- const [last] = getDefined(wholeBlocks.blocks.at(-1));
22057
- if (!wholeBlocks.takesCaret || !first.children.some(NodeApi.isText)) return null;
22058
- const anchor = RangeApi.start(range);
22059
- const focus = getDefined(editor.read((state) => state.points.end(state.key(wholeBlocks.blocks.length > 1 ? last : first))));
22060
- return wholeBlocks.blocks.length > 1 ? {
22061
- anchor,
22062
- focus
22063
- } : resolveDeletedRange(editor, {
22064
- anchor,
22065
- focus
22066
- });
21997
+ const landing = editor.read((state) => readWholeBlockLanding(state, range, {
21998
+ root: range.anchor.root ?? range.focus.root ?? getEditorUpdateRoot(editor),
21999
+ tripleClicked: readLastCommitAnnotation(state, tripleClickedBlock, range)
22000
+ }));
22001
+ if (!landing) return resolveDeletedRange(editor, range);
22002
+ if (landing.keeps === "default") {
22003
+ const [first, ...rest] = landing.blocks.map(([, path]) => path);
22004
+ const firstPath = getDefined(first);
22005
+ return landing.whole && firstPath.length === 1 ? SelectionApi.nodes([firstPath, ...rest], { mode: "block" }) : null;
22006
+ }
22007
+ if (landing.keeps !== "first") return range;
22008
+ const { blocks, spansLines, text } = landing;
22009
+ const [, firstPath] = getDefined(blocks[0]);
22010
+ if (blocks.length > 1) {
22011
+ const [, lastPath] = getDefined(blocks.at(-1));
22012
+ return {
22013
+ anchor: RangeApi.start(range),
22014
+ focus: getDefined(editor.read((state) => state.points.end(lastPath)))
22015
+ };
22016
+ }
22017
+ if (RangeApi.isCollapsed(text)) return text;
22018
+ return spansLines && firstPath.length === 1 && !RangeApi.equals(text, range) ? null : resolveDeletedRange(editor, text);
22067
22019
  };
22068
22020
  //#endregion
22069
22021
  //#region src/react/editable/projected-clipboard.ts
@@ -22287,13 +22239,13 @@ const applyEditableCopy = ({ editor, event, onCopy }) => {
22287
22239
  }
22288
22240
  };
22289
22241
  const readCutDeletedRange = (editor, selection) => {
22290
- if (RangeApi.isCollapsed(selection) || selection.anchor.root || selection.focus.root || readTripleClickedBlock(editor, selection)) return null;
22242
+ if (RangeApi.isCollapsed(selection) || selection.anchor.root || selection.focus.root) return null;
22291
22243
  const removed = resolveFragmentDeletedRange(editor, selection);
22292
22244
  const [start, end] = RangeApi.edges(selection);
22293
- return removed && !RangeApi.equals(removed, {
22245
+ return removed && (SelectionApi.isNode(removed) || !RangeApi.equals(removed, {
22294
22246
  anchor: start,
22295
22247
  focus: end
22296
- }) ? removed : null;
22248
+ })) ? removed : null;
22297
22249
  };
22298
22250
  const applyEditableCut = ({ editor, event, onCut, readOnly }) => {
22299
22251
  const clipboardData = event.clipboardData ?? event.nativeEvent.clipboardData;
@@ -23232,6 +23184,10 @@ const useRuntimeDragEvents = ({ editor, inputController, onDragEnd, onDragOver,
23232
23184
  };
23233
23185
  //#endregion
23234
23186
  //#region src/react/editable/runtime-focus-mouse-events.ts
23187
+ const hasDOMCaretIn = (element) => {
23188
+ const anchorNode = getSelection$1(element.getRootNode())?.anchorNode;
23189
+ return !!anchorNode && element.contains(anchorNode);
23190
+ };
23235
23191
  const useRuntimeFocusMouseEvents = ({ cancelNativeSelectionImport, clearVerticalGoal, domPhaseScheduler, editor, flushPendingNativeTextInput, inputController, onBlur, onClick, onFocus, onMouseDown, onMouseUp, publishFocusState, readOnly, selection, state, syncDOMSelectionToEditor, trace }) => {
23236
23192
  const nativeInternalFocusRef = useRef(false);
23237
23193
  const nativePointerFocusRef = useRef(false);
@@ -23338,11 +23294,19 @@ const useRuntimeFocusMouseEvents = ({ cancelNativeSelectionImport, clearVertical
23338
23294
  const syncProgrammaticFocusSelection = () => {
23339
23295
  if (ReactEditor.isFocused(editor)) syncDOMSelectionToEditor();
23340
23296
  };
23297
+ let placedStartCaret = false;
23298
+ const lacksAnyCaret = () => mayClearCaret(editor) && !resolveLiveCaret(editor) && !readPliteViewSelection(editor) && !hasDOMCaretIn(editorElement);
23299
+ const fillStartCaretOnceFocusSettles = () => {
23300
+ if (!ReactEditor.isFocused(editor)) return;
23301
+ if (!readOnly && !placedStartCaret && lacksAnyCaret()) editor.update({ tags: "skip-scroll-into-view" }, () => {
23302
+ placedStartCaret = !ensureFocusCaret(editor, editorElement);
23303
+ });
23304
+ if (!placedStartCaret || !hasDOMCaretIn(editorElement)) syncDOMSelectionToEditor();
23305
+ };
23341
23306
  nativeInternalFocusRef.current = false;
23342
- if (!readOnly && !readPliteViewSelection(editor)) ensureFocusCaret(editor, editorElement);
23343
23307
  syncProgrammaticFocusSelection();
23344
- domPhaseScheduler.schedule("selection-repair", "programmatic-focus-selection-microtask", syncProgrammaticFocusSelection, { timing: "microtask" });
23345
- domPhaseScheduler.schedule("selection-repair", "programmatic-focus-selection-timeout", syncProgrammaticFocusSelection, { timing: "timeout" });
23308
+ domPhaseScheduler.schedule("selection-repair", "programmatic-focus-selection-microtask", fillStartCaretOnceFocusSettles, { timing: "microtask" });
23309
+ domPhaseScheduler.schedule("selection-repair", "programmatic-focus-selection-timeout", fillStartCaretOnceFocusSettles, { timing: "timeout" });
23346
23310
  }
23347
23311
  publishFocusState();
23348
23312
  }, [
@@ -27165,11 +27129,14 @@ const EditorRootContent = (props) => {
27165
27129
  root: initialRoot === "main" ? void 0 : initialRoot
27166
27130
  };
27167
27131
  }, [editor]);
27132
+ const enclosingLock = useContext(ViewLockScopeContext);
27168
27133
  const carried = getCarriedMount(editor);
27134
+ const followsEnclosingLock = carried !== void 0 && !carried.mountedIn;
27169
27135
  const content = /* @__PURE__ */ jsx(EditorRuntimeView, {
27170
27136
  ...viewProps,
27171
27137
  authored: carried ? void 0 : props.authored ?? defaults.authored,
27172
27138
  lifetime: editor,
27139
+ lockLink: followsEnclosingLock ? enclosingLock : void 0,
27173
27140
  mountedIn: carried?.mountedIn,
27174
27141
  presentation: carried?.presentation,
27175
27142
  readOnly: props.readOnly ?? defaults.readOnly,
@@ -27180,12 +27147,13 @@ const EditorRootContent = (props) => {
27180
27147
  children: content
27181
27148
  });
27182
27149
  };
27183
- const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, onSelectionChange, onValueChange, readOnly = false, root, directEditor, lifetime, mountedIn, presentation }) => {
27150
+ const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, onSelectionChange, onValueChange, readOnly = false, root, directEditor, lifetime, lockLink, mountedIn, presentation }) => {
27184
27151
  const { getView, registerHistoryStepView, registerViewEditor } = useRequiredPliteRuntimeContext();
27185
27152
  const parentEditor = useOptionalEditorContext();
27186
27153
  const inheritedTextFlow = useContext(ImperativeTextFlowContext);
27187
27154
  const contentRootOwner = useContext(PliteContentRootOwnerContext);
27188
27155
  const { selectorContext, onChange } = useEditorSelectorContext();
27156
+ const [lockScope] = useState(() => createViewLockScope(readOnly));
27189
27157
  const editor = useMemo(() => {
27190
27158
  if (directEditor) return directEditor;
27191
27159
  return createReactRuntimeViewEditor(getView({
@@ -27210,13 +27178,26 @@ const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, o
27210
27178
  }, [authored && ("intent" in authored ? authored.intent : authored.preview), reactEditor]);
27211
27179
  useInsertionEffect(() => {
27212
27180
  if (directEditor) return void 0;
27213
- setEditorReadOnly(reactEditor, readOnly);
27214
27181
  return () => setEditorReadOnly(reactEditor, true);
27182
+ }, [directEditor, reactEditor]);
27183
+ useInsertionEffect(() => {
27184
+ setViewLockScopeLocked(lockScope, readOnly);
27185
+ if (!directEditor) setEditorReadOnly(reactEditor, readOnly);
27215
27186
  }, [
27216
27187
  directEditor,
27188
+ lockScope,
27217
27189
  reactEditor,
27218
27190
  readOnly
27219
27191
  ]);
27192
+ useInsertionEffect(() => directEditor ? void 0 : joinViewLockScope(lockScope, reactEditor), [
27193
+ directEditor,
27194
+ lockScope,
27195
+ reactEditor
27196
+ ]);
27197
+ useInsertionEffect(() => {
27198
+ linkViewLockScope(lockScope, lockLink);
27199
+ }, [lockLink, lockScope]);
27200
+ useInsertionEffect(() => () => linkViewLockScope(lockScope, void 0), [lockScope]);
27220
27201
  const viewRoot = toInternalRoot(editor.read((state) => state.view.root()));
27221
27202
  const { focused: isFocused } = useRuntimeFocusState(reactEditor);
27222
27203
  useInsertionEffect(() => registerHistoryStepView(reactEditor, viewRoot), [
@@ -27231,7 +27212,13 @@ const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, o
27231
27212
  ]);
27232
27213
  useIsomorphicLayoutEffect(() => {
27233
27214
  flushEditorViewState(reactEditor);
27234
- }, [reactEditor, readOnly]);
27215
+ flushViewLockScope(lockScope);
27216
+ }, [
27217
+ lockLink,
27218
+ lockScope,
27219
+ reactEditor,
27220
+ readOnly
27221
+ ]);
27235
27222
  const hasViewSelection = usePliteViewSelectionPresence(reactEditor);
27236
27223
  const viewSelectionDecoration = useMemo(() => createPliteViewSelectionDecorationSource(reactEditor, contentRootOwner), [contentRootOwner, reactEditor]);
27237
27224
  const allDecorations = useMemo(() => hasViewSelection ? [...decorations ?? [], viewSelectionDecoration] : decorations ?? [], [
@@ -27243,33 +27230,46 @@ const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, o
27243
27230
  const registerDecorationSource = useDecorationRegistrar(decorationManager);
27244
27231
  return /* @__PURE__ */ jsxs(EditorSelectorContext, {
27245
27232
  value: selectorContext,
27246
- children: [/* @__PURE__ */ jsx(FirstChildViewStart, {
27247
- editor: reactEditor,
27248
- onChange,
27249
- onCommit,
27250
- onSelectionChange,
27251
- onValueChange,
27252
- root: viewRoot
27253
- }), /* @__PURE__ */ jsx(DecorationContext, {
27254
- value: decorationManager,
27255
- children: /* @__PURE__ */ jsx(DecorationRegistrationContext, {
27256
- value: registerDecorationSource,
27257
- children: /* @__PURE__ */ jsx(DecorationSourcesContext, {
27258
- value: decorations,
27259
- children: /* @__PURE__ */ jsx(EditorContext, {
27260
- value: reactEditor,
27261
- children: /* @__PURE__ */ jsx(ReadOnlyContext, {
27262
- value: readOnly,
27263
- children: /* @__PURE__ */ jsx(FocusedContext, {
27264
- value: isFocused,
27265
- children: /* @__PURE__ */ jsx(ImperativeTextFlowContext, {
27266
- value: parentEditor ? true : inheritedTextFlow,
27267
- children: /* @__PURE__ */ jsx(TextRenderScopeContext, {
27268
- value: "flat",
27269
- children: /* @__PURE__ */ jsx(SurfaceRuntimeScope, {
27270
- mountedEditor: reactEditor,
27271
- presentation: viewPresentation,
27272
- children
27233
+ children: [
27234
+ /* @__PURE__ */ jsx(ViewReadOnlyLock, {
27235
+ editor: reactEditor,
27236
+ link: lockLink,
27237
+ readOnly,
27238
+ scope: lockScope,
27239
+ skip: Boolean(directEditor)
27240
+ }),
27241
+ /* @__PURE__ */ jsx(FirstChildViewStart, {
27242
+ editor: reactEditor,
27243
+ onChange,
27244
+ onCommit,
27245
+ onSelectionChange,
27246
+ onValueChange,
27247
+ root: viewRoot
27248
+ }),
27249
+ /* @__PURE__ */ jsx(DecorationContext, {
27250
+ value: decorationManager,
27251
+ children: /* @__PURE__ */ jsx(DecorationRegistrationContext, {
27252
+ value: registerDecorationSource,
27253
+ children: /* @__PURE__ */ jsx(DecorationSourcesContext, {
27254
+ value: decorations,
27255
+ children: /* @__PURE__ */ jsx(EditorContext, {
27256
+ value: reactEditor,
27257
+ children: /* @__PURE__ */ jsx(ReadOnlyContext, {
27258
+ value: readOnly,
27259
+ children: /* @__PURE__ */ jsx(FocusedContext, {
27260
+ value: isFocused,
27261
+ children: /* @__PURE__ */ jsx(ImperativeTextFlowContext, {
27262
+ value: parentEditor ? true : inheritedTextFlow,
27263
+ children: /* @__PURE__ */ jsx(TextRenderScopeContext, {
27264
+ value: "flat",
27265
+ children: /* @__PURE__ */ jsx(SurfaceRuntimeScope, {
27266
+ mountedEditor: reactEditor,
27267
+ presentation: viewPresentation,
27268
+ children: /* @__PURE__ */ jsx(ViewLockScopeContext, {
27269
+ value: lockScope,
27270
+ children
27271
+ })
27272
+ })
27273
27273
  })
27274
27274
  })
27275
27275
  })
@@ -27278,9 +27278,25 @@ const EditorRuntimeView = ({ authored, children, decorations = null, onCommit, o
27278
27278
  })
27279
27279
  })
27280
27280
  })
27281
- })]
27281
+ ]
27282
27282
  });
27283
27283
  };
27284
+ var ViewReadOnlyLock = class extends Component {
27285
+ getSnapshotBeforeUpdate(prev) {
27286
+ const { editor, link, readOnly, scope, skip } = this.props;
27287
+ if (prev.link !== link) linkViewLockScope(scope, link);
27288
+ if (!readOnly) return null;
27289
+ if (!prev.skip && prev.editor !== editor) setEditorReadOnly(prev.editor, true);
27290
+ if (prev.editor === editor && prev.readOnly) return null;
27291
+ setViewLockScopeLocked(scope, true);
27292
+ if (!skip) setEditorReadOnly(editor, true);
27293
+ return null;
27294
+ }
27295
+ componentDidUpdate() {}
27296
+ render() {
27297
+ return null;
27298
+ }
27299
+ };
27284
27300
  const FirstChildViewStart = (props) => {
27285
27301
  usePliteChangeCallbacks(props);
27286
27302
  useIsomorphicLayoutEffect(() => {
@@ -1,2 +1,2 @@
1
- import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs } from "../index-Cw-oC2ps.js";
1
+ import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs } from "../index-UrB4jAwl.js";
2
2
  export { type YjsAdmissionStatus, type YjsAwarenessChange, type YjsAwarenessLike, type YjsAwarenessState, type YjsCursorDataSchema, type YjsInitialReadiness, type YjsPluginOptions, type YjsRemoteCursor, type YjsRemoteCursorData, YjsUpdatePolicy, yjs };
package/dist/yjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { r as YjsUpdatePolicy, t as yjs } from "../yjs-DOK-m7kl.js";
1
+ import { r as YjsUpdatePolicy, t as yjs } from "../yjs-IGE0Al3n.js";
2
2
  export { YjsUpdatePolicy, yjs };
@@ -1,6 +1,6 @@
1
- import "../../index-DpltOCot.js";
2
- import { t as RangeGeometry } from "../../range-geometry-BLAHRE11.js";
3
- import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, o as YjsBaseApi, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs, u as YjsPresenceApi } from "../../index-Cw-oC2ps.js";
1
+ import "../../index-BXjLmx1n.js";
2
+ import { t as RangeGeometry } from "../../range-geometry-Dwp2oyCc.js";
3
+ import { a as YjsAwarenessState, c as YjsInitialReadiness, d as YjsRemoteCursor, f as YjsRemoteCursorData, i as YjsAwarenessLike, l as YjsPluginOptions, n as YjsAdmissionStatus, o as YjsBaseApi, p as YjsUpdatePolicy, r as YjsAwarenessChange, s as YjsCursorDataSchema, t as yjs, u as YjsPresenceApi } from "../../index-UrB4jAwl.js";
4
4
  import { RefObject } from "react";
5
5
  import "yjs";
6
6
  //#region src/yjs/react/useYjs.d.ts
@@ -1,6 +1,6 @@
1
- import { wu as getEditorRuntimeOwner } from "../../plugin-DWzkJbnJ.js";
2
- import { a as useRangeGeometryOwner, t as createRangeGeometryOwner } from "../../range-geometry-BjeLHOnl.js";
3
- import { n as getActiveYjsBinding, r as YjsUpdatePolicy, t as yjs } from "../../yjs-DOK-m7kl.js";
1
+ import { wu as getEditorRuntimeOwner } from "../../plugin-SR3HTH0j.js";
2
+ import { a as useRangeGeometryOwner, t as createRangeGeometryOwner } from "../../range-geometry-CdltxcH6.js";
3
+ import { n as getActiveYjsBinding, r as YjsUpdatePolicy, t as yjs } from "../../yjs-IGE0Al3n.js";
4
4
  import { useCallback, useMemo, useSyncExternalStore } from "react";
5
5
  //#region src/yjs/react/useYjs.ts
6
6
  const getYjsCursorCache = (editor) => {