@portabletext/editor 1.47.3 → 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/_chunks-cjs/editor-provider.cjs +125 -100
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs +0 -5
- package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +126 -101
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/util.is-selection-collapsed.js +0 -5
- package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
- package/lib/behaviors/index.d.cts +404 -543
- package/lib/behaviors/index.d.ts +404 -543
- package/lib/index.cjs +6 -14
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +411 -34
- package/lib/index.d.ts +411 -34
- package/lib/index.js +7 -15
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +411 -34
- package/lib/plugins/index.d.ts +411 -34
- package/lib/selectors/index.d.cts +404 -33
- package/lib/selectors/index.d.ts +404 -33
- package/lib/utils/index.cjs +4 -1
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +404 -33
- package/lib/utils/index.d.ts +404 -33
- package/lib/utils/index.js +6 -3
- package/lib/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/src/behavior-actions/behavior.action.insert.text.ts +10 -1
- package/src/behavior-actions/behavior.actions.ts +0 -18
- package/src/behaviors/behavior.perform-event.ts +55 -65
- package/src/behaviors/behavior.types.event.ts +7 -9
- package/src/editor/Editable.tsx +14 -27
- package/src/editor/create-editor.ts +14 -0
- package/src/editor/editor-machine.ts +76 -5
- package/src/editor/plugins/create-with-event-listeners.ts +0 -6
- package/src/editor/plugins/createWithEditableAPI.ts +2 -8
- package/src/editor/with-applying-behavior-actions.ts +2 -2
- package/src/behavior-actions/behavior.action.blur.ts +0 -8
- package/src/behavior-actions/behavior.action.focus.ts +0 -8
package/lib/index.cjs
CHANGED
|
@@ -1247,26 +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
|
-
const
|
|
1251
|
-
|
|
1252
|
-
editor: slateEditor,
|
|
1253
|
-
range: slateEditor.selection
|
|
1254
|
-
}) : null;
|
|
1255
|
-
editorActor.send({
|
|
1250
|
+
const selection_3 = editorProvider.PortableTextEditor.getSelection(portableTextEditor);
|
|
1251
|
+
selection_3 === null && (slate.Transforms.select(slateEditor, slate.Editor.start(slateEditor, [])), slateEditor.onChange()), editorActor.send({
|
|
1256
1252
|
type: "notify.focused",
|
|
1257
1253
|
event: event_2
|
|
1258
1254
|
});
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
editor: slateEditor,
|
|
1262
|
-
range: slateEditor.selection
|
|
1263
|
-
}) : null;
|
|
1264
|
-
selectionBefore && selectionAfter && util_isSelectionCollapsed.isEqualSelections(selectionBefore, selectionAfter) && editorActor.send({
|
|
1255
|
+
const newSelection = editorProvider.PortableTextEditor.getSelection(portableTextEditor);
|
|
1256
|
+
selection_3 === newSelection && editorActor.send({
|
|
1265
1257
|
type: "notify.selection",
|
|
1266
|
-
selection:
|
|
1258
|
+
selection: selection_3
|
|
1267
1259
|
});
|
|
1268
1260
|
}
|
|
1269
|
-
}, [editorActor, onFocus, slateEditor]), handleClick = React.useCallback((event_3) => {
|
|
1261
|
+
}, [editorActor, onFocus, slateEditor, portableTextEditor]), handleClick = React.useCallback((event_3) => {
|
|
1270
1262
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
1271
1263
|
return;
|
|
1272
1264
|
const position_3 = getEventPosition({
|