File size: 658 Bytes
cce8120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"use client";

import {useEffect,useRef} from "react";
import grapesjs from "grapesjs";
import "grapesjs/dist/css/grapes.min.css";
import "grapesjs-preset-webpage";

export default function ProductionVisualBuilder(){

const editorRef=useRef(null);

useEffect(()=>{

if(editorRef.current)return;

editorRef.current=grapesjs.init({

container:"#gjs",

height:"100vh",

storageManager:false,

plugins:["grapesjs-preset-webpage"],

deviceManager:{
devices:[
{name:"Desktop",width:""},
{name:"Tablet",width:"768px"},
{name:"Mobile",width:"375px"}
]
}

});

return()=>{
editorRef.current?.destroy();
};

},[]);

return <div id="gjs" style={{height:"100vh"}}/>;

}