DmitrMakeev commited on
Commit
6c4df8a
·
verified ·
1 Parent(s): 6fe4214

Update js/rus/rus.js

Browse files
Files changed (1) hide show
  1. js/rus/rus.js +47 -0
js/rus/rus.js CHANGED
@@ -1017,7 +1017,54 @@ editor.CssComposer.addRules(`
1017
 
1018
 
1019
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1020
 
 
 
 
 
 
 
 
 
 
 
1021
 
1022
 
1023
 
 
1017
 
1018
 
1019
 
1020
+ editor.BlockManager.add('custom-widget', {
1021
+ label: `
1022
+ <div style="display: flex; flex-direction: column; align-items: center;">
1023
+ <!-- icon666.com - MILLIONS vector ICONS FREE --><svg id="Layer_1" enable-background="new 0 0 48 48" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" width="36" height="36"><path d="m38 8h-28c-2.2 0-4 1.8-4 4v24c0 2.2 1.8 4 4 4h8v-4h-8v-20h28v20h-8v4h8c2.2 0 4-1.8 4-4v-24c0-2.2-1.8-4-4-4zm-14 12-8 8h6v12h4v-12h6z" fill="#000000" style="fill: rgb(237, 237, 237);"></path></svg>
1024
+ <span style="margin-top: 8px;">Widget</span>
1025
+ </div>`,
1026
+ content: `
1027
+ <div id="custom-widget-container">
1028
+ <script id="custom-widget-script" src="https://school.riverpsy.com/pl/lite/widget/script?id=731982"></script>
1029
+ </div>
1030
+ `,
1031
+ attributes: {
1032
+ class: ''
1033
+ },
1034
+ // Добавляем поля ввода для URL и ID виджета
1035
+ components: {
1036
+ scriptUrl: {
1037
+ type: 'text',
1038
+ label: 'Script URL',
1039
+ value: 'https://school.riverpsy.com/pl/lite/widget/script'
1040
+ },
1041
+ widgetId: {
1042
+ type: 'text',
1043
+ label: 'Widget ID',
1044
+ value: '731982'
1045
+ }
1046
+ },
1047
+ // Функция для обновления скрипта при изменении полей ввода
1048
+ onUpdate: function(component) {
1049
+ const scriptUrl = component.get('scriptUrl');
1050
+ const widgetId = component.get('widgetId');
1051
+ const scriptElement = document.getElementById('custom-widget-script');
1052
+ if (scriptElement) {
1053
+ scriptElement.src = `${scriptUrl}?id=${widgetId}`;
1054
+ }
1055
+ }
1056
+ });
1057
 
1058
+ editor.CssComposer.addRules(`
1059
+ #custom-widget-container {
1060
+ width: 100%;
1061
+ height: auto;
1062
+ margin: 0 auto;
1063
+ position: relative;
1064
+ top: 0;
1065
+ display: block;
1066
+ }
1067
+ `);
1068
 
1069
 
1070