1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Updated image card to trigger file browse immediately when inserting

no issue

- removes number of clicks required to insert images, especially when using the `/image` shortcut
- strips `triggerBrowse` property from the payload after inserting to avoid triggering file browse when a post with blank image cards is rendered/re-rendered
This commit is contained in:
Kevin Ansfield 2020-02-27 14:36:43 +00:00
parent 1e73f323e7
commit 1bd612a359
2 changed files with 16 additions and 1 deletions

View file

@ -147,6 +147,18 @@ export default Component.extend({
}
},
didInsertElement() {
if (this.payload.triggerBrowse && !this.payload.src && !this.payload.files) {
// we don't want to persist this in the serialized payload
this._updatePayloadAttr('triggerBrowse', undefined);
let fileInput = this.element.querySelector('input[type="file"]');
if (fileInput) {
fileInput.click();
}
}
},
actions: {
updateSrc(images) {
let [image] = images;

View file

@ -52,7 +52,10 @@ export const CARD_MENU = [
matches: ['image', 'img'],
type: 'card',
replaceArg: 'image',
params: ['src']
params: ['src'],
payload: {
triggerBrowse: true
}
},
{
label: 'Markdown',