mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 06:53:25 +02:00
change zero-width spaces to use data attributes for consistency
This commit is contained in:
@@ -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
|
// 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
|
// an inline void node, so we render a zero-width space so that the
|
||||||
// selection can be inserted next to it still.
|
// selection can be inserted next to it still.
|
||||||
if (text == '') return <span className="slate-zero-width-space">{'\u200B'}</span>
|
if (text == '') return <span data-slate-zero-width>{'\u200B'}</span>
|
||||||
|
|
||||||
// COMPAT: Browsers will collapse trailing new lines at the end of blocks,
|
// 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.
|
// so we need to add an extra trailing new lines to prevent that.
|
||||||
|
@@ -229,7 +229,7 @@ function Plugin(options = {}) {
|
|||||||
|
|
||||||
// Remove any zero-width space spans from the cloned DOM so that they don't
|
// Remove any zero-width space spans from the cloned DOM so that they don't
|
||||||
// show up elsewhere when copied.
|
// 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))
|
zws.forEach(zw => zw.parentNode.removeChild(zw))
|
||||||
|
|
||||||
// Wrap the first character of the selection in a span that has the encoded
|
// Wrap the first character of the selection in a span that has the encoded
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div data-slate-void="true" style="position:relative;">
|
<div data-slate-void="true" style="position:relative;">
|
||||||
<span style="position:absolute;top:0px;left:-9999px;text-indent:-9999px;">
|
<span style="position:absolute;top:0px;left:-9999px;text-indent:-9999px;">
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<div contenteditable="false">
|
<div contenteditable="false">
|
||||||
|
@@ -3,13 +3,13 @@
|
|||||||
<div style="position:relative;">
|
<div style="position:relative;">
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span data-slate-void="true" style="position:relative;">
|
<span data-slate-void="true" style="position:relative;">
|
||||||
<span style="position:relative;top:0px;left:-9999px;text-indent:-9999px;">
|
<span style="position:relative;top:0px;left:-9999px;text-indent:-9999px;">
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span contenteditable="false">
|
<span contenteditable="false">
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div style="position:relative;">
|
<div style="position:relative;">
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<a href="https://google.com">
|
<a href="https://google.com">
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div style="position:relative;">
|
<div style="position:relative;">
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span style="position:relative;">
|
<span style="position:relative;">
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<div style="position:relative;">
|
<div style="position:relative;">
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<a href="https://google.com">
|
<a href="https://google.com">
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<a href="https://google.com">
|
<a href="https://google.com">
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<span>
|
<span>
|
||||||
<span>
|
<span>
|
||||||
<span class="slate-zero-width-space">​</span>
|
<span data-slate-zero-width="true">​</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user