Skip to content

Commit 788473f

Browse files
committed
refactor(editor): rename JavaScript editor settings constant
1 parent b5785c0 commit 788473f

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎inc/Services/Editor.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function admin_editor_script(): void {
262262

263263
$this->assets_tools->add_inline_script(
264264
'theme-admin-editor-script',
265-
'const BFFEditorSettings = ' . wp_json_encode(
265+
'const BEAPI_EDITOR_SETTINGS = ' . wp_json_encode(
266266
apply_filters(
267267
'bff_editor_custom_settings',
268268
[

‎src/js/common/editor.js‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* global BFFEditorSettings */
1+
/* global BEAPI_EDITOR_SETTINGS */
22

3-
/* Customize BFFEditorSettings in inc/Services/Editor.php or with `bff_editor_custom_settings` filter (see readme). */
3+
/* Customize BEAPI_EDITOR_SETTINGS in inc/Services/Editor.php or with `bff_editor_custom_settings` filter (see readme). */
44
import domReady from '@wordpress/dom-ready';
55
import { subscribe } from '@wordpress/data';
66
import { addFilter } from '@wordpress/hooks';
@@ -13,11 +13,11 @@ import {
1313
import './utils/beapi';
1414

1515
const unregisterDisabledBlockStyles = () => {
16-
if (!BFFEditorSettings.disabledBlocksStyles) {
16+
if (!BEAPI_EDITOR_SETTINGS.disabledBlocksStyles) {
1717
return;
1818
}
1919

20-
Object.entries(BFFEditorSettings.disabledBlocksStyles).forEach(
20+
Object.entries(BEAPI_EDITOR_SETTINGS.disabledBlocksStyles).forEach(
2121
([blockName, styles]) => {
2222
[].concat(styles).forEach((styleName) => {
2323
unregisterBlockStyle(blockName, styleName);
@@ -27,11 +27,11 @@ const unregisterDisabledBlockStyles = () => {
2727
};
2828

2929
const unregisterDisallowedBlockVariations = () => {
30-
if (!BFFEditorSettings.allowedBlocksVariations) {
30+
if (!BEAPI_EDITOR_SETTINGS.allowedBlocksVariations) {
3131
return;
3232
}
3333

34-
Object.entries(BFFEditorSettings.allowedBlocksVariations).forEach(
34+
Object.entries(BEAPI_EDITOR_SETTINGS.allowedBlocksVariations).forEach(
3535
([blockName, allowedVariationNames]) => {
3636
const blockVariations = getBlockVariations(blockName) || [];
3737

@@ -67,9 +67,9 @@ const whenBlocksRegistered = (blockNames, callback) => {
6767
domReady(() => {
6868
unregisterDisabledBlockStyles();
6969

70-
if (BFFEditorSettings.allowedBlocksVariations) {
70+
if (BEAPI_EDITOR_SETTINGS.allowedBlocksVariations) {
7171
const blockNames = Object.keys(
72-
BFFEditorSettings.allowedBlocksVariations
72+
BEAPI_EDITOR_SETTINGS.allowedBlocksVariations
7373
);
7474

7575
whenBlocksRegistered(blockNames, unregisterDisallowedBlockVariations);
@@ -87,8 +87,8 @@ addFilter(
8787
function (settings, name) {
8888
// Disable all styles
8989
if (
90-
BFFEditorSettings.disableAllBlocksStyles &&
91-
BFFEditorSettings.disableAllBlocksStyles.includes(name)
90+
BEAPI_EDITOR_SETTINGS.disableAllBlocksStyles &&
91+
BEAPI_EDITOR_SETTINGS.disableAllBlocksStyles.includes(name)
9292
) {
9393
settings.styles = [];
9494
}

0 commit comments

Comments
 (0)