plitejs 54.0.0-beta.7 → 54.0.0-beta.8
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/authored/index.d.ts +44 -41
- package/dist/authored/index.js +16489 -16181
- package/dist/{authored-veto-CferDljr.js → authored-veto-DLmBMIcy.js} +1 -1
- package/dist/{clipboard-format-key-CLFcThXH.js → clipboard-format-key-SzffxWqa.js} +1 -1
- package/dist/{comparison-plan-7iIABSWG.js → comparison-plan-BqFJWjO4.js} +36 -14
- package/dist/{create-editor-acDgsovY.js → create-editor-kU8fg-PF.js} +6 -30
- package/dist/diff/index.d.ts +2 -32
- package/dist/diff/index.js +7 -378
- package/dist/dom/index.d.ts +2 -2
- package/dist/dom/index.js +2 -2
- package/dist/{dom-B5bAma7X.js → dom-SUWlnfT9.js} +562 -145
- package/dist/history/index.d.ts +5 -5
- package/dist/history/index.js +2041 -1833
- package/dist/history-skip-CcEhIzak.js +35 -0
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/hyperscript/index.js +1 -1
- package/dist/{hyperscript-BXUV6sdO.js → hyperscript-DdeGYoSc.js} +3 -2
- package/dist/{index-CTTjpWgb.d.ts → index-4PpawhYe.d.ts} +1 -1
- package/dist/{index-DJvrmSRP.d.ts → index-BsOySJwr.d.ts} +9 -9
- package/dist/{index-D8DQ1YFB.d.ts → index-CHEKdrHP.d.ts} +12 -4
- package/dist/{comparison-types-CsmDG5r2.d.ts → index-DM-b6jEe.d.ts} +21 -57
- package/dist/{index-LhVJuuEf.d.ts → index-DqmhcD_0.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +66 -5
- package/dist/law-check-Bvnz2EKh.js +19271 -0
- 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 +92 -46
- package/dist/{pagination-CwjmxPoX.js → pagination-XEnxZ1DX.js} +2 -1
- package/dist/{plugin-BZCGtqMI.js → plugin-B8uCi-Hr.js} +8758 -19452
- package/dist/{range-geometry-CZari453.d.ts → range-geometry-B2f67yLv.d.ts} +1 -1
- package/dist/{range-geometry-CqWrwkjH.js → range-geometry-BGKYQHqO.js} +3 -2
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +7 -6
- package/dist/react/virtualized.d.ts +2 -2
- package/dist/react/virtualized.js +59 -38
- package/dist/{react-DO9IETEQ.js → react-B6B-5z7t.js} +24 -55
- package/dist/{retraction-RHEKiF3h.js → retraction-BMzQ2on5.js} +1 -1
- package/dist/scroll-root-DudA40xj.js +25 -0
- package/dist/{src-fLbHzUjC.js → src--BZ7fZY4.js} +60 -26
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +4 -3
- package/dist/{tx-only-1FM45FSj.d.ts → tx-only-D8lpB-sT.d.ts} +338 -147
- package/dist/{update-policy-C32RjjGt.js → update-policy-J-4sHmrg.js} +2 -1
- package/dist/{use-editor-dom-scope-CUBnNAZV.js → use-editor-dom-scope-BFWvutxn.js} +2837 -2093
- 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-BMguSAX_.js → yjs-DPngKQWQ.js} +114 -39
- package/package.json +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { Ai as countCoreWork, Bn as getNodeKeyForNode, G as mapInternalDocumentChangePosition, N as hasInternalDocumentChangeRoot, W as mapInternalDocumentChangePoint, Wi as getDefined, Y as valueRoot, hi as PathApi, ii as PointApi, ni as LocationApi, ti as RangeApi, tn as DocumentIndex } from "./law-check-Bvnz2EKh.js";
|
|
2
|
+
import { At as isVoid$2, Au as getPluginRegistry, Bd as hasEditorRuntime, Bo as placedSince, Cd as definePluginPoint, Co as nodes, Dd as ElementApi, Dn as attachTransactionSpecAfterCommit, Dt as isInline, Du as getCompiledEditorSchema, Ed as SelectionApi, Ei as subscribeCaretTarget, F as evaluateCommandWithState, G as before, Gi as captureSliceLanding, Gt as range, H as above, Hd as defineCommand, Hi as withUpdateTagContext, I as getActiveCommandEditor, Id as getEditorRuntime, Ld as getEditorRuntimeOwner, Ls as txLocate, Mo as getPlacementGeneration, N as dispatchCommand, Od as formatDebugValue, P as evaluateCommand, Po as holdsCaret, Rd as getEditorRuntimeRoot, Rt as next, Sn as applyTransactionSpec, Ud as registerImplicitTargetCommand, Un as getBaseCallRoot, Uo as resolveParkedCaret, Uu as getCompiledSchemaPropertyId, V as NodeApi, Vt as point, W as after, Xa as readRemovalLanding, Xc as createDetachedContentSlice, Yc as ContentSlice, ac as getCompiledEditorSchemaFromApi, ar as getEditorReadDepth, bc as getSelectionDOMRange, bd as failInvariant, br as getSetSite, cn as unhangRange, cr as getEditorStateView, du as toPublicRoot, fn as voidEditor, fo as isTextCell, gr as getNodeTargetRoot, hi as setEditorFocused, ii as resolveEditorNodeKeyForNode, jd as TextApi, ji as toEditorCoreStateView, jo as getCaretOwner, ku as getPluginContributions, l as definePlugin, ls as getViewFollowTarget, lt as getSelection$1, lu as getPublicExplicitLocationRoot, m as getInstalledPlugin, mn as editorCommands, nt as getChildren, oc as getInternalEditorSchemaFromApi, os as getOwnViewPresentation, ot as getNodeKey, pt as hasPath, qa as withLandingBlock, qo as setSelectionAsView, st as getPathByNodeKey, ud as EditorSchemaValidationError, ut as getSnapshot, uu as toInternalRoot, vl as getEditorCommitSnapshot, vn as afterActiveTransactionEnds, wc as mapSelectionThroughChange, wl as readRootEntries, xl as getEditorCommitValue, xt as isBlock, xu as reportEditorLifecycleError, zd as getEditorSchema, zn as getActiveEditorTransaction } from "./plugin-B8uCi-Hr.js";
|
|
3
|
+
import { a as transferEntries, c as dispatchPaste, n as checkFilesLanding, r as checkTransfer, u as landPaste } from "./src--BZ7fZY4.js";
|
|
4
|
+
import { i as setDOMClipboardFormatKey, n as clearDOMClipboardFormatKey, r as getDOMClipboardFormatKey, t as DEFAULT_CLIPBOARD_FORMAT_KEY$2 } from "./clipboard-format-key-SzffxWqa.js";
|
|
5
5
|
//#region src/dom/utils/dom.ts
|
|
6
6
|
globalThis.Node;
|
|
7
7
|
globalThis.Text;
|
|
@@ -1102,6 +1102,45 @@ const readDOMTextFlowHost = (host) => {
|
|
|
1102
1102
|
text: segments ? readDOMTextFlowRecord(record, segments) : null
|
|
1103
1103
|
}));
|
|
1104
1104
|
};
|
|
1105
|
+
const pathsEqual = (left, right) => left !== null && left.length === right.length && left.every((value, index) => value === right[index]);
|
|
1106
|
+
const getDOMTextFlowRestoreSegments = (host, path) => {
|
|
1107
|
+
const index = TEXT_HOST_TO_FLOW_INDEX.get(host);
|
|
1108
|
+
if (!index) return null;
|
|
1109
|
+
let matched = null;
|
|
1110
|
+
if (path) {
|
|
1111
|
+
for (const { record } of index.records.values()) if (pathsEqual(record.path, path)) {
|
|
1112
|
+
matched = record;
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if (!matched && index.records.size === 1) matched = index.records.values().next().value?.record ?? null;
|
|
1117
|
+
if (!matched || matched.segments.length === 0) return null;
|
|
1118
|
+
const record = matched;
|
|
1119
|
+
return record.segments.map((segment) => {
|
|
1120
|
+
const bounds = getBindingSegmentBounds({
|
|
1121
|
+
record,
|
|
1122
|
+
segment
|
|
1123
|
+
});
|
|
1124
|
+
return {
|
|
1125
|
+
domLength: segment.domLength,
|
|
1126
|
+
end: bounds.end,
|
|
1127
|
+
replaceTextNode: (nextTextNode) => {
|
|
1128
|
+
if (segment.textNode === nextTextNode) return;
|
|
1129
|
+
segment.textNode[DOM_TEXT_FLOW_SEGMENT] = null;
|
|
1130
|
+
segment.textNode = nextTextNode;
|
|
1131
|
+
nextTextNode[DOM_TEXT_FLOW_SEGMENT] = segment;
|
|
1132
|
+
segment.boundNodes = [
|
|
1133
|
+
segment.rootNode,
|
|
1134
|
+
segment.stringElement,
|
|
1135
|
+
nextTextNode
|
|
1136
|
+
].filter((node) => !!node);
|
|
1137
|
+
},
|
|
1138
|
+
start: bounds.start,
|
|
1139
|
+
stringElement: segment.stringElement,
|
|
1140
|
+
textNode: segment.textNode
|
|
1141
|
+
};
|
|
1142
|
+
});
|
|
1143
|
+
};
|
|
1105
1144
|
const resolveDOMTextFlowOffset = (host, node, offset) => {
|
|
1106
1145
|
if (node.nodeType !== Node.TEXT_NODE) return null;
|
|
1107
1146
|
const directBinding = getSegmentBinding(node);
|
|
@@ -1494,9 +1533,12 @@ const getPliteStringDirectPlacement = ({ root, target, x, y }) => {
|
|
|
1494
1533
|
};
|
|
1495
1534
|
const isOverLetterBefore = (document, [textNode, offset], x, y) => {
|
|
1496
1535
|
if (offset === 0) return false;
|
|
1536
|
+
const boundaries = getGraphemeBoundaryOffsets(textNode.textContent ?? "");
|
|
1537
|
+
const start = boundaries.findLast((boundary) => boundary < offset) ?? 0;
|
|
1538
|
+
const end = boundaries.find((boundary) => boundary >= offset) ?? offset;
|
|
1497
1539
|
const letter = document.createRange();
|
|
1498
|
-
letter.setStart(textNode,
|
|
1499
|
-
letter.setEnd(textNode,
|
|
1540
|
+
letter.setStart(textNode, start);
|
|
1541
|
+
letter.setEnd(textNode, end);
|
|
1500
1542
|
return getUsableRangeRects(letter).some((candidate) => x >= candidate.left && x < candidate.right && y >= candidate.top && y <= candidate.bottom);
|
|
1501
1543
|
};
|
|
1502
1544
|
const getNearestPliteStringRect = ({ strings, x, y }) => {
|
|
@@ -3149,11 +3191,21 @@ const EDITOR_DOM_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
3149
3191
|
"data-editor-zero-width"
|
|
3150
3192
|
]);
|
|
3151
3193
|
const affectsEditorDOMContract = (mutation) => mutation.type !== "attributes" || mutation.attributeName !== null && EDITOR_DOM_ATTRIBUTES.has(mutation.attributeName);
|
|
3152
|
-
const captureSelection = (root) => {
|
|
3153
|
-
|
|
3194
|
+
const captureSelection = (root, readSelection) => {
|
|
3195
|
+
if (readSelection) {
|
|
3196
|
+
const points = readSelection(root);
|
|
3197
|
+
if (!points || !containsShadowAware(root, points.anchor[0]) || !containsShadowAware(root, points.focus[0])) return null;
|
|
3198
|
+
return {
|
|
3199
|
+
anchorNode: points.anchor[0],
|
|
3200
|
+
anchorOffset: points.anchor[1],
|
|
3201
|
+
focusNode: points.focus[0],
|
|
3202
|
+
focusOffset: points.focus[1]
|
|
3203
|
+
};
|
|
3204
|
+
}
|
|
3205
|
+
const selection = getSelection(root.getRootNode());
|
|
3154
3206
|
const anchorNode = selection?.anchorNode ?? null;
|
|
3155
3207
|
const focusNode = selection?.focusNode ?? null;
|
|
3156
|
-
if (!selection || !anchorNode || !focusNode || !root
|
|
3208
|
+
if (!selection || !anchorNode || !focusNode || !containsShadowAware(root, anchorNode) || !containsShadowAware(root, focusNode)) return null;
|
|
3157
3209
|
return {
|
|
3158
3210
|
anchorNode,
|
|
3159
3211
|
anchorOffset: selection.anchorOffset,
|
|
@@ -3163,7 +3215,7 @@ const captureSelection = (root) => {
|
|
|
3163
3215
|
};
|
|
3164
3216
|
const maxOffset = (node) => node.nodeType === TEXT_NODE ? node.nodeValue?.length ?? 0 : node.childNodes.length;
|
|
3165
3217
|
const restoreSelection = (root, snapshot, writeSelection) => {
|
|
3166
|
-
if (!snapshot || !writeSelection || !root
|
|
3218
|
+
if (!snapshot || !writeSelection || !containsShadowAware(root, snapshot.anchorNode) || !containsShadowAware(root, snapshot.focusNode)) return;
|
|
3167
3219
|
writeSelection(root, {
|
|
3168
3220
|
anchor: [snapshot.anchorNode, Math.min(snapshot.anchorOffset, maxOffset(snapshot.anchorNode))],
|
|
3169
3221
|
focus: [snapshot.focusNode, Math.min(snapshot.focusOffset, maxOffset(snapshot.focusNode))]
|
|
@@ -3439,7 +3491,7 @@ var DOMIntegrityObserver = class {
|
|
|
3439
3491
|
path: this.options.resolvePath(mutation),
|
|
3440
3492
|
type: mutation.type
|
|
3441
3493
|
}));
|
|
3442
|
-
const selection = captureSelection(root);
|
|
3494
|
+
const selection = captureSelection(root, this.options.readSelection);
|
|
3443
3495
|
for (const mutation of mutations.reverse()) restoreMutation(mutation);
|
|
3444
3496
|
restoreSelection(root, selection, this.options.writeSelection);
|
|
3445
3497
|
this.repairPassesInFrame += 1;
|
|
@@ -4115,7 +4167,10 @@ const readEditableDOMSelectionPoints = (editable, selection) => {
|
|
|
4115
4167
|
const tree = editable.getRootNode();
|
|
4116
4168
|
if (tree.nodeType === tree.DOCUMENT_FRAGMENT_NODE) {
|
|
4117
4169
|
const composed = readComposedSelectionRange(editable, selection);
|
|
4118
|
-
if (composed) return {
|
|
4170
|
+
if (composed) return selection.direction === "backward" ? {
|
|
4171
|
+
anchor: [composed.endContainer, composed.endOffset],
|
|
4172
|
+
focus: [composed.startContainer, composed.startOffset]
|
|
4173
|
+
} : {
|
|
4119
4174
|
anchor: [composed.startContainer, composed.startOffset],
|
|
4120
4175
|
focus: [composed.endContainer, composed.endOffset]
|
|
4121
4176
|
};
|
|
@@ -4177,16 +4232,156 @@ const resolveInnermostElementAtPoint = (document, x, y) => {
|
|
|
4177
4232
|
for (let inner = element && shadowRootOf(element)?.elementFromPoint(x, y); inner && inner !== element; inner = shadowRootOf(element)?.elementFromPoint(x, y)) element = inner;
|
|
4178
4233
|
return element;
|
|
4179
4234
|
};
|
|
4180
|
-
const focusedElementOf = (top) => {
|
|
4235
|
+
const focusedElementOf = (top, extraShadowRoots) => {
|
|
4181
4236
|
let element = top.activeElement;
|
|
4182
4237
|
while (element) {
|
|
4183
|
-
const inner = shadowRootOf(element)?.activeElement ?? element.contentDocument?.activeElement;
|
|
4238
|
+
const inner = (shadowRootOf(element) ?? extraShadowRoots?.get(element))?.activeElement ?? element.contentDocument?.activeElement;
|
|
4184
4239
|
if (!inner) return element;
|
|
4185
4240
|
element = inner;
|
|
4186
4241
|
}
|
|
4187
4242
|
return null;
|
|
4188
4243
|
};
|
|
4189
|
-
const focusedElementOnPage = (node) =>
|
|
4244
|
+
const focusedElementOnPage = (node) => {
|
|
4245
|
+
let extraShadowRoots;
|
|
4246
|
+
const element = asElement(node);
|
|
4247
|
+
if (element) {
|
|
4248
|
+
for (const shadowRoot of shadowRootsAbove(element)) if (!shadowRootOf(shadowRoot.host)) {
|
|
4249
|
+
extraShadowRoots ??= /* @__PURE__ */ new Map();
|
|
4250
|
+
extraShadowRoots.set(shadowRoot.host, shadowRoot);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return focusedElementOf(pageOf(node.ownerDocument ?? node), extraShadowRoots);
|
|
4254
|
+
};
|
|
4255
|
+
const isEventInsideRoot = (root, event, seen) => {
|
|
4256
|
+
if (seen?.has(event)) return true;
|
|
4257
|
+
return (typeof event.composedPath === "function" ? event.composedPath() : []).includes(root) || isDOMNode(event.target) && containsShadowAware(root, event.target);
|
|
4258
|
+
};
|
|
4259
|
+
const getEventTargetInRoot = (root, event) => {
|
|
4260
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4261
|
+
return path.includes(root) ? path[0] ?? event.target : event.target;
|
|
4262
|
+
};
|
|
4263
|
+
const isSlottedIntoShadowRoot = (shadowRoot, target) => {
|
|
4264
|
+
if (!isDOMNode(target)) return false;
|
|
4265
|
+
const slots = shadowRoot.querySelectorAll("slot");
|
|
4266
|
+
if (slots.length === 0) return false;
|
|
4267
|
+
for (const slot of slots) for (const assigned of slot.assignedNodes({ flatten: true })) if (assigned === target || containsShadowAware(assigned, target)) return true;
|
|
4268
|
+
return false;
|
|
4269
|
+
};
|
|
4270
|
+
const observeRootBoundaryEvent = (root, type, listener, { capture = true, filter = "all", scope = "document" } = {}) => {
|
|
4271
|
+
const { ownerDocument } = root;
|
|
4272
|
+
const outerTarget = scope === "window" ? ownerDocument.defaultView : ownerDocument;
|
|
4273
|
+
if (!outerTarget) return () => {};
|
|
4274
|
+
const allShadowRoots = shadowRootsAbove(root);
|
|
4275
|
+
const closedRoots = allShadowRoots.filter((shadowRoot) => shadowRoot.mode === "closed");
|
|
4276
|
+
const emit = (event, inRoot, target) => {
|
|
4277
|
+
if (filter === "inside" && !inRoot) return;
|
|
4278
|
+
if (filter === "outside" && inRoot) return;
|
|
4279
|
+
listener(event, {
|
|
4280
|
+
inRoot,
|
|
4281
|
+
target
|
|
4282
|
+
});
|
|
4283
|
+
};
|
|
4284
|
+
if (filter === "inside") {
|
|
4285
|
+
const insideTarget = allShadowRoots[0] ?? outerTarget;
|
|
4286
|
+
const handleInner = (event) => {
|
|
4287
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4288
|
+
if (!path.includes(root) && !(isDOMNode(event.target) && containsShadowAware(root, event.target))) return;
|
|
4289
|
+
emit(event, true, path[0] ?? event.target);
|
|
4290
|
+
};
|
|
4291
|
+
insideTarget.addEventListener(type, handleInner, capture);
|
|
4292
|
+
return () => {
|
|
4293
|
+
insideTarget.removeEventListener(type, handleInner, capture);
|
|
4294
|
+
};
|
|
4295
|
+
}
|
|
4296
|
+
if (closedRoots.length === 0) {
|
|
4297
|
+
const handleOuter = (event) => {
|
|
4298
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4299
|
+
const inRoot = path.includes(root) || isDOMNode(event.target) && containsShadowAware(root, event.target);
|
|
4300
|
+
const target = inRoot ? path[0] ?? event.target : event.target;
|
|
4301
|
+
emit(event, inRoot, target);
|
|
4302
|
+
};
|
|
4303
|
+
outerTarget.addEventListener(type, handleOuter, capture);
|
|
4304
|
+
return () => {
|
|
4305
|
+
outerTarget.removeEventListener(type, handleOuter, capture);
|
|
4306
|
+
};
|
|
4307
|
+
}
|
|
4308
|
+
const innermostRoot = allShadowRoots[0];
|
|
4309
|
+
if (!capture) {
|
|
4310
|
+
const insideTargets = /* @__PURE__ */ new WeakMap();
|
|
4311
|
+
const resetOnOuterCapture = (event) => {
|
|
4312
|
+
insideTargets.delete(event);
|
|
4313
|
+
};
|
|
4314
|
+
const markInside = (event) => {
|
|
4315
|
+
if (isEventInsideRoot(root, event)) {
|
|
4316
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4317
|
+
insideTargets.set(event, path[0] ?? event.target);
|
|
4318
|
+
}
|
|
4319
|
+
};
|
|
4320
|
+
const handleBubble = (event) => {
|
|
4321
|
+
const hasInside = insideTargets.has(event);
|
|
4322
|
+
const insideTarget = insideTargets.get(event) ?? null;
|
|
4323
|
+
insideTargets.delete(event);
|
|
4324
|
+
const inRoot = hasInside || isEventInsideRoot(root, event);
|
|
4325
|
+
const target = hasInside ? insideTarget ?? event.target : getEventTargetInRoot(root, event);
|
|
4326
|
+
emit(event, inRoot, target);
|
|
4327
|
+
};
|
|
4328
|
+
outerTarget.addEventListener(type, resetOnOuterCapture, true);
|
|
4329
|
+
innermostRoot.addEventListener(type, markInside, true);
|
|
4330
|
+
outerTarget.addEventListener(type, handleBubble, false);
|
|
4331
|
+
return () => {
|
|
4332
|
+
outerTarget.removeEventListener(type, resetOnOuterCapture, true);
|
|
4333
|
+
innermostRoot.removeEventListener(type, markInside, true);
|
|
4334
|
+
outerTarget.removeEventListener(type, handleBubble, false);
|
|
4335
|
+
};
|
|
4336
|
+
}
|
|
4337
|
+
const outerToInnerClosed = [...closedRoots].reverse();
|
|
4338
|
+
const levels = [outerTarget, ...outerToInnerClosed];
|
|
4339
|
+
const handled = /* @__PURE__ */ new WeakSet();
|
|
4340
|
+
const cleanups = [];
|
|
4341
|
+
for (let index = 0; index < levels.length; index += 1) {
|
|
4342
|
+
const levelTarget = levels[index];
|
|
4343
|
+
const nextClosed = outerToInnerClosed[index] ?? null;
|
|
4344
|
+
if (nextClosed) {
|
|
4345
|
+
const nextHost = nextClosed.host;
|
|
4346
|
+
const handleLevelCapture = (event) => {
|
|
4347
|
+
if (index === 0) handled.delete(event);
|
|
4348
|
+
if (handled.has(event)) return;
|
|
4349
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4350
|
+
const deepestTarget = path[0] ?? event.target;
|
|
4351
|
+
if (deepestTarget === nextHost || path.includes(nextHost) && isSlottedIntoShadowRoot(nextClosed, deepestTarget)) return;
|
|
4352
|
+
if (event.composed) handled.add(event);
|
|
4353
|
+
emit(event, false, deepestTarget);
|
|
4354
|
+
};
|
|
4355
|
+
const handleHostFallback = (event) => {
|
|
4356
|
+
if (handled.has(event)) return;
|
|
4357
|
+
if (((typeof event.composedPath === "function" ? event.composedPath() : [])[0] ?? event.target) !== nextHost) return;
|
|
4358
|
+
if (event.composed) handled.add(event);
|
|
4359
|
+
emit(event, false, event.target);
|
|
4360
|
+
};
|
|
4361
|
+
levelTarget.addEventListener(type, handleLevelCapture, true);
|
|
4362
|
+
nextHost.addEventListener(type, handleHostFallback, false);
|
|
4363
|
+
cleanups.push(() => {
|
|
4364
|
+
levelTarget.removeEventListener(type, handleLevelCapture, true);
|
|
4365
|
+
nextHost.removeEventListener(type, handleHostFallback, false);
|
|
4366
|
+
});
|
|
4367
|
+
} else {
|
|
4368
|
+
const handleInnermostCapture = (event) => {
|
|
4369
|
+
if (handled.has(event)) return;
|
|
4370
|
+
if (event.composed) handled.add(event);
|
|
4371
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
4372
|
+
const inRoot = path.includes(root) || isDOMNode(event.target) && containsShadowAware(root, event.target);
|
|
4373
|
+
emit(event, inRoot, inRoot ? path[0] ?? event.target : event.target);
|
|
4374
|
+
};
|
|
4375
|
+
levelTarget.addEventListener(type, handleInnermostCapture, true);
|
|
4376
|
+
cleanups.push(() => {
|
|
4377
|
+
levelTarget.removeEventListener(type, handleInnermostCapture, true);
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
return () => {
|
|
4382
|
+
for (const cleanup of cleanups) cleanup();
|
|
4383
|
+
};
|
|
4384
|
+
};
|
|
4190
4385
|
const movedFocusElsewhere = (element, before, after) => {
|
|
4191
4386
|
if (!after || after === before || after === element || containsShadowAware(element, after) && !isNestedEditableOrInput(element, after)) return false;
|
|
4192
4387
|
const ownDoc = element.ownerDocument;
|
|
@@ -4310,6 +4505,7 @@ var DOMRootRuntime = class DOMRootRuntime {
|
|
|
4310
4505
|
connected = false;
|
|
4311
4506
|
isComposing;
|
|
4312
4507
|
isSelectionHeld;
|
|
4508
|
+
exportSelection;
|
|
4313
4509
|
focusSelection;
|
|
4314
4510
|
nodeSelectionFocus;
|
|
4315
4511
|
generation = 0;
|
|
@@ -4328,6 +4524,7 @@ var DOMRootRuntime = class DOMRootRuntime {
|
|
|
4328
4524
|
constructor(options) {
|
|
4329
4525
|
this.isComposing = options.isComposing;
|
|
4330
4526
|
this.isSelectionHeld = options.isSelectionHeld ?? (() => false);
|
|
4527
|
+
this.exportSelection = options.exportSelection ?? (() => void 0);
|
|
4331
4528
|
this.focusSelection = options.focusSelection ?? (() => false);
|
|
4332
4529
|
this.nodeSelectionFocus = options.nodeSelectionFocus ?? (() => null);
|
|
4333
4530
|
this.adapter = options.adapter;
|
|
@@ -4346,6 +4543,7 @@ var DOMRootRuntime = class DOMRootRuntime {
|
|
|
4346
4543
|
this.schedulerImplementation = this.createScheduler();
|
|
4347
4544
|
this.domSyncMutationOwnership = new DOMSyncMutationOwnership((phase, label, callback, scheduleOptions) => this.schedulerImplementation?.schedule(phase, label, callback, scheduleOptions) ?? (() => {}));
|
|
4348
4545
|
this.domIntegrityObserver = new DOMIntegrityObserver({
|
|
4546
|
+
readSelection: (root) => readEditableDOMSelectionPoints(root, getSelection(root.getRootNode())),
|
|
4349
4547
|
writeSelection: (root, points) => writeEditableDOMSelection(root, points, { editor: this.editor }),
|
|
4350
4548
|
getAndroidMutationHandler: options.getAndroidMutationHandler,
|
|
4351
4549
|
isAndroidMutationOwned: options.isAndroidMutationOwned,
|
|
@@ -4673,7 +4871,7 @@ var DOMRootRuntime = class DOMRootRuntime {
|
|
|
4673
4871
|
this.rootInputActivationCleanup = null;
|
|
4674
4872
|
const runtime = this;
|
|
4675
4873
|
const root = this.rootRef.current;
|
|
4676
|
-
const activeElement = (root
|
|
4874
|
+
const activeElement = root ? focusedElementOnPage(root) : null;
|
|
4677
4875
|
const focusedRuntime = activeElement ? findDOMRootRuntime(activeElement) : null;
|
|
4678
4876
|
const otherFocusedView = focusedRuntime && focusedRuntime.editor === this.editor && focusedRuntime !== runtime;
|
|
4679
4877
|
if (root && DOM_ROOT_RUNTIME_BY_ROOT.get(root) === runtime) DOM_ROOT_RUNTIME_BY_ROOT.delete(root);
|
|
@@ -6120,6 +6318,7 @@ const domCommands = Object.freeze({ insertData: defineCommand("dom.insertData",
|
|
|
6120
6318
|
return getInstalledPlugin(editor, "dom") ? withLandingBlock(editor, state, (current) => createDOMDataTransactionSpec(editor, input, current)) : false;
|
|
6121
6319
|
}
|
|
6122
6320
|
}) });
|
|
6321
|
+
registerImplicitTargetCommand(domCommands.insertData, void 0, { crossingPolicy: "cancel" });
|
|
6123
6322
|
const stripRenderOnlyLeafWrappers = (root, ui) => {
|
|
6124
6323
|
Array.from(root.querySelectorAll("[data-editor-leaf] span:not([data-editor-string]):not([data-editor-zero-width])")).forEach((candidate) => {
|
|
6125
6324
|
if (candidate.closest("[data-editor-leaf]")) {
|
|
@@ -7479,7 +7678,9 @@ const resolveVoidEventRange = (editor, { node, path, target, x, y }) => {
|
|
|
7479
7678
|
//#endregion
|
|
7480
7679
|
//#region src/dom/plugin/dom-scroll-into-view.ts
|
|
7481
7680
|
const MARGIN = 4;
|
|
7681
|
+
const MAX_IFRAME_DEPTH = 16;
|
|
7482
7682
|
const SCROLLABLE_RE = /(auto|scroll|overlay)/;
|
|
7683
|
+
const HIDDEN_OVERFLOW_RE = /\bhidden\b/;
|
|
7483
7684
|
const isUsableScrollRect = (r) => r.width > 0 || r.height > 0 || r.x !== 0 || r.y !== 0 || r.top !== 0 || r.left !== 0 || r.bottom !== 0 || r.right !== 0;
|
|
7484
7685
|
const toScrollRect = (r) => ({
|
|
7485
7686
|
bottom: r.bottom,
|
|
@@ -7487,28 +7688,105 @@ const toScrollRect = (r) => ({
|
|
|
7487
7688
|
right: r.right,
|
|
7488
7689
|
top: r.top
|
|
7489
7690
|
});
|
|
7691
|
+
const isDefaultScrollRevealOptions = (options) => options === void 0 || typeof options === "object" && options !== null && (options.scrollMode === void 0 || options.scrollMode === "if-needed") && options.block === void 0 && options.inline === void 0 && options.behavior === void 0 && options.boundary === void 0 && options.skipOverflowHiddenElements === void 0;
|
|
7692
|
+
const normalizeOptions = (options) => {
|
|
7693
|
+
if (isDefaultScrollRevealOptions(options)) return {
|
|
7694
|
+
behavior: "auto",
|
|
7695
|
+
block: "nearest",
|
|
7696
|
+
boundary: null,
|
|
7697
|
+
defaultReveal: true,
|
|
7698
|
+
inline: "nearest",
|
|
7699
|
+
scrollMode: "if-needed",
|
|
7700
|
+
skipOverflowHiddenElements: true
|
|
7701
|
+
};
|
|
7702
|
+
if (typeof options === "boolean") return {
|
|
7703
|
+
behavior: "auto",
|
|
7704
|
+
block: options ? "start" : "end",
|
|
7705
|
+
boundary: null,
|
|
7706
|
+
defaultReveal: false,
|
|
7707
|
+
inline: "nearest",
|
|
7708
|
+
scrollMode: "always",
|
|
7709
|
+
skipOverflowHiddenElements: true
|
|
7710
|
+
};
|
|
7711
|
+
const scrollMode = options?.scrollMode ?? "always";
|
|
7712
|
+
return {
|
|
7713
|
+
behavior: options?.behavior ?? "auto",
|
|
7714
|
+
block: options?.block ?? (scrollMode === "always" ? "center" : "nearest"),
|
|
7715
|
+
boundary: options?.boundary ?? null,
|
|
7716
|
+
defaultReveal: false,
|
|
7717
|
+
inline: options?.inline ?? "nearest",
|
|
7718
|
+
scrollMode,
|
|
7719
|
+
skipOverflowHiddenElements: options?.skipOverflowHiddenElements ?? true
|
|
7720
|
+
};
|
|
7721
|
+
};
|
|
7490
7722
|
const shiftRect = (r, dx, dy) => ({
|
|
7491
7723
|
bottom: r.bottom - dy,
|
|
7492
7724
|
left: r.left - dx,
|
|
7493
7725
|
right: r.right - dx,
|
|
7494
7726
|
top: r.top - dy
|
|
7495
7727
|
});
|
|
7496
|
-
const
|
|
7728
|
+
const parsePositivePx = (value) => {
|
|
7729
|
+
const n = Number.parseFloat(value ?? "");
|
|
7730
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
7731
|
+
};
|
|
7732
|
+
const getElementStyle = (element) => element.ownerDocument.defaultView?.getComputedStyle(element) ?? (isDOMHTMLElement(element) ? element.style : void 0);
|
|
7733
|
+
const readScrollMargins = (element, scrollMarginTopOverride) => {
|
|
7734
|
+
const style = getElementStyle(element);
|
|
7735
|
+
const inlineStyle = isDOMHTMLElement(element) ? element.style : void 0;
|
|
7736
|
+
const top = scrollMarginTopOverride !== void 0 ? Math.max(0, scrollMarginTopOverride) : parsePositivePx(inlineStyle?.scrollMarginTop || style?.scrollMarginTop);
|
|
7737
|
+
return {
|
|
7738
|
+
bottom: parsePositivePx(inlineStyle?.scrollMarginBottom || style?.scrollMarginBottom),
|
|
7739
|
+
left: parsePositivePx(inlineStyle?.scrollMarginLeft || style?.scrollMarginLeft),
|
|
7740
|
+
right: parsePositivePx(inlineStyle?.scrollMarginRight || style?.scrollMarginRight),
|
|
7741
|
+
top
|
|
7742
|
+
};
|
|
7743
|
+
};
|
|
7744
|
+
const canScroll = (el, style, axis, skipOverflowHiddenElements) => {
|
|
7497
7745
|
const overflow = axis === "y" ? `${style?.overflowY ?? ""} ${style?.overflow ?? ""}` : `${style?.overflowX ?? ""} ${style?.overflow ?? ""}`;
|
|
7498
|
-
return SCROLLABLE_RE.test(overflow) && (axis === "y" ? el.scrollHeight > el.clientHeight : el.scrollWidth > el.clientWidth);
|
|
7746
|
+
return (SCROLLABLE_RE.test(overflow) || !skipOverflowHiddenElements && HIDDEN_OVERFLOW_RE.test(overflow)) && (axis === "y" ? el.scrollHeight > el.clientHeight : el.scrollWidth > el.clientWidth);
|
|
7499
7747
|
};
|
|
7500
7748
|
const pad = (value, size) => {
|
|
7501
7749
|
const n = Number.parseFloat(value ?? "");
|
|
7502
7750
|
if (!Number.isFinite(n) || n <= 0) return 0;
|
|
7503
7751
|
return value?.trim().endsWith("%") ? n / 100 * size : n;
|
|
7504
7752
|
};
|
|
7505
|
-
const paddedBox = (rect, style) => ({
|
|
7506
|
-
bottom: rect.bottom - pad(style?.scrollPaddingBottom, rect.height) -
|
|
7507
|
-
left: rect.left + pad(style?.scrollPaddingLeft, rect.width) +
|
|
7508
|
-
right: rect.right - pad(style?.scrollPaddingRight, rect.width) -
|
|
7509
|
-
top: rect.top + pad(style?.scrollPaddingTop, rect.height) +
|
|
7753
|
+
const paddedBox = (rect, style, margin, scaleX = 1, scaleY = 1) => ({
|
|
7754
|
+
bottom: rect.bottom - pad(style?.scrollPaddingBottom, rect.height / scaleY) * scaleY - margin,
|
|
7755
|
+
left: rect.left + pad(style?.scrollPaddingLeft, rect.width / scaleX) * scaleX + margin,
|
|
7756
|
+
right: rect.right - pad(style?.scrollPaddingRight, rect.width / scaleX) * scaleX - margin,
|
|
7757
|
+
top: rect.top + pad(style?.scrollPaddingTop, rect.height / scaleY) * scaleY + margin
|
|
7510
7758
|
});
|
|
7511
|
-
const
|
|
7759
|
+
const getElementScale = (el, rect) => {
|
|
7760
|
+
if (!isDOMHTMLElement(el)) return {
|
|
7761
|
+
x: 1,
|
|
7762
|
+
y: 1
|
|
7763
|
+
};
|
|
7764
|
+
return {
|
|
7765
|
+
x: el.offsetWidth > 0 && rect.width > 0 ? rect.width / el.offsetWidth : 1,
|
|
7766
|
+
y: el.offsetHeight > 0 && rect.height > 0 ? rect.height / el.offsetHeight : 1
|
|
7767
|
+
};
|
|
7768
|
+
};
|
|
7769
|
+
const getScrollContainerBox = (el, style, scale, margin) => {
|
|
7770
|
+
const rect = el.getBoundingClientRect();
|
|
7771
|
+
const borderTop = parsePositivePx(style?.borderTopWidth) * scale.y;
|
|
7772
|
+
const borderBottom = parsePositivePx(style?.borderBottomWidth) * scale.y;
|
|
7773
|
+
const borderLeft = parsePositivePx(style?.borderLeftWidth) * scale.x;
|
|
7774
|
+
const borderRight = parsePositivePx(style?.borderRightWidth) * scale.x;
|
|
7775
|
+
const top = rect.top + borderTop;
|
|
7776
|
+
const bottom = el.clientHeight > 0 ? Math.min(rect.bottom - borderBottom, top + el.clientHeight * scale.y) : rect.bottom - borderBottom;
|
|
7777
|
+
const isRtl = style?.direction === "rtl";
|
|
7778
|
+
const left = isRtl && el.clientWidth > 0 ? Math.max(rect.left + borderLeft, rect.right - borderRight - el.clientWidth * scale.x) : rect.left + borderLeft;
|
|
7779
|
+
const right = !isRtl && el.clientWidth > 0 ? Math.min(rect.right - borderRight, left + el.clientWidth * scale.x) : rect.right - borderRight;
|
|
7780
|
+
return paddedBox({
|
|
7781
|
+
bottom,
|
|
7782
|
+
height: Math.max(0, bottom - top),
|
|
7783
|
+
left,
|
|
7784
|
+
right,
|
|
7785
|
+
top,
|
|
7786
|
+
width: Math.max(0, right - left)
|
|
7787
|
+
}, style, margin, scale.x, scale.y);
|
|
7788
|
+
};
|
|
7789
|
+
const getVisibleViewportBox = (win, scrollingElement, margin) => {
|
|
7512
7790
|
const vv = win.visualViewport;
|
|
7513
7791
|
const height = vv?.height ?? win.innerHeight;
|
|
7514
7792
|
const width = vv?.width ?? win.innerWidth;
|
|
@@ -7521,10 +7799,15 @@ const getVisibleViewportBox = (win, scrollingElement) => {
|
|
|
7521
7799
|
right: left + width,
|
|
7522
7800
|
top,
|
|
7523
7801
|
width
|
|
7524
|
-
}, win.getComputedStyle(scrollingElement));
|
|
7802
|
+
}, win.getComputedStyle(scrollingElement), margin);
|
|
7525
7803
|
};
|
|
7526
|
-
const axisDelta = (
|
|
7804
|
+
const axisDelta = ({ align, end, high, low, ownHigh, ownLow, rtl = false, scrollMode, start }) => {
|
|
7527
7805
|
if (low >= high) return 0;
|
|
7806
|
+
if (scrollMode === "if-needed" && start >= low && end <= high) return 0;
|
|
7807
|
+
if (align === "start") return rtl ? end - high : start - low;
|
|
7808
|
+
if (align === "end") return rtl ? start - low : end - high;
|
|
7809
|
+
if (align === "center") return (start + end) / 2 - (low + high) / 2;
|
|
7810
|
+
if (start < low && end > high) return 0;
|
|
7528
7811
|
if (start < low) {
|
|
7529
7812
|
const d = low - start;
|
|
7530
7813
|
return ownHigh === void 0 ? -d : -Math.min(d, Math.max(0, ownHigh - end));
|
|
@@ -7535,25 +7818,111 @@ const axisDelta = (start, end, low, high, ownLow, ownHigh) => {
|
|
|
7535
7818
|
}
|
|
7536
7819
|
return 0;
|
|
7537
7820
|
};
|
|
7538
|
-
const
|
|
7821
|
+
const applyElementScroll = (el, dx, dy, behavior) => {
|
|
7822
|
+
const prevLeft = el.scrollLeft;
|
|
7823
|
+
const prevTop = el.scrollTop;
|
|
7824
|
+
const nextLeft = prevLeft + dx;
|
|
7825
|
+
const nextTop = prevTop + dy;
|
|
7826
|
+
if (behavior === "smooth" && typeof el.scroll === "function") {
|
|
7827
|
+
el.scroll({
|
|
7828
|
+
behavior,
|
|
7829
|
+
left: nextLeft,
|
|
7830
|
+
top: nextTop
|
|
7831
|
+
});
|
|
7832
|
+
return {
|
|
7833
|
+
dx,
|
|
7834
|
+
dy
|
|
7835
|
+
};
|
|
7836
|
+
}
|
|
7837
|
+
if (typeof el.scroll === "function") el.scroll({
|
|
7838
|
+
behavior,
|
|
7839
|
+
left: nextLeft,
|
|
7840
|
+
top: nextTop
|
|
7841
|
+
});
|
|
7842
|
+
if (el.scrollTop === prevTop && dy !== 0) el.scrollTop = nextTop;
|
|
7843
|
+
if (el.scrollLeft === prevLeft && dx !== 0) el.scrollLeft = nextLeft;
|
|
7844
|
+
return {
|
|
7845
|
+
dx: el.scrollLeft - prevLeft,
|
|
7846
|
+
dy: el.scrollTop - prevTop
|
|
7847
|
+
};
|
|
7848
|
+
};
|
|
7849
|
+
const scrollAncestors = (startElement, scrollingElement, rect, visibleBox, options) => {
|
|
7539
7850
|
let cur = rect;
|
|
7851
|
+
const margin = options.defaultReveal ? MARGIN : 0;
|
|
7852
|
+
if (getElementStyle(startElement)?.position === "fixed") return {
|
|
7853
|
+
cur,
|
|
7854
|
+
stopped: true
|
|
7855
|
+
};
|
|
7856
|
+
if (options.boundary === startElement) return {
|
|
7857
|
+
cur,
|
|
7858
|
+
stopped: true
|
|
7859
|
+
};
|
|
7540
7860
|
for (let el = getFlatTreeParentElement(startElement); el; el = getFlatTreeParentElement(el)) {
|
|
7541
|
-
if (
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
if (
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
const
|
|
7551
|
-
const
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7861
|
+
if (typeof options.boundary === "function" && !options.boundary(el)) return {
|
|
7862
|
+
cur,
|
|
7863
|
+
stopped: true
|
|
7864
|
+
};
|
|
7865
|
+
if (el === scrollingElement) return {
|
|
7866
|
+
cur,
|
|
7867
|
+
stopped: options.boundary === el
|
|
7868
|
+
};
|
|
7869
|
+
const style = getElementStyle(el);
|
|
7870
|
+
const scrollY = canScroll(el, style, "y", options.skipOverflowHiddenElements);
|
|
7871
|
+
const scrollX = canScroll(el, style, "x", options.skipOverflowHiddenElements);
|
|
7872
|
+
if (scrollY || scrollX) {
|
|
7873
|
+
const scale = getElementScale(el, el.getBoundingClientRect());
|
|
7874
|
+
const own = getScrollContainerBox(el, style, scale, margin);
|
|
7875
|
+
const isRtl = style?.direction === "rtl";
|
|
7876
|
+
const dy = scrollY ? visibleBox ? axisDelta({
|
|
7877
|
+
align: "nearest",
|
|
7878
|
+
end: cur.bottom,
|
|
7879
|
+
high: Math.min(own.bottom, visibleBox.bottom),
|
|
7880
|
+
low: Math.max(own.top, visibleBox.top),
|
|
7881
|
+
ownHigh: own.bottom,
|
|
7882
|
+
ownLow: own.top,
|
|
7883
|
+
scrollMode: "if-needed",
|
|
7884
|
+
start: cur.top
|
|
7885
|
+
}) : axisDelta({
|
|
7886
|
+
align: options.block,
|
|
7887
|
+
end: cur.bottom,
|
|
7888
|
+
high: own.bottom,
|
|
7889
|
+
low: own.top,
|
|
7890
|
+
scrollMode: options.scrollMode,
|
|
7891
|
+
start: cur.top
|
|
7892
|
+
}) : 0;
|
|
7893
|
+
const dx = scrollX ? visibleBox ? axisDelta({
|
|
7894
|
+
align: "nearest",
|
|
7895
|
+
end: cur.right,
|
|
7896
|
+
high: Math.min(own.right, visibleBox.right),
|
|
7897
|
+
low: Math.max(own.left, visibleBox.left),
|
|
7898
|
+
ownHigh: own.right,
|
|
7899
|
+
ownLow: own.left,
|
|
7900
|
+
rtl: isRtl,
|
|
7901
|
+
scrollMode: "if-needed",
|
|
7902
|
+
start: cur.left
|
|
7903
|
+
}) : axisDelta({
|
|
7904
|
+
align: options.inline,
|
|
7905
|
+
end: cur.right,
|
|
7906
|
+
high: own.right,
|
|
7907
|
+
low: own.left,
|
|
7908
|
+
rtl: isRtl,
|
|
7909
|
+
scrollMode: options.scrollMode,
|
|
7910
|
+
start: cur.left
|
|
7911
|
+
}) : 0;
|
|
7912
|
+
if (dy !== 0 || dx !== 0) {
|
|
7913
|
+
const applied = applyElementScroll(el, dx / scale.x, dy / scale.y, options.behavior);
|
|
7914
|
+
cur = shiftRect(cur, applied.dx * scale.x, applied.dy * scale.y);
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
if (style?.position === "fixed" || options.boundary === el) return {
|
|
7918
|
+
cur,
|
|
7919
|
+
stopped: true
|
|
7920
|
+
};
|
|
7921
|
+
}
|
|
7922
|
+
return {
|
|
7923
|
+
cur,
|
|
7924
|
+
stopped: false
|
|
7925
|
+
};
|
|
7557
7926
|
};
|
|
7558
7927
|
const outsideBox = (rect, box, tolerance = 0) => rect.top < box.top - tolerance || rect.bottom > box.bottom + tolerance || rect.left < box.left - tolerance || rect.right > box.right + tolerance;
|
|
7559
7928
|
const setCaretScrollMargin = (el, elRect, caret, top, right, bottom, left) => {
|
|
@@ -7563,7 +7932,7 @@ const canPanVisualViewport = (win, scrollingElement, el) => {
|
|
|
7563
7932
|
const vv = win.visualViewport;
|
|
7564
7933
|
return Boolean(vv && isDOMHTMLElement(el) && typeof el.scrollIntoView === "function" && (vv.height < scrollingElement.clientHeight || vv.width < scrollingElement.clientWidth));
|
|
7565
7934
|
};
|
|
7566
|
-
const panVisualViewportNearest = (win, scrollingElement, el, caret) => {
|
|
7935
|
+
const panVisualViewportNearest = (win, scrollingElement, el, caret, margin) => {
|
|
7567
7936
|
const vv = win.visualViewport;
|
|
7568
7937
|
if (!vv || !canPanVisualViewport(win, scrollingElement, el)) return caret;
|
|
7569
7938
|
const elRect = el.getBoundingClientRect();
|
|
@@ -7573,20 +7942,20 @@ const panVisualViewportNearest = (win, scrollingElement, el, caret) => {
|
|
|
7573
7942
|
const afterRect = el.getBoundingClientRect();
|
|
7574
7943
|
return shiftRect(caret, elRect.left - afterRect.left, elRect.top - afterRect.top);
|
|
7575
7944
|
};
|
|
7576
|
-
setCaretScrollMargin(el, elRect, caret,
|
|
7945
|
+
setCaretScrollMargin(el, elRect, caret, margin, margin, margin, margin);
|
|
7577
7946
|
el.scrollIntoView({
|
|
7578
7947
|
block: "nearest",
|
|
7579
7948
|
inline: "nearest"
|
|
7580
7949
|
});
|
|
7581
7950
|
let nextCaret = caretAfter();
|
|
7582
|
-
if (outsideBox(nextCaret, getVisibleViewportBox(win, scrollingElement), 1)) {
|
|
7951
|
+
if (outsideBox(nextCaret, getVisibleViewportBox(win, scrollingElement, margin), 1)) {
|
|
7583
7952
|
const rootStyle = win.getComputedStyle(scrollingElement);
|
|
7584
7953
|
const padTop = pad(rootStyle.scrollPaddingTop, vv.height);
|
|
7585
7954
|
const padRight = pad(rootStyle.scrollPaddingRight, vv.width);
|
|
7586
7955
|
const padBottom = pad(rootStyle.scrollPaddingBottom, vv.height);
|
|
7587
7956
|
const padLeft = pad(rootStyle.scrollPaddingLeft, vv.width);
|
|
7588
7957
|
if (padTop > 0 || padRight > 0 || padBottom > 0 || padLeft > 0) {
|
|
7589
|
-
setCaretScrollMargin(el, elRect, caret,
|
|
7958
|
+
setCaretScrollMargin(el, elRect, caret, margin + padTop, margin + padRight, margin + padBottom, margin + padLeft);
|
|
7590
7959
|
el.scrollIntoView({
|
|
7591
7960
|
block: "nearest",
|
|
7592
7961
|
inline: "nearest"
|
|
@@ -7598,12 +7967,12 @@ const panVisualViewportNearest = (win, scrollingElement, el, caret) => {
|
|
|
7598
7967
|
else el.style.removeProperty("scroll-margin");
|
|
7599
7968
|
return nextCaret;
|
|
7600
7969
|
};
|
|
7601
|
-
const panVisualViewportCenter = (win, scrollingElement, el, caret) => {
|
|
7970
|
+
const panVisualViewportCenter = (win, scrollingElement, el, caret, margin) => {
|
|
7602
7971
|
if (!canPanVisualViewport(win, scrollingElement, el)) return;
|
|
7603
7972
|
const elRect = el.getBoundingClientRect();
|
|
7604
7973
|
const prev = el.style.getPropertyValue("scroll-margin");
|
|
7605
7974
|
const priority = el.style.getPropertyPriority("scroll-margin");
|
|
7606
|
-
setCaretScrollMargin(el, elRect, caret,
|
|
7975
|
+
setCaretScrollMargin(el, elRect, caret, margin, margin, margin, margin);
|
|
7607
7976
|
el.scrollIntoView({
|
|
7608
7977
|
block: "center",
|
|
7609
7978
|
inline: "nearest"
|
|
@@ -7611,27 +7980,101 @@ const panVisualViewportCenter = (win, scrollingElement, el, caret) => {
|
|
|
7611
7980
|
if (prev) el.style.setProperty("scroll-margin", prev, priority);
|
|
7612
7981
|
else el.style.removeProperty("scroll-margin");
|
|
7613
7982
|
};
|
|
7983
|
+
const getEnclosingFrame = (win) => {
|
|
7984
|
+
try {
|
|
7985
|
+
return win.frameElement;
|
|
7986
|
+
} catch {
|
|
7987
|
+
return null;
|
|
7988
|
+
}
|
|
7989
|
+
};
|
|
7990
|
+
const mapRectIntoParentWindow = (rect, frame) => {
|
|
7991
|
+
const frameRect = frame.getBoundingClientRect();
|
|
7992
|
+
const frameStyle = getElementStyle(frame);
|
|
7993
|
+
const scale = getElementScale(frame, frameRect);
|
|
7994
|
+
const offsetX = frameRect.left + (parsePositivePx(frameStyle?.borderLeftWidth) + parsePositivePx(frameStyle?.paddingLeft)) * scale.x;
|
|
7995
|
+
const offsetY = frameRect.top + (parsePositivePx(frameStyle?.borderTopWidth) + parsePositivePx(frameStyle?.paddingTop)) * scale.y;
|
|
7996
|
+
return {
|
|
7997
|
+
bottom: offsetY + rect.bottom * scale.y,
|
|
7998
|
+
left: offsetX + rect.left * scale.x,
|
|
7999
|
+
right: offsetX + rect.right * scale.x,
|
|
8000
|
+
top: offsetY + rect.top * scale.y
|
|
8001
|
+
};
|
|
8002
|
+
};
|
|
8003
|
+
const scrollRectIntoView = ({ options, rect, scrollMarginTop, startElement }) => {
|
|
8004
|
+
const normalized = normalizeOptions(options);
|
|
8005
|
+
const margin = normalized.defaultReveal ? MARGIN : 0;
|
|
8006
|
+
const margins = readScrollMargins(startElement, scrollMarginTop);
|
|
8007
|
+
let cur = {
|
|
8008
|
+
bottom: rect.bottom + margins.bottom,
|
|
8009
|
+
left: rect.left - margins.left,
|
|
8010
|
+
right: rect.right + margins.right,
|
|
8011
|
+
top: rect.top - margins.top
|
|
8012
|
+
};
|
|
8013
|
+
let currentStart = startElement;
|
|
8014
|
+
for (let depth = 0; depth < MAX_IFRAME_DEPTH; depth += 1) {
|
|
8015
|
+
const doc = currentStart.ownerDocument;
|
|
8016
|
+
const scrollingElement = doc.scrollingElement ?? doc.documentElement;
|
|
8017
|
+
if (!scrollingElement) return;
|
|
8018
|
+
const { cur: afterAncestors, stopped } = scrollAncestors(currentStart, scrollingElement, cur, null, normalized);
|
|
8019
|
+
cur = afterAncestors;
|
|
8020
|
+
if (stopped) return;
|
|
8021
|
+
const win = doc.defaultView;
|
|
8022
|
+
if (!win) return;
|
|
8023
|
+
const isRtl = win.getComputedStyle(scrollingElement)?.direction === "rtl";
|
|
8024
|
+
let visible = getVisibleViewportBox(win, scrollingElement, margin);
|
|
8025
|
+
const dy = scrollingElement.scrollHeight > scrollingElement.clientHeight ? axisDelta({
|
|
8026
|
+
align: normalized.block,
|
|
8027
|
+
end: cur.bottom,
|
|
8028
|
+
high: visible.bottom,
|
|
8029
|
+
low: visible.top,
|
|
8030
|
+
scrollMode: normalized.scrollMode,
|
|
8031
|
+
start: cur.top
|
|
8032
|
+
}) : 0;
|
|
8033
|
+
const dx = scrollingElement.scrollWidth > scrollingElement.clientWidth ? axisDelta({
|
|
8034
|
+
align: normalized.inline,
|
|
8035
|
+
end: cur.right,
|
|
8036
|
+
high: visible.right,
|
|
8037
|
+
low: visible.left,
|
|
8038
|
+
rtl: isRtl,
|
|
8039
|
+
scrollMode: normalized.scrollMode,
|
|
8040
|
+
start: cur.left
|
|
8041
|
+
}) : 0;
|
|
8042
|
+
if (dy !== 0 || dx !== 0) {
|
|
8043
|
+
if (normalized.behavior === "smooth") {
|
|
8044
|
+
win.scrollBy({
|
|
8045
|
+
behavior: "smooth",
|
|
8046
|
+
left: dx,
|
|
8047
|
+
top: dy
|
|
8048
|
+
});
|
|
8049
|
+
cur = shiftRect(cur, dx, dy);
|
|
8050
|
+
} else {
|
|
8051
|
+
const prevY = win.scrollY;
|
|
8052
|
+
const prevX = win.scrollX;
|
|
8053
|
+
win.scrollBy(dx, dy);
|
|
8054
|
+
cur = shiftRect(cur, win.scrollX - prevX, win.scrollY - prevY);
|
|
8055
|
+
}
|
|
8056
|
+
visible = getVisibleViewportBox(win, scrollingElement, margin);
|
|
8057
|
+
}
|
|
8058
|
+
if (normalized.behavior !== "smooth") {
|
|
8059
|
+
if (outsideBox(cur, visible, 1)) {
|
|
8060
|
+
cur = panVisualViewportNearest(win, scrollingElement, currentStart, cur, margin);
|
|
8061
|
+
visible = getVisibleViewportBox(win, scrollingElement, margin);
|
|
8062
|
+
}
|
|
8063
|
+
if (outsideBox(cur, visible)) ({cur} = scrollAncestors(currentStart, scrollingElement, cur, visible, normalized));
|
|
8064
|
+
if (outsideBox(cur, visible, 1)) panVisualViewportCenter(win, scrollingElement, currentStart, cur, margin);
|
|
8065
|
+
}
|
|
8066
|
+
const frame = getEnclosingFrame(win);
|
|
8067
|
+
if (!frame || frame.ownerDocument === doc) return;
|
|
8068
|
+
if (normalized.boundary === frame || typeof normalized.boundary === "function" && !normalized.boundary(frame)) return;
|
|
8069
|
+
cur = mapRectIntoParentWindow(cur, frame);
|
|
8070
|
+
currentStart = frame;
|
|
8071
|
+
}
|
|
8072
|
+
};
|
|
7614
8073
|
const scrollRectIntoViewIfNeeded = ({ rect, startElement }) => {
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
let visible = getVisibleViewportBox(win, scrollingElement);
|
|
7620
|
-
const dy = scrollingElement.scrollHeight > scrollingElement.clientHeight ? axisDelta(cur.top, cur.bottom, visible.top, visible.bottom) : 0;
|
|
7621
|
-
const dx = scrollingElement.scrollWidth > scrollingElement.clientWidth ? axisDelta(cur.left, cur.right, visible.left, visible.right) : 0;
|
|
7622
|
-
if (dy !== 0 || dx !== 0) {
|
|
7623
|
-
const prevY = win.scrollY;
|
|
7624
|
-
const prevX = win.scrollX;
|
|
7625
|
-
win.scrollBy(dx, dy);
|
|
7626
|
-
cur = shiftRect(cur, win.scrollX - prevX, win.scrollY - prevY);
|
|
7627
|
-
visible = getVisibleViewportBox(win, scrollingElement);
|
|
7628
|
-
}
|
|
7629
|
-
if (outsideBox(cur, visible, 1)) {
|
|
7630
|
-
cur = panVisualViewportNearest(win, scrollingElement, startElement, cur);
|
|
7631
|
-
visible = getVisibleViewportBox(win, scrollingElement);
|
|
7632
|
-
}
|
|
7633
|
-
if (outsideBox(cur, visible)) cur = scrollAncestors(startElement, scrollingElement, cur, visible);
|
|
7634
|
-
if (outsideBox(cur, visible, 1)) panVisualViewportCenter(win, scrollingElement, startElement, cur);
|
|
8074
|
+
scrollRectIntoView({
|
|
8075
|
+
rect,
|
|
8076
|
+
startElement
|
|
8077
|
+
});
|
|
7635
8078
|
};
|
|
7636
8079
|
const scrollDOMRangeFocusIntoViewIfNeeded = (domRange, isBackward = false) => {
|
|
7637
8080
|
const focusRange = domRange.cloneRange();
|
|
@@ -7855,29 +8298,6 @@ const nextScrollIntoViewToken = (scope) => {
|
|
|
7855
8298
|
VIEW_TO_SCROLL_TOKEN.set(scope, token);
|
|
7856
8299
|
return token;
|
|
7857
8300
|
};
|
|
7858
|
-
const hasCSSScrollMargin = (element) => {
|
|
7859
|
-
const win = element.ownerDocument?.defaultView;
|
|
7860
|
-
if (!win) return false;
|
|
7861
|
-
const style = win.getComputedStyle(element);
|
|
7862
|
-
return (Number.parseFloat(element.style.scrollMarginTop || style.scrollMarginTop) || 0) > 0 || (Number.parseFloat(element.style.scrollMarginBottom || style.scrollMarginBottom) || 0) > 0 || (Number.parseFloat(element.style.scrollMarginLeft || style.scrollMarginLeft) || 0) > 0 || (Number.parseFloat(element.style.scrollMarginRight || style.scrollMarginRight) || 0) > 0;
|
|
7863
|
-
};
|
|
7864
|
-
const runScrollIntoViewIfNeeded = (element, options) => {
|
|
7865
|
-
if (typeof options !== "object" || options === null || typeof options.behavior === "function" || !hasCSSScrollMargin(element)) {
|
|
7866
|
-
scrollIntoViewIfNeeded(element, options);
|
|
7867
|
-
return;
|
|
7868
|
-
}
|
|
7869
|
-
const { behavior } = options;
|
|
7870
|
-
scrollIntoViewIfNeeded(element, {
|
|
7871
|
-
...options,
|
|
7872
|
-
behavior: (actions) => {
|
|
7873
|
-
for (const { el, left, top } of actions) if (el.scrollTop !== top || el.scrollLeft !== left) el.scroll({
|
|
7874
|
-
behavior,
|
|
7875
|
-
left,
|
|
7876
|
-
top
|
|
7877
|
-
});
|
|
7878
|
-
}
|
|
7879
|
-
});
|
|
7880
|
-
};
|
|
7881
8301
|
const getScrollIntoViewScope = (editor, fallback) => hasEditorRuntime(editor) ? getOwnViewPresentation(editor) ?? documentOf(editor) : fallback;
|
|
7882
8302
|
const findMountedAncestorRevealStep = (editor, targetRoot) => {
|
|
7883
8303
|
if (!hasEditorRuntime(editor)) return null;
|
|
@@ -8135,6 +8555,11 @@ const resolveDOMRangeInRoot = (editor, range, root, { checkPageText = false, exp
|
|
|
8135
8555
|
}
|
|
8136
8556
|
return domRange;
|
|
8137
8557
|
};
|
|
8558
|
+
const isTargetInsideVoid = (editor, target) => {
|
|
8559
|
+
if (!DOMEditor.hasTarget(editor, target)) return false;
|
|
8560
|
+
const editorNode = DOMEditor.resolveNode(editor, target);
|
|
8561
|
+
return !!editorNode && NodeApi.isElement(editorNode) && isVoid$2(editor, editorNode);
|
|
8562
|
+
};
|
|
8138
8563
|
const DOMEditorImpl = {
|
|
8139
8564
|
androidPendingDiffs: (editor) => EDITOR_TO_PENDING_DIFFS.get(editor),
|
|
8140
8565
|
androidScheduleFlush: (editor) => {
|
|
@@ -8269,22 +8694,30 @@ const DOMEditorImpl = {
|
|
|
8269
8694
|
const syncDomSelection = () => {
|
|
8270
8695
|
if (findDOMRootRuntime(el)?.isSelectionHeld()) return;
|
|
8271
8696
|
const innerSelection = resolveNextKeyCaret(editor, el);
|
|
8272
|
-
if (innerSelection)
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8697
|
+
if (!innerSelection) return;
|
|
8698
|
+
const projectedSelection = getSelectionDOMRange(editor, innerSelection);
|
|
8699
|
+
const view = projectedSelection ? reachAt(editor, projectedSelection) : null;
|
|
8700
|
+
const targetEditable = (view && view !== editor ? DOMEditor.editable(view) : null) ?? el;
|
|
8701
|
+
const targetRuntime = findDOMRootRuntime(targetEditable);
|
|
8702
|
+
if (targetRuntime?.isSelectionHeld()) return;
|
|
8703
|
+
if (targetRuntime?.exportSelection({
|
|
8704
|
+
coverageMode: "model-only",
|
|
8705
|
+
forceModelExport: true,
|
|
8706
|
+
requireFocused: true,
|
|
8707
|
+
skipScroll: true
|
|
8708
|
+
}) !== void 0) return;
|
|
8709
|
+
if (!projectedSelection) {
|
|
8710
|
+
clearEditableDOMSelection(el, { editor });
|
|
8711
|
+
return;
|
|
8287
8712
|
}
|
|
8713
|
+
const domRange = view && resolveDOMRangeInRoot(view, projectedSelection, void 0, {
|
|
8714
|
+
exportingSelection: true,
|
|
8715
|
+
rejectStaleText: true
|
|
8716
|
+
});
|
|
8717
|
+
if (domRange) writeEditableDOMSelection(targetEditable, getDOMRangeSelectionPoints(domRange, RangeApi.isBackward(projectedSelection)), {
|
|
8718
|
+
editor: view ?? editor,
|
|
8719
|
+
policy: "focused"
|
|
8720
|
+
});
|
|
8288
8721
|
};
|
|
8289
8722
|
const trySyncDomSelection = () => {
|
|
8290
8723
|
try {
|
|
@@ -8380,7 +8813,7 @@ const DOMEditorImpl = {
|
|
|
8380
8813
|
},
|
|
8381
8814
|
hasEditableTarget: (editor, target) => isDOMNode(target) && DOMEditor.hasDOMNode(editor, target, { editable: true }),
|
|
8382
8815
|
hasRange: (editor, { anchor, focus }) => hasPointPath(editor, anchor) && hasPointPath(editor, focus),
|
|
8383
|
-
hasSelectableTarget: (editor, target) => DOMEditor.hasEditableTarget(editor, target) ||
|
|
8816
|
+
hasSelectableTarget: (editor, target) => DOMEditor.hasEditableTarget(editor, target) || isTargetInsideVoid(editor, target) || DOMEditor.hasTarget(editor, target) && isSoftLineEndTarget(target),
|
|
8384
8817
|
hasTarget: (editor, target) => isDOMNode(target) && DOMEditor.hasDOMNode(editor, target),
|
|
8385
8818
|
clipboard: {
|
|
8386
8819
|
insertData: (editor, data) => insertDOMData(editor, data),
|
|
@@ -8393,12 +8826,7 @@ const DOMEditorImpl = {
|
|
|
8393
8826
|
isComposing: (editor) => !!IS_COMPOSING.get(editor),
|
|
8394
8827
|
isFocused: (editor) => !!IS_FOCUSED.get(editor),
|
|
8395
8828
|
isReadOnly: (editor) => !!IS_READ_ONLY.get(editor),
|
|
8396
|
-
isTargetInsideNonReadonlyVoid: (editor, target) =>
|
|
8397
|
-
if (IS_READ_ONLY.get(editor)) return false;
|
|
8398
|
-
if (!DOMEditor.hasTarget(editor, target)) return false;
|
|
8399
|
-
const editorNode = DOMEditor.resolveNode(editor, target);
|
|
8400
|
-
return !!editorNode && NodeApi.isElement(editorNode) && isVoid$2(editor, editorNode);
|
|
8401
|
-
},
|
|
8829
|
+
isTargetInsideNonReadonlyVoid: (editor, target) => !IS_READ_ONLY.get(editor) && isTargetInsideVoid(editor, target),
|
|
8402
8830
|
resolveDOMNode: (editor, nodeOrKey) => {
|
|
8403
8831
|
if (nodeOrKey === editor) return DOMEditor.editable(editor);
|
|
8404
8832
|
if (DOMEditor.editable(editor)?.isConnected !== true) return null;
|
|
@@ -8462,7 +8890,7 @@ const DOMEditorImpl = {
|
|
|
8462
8890
|
},
|
|
8463
8891
|
scroll: (editor) => getRegisteredScrollElement(editor) ?? DOMEditor.root(editor) ?? DOMEditor.editable(editor) ?? null,
|
|
8464
8892
|
scrollIntoView: (editor, target, options = { scrollMode: "if-needed" }) => {
|
|
8465
|
-
const usesDefaultReveal =
|
|
8893
|
+
const usesDefaultReveal = isDefaultScrollRevealOptions(options);
|
|
8466
8894
|
const readScrollMarginTop = (element) => {
|
|
8467
8895
|
const window = element.ownerDocument?.defaultView;
|
|
8468
8896
|
if (!window) return 0;
|
|
@@ -8564,13 +8992,15 @@ const DOMEditorImpl = {
|
|
|
8564
8992
|
left: scrollElement.scrollLeft,
|
|
8565
8993
|
top: scrollElement.scrollTop + elementRect.top - scrollRect.top - requestedScrollMarginTop
|
|
8566
8994
|
});
|
|
8567
|
-
} else
|
|
8995
|
+
} else {
|
|
8568
8996
|
const rect = element.getBoundingClientRect();
|
|
8569
|
-
if (isUsableScrollRect(rect))
|
|
8997
|
+
if (isUsableScrollRect(rect)) scrollRectIntoView({
|
|
8998
|
+
options,
|
|
8570
8999
|
rect: toScrollRect(rect),
|
|
9000
|
+
scrollMarginTop: requestedScrollMarginTop,
|
|
8571
9001
|
startElement: element
|
|
8572
9002
|
});
|
|
8573
|
-
}
|
|
9003
|
+
}
|
|
8574
9004
|
return;
|
|
8575
9005
|
}
|
|
8576
9006
|
const domRange = PointApi.isPoint(target) ? DOMEditor.resolveDOMRange(activeView, {
|
|
@@ -8590,31 +9020,14 @@ const DOMEditorImpl = {
|
|
|
8590
9020
|
scrollDOMRangeFocusIntoViewIfNeeded(domRange, Boolean(range && RangeApi.isBackward(range)));
|
|
8591
9021
|
return;
|
|
8592
9022
|
}
|
|
8593
|
-
const
|
|
8594
|
-
const
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
bottom: baseRect.bottom + nearestScrollMarginTop,
|
|
8602
|
-
height: baseRect.height + nearestScrollMarginTop,
|
|
8603
|
-
left: baseRect.left,
|
|
8604
|
-
right: baseRect.right,
|
|
8605
|
-
toJSON: () => baseRect.toJSON?.() ?? {},
|
|
8606
|
-
top: baseRect.top,
|
|
8607
|
-
width: baseRect.width,
|
|
8608
|
-
x: baseRect.x,
|
|
8609
|
-
y: baseRect.y
|
|
8610
|
-
};
|
|
8611
|
-
};
|
|
8612
|
-
try {
|
|
8613
|
-
runScrollIntoViewIfNeeded(leafElement, options);
|
|
8614
|
-
} finally {
|
|
8615
|
-
if (hadOwnRect) leafElement.getBoundingClientRect = originalGetBoundingClientRect;
|
|
8616
|
-
else Reflect.deleteProperty(leafElement, "getBoundingClientRect");
|
|
8617
|
-
}
|
|
9023
|
+
const rangeRect = typeof domRange.getBoundingClientRect === "function" ? domRange.getBoundingClientRect() : null;
|
|
9024
|
+
const baseRect = rangeRect && isUsableScrollRect(rangeRect) ? rangeRect : leafElement.getBoundingClientRect();
|
|
9025
|
+
if (!isUsableScrollRect(baseRect)) return;
|
|
9026
|
+
scrollRectIntoView({
|
|
9027
|
+
options,
|
|
9028
|
+
rect: toScrollRect(baseRect),
|
|
9029
|
+
startElement: leafElement
|
|
9030
|
+
});
|
|
8618
9031
|
};
|
|
8619
9032
|
if (!alwaysMode) {
|
|
8620
9033
|
const cancelInitial = schedulePhase(initialSchedulerView, "dom-editor-scroll-into-view", run);
|
|
@@ -9745,7 +10158,11 @@ function isHotkey(hotkey, optionsOrEvent, event) {
|
|
|
9745
10158
|
const targetEvent = isKeyboardEventLike(optionsOrEvent) ? optionsOrEvent : event;
|
|
9746
10159
|
const options = isKeyboardEventLike(optionsOrEvent) ? void 0 : optionsOrEvent;
|
|
9747
10160
|
if (!targetEvent) throw new TypeError("isHotkey requires a keyboard event");
|
|
9748
|
-
|
|
10161
|
+
const rawPlatform = options?.platform;
|
|
10162
|
+
return getCachedHotkeyMatcher(hotkey, {
|
|
10163
|
+
ignoreModifiers: options?.ignoreModifiers,
|
|
10164
|
+
platform: rawPlatform ?? (usesAppleDOMHotkeys(targetEvent) ? "apple" : "other")
|
|
10165
|
+
})(targetEvent);
|
|
9749
10166
|
}
|
|
9750
10167
|
//#endregion
|
|
9751
10168
|
//#region src/dom/utils/hotkeys.ts
|
|
@@ -9891,4 +10308,4 @@ const keyToDataAttribute = (key) => `data-editor-${toKebabCase(key)}`;
|
|
|
9891
10308
|
/** Return DOM data attribute names that mirror primitive node properties. */
|
|
9892
10309
|
const getNodeDataAttributeKeys = (node) => Object.keys(node).filter((key) => typeof node[key] !== "object" && (!TextApi.isText(node) || key !== "text")).map((key) => keyToDataAttribute(key));
|
|
9893
10310
|
//#endregion
|
|
9894
|
-
export { eventCarriesBlockFragment as $,
|
|
10311
|
+
export { eventCarriesBlockFragment as $, getDOMTextFlowRestoreSegments as $n, normalizeDOMPoint as $r, hasMountedDOMRoot as $t, createDOMEditorCapability as A, isAndroidDOMHost as An, IS_FOCUSED as Ar, SOFT_LINE_END as At, resolveWrittenDOMRange as B, getPliteStringCoordinatePlacement as Bn, getFlatTreeParentElement as Br, resolveSoftLineEndDOMPoint as Bt, normalizeRange as C, readsSelectionAsHost as Cn, EDITOR_TO_SCHEDULE_FLUSH as Cr, writeDOMDataTransferFragment as Ct, DOMEditor as D, CAN_USE_DOM as Dn, ELEMENT_TO_EDITOR as Dr, observeDataTransferInsertion as Dt, verifyDiffState as E, writeDOMSelection as En, EDITOR_TO_WINDOW as Er, dataTransferFormats as Et, isFocusRequestedElsewhere as F, usesAppleDOMHotkeys as Fn, NODE_TO_PARENT as Fr, isSoftLineTextStale as Ft, subscribeEditorDOMScope as G, getPliteStringPlacementAtX as Gn, isDOMElement as Gr, canWriteEditableDOMSelection as Gt, setEditorDOMEditableElement as H, getPliteStringDocumentOffset as Hn, hasShadowRoot as Hr, resolvePliteNodePath as Ht, isSelectableDOMSelection as I, caretShowsPointOffTextFlowCharacters as In, closestShadowAware as Ir, noteAfterInsertCaret as It, writeViewSelectionPart as J, getPliteTextHostStrings as Jn, isDOMNode as Jr, findDOMRootRuntime as Jt, supersedeFocusRequest as K, getPliteStringPlacementDOMPoint as Kn, isDOMHTMLElement as Kr, clearEditableDOMSelection as Kt, isTrackedMutation as L, createDOMGeometryKernel as Ln, containsShadowAware as Lr, readAfterInsertCaret as Lt, focusEditableElement as M, isGeckoDOMHost as Mn, IS_READ_ONLY as Mr, SOFT_LINE_FLAG as Mt, getEditorDOMHostScrollElement as N, isWebKitDOMHost as Nn, NODE_TO_ELEMENT as Nr, clearAfterInsertCaret as Nt, DOMResolutionError as O, getDOMHostLanguage as On, ELEMENT_TO_NODE as Or, writeDataTransferFragment as Ot, getOrCreateDOMNodeKey as P, supportsDOMBeforeInput as Pn, NODE_TO_INDEX as Pr, isSoftLineEndBetween as Pt, scrollDOMRangeFocusIntoViewIfNeeded as Q, isOnVisualRow as Qn, markPlainTextPaste as Qr, getEventTargetInRoot as Qt, resolveDOMPointInRoot as R, getNearestPliteStringRect as Rn, getActiveElement as Rr, readLowerSoftLineEnd as Rt, normalizePoint as S, readDOMSelectionRecord as Sn, EDITOR_TO_RUNTIME_ID_TO_KEY as Sr, domCommands as St, targetRange as T, sameDOMSelectionPoints as Tn, EDITOR_TO_USER_SELECTION as Tr, writeDOMRangeData as Tt, setEditorDOMRootElement as U, getPliteStringEdgeOffset as Un, isAfter as Ur, DOMRootRuntime as Ut, setEditableRootReveal as V, getPliteStringDirectPlacement as Vn, getSelection as Vr, findMountedDOMNodeByPath as Vt, setEditorDOMScrollElement as W, getPliteStringLength as Wn, isBefore as Wr, canWriteDOMSelection as Wt, liftCaretOutOfCollapsedSection as X, getUsableRangeRects as Xn, isDOMText as Xr, focusedElementOnPage as Xt, ensureFocusCaret as Y, getTextFlowPointAtCoordinates as Yn, isDOMSelection as Yr, findEditorDOMRootRuntime as Yt, resolveNextKeyCaret as Z, hasUsableDOMRect as Zn, isPlainTextOnlyPaste as Zr, getEditorDOMRoot as Zt, TRIPLE_CLICK as _, forgetDOMSelectionRecordWithin as _n, EDITOR_TO_PENDING_INSERTION_MARKS as _r, takeDragSession as _t, isLeaf as a, readEditableDOMSelectionPoints as an, resolveDOMTextFlowOffset as ar, indicateDOMDropTarget as at, longestCommonPrefixLength as b, readDOMSelectionPoints as bn, EDITOR_TO_ROOT_VIEW_EDITORS as br, subscribeDropIndicator as bt, isText as c, shouldClearEditableDOMSelection as cn, setDOMTextFlowRecordIndex as cr, restDOMBlockDrag as ct, Hotkeys as d, markDOMSyncMutationTarget as dn, isCollapsedDOMCoverageBoundary as dr, clearDragScrollRepaint as dt, readClipboardCut as ei, isElementFocused as en, isDOMTextFlowSegmentSynchronized as er, resolveBlockFragmentDropRange as et, getLineBoundaryKeyboardMove as f, watchDOMSyncTextMarks as fn, EDITOR_TO_ELEMENT as fr, clearDragSession as ft, isHotkey as g, forgetDOMSelectionRecord as gn, EDITOR_TO_PENDING_DIFFS as gr, settleDragSession as gt, createCompiledHotkeyMatcher as h, selectDOMInputDefaultActionPhase as hn, EDITOR_TO_PENDING_ACTION as hr, setDragScrollRepaint as ht, isElement as i, observeRootBoundaryEvent as in, resolveDOMTextFlowInsertTarget as ir, copyIntentOf as it, findDOMPointElementInRoot as j, isBlinkDOMHost as jn, IS_NODE_MAP_DIRTY as jr, SOFT_LINE_END_SELECTOR as jt, claimFocusRequest as k, hasDOMHostQuirk as kn, IS_COMPOSING as kr, Key as kt, isVoid as l, writeEditableDOMSelection as ln, setDOMTextFlowRecordIndexes as lr, beginDragSession as lt, ariaKeyShortcuts as m, enableKernelTraceRetention as mn, EDITOR_TO_KEY_TO_ELEMENT as mr, readDragSession as mt, getNodeDataAttributeKeys as n, isSelectionOwnedByEditable as nn, releaseDOMTextFlowRecordIndex as nr, intersectClipChain as nt, isNode as o, resolveDOMReach as on, resolveDOMTextFlowRecordDOMText as or, pointAt as ot, isPasteWithoutFormatting as p, scheduleEditorDOMPhase as pn, EDITOR_TO_FORCE_RENDER as pr, isDragSessionClaimed as pt, watchFocusSuperseded as q, getPliteTextHostBounds as qn, isDOMInputOrTextArea as qr, documentOf as qt, isEditor as r, movedFocusElsewhere as rn, resolveDOMTextFlowEntry as rr, walkClipChain as rt, isString as s, resolveDOMTargetView as sn, resolveDOMTextFlowRecordText as sr, resolveDOMDropTarget as st, getElements as t, writeClipboardCut as ti, isEventInsideRoot as tn, readDOMTextFlowPaint as tr, getDragAutoScrollTarget as tt, keyToDataAttribute as u, isDOMSyncMutation as un, DOMCoverage as ur, cancelDragRest as ut, dom as v, getDOMRangeSelectionPoints as vn, EDITOR_TO_PENDING_SELECTION as vr, publishDropIndicator as vt, normalizeStringDiff as w, recordDOMSelection as wn, EDITOR_TO_USER_MARKS as wr, writeDOMFragmentData as wt, mergeStringDiffs as x, readDOMSelectionRange as xn, EDITOR_TO_RUNTIME_ID_TO_ELEMENTS as xr, cleanDOMClipboardContents as xt, applyStringDiff as y, isDOMSelectionWriteEcho as yn, EDITOR_TO_PLACEHOLDER_ELEMENT as yr, readDropIndicator as yt, resolveDOMRangeInRoot as z, getOwnedPliteTextStrings as zn, getDefaultView as zr, recordSoftLineEnd as zt };
|