react-pencil
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -92,3 +92,3 @@ 'use strict'; | ||
if (this._delayedFocus) { | ||
global.clearTimeout(this._delayedFocus); | ||
window.clearTimeout(this._delayedFocus); | ||
} | ||
@@ -117,3 +117,3 @@ } | ||
this._delayedFocus = global.setTimeout(function () { | ||
this._delayedFocus = window.setTimeout(function () { | ||
moveCursorToEnd(_this2.refs.content); | ||
@@ -201,7 +201,7 @@ _this2.refs.content.focus(); | ||
if (typeof global.document.execCommand === 'function') { | ||
if (document && typeof document.execCommand === 'function') { | ||
// Mimic input behavior when navigating to element with TAB key. | ||
setTimeout(function () { | ||
if (!_this4._wasClicked) { | ||
global.document.execCommand('selectAll', false, null); | ||
document.execCommand('selectAll', false, null); | ||
} | ||
@@ -341,3 +341,3 @@ }, 50); | ||
'div', | ||
{ className: 'react-pencil ' + wrapperClassname + ' ' + (error ? 'error' : '') }, | ||
{ className: 'react-pencil' + (wrapperClassname ? ' ' + wrapperClassname : '') + (error ? ' error' : '') }, | ||
_react2.default.createElement(Component, _extends({ ref: 'editable' }, rest, { finishEdit: this.finishEdit.bind(this) })), | ||
@@ -344,0 +344,0 @@ pencil ? this.renderPencilButton() : null, |
{ | ||
"name": "react-pencil", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A React component that allows single and multiline in-place edits.", | ||
@@ -5,0 +5,0 @@ "main": "dist/react-pencil.js", |
@@ -54,3 +54,3 @@ import React from 'react'; | ||
if (this._delayedFocus) { | ||
global.clearTimeout(this._delayedFocus); | ||
window.clearTimeout(this._delayedFocus); | ||
} | ||
@@ -72,3 +72,3 @@ } | ||
focus() { | ||
this._delayedFocus = global.setTimeout(() => { | ||
this._delayedFocus = window.setTimeout(() => { | ||
moveCursorToEnd(this.refs.content); | ||
@@ -133,7 +133,7 @@ this.refs.content.focus(); | ||
selectAll() { | ||
if (typeof global.document.execCommand === 'function') { | ||
if (document && typeof document.execCommand === 'function') { | ||
// Mimic input behavior when navigating to element with TAB key. | ||
setTimeout(() => { | ||
if (!this._wasClicked) { | ||
global.document.execCommand('selectAll', false, null); | ||
document.execCommand('selectAll', false, null); | ||
} | ||
@@ -230,3 +230,3 @@ }, 50); | ||
return ( | ||
<div className={`react-pencil ${wrapperClassname} ${error ? 'error' : ''}`}> | ||
<div className={`react-pencil${wrapperClassname ? ' ' + wrapperClassname : ''}${error ? ' error' : ''}`}> | ||
<Component ref='editable' {...rest} finishEdit={this.finishEdit.bind(this)}/> | ||
@@ -233,0 +233,0 @@ {pencil ? this.renderPencilButton() : null} |
Sorry, the diff of this file is too big to display
771828
19743