docbrown/app/javascript/utilities/dragAndUpload.js
Suzanne Aitchison d0dea2228c
Add markdown toolbar to V2 editor (#15347)
* initial add of toolbar to v2 editor WIP

* fix Form test knocked out by rebase

* basic image upload functionality added to toolbar

* add cypress tests for toolbar

* move image tests to previous cypress spec

* test markdown insertion from buttons in jest

* small tidy up

* remove right padding in scrollable layout, hide scrollbar

* update tests following new line changes

* add more doc comments

* tweak padding css

* create constant for image placeholder

* add image uploader change missed in staging after merge conflict resolution
2021-11-29 07:50:17 +00:00

17 lines
435 B
JavaScript

import { generateMainImage } from '../article-form/actions';
import { validateFileInputs } from '../packs/validateFileInputs';
export const dragAndUpload = (
files,
handleImageSuccess,
handleImageFailure,
) => {
if (files.length > 0 && validateFileInputs()) {
const payload = { image: files };
generateMainImage({
payload,
successCb: handleImageSuccess,
failureCb: handleImageFailure,
});
}
};