-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (44 loc) · 1.24 KB
/
index.html
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
<html>
<head>
<title>Advanced Selector</title>
<link rel="stylesheet" type="text/css" href="./advanced-selector.css">
<script src="./index.js"></script>
<link href="http://127.0.0.1:8081/dist/css/grapes.min.css" rel="stylesheet">
<script src="http://127.0.0.1:8081/dist/grapes.min.js"></script>
<style>
body, html {
margin: 0;
height: 100%;
}
:root {
--gjs-left-width: 50%;
}
</style>
</head>
<body>
<div id="gjs"></div>
<script>
// Wait for the plugin to be injected by the dev server
setTimeout(() => {
const editor = grapesjs.init({
container: '#gjs',
height: '100%',
fromElement: true,
selectorManager: {
custom: true, // This should not be needed, check index.js
escapeName: (name) => `${name}`,
},
plugins: ['@silexlabs/grapesjs-advanced-selector'],
});
editor.on('load', () => {
editor.addComponents('<div class="container"><p class="child">This is a child</p></div>')
})
window.editor = editor;
setTimeout(() => {
var comp = editor.Components.getComponents().models.find(c => c.cid === 'c518')
editor.select(comp)
}, 1000);
}, 100);
</script>
</body>
</html>