diff --git a/packages/slate/src/transforms/selection.ts b/packages/slate/src/transforms/selection.ts
index 33730f358..aba27d086 100755
--- a/packages/slate/src/transforms/selection.ts
+++ b/packages/slate/src/transforms/selection.ts
@@ -157,13 +157,10 @@ export const SelectionTransforms = {
const { anchor, focus } = selection
const point = edge === 'anchor' ? anchor : focus
- const newPoint = Object.assign(point, props)
- if (edge === 'anchor') {
- Transforms.setSelection(editor, { anchor: newPoint })
- } else {
- Transforms.setSelection(editor, { focus: newPoint })
- }
+ Transforms.setSelection(editor, {
+ [edge === 'anchor' ? 'anchor' : 'focus']: { ...point, ...props },
+ })
},
/**
diff --git a/packages/slate/test/transforms/setPoint/offset.js b/packages/slate/test/transforms/setPoint/offset.js
new file mode 100644
index 000000000..babfcd2f9
--- /dev/null
+++ b/packages/slate/test/transforms/setPoint/offset.js
@@ -0,0 +1,28 @@
+/** @jsx jsx */
+
+import { Editor, Transforms } from 'slate'
+import { jsx } from '../..'
+
+export const run = editor => {
+ Transforms.move(editor)
+ Transforms.setPoint(editor, { offset: 0 }, { edge: 'focus' })
+}
+
+export const input = (
+
+
+ f
+ oo
+
+
+)
+
+export const output = (
+
+
+
+ fo
+ o
+
+
+)