mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-26 16:44:22 +02:00
* fix copying text with leading/trailing white space, fixes #1153 * remove extra removeChild
This commit is contained in:
@@ -204,6 +204,11 @@ function Plugin(options = {}) {
|
|||||||
// node, wrap it in a `<span>` so we have something to set an attribute on.
|
// node, wrap it in a `<span>` so we have something to set an attribute on.
|
||||||
if (attach.nodeType == 3) {
|
if (attach.nodeType == 3) {
|
||||||
const span = window.document.createElement('span')
|
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)
|
span.appendChild(attach)
|
||||||
contents.appendChild(span)
|
contents.appendChild(span)
|
||||||
attach = span
|
attach = span
|
||||||
|
Reference in New Issue
Block a user