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.
- package/dist/annotations/index.d.ts +1 -1
- package/dist/annotations/index.js +1 -1
- package/dist/authored/index.d.ts +2 -2
- package/dist/authored/index.js +168 -46
- package/dist/{authored-veto-DSnQcHGR.js → authored-veto-D_9wCJcK.js} +1 -1
- package/dist/{comparison-plan-CEQL0ooW.js → comparison-plan-DY_vuGPq.js} +1 -1
- package/dist/{comparison-types-Dt-unJZY.d.ts → comparison-types-DdwE6mYq.d.ts} +1 -1
- package/dist/{create-editor-CkHtPWXV.js → create-editor-CLQEkEZ1.js} +2 -1
- package/dist/diff/index.d.ts +2 -2
- package/dist/diff/index.js +2 -2
- package/dist/dom/index.d.ts +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/{dom-Cgfscvnm.js → dom-CH2BXXj6.js} +2 -2
- package/dist/{editor-owner-IUmkTeXz.js → editor-owner-C9rVbMTs.js} +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.js +2 -2
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/hyperscript/index.js +1 -1
- package/dist/{hyperscript-FPuoArEi.js → hyperscript-CeT83ZLB.js} +2 -2
- package/dist/{index-DPWyk3lG.d.ts → index-BWPcE4ac.d.ts} +7 -1
- package/dist/{index-DpltOCot.d.ts → index-BXjLmx1n.d.ts} +101 -27
- package/dist/{index-K0Za9YXc.d.ts → index-DVMNewDn.d.ts} +10 -13
- package/dist/{index-BpQx2UG4.d.ts → index-Db-ktCTE.d.ts} +5 -6
- package/dist/{index-HPYawTae.d.ts → index-Dq3Jlj8O.d.ts} +1 -1
- package/dist/{index-Cw-oC2ps.d.ts → index-UrB4jAwl.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +4 -4
- package/dist/{mapped-view-store-ld-6uxEU.js → mapped-view-store-CbWqba_1.js} +1 -1
- package/dist/{native-grouping-input-DMNcsIaW.js → native-grouping-input-DXNhlPHd.js} +1 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/react.d.ts +2 -2
- package/dist/pagination/react.js +5 -5
- package/dist/{pagination-D_A8iPJP.js → pagination-CBdYiOuR.js} +1 -1
- package/dist/{plugin-DWzkJbnJ.js → plugin-SR3HTH0j.js} +1458 -952
- package/dist/{range-geometry-BjeLHOnl.js → range-geometry-CdltxcH6.js} +2 -2
- package/dist/{range-geometry-BLAHRE11.d.ts → range-geometry-Dwp2oyCc.d.ts} +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +6 -6
- package/dist/react/virtualized.d.ts +2 -2
- package/dist/react/virtualized.js +1 -1
- package/dist/{react-DZ15gmz2.js → react-CN-iBh1z.js} +8 -8
- package/dist/{retraction-BMem8Rfk.js → retraction-BmPJB9cE.js} +1 -1
- package/dist/{src-cT1OTKP_.js → src-B-zm0kz4.js} +128 -3
- package/dist/{store-Cz2mXyDe.js → store-51r4zpCR.js} +24 -11
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +3 -3
- package/dist/{use-editor-dom-scope-BbMDSCpW.js → use-editor-dom-scope-uDJQ692F.js} +184 -168
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/index.js +1 -1
- package/dist/yjs/react/index.d.ts +3 -3
- package/dist/yjs/react/index.js +3 -3
- package/dist/{yjs-DOK-m7kl.js → yjs-IGE0Al3n.js} +5 -2
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import { g as getScreenReaderAnnouncements, h as getTextRunBetweenAtomics, m as projectRangeInSnapshot } from "./create-editor-
|
|
3
|
-
import { n as startOwnedEditor, r as sameResult } from "./editor-owner-
|
|
4
|
-
import { r as createViewSourceFaultBoundary } from "./mapped-view-store-
|
|
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-
|
|
6
|
-
import { t as nativeGroupingInput } from "./native-grouping-input-
|
|
7
|
-
import { a as useRangeGeometryOwner, i as resolveRangeGeometry, o as useIsomorphicLayoutEffect, r as resolveDOMRangeGeometry, t as createRangeGeometryOwner } from "./range-geometry-
|
|
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 }) =>
|
|
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$
|
|
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$
|
|
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 ?
|
|
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
|
|
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: () =>
|
|
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
|
-
|
|
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.
|
|
16139
|
-
* `EditorRoot
|
|
16140
|
-
*
|
|
16141
|
-
*
|
|
16142
|
-
*
|
|
16143
|
-
*
|
|
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
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
if (!
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
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
|
|
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",
|
|
23345
|
-
domPhaseScheduler.schedule("selection-repair", "programmatic-focus-selection-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
|
-
|
|
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: [
|
|
27247
|
-
|
|
27248
|
-
|
|
27249
|
-
|
|
27250
|
-
|
|
27251
|
-
|
|
27252
|
-
|
|
27253
|
-
|
|
27254
|
-
|
|
27255
|
-
|
|
27256
|
-
|
|
27257
|
-
|
|
27258
|
-
|
|
27259
|
-
|
|
27260
|
-
|
|
27261
|
-
|
|
27262
|
-
|
|
27263
|
-
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27268
|
-
|
|
27269
|
-
|
|
27270
|
-
|
|
27271
|
-
|
|
27272
|
-
|
|
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(() => {
|
package/dist/yjs/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
1
|
+
import { r as YjsUpdatePolicy, t as yjs } from "../yjs-IGE0Al3n.js";
|
|
2
2
|
export { YjsUpdatePolicy, yjs };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../index-
|
|
2
|
-
import { t as RangeGeometry } from "../../range-geometry-
|
|
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-
|
|
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
|
package/dist/yjs/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { wu as getEditorRuntimeOwner } from "../../plugin-
|
|
2
|
-
import { a as useRangeGeometryOwner, t as createRangeGeometryOwner } from "../../range-geometry-
|
|
3
|
-
import { n as getActiveYjsBinding, r as YjsUpdatePolicy, t as yjs } from "../../yjs-
|
|
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) => {
|