@revisium/schema-toolkit-ui 0.3.2 → 0.3.3
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/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +3 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2520,7 +2520,7 @@ function useContentEditable(options) {
|
|
|
2520
2520
|
const { value, autoFocus, focusTrigger } = options;
|
|
2521
2521
|
const elementRef = useRef(null);
|
|
2522
2522
|
const cursorPosition = useRef(null);
|
|
2523
|
-
const
|
|
2523
|
+
const prevFocusTriggerRef = useRef(focusTrigger);
|
|
2524
2524
|
const optionsRef = useRef(options);
|
|
2525
2525
|
optionsRef.current = options;
|
|
2526
2526
|
const ref = useCallback((node) => {
|
|
@@ -2545,10 +2545,8 @@ function useContentEditable(options) {
|
|
|
2545
2545
|
}
|
|
2546
2546
|
});
|
|
2547
2547
|
useEffect(() => {
|
|
2548
|
-
if (
|
|
2549
|
-
|
|
2550
|
-
return;
|
|
2551
|
-
}
|
|
2548
|
+
if (prevFocusTriggerRef.current === focusTrigger) return;
|
|
2549
|
+
prevFocusTriggerRef.current = focusTrigger;
|
|
2552
2550
|
elementRef.current?.focus();
|
|
2553
2551
|
const selection = globalThis.getSelection();
|
|
2554
2552
|
if (elementRef.current && selection) {
|