Update js/rus/rus.js
Browse files- js/rus/rus.js +0 -59
js/rus/rus.js
CHANGED
|
@@ -1017,65 +1017,6 @@ editor.CssComposer.addRules(`
|
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
| 1020 |
-
editor.BlockManager.add('custom-widget', {
|
| 1021 |
-
label: `
|
| 1022 |
-
<div style="display: flex; flex-direction: column; align-items: center;">
|
| 1023 |
-
<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 |
-
// Add traits for input fields to modify Script URL and Widget ID
|
| 1035 |
-
traits: [
|
| 1036 |
-
{
|
| 1037 |
-
type: 'text',
|
| 1038 |
-
label: 'Script URL',
|
| 1039 |
-
name: 'scriptUrl',
|
| 1040 |
-
value: 'https://school.riverpsy.com/pl/lite/widget/script',
|
| 1041 |
-
},
|
| 1042 |
-
{
|
| 1043 |
-
type: 'text',
|
| 1044 |
-
label: 'Widget ID',
|
| 1045 |
-
name: 'widgetId',
|
| 1046 |
-
value: '731982',
|
| 1047 |
-
},
|
| 1048 |
-
],
|
| 1049 |
-
// Update script src when the traits change
|
| 1050 |
-
script: function() {
|
| 1051 |
-
const updateScript = () => {
|
| 1052 |
-
const scriptUrl = this.getAttribute('scriptUrl') || 'https://school.riverpsy.com/pl/lite/widget/script';
|
| 1053 |
-
const widgetId = this.getAttribute('widgetId') || '731982';
|
| 1054 |
-
const scriptElement = document.getElementById('custom-widget-script');
|
| 1055 |
-
if (scriptElement) {
|
| 1056 |
-
scriptElement.src = `${scriptUrl}?id=${widgetId}`;
|
| 1057 |
-
}
|
| 1058 |
-
};
|
| 1059 |
-
|
| 1060 |
-
updateScript();
|
| 1061 |
-
|
| 1062 |
-
// Watch for trait changes and update the script dynamically
|
| 1063 |
-
this.addEventListener('change:scriptUrl', updateScript);
|
| 1064 |
-
this.addEventListener('change:widgetId', updateScript);
|
| 1065 |
-
},
|
| 1066 |
-
});
|
| 1067 |
-
|
| 1068 |
-
editor.CssComposer.addRules(`
|
| 1069 |
-
#custom-widget-container {
|
| 1070 |
-
width: 100%;
|
| 1071 |
-
height: auto;
|
| 1072 |
-
margin: 0 auto;
|
| 1073 |
-
position: relative;
|
| 1074 |
-
top: 0;
|
| 1075 |
-
display: block;
|
| 1076 |
-
}
|
| 1077 |
-
`);
|
| 1078 |
-
|
| 1079 |
|
| 1080 |
|
| 1081 |
|
|
|
|
| 1017 |
|
| 1018 |
|
| 1019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1020 |
|
| 1021 |
|
| 1022 |
|