Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/extendif.../src/PageCrea.../util
File: installBlocks.js
import { downloadableBlocksManifest } from '@page-creator/lib/blocks';
[0] Fix | Delete
import { useInstalledPluginsCache } from '@page-creator/state/plugins-cache';
[1] Fix | Delete
import { store as blockDirectoryStore } from '@wordpress/block-directory';
[2] Fix | Delete
import { dispatch } from '@wordpress/data';
[3] Fix | Delete
[4] Fix | Delete
const supportedBlocks = ['contact-form-7', 'simplybook'];
[5] Fix | Delete
[6] Fix | Delete
export const installBlocks = async ({ patterns }) => {
[7] Fix | Delete
const { installBlockType } = dispatch(blockDirectoryStore);
[8] Fix | Delete
const { installedPlugins, updateInstalledPlugins } =
[9] Fix | Delete
useInstalledPluginsCache.getState();
[10] Fix | Delete
[11] Fix | Delete
const code = patterns
[12] Fix | Delete
.flatMap((p) => p.patternReplacementCode)
[13] Fix | Delete
.filter(Boolean);
[14] Fix | Delete
[15] Fix | Delete
// Look for any blocks we support installing
[16] Fix | Delete
const foundBlocks = supportedBlocks.filter(
[17] Fix | Delete
(block) =>
[18] Fix | Delete
code.some((c) => c.includes(block)) && !installedPlugins.includes(block),
[19] Fix | Delete
); // Install the blocks
[20] Fix | Delete
for (const block of foundBlocks) {
[21] Fix | Delete
const blockManifest = downloadableBlocksManifest[block];
[22] Fix | Delete
if (blockManifest) await installBlockType(blockManifest);
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
await updateInstalledPlugins();
[26] Fix | Delete
};
[27] Fix | Delete
[28] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function