1 | import { createElement } from "@wordpress/element";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import '@wordpress/core-data';
|
7 | import '@wordpress/block-editor';
|
8 | import '@wordpress/editor';
|
9 | import '@wordpress/nux';
|
10 | import '@wordpress/viewport';
|
11 | import '@wordpress/notices';
|
12 | import { registerCoreBlocks } from '@wordpress/block-library';
|
13 | import { render, unmountComponentAtNode } from '@wordpress/element';
|
14 | import { dispatch } from '@wordpress/data';
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | import './hooks';
|
20 | import './plugins';
|
21 | import './store';
|
22 | import Editor from './editor';
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export function reinitializeEditor(postType, postId, target, settings, initialEdits) {
|
38 | unmountComponentAtNode(target);
|
39 | var reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
|
40 | render(createElement(Editor, {
|
41 | settings: settings,
|
42 | onError: reboot,
|
43 | postId: postId,
|
44 | postType: postType,
|
45 | initialEdits: initialEdits,
|
46 | recovery: true
|
47 | }), target);
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | export function initializeEditor(id, postType, postId, settings, initialEdits) {
|
65 | var target = document.getElementById(id);
|
66 | var reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
|
67 | registerCoreBlocks();
|
68 |
|
69 | var documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
70 |
|
71 | if (documentMode !== 'Standards') {
|
72 |
|
73 | console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
|
74 | }
|
75 |
|
76 | dispatch('core/nux').triggerGuide(['core/editor.inserter', 'core/editor.settings', 'core/editor.preview', 'core/editor.publish']);
|
77 | render(createElement(Editor, {
|
78 | settings: settings,
|
79 | onError: reboot,
|
80 | postId: postId,
|
81 | postType: postType,
|
82 | initialEdits: initialEdits
|
83 | }), target);
|
84 | }
|
85 | export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
|
86 | export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
87 | export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
88 | export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
89 | export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
|
90 | export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
91 | export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
|
92 |
|
\ | No newline at end of file |