diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000..03dcbfd4e8
Binary files /dev/null and b/.DS_Store differ
diff --git a/packages/slate/src/interfaces/editor.ts b/packages/slate/src/interfaces/editor.ts
index 7340e60326..b095fc2ab8 100755
--- a/packages/slate/src/interfaces/editor.ts
+++ b/packages/slate/src/interfaces/editor.ts
@@ -1265,6 +1265,13 @@ export const Editor = {
at: end,
match: n => Editor.isBlock(editor, n),
})
+
+ // If last element is a void node, unhang range by including void node in range
+ if (Editor.isVoid(editor, endBlock[0])) {
+ end = { path: end.path, offset: 1 }
+ return { anchor: start, focus: end }
+ }
+
const blockPath = endBlock ? endBlock[1] : []
const first = Editor.start(editor, [])
const before = { anchor: first, focus: end }
@@ -1274,7 +1281,7 @@ export const Editor = {
at: before,
match: Text.isText,
reverse: true,
- voids,
+ voids: true,
})) {
if (skip) {
skip = false
diff --git a/packages/slate/test/transforms/delete/voids-true/delete-void-and-newline-at-end.tsx b/packages/slate/test/transforms/delete/voids-true/delete-void-and-newline-at-end.tsx
new file mode 100644
index 0000000000..980a82bfcb
--- /dev/null
+++ b/packages/slate/test/transforms/delete/voids-true/delete-void-and-newline-at-end.tsx
@@ -0,0 +1,40 @@
+/** @jsx jsx */
+import { Editor, Transforms } from 'slate'
+import { jsx } from '../../..'
+
+export const input = (
+
+
+
+
+ This is a first paragraph
+
+
+
+ This is the second paragraph
+
+
+
+
+
+
+
+
+
+
+)
+export const run = editor => {
+ editor.deleteFragment(editor)
+}
+export const output = (
+
+
+
+
+
+
+
+
+
+
+)
diff --git a/packages/slate/test/transforms/delete/voids-true/delete-void-at-end.tsx b/packages/slate/test/transforms/delete/voids-true/delete-void-at-end.tsx
new file mode 100644
index 0000000000..7243586805
--- /dev/null
+++ b/packages/slate/test/transforms/delete/voids-true/delete-void-at-end.tsx
@@ -0,0 +1,34 @@
+/** @jsx jsx */
+import { Editor, Transforms } from 'slate'
+import { jsx } from '../../..'
+
+export const input = (
+
+
+
+
+ This is a first paragraph
+
+
+
+ This is the second paragraph
+
+
+
+
+
+
+
+)
+export const run = editor => {
+ editor.deleteFragment(editor)
+}
+export const output = (
+
+
+
+
+
+
+
+)
diff --git a/site/.DS_Store b/site/.DS_Store
new file mode 100644
index 0000000000..f4ddc634d2
Binary files /dev/null and b/site/.DS_Store differ