Update pages.html
Browse files- pages.html +183 -181
pages.html
CHANGED
|
@@ -1209,208 +1209,210 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
| 1209 |
|
| 1210 |
<script src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/per.js"></script>
|
| 1211 |
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
| 1221 |
-
|
| 1222 |
-
|
| 1223 |
-
|
| 1224 |
-
"gjs-blocks-basic",
|
| 1225 |
-
"grapesjs-component-countdown",
|
| 1226 |
-
"grapesjs-component-code-editor",
|
| 1227 |
-
"grapesjs-templates",
|
| 1228 |
-
"grapesjs-rte-extensions",
|
| 1229 |
-
"grapesjs-user-blocks",
|
| 1230 |
-
"grapesjs-tabs", // Плагин вкладок
|
| 1231 |
-
"grapesjs-tooltip", // Плагин подсказок
|
| 1232 |
-
"grapesjs-script-editor", // Плагин редактора скриптов
|
| 1233 |
-
"grapesjs-rulers", // Добавляем плагин линеек
|
| 1234 |
-
"grapesjs-tui-image-editor" // Добавляем плагин редактора изображений
|
| 1235 |
-
],
|
| 1236 |
-
pluginsOpts: {
|
| 1237 |
-
"gjs-blocks-basic": {
|
| 1238 |
-
blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'quote', 'social', 'image', 'video'],
|
| 1239 |
-
blocksBasicOpts: {
|
| 1240 |
-
flexGrid: true,
|
| 1241 |
-
stylePrefix: 'gjs-',
|
| 1242 |
-
columns: 12,
|
| 1243 |
-
rowHeight: 75,
|
| 1244 |
-
addBasicStyle: true
|
| 1245 |
-
}
|
| 1246 |
-
},
|
| 1247 |
-
"grapesjs-component-code-editor": {
|
| 1248 |
-
panelId: 'views-container',
|
| 1249 |
-
appendTo: '.gjs-pn-views-container',
|
| 1250 |
-
openState: { pn: '35%', cv: '65%' },
|
| 1251 |
-
closedState: { pn: '15%', cv: '85%' },
|
| 1252 |
-
codeViewOptions: {},
|
| 1253 |
-
preserveWidth: false,
|
| 1254 |
-
clearData: false,
|
| 1255 |
-
editJs: true,
|
| 1256 |
-
cleanCssBtn: true,
|
| 1257 |
-
htmlBtnText: 'Применить',
|
| 1258 |
-
cssBtnText: 'Применить',
|
| 1259 |
-
cleanCssBtnText: 'Удалить'
|
| 1260 |
-
},
|
| 1261 |
-
"grapesjs-templates": {
|
| 1262 |
-
// Настройки для grapesjs-templates
|
| 1263 |
},
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
|
| 1270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1271 |
},
|
| 1272 |
-
|
| 1273 |
-
|
| 1274 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1275 |
},
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
heading2: true,
|
| 1279 |
-
heading3: true,
|
| 1280 |
-
paragraph: true,
|
| 1281 |
-
clearFormatting: true,
|
| 1282 |
},
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
"grapesjs-tabs": {
|
| 1291 |
-
// Настройки для grapesjs-tabs
|
| 1292 |
-
},
|
| 1293 |
-
"grapesjs-tooltip": {
|
| 1294 |
-
// Настройки для grapesjs-tooltip
|
| 1295 |
-
},
|
| 1296 |
-
"grapesjs-script-editor": {
|
| 1297 |
-
// Настройки для grapesjs-script-editor
|
| 1298 |
-
starter: 'let el = this',
|
| 1299 |
-
toolbarIcon: '<i class="fa fa-puzzle-piece"></i>',
|
| 1300 |
-
scriptTypesSupport: ['default', 'wrapper', 'text', 'textnode', 'image', 'video', 'svg'],
|
| 1301 |
-
toolbarBtnCustomScript: {},
|
| 1302 |
-
onRun: () => console.log('valid syntax'),
|
| 1303 |
-
onError: err => console.log('error:', err),
|
| 1304 |
-
modalTitle: 'Script',
|
| 1305 |
-
codeViewOptions: {},
|
| 1306 |
-
buttonLabel: 'save',
|
| 1307 |
-
commandAttachScript: {}
|
| 1308 |
-
},
|
| 1309 |
-
"grapesjs-rulers": {
|
| 1310 |
-
// Настройки для grapesjs-rulers
|
| 1311 |
-
dragMode: 'translate',
|
| 1312 |
-
rulerHeight: 15,
|
| 1313 |
-
canvasZoom: 94,
|
| 1314 |
-
rulerOpts: {}
|
| 1315 |
-
},
|
| 1316 |
-
"grapesjs-tui-image-editor": {
|
| 1317 |
-
config: {
|
| 1318 |
-
includeUI: {
|
| 1319 |
-
initMenu: 'filter',
|
| 1320 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1321 |
},
|
| 1322 |
-
|
| 1323 |
-
|
| 1324 |
-
|
| 1325 |
-
|
| 1326 |
-
|
| 1327 |
-
|
| 1328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1329 |
}
|
| 1330 |
-
}
|
| 1331 |
-
});
|
| 1332 |
-
|
| 1333 |
-
// Добавляем кнопку линейки в верхнюю панель инструментов с использованием SVG-иконки
|
| 1334 |
-
editor.Panels.addButton('options', {
|
| 1335 |
-
id: 'toggle-rulers',
|
| 1336 |
-
label: `<svg width="16" height="16" viewBox="0 0 16 16">
|
| 1337 |
-
<path d="M0 8a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1H.5A.5.5 0 0 1 0 8z"/>
|
| 1338 |
-
<path d="M4 3h8a1 1 0 0 1 1 1v2.5h1V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v2.5h1V4a1 1 0 0 1 1-1zM3 9.5H2V12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9.5h-1V12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9.5z"/>
|
| 1339 |
-
</svg>`,
|
| 1340 |
-
command: 'ruler-visibility', // Команда для переключения видимости линеек
|
| 1341 |
-
attributes: { title: 'Toggle Rulers' }
|
| 1342 |
-
});
|
| 1343 |
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
|
|
|
| 1355 |
}
|
| 1356 |
-
}
|
| 1357 |
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
|
| 1361 |
-
|
| 1362 |
-
|
| 1363 |
-
editor.on('component:drag', (component) => {
|
| 1364 |
-
updatePositionInfo(component);
|
| 1365 |
-
});
|
| 1366 |
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
|
| 1371 |
-
|
| 1372 |
-
|
| 1373 |
-
|
| 1374 |
|
| 1375 |
-
|
| 1376 |
-
|
| 1377 |
-
|
| 1378 |
-
let offsetY = 0;
|
| 1379 |
-
let selectedComponent: Component | null = null;
|
| 1380 |
-
|
| 1381 |
-
function startDrag(e: MouseEvent, component: Component) {
|
| 1382 |
-
isDragging = true;
|
| 1383 |
-
selectedComponent = component;
|
| 1384 |
-
const rect = component.getEl().getBoundingClientRect();
|
| 1385 |
-
offsetX = e.clientX - rect.left;
|
| 1386 |
-
offsetY = e.clientY - rect.top;
|
| 1387 |
-
document.addEventListener('mousemove', drag);
|
| 1388 |
-
document.addEventListener('mouseup', stopDrag);
|
| 1389 |
-
}
|
| 1390 |
|
| 1391 |
-
|
| 1392 |
-
|
| 1393 |
-
|
| 1394 |
-
|
| 1395 |
-
selectedComponent
|
| 1396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1397 |
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
| 1403 |
-
|
| 1404 |
|
| 1405 |
-
|
| 1406 |
-
|
| 1407 |
-
|
| 1408 |
-
|
|
|
|
|
|
|
| 1409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1410 |
|
| 1411 |
|
| 1412 |
|
|
|
|
| 1413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1414 |
|
| 1415 |
<script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/rus/rus.js"></script>
|
| 1416 |
|
|
|
|
| 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-иконки
|
| 1406 |
+
editor.Panels.addButton('options', {
|
| 1407 |
+
id: 'toggle-rulers',
|
| 1408 |
+
label: `<svg width="16" height="16" viewBox="0 0 16 16">
|
| 1409 |
+
<path d="M0 8a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1H.5A.5.5 0 0 1 0 8z"/>
|
| 1410 |
+
<path d="M4 3h8a1 1 0 0 1 1 1v2.5h1V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v2.5h1V4a1 1 0 0 1 1-1zM3 9.5H2V12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9.5h-1V12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9.5z"/>
|
| 1411 |
+
</svg>`,
|
| 1412 |
+
command: 'ruler-visibility', // Команда для переключения видимости линеек
|
| 1413 |
+
attributes: { title: 'Toggle Rulers' }
|
| 1414 |
+
});
|
| 1415 |
+
</script>
|
| 1416 |
|
| 1417 |
<script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/rus/rus.js"></script>
|
| 1418 |
|