@portabletext/editor 1.47.4 → 1.47.5
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/lib/index.cjs +5 -8
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +5 -8
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/editor/Editable.tsx +12 -12
package/lib/index.cjs
CHANGED
|
@@ -1247,21 +1247,18 @@ const debug = editorProvider.debugWithName("component:Editable"), PLACEHOLDER_ST
|
|
|
1247
1247
|
debug("No result from custom paste handler, pasting normally");
|
|
1248
1248
|
}, [editorActor, onPaste, portableTextEditor, slateEditor]), handleOnFocus = React.useCallback((event_2) => {
|
|
1249
1249
|
if (onFocus && onFocus(event_2), !event_2.isDefaultPrevented()) {
|
|
1250
|
-
|
|
1250
|
+
const selection_3 = editorProvider.PortableTextEditor.getSelection(portableTextEditor);
|
|
1251
|
+
selection_3 === null && (slate.Transforms.select(slateEditor, slate.Editor.start(slateEditor, [])), slateEditor.onChange()), editorActor.send({
|
|
1251
1252
|
type: "notify.focused",
|
|
1252
1253
|
event: event_2
|
|
1253
1254
|
});
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
editor: slateEditor,
|
|
1257
|
-
range: slateEditor.selection
|
|
1258
|
-
}) : null;
|
|
1259
|
-
selection_3 && editorActor.send({
|
|
1255
|
+
const newSelection = editorProvider.PortableTextEditor.getSelection(portableTextEditor);
|
|
1256
|
+
selection_3 === newSelection && editorActor.send({
|
|
1260
1257
|
type: "notify.selection",
|
|
1261
1258
|
selection: selection_3
|
|
1262
1259
|
});
|
|
1263
1260
|
}
|
|
1264
|
-
}, [editorActor, onFocus, slateEditor]), handleClick = React.useCallback((event_3) => {
|
|
1261
|
+
}, [editorActor, onFocus, slateEditor, portableTextEditor]), handleClick = React.useCallback((event_3) => {
|
|
1265
1262
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
1266
1263
|
return;
|
|
1267
1264
|
const position_3 = getEventPosition({
|