slate-react 0.133.0 → 0.133.2-20261010231908
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/components/editable.d.ts.map +1 -1
- package/dist/hooks/use-composition-dom.d.ts +8 -0
- package/dist/hooks/use-composition-dom.d.ts.map +1 -0
- package/dist/index.es.js +94 -43
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +100 -45
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +102 -45
- package/dist/slate-react.min.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KASN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,EAEL,OAAO,EAEP,SAAS,EAIT,IAAI,EAEJ,cAAc,EACd,YAAY,EACb,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"editable.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/components/editable.tsx"],"names":[],"mappings":"AAGA,OAAO,KASN,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAE3B,OAAO,EAEL,OAAO,EAEP,SAAS,EAIT,IAAI,EAEJ,cAAc,EACd,YAAY,EACb,MAAM,OAAO,CAAA;AASd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,OAAO,EAGL,QAAQ,EAQT,MAAM,WAAW,CAAA;AA0DlB;;GAEG;AAEH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE;QACV,iBAAiB,EAAE,SAAS,CAAA;QAC5B,mBAAmB,CAAC,EAAE,IAAI,CAAA;QAC1B,iBAAiB,CAAC,EAAE,I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AAA;AAED;;GAEG;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,cAAc,EAAa,CAAA;AAE/E;;GAEG;AAEH,eAAO,MAAM,8BAA8B,WACjC,WAAW,YACT,QAAQ,SAwCnB,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,cAAc,gHAIO,IAAI,GAAG,OAAO,yBAc/C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,yFAUjC,CAAA;AAED;;GAEG;AAEH,eAAO,MAAM,iBAAiB,uDAEJ,IAAI,GAAG,OAAO,yBAevC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactEditor } from '../plugin/react-editor';
|
|
2
|
+
export declare const useCompositionDOM: (editor: ReactEditor) => {
|
|
3
|
+
track: (text: string | null) => void;
|
|
4
|
+
pause: () => void;
|
|
5
|
+
restore: () => void;
|
|
6
|
+
clear: () => void;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use-composition-dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-composition-dom.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-composition-dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,eAAO,MAAM,iBAAiB,WAAY,WAAW;kBAW5B,MAAM,GAAG,IAAI;;;;CA4BrC,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import throttle from 'lodash/throttle';
|
|
|
4
4
|
import React, { useContext, createContext, useRef, useEffect, useLayoutEffect, useState, memo, forwardRef, useCallback, useReducer, useMemo, Fragment, Component } from 'react';
|
|
5
5
|
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
6
6
|
import { Node, Range, Editor, Path, Transforms, Location, Text as Text$1, Point, Scrubber } from 'slate';
|
|
7
|
-
import { DOMEditor, isTrackedMutation, EDITOR_TO_FORCE_RENDER, IS_NODE_MAP_DIRTY, EDITOR_TO_PENDING_DIFFS, EDITOR_TO_PENDING_SELECTION, applyStringDiff, EDITOR_TO_PENDING_INSERTION_MARKS, isDOMSelection, IS_COMPOSING, EDITOR_TO_PENDING_ACTION, EDITOR_TO_USER_MARKS, targetRange, verifyDiffState, EDITOR_TO_PLACEHOLDER_ELEMENT, normalizeStringDiff, mergeStringDiffs, normalizeRange, normalizePoint, CAN_USE_DOM, IS_ANDROID, EDITOR_TO_SCHEDULE_FLUSH, MARK_PLACEHOLDER_SYMBOL, PLACEHOLDER_SYMBOL, IS_WEBKIT, isTextDecorationsEqual, isElementDecorationsEqual, EDITOR_TO_KEY_TO_ELEMENT, NODE_TO_ELEMENT, ELEMENT_TO_NODE, NODE_TO_INDEX, NODE_TO_PARENT, Key, splitDecorationsByChild, IS_READ_ONLY, getActiveElement, getSelection, IS_FOCUSED, isDOMNode, getDefaultView, EDITOR_TO_WINDOW, EDITOR_TO_ELEMENT, IS_FIREFOX, containsShadowAware, EDITOR_TO_USER_SELECTION, HAS_BEFORE_INPUT_SUPPORT, isPlainTextOnlyPaste, Hotkeys,
|
|
7
|
+
import { DOMEditor, isTrackedMutation, EDITOR_TO_FORCE_RENDER, IS_NODE_MAP_DIRTY, EDITOR_TO_PENDING_DIFFS, EDITOR_TO_PENDING_SELECTION, applyStringDiff, EDITOR_TO_PENDING_INSERTION_MARKS, isDOMSelection, IS_COMPOSING, EDITOR_TO_PENDING_ACTION, EDITOR_TO_USER_MARKS, targetRange, verifyDiffState, EDITOR_TO_PLACEHOLDER_ELEMENT, normalizeStringDiff, mergeStringDiffs, normalizeRange, normalizePoint, CAN_USE_DOM, IS_ANDROID, EDITOR_TO_SCHEDULE_FLUSH, MARK_PLACEHOLDER_SYMBOL, PLACEHOLDER_SYMBOL, IS_WEBKIT, isTextDecorationsEqual, isElementDecorationsEqual, EDITOR_TO_KEY_TO_ELEMENT, NODE_TO_ELEMENT, ELEMENT_TO_NODE, NODE_TO_INDEX, NODE_TO_PARENT, Key, splitDecorationsByChild, IS_READ_ONLY, getActiveElement, getSelection, IS_FOCUSED, isDOMNode, getDefaultView, EDITOR_TO_WINDOW, EDITOR_TO_ELEMENT, IS_FIREFOX, containsShadowAware, IS_CHROME, EDITOR_TO_USER_SELECTION, HAS_BEFORE_INPUT_SUPPORT, isPlainTextOnlyPaste, Hotkeys, IS_FIREFOX_LEGACY, IS_IOS, IS_WECHATBROWSER, IS_UC_MOBILE, TRIPLE_CLICK, isDOMElement, EDITOR_TO_ON_CHANGE, withDOM } from 'slate-dom';
|
|
8
8
|
export { NODE_TO_INDEX, NODE_TO_PARENT } from 'slate-dom';
|
|
9
9
|
import ReactDOM from 'react-dom';
|
|
10
10
|
import { ResizeObserver } from '@juggle/resize-observer';
|
|
@@ -2493,6 +2493,86 @@ function useTrackUserInput() {
|
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
2495
|
|
|
2496
|
+
const createRestoreDomManager = (editor, receivedUserInput) => {
|
|
2497
|
+
let bufferedMutations = [];
|
|
2498
|
+
const clear = () => {
|
|
2499
|
+
bufferedMutations = [];
|
|
2500
|
+
};
|
|
2501
|
+
const registerMutations = mutations => {
|
|
2502
|
+
if (!receivedUserInput.current) {
|
|
2503
|
+
return;
|
|
2504
|
+
}
|
|
2505
|
+
const trackedMutations = mutations.filter(mutation => isTrackedMutation(editor, mutation, mutations));
|
|
2506
|
+
bufferedMutations.push(...trackedMutations);
|
|
2507
|
+
};
|
|
2508
|
+
function restoreDOM() {
|
|
2509
|
+
if (bufferedMutations.length > 0) {
|
|
2510
|
+
bufferedMutations.reverse().forEach(mutation => {
|
|
2511
|
+
if (mutation.type === 'characterData') {
|
|
2512
|
+
// We don't want to restore the DOM for characterData mutations
|
|
2513
|
+
// because this interrupts the composition.
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
mutation.removedNodes.forEach(node => {
|
|
2517
|
+
mutation.target.insertBefore(node, mutation.nextSibling);
|
|
2518
|
+
});
|
|
2519
|
+
mutation.addedNodes.forEach(node => {
|
|
2520
|
+
mutation.target.removeChild(node);
|
|
2521
|
+
});
|
|
2522
|
+
});
|
|
2523
|
+
// Clear buffered mutations to ensure we don't undo them twice
|
|
2524
|
+
clear();
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
return {
|
|
2528
|
+
registerMutations,
|
|
2529
|
+
restoreDOM,
|
|
2530
|
+
clear
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
const useCompositionDOM = editor => {
|
|
2535
|
+
const compositionDOM = useMemo(() => {
|
|
2536
|
+
const manager = createRestoreDomManager(editor, {
|
|
2537
|
+
current: true
|
|
2538
|
+
});
|
|
2539
|
+
let observer = null;
|
|
2540
|
+
const clear = () => {
|
|
2541
|
+
var _observer;
|
|
2542
|
+
(_observer = observer) === null || _observer === void 0 || _observer.disconnect();
|
|
2543
|
+
observer = null;
|
|
2544
|
+
manager.clear();
|
|
2545
|
+
};
|
|
2546
|
+
const track = text => {
|
|
2547
|
+
if (!observer) {
|
|
2548
|
+
if (!(text !== null && text !== void 0 && text.includes('\n'))) return;
|
|
2549
|
+
observer = new MutationObserver(manager.registerMutations);
|
|
2550
|
+
}
|
|
2551
|
+
observer.observe(ReactEditor.toDOMNode(editor, editor), {
|
|
2552
|
+
childList: true,
|
|
2553
|
+
subtree: true
|
|
2554
|
+
});
|
|
2555
|
+
};
|
|
2556
|
+
const pause = () => {
|
|
2557
|
+
if (!observer) return;
|
|
2558
|
+
manager.registerMutations(observer.takeRecords());
|
|
2559
|
+
observer.disconnect();
|
|
2560
|
+
};
|
|
2561
|
+
const restore = () => {
|
|
2562
|
+
pause();
|
|
2563
|
+
manager.restoreDOM();
|
|
2564
|
+
};
|
|
2565
|
+
return {
|
|
2566
|
+
track,
|
|
2567
|
+
pause,
|
|
2568
|
+
restore,
|
|
2569
|
+
clear
|
|
2570
|
+
};
|
|
2571
|
+
}, [editor]);
|
|
2572
|
+
useEffect(() => () => compositionDOM.clear(), [compositionDOM]);
|
|
2573
|
+
return compositionDOM;
|
|
2574
|
+
};
|
|
2575
|
+
|
|
2496
2576
|
const blockPathAt = (editor, point) => {
|
|
2497
2577
|
var _Editor$above;
|
|
2498
2578
|
return (_Editor$above = Editor.above(editor, {
|
|
@@ -2536,44 +2616,6 @@ const deleteMovedRange = (editor, range) => {
|
|
|
2536
2616
|
}
|
|
2537
2617
|
};
|
|
2538
2618
|
|
|
2539
|
-
const createRestoreDomManager = (editor, receivedUserInput) => {
|
|
2540
|
-
let bufferedMutations = [];
|
|
2541
|
-
const clear = () => {
|
|
2542
|
-
bufferedMutations = [];
|
|
2543
|
-
};
|
|
2544
|
-
const registerMutations = mutations => {
|
|
2545
|
-
if (!receivedUserInput.current) {
|
|
2546
|
-
return;
|
|
2547
|
-
}
|
|
2548
|
-
const trackedMutations = mutations.filter(mutation => isTrackedMutation(editor, mutation, mutations));
|
|
2549
|
-
bufferedMutations.push(...trackedMutations);
|
|
2550
|
-
};
|
|
2551
|
-
function restoreDOM() {
|
|
2552
|
-
if (bufferedMutations.length > 0) {
|
|
2553
|
-
bufferedMutations.reverse().forEach(mutation => {
|
|
2554
|
-
if (mutation.type === 'characterData') {
|
|
2555
|
-
// We don't want to restore the DOM for characterData mutations
|
|
2556
|
-
// because this interrupts the composition.
|
|
2557
|
-
return;
|
|
2558
|
-
}
|
|
2559
|
-
mutation.removedNodes.forEach(node => {
|
|
2560
|
-
mutation.target.insertBefore(node, mutation.nextSibling);
|
|
2561
|
-
});
|
|
2562
|
-
mutation.addedNodes.forEach(node => {
|
|
2563
|
-
mutation.target.removeChild(node);
|
|
2564
|
-
});
|
|
2565
|
-
});
|
|
2566
|
-
// Clear buffered mutations to ensure we don't undo them twice
|
|
2567
|
-
clear();
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
return {
|
|
2571
|
-
registerMutations,
|
|
2572
|
-
restoreDOM,
|
|
2573
|
-
clear
|
|
2574
|
-
};
|
|
2575
|
-
};
|
|
2576
|
-
|
|
2577
2619
|
const MUTATION_OBSERVER_CONFIG = {
|
|
2578
2620
|
subtree: true,
|
|
2579
2621
|
childList: true,
|
|
@@ -2693,6 +2735,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
2693
2735
|
const deferredOperations = useRef([]);
|
|
2694
2736
|
const [placeholderHeight, setPlaceholderHeight] = useState();
|
|
2695
2737
|
const processing = useRef(false);
|
|
2738
|
+
const compositionDOM = useCompositionDOM(editor);
|
|
2696
2739
|
const {
|
|
2697
2740
|
onUserInput,
|
|
2698
2741
|
receivedUserInput
|
|
@@ -3015,6 +3058,9 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3015
3058
|
// COMPAT: use composition change events as a hint to where we should insert
|
|
3016
3059
|
// composition text if we aren't composing to work around https://github.com/ianstormtaylor/slate/issues/5038
|
|
3017
3060
|
if (isCompositionChange && ReactEditor.isComposing(editor)) {
|
|
3061
|
+
if (IS_CHROME) {
|
|
3062
|
+
compositionDOM.track(event.data);
|
|
3063
|
+
}
|
|
3018
3064
|
return;
|
|
3019
3065
|
}
|
|
3020
3066
|
let native = false;
|
|
@@ -3232,7 +3278,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3232
3278
|
Transforms.select(editor, toRestore);
|
|
3233
3279
|
}
|
|
3234
3280
|
}
|
|
3235
|
-
}, [editor, onDOMSelectionChange, onUserInput, propsOnDOMBeforeInput, readOnly, scheduleOnDOMSelectionChange]);
|
|
3281
|
+
}, [editor, onDOMSelectionChange, onUserInput, propsOnDOMBeforeInput, compositionDOM, readOnly, scheduleOnDOMSelectionChange]);
|
|
3236
3282
|
const callbackRef = useCallback(node => {
|
|
3237
3283
|
if (node == null) {
|
|
3238
3284
|
onDOMSelectionChange.cancel();
|
|
@@ -3444,6 +3490,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3444
3490
|
}
|
|
3445
3491
|
}, [attributes.onBeforeInput, editor, readOnly]),
|
|
3446
3492
|
onInput: useCallback(event => {
|
|
3493
|
+
compositionDOM.pause();
|
|
3447
3494
|
if (isEventHandled(event, attributes.onInput)) {
|
|
3448
3495
|
return;
|
|
3449
3496
|
}
|
|
@@ -3466,7 +3513,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3466
3513
|
if (!ReactEditor.isFocused(editor)) {
|
|
3467
3514
|
handleNativeHistoryEvents(editor, event.nativeEvent);
|
|
3468
3515
|
}
|
|
3469
|
-
}, [attributes.onInput, editor]),
|
|
3516
|
+
}, [attributes.onInput, editor, compositionDOM]),
|
|
3470
3517
|
onBlur: useCallback(event => {
|
|
3471
3518
|
if (readOnly || state.isUpdatingSelection || !ReactEditor.hasSelectableTarget(editor, event.target) || isEventHandled(event, attributes.onBlur)) {
|
|
3472
3519
|
return;
|
|
@@ -3579,6 +3626,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3579
3626
|
}
|
|
3580
3627
|
(_androidInputManagerR3 = androidInputManagerRef.current) === null || _androidInputManagerR3 === void 0 || _androidInputManagerR3.handleCompositionEnd(event);
|
|
3581
3628
|
if (isEventHandled(event, attributes.onCompositionEnd) || IS_ANDROID) {
|
|
3629
|
+
compositionDOM.clear();
|
|
3582
3630
|
return;
|
|
3583
3631
|
}
|
|
3584
3632
|
// COMPAT: In Chrome, `beforeinput` events for compositions
|
|
@@ -3593,6 +3641,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3593
3641
|
EDITOR_TO_USER_MARKS.set(editor, editor.marks);
|
|
3594
3642
|
editor.marks = placeholderMarks;
|
|
3595
3643
|
}
|
|
3644
|
+
compositionDOM.restore();
|
|
3596
3645
|
Editor.insertText(editor, event.data);
|
|
3597
3646
|
const userMarks = EDITOR_TO_USER_MARKS.get(editor);
|
|
3598
3647
|
EDITOR_TO_USER_MARKS.delete(editor);
|
|
@@ -3600,8 +3649,9 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3600
3649
|
editor.marks = userMarks;
|
|
3601
3650
|
}
|
|
3602
3651
|
}
|
|
3652
|
+
compositionDOM.clear();
|
|
3603
3653
|
}
|
|
3604
|
-
}, [attributes.onCompositionEnd, editor]),
|
|
3654
|
+
}, [attributes.onCompositionEnd, editor, compositionDOM]),
|
|
3605
3655
|
onCompositionUpdate: useCallback(event => {
|
|
3606
3656
|
if (ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionUpdate) && !isDOMEventTargetInput(event)) {
|
|
3607
3657
|
if (!ReactEditor.isComposing(editor)) {
|
|
@@ -3620,6 +3670,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3620
3670
|
if (isEventHandled(event, attributes.onCompositionStart) || IS_ANDROID) {
|
|
3621
3671
|
return;
|
|
3622
3672
|
}
|
|
3673
|
+
compositionDOM.clear();
|
|
3623
3674
|
setIsComposing(true);
|
|
3624
3675
|
const {
|
|
3625
3676
|
selection
|
|
@@ -3629,7 +3680,7 @@ const Editable = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
3629
3680
|
return;
|
|
3630
3681
|
}
|
|
3631
3682
|
}
|
|
3632
|
-
}, [attributes.onCompositionStart, editor]),
|
|
3683
|
+
}, [attributes.onCompositionStart, editor, compositionDOM]),
|
|
3633
3684
|
onCopy: useCallback(event => {
|
|
3634
3685
|
if (ReactEditor.hasSelectableTarget(editor, event.target) && !isEventHandled(event, attributes.onCopy) && !isDOMEventTargetInput(event)) {
|
|
3635
3686
|
event.preventDefault();
|