Skip to content

Commit c3c0897

Browse files
authored
Editor Script: Add back compat with WP 6.5 (#1760)
1 parent 2a98002 commit c3c0897

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: fixed
3+
4+
Fixes a bug in WordPress 6.5 where the plugin settings in the Editor would fail to render, due to a backwards compatibility break.

build/editor-plugin/plugin.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '1bd009e5ff8d85217279');
1+
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '35ef322601ad7ccf1214');

build/editor-plugin/plugin.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"@wordpress/core-data": "^7.22.0",
3636
"@wordpress/data": "^10.0.0",
3737
"@wordpress/dom-ready": "^4.0.0",
38+
"@wordpress/edit-post": "^8.22.0",
3839
"@wordpress/editor": "^14.22.0",
3940
"@wordpress/element": "^6.0.0",
4041
"@wordpress/env": "^10.10.0",

src/editor-plugin/plugin.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { PluginDocumentSettingPanel, PluginPreviewMenuItem } from '@wordpress/editor';
2+
import { PluginDocumentSettingPanel as DocumentSettingPanel } from '@wordpress/edit-post';
23
import { registerPlugin } from '@wordpress/plugins';
34
import { TextControl, RadioControl, RangeControl, __experimentalText as Text, Tooltip } from '@wordpress/components';
45
import { Icon, globe, people, external } from '@wordpress/icons';
@@ -34,6 +35,7 @@ const EditorPlugin = () => {
3435
if ( 'wp_block' === postType ) {
3536
return null;
3637
}
38+
3739
const { maxImageAttachments = 4 } = useOptions();
3840
const labelStyling = {
3941
verticalAlign: 'middle',
@@ -61,8 +63,14 @@ const EditorPlugin = () => {
6163
</Tooltip>
6264
);
6365

66+
/*
67+
* Backwards compatibility with WordPress 6.5.
68+
* @todo Remove when 6.5 is no longer supported.
69+
*/
70+
const SettingsPanel = PluginDocumentSettingPanel || DocumentSettingPanel;
71+
6472
return (
65-
<PluginDocumentSettingPanel
73+
<SettingsPanel
6674
name="activitypub"
6775
className="block-editor-block-inspector"
6876
title={ __( 'Fediverse ⁂', 'activitypub' ) }
@@ -139,7 +147,7 @@ const EditorPlugin = () => {
139147
} }
140148
className="activitypub-visibility"
141149
/>
142-
</PluginDocumentSettingPanel>
150+
</SettingsPanel>
143151
);
144152
};
145153

0 commit comments

Comments
 (0)