mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03: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:
parent
74b5327dbe
commit
dfe0b6f810
@ -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;
|
||||
|
@ -52,7 +52,10 @@ export const CARD_MENU = [
|
||||
matches: ['image', 'img'],
|
||||
type: 'card',
|
||||
replaceArg: 'image',
|
||||
params: ['src']
|
||||
params: ['src'],
|
||||
payload: {
|
||||
triggerBrowse: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Markdown',
|
||||
|
Loading…
Reference in New Issue
Block a user