slate-react 0.124.2 → 0.125.1-20260630174312

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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-decorations.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-decorations.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAQ,SAAS,EAAE,MAAM,OAAO,CAAA;AAOnE,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAE1B;;;GAGG;AAEH,eAAO,MAAM,eAAe;oCACM,cAAc,EAAE;iCACnB,QAAQ,KAAK,MAAM,IAAI;EACzC,CAAA;AAEb,eAAO,MAAM,cAAc,SACnB,UAAU,qBACG,cAAc,EAAE,KAClC,cAAc,EA0BhB,CAAA;AAED,eAAO,MAAM,kBAAkB,uCACO,cAAc,EAAE;;iCAgBJ,QAAQ;CAYzD,CAAA"}
1
+ {"version":3,"file":"use-decorations.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/hooks/use-decorations.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAQ,SAAS,EAAE,MAAM,OAAO,CAAA;AAOnE,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAE1B;;;GAGG;AAEH,eAAO,MAAM,eAAe;oCACM,cAAc,EAAE;iCACnB,QAAQ,KAAK,MAAM,IAAI;EACzC,CAAA;AAEb,eAAO,MAAM,cAAc,SACnB,UAAU,qBACG,cAAc,EAAE,KAClC,cAAc,EA0BhB,CAAA;AAED,eAAO,MAAM,kBAAkB,uCACO,cAAc,EAAE;;iCAwBJ,QAAQ;CAYzD,CAAA"}
package/dist/index.es.js CHANGED
@@ -1150,11 +1150,19 @@ var useDecorations = (node, parentDecorations) => {
1150
1150
  return useMemo(() => [...decorations, ...parentDecorations], [decorations, parentDecorations]);
1151
1151
  };
1152
1152
  var useDecorateContext = decorateProp => {
1153
+ var [, forceUpdate] = useReducer(s => s + 1, 0);
1153
1154
  var eventListeners = useRef(new Set());
1154
1155
  var latestDecorate = useRef(decorateProp);
1155
1156
  useIsomorphicLayoutEffect(() => {
1156
1157
  latestDecorate.current = decorateProp;
1157
1158
  eventListeners.current.forEach(listener => listener());
1159
+ // Force Editable to re-render in the same batch as the text components
1160
+ // notified above, so its selection-restoration layout effect runs after
1161
+ // the decoration-induced DOM changes are committed. Without this, the
1162
+ // text components restructure the DOM in a separate pass where
1163
+ // Editable's layout effect never fires, potentially leaving the caret
1164
+ // at a wrong position.
1165
+ forceUpdate();
1158
1166
  }, [decorateProp]);
1159
1167
  var decorate = useCallback(entry => latestDecorate.current(entry), []);
1160
1168
  var addEventListener = useCallback(callback => {