slate-react 0.91.11-202321613648 → 0.91.11
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/hooks/android-input-manager/android-input-manager.d.ts.map +1 -1
- package/dist/index.es.js +32 -8
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +34 -10
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +34 -10
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-input-manager.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/hooks/android-input-manager/android-input-manager.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAsB,KAAK,EAAE,KAAK,EAAoB,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAwBvD,oBAAY,MAAM,GAAG;IAAE,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"android-input-manager.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/hooks/android-input-manager/android-input-manager.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAsB,KAAK,EAAE,KAAK,EAAoB,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAwBvD,oBAAY,MAAM,GAAG;IAAE,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IAAC,GAAG,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AAgB5D,oBAAY,gCAAgC,GAAG;IAC7C,MAAM,EAAE,WAAW,CAAA;IAEnB,4BAA4B,EAAE,aAAa,CAAC,MAAM,IAAI,CAAC,CAAA;IACvD,oBAAoB,EAAE,aAAa,CAAC,MAAM,IAAI,CAAC,CAAA;CAChD,CAAA;AAED,oBAAY,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,aAAa,EAAE,MAAM,IAAI,CAAA;IAEzB,eAAe,EAAE,MAAM,OAAO,CAAA;IAC9B,gBAAgB,EAAE,MAAM,OAAO,CAAA;IAC/B,iBAAiB,EAAE,MAAM,OAAO,CAAA;IAChC,UAAU,EAAE,MAAM,OAAO,GAAG,QAAQ,CAAA;IAEpC,gBAAgB,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/C,oBAAoB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IAC7E,sBAAsB,EAAE,CACtB,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,KAC1C,IAAI,CAAA;IACT,oBAAoB,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,KAAK,IAAI,CAAA;IAEnE,kBAAkB,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,IAAI,CAAA;IACzD,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB,CAAA;AAED,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,4BAA4B,EAC5B,oBAAoB,GACrB,EAAE,gCAAgC,GAAG,mBAAmB,CAktBxD"}
|
package/dist/index.es.js
CHANGED
|
@@ -2425,7 +2425,10 @@ var RESOLVE_DELAY = 25; // Time with no user interaction before the current user
|
|
|
2425
2425
|
|
|
2426
2426
|
var FLUSH_DELAY = 200; // Replace with `const debug = console.log` to debug
|
|
2427
2427
|
|
|
2428
|
-
var debug = function debug() {};
|
|
2428
|
+
var debug = function debug() {}; // Type guard to check if a value is a DataTransfer
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
var isDataTransfer = value => (value === null || value === void 0 ? void 0 : value.constructor.name) === 'DataTransfer';
|
|
2429
2432
|
|
|
2430
2433
|
function createAndroidInputManager(_ref) {
|
|
2431
2434
|
var {
|
|
@@ -2954,24 +2957,45 @@ function createAndroidInputManager(_ref) {
|
|
|
2954
2957
|
case 'insertReplacementText':
|
|
2955
2958
|
case 'insertText':
|
|
2956
2959
|
{
|
|
2957
|
-
if ((data
|
|
2960
|
+
if (isDataTransfer(data)) {
|
|
2958
2961
|
return scheduleAction(() => ReactEditor.insertData(editor, data), {
|
|
2959
2962
|
at: targetRange
|
|
2960
2963
|
});
|
|
2961
2964
|
}
|
|
2962
2965
|
|
|
2963
|
-
if (typeof data === 'string' && data.includes('\n')) {
|
|
2964
|
-
return scheduleAction(() => Editor.insertSoftBreak(editor), {
|
|
2965
|
-
at: Range.end(targetRange)
|
|
2966
|
-
});
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
2966
|
var _text = data !== null && data !== void 0 ? data : ''; // COMPAT: If we are writing inside a placeholder, the ime inserts the text inside
|
|
2970
2967
|
// the placeholder itself and thus includes the zero-width space inside edit events.
|
|
2971
2968
|
|
|
2972
2969
|
|
|
2973
2970
|
if (EDITOR_TO_PENDING_INSERTION_MARKS.get(editor)) {
|
|
2974
2971
|
_text = _text.replace('\uFEFF', '');
|
|
2972
|
+
} // Pastes from the Android clipboard will generate `insertText` events.
|
|
2973
|
+
// If the copied text contains any newlines, Android will append an
|
|
2974
|
+
// extra newline to the end of the copied text.
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
if (type === 'insertText' && /.*\n.*\n$/.test(_text)) {
|
|
2978
|
+
_text = _text.slice(0, -1);
|
|
2979
|
+
} // If the text includes a newline, split it at newlines and paste each component
|
|
2980
|
+
// string, with soft breaks in between each.
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
if (_text.includes('\n')) {
|
|
2984
|
+
return scheduleAction(() => {
|
|
2985
|
+
var parts = _text.split('\n');
|
|
2986
|
+
|
|
2987
|
+
parts.forEach((line, i) => {
|
|
2988
|
+
if (line) {
|
|
2989
|
+
Editor.insertText(editor, line);
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
if (i !== parts.length - 1) {
|
|
2993
|
+
Editor.insertSoftBreak(editor);
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
}, {
|
|
2997
|
+
at: targetRange
|
|
2998
|
+
});
|
|
2975
2999
|
}
|
|
2976
3000
|
|
|
2977
3001
|
if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {
|