@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 CHANGED
@@ -2546,7 +2546,7 @@ function useContentEditable(options) {
2546
2546
  const { value, autoFocus, focusTrigger } = options;
2547
2547
  const elementRef = (0, react.useRef)(null);
2548
2548
  const cursorPosition = (0, react.useRef)(null);
2549
- const isFirstRender = (0, react.useRef)(true);
2549
+ const prevFocusTriggerRef = (0, react.useRef)(focusTrigger);
2550
2550
  const optionsRef = (0, react.useRef)(options);
2551
2551
  optionsRef.current = options;
2552
2552
  const ref = (0, react.useCallback)((node) => {
@@ -2571,10 +2571,8 @@ function useContentEditable(options) {
2571
2571
  }
2572
2572
  });
2573
2573
  (0, react.useEffect)(() => {
2574
- if (isFirstRender.current) {
2575
- isFirstRender.current = false;
2576
- return;
2577
- }
2574
+ if (prevFocusTriggerRef.current === focusTrigger) return;
2575
+ prevFocusTriggerRef.current = focusTrigger;
2578
2576
  elementRef.current?.focus();
2579
2577
  const selection = globalThis.getSelection();
2580
2578
  if (elementRef.current && selection) {