DmitrMakeev commited on
Commit
a1dea77
·
verified ·
1 Parent(s): 763c2ce

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +113 -201
pages.html CHANGED
@@ -1191,215 +1191,127 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
1191
 
1192
 
1193
 
1194
- <style>
1195
- /* Ваши стили */
1196
- #grabbed-info {
1197
- position: fixed;
1198
- background-color: #fff;
1199
- border: 1px solid #ccc;
1200
- padding: 10px;
1201
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
1202
- z-index: 1000;
1203
- }
1204
- </style>
1205
-
1206
-
1207
- <div id="grabbed-info"></div>
1208
-
1209
-
1210
- <script src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/per.js"></script>
1211
-
1212
-
1213
-
1214
- <script type="text/javascript">
1215
- var editor = grapesjs.init({
1216
- container: '#gjs',
1217
- fromElement: true,
1218
- height: "100vh",
1219
- storageManager: {
1220
- type: 'local',
1221
- autosave: true,
1222
- autoload: true,
1223
- stepsBeforeSave: 1,
 
 
 
 
1224
  },
1225
- plugins: [
1226
- "gjs-blocks-basic",
1227
- "grapesjs-component-countdown",
1228
- "grapesjs-component-code-editor",
1229
- "grapesjs-templates",
1230
- "grapesjs-rte-extensions",
1231
- "grapesjs-user-blocks",
1232
- "grapesjs-tabs", // Плагин вкладок
1233
- "grapesjs-tooltip", // Плагин подсказок
1234
- "grapesjs-script-editor", // Плагин редактора скриптов
1235
- "grapesjs-rulers", // Добавляем плагин линеек
1236
- "grapesjs-tui-image-editor" // Добавляем плагин редактора изображений
1237
- ],
1238
- pluginsOpts: {
1239
- "gjs-blocks-basic": {
1240
- blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'quote', 'social', 'image', 'video'],
1241
- blocksBasicOpts: {
1242
- flexGrid: true,
1243
- stylePrefix: 'gjs-',
1244
- columns: 12,
1245
- rowHeight: 75,
1246
- addBasicStyle: true
1247
- }
 
1248
  },
1249
- "grapesjs-component-code-editor": {
1250
- panelId: 'views-container',
1251
- appendTo: '.gjs-pn-views-container',
1252
- openState: { pn: '35%', cv: '65%' },
1253
- closedState: { pn: '15%', cv: '85%' },
1254
- codeViewOptions: {},
1255
- preserveWidth: false,
1256
- clearData: false,
1257
- editJs: true,
1258
- cleanCssBtn: true,
1259
- htmlBtnText: 'Применить',
1260
- cssBtnText: 'Применить',
1261
- cleanCssBtnText: 'Удалить'
1262
  },
1263
- "grapesjs-templates": {
1264
- // Настройки для grapesjs-templates
 
 
 
 
1265
  },
1266
- "grapesjs-rte-extensions": {
1267
- base: {
1268
- bold: true,
1269
- italic: true,
1270
- underline: true,
1271
- strikethrough: true,
1272
- link: true,
1273
- },
1274
- fonts: {
1275
- fontColor: true,
1276
- hilite: true,
1277
- },
1278
- format: {
1279
- heading1: true,
1280
- heading2: true,
1281
- heading3: true,
1282
- paragraph: true,
1283
- clearFormatting: true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1284
  },
1285
- align: true,
1286
- darkColorPicker: true,
1287
- maxWidth: '600px'
1288
- },
1289
- "grapesjs-user-blocks": {
1290
- // Настройки для grapesjs-user-blocks
1291
- },
1292
- "grapesjs-tabs": {
1293
- // Настройки для grapesjs-tabs
1294
- },
1295
- "grapesjs-tooltip": {
1296
- // Настройки для grapesjs-tooltip
1297
- },
1298
- "grapesjs-script-editor": {
1299
- // Настройки для grapesjs-script-editor
1300
- starter: 'let el = this',
1301
- toolbarIcon: '<i class="fa fa-puzzle-piece"></i>',
1302
- scriptTypesSupport: ['default', 'wrapper', 'text', 'textnode', 'image', 'video', 'svg'],
1303
- toolbarBtnCustomScript: {},
1304
- onRun: () => console.log('valid syntax'),
1305
- onError: err => console.log('error:', err),
1306
- modalTitle: 'Script',
1307
- codeViewOptions: {},
1308
- buttonLabel: 'save',
1309
- commandAttachScript: {}
1310
  },
1311
- "grapesjs-rulers": {
1312
- // Настройки для grapesjs-rulers
1313
- dragMode: 'translate',
1314
- rulerHeight: 15,
1315
- canvasZoom: 94,
1316
- rulerOpts: {}
1317
- },
1318
- "grapesjs-tui-image-editor": {
1319
- config: {
1320
- includeUI: {
1321
- initMenu: 'filter',
1322
- },
1323
- },
1324
- labelImageEditor: 'Image Editor',
1325
- labelApply: 'Apply',
1326
- height: '650px',
1327
- width: '100%',
1328
- hideHeader: true,
1329
- addToAssets: true,
1330
- upload: false
1331
- }
1332
  }
1333
- });
1334
-
1335
- // Функция для обновления информации о положении элемента
1336
- function updatePositionInfo(component) {
1337
- const positionInfo = document.getElementById('position-info');
1338
- if (component) {
1339
- const { x, y, width, height } = component.getBoundingRect();
1340
- const { width: canvasWidth, height: canvasHeight } = editor.Canvas.getCanvasElement().getBoundingClientRect();
1341
- const xPercent = (x / canvasWidth * 100).toFixed(2);
1342
- const yPercent = (y / canvasHeight * 100).toFixed(2);
1343
- positionInfo.textContent = `Position: X: ${x}px (${xPercent}%), Y: ${y}px (${yPercent}%), Width: ${width}px, Height: ${height}px`;
1344
- } else {
1345
- positionInfo.textContent = 'Position: ';
1346
- }
1347
- }
1348
-
1349
- // Подписываемся на события перетаскивания и выбора элемента
1350
- editor.on('component:drag:start', (component) => {
1351
- updatePositionInfo(component);
1352
- });
1353
-
1354
- editor.on('component:drag', (component) => {
1355
- updatePositionInfo(component);
1356
- });
1357
-
1358
- editor.on('component:drag:stop', (component) => {
1359
- updatePositionInfo(component);
1360
- });
1361
-
1362
- editor.on('component:selected', (component) => {
1363
- updatePositionInfo(component);
1364
- });
1365
-
1366
- // Добавляем обработчики событий для перемещения элементов
1367
- let isDragging = false;
1368
- let offsetX = 0;
1369
- let offsetY = 0;
1370
- let selectedComponent = null;
1371
-
1372
- function startDrag(e, component) {
1373
- isDragging = true;
1374
- selectedComponent = component;
1375
- const rect = component.getEl().getBoundingClientRect();
1376
- offsetX = e.clientX - rect.left;
1377
- offsetY = e.clientY - rect.top;
1378
- document.addEventListener('mousemove', drag);
1379
- document.addEventListener('mouseup', stopDrag);
1380
- }
1381
-
1382
- function drag(e) {
1383
- if (!isDragging || !selectedComponent) return;
1384
- const newX = e.clientX - offsetX;
1385
- const newY = e.clientY - offsetY;
1386
- selectedComponent.set('position', { x: newX, y: newY });
1387
  }
1388
-
1389
- function stopDrag() {
1390
- isDragging = false;
1391
- selectedComponent = null;
1392
- document.removeEventListener('mousemove', drag);
1393
- document.removeEventListener('mouseup', stopDrag);
1394
- }
1395
-
1396
- editor.on('component:selected', (component) => {
1397
- component.getEl().addEventListener('mousedown', (e) => startDrag(e, component));
1398
- });
1399
- </script>
1400
-
1401
-
1402
-
1403
  <script>
1404
 
1405
  // Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
 
1191
 
1192
 
1193
 
1194
+ <script type="text/javascript">
1195
+ var editor = grapesjs.init({
1196
+ container: '#gjs',
1197
+ fromElement: true,
1198
+ height: "100vh",
1199
+ storageManager: {
1200
+ type: 'local',
1201
+ autosave: true,
1202
+ autoload: true,
1203
+ stepsBeforeSave: 1,
1204
+ },
1205
+ plugins: [
1206
+ "gjs-blocks-basic",
1207
+ "grapesjs-component-countdown",
1208
+ "grapesjs-component-code-editor",
1209
+ "grapesjs-templates",
1210
+ "grapesjs-rte-extensions",
1211
+ "grapesjs-user-blocks",
1212
+ "grapesjs-tabs", // Плагин вкладок
1213
+ "grapesjs-tooltip", // Плагин подсказок
1214
+ "grapesjs-script-editor", // Плагин редактора скриптов
1215
+ "grapesjs-rulers", // Добавляем плагин линеек
1216
+ "grapesjs-tui-image-editor" // Добавляем плагин редактора изображений
1217
+ ],
1218
+ pluginsOpts: {
1219
+ "gjs-blocks-basic": {
1220
+ blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'quote', 'social', 'image', 'video'],
1221
+ blocksBasicOpts: {
1222
+ flexGrid: true,
1223
+ stylePrefix: 'gjs-',
1224
+ columns: 12,
1225
+ rowHeight: 75,
1226
+ addBasicStyle: true
1227
+ }
1228
  },
1229
+ "grapesjs-component-code-editor": {
1230
+ panelId: 'views-container',
1231
+ appendTo: '.gjs-pn-views-container',
1232
+ openState: { pn: '35%', cv: '65%' },
1233
+ closedState: { pn: '15%', cv: '85%' },
1234
+ codeViewOptions: {},
1235
+ preserveWidth: false,
1236
+ clearData: false,
1237
+ editJs: true,
1238
+ cleanCssBtn: true,
1239
+ htmlBtnText: 'Применить',
1240
+ cssBtnText: 'Применить',
1241
+ cleanCssBtnText: 'Удалить'
1242
+ },
1243
+ "grapesjs-templates": {
1244
+ // Настройки для grapesjs-templates
1245
+ },
1246
+ "grapesjs-rte-extensions": {
1247
+ base: {
1248
+ bold: true,
1249
+ italic: true,
1250
+ underline: true,
1251
+ strikethrough: true,
1252
+ link: true,
1253
  },
1254
+ fonts: {
1255
+ fontColor: true,
1256
+ hilite: true,
 
 
 
 
 
 
 
 
 
 
1257
  },
1258
+ format: {
1259
+ heading1: true,
1260
+ heading2: true,
1261
+ heading3: true,
1262
+ paragraph: true,
1263
+ clearFormatting: true,
1264
  },
1265
+ align: true,
1266
+ darkColorPicker: true,
1267
+ maxWidth: '600px'
1268
+ },
1269
+ "grapesjs-user-blocks": {
1270
+ // Настройки для grapesjs-user-blocks
1271
+ },
1272
+ "grapesjs-tabs": {
1273
+ // Настройки для grapesjs-tabs
1274
+ },
1275
+ "grapesjs-tooltip": {
1276
+ // Настройки для grapesjs-tooltip
1277
+ },
1278
+ "grapesjs-script-editor": {
1279
+ // Настройки для grapesjs-script-editor
1280
+ starter: 'let el = this',
1281
+ toolbarIcon: '<i class="fa fa-puzzle-piece"></i>',
1282
+ scriptTypesSupport: ['default', 'wrapper', 'text', 'textnode', 'image', 'video', 'svg'],
1283
+ toolbarBtnCustomScript: {},
1284
+ onRun: () => console.log('valid syntax'),
1285
+ onError: err => console.log('error:', err),
1286
+ modalTitle: 'Script',
1287
+ codeViewOptions: {},
1288
+ buttonLabel: 'save',
1289
+ commandAttachScript: {}
1290
+ },
1291
+ "grapesjs-rulers": {
1292
+ // Настройки для grapesjs-rulers
1293
+ dragMode: 'translate',
1294
+ rulerHeight: 15,
1295
+ canvasZoom: 94,
1296
+ rulerOpts: {}
1297
+ },
1298
+ "grapesjs-tui-image-editor": {
1299
+ config: {
1300
+ includeUI: {
1301
+ initMenu: 'filter',
1302
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1303
  },
1304
+ labelImageEditor: 'Image Editor',
1305
+ labelApply: 'Apply',
1306
+ height: '650px',
1307
+ width: '100%',
1308
+ hideHeader: true,
1309
+ addToAssets: true,
1310
+ upload: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1311
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1312
  }
1313
+ });
1314
+ </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
1315
  <script>
1316
 
1317
  // Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки