mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
b2b66490b7
refs https://github.com/TryGhost/Team/issues/755 reqs https://github.com/TryGhost/Ghost/pull/13006 - updated settings model to match new server-side settings - updated email customisation modal behind the dev experiments flag - adjusted layout to move to a fixed top bar and scrollable sidebar - added image upload, toggles and selections for new settings - updated preview to match selected settings Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import XFileInput from 'emberx-file-input/components/x-file-input';
|
|
|
|
// TODO: remove this override and use {{x-file-input}} directly once we've
|
|
// upgraded to emberx-file-input@1.2.0
|
|
|
|
export default XFileInput.extend({
|
|
didInsertElement() {
|
|
this.onInsert?.(this.element.querySelector('input[type="file"]'));
|
|
},
|
|
|
|
change(e) {
|
|
let action = this.action;
|
|
let files = this.files(e);
|
|
|
|
if (files.length && action) {
|
|
action(files, this.resetInput.bind(this));
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Gets files from event object.
|
|
*
|
|
* @method
|
|
* @private
|
|
* @param {$.Event || Event}
|
|
*/
|
|
files(e) {
|
|
return (e.originalEvent || e).testingFiles || e.target.files;
|
|
},
|
|
|
|
/**
|
|
* Resets the value of the input so you can select the same file
|
|
* multiple times.
|
|
*
|
|
* NOTE: fixes reset in Firefox which doesn't reset like other browsers
|
|
* when doing input.value = null;
|
|
*
|
|
* @method
|
|
*/
|
|
resetInput() {
|
|
let input = this.element.querySelector('.x-file--input');
|
|
input.removeAttribute('value');
|
|
input.value = null;
|
|
input.parentNode.replaceChild(input.cloneNode(true), input);
|
|
}
|
|
});
|