diff --git a/packages/slate-react/src/plugins/core.js b/packages/slate-react/src/plugins/core.js index 846f6fd98..b8ba7b893 100644 --- a/packages/slate-react/src/plugins/core.js +++ b/packages/slate-react/src/plugins/core.js @@ -204,6 +204,11 @@ function Plugin(options = {}) { // node, wrap it in a `` so we have something to set an attribute on. if (attach.nodeType == 3) { const span = window.document.createElement('span') + + // COMPAT: In Chrome and Safari, if we don't add the `white-space` style + // then leading and trailing spaces will be ignored. (2017/09/21) + span.style.whiteSpace = 'pre' + span.appendChild(attach) contents.appendChild(span) attach = span