From 5808e646357bf3badfc1b6923f9f113895cf061a Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Wed, 7 Dec 2016 21:16:04 -0800 Subject: [PATCH] change zero-width spaces to use data attributes for consistency --- src/components/leaf.js | 2 +- src/plugins/core.js | 2 +- test/rendering/fixtures/custom-block-void/output.html | 2 +- test/rendering/fixtures/custom-inline-void/output.html | 6 +++--- test/rendering/fixtures/custom-inline/output.html | 4 ++-- .../rendering/fixtures/default-block-and-inline/output.html | 4 ++-- test/rendering/fixtures/multiple-custom-inline/output.html | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/leaf.js b/src/components/leaf.js index ea1938962..641f1e3bb 100644 --- a/src/components/leaf.js +++ b/src/components/leaf.js @@ -264,7 +264,7 @@ class Leaf extends React.Component { // COMPAT: If the text is empty otherwise, it's because it's on the edge of // an inline void node, so we render a zero-width space so that the // selection can be inserted next to it still. - if (text == '') return {'\u200B'} + if (text == '') return {'\u200B'} // COMPAT: Browsers will collapse trailing new lines at the end of blocks, // so we need to add an extra trailing new lines to prevent that. diff --git a/src/plugins/core.js b/src/plugins/core.js index 00ffb121e..c68060ad9 100644 --- a/src/plugins/core.js +++ b/src/plugins/core.js @@ -229,7 +229,7 @@ function Plugin(options = {}) { // Remove any zero-width space spans from the cloned DOM so that they don't // show up elsewhere when copied. - const zws = [].slice.call(contents.querySelectorAll('.slate-zero-width-space')) + const zws = [].slice.call(contents.querySelectorAll('[data-slate-zero-width]')) zws.forEach(zw => zw.parentNode.removeChild(zw)) // Wrap the first character of the selection in a span that has the encoded diff --git a/test/rendering/fixtures/custom-block-void/output.html b/test/rendering/fixtures/custom-block-void/output.html index 91dbcfda6..46a590bc8 100644 --- a/test/rendering/fixtures/custom-block-void/output.html +++ b/test/rendering/fixtures/custom-block-void/output.html @@ -3,7 +3,7 @@
- +
diff --git a/test/rendering/fixtures/custom-inline-void/output.html b/test/rendering/fixtures/custom-inline-void/output.html index 1f9a66849..9869ab7d1 100644 --- a/test/rendering/fixtures/custom-inline-void/output.html +++ b/test/rendering/fixtures/custom-inline-void/output.html @@ -3,13 +3,13 @@
- + - + @@ -18,7 +18,7 @@ - +
diff --git a/test/rendering/fixtures/custom-inline/output.html b/test/rendering/fixtures/custom-inline/output.html index 805a9996a..30213e1d9 100644 --- a/test/rendering/fixtures/custom-inline/output.html +++ b/test/rendering/fixtures/custom-inline/output.html @@ -3,7 +3,7 @@
- + @@ -13,7 +13,7 @@ - +
diff --git a/test/rendering/fixtures/default-block-and-inline/output.html b/test/rendering/fixtures/default-block-and-inline/output.html index eac9d7b42..4b021cd8e 100644 --- a/test/rendering/fixtures/default-block-and-inline/output.html +++ b/test/rendering/fixtures/default-block-and-inline/output.html @@ -3,7 +3,7 @@
- + @@ -13,7 +13,7 @@ - +
diff --git a/test/rendering/fixtures/multiple-custom-inline/output.html b/test/rendering/fixtures/multiple-custom-inline/output.html index 2af61446b..223556582 100644 --- a/test/rendering/fixtures/multiple-custom-inline/output.html +++ b/test/rendering/fixtures/multiple-custom-inline/output.html @@ -3,7 +3,7 @@
- + @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ - +