Fix JS error in Draftail sources because of script execution order

This commit is contained in:
Thibaud Colas 2017-12-14 16:36:33 +13:00
parent 0f10d42e92
commit f647c9f270
4 changed files with 4 additions and 8 deletions

View file

@ -1,7 +1,6 @@
import ModalSource from './ModalSource';
const $ = global.jQuery;
const ModalWorkflow = global.ModalWorkflow;
class DocumentSource extends ModalSource {
constructor(props) {
@ -30,7 +29,7 @@ class DocumentSource extends ModalSource {
}
// eslint-disable-next-line new-cap
ModalWorkflow({
window.ModalWorkflow({
url,
responses: {
documentChosen: this.parseData,

View file

@ -1,7 +1,6 @@
import ModalSource from './ModalSource';
const $ = global.jQuery;
const ModalWorkflow = global.ModalWorkflow;
class EmbedSource extends ModalSource {
constructor(props) {
@ -26,7 +25,7 @@ class EmbedSource extends ModalSource {
$(document.body).on('hidden.bs.modal', this.onClose);
// eslint-disable-next-line new-cap
ModalWorkflow({
window.ModalWorkflow({
url: global.chooserUrls.embedsChooser,
responses: {
embedChosen: this.parseData,

View file

@ -1,7 +1,6 @@
import ModalSource from './ModalSource';
const $ = global.jQuery;
const ModalWorkflow = global.ModalWorkflow;
class ImageSource extends ModalSource {
constructor(props) {
@ -20,7 +19,7 @@ class ImageSource extends ModalSource {
$(document.body).on('hidden.bs.modal', this.onClose);
// eslint-disable-next-line new-cap
ModalWorkflow({
window.ModalWorkflow({
url: imageChooser,
responses: {
imageChosen: this.parseData,

View file

@ -1,7 +1,6 @@
import ModalSource from './ModalSource';
const $ = global.jQuery;
const ModalWorkflow = global.ModalWorkflow;
// Plaster over Wagtail internals.
const buildInitialUrl = (entity, openAtParentId, canChooseRoot, pageTypes) => {
@ -89,7 +88,7 @@ class LinkSource extends ModalSource {
$(document.body).on('hidden.bs.modal', this.onClose);
// eslint-disable-next-line new-cap
ModalWorkflow({
window.ModalWorkflow({
url,
urlParams,
responses: {