Файловый менеджер - Редактировать - /home/clickysoft/public_html/travel-guru.clickysoft.net/resources/js/components/WebBuilder.js
Назад
import React, { useEffect, useRef } from 'react'; import ReactDOM from 'react-dom'; import grapesjs from 'grapesjs'; import plugin from 'grapesjs-preset-webpage'; import basic from 'grapesjs-blocks-basic'; import 'grapesjs/dist/css/grapes.min.css'; const WebBuilder = (props) => { const { primaryId, appUrl } = props; const editorRef = useRef(null); const projectEndpoint = `${appUrl}/get-template/${primaryId}`; useEffect(() => { const editor = grapesjs.init({ container: '#gjs', height: '700px', width: '100%', plugins: [plugin, basic], storageManager: { id: 'gjs-', type: 'remote', contentTypeJson: true, autosave: false, // Disable autosave autoload: true, storeComponents: true, storeStyles: true, storeHtml: true, storeCss: true, options: { remote: { urlStore: `${appUrl}/save-template`, urlLoad: projectEndpoint, onStore: data => ({ id: primaryId, data }), onLoad: result => result, }, }, headers: { 'Content-Type': 'application/json', }, }, deviceManager: { devices: [ { id: 'desktop', name: 'Desktop', width: '', }, { id: 'tablet', name: 'Tablet', width: '768px', widthMedia: '992px', }, { id: 'mobilePortrait', name: 'Mobile portrait', width: '320px', widthMedia: '575px', }, ], }, pluginsOpts: {}, }); editorRef.current = editor; }, [primaryId]); // Event handler for the "Save" button const handleSave = () => { const editor = editorRef.current; editor.store(); Swal.fire({ icon: 'success', title: 'Saved!', text: 'Your changes have been saved successfully.', }); }; return ( <div> <div id="gjs"></div> <div class="row mt-3"> <div class="col-md-12"> <button onClick={handleSave} class="btn btn-primary">Update page builder</button> </div> </div> <div class="row mt-3"></div> </div> ); } export default WebBuilder; const el = document.getElementById('web-builder'); console.log(el.length) if (el !== undefined) { ReactDOM.render(<WebBuilder {...el.dataset} />, document.getElementById('web-builder')); }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка