Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Fixed carousel bugs and added slide settings for mobile and tablet, added youtube background option for sections

givanzc810c533ddfc
diff --git a/public/js/vvvebjs/builder.js b/public/js/vvvebjs/builder.js
index 64ef842..32d87e4 100755
--- a/public/js/vvvebjs/builder.js
+++ b/public/js/vvvebjs/builder.js
@@ -2766,6 +2766,9 @@ Vvveb.Gui = {
breakpoint = null;
}
+ Vvveb.Builder.documentFrame.style.width = "";
+ Vvveb.Builder.documentFrame.style.height = "";
+
if (breakpoint) {
document.getElementById("canvas").classList.add("responsive");
document.getElementById("iframe-wrapper").style.width = Vvveb.StyleManager.breakpoints[breakpoint].replace(".98", "");
@@ -2979,7 +2982,7 @@ Vvveb.Gui = {
document.getElementById("toggle-tree-list").classList.remove("active");
}
},
-
+
treeListRight: function () {
let treeList = document.getElementById("tree-list");
let btnIcon = document.querySelector("[data-vvveb-action='treeListRight'] i");
@@ -2991,16 +2994,30 @@ Vvveb.Gui = {
treeList.style.width = "";
btnIcon.className = "icon-stop-outline";
} else {
- treeList.style.height = "100vh";
- treeList.style.height = "calc(100vh - 35px)";
+ treeList.style.height = "100%";
treeList.style.right = "0";
- treeList.style.top = "35px";
+ treeList.style.top = "0";
treeList.style.left = "auto";
treeList.style.width = "300px";
btnIcon.className = "icon-remove-outline";
}
},
-
+
+ treeListPanel: function () {
+ let treeList = document.getElementById("tree-list");
+ let canvas = document.getElementById("canvas");
+ let filemanager = document.getElementById("filemanager");
+ let btnIcon = document.querySelector("[data-vvveb-action='treeListPanel'] i");
+
+ if (treeList.parentNode == canvas) {
+ filemanager.after(treeList);
+ btnIcon.className = "icon-chevron-forward-outline";
+ } else {
+ canvas.append(treeList);
+ btnIcon.className = "icon-chevron-back-outline";
+ }
+ },
+
zoomChange: function () {
let wrapper = document.getElementById("iframe-wrapper");
let scale = "";
@@ -3360,10 +3377,13 @@ function getNodeTree (node, parent, allowedComponents, idToNode = {}) {
continue;
}
- let title = "";
- //if (matchChild.type === "elements/section") {
- title = child.id ? child.id : (child.title ? child.title : child.ariaLabel ?? "");
- //}
+ let title;
+ for (const attr of ["id", "title", "aria-label"]) {
+ title = child.getAttribute(attr);
+ if (title) {
+ break;
+ }
+ }
element = {
name: matchChild.name,
@@ -3374,7 +3394,7 @@ function getNodeTree (node, parent, allowedComponents, idToNode = {}) {
id: id + '-' + j,
children: []
};
-
+
element.children = [];
parent.push(element);
idToNode[id + '-' + j] = child;
@@ -3408,7 +3428,7 @@ function drawComponentsTree(tree) {
if (!id) {
id = prefix + '-' + j + '-' + i;
}
-
+
let title = (node.title ? friendlyName(node.title.substr(0, 21)) : "");
if (title) {
title = ` - <span class="text-secondary">${title}</span>`;
@@ -3997,7 +4017,22 @@ Vvveb.FileManager = {
let element = event.target.closest("li[data-page] label");
if (element) {
let page = element.parentNode.dataset.page;
- if (page) Vvveb.FileManager.loadPage(page, allowedComponents);
+ if (page) {
+ Vvveb.FileManager.loadPage(page, allowedComponents);
+
+ let data = Vvveb.FileManager.pages[page];
+
+ let pageUrl = window.location.pathname + "?module=editor/editor&template=" + data["file"] + "&url=" + data["url"] + "&name=" + data["title"];
+ if (data["post_id"]) {
+ pageUrl += "&post_id=" + data["post_id"];
+ }
+ if (data["product_id"]) {
+ pageUrl += "&product_id=" + data["product_id"];
+ }
+
+ window.history.pushState({name:page}, null, pageUrl);
+ }
+
e.preventDefault();
return false;
}
@@ -4262,7 +4297,8 @@ Vvveb.FileManager = {
},
loadPage: function(name, allowedComponents = false, disableCache = true, loadComponents = false) {
- let url = this.pages[name]['url'] ?? "";
+ let data = this.pages[name];
+ let url = data['url'] ?? "";
if (!url) {
return;
@@ -4449,13 +4485,9 @@ Vvveb.Revisions = {
displayToast("danger", "Error", "Error loading revisions!");
});
}
- }
- });
-
- document.querySelector(".revisions-dropdown").addEventListener("click", function (event) {
- if (confirm("Are you sure?")) {
+ } else {
let element = event.target.closest(".btn-revision-delete");
- if (element) {
+ if (element && confirm("Are you sure?")) {
let item = element.closest(".dropdown-item");
let file = element.dataset.file;
@@ -4964,3 +4996,12 @@ let fontList = [{
value: "'Brush Script MT', sans-serif",
text: 'Brush Script'
}];
+
+
+window.addEventListener("popstate", checkState);
+
+function checkState(e) {
+ if (e.state && e.state.name) {
+ Vvveb.FileManager.loadPage(e.state.name);
+ }
+}
diff --git a/public/js/vvvebjs/components-elements.js b/public/js/vvvebjs/components-elements.js
index 911e5ea..81b2304 100644
--- a/public/js/vvvebjs/components-elements.js
+++ b/public/js/vvvebjs/components-elements.js
@@ -195,145 +195,145 @@ Vvveb.Components.extend("_base","elements/svg-image", {
htmlAttr: "innerHTML",
inputtype: SvgInput
}, {
- name: "Icon",
- key: "icon",
- inline:true,
- inputtype: HtmlListSelectInput,
- onChange:function(element, value, input, component) {
- let newElement = generateElements(value)[0];
- let attributes = element.attributes;
-
- //keep old svg size and colors
- for (let i = 0; i < attributes.length; i++) {
- let attr = attributes[i];
- if (attr.name && attr.name != "viewBox") {
- newElement.setAttribute(attr.name, attr.value);
- }
+ name: "Icon",
+ key: "icon",
+ inline:true,
+ inputtype: HtmlListSelectInput,
+ onChange:function(element, value, input, component) {
+ let newElement = generateElements(value)[0];
+ let attributes = element.attributes;
+
+ //keep old svg size and colors
+ for (let i = 0; i < attributes.length; i++) {
+ let attr = attributes[i];
+ if (attr.name && attr.name != "viewBox") {
+ newElement.setAttribute(attr.name, attr.value);
}
-
- element.replaceWith(newElement);
- return newElement;
- },
- data: {
- url: Vvveb.baseUrl + "../../resources/svg/icons/{value}/index.html",
- clickElement:"li",
- insertElement:"svg",
- elements: 'Loading ...',
- options: [{
- value: "eva-icons",
- text: "Eva icons"
- },{
- value: "ionicons",
- text: "IonIcons"
- },{
- value: "linea",
- text: "Linea"
- },{
- value: "remix-icon",
- text: "RemixIcon"
- },{
- value: "unicons",
- text: "Unicons"
- },{
- value: "clarity-icons",
- text: "Clarity icons"
- },{
- value: "jam-icons",
- text: "Jam icons"
- },{
- value: "ant-design-icons",
- text: "Ant design icons"
- },{
- value: "themify",
- text: "Themify"
- },{
- value: "css.gg",
- text: "Css.gg"
- },{
- value: "olicons",
- text: "Olicons"
- },{
- value: "open-iconic",
- text: "Open iconic"
- },{
- value: "boxicons",
- text: "Box icons"
- },{
- value: "elegant-font",
- text: "Elegant font"
- },{
- value: "dripicons",
- text: "Dripicons"
- },{
- value: "feather",
- text: "Feather"
- },{
- value: "coreui-icons",
- text: "Coreui icons"
- },{
- value: "heroicons",
- text: "Heroicons"
- },{
- value: "iconoir",
- text: "Iconoir"
- },{
- value: "iconsax",
- text: "Iconsax"
- },{
- value: "ikonate",
- text: "Ikonate"
- },{
- value: "tabler-icons",
- text: "Tabler icons"
- },{
- value: "octicons",
- text: "Octicons"
- },{
- value: "system-uicons",
- text: "System-uicons"
- },{
- value: "font-awesome",
- text: "FontAwesome"
- },{
- value: "pe-icon-7-stroke",
- text: "Pixeden icon 7 stroke"
- },{
- value: "77_essential_icons",
- text: "77 essential icons"
- },{
- value: "150-outlined-icons",
- text: "150 outlined icons"
- },{
- value: "material-design",
- text: "Material Design"
- }]
- },
- },{
- name: "Width",
- key: "width",
- htmlAttr: "width",
- inputtype: RangeInput,
- data:{
- max: 640,
- min:6,
- step:1
}
+
+ element.replaceWith(newElement);
+ return newElement;
+ },
+ data: {
+ url: Vvveb.baseUrl + "../../resources/svg/icons/{value}/index.html",
+ clickElement:"li",
+ insertElement:"svg",
+ elements: 'Loading ...',
+ options: [{
+ value: "eva-icons",
+ text: "Eva icons"
+ },{
+ value: "ionicons",
+ text: "IonIcons"
+ },{
+ value: "linea",
+ text: "Linea"
+ },{
+ value: "remix-icon",
+ text: "RemixIcon"
+ },{
+ value: "unicons",
+ text: "Unicons"
+ },{
+ value: "clarity-icons",
+ text: "Clarity icons"
+ },{
+ value: "jam-icons",
+ text: "Jam icons"
+ },{
+ value: "ant-design-icons",
+ text: "Ant design icons"
+ },{
+ value: "themify",
+ text: "Themify"
+ },{
+ value: "css.gg",
+ text: "Css.gg"
+ },{
+ value: "olicons",
+ text: "Olicons"
+ },{
+ value: "open-iconic",
+ text: "Open iconic"
+ },{
+ value: "boxicons",
+ text: "Box icons"
+ },{
+ value: "elegant-font",
+ text: "Elegant font"
+ },{
+ value: "dripicons",
+ text: "Dripicons"
+ },{
+ value: "feather",
+ text: "Feather"
+ },{
+ value: "coreui-icons",
+ text: "Coreui icons"
+ },{
+ value: "heroicons",
+ text: "Heroicons"
+ },{
+ value: "iconoir",
+ text: "Iconoir"
+ },{
+ value: "iconsax",
+ text: "Iconsax"
+ },{
+ value: "ikonate",
+ text: "Ikonate"
+ },{
+ value: "tabler-icons",
+ text: "Tabler icons"
+ },{
+ value: "octicons",
+ text: "Octicons"
+ },{
+ value: "system-uicons",
+ text: "System-uicons"
+ },{
+ value: "font-awesome",
+ text: "FontAwesome"
+ },{
+ value: "pe-icon-7-stroke",
+ text: "Pixeden icon 7 stroke"
+ },{
+ value: "77_essential_icons",
+ text: "77 essential icons"
+ },{
+ value: "150-outlined-icons",
+ text: "150 outlined icons"
+ },{
+ value: "material-design",
+ text: "Material Design"
+ }]
+ },
},{
- name: "Height",
- key: "height",
- htmlAttr: "height",
- inputtype: RangeInput,
- data:{
- max: 640,
- min:6,
- step:1
- }
+ name: "Width",
+ key: "width",
+ htmlAttr: "width",
+ inputtype: RangeInput,
+ data:{
+ max: 640,
+ min:6,
+ step:1
+ }
},{
- name: "Stroke width",
- key: "stroke-width",
- htmlAttr: "stroke-width",
- inputtype: RangeInput,
- data:{
+ name: "Height",
+ key: "height",
+ htmlAttr: "height",
+ inputtype: RangeInput,
+ data:{
+ max: 640,
+ min:6,
+ step:1
+ }
+ },{
+ name: "Stroke width",
+ key: "stroke-width",
+ htmlAttr: "stroke-width",
+ inputtype: RangeInput,
+ data:{
max: 512,
min:1,
step:1
@@ -1210,7 +1210,10 @@ function carouselAfterDrop(node) {
};
for (i in el.dataset) {
let param = el.dataset[i];
- if (param[0] = '{') {
+ if (param == 'true') param = true;
+ if (param == 'false') param = false;
+
+ if (param[0] == '{') {
param = JSON.parse(param);
}
params[i] = param;
@@ -1223,7 +1226,7 @@ function carouselAfterDrop(node) {
if (document.readyState !== 'loading') {
initSwiper();
} else {
- document.addEventListener('DOMContentLoaded', initSwiper);
+ document.addEventListener('DOMContentLoaded', e => initSwiper());
}`;
body.appendChild(link);
@@ -1262,6 +1265,21 @@ Vvveb.Components.add("elements/carousel", {
<!-- <div class="swiper-scrollbar"></div> -->
</div>
`,
+
+ beforeInit(node) {
+ if (node.dataset.breakpoints) {
+ breakpoints = JSON.parse(node.dataset.breakpoints);
+
+ for (let prop of this.properties) {
+ if (prop.breakpoint && breakpoints[prop.breakpoint] && breakpoints[prop.breakpoint][prop.breakname]) {
+ prop.defaultValue = breakpoints[prop.breakpoint][prop.breakname];
+ }
+ }
+ }
+
+ return node;
+ },
+
afterDrop: carouselAfterDrop,
onChange: function (node, property, value) {
@@ -1270,9 +1288,46 @@ Vvveb.Components.add("elements/carousel", {
value = {"waitForTransition":true,"enabled":value,"delay":element.dataset.delay};
}
+ if (value == 'true') value= true;
+ if (value == 'false') value = false;
+
+ /*
element.swiper.params[property.key] = value;
element.swiper.originalParams[property.key] = value;
- element.swiper.update();
+
+ if (property.key == 'effect') {
+ //Vvveb.Builder.iframe.contentWindow.cleanSwiper(element);
+ element.swiper.destroy();
+ Vvveb.Builder.iframe.contentWindow.initSwiper(true);
+ } else {
+ element.swiper.update();
+ }
+ */
+
+ if (property.group == "breakpoints") {
+ let breakpoints;
+ if (node.dataset.breakpoints) {
+ breakpoints = JSON.parse(node.dataset.breakpoints);
+ } else {
+ breakpoints = {};
+ }
+
+ property.breakpoint = parseInt(property.breakpoint);
+
+ if (!breakpoints[property.breakpoint]) {
+ breakpoints[property.breakpoint] = {};
+ }
+
+ breakpoints[property.breakpoint][property.breakname] = parseInt(value);
+
+ node.dataset.breakpoints = JSON.stringify(breakpoints);
+
+
+ }
+
+ element.swiper.destroy();
+ Vvveb.Builder.iframe.contentWindow.initSwiper(true);
+
return node;
},
@@ -1345,85 +1400,112 @@ Vvveb.Components.add("elements/carousel", {
htmlAttr:"data-delay",
data: {step:100},
},{
- key: "carousel_options",
+ name: "Effect",
+ key: "effect",
+ inputtype: SelectInput,
+ htmlAttr:"data-effect",
+
+ data:{
+ options: [{
+ value: "",
+ text: "None"
+ }, {
+ value: "fade",
+ text: "Fade"
+ }, {
+ value: "flip",
+ text: "Flip"
+ }, {
+ value: "cube",
+ text: "Cube"
+ }, {
+ value: "cards",
+ text: "Cards"
+ }, {
+ value: "creative",
+ text: "Creative"
+ }]
+ }
+ },{
+ key: "carousel_options",
inputtype: SectionInput,
name:false,
data: {header:"Options"},
},{
- name: "Simulate touch",
+ name: "Simulate touch",
key: "simulateTouch",
- htmlAttr:"data-simulate-touch",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-simulate-touch",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
},{
- name: "Autoplay",
+ name: "Autoplay",
key: "autoplay",
- htmlAttr:"data-autoplay",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-autoplay",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{
- name: "Auto height",
+ },{
+ name: "Auto height",
key: "autoHeight",
- htmlAttr:"data-auto-height",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-auto-height",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{
- name: "Centered slides",
+ },{
+ name: "Centered slides",
key: "centeredSlides",
- htmlAttr:"data-centered-slides",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-centered-slides",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{ name: "Center insufficient",
+ },{ name: "Center insufficient",
key: "centerInsufficientSlides",
- htmlAttr:"data-center-insufficient-slides",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-center-insufficient-slides",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{ name: "Loop",
+ },{ name: "Loop",
key: "loop",
- htmlAttr:"data-loop",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-loop",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{ name: "Mouse wheel",
+ },{ name: "Mouse wheel",
key: "mousewheel",
- htmlAttr:"data-mousewheel",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-mousewheel",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{
+ },{
name: "Pagination",
key: "pagination",
- htmlAttr:"data-pagination",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-pagination",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{ name: "Rewind",
+ },{ name: "Rewind",
key: "rewind",
- htmlAttr:"data-rewind",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-rewind",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },{ name: "Scrollbar",
+ },{ name: "Scrollbar",
key: "scrollbar",
- htmlAttr:"data-scrollbar",
- inputtype: CheckboxInput,
- inline:true,
+ htmlAttr:"data-scrollbar",
+ inputtype: CheckboxInput,
+ inline:true,
col:6
- },/*{
+ },{
name: "direction",
key: "direction",
- htmlAttr:"data-direction",
- section: style_section,
+ htmlAttr:"data-direction",
+ section: style_section,
col:6,
inline:false,
inputtype: RadioButtonInput,
data: {
- extraclass:"btn-group-sm btn-group-fullwidth",
+ extraclass:"btn-group-sm btn-group-fullwidth",
options: [{
value: "horizontal",
icon:"la la-arrow-down",
@@ -1434,9 +1516,84 @@ Vvveb.Components.add("elements/carousel", {
title: "Vertical",
icon:"la la-arrow-right",
checked:false,
- }],
- }
- }*/]
+ }],
+ }
+ },{
+ key: "breakpoint_options",
+ inputtype: SectionInput,
+ name:false,
+ data: {header:"Breakpoints"},
+ },{
+ name: "Slides mobile",
+ group: "breakpoints",
+ key: "sm.view",
+ breakpoint: "320",
+ breakname: "slidesPerView",
+ inputtype: NumberInput,
+ },{
+ name: "Space mobile",
+ group: "breakpoints",
+ key: "sm.space",
+ breakpoint: "320",
+ breakname: "spaceBetween",
+ inputtype: NumberInput,
+ },{
+ name: "Slides tablet",
+ group: "breakpoints",
+ key: "md.view",
+ breakpoint: "480",
+ breakname: "slidesPerView",
+ inputtype: NumberInput,
+ },{
+ name: "Space tablet",
+ group: "breakpoints",
+ key: "md.space",
+ breakpoint: "480",
+ breakname: "spaceBetween",
+ inputtype: NumberInput,
+ },{
+ name: "Slides landscape",
+ group: "breakpoints",
+ key: "lg.view",
+ breakpoint: "768",
+ breakname: "slidesPerView",
+ inputtype: NumberInput,
+ },{
+ name: "Space landscape",
+ group: "breakpoints",
+ key: "lg.space",
+ breakpoint: "768",
+ breakname: "spaceBetween",
+ inputtype: NumberInput,
+ },{
+ name: "Slides laptop",
+ group: "breakpoints",
+ key: "xl.view",
+ breakpoint: "1024",
+ breakname: "slidesPerView",
+ inputtype: NumberInput,
+ },{
+ name: "Space laptop",
+ group: "breakpoints",
+ key: "xl.space",
+ breakpoint: "1024",
+ breakname: "spaceBetween",
+ inputtype: NumberInput,
+ },{
+ name: "Slides desktop",
+ group: "breakpoints",
+ key: "xxl.view",
+ breakpoint: "1200",
+ breakname: "slidesPerView",
+ inputtype: NumberInput,
+ },{
+ name: "Space desktop",
+ group: "breakpoints",
+ key: "xxl.space",
+ breakpoint: "1200",
+ breakname: "spaceBetween",
+ inputtype: NumberInput,
+ }]
});
//Slider
diff --git a/public/js/vvvebjs/components-server.js b/public/js/vvvebjs/components-server.js
index b7dd818..da14400 100755
--- a/public/js/vvvebjs/components-server.js
+++ b/public/js/vvvebjs/components-server.js
@@ -79,14 +79,14 @@ Vvveb.Components.add("components/products", {
attributes: ["data-component-products"],
image: "icons/products.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
init: function (node) {
- $('.mb-3[data-group]').hide();
+ $('.mb-2[data-group]').hide();
if (node.dataset.type != undefined) {
- $('.mb-3[data-group="'+ node.dataset.type + '"]').show();
+ $('.mb-2[data-group="'+ node.dataset.type + '"]').show();
} else {
- $('.mb-3[data-group]').show();
+ $('.mb-2[data-group]').show();
}
},
properties: [{
@@ -112,8 +112,8 @@ Vvveb.Components.add("components/products", {
},
onChange : function(element, value, input) {
- $('.mb-3[data-group]').hide();
- $('.mb-3[data-group="'+ input.value + '"]').show();
+ $('.mb-2[data-group]').hide();
+ $('.mb-2[data-group="'+ input.value + '"]').show();
return element;
},
@@ -221,7 +221,7 @@ Vvveb.Components.add("components/manufacturers", {
name: "Manufacturers",
classes: ["component_manufacturers"],
image: "icons/categories.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
nolabel:false,
inputtype: TextInput,
@@ -242,7 +242,7 @@ Vvveb.Components.add("components/categories", {
name: "Categories",
classes: ["component_categories"],
image: "icons/categories.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "Name",
key: "name",
@@ -254,7 +254,7 @@ Vvveb.Components.add("components/search", {
name: "Search",
classes: ["component_search"],
image: "icons/search.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -276,7 +276,7 @@ Vvveb.Components.add("components/user", {
name: "User",
classes: ["component_user"],
image: "icons/user.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -298,7 +298,7 @@ Vvveb.Components.add("components/product_gallery", {
name: "Product gallery",
classes: ["component_product_gallery"],
image: "icons/product_gallery.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -320,7 +320,7 @@ Vvveb.Components.add("components/cart", {
name: "Cart",
classes: ["component_cart"],
image: "icons/cart.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -342,7 +342,7 @@ Vvveb.Components.add("components/checkout", {
name: "Checkout",
classes: ["component_checkout"],
image: "icons/checkout.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -364,7 +364,7 @@ Vvveb.Components.add("components/filters", {
name: "Filters",
classes: ["component_filters"],
image: "icons/filters.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -386,7 +386,7 @@ Vvveb.Components.add("components/product", {
name: "Product",
classes: ["component_product"],
image: "icons/product.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
properties: [{
name: "asdasdad",
key: "src",
@@ -414,7 +414,7 @@ Vvveb.Components.add("components/slider", {
attributes: ["data-component-slider"],
image: "icons/slider.svg",
- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',
+ html: '<div class="mb-2"><label>Your response:</label><textarea class="form-control"></textarea></div>',
beforeInit: function (node) {
properties = [];
@@ -503,8 +503,8 @@ Vvveb.Components.add("components/slider", {
},
onChange : function(element, value, input) {
- $('.mb-3[data-group]').hide();
- $('.mb-3[data-group="'+ input.value + '"]').show();
+ $('.mb-2[data-group]').hide();
+ $('.mb-2[data-group="'+ input.value + '"]').show();
return element;
},
diff --git a/public/js/vvvebjs/plugin-media.js b/public/js/vvvebjs/plugin-media.js
old mode 100755
new mode 100644
index f331da2..a14c663
--- a/public/js/vvvebjs/plugin-media.js
+++ b/public/js/vvvebjs/plugin-media.js
@@ -90,7 +90,7 @@ VideoInput = { ...ImageInput, ...{
tag:"video",
events: [
- ["change", "onChange", "input[type=text]"],
+ ["change", "onImageChange", "input[type=text]"],
["click", "onClick", "button"],
["click", "onClick", "video"],
],
diff --git a/public/js/vvvebjs/section.js b/public/js/vvvebjs/section.js
old mode 100755
new mode 100644
index d6aec13..898c400
--- a/public/js/vvvebjs/section.js
+++ b/public/js/vvvebjs/section.js
@@ -20,6 +20,7 @@
*/
let bgVideoTemplate = '<video playsinline loop muted autoplay src="../../media/demo/sample.webm" poster="../../media/demo/sample.webp"><video>';
+let bgYoutubeTemplate = '<div class="iframe-container"><iframe src="https://www.youtube.com/embed/XJpVLAYgUzY?autoplay=1&loop=1&playsinline=1&controls=0&mute=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe></div>';
let bgImageTemplate = '<img src="../../media/demo/sample.webp">';
let defaultSeparatorSvg = '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 41" width="100%" height="300" fill="var(--bs-body-bg)" preserveAspectRatio="none"><defs><style>.cls-1{fill:inherit}</style></defs><title>rough-edges-bottom</title><path class="cls-1" d="M0,185l125-26,33,17,58-12s54,19,55,19,50-11,50-11l56,6,60-8,63,15v15H0Z" transform="translate(0 -159)"/></svg>';
@@ -113,7 +114,12 @@ let SectionBackground = [{
value: "bg-video",
icon:"la la-video",
text: "Video",
- title: "Video",/*
+ title: "Video",
+ },{
+ value: "bg-yt",
+ icon:"lab la-youtube",
+ text: "Youtube",
+ title: "Youtube",/*
},{
value: "slideshow",
icon:"la la-arrows-alt-h",
@@ -122,7 +128,7 @@ let SectionBackground = [{
}],
},
hideGroups : function() {
- document.querySelectorAll('.mb-2[data-group="bg-image"],.mb-2[data-group="bg-video"]').forEach(e => e.classList.add("d-none"));
+ document.querySelectorAll('.mb-2[data-group="bg-image"],.mb-2[data-group="bg-video"],.mb-2[data-group="bg-yt"]').forEach(e => e.classList.add("d-none"));
},
onChange : function(node, value, input) {
@@ -139,6 +145,7 @@ let SectionBackground = [{
let img = node.querySelector(":scope > .background-container > img");
let video = node.querySelector(":scope > .background-container > video");
+ let yt = node.querySelector(":scope > .background-container > .iframe-container ");
container.querySelectorAll(":scope > *").forEach((el, i) => {
el.classList.add("d-none");
@@ -163,6 +170,15 @@ let SectionBackground = [{
node.click();
}
break;
+ case "bg-yt":
+ if (yt) {
+ yt.classList.remove("d-none");
+ } else {
+ container.append(generateElements(bgYoutubeTemplate)[0]);
+ //reselect element to load video
+ node.click();
+ }
+ break;
}
@@ -172,15 +188,20 @@ let SectionBackground = [{
let selected = "none";
let img = node.querySelector(":scope > .background-container > img");
let video = node.querySelector(":scope > .background-container > video");
+ let yt = node.querySelector(":scope > .background-container > .iframe-container ");
if (img && (img.offsetParent || img.offsetHeight || !img.classList.contains("d-none"))) {
selected = "bg-image";
}
- if (video && (img.offsetParent || video.offsetHeight || !video.classList.contains("d-none"))) {
+ if (video && (video.offsetParent || video.offsetHeight || !video.classList.contains("d-none"))) {
selected = "bg-video";
}
+ if (yt && (yt.offsetParent || yt.offsetHeight || !yt.classList.contains("d-none"))) {
+ selected = "bg-yt";
+ }
+
this.hideGroups();
return selected;
},
@@ -203,7 +224,7 @@ let SectionBackground = [{
group:"bg-video",
inline:true,
inputtype: VideoInput
- },{
+ },{
name: "Poster",
key: "poster",
sort: section_sort++,
@@ -212,7 +233,21 @@ let SectionBackground = [{
group:"bg-video",
inline:true,
inputtype: ImageInput
- }, {
+ },{
+ name: "Video",
+ key: "src",
+ sort: section_sort++,
+ htmlAttr: "src",
+ child:":scope > .background-container > .iframe-container > iframe",
+ group:"bg-yt",
+ inline:true,
+ inputtype: TextInput,
+ onChange: function(node, value) {
+ return value.replace("watch?v=", "embed/") + "?autoplay=1&loop=1&playsinline=1&controls=0&mute=1";
+
+ return node;
+ },
+ },{
name: "Parallax",
key: "parallax",
sort: section_sort++,
@@ -621,6 +656,7 @@ function componentsInit(node) {
let img = node.querySelector(":scope > .background-container img");
let video = node.querySelector(":scope > .background-container video");
+ let yt = node.querySelector(":scope > .background-container .iframe-container");
let overlay = node.querySelector(":scope > .overlay");
let separatorTop = node.querySelector(":scope > .separator.top");
let separatorBottom = node.querySelector(":scope > .separator.bottom");
@@ -630,9 +666,13 @@ function componentsInit(node) {
bg = "bg-image";
}
- if (video && (img.offsetParent || video.offsetHeight || !video.classList.contains("d-none"))) {
+ if (video && (video.offsetParent || video.offsetHeight || !video.classList.contains("d-none"))) {
bg = "bg-video";
}
+
+ if (yt && (yt.offsetParent || yt.offsetHeight || !yt.classList.contains("d-none"))) {
+ bg = "bg-yt";
+ }
let showSection = function (section) {
document.querySelectorAll('.mb-2[data-group="' + section + '"]').forEach(e => e.classList.remove("d-none"));