+
{'\uFEFF'}
@@ -158,7 +162,11 @@ class Leaf extends React.Component {
// node, so we render a zero-width space so that the selection can be
// inserted next to it still.
if (text === '') {
- return {'\uFEFF'}
+ return (
+
+ {'\uFEFF'}
+
+ )
}
// COMPAT: Browsers will collapse trailing new lines at the end of blocks,
diff --git a/packages/slate-react/src/utils/find-dom-point.js b/packages/slate-react/src/utils/find-dom-point.js
index 217272f21..6414fc4d3 100644
--- a/packages/slate-react/src/utils/find-dom-point.js
+++ b/packages/slate-react/src/utils/find-dom-point.js
@@ -21,7 +21,10 @@ function findDOMPoint(point, win = window) {
for (const text of texts) {
const node = text.childNodes[0]
- const { length } = node.textContent
+ const length = text.hasAttribute('data-slate-length')
+ ? parseInt(text.getAttribute('data-slate-length'), 10)
+ : node.textContent.length
+
const end = start + length
if (point.offset <= end) {
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-blurred.js b/packages/slate-react/test/rendering/fixtures/custom-block-blurred.js
index 4f263f93a..f43d408b9 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-blurred.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-blurred.js
@@ -63,7 +63,7 @@ export const output = `
-
+
@@ -71,7 +71,7 @@ export const output = `
-
+
@@ -82,7 +82,7 @@ export const output = `
-
+
@@ -90,7 +90,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-focused.js b/packages/slate-react/test/rendering/fixtures/custom-block-focused.js
index 394ed52af..e1a2f935e 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-focused.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-focused.js
@@ -59,7 +59,7 @@ export const output = `
-
+
@@ -67,7 +67,7 @@ export const output = `
-
+
@@ -78,7 +78,7 @@ export const output = `
-
+
@@ -86,7 +86,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-selected.js b/packages/slate-react/test/rendering/fixtures/custom-block-selected.js
index 44a2f3abb..4b4bae4f8 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-selected.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-selected.js
@@ -59,7 +59,7 @@ export const output = `
-
+
@@ -67,7 +67,7 @@ export const output = `
-
+
@@ -78,7 +78,7 @@ export const output = `
-
+
@@ -86,7 +86,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-void.js b/packages/slate-react/test/rendering/fixtures/custom-block-void.js
index 0afa1c4fc..a16106de8 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-void.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-void.js
@@ -46,7 +46,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js b/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
index f5aff7d2c..d216c491d 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
@@ -45,7 +45,7 @@ export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline-void.js b/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
index e1d1e8171..b57683dc0 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
@@ -46,14 +46,14 @@ export const output = `
-
+
-
+
@@ -63,7 +63,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline.js b/packages/slate-react/test/rendering/fixtures/custom-inline.js
index 73c67c8f9..152c0779c 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline.js
@@ -41,7 +41,7 @@ export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js b/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
index 527028ec1..bf8818a32 100644
--- a/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
+++ b/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
@@ -21,7 +21,7 @@ export const output = `
-
+
@@ -33,7 +33,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/empty-block.js b/packages/slate-react/test/rendering/fixtures/empty-block.js
index 0066221c0..c95c83e07 100644
--- a/packages/slate-react/test/rendering/fixtures/empty-block.js
+++ b/packages/slate-react/test/rendering/fixtures/empty-block.js
@@ -19,7 +19,7 @@ export const output = `
-
+
diff --git a/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js b/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
index 1dbd56e49..aeef2dfdf 100644
--- a/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
+++ b/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
@@ -45,7 +45,7 @@ export const output = `
-
+
@@ -55,7 +55,7 @@ export const output = `
-
+