diff --git a/packages/slate-react/src/components/content.js b/packages/slate-react/src/components/content.js index 3faa99b97..648f7ebe5 100644 --- a/packages/slate-react/src/components/content.js +++ b/packages/slate-react/src/components/content.js @@ -162,7 +162,10 @@ class Content extends React.Component { const window = getWindow(this.element) const native = window.getSelection() const { activeElement } = window.document - debug.update('updateSelection', { selection: selection.toJSON() }) + + if (debug.enabled) { + debug.update('updateSelection', { selection: selection.toJSON() }) + } // COMPAT: In Firefox, there's a but where `getSelection` can return `null`. // https://bugzilla.mozilla.org/show_bug.cgi?id=827585 (2018/11/07) @@ -274,7 +277,7 @@ class Content extends React.Component { }) } - if (updated) { + if (updated && debug.enabled) { debug('updateSelection', { selection, native, activeElement }) debug.update('updateSelection-applied', { selection }) } @@ -483,11 +486,13 @@ class Content extends React.Component { debug('render', { props }) - debug.update('render', { - text: value.document.text, - selection: value.selection.toJSON(), - value: value.toJSON(), - }) + if (debug.enabled) { + debug.update('render', { + text: value.document.text, + selection: value.selection.toJSON(), + value: value.toJSON(), + }) + } return (