DmitrMakeev commited on
Commit
30e5f3c
·
verified ·
1 Parent(s): 7f00d88

Update pages.html

Browse files
Files changed (1) hide show
  1. pages.html +48 -4
pages.html CHANGED
@@ -1196,7 +1196,19 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
1196
 
1197
 
1198
 
 
 
 
 
 
 
 
 
 
 
 
1199
 
 
1200
 
1201
  <script type="text/javascript">
1202
  var editor = grapesjs.init({
@@ -1220,7 +1232,8 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
1220
  "grapesjs-tooltip", // Плагин подсказок
1221
  "grapesjs-script-editor", // Плагин редактора скриптов
1222
  "grapesjs-rulers", // Добавляем плагин линеек
1223
- "grapesjs-tui-image-editor" // Добавляем плагин редактора изображений
 
1224
  ],
1225
  pluginsOpts: {
1226
  "gjs-blocks-basic": {
@@ -1315,11 +1328,12 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
1315
  hideHeader: true,
1316
  addToAssets: true,
1317
  upload: false
 
 
 
1318
  }
1319
  }
1320
  });
1321
- </script>
1322
- <script>
1323
 
1324
  // Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
1325
  editor.Panels.addButton('options', {
@@ -1331,8 +1345,38 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
1331
  command: 'ruler-visibility', // Команда для переключения видимости линеек
1332
  attributes: { title: 'Toggle Rulers' }
1333
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1334
  </script>
1335
-
1336
 
1337
  <script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/rus/rus.js"></script>
1338
 
 
1196
 
1197
 
1198
 
1199
+ <style>
1200
+ /* Ваши стили */
1201
+ #grabbed-info {
1202
+ position: fixed;
1203
+ background-color: #fff;
1204
+ border: 1px solid #ccc;
1205
+ padding: 10px;
1206
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
1207
+ z-index: 1000;
1208
+ }
1209
+ </style>
1210
 
1211
+ <div id="grabbed-info"></div>
1212
 
1213
  <script type="text/javascript">
1214
  var editor = grapesjs.init({
 
1232
  "grapesjs-tooltip", // Плагин подсказок
1233
  "grapesjs-script-editor", // Плагин редактора скриптов
1234
  "grapesjs-rulers", // Добавляем плагин линеек
1235
+ "grapesjs-tui-image-editor", // Добавляем плагин редактора изображений
1236
+ "grapesjs-click" // Добавляем плагин grapesjs-click
1237
  ],
1238
  pluginsOpts: {
1239
  "gjs-blocks-basic": {
 
1328
  hideHeader: true,
1329
  addToAssets: true,
1330
  upload: false
1331
+ },
1332
+ "grapesjs-click": {
1333
+ // Настройки для grapesjs-click
1334
  }
1335
  }
1336
  });
 
 
1337
 
1338
  // Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
1339
  editor.Panels.addButton('options', {
 
1345
  command: 'ruler-visibility', // Команда для переключения видимости линеек
1346
  attributes: { title: 'Toggle Rulers' }
1347
  });
1348
+
1349
+ // Функция для обновления информации о положении элемента
1350
+ function updatePositionInfo(component) {
1351
+ const positionInfo = document.getElementById('position-info');
1352
+ if (component) {
1353
+ const { x, y, width, height } = component.getBoundingRect();
1354
+ const { width: canvasWidth, height: canvasHeight } = editor.Canvas.getCanvasElement().getBoundingClientRect();
1355
+ const xPercent = (x / canvasWidth * 100).toFixed(2);
1356
+ const yPercent = (y / canvasHeight * 100).toFixed(2);
1357
+ positionInfo.textContent = `Position: X: ${x}px (${xPercent}%), Y: ${y}px (${yPercent}%), Width: ${width}px, Height: ${height}px`;
1358
+ } else {
1359
+ positionInfo.textContent = 'Position: ';
1360
+ }
1361
+ }
1362
+
1363
+ // Подписываемся на события перетаскивания и выбора элемента
1364
+ editor.on('component:drag:start', (component) => {
1365
+ updatePositionInfo(component);
1366
+ });
1367
+
1368
+ editor.on('component:drag', (component) => {
1369
+ updatePositionInfo(component);
1370
+ });
1371
+
1372
+ editor.on('component:drag:stop', (component) => {
1373
+ updatePositionInfo(component);
1374
+ });
1375
+
1376
+ editor.on('component:selected', (component) => {
1377
+ updatePositionInfo(component);
1378
+ });
1379
  </script>
 
1380
 
1381
  <script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/rus/rus.js"></script>
1382