slate-react 0.117.2 → 0.117.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.
@@ -1 +1 @@
1
- {"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,OAAO,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,mFAgDrB,CAAA"}
1
+ {"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../../../../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAQ,MAAM,OAAO,CAAA;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAI5C;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,mFA8DrB,CAAA"}
@@ -3579,7 +3579,22 @@
3579
3579
  insertPositionHint = false;
3580
3580
  }
3581
3581
  if (canStoreDiff) {
3582
+ var currentSelection = editor.selection;
3582
3583
  storeDiff(_start.path, _diff);
3584
+ if (currentSelection) {
3585
+ var newPoint = {
3586
+ path: _start.path,
3587
+ offset: _start.offset + _text.length
3588
+ };
3589
+ scheduleAction(function () {
3590
+ slate.Transforms.select(editor, {
3591
+ anchor: newPoint,
3592
+ focus: newPoint
3593
+ });
3594
+ }, {
3595
+ at: newPoint
3596
+ });
3597
+ }
3583
3598
  return;
3584
3599
  }
3585
3600
  }
@@ -38288,10 +38303,23 @@
38288
38303
  e = withDOM(e, clipboardFormatKey);
38289
38304
  var _e = e,
38290
38305
  onChange = _e.onChange,
38291
- apply = _e.apply;
38306
+ apply = _e.apply,
38307
+ insertText = _e.insertText;
38292
38308
  e.getChunkSize = function () {
38293
38309
  return null;
38294
38310
  };
38311
+ if (IS_ANDROID) {
38312
+ e.insertText = function (text, options) {
38313
+ // COMPAT: Android devices, specifically Samsung devices, experience cursor jumping.
38314
+ // This issue occurs when the ⁠insertText function is called immediately after typing.
38315
+ // The problem arises because typing schedules a selection change.
38316
+ // However, this selection change is only executed after the ⁠insertText function.
38317
+ // As a result, the already obsolete selection is applied, leading to incorrect
38318
+ // final cursor position.
38319
+ EDITOR_TO_PENDING_SELECTION["delete"](e);
38320
+ return insertText(text, options);
38321
+ };
38322
+ }
38295
38323
  e.onChange = function (options) {
38296
38324
  // COMPAT: React < 18 doesn't batch `setState` hook calls, which means
38297
38325
  // that the children and selection can get out of sync for one render