Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/extendif.../src/HelpCent...
File: buttons.js
import { AdminBar } from '@help-center/components/buttons/AdminBar';
[0] Fix | Delete
import { PostEditor } from '@help-center/components/buttons/PostEditor';
[1] Fix | Delete
import { render } from '@shared/lib/dom';
[2] Fix | Delete
import { isOnLaunch } from '@shared/lib/utils';
[3] Fix | Delete
import { useEffect } from '@wordpress/element';
[4] Fix | Delete
import { registerPlugin } from '@wordpress/plugins';
[5] Fix | Delete
[6] Fix | Delete
// Global toolbar
[7] Fix | Delete
(() => {
[8] Fix | Delete
if (isOnLaunch()) return;
[9] Fix | Delete
const id = 'wp-admin-bar-help-center-btn';
[10] Fix | Delete
if (document.getElementById(id)) return;
[11] Fix | Delete
const helpCenter = Object.assign(document.createElement('li'), {
[12] Fix | Delete
className: 'extendify-help-center',
[13] Fix | Delete
id,
[14] Fix | Delete
});
[15] Fix | Delete
document.querySelector('#wp-admin-bar-my-account')?.after(helpCenter);
[16] Fix | Delete
render(<AdminBar />, helpCenter);
[17] Fix | Delete
})();
[18] Fix | Delete
[19] Fix | Delete
// In editor
[20] Fix | Delete
registerPlugin('extendify-help-center-buttons', {
[21] Fix | Delete
render: () => <HelpCenterButton />,
[22] Fix | Delete
});
[23] Fix | Delete
const HelpCenterButton = () => {
[24] Fix | Delete
useEffect(() => {
[25] Fix | Delete
if (isOnLaunch()) return;
[26] Fix | Delete
const id = 'extendify-gtnbrg-help-center-btn';
[27] Fix | Delete
if (document.getElementById(id)) return;
[28] Fix | Delete
[29] Fix | Delete
const helpCenter = Object.assign(document.createElement('span'), {
[30] Fix | Delete
className: 'extendify-help-center',
[31] Fix | Delete
id,
[32] Fix | Delete
});
[33] Fix | Delete
setTimeout(() => {
[34] Fix | Delete
if (document.getElementById(id)) return;
[35] Fix | Delete
const page = '[aria-controls="edit-post:document"]';
[36] Fix | Delete
const fse = '[aria-controls="edit-site:template"]';
[37] Fix | Delete
document.querySelector(page)?.after(helpCenter);
[38] Fix | Delete
document.querySelector(fse)?.after(helpCenter);
[39] Fix | Delete
render(<PostEditor />, helpCenter);
[40] Fix | Delete
}, 500);
[41] Fix | Delete
}, []);
[42] Fix | Delete
return null;
[43] Fix | Delete
};
[44] Fix | Delete
[45] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function