1 |
|
2 |
|
3 |
|
4 | import '@wordpress/core-data';
|
5 | import '@wordpress/block-editor';
|
6 | import '@wordpress/editor';
|
7 | import '@wordpress/nux';
|
8 | import '@wordpress/viewport';
|
9 | import '@wordpress/notices';
|
10 | import { registerCoreBlocks } from '@wordpress/block-library';
|
11 | import { render, unmountComponentAtNode } from '@wordpress/element';
|
12 | import { dispatch } from '@wordpress/data';
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import './hooks';
|
18 | import './plugins';
|
19 | import './store';
|
20 | import Editor from './editor';
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export function reinitializeEditor( postType, postId, target, settings, initialEdits ) {
|
36 | unmountComponentAtNode( target );
|
37 | const reboot = reinitializeEditor.bind( null, postType, postId, target, settings, initialEdits );
|
38 |
|
39 | render(
|
40 | <Editor
|
41 | settings={ settings }
|
42 | onError={ reboot }
|
43 | postId={ postId }
|
44 | postType={ postType }
|
45 | initialEdits={ initialEdits }
|
46 | recovery
|
47 | />,
|
48 | target
|
49 | );
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | export function initializeEditor( id, postType, postId, settings, initialEdits ) {
|
67 | const target = document.getElementById( id );
|
68 | const reboot = reinitializeEditor.bind( null, postType, postId, target, settings, initialEdits );
|
69 |
|
70 | registerCoreBlocks();
|
71 |
|
72 |
|
73 | const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
74 | if ( documentMode !== 'Standards' ) {
|
75 |
|
76 | 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." );
|
77 | }
|
78 |
|
79 | dispatch( 'core/nux' ).triggerGuide( [
|
80 | 'core/editor.inserter',
|
81 | 'core/editor.settings',
|
82 | 'core/editor.preview',
|
83 | 'core/editor.publish',
|
84 | ] );
|
85 |
|
86 | render(
|
87 | <Editor
|
88 | settings={ settings }
|
89 | onError={ reboot }
|
90 | postId={ postId }
|
91 | postType={ postType }
|
92 | initialEdits={ initialEdits }
|
93 | />,
|
94 | target
|
95 | );
|
96 | }
|
97 |
|
98 | export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
|
99 | export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
100 | export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
101 | export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
102 | export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
|
103 | export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
104 | export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
|