golden hour
/home/godaofbq/hardchambers.com/wp-content/plugins/essential-blocks/src/write-with-ai
⬆️ Go Up
Upload
File/Folder
Size
Actions
WriteAiButton.js
26.39 KB
Del
OK
ai-write-icon.js
1.73 KB
Del
OK
index.js
1.14 KB
Del
OK
style.scss
4.75 KB
Del
OK
Edit: index.js
import { createRoot } from "@wordpress/element" import { subscribe } from '@wordpress/data' import "./style.scss" import WriteAIButton from "./WriteAiButton" document.addEventListener('DOMContentLoaded', function () { // const plugin_file = "templately/templately.php"; // const templately = EssentialBlocksLocalize.get_plugins[plugin_file]; // if (templately && templately.active) { // return; // } // Create Button const buttonDiv = document.createElement('div') buttonDiv.classList.add('eb-write-ai-button-wrapper') const root = createRoot(buttonDiv); root.render(<WriteAIButton />); subscribe(() => { const toplbar = document.querySelector('.editor-header__settings') if (toplbar) { const templately = undefined; if (templately && templately.active) { if (toplbar.querySelector('.eb-write-ai-button-wrapper')) { toplbar.removeChild(buttonDiv) } } else if (!toplbar.querySelector('.eb-write-ai-button-wrapper')) { toplbar.prepend(buttonDiv) } } }) });
Save