@wordpress/edit-widgets 5.1.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +1 -1
- package/build/components/error-boundary/index.js +24 -22
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/index.js +2 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +1 -1
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +7 -1
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/index.js +24 -25
- package/build/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +24 -22
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +6 -2
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/index.js +19 -24
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +7 -0
- package/build-style/style.css +7 -0
- package/package.json +27 -26
- package/src/components/error-boundary/index.js +23 -25
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/src/components/layout/index.js +2 -2
- package/src/components/layout/unsaved-changes-warning.js +1 -1
- package/src/components/sidebar/style.scss +8 -0
- package/src/components/widget-areas-block-editor-provider/index.js +6 -3
- package/src/experiments.js +10 -0
- package/src/index.js +21 -24
package/src/index.js
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
store as blocksStore,
|
|
9
9
|
} from '@wordpress/blocks';
|
|
10
10
|
import { dispatch } from '@wordpress/data';
|
|
11
|
-
import
|
|
11
|
+
import deprecated from '@wordpress/deprecated';
|
|
12
|
+
import { createRoot } from '@wordpress/element';
|
|
12
13
|
import {
|
|
13
14
|
registerCoreBlocks,
|
|
14
15
|
__experimentalGetCoreBlocks,
|
|
@@ -42,32 +43,16 @@ const disabledBlocks = [
|
|
|
42
43
|
...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),
|
|
43
44
|
];
|
|
44
45
|
|
|
45
|
-
/**
|
|
46
|
-
* Reinitializes the editor after the user chooses to reboot the editor after
|
|
47
|
-
* an unhandled error occurs, replacing previously mounted editor element using
|
|
48
|
-
* an initial state from prior to the crash.
|
|
49
|
-
*
|
|
50
|
-
* @param {Element} target DOM node in which editor is rendered.
|
|
51
|
-
* @param {?Object} settings Editor settings object.
|
|
52
|
-
*/
|
|
53
|
-
export function reinitializeEditor( target, settings ) {
|
|
54
|
-
unmountComponentAtNode( target );
|
|
55
|
-
const reboot = reinitializeEditor.bind( null, target, settings );
|
|
56
|
-
render(
|
|
57
|
-
<Layout blockEditorSettings={ settings } onError={ reboot } />,
|
|
58
|
-
target
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
46
|
/**
|
|
63
47
|
* Initializes the block editor in the widgets screen.
|
|
64
48
|
*
|
|
65
49
|
* @param {string} id ID of the root element to render the screen in.
|
|
66
50
|
* @param {Object} settings Block editor settings.
|
|
67
51
|
*/
|
|
68
|
-
export function
|
|
52
|
+
export function initializeEditor( id, settings ) {
|
|
69
53
|
const target = document.getElementById( id );
|
|
70
|
-
const
|
|
54
|
+
const root = createRoot( target );
|
|
55
|
+
|
|
71
56
|
const coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {
|
|
72
57
|
return ! (
|
|
73
58
|
disabledBlocks.includes( block.name ) ||
|
|
@@ -105,10 +90,22 @@ export function initialize( id, settings ) {
|
|
|
105
90
|
// do this will result in errors in the default block parser.
|
|
106
91
|
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
107
92
|
setFreeformContentHandlerName( 'core/html' );
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
|
|
94
|
+
root.render( <Layout blockEditorSettings={ settings } /> );
|
|
95
|
+
|
|
96
|
+
return root;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Compatibility export under the old `initialize` name.
|
|
101
|
+
*/
|
|
102
|
+
export const initialize = initializeEditor;
|
|
103
|
+
|
|
104
|
+
export function reinitializeEditor() {
|
|
105
|
+
deprecated( 'wp.editWidgets.reinitializeEditor', {
|
|
106
|
+
since: '6.2',
|
|
107
|
+
version: '6.3',
|
|
108
|
+
} );
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
/**
|