Load @wordpress/date settings and locale data for date picker
[MAILPOET-5000]
This commit is contained in:
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { Button, Icon, Popover, SlotFillProvider } from '@wordpress/components';
|
import { Button, Icon, Popover, SlotFillProvider } from '@wordpress/components';
|
||||||
import { store as noticesStore } from '@wordpress/notices';
|
import { store as noticesStore } from '@wordpress/notices';
|
||||||
import { dispatch, select as globalSelect, useSelect } from '@wordpress/data';
|
import { dispatch, select as globalSelect, useSelect } from '@wordpress/data';
|
||||||
|
import { getSettings, setSettings } from '@wordpress/date';
|
||||||
import { wordpress } from '@wordpress/icons';
|
import { wordpress } from '@wordpress/icons';
|
||||||
import {
|
import {
|
||||||
ComplementaryArea,
|
ComplementaryArea,
|
||||||
@@ -11,7 +12,7 @@ import {
|
|||||||
InterfaceSkeleton,
|
InterfaceSkeleton,
|
||||||
} from '@wordpress/interface';
|
} from '@wordpress/interface';
|
||||||
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __, setLocaleData } from '@wordpress/i18n';
|
||||||
import { addQueryArgs } from '@wordpress/url';
|
import { addQueryArgs } from '@wordpress/url';
|
||||||
import { registerTranslations } from 'common';
|
import { registerTranslations } from 'common';
|
||||||
import { Header } from './components/header';
|
import { Header } from './components/header';
|
||||||
@@ -169,6 +170,13 @@ function Editor(): JSX.Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
setLocaleData(window.wp.i18n.getLocaleData());
|
||||||
|
|
||||||
|
const dateSettings = window.wp as unknown as {
|
||||||
|
date: { getSettings: typeof getSettings };
|
||||||
|
};
|
||||||
|
setSettings(dateSettings.date.getSettings());
|
||||||
|
|
||||||
createStore();
|
createStore();
|
||||||
|
|
||||||
const root = document.getElementById('mailpoet_automation_editor');
|
const root = document.getElementById('mailpoet_automation_editor');
|
||||||
|
@@ -143,7 +143,7 @@ EOL;
|
|||||||
$this->wp->wpEnqueueScript(
|
$this->wp->wpEnqueueScript(
|
||||||
'automation_editor',
|
'automation_editor',
|
||||||
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('automation_editor.js'),
|
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('automation_editor.js'),
|
||||||
[],
|
['wp-date'],
|
||||||
Env::$version,
|
Env::$version,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user