Comparing version 3.0.1 to 3.1.0
# @uppy/url | ||
## 3.1.0 | ||
Released: 2022-10-19 | ||
Included in: Uppy v3.2.0 | ||
- @uppy/url: refactor `UrlUI` (Antoine du Hamel / #4143) | ||
- @uppy/url: trim whitespace around user input (Andrew McIntee / #4143) | ||
## 3.0.1 | ||
@@ -4,0 +12,0 @@ |
@@ -8,3 +8,3 @@ import { h } from 'preact'; | ||
const packageJson = { | ||
"version": "3.0.1" | ||
"version": "3.1.0" | ||
}; | ||
@@ -11,0 +11,0 @@ import locale from './locale.js'; |
@@ -0,8 +1,34 @@ | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
var id = 0; | ||
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; } | ||
import { h, Component } from 'preact'; | ||
var _handleKeyPress = /*#__PURE__*/_classPrivateFieldLooseKey("handleKeyPress"); | ||
var _handleSubmit = /*#__PURE__*/_classPrivateFieldLooseKey("handleSubmit"); | ||
class UrlUI extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.handleKeyPress = this.handleKeyPress.bind(this); | ||
this.handleClick = this.handleClick.bind(this); | ||
constructor() { | ||
super(...arguments); | ||
Object.defineProperty(this, _handleKeyPress, { | ||
writable: true, | ||
value: ev => { | ||
if (ev.keyCode === 13) { | ||
_classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit](); | ||
} | ||
} | ||
}); | ||
Object.defineProperty(this, _handleSubmit, { | ||
writable: true, | ||
value: () => { | ||
const { | ||
addFile | ||
} = this.props; | ||
const preparedValue = this.input.value.trim(); | ||
addFile(preparedValue); | ||
} | ||
}); | ||
} | ||
@@ -14,19 +40,2 @@ | ||
handleKeyPress(ev) { | ||
const { | ||
addFile | ||
} = this.props; | ||
if (ev.keyCode === 13) { | ||
addFile(this.input.value); | ||
} | ||
} | ||
handleClick() { | ||
const { | ||
addFile | ||
} = this.props; | ||
addFile(this.input.value); | ||
} | ||
render() { | ||
@@ -43,3 +52,3 @@ const { | ||
placeholder: i18n('enterUrlToImport'), | ||
onKeyUp: this.handleKeyPress, | ||
onKeyUp: _classPrivateFieldLooseBase(this, _handleKeyPress)[_handleKeyPress], | ||
ref: input => { | ||
@@ -52,3 +61,3 @@ this.input = input; | ||
type: "button", | ||
onClick: this.handleClick | ||
onClick: _classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit] | ||
}, i18n('import'))); | ||
@@ -55,0 +64,0 @@ } |
{ | ||
"name": "@uppy/url", | ||
"description": "The Url plugin lets users import files from the Internet. Paste any URL and it’ll be added!", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -31,4 +31,4 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"@uppy/core": "^3.0.2" | ||
"@uppy/core": "^3.0.3" | ||
} | ||
} |
import { h, Component } from 'preact' | ||
class UrlUI extends Component { | ||
constructor (props) { | ||
super(props) | ||
this.handleKeyPress = this.handleKeyPress.bind(this) | ||
this.handleClick = this.handleClick.bind(this) | ||
} | ||
componentDidMount () { | ||
@@ -14,12 +8,12 @@ this.input.value = '' | ||
handleKeyPress (ev) { | ||
const { addFile } = this.props | ||
#handleKeyPress = (ev) => { | ||
if (ev.keyCode === 13) { | ||
addFile(this.input.value) | ||
this.#handleSubmit() | ||
} | ||
} | ||
handleClick () { | ||
#handleSubmit = () => { | ||
const { addFile } = this.props | ||
addFile(this.input.value) | ||
const preparedValue = this.input.value.trim() | ||
addFile(preparedValue) | ||
} | ||
@@ -36,3 +30,3 @@ | ||
placeholder={i18n('enterUrlToImport')} | ||
onKeyUp={this.handleKeyPress} | ||
onKeyUp={this.#handleKeyPress} | ||
ref={(input) => { this.input = input }} | ||
@@ -44,3 +38,3 @@ data-uppy-super-focusable | ||
type="button" | ||
onClick={this.handleClick} | ||
onClick={this.#handleSubmit} | ||
> | ||
@@ -47,0 +41,0 @@ {i18n('import')} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51137
692