Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/extendif.../src/PageCrea.../util
File: insert.js
import { dispatch, select } from '@wordpress/data';
[0] Fix | Delete
[1] Fix | Delete
export const insertBlocks = async (blocks) => {
[2] Fix | Delete
const { insertBlocks, replaceBlock } = dispatch('core/block-editor');
[3] Fix | Delete
const {
[4] Fix | Delete
getSelectedBlock,
[5] Fix | Delete
getBlockHierarchyRootClientId,
[6] Fix | Delete
getBlockIndex,
[7] Fix | Delete
getGlobalBlockCount,
[8] Fix | Delete
} = select('core/block-editor');
[9] Fix | Delete
[10] Fix | Delete
const { clientId, name, attributes } = getSelectedBlock() || {};
[11] Fix | Delete
const rootClientId = clientId ? getBlockHierarchyRootClientId(clientId) : '';
[12] Fix | Delete
const insertPointIndex =
[13] Fix | Delete
(rootClientId ? getBlockIndex(rootClientId) : getGlobalBlockCount()) + 1;
[14] Fix | Delete
[15] Fix | Delete
if (name === 'core/paragraph' && attributes?.content === '') {
[16] Fix | Delete
return await replaceBlock(clientId, blocks);
[17] Fix | Delete
}
[18] Fix | Delete
return await insertBlocks(blocks, insertPointIndex);
[19] Fix | Delete
};
[20] Fix | Delete
[21] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function