Comparing version 3.2.0 to 3.3.0
@@ -8,3 +8,3 @@ import { h } from 'preact'; | ||
const packageJson = { | ||
"version": "3.2.0" | ||
"version": "3.3.0" | ||
}; | ||
@@ -11,0 +11,0 @@ import locale from './locale.js'; |
@@ -8,21 +8,14 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
import { h, Component } from 'preact'; | ||
import { nanoid } from 'nanoid/non-secure'; | ||
var _handleKeyPress = /*#__PURE__*/_classPrivateFieldLooseKey("handleKeyPress"); | ||
var _handleSubmit = /*#__PURE__*/_classPrivateFieldLooseKey("handleSubmit"); | ||
class UrlUI extends Component { | ||
constructor() { | ||
super(...arguments); | ||
Object.defineProperty(this, _handleKeyPress, { | ||
constructor(props) { | ||
super(props); | ||
this.form = document.createElement('form'); | ||
Object.defineProperty(this, _handleSubmit, { | ||
writable: true, | ||
value: ev => { | ||
if (ev.keyCode === 13) { | ||
_classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit](); | ||
} | ||
} | ||
}); | ||
Object.defineProperty(this, _handleSubmit, { | ||
writable: true, | ||
value: () => { | ||
ev.preventDefault(); | ||
const { | ||
@@ -35,2 +28,3 @@ addFile | ||
}); | ||
this.form.id = nanoid(); | ||
} | ||
@@ -40,4 +34,11 @@ | ||
this.input.value = ''; | ||
this.form.addEventListener('submit', _classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit]); | ||
document.body.appendChild(this.form); | ||
} | ||
componentWillUnmount() { | ||
this.form.removeEventListener('submit', _classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit]); | ||
document.body.removeChild(this.form); | ||
} | ||
render() { | ||
@@ -54,11 +55,11 @@ const { | ||
placeholder: i18n('enterUrlToImport'), | ||
onKeyUp: _classPrivateFieldLooseBase(this, _handleKeyPress)[_handleKeyPress], | ||
ref: input => { | ||
this.input = input; | ||
}, | ||
"data-uppy-super-focusable": true | ||
"data-uppy-super-focusable": true, | ||
form: this.form.id | ||
}), h("button", { | ||
className: "uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton", | ||
type: "button", | ||
onClick: _classPrivateFieldLooseBase(this, _handleSubmit)[_handleSubmit] | ||
type: "submit", | ||
form: this.form.id | ||
}, i18n('import'))); | ||
@@ -65,0 +66,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.2.0", | ||
"version": "3.3.0", | ||
"license": "MIT", | ||
@@ -26,9 +26,10 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/companion-client": "^3.1.1", | ||
"@uppy/utils": "^5.1.3", | ||
"@uppy/companion-client": "^3.1.2", | ||
"@uppy/utils": "^5.2.0", | ||
"nanoid": "^4.0.0", | ||
"preact": "^10.5.13" | ||
}, | ||
"peerDependencies": { | ||
"@uppy/core": "^3.1.0" | ||
"@uppy/core": "^3.1.2" | ||
} | ||
} |
import { h, Component } from 'preact' | ||
import { nanoid } from 'nanoid/non-secure' | ||
class UrlUI extends Component { | ||
form = document.createElement('form') | ||
constructor (props) { | ||
super(props) | ||
this.form.id = nanoid() | ||
} | ||
componentDidMount () { | ||
this.input.value = '' | ||
this.form.addEventListener('submit', this.#handleSubmit) | ||
document.body.appendChild(this.form) | ||
} | ||
#handleKeyPress = (ev) => { | ||
if (ev.keyCode === 13) { | ||
this.#handleSubmit() | ||
} | ||
componentWillUnmount () { | ||
this.form.removeEventListener('submit', this.#handleSubmit) | ||
document.body.removeChild(this.form) | ||
} | ||
#handleSubmit = () => { | ||
#handleSubmit = (ev) => { | ||
ev.preventDefault() | ||
const { addFile } = this.props | ||
@@ -29,10 +39,10 @@ const preparedValue = this.input.value.trim() | ||
placeholder={i18n('enterUrlToImport')} | ||
onKeyUp={this.#handleKeyPress} | ||
ref={(input) => { this.input = input }} | ||
data-uppy-super-focusable | ||
form={this.form.id} | ||
/> | ||
<button | ||
className="uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton" | ||
type="button" | ||
onClick={this.#handleSubmit} | ||
type="submit" | ||
form={this.form.id} | ||
> | ||
@@ -39,0 +49,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
51719
689
5
+ Addednanoid@^4.0.0
Updated@uppy/utils@^5.2.0