🎨 Koenig - Focus URL input after creating embed card

refs https://github.com/TryGhost/Ghost/issues/9623
This commit is contained in:
Kevin Ansfield 2018-06-13 11:14:34 +01:00
parent 2dc916299b
commit 49d2ed2fb4
2 changed files with 10 additions and 0 deletions

View File

@ -41,6 +41,7 @@ export default Component.extend({
didInsertElement() {
this._super(...arguments);
this._loadPayloadScript();
this._focusInput();
},
actions: {
@ -118,6 +119,14 @@ export default Component.extend({
}
}),
_focusInput() {
let urlInput = this.element.querySelector('[name="url"]');
if (urlInput) {
urlInput.focus();
}
},
// some oembeds will have a script tag but it won't automatically run
// due to the way Ember renders the card components. Grab the script
// element and push a new one to force the browser to download+run it

View File

@ -47,6 +47,7 @@
<input
type="text"
value={{payload.url}}
name="url"
placeholder="Paste URL to add embedded content..."
class="miw-100 pa2 ba br2 b--lightgrey-d2 f7 form-text lh-title tracked-2 h10"
oninput={{action "updateUrl"}}