@portabletext/editor 1.47.2 → 1.47.4
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-es/editor-provider.js +126 -101
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +404 -543
- package/lib/behaviors/index.d.ts +404 -543
- package/lib/index.cjs +9 -6
- 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 +9 -6
- 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.d.cts +404 -33
- package/lib/utils/index.d.ts +404 -33
- 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 +18 -13
- 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.js
CHANGED
|
@@ -1178,7 +1178,7 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
}, [onCut, editorActor, slateEditor]), handlePaste = useCallback((event_1) => {
|
|
1181
|
-
const value =
|
|
1181
|
+
const value = fromSlateValue(slateEditor.children, editorActor.getSnapshot().context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(slateEditor)), path = (slateEditor.selection ? slateRangeToSelection({
|
|
1182
1182
|
schema: editorActor.getSnapshot().context.schema,
|
|
1183
1183
|
editor: slateEditor,
|
|
1184
1184
|
range: slateEditor.selection
|
|
@@ -1261,18 +1261,21 @@ 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
|
-
|
|
1265
|
-
selection_3 === null && (Transforms.select(slateEditor, Editor.start(slateEditor, [])), slateEditor.onChange()), editorActor.send({
|
|
1264
|
+
editorActor.send({
|
|
1266
1265
|
type: "notify.focused",
|
|
1267
1266
|
event: event_2
|
|
1268
1267
|
});
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1268
|
+
const selection_3 = slateEditor.selection ? slateRangeToSelection({
|
|
1269
|
+
schema: editorActor.getSnapshot().context.schema,
|
|
1270
|
+
editor: slateEditor,
|
|
1271
|
+
range: slateEditor.selection
|
|
1272
|
+
}) : null;
|
|
1273
|
+
selection_3 && editorActor.send({
|
|
1271
1274
|
type: "notify.selection",
|
|
1272
1275
|
selection: selection_3
|
|
1273
1276
|
});
|
|
1274
1277
|
}
|
|
1275
|
-
}, [editorActor, onFocus,
|
|
1278
|
+
}, [editorActor, onFocus, slateEditor]), handleClick = useCallback((event_3) => {
|
|
1276
1279
|
if (onClick && onClick(event_3), event_3.isDefaultPrevented() || event_3.isPropagationStopped())
|
|
1277
1280
|
return;
|
|
1278
1281
|
const position_3 = getEventPosition({
|