DmitrMakeev commited on
Commit
ff96903
·
verified ·
1 Parent(s): 57b52c6

Update builder.html

Browse files
Files changed (1) hide show
  1. builder.html +74 -69
builder.html CHANGED
@@ -5,6 +5,9 @@
5
  <title>GrapesJS</title>
6
  <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
7
  <script src="https://unpkg.com/grapesjs"></script>
 
 
 
8
  <style>
9
  body,
10
  html {
@@ -83,79 +86,81 @@
83
  }
84
  </style>
85
  </div>
86
- <script src="https://unpkg.com/grapesjs-custom-code/dist/grapesjs-custom-code.min.js"></script>
87
 
88
- <script type="text/javascript">
89
- var editor = grapesjs.init({
90
- showOffsets: 1,
91
- noticeOnUnload: 0,
92
- container: '#gjs',
93
- height: '100%',
94
- fromElement: true,
95
- storageManager: { autoload: 0 },
96
- plugins: ['gjs-custom-code'],
97
- pluginsOpts: {
98
- 'gjs-custom-code': {
99
- // Опции плагина
100
- }
101
- },
102
- styleManager : {
103
- sectors: [{
104
- name: 'General',
105
- open: false,
106
- buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom']
107
- },{
108
- name: 'Flex',
109
- open: false,
110
- buildProps: ['flex-direction', 'flex-wrap', 'justify-content', 'align-items', 'align-content', 'order', 'flex-basis', 'flex-grow', 'flex-shrink', 'align-self']
111
- },{
112
- name: 'Dimension',
113
- open: false,
114
- buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding'],
115
- },{
116
- name: 'Typography',
117
- open: false,
118
- buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-shadow'],
119
- },{
120
- name: 'Decorations',
121
- open: false,
122
- buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background'],
123
- },{
124
- name: 'Extra',
125
- open: false,
126
- buildProps: ['transition', 'perspective', 'transform'],
127
- }
128
- ],
129
- },
130
- });
131
 
132
- // Add blocks for each element
133
- editor.BlockManager.add('welcome-block', {
134
- label: 'Welcome Title',
135
- content: `<h1 class="welcome">Welcome to</h1>`
136
- });
137
 
138
- editor.BlockManager.add('big-title-block', {
139
- label: 'Big Title',
140
- content: `
141
- <div class="big-title">
142
- <svg class="logo" viewBox="0 0 100 100">
143
- <path d="M40 5l-12.9 7.4 -12.9 7.4c-1.4 0.8-2.7 2.3-3.7 3.9 -0.9 1.6-1.5 3.5-1.5 5.1v14.9 14.9c0 1.7 0.6 3.5 1.5 5.1 0.9 1.6 2.2 3.1 3.7 3.9l12.9 7.4 12.9 7.4c1.4 0.8 3.3 1.2 5.2 1.2 1.9 0 3.8-0.4 5.2-1.2l12.9-7.4 12.9-7.4c1.4-0.8 2.7-2.2 3.7-3.9 0.9-1.6 1.5-3.5 1.5-5.1v-14.9 -12.7c0-4.6-3.8-6-6.8-4.2l-28 16.2"/>
144
- </svg>
145
- <span>GrapesJS</span>
146
- </div>
147
- `
148
- });
149
-
150
- editor.BlockManager.add('description-block', {
151
- label: 'Description',
152
- content: `<div class="description">This is a demo content from index.html. For the development, you shouldn't edit this file, instead you can copy and rename it to _index.html, on next server start the new file will be served, and it will be ignored by git.</div>`
 
 
 
 
 
153
  });
 
 
 
 
154
 
155
- editor.BlockManager.add('button-block', {
156
- label: 'Add Button',
157
- content: `<button class="add-button">Ещё добавь</button>`
158
- });
159
- </script>
160
  </body>
161
  </html>
 
5
  <title>GrapesJS</title>
6
  <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
7
  <script src="https://unpkg.com/grapesjs"></script>
8
+
9
+ <script src="path/to/grapesjs-custom-code.min.js"></script>
10
+
11
  <style>
12
  body,
13
  html {
 
86
  }
87
  </style>
88
  </div>
 
89
 
90
+ <script type="text/javascript">
91
+ var editor = grapesjs.init({
92
+ showOffsets: 1,
93
+ noticeOnUnload: 0,
94
+ container: '#gjs',
95
+ height: '100%',
96
+ fromElement: true,
97
+ storageManager: { autoload: 0 },
98
+ styleManager : {
99
+ sectors: [{
100
+ name: 'General',
101
+ open: false,
102
+ buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom']
103
+ },{
104
+ name: 'Flex',
105
+ open: false,
106
+ buildProps: ['flex-direction', 'flex-wrap', 'justify-content', 'align-items', 'align-content', 'order', 'flex-basis', 'flex-grow', 'flex-shrink', 'align-self']
107
+ },{
108
+ name: 'Dimension',
109
+ open: false,
110
+ buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding'],
111
+ },{
112
+ name: 'Typography',
113
+ open: false,
114
+ buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-shadow'],
115
+ },{
116
+ name: 'Decorations',
117
+ open: false,
118
+ buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background'],
119
+ },{
120
+ name: 'Extra',
121
+ open: false,
122
+ buildProps: ['transition', 'perspective', 'transform'],
123
+ }
124
+ ],
125
+ },
126
+ });
 
 
 
 
 
 
127
 
128
+ // Add blocks for each element
129
+ editor.BlockManager.add('welcome-block', {
130
+ label: 'Welcome Title',
131
+ content: `<h1 class="welcome">Welcome to</h1>`
132
+ });
133
 
134
+ editor.BlockManager.add('big-title-block', {
135
+ label: 'Big Title',
136
+ content: `
137
+ <div class="big-title">
138
+ <svg class="logo" viewBox="0 0 100 100">
139
+ <path d="M40 5l-12.9 7.4 -12.9 7.4c-1.4 0.8-2.7 2.3-3.7 3.9 -0.9 1.6-1.5 3.5-1.5 5.1v14.9 14.9c0 1.7 0.6 3.5 1.5 5.1 0.9 1.6 2.2 3.1 3.7 3.9l12.9 7.4 12.9 7.4c1.4 0.8 3.3 1.2 5.2 1.2 1.9 0 3.8-0.4 5.2-1.2l12.9-7.4 12.9-7.4c1.4-0.8 2.7-2.2 3.7-3.9 0.9-1.6 1.5-3.5 1.5-5.1v-14.9 -12.7c0-4.6-3.8-6-6.8-4.2l-28 16.2"/>
140
+ </svg>
141
+ <span>GrapesJS</span>
142
+ </div>
143
+ `
144
+ });
145
+ var editor = grapesjs.init({
146
+ container : '#gjs',
147
+ ...
148
+ plugins: ['grapesjs-custom-code'],
149
+ pluginsOpts: {
150
+ 'grapesjs-custom-code': {
151
+ // options
152
+ }
153
+ }
154
  });
155
+ editor.BlockManager.add('description-block', {
156
+ label: 'Description',
157
+ content: `<div class="description">This is a demo content from index.html. For the development, you shouldn't edit this file, instead you can copy and rename it to _index.html, on next server start the new file will be served, and it will be ignored by git.</div>`
158
+ });
159
 
160
+ editor.BlockManager.add('button-block', {
161
+ label: 'Add Button',
162
+ content: `<button class="add-button">Ещё добавь</button>`
163
+ });
164
+ </script>
165
  </body>
166
  </html>