1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- const wagtailConfig = {
- ADMIN_API: {
- DOCUMENTS: '/admin/api/main/documents/',
- IMAGES: '/admin/api/main/images/',
- PAGES: '/admin/api/main/pages/',
- EXTRA_CHILDREN_PARAMETERS: '',
- },
- ADMIN_URLS: {
- PAGES: '/admin/pages/',
- },
- CSRF_HEADER_NAME: 'x-xsrf-token',
- CSRF_TOKEN: 'potato',
- DATE_FORMATTING: {
- DATE_FORMAT: 'MMM. D, YYYY',
- SHORT_DATE_FORMAT: 'DD/MM/YYYY',
- },
- WAGTAIL_I18N_ENABLED: true,
- LOCALES: [
- {
- code: 'en',
- display_name: 'English',
- },
- {
- code: 'fr',
- display_name: 'French',
- },
- ],
- ACTIVE_CONTENT_LOCALE: 'en',
- };
- const configScript = Object.assign(document.createElement('script'), {
- id: 'wagtail-config',
- textContent: JSON.stringify(wagtailConfig),
- type: 'application/json',
- });
- document.body.appendChild(configScript);
- global.wagtail = {};
- global.IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'image' };
- global.PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'page' };
- global.EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'embed' };
- global.DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'document' };
- class PageChooserModal {}
- global.PageChooserModal = PageChooserModal;
- window.scrollTo = () => {};
- const consoleWarnOriginal = console.warn;
- console.warn = function filterWarnings(...args) {
-
- const [warning, component] = args;
- const legacyReactWarnings = [
- 'Warning: componentWillMount has been renamed, and is not recommended for use.',
- 'Warning: componentWillReceiveProps has been renamed, and is not recommended for use.',
- 'Warning: componentWillUpdate has been renamed, and is not recommended for use.',
- ];
- const ignoredComponents = ['DraftEditor', 'PluginEditor'];
- if (
- legacyReactWarnings.some((_) => warning.includes(_)) &&
- ignoredComponents.includes(component)
- ) {
- return;
- }
- consoleWarnOriginal.apply(console, args);
- };
|