@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.js
CHANGED
|
@@ -1261,21 +1261,18 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1261
1261
|
debug("No result from custom paste handler, pasting normally");
|
|
1262
1262
|
}, [editorActor, onPaste, portableTextEditor, slateEditor]), handleOnFocus = useCallback((event_2) => {
|
|
1263
1263
|
if (onFocus && onFocus(event_2), !event_2.isDefaultPrevented()) {
|
|
1264
|
-
|
|
1264
|
+
const selection_3 = PortableTextEditor.getSelection(portableTextEditor);
|
|
1265
|
+
selection_3 === null && (Transforms.select(slateEditor, Editor.start(slateEditor, [])), slateEditor.onChange()), editorActor.send({
|
|
1265
1266
|
type: "notify.focused",
|
|
1266
1267
|
event: event_2
|
|
1267
1268
|
});
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
editor: slateEditor,
|
|
1271
|
-
range: slateEditor.selection
|
|
1272
|
-
}) : null;
|
|
1273
|
-
selection_3 && editorActor.send({
|
|
1269
|
+
const newSelection = PortableTextEditor.getSelection(portableTextEditor);
|
|
1270
|
+
selection_3 === newSelection && editorActor.send({
|
|
1274
1271
|
type: "notify.selection",
|
|
1275
1272
|
selection: selection_3
|
|
1276
1273
|
});
|
|
1277
1274
|
}
|
|
1278
|
-
}, [editorActor, onFocus, slateEditor]), handleClick = useCallback((event_3) => {
|
|
1275
|
+
}, [editorActor, onFocus, slateEditor, portableTextEditor]), handleClick = useCallback((event_3) => {
|
|
1279
1276
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
1280
1277
|
return;
|
|
1281
1278
|
const position_3 = getEventPosition({
|