Skip to content

Commit aa067fd

Browse files
author
Leonid Vakulenko
committed
Site app v.3.2.1
1 parent e88989f commit aa067fd

File tree

91 files changed

+1196
-662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1196
-662
lines changed

wa-apps/site/css/site.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wa-apps/site/img/site.png

574 Bytes
Loading

wa-apps/site/img/site16.png

-2.61 KB
Loading

wa-apps/site/img/site24.png

-2.53 KB
Loading

wa-apps/site/img/site512.png

78.5 KB
Loading

wa-apps/site/img/site96.png

2.84 KB
Loading

wa-apps/site/js/compiled/site.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wa-apps/site/js/editor/BlockStorage.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class BlockStorage
5151
return this.data[block_id]?.data || null;
5252
}
5353

54+
getParents(block_id) {
55+
return this.data[block_id]?.parents || [];
56+
}
57+
5458
setFile(block_id, key, file) {
5559
if (!this.data[block_id]) {
5660
this.data[block_id] = {

wa-apps/site/js/editor/SiteEditor.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,23 @@ class SiteEditor {
538538
}
539539
}
540540

541+
/*checkElementsSize($block_wrapper) {
542+
const $is_block = $block_wrapper.hasClass('js-seq-wrapper') ? $block_wrapper : $block_wrapper.find('.js-seq-wrapper').eq(0);
543+
console.log('checkElementsSize', $is_block)
544+
if ($is_block.length) {
545+
const is_vertical_block = $is_block.hasClass('vseq-wrapper');
546+
const is_horiz_block = $is_block.hasClass('hseq-wrapper');
547+
const $elements_collection = $is_block.children().find('> .js-add-element').closest('.seq-child');
548+
$elements_collection.each(function(){
549+
if (is_vertical_block) {
550+
if ($(this).height() < 40 && !$(this).hasClass('small-height')) $(this).addClass('small-height');
551+
} else if(is_horiz_block) {
552+
if ($(this).width() < 40 && !$(this).hasClass('small-width')) $(this).addClass('small-width');
553+
}
554+
})
555+
}
556+
}*/
557+
541558
// @see copy SiteEditor.js
542559
sanitizeHTML(str) {
543560
if (!str) {

wa-apps/site/js/editor/form/FormConstructor.js

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var FormConstructor = ( function($) {
1313

1414
function FormConstructor(options) {
1515
var that = this;
16-
//const { ref } = Vue;
1716

1817
// CONST
1918
//that.block_id = options["block_id"];
@@ -23,7 +22,6 @@ var FormConstructor = ( function($) {
2322
that.storage_data = $.form_storage.data;
2423
that.media_prop = options["media_prop"];
2524

26-
//that.block_elements = options["form_config"].elements || null;
2725
that.states = {
2826
block_id: options["block_id"],
2927
form_config: options["form_config"],
@@ -48,10 +46,10 @@ var FormConstructor = ( function($) {
4846
that.vue_custom_components = that.components.custom_components;
4947
// CONST
5048

49+
//append :root styles from blockpage.wrapper.html
50+
appendIframeWrapperStyles(that.$iframe_wrapper);
5151
// INIT
5252
that.vue_model = that.initVue();
53-
54-
5553
}
5654

5755
FormConstructor.prototype.init = function(vue_model) {
@@ -94,8 +92,6 @@ var FormConstructor = ( function($) {
9492
FormConstructor.prototype.initVue = function() {
9593
var that = this;
9694

97-
const { reactive } = Vue;
98-
9995
const i18n = VueI18n.createI18n({
10096
locale: $.site.lang,
10197
legacy: false,
@@ -107,12 +103,11 @@ var FormConstructor = ( function($) {
107103
fallbackLocale: 'en',
108104
messages: $.form_storage.translate
109105
});
110-
// i18n.global.locale.value = $.site.lang;
106+
111107
if (typeof $.vue_app === "object" && typeof $.vue_app.unmount === "function") {
112108
$.vue_app.unmount();
113109
}
114110

115-
116111
$.vue_app = Vue.createApp({
117112

118113
data() {
@@ -249,7 +244,6 @@ var FormConstructor = ( function($) {
249244
let arr_options = that.storage_data[this.group_config.type];
250245

251246
let active_option = this.block_data?.block_props?.[form_type];
252-
const form_type_custom = 'custom';
253247

254248
const header_name = this.group_config.name;
255249

@@ -259,7 +253,7 @@ var FormConstructor = ( function($) {
259253
delimiters: ['{ { ', ' } }'],
260254
components: {
261255
'ButtonStyleDropdown': that.vue_custom_components['component-button-color-dropdown'],
262-
},
256+
},
263257
methods: {
264258
change: function(option) { //put classes to remove in temp_active_option
265259
let self = this;
@@ -1636,17 +1630,8 @@ var FormConstructor = ( function($) {
16361630
that.$iframe_wrapper[0].execCommand('foreColor', false, '#' + option);
16371631
$(self.getSelectionBoundaryElement(false)).removeAttr("class");
16381632
}
1639-
//console.log(that.$iframe_wrapper[0].getSelection().focusNode, self.getSelectionBoundaryElement(true), self.getSelectionBoundaryElement(false))
1640-
//if (that.$iframe_wrapper[0].getSelection().focusNode.parentNode.nodeName === "FONT") that.$iframe_wrapper[0].getSelection().focusNode.parentNode.classList = [];
1641-
//that.$iframe_wrapper[0].execCommand('removeformat');
1642-
16431633
self.block_data.html = $editable.html();
16441634

1645-
//self.active_option = { type: 'self_color', value: '#' + option, name: 'Self color'};
1646-
/*$.wa.editor._block_settings_drawer_promise.then(function(bs) {
1647-
bs.saveBlockData(self.block_data);
1648-
});
1649-
console.log('saveBlockData', self.block_data)*/
16501635
},
16511636
changePalette: function(option) {
16521637
let self = this;
@@ -1662,17 +1647,11 @@ var FormConstructor = ( function($) {
16621647
sel.addRange(rng)
16631648
//that.$iframe_wrapper[0].execCommand("SelectAll");
16641649
}
1665-
//that.$iframe_wrapper[0].execCommand('removeformat');
1666-
//that.$iframe_wrapper[0].execCommand('formatblock', false, 'font');
1667-
//console.log($(self.getSelectionBoundaryElement(true)).find('font'))
16681650
$(self.getSelectionBoundaryElement(true)).find('font').each(function(){$(this).removeAttr("class")});
1669-
that.$iframe_wrapper[0].execCommand('foreColor', false, '#000');
1670-
1671-
//$(self.getSelectionBoundaryElement(true)).attr('class', option.value);
1651+
that.$iframe_wrapper[0].execCommand('foreColor', false, '#010203');
16721652
that.$iframe_wrapper[0].getSelection().focusNode.parentNode.color = '';
16731653
that.$iframe_wrapper[0].getSelection().focusNode.parentNode.classList = [option.value];
16741654

1675-
16761655
self.block_data.html = $editable.html();
16771656
$.wa.editor._block_settings_drawer_promise.then(function(bs) {
16781657
bs.saveBlockData(self.block_data);
@@ -4125,8 +4104,43 @@ var FormConstructor = ( function($) {
41254104
}
41264105
return false; // Возвращаем false, если все iframe имеют закрывающие теги
41274106
}
4107+
41284108
};
41294109

4110+
function appendIframeWrapperStyles(iframe_document) {
4111+
const root_style = Array.from(iframe_document[0].styleSheets)
4112+
.filter(
4113+
sheet =>
4114+
sheet.href === null
4115+
)
4116+
.reduce(
4117+
(acc, sheet) =>
4118+
(acc = [
4119+
...acc,
4120+
...Array.from(sheet.cssRules).reduce(
4121+
(def, rule) =>
4122+
(def =
4123+
rule.selectorText === ":root"
4124+
? [
4125+
...def,
4126+
rule
4127+
]
4128+
: def),
4129+
[]
4130+
)
4131+
]),
4132+
[]
4133+
);
4134+
4135+
if (root_style.length) {
4136+
const style = document.createElement('style');
4137+
style.textContent = root_style[0]?.cssText || '';
4138+
document.head.appendChild(style);
4139+
}
4140+
4141+
//console.log(iframe_document[0].styleSheets)
4142+
}
4143+
41304144
return FormConstructor;
41314145

41324146
})(jQuery);

0 commit comments

Comments
 (0)