Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
VvvebJs update, jQuery code rewrite to vanilla js
givanzf0083e2377b9
diff --git a/public/css/vvvebjs-editor-helpers.css b/public/css/vvvebjs-editor-helpers.cssindex 83e9b40..712c491 100755--- a/public/css/vvvebjs-editor-helpers.css+++ b/public/css/vvvebjs-editor-helpers.css@@ -112,10 +112,10 @@ section:hover .container div > .row > .col, section:hover .container > .row > [csection:hover .container > .row > .col, section:hover .container-fluid div > .row > [class*="col-"],section:hover .container-fluid div > .row > .col, section:hover .container-fluid > .row > [class*="col-"],section:hover .container-fluid > .row > .col {- outline: 1px dashed lime;+ outline: 1px dashed rgba(var(--bs-success-rgb), 0.35);outline-offset: -2px; }.row:hover > [class*="col-"],.row:hover > .col {- outline: 1px dashed lime;+ outline: 1px dashed rgba(var(--bs-success-rgb), 0.35);outline-offset: -2px; }diff --git a/public/js/vvvebjs/builder.js b/public/js/vvvebjs/builder.jsindex 1ff25e9..9895800 100755--- a/public/js/vvvebjs/builder.js+++ b/public/js/vvvebjs/builder.js@@ -19,26 +19,26 @@*/-// Simple JavaScript Templating+// Simple JavaScript Templating and buildParams// John Resig - https://johnresig.com/ - MIT Licensed(function(){- var cache = {};- var startTag = "{%";- var endTag = "%}";- var re1 = new RegExp(`((^|${endTag})[^\t]*)'`,"g");- var re2 = new RegExp(`\t=(.*?)${endTag}`,"g");+ let cache = {};+ let startTag = "{%";+ let endTag = "%}";+ let re1 = new RegExp(`((^|${endTag})[^\t]*)'`,"g");+ let re2 = new RegExp(`\t=(.*?)${endTag}`,"g");this.tmpl = function tmpl(str, data){// Figure out if we're getting a template, or if we need to// load the template - and be sure to cache the result.- var fn = /^[-a-zA-Z0-9]+$/.test(str) ?+ let fn = /^[-a-zA-Z0-9]+$/.test(str) ?cache[str] = cache[str] ||tmpl(document.getElementById(str).innerHTML) :// Generate a reusable function that will serve as a template// generator (and which will be cached).new Function("obj",- "var p=[],print=function(){p.push.apply(p,arguments);};" ++ "let p=[],print=function(){p.push.apply(p,arguments);};" +// Introduce the data as local variables using with(){}"with(obj){p.push('" +@@ -58,8 +58,93 @@};})();-var delay = (function(){- var timer = 0;++var rbracket = /\[\]$/;++function buildParams( prefix, obj, add ) {+ var name;++ if ( Array.isArray( obj ) ) {++ // Serialize array item.+ for(var key in obj) {+ let v = obj[key];+ if ( rbracket.test( prefix ) ) {++ // Treat each array item as a scalar.+ add( prefix, v );++ } else {++ // Item is non-scalar (array or object), encode its numeric index.+ buildParams(+ prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",+ v,+ add+ );+ }+ }++ } else if ( typeof obj === "object" ) {++ // Serialize object item.+ for ( name in obj ) {+ buildParams( prefix + "[" + name + "]", obj[ name ], add );+ }++ } else {++ // Serialize scalar item.+ add( prefix, obj );+ }+}++// Serialize an array of form elements or a set of+// key/values into a query string+function nestedFormData( a ) {+ var prefix,+ s = [],+ add = function( key, valueOrFunction ) {++ // If value is a function, invoke it and use its return value+ var value = typeof valueOrFunction === "function" ?+ valueOrFunction() :+ valueOrFunction;++ s[ s.length ] = encodeURIComponent( key ) + "=" ++ encodeURIComponent( value == null ? "" : value );+ };++ if ( a == null ) {+ return "";+ }++ // If an array was passed in, assume that it is an array of form elements.+ if ( Array.isArray( a ) || ( Object.is( a ) ) ) {++ // Serialize the form elements+ for(var key in object) {+ let v = object[key];+ //jQuery.each( a, function() {+ add( key, v );+ };++ } else {++ // If traditional, encode the "old" way (the way 1.3.2 or older+ // did it), otherwise encode params recursively.+ for ( prefix in a ) {+ buildParams( prefix, a[ prefix ], add );+ }+ }++ // Return the resulting serialization+ return s.join( "&" );+};+++let delay = (function(){+ let timer = 0;return function(callback, ms){clearTimeout (timer);timer = setTimeout(callback, ms);@@ -72,6 +157,21 @@ function isElement(obj){(typeof obj.ownerDocument ==="object")/* && obj.tagName != "BODY"*/;}+function generateElements(html) {+ const template = document.createElement('template');+ template.innerHTML = html.trim();+ return template.content.children;+}++function offset(el) {+ box = el.getBoundingClientRect();+ docElem = document.documentElement;+ return {+ top: box.top + window.pageYOffset - docElem.clientTop,+ left: box.left + window.pageXOffset - docElem.clientLeft+ };+}+if (Vvveb === undefined) var Vvveb = {};Vvveb.defaultComponent = "_base";@@ -133,33 +233,24 @@ Vvveb.Components = {this._components[type] = data;- if (data.nodes)- {- for (var i in data.nodes)- {+ if (data.nodes) {+ for (let i in data.nodes) {this._nodesLookup[ data.nodes[i] ] = data;}}- if (data.attributes)- {- if (data.attributes.constructor === Array)- {- for (var i in data.attributes)- {+ if (data.attributes) {+ if (data.attributes.constructor === Array) {+ for (let i in data.attributes) {this._attributesLookup[ data.attributes[i] ] = data;}- } else- {- for (var i in data.attributes)- {- if (typeof this._attributesLookup[i] === 'undefined')- {+ } else {+ for (let i in data.attributes) {+ if (typeof this._attributesLookup[i] === 'undefined') {this._attributesLookup[i] = {};}- if (typeof this._attributesLookup[i][ data.attributes[i] ] === 'undefined')- {+ if (typeof this._attributesLookup[i][ data.attributes[i] ] === 'undefined') {this._attributesLookup[i][ data.attributes[i] ] = {};}@@ -168,18 +259,14 @@ Vvveb.Components = {}}- if (data.classes)- {- for (var i in data.classes)- {+ if (data.classes) {+ for (let i in data.classes) {this._classesLookup[ data.classes[i] ] = data;}}- if (data.classesRegex)- {- for (var i in data.classesRegex)- {+ if (data.classesRegex) {+ for (let i in data.classesRegex) {this._classesRegexLookup[ data.classesRegex[i] ] = data;}}@@ -187,17 +274,23 @@ Vvveb.Components = {extend: function(inheritType, type, data) {- var newData = data;+ let newData = data;- if (inheritData = this._components[inheritType])- {- newData = $.extend(true,{}, inheritData, data);- newData.properties = $.merge( $.merge([], inheritData.properties?inheritData.properties:[]), data.properties?data.properties:[]);+ if (inheritData = this._components[inheritType]) {+ newData = {...inheritData, ...data};+ newData.properties = (data.properties ? data.properties : []).concat(inheritData.properties ? inheritData.properties : []);}-++ //remove duplicates+ /*+ newData.properties = newData.properties.filter((value, index, self) =>+ index === self.findIndex((t) => (+ t.key === value.key+ ))+ );*/+//sort by order- newData.properties.sort(function (a,b)- {+ newData.properties.sort(function (a,b) {if (typeof a.sort === "undefined") a.sort = 0;if (typeof b.sort === "undefined") b.sort = 0;@@ -207,90 +300,55 @@ Vvveb.Components = {return 1;return 0;});-/*- var output = array.reduce(function(o, cur) {-- // Get the index of the key-value pair.- var occurs = o.reduce(function(n, item, i) {- return (item.key === cur.key) ? i : n;- }, -1);-- // If the name is found,- if (occurs >= 0) {-- // append the current value to its list of values.- o[occurs].value = o[occurs].value.concat(cur.value);-- // Otherwise,- } else {-- // add the current item to o (but make sure the value is an array).- var obj = {name: cur.key, value: [cur.value]};- o = o.concat([obj]);- }-- return o;- }, newData.properties);-*/this.add(type, newData);},matchNode: function(node) {- var component = {};+ let component = {};if (!node || !node.tagName) return false;- if (node.attributes && node.attributes.length)- {+ if (node.attributes && node.attributes.length) {//search for attributes- for (var i in node.attributes)- {- if (node.attributes[i])- {- attr = node.attributes[i].name;- value = node.attributes[i].value;+ for (let i in node.attributes) {+ if (node.attributes[i]) {+ attr = node.attributes[i].name;+ value = node.attributes[i].value;- if (attr in this._attributesLookup)- {- component = this._attributesLookup[ attr ];-- //currently we check that is not a component by looking at name attribute- //if we have a collection of objects it means that attribute value must be checked- if (typeof component["name"] === "undefined")- {- if (value in component)- {- return component[value];+ if (attr in this._attributesLookup) {+ component = this._attributesLookup[ attr ];++ //currently we check that is not a component by looking at name attribute+ //if we have a collection of objects it means that attribute value must be checked+ if (typeof component["name"] === "undefined") {+ if (value in component) {+ return component[value];+ }+ } else {+ return component;}- } else- return component;+ }}}- }- for (var i in node.attributes)- {+ for (let i in node.attributes) {attr = node.attributes[i].name;value = node.attributes[i].value;//check for node classes- if (attr == "class")- {+ if (attr == "class") {classes = value.split(" ");- for (j in classes)- {+ for (j in classes) {if (classes[j] in this._classesLookup)return this._classesLookup[ classes[j] ];}- for (regex in this._classesRegexLookup)- {+ for (regex in this._classesRegexLookup) {regexObj = new RegExp(regex);- if (regexObj.exec(value))- {+ if (regexObj.exec(value)) {return this._classesRegexLookup[ regex ];}}@@ -307,134 +365,144 @@ Vvveb.Components = {render: function(type, panel = false) {- var component = this._components[type];+ let component = this._components[type];if (!component) return;- if (panel) {- componentsPanel = panel;- } else {+ if (!panel) {+ //panel = document.querySelector(this.componentPropertiesElement);panel = this.componentPropertiesElement;}- var componentsPanel = $(panel);- var defaultSection = this.componentPropertiesDefaultSection;- var componentsPanelSections = {};+ let defaultSection = this.componentPropertiesDefaultSection;+ let componentsPanelSections = {};- $(panel + " .tab-pane").each(function ()- {- var sectionName = this.dataset.section;- componentsPanelSections[sectionName] = $(this);- $('.section[data-section!="default"]', this).remove();- $('label[data-header!="default"] + input', this).remove();- $('label[data-header!="default"]', this).remove();+ document.querySelectorAll(panel + " .tab-pane").forEach((el, i) => {+ let sectionName = el.dataset.section;+ componentsPanelSections[sectionName] = el;+ for (const item of el.querySelectorAll(+ 'label:not([data-header="default"]) + input,' ++ 'label:not([data-header="default"]),' ++ '.section:not([data-section="default"])'+ )) {+ item.remove();+ }});- var section = componentsPanelSections[defaultSection].find('.section[data-section="default"]');+ let section = componentsPanelSections[defaultSection].querySelector('.section[data-section="default"]');- if (!(Vvveb.preservePropertySections && section.length))- {- componentsPanelSections[defaultSection].html('').append(tmpl("vvveb-input-sectioninput", {key:"default", header:component.name}));- section = componentsPanelSections[defaultSection].find(".section");+ if (!(Vvveb.preservePropertySections && section)) {+ let template = tmpl("vvveb-input-sectioninput", {key:"default", header:component.name});++ componentsPanelSections[defaultSection].replaceChildren();+ componentsPanelSections[defaultSection].append(generateElements(template)[0]);++ section = componentsPanelSections[defaultSection].querySelector(".section");}- componentsPanelSections[defaultSection].find('[data-header="default"] span').html(component.name);- section.html("");+ componentsPanelSections[defaultSection].querySelector('[data-header="default"] span').innerHTML = component.name;+ section.replaceChildren();- if (component.beforeInit) component.beforeInit(Vvveb.Builder.selectedEl.get(0));+ if (component.beforeInit) component.beforeInit(Vvveb.Builder.selectedEl);- var element;+ let element;- var fn = function(component, property) {- return property.input.on('propertyChange', function (event, value, input, origEvent) {-- var element = selectedElement = Vvveb.Builder.selectedEl;-- if (property.child) element = element.find(property.child);- if (property.parent) element = element.parent(property.parent);-- if (property.onChange) {- let ret = property.onChange(element, value, input, component, origEvent);- //if on change returns an object then is returning the dom node otherwise is returning the new value- if (typeof ret == "object") {- element = ret;- } else {- value = ret;- }- }/* else */- if (property.htmlAttr)- {- oldValue = element.attr(property.htmlAttr);+ let fn = function(component, property) {+ if (property.input) {+ property.input.addEventListener('propertyChange', (event) => {+ element = selectedElement = Vvveb.Builder.selectedEl;+ let value = event.detail.value, input = event.detail.input, origEvent = event.detail.origEvent;- if (property.htmlAttr == "class" && property.validValues) {- element.removeClass(property.validValues.join(" "));- element = element.addClass(value);- }- else if (property.htmlAttr == "style") {- //keep old style for undo- oldStyle = $("#vvvebjs-styles", window.FrameDocument).html();- element = Vvveb.StyleManager.setStyle(element, property.key, value);- } else if (property.htmlAttr == "innerHTML") {- element = Vvveb.ContentManager.setHtml(element, value);- } else if (property.htmlAttr == "innerText") {- element = Vvveb.ContentManager.setText(element, value);- } else {- //if value is empty then remove attribute useful for attributes without values like disabled- if (value) {- element = element.attr(property.htmlAttr, value);+ if (property.child) element = element.querySelector(property.child);+ if (property.parent) element = element.parent(property.parent);++ if (property.onChange) {+ let ret = property.onChange(element, value, input, component, origEvent);+ //if on change returns an object then is returning the dom node otherwise is returning the new value+ if (typeof ret == "object") {+ element = ret;+ } else {+ value = ret;+ }+ }/* else */+ if (property.htmlAttr) {+ oldValue = element.getAttribute(property.htmlAttr);++ if (property.htmlAttr == "class" && property.validValues) {+ if (property.validValues) {+ element.classList.remove(...property.validValues.filter(v => v));+ }+ if (value) {+ element.classList.add(...value.split(" "));+ }+ }+ else if (property.htmlAttr == "style") {+ //keep old style for undo+ oldStyle = window.FrameDocument.getElementById("vvvebjs-styles").textContent;+ element = Vvveb.StyleManager.setStyle(element, property.key, value);+ } else if (property.htmlAttr == "innerHTML") {+ element = Vvveb.ContentManager.setHtml(element, value);+ } else if (property.htmlAttr == "innerText") {+ element = Vvveb.ContentManager.setText(element, value);+ } else {+ //if value is empty then remove attribute useful for attributes without values like disabled+ if (value) {+ element.setAttribute(property.htmlAttr, value);+ } else {+ element.removeAttribute(property.htmlAttr);+ }+ }++ if (property.htmlAttr == "style") {+ mutation = {+ type: 'style',+ target: element,+ attributeName: property.htmlAttr,+ oldValue: oldStyle,+ newValue: window.FrameDocument.getElementById("vvvebjs-styles").textContent};++ Vvveb.Undo.addMutation(mutation);} else {- element = element.removeAttr(property.htmlAttr);+ Vvveb.Undo.addMutation({+ type: 'attributes',+ target: element,+ attributeName: property.htmlAttr,+ oldValue: oldValue,+ newValue: element.getAttribute(property.htmlAttr)+ });}}++ if (component.onChange) {+ element = component.onChange(element, property, value, input);+ }- if (property.htmlAttr == "style") {- mutation = {- type: 'style',- target: element.get(0),- attributeName: property.htmlAttr,- oldValue: oldStyle,- newValue: $("#vvvebjs-styles", window.FrameDocument).html()};-- Vvveb.Undo.addMutation(mutation);+ if (property.child || property.parent) {+ Vvveb.Builder.selectNode(selectedElement);} else {- Vvveb.Undo.addMutation(- {type: 'attributes',- target: element.get(0),- attributeName: property.htmlAttr,- oldValue: oldValue,- newValue: element.attr(property.htmlAttr)});+ Vvveb.Builder.selectNode(element);}- }-- if (component.onChange) {- element = component.onChange(element, property, value, input);- }-- if (property.child || property.parent) {- Vvveb.Builder.selectNode(selectedElement);- } else {- Vvveb.Builder.selectNode(element);- }-- return element;- });++ return element;+ });+ }++ return property.input;};- var nodeElement = Vvveb.Builder.selectedEl;+ let nodeElement = Vvveb.Builder.selectedEl;- for (var i in component.properties)- {- var property = component.properties[i];- var element = nodeElement;-- if (property.beforeInit) property.beforeInit(element.get(0));+ for (let i in component.properties) {+ let property = component.properties[i];+ let element = nodeElement;++ if (property.beforeInit) property.beforeInit(element);- if (property.child) element = element.find(property.child);- if (property.parent) element = element.parent(property.parent);+ if (property.child) element = element.querySelector(property.child) ?? element;+ if (property.parent) element = element.closest(property.parent) ?? element;if (property.data) {property.data["key"] = property.key;- } else- {+ } else {property.data = {"key" : property.key};}@@ -443,13 +511,10 @@ Vvveb.Components = {property.input = property.inputtype.init(property.data, element);let value;- if (property.init)- {- property.inputtype.setValue(property.init(element.get(0)));- } else if (property.htmlAttr)- {- if (property.htmlAttr == "style")- {+ if (property.init) {+ property.inputtype.setValue(property.init(element));+ } else if (property.htmlAttr) {+ if (property.htmlAttr == "style") {//value = element.css(property.key);//jquery css returns computed stylevalue = Vvveb.StyleManager.getStyle(element, property.key);//getStyle returns declared style} else@@ -458,15 +523,15 @@ Vvveb.Components = {} else if (property.htmlAttr == "innerText") {value = Vvveb.ContentManager.getText(element);} else {- value = element.attr(property.htmlAttr);+ value = element.getAttribute(property.htmlAttr);}//if attribute is class check if one of valid values is included as class to set the select- if (value && property.htmlAttr == "class" && property.validValues)- {+ if (value && property.htmlAttr == "class" && property.validValues) {let valid = value.split(" ").filter(function(el) {return property.validValues.indexOf(el) != -1});+if (valid && valid.length) {value = valid[0];} else {@@ -489,44 +554,37 @@ Vvveb.Components = {fn(component, property);- var propertySection = defaultSection;- if (property.section)- {+ let propertySection = defaultSection;+ if (property.section) {propertySection = property.section;}- if (property.inputtype == SectionInput)- {- section = componentsPanelSections[propertySection].find('.section[data-section="' + property.key + '"]');+ if (property.inputtype == SectionInput) {+ section = componentsPanelSections[propertySection].querySelector('.section[data-section="' + property.key + '"]');- if (Vvveb.preservePropertySections && section.length)- {- section.html("");- } else- {+ if (Vvveb.preservePropertySections && section) {+ section.replaceChildren();+ } else {componentsPanelSections[propertySection].append(property.input);- section = componentsPanelSections[propertySection].find('.section[data-section="' + property.key + '"]');+ section = componentsPanelSections[propertySection].querySelector('.section[data-section="' + property.key + '"]');}}- else- {- var row = $(tmpl('vvveb-property', property));- row.find('.input').append(property.input);+ else {+ let row = generateElements(tmpl('vvveb-property', property))[0];+ row.querySelector('.input').append(property.input);section.append(row);}- if (property.inputtype.afterInit)- {+ if (property.inputtype.afterInit) {property.inputtype.afterInit(property.input);}- if (property.afterInit)- {- property.afterInit(element.get(0), property.input);+ if (property.afterInit) {+ property.afterInit(element, property.input);}}- if (component.init) component.init(nodeElement.get(0));+ if (component.init) component.init(nodeElement);}};@@ -632,7 +690,7 @@ Vvveb.WysiwygEditor = {this.doc = doc;let self = this;- $("#bold-btn").on("click", function (e) {+ document.getElementById("bold-btn").addEventListener("click", function (e) {//doc.execCommand('bold',false,null);//self.editorSetStyle("b", {"font-weight" : "bold"}, true);self.editorSetStyle(false, {"font-weight" : "bold"}, true);@@ -640,7 +698,7 @@ Vvveb.WysiwygEditor = {return false;});- $("#italic-btn").on("click", function (e) {+ document.getElementById("italic-btn").addEventListener("click", function (e) {//doc.execCommand('italic',false,null);//self.editorSetStyle("i", {"font-style" : "italic"}, true);self.editorSetStyle(false, {"font-style" : "italic"}, true);@@ -648,7 +706,7 @@ Vvveb.WysiwygEditor = {return false;});- $("#underline-btn").on("click", function (e) {+ document.getElementById("underline-btn").addEventListener("click", function (e) {//doc.execCommand('underline',false,null);//self.editorSetStyle("u", {"text-decoration" : "underline"}, true);self.editorSetStyle(false, {"text-decoration" : "underline"}, true);@@ -656,7 +714,7 @@ Vvveb.WysiwygEditor = {return false;});- $("#strike-btn").on("click", function (e) {+ document.getElementById("strike-btn").addEventListener("click", function (e) {//doc.execCommand('strikeThrough',false,null);//self.editorSetStyle("strike", {"text-decoration" : "line-through"}, true);self.editorSetStyle(false, {"text-decoration" : "line-through"}, true);@@ -664,14 +722,14 @@ Vvveb.WysiwygEditor = {return false;});- $("#link-btn").on("click", function (e) {+ document.getElementById("link-btn").addEventListener("click", function (e) {//doc.execCommand('createLink',false,"#");self.editorSetStyle("a");e.preventDefault();return false;});- $("#fore-color").on("change", function (e) {+ document.getElementById("fore-color").addEventListener("change", function (e) {//doc.execCommand('foreColor',false,this.value);self.editorSetStyle(false, {"color" : this.value});e.preventDefault();@@ -679,14 +737,14 @@ Vvveb.WysiwygEditor = {});- $("#back-color").on("change", function (e) {+ document.getElementById("back-color").addEventListener("change", function (e) {//doc.execCommand('hiliteColor',false,this.value);self.editorSetStyle(false, {"background-color" : this.value});e.preventDefault();return false;});- $("#font-size").on("change", function (e) {+ document.getElementById("font-size").addEventListener("change", function (e) {//doc.execCommand('fontSize',false,this.value);self.editorSetStyle(false, {"font-size" : this.value});e.preventDefault();@@ -697,9 +755,9 @@ Vvveb.WysiwygEditor = {for (i = 1;i <= 128; i++) {sizes += "<option value='"+ i +"px'>"+ i +"</option>";}- $("#font-size").html(sizes);+ document.getElementById("font-size").innerHTML = sizes;- $("#font-family").on("change", function (e) {+ document.getElementById("font-family").addEventListener("change", function (e) {let option = this.options[this.selectedIndex];let element = self.editorSetStyle(false, {"font-family" : this.value});Vvveb.FontsManager.addFont(option.dataset.provider, this.value, element);@@ -708,10 +766,11 @@ Vvveb.WysiwygEditor = {return false;});- $("#justify-btn a").on("click", function (e) {- //var command = "justify" + this.dataset.value;+ document.getElementById("justify-btn").addEventListener("click", function (e) {+ //let command = "justify" + this.dataset.value;//doc.execCommand(command,false,"#");- self.editorSetStyle(false, {"text-align" : this.dataset.value});++ self.editorSetStyle(false, {"text-align" : e.srcElement.dataset.value});e.preventDefault();return false;});@@ -726,24 +785,29 @@ Vvveb.WysiwygEditor = {},edit: function(element) {- element.attr({'contenteditable':true, 'spellcheckker':false});- $("#wysiwyg-editor").show();+ element.setAttribute("contenteditable", true);+ element.setAttribute("spellcheckker", false);+ document.getElementById("wysiwyg-editor").style.display = "block";this.element = element;this.isActive = true;- this.oldValue = element.html();+ this.oldValue = element.innerHTML;- $("#font-familly").val(getComputedStyle(element[0])['font-family']);+ document.getElementById("font-family").value = Vvveb.StyleManager.getStyle(element,'font-family');+ document.getElementById("fore-color").value = Vvveb.StyleManager.getStyle(element,'color');+ document.getElementById("back-color").value = Vvveb.StyleManager.getStyle(element,'background-color');element.focus();},destroy: function(element) {- element.removeAttr('contenteditable spellcheckker');- $("#wysiwyg-editor").hide();+ element.removeAttribute("contenteditable");+ element.removeAttribute("spellcheckker");++ document.getElementById("wysiwyg-editor").style.display = "none";this.isActive = false;- node = this.element.get(0);+ node = this.element;Vvveb.Undo.addMutation({type:'characterData',target: node,oldValue: this.oldValue,@@ -765,7 +829,7 @@ Vvveb.Builder = {init: function(url, callback) {- var self = this;+ let self = this;self.loadControlGroups();self.loadBlockGroups();@@ -775,8 +839,8 @@ Vvveb.Builder = {self.highlightEl = null;self.initCallback = callback;- self.documentFrame = $("#iframe-wrapper > iframe");- self.canvas = $("#canvas");+ self.documentFrame = document.querySelector("#iframe-wrapper > iframe");+ self.canvas = document.getElementById("canvas");self._loadIframe(url + (url.indexOf('?') > -1 ? '&r=':'?r=') + Math.random());@@ -788,11 +852,11 @@ Vvveb.Builder = {self.highlightEnabled = true;- self.leftPanelWidth = $("#left-panel").width();+ self.leftPanelWidth = document.getElementById("left-panel").width;self.adjustListsHeight();- $(window).on("scroll resize", function(event) {+ window.addEventListener("scroll resize", function(event) {self.adjustListsHeight();});},@@ -800,54 +864,46 @@ Vvveb.Builder = {/* controls */loadControlGroups : function() {- var componentsList = $(".components-list");- componentsList.empty();- var item = {}, component = {};- var count = 0;+ let componentsList = document.querySelectorAll(".components-list");+ let item = {}, component = {};+ let count = 0;- componentsList.each(function ()- {- var list = $(this);- var type = this.dataset.type;+ componentsList.forEach(function (list, i) {+ let type = list.dataset.type;+ list.replaceChildren();count ++;- for (group in Vvveb.ComponentsGroup)- {+ for (group in Vvveb.ComponentsGroup) {- list.append(+ list.append(generateElements(`<li class="header" data-section="${group}" data-search=""><label class="header" for="${type}_comphead_${group}${count}">${group}<div class="header-arrow"></div></label><input class="header_check" type="checkbox" checked="true" id="${type}_comphead_${group}${count}"><ol></ol>- </li>`);+ </li>`)[0]);//list.append('<li class="header clearfix" data-section="' + group + '" data-search=""><label class="header" for="' + type + '_comphead_' + group + count + '">' + group + ' <div class="header-arrow"></div>\// </label><input class="header_check" type="checkbox" checked="true" id="' + type + '_comphead_' + group + count + '"> <ol></ol></li>');- var componentsSubList = list.find('li[data-section="' + group + '"] ol');+ let componentsSubList = list.querySelector('li[data-section="' + group + '"] ol');components = Vvveb.ComponentsGroup[ group ];- for (i in components)- {+ for (i in components) {componentType = components[i];component = Vvveb.Components.get(componentType);- if (component)- {- item = $(`<li data-section="${group}" data-drag-type="component" data-type="${componentType}" data-search="${component.name.toLowerCase()}">+ if (component) {+ item = generateElements(`<li data-section="${group}" data-drag-type="component" data-type="${componentType}" data-search="${component.name.toLowerCase()}"><span>${component.name}</span>- </li>`);- //item = $('<li data-section="' + group + '" data-drag-type=component data-type="' + componentType + '" data-search="' + component.name.toLowerCase() + '"><span>' + component.name + "</span></li>");+ </li>`)[0];if (component.image) {- item.css({- backgroundImage: "url(" + Vvveb.imgBaseUrl + component.image + ")",- backgroundRepeat: "no-repeat"- })+ item.style.backgroundImage = "url(" + Vvveb.imgBaseUrl + component.image + ")";+ item.style.backgroundRepeat = "no-repeat";}componentsSubList.append(item);@@ -859,53 +915,48 @@ Vvveb.Builder = {loadSectionGroups : function() {- var sectionsList = $(".sections-list");- sectionsList.empty();- var item = {};-- sectionsList.each(function ()- {+ let sectionsList = document.querySelectorAll(".sections-list");+ let item = {};- var list = $(this);- var type = this.dataset.type;+ sectionsList.forEach(function (list, i) {+ let type = list.dataset.type;+ list.replaceChildren();- for (group in Vvveb.SectionsGroup)- {- list.append(+ for (group in Vvveb.SectionsGroup) {+ list.append(generateElements(`<li class="header" data-section="${group}" data-search=""><label class="header" for="${type}_sectionhead_${group}">${group}<div class="header-arrow"></div></label><input class="header_check" type="checkbox" checked="true" id="${type}_sectionhead_${group}"><ol></ol>- </li>`);+ </li>`)[0]);- var sectionsSubList = list.find('li[data-section="' + group + '"] ol');+ let sectionsSubList = list.querySelector('li[data-section="' + group + '"] ol');sections = Vvveb.SectionsGroup[ group ];- for (i in sections)- {+ for (i in sections) {sectionType = sections[i];section = Vvveb.Sections.get(sectionType);- if (section)- {- item = $(`<li data-section="${group}" data-type="${sectionType}" data-search="${section.name.toLowerCase()}">+ if (section) {+ item = generateElements(`<li data-section="${group}" data-type="${sectionType}" data-search="${section.name.toLowerCase()}"><span class="name">${section.name}</span><div class="add-section-btn" title="Add section"><i class="la la-plus"></i></div><img class="preview" src="" loading="lazy">- </li>`);+ </li>`)[0];if (section.image) {- var image = ((section.image.indexOf('/') == -1) ? Vvveb.imgBaseUrl:'') + section.image;+ let image = ((section.image.indexOf('/') == -1) ? Vvveb.imgBaseUrl:'') + section.image;- item.css({+ /*+ Object.assign(item.style,{//backgroundImage: "url(" + image + ")",//backgroundRepeat: "no-repeat"- }).find("img").attr("src", image);-+ });*/+ item.querySelector("img").setAttribute("src", image);}sectionsSubList.append(item)@@ -917,50 +968,46 @@ Vvveb.Builder = {loadBlockGroups : function() {- var blocksList = $(".blocks-list");- blocksList.empty();- var item = {};-- blocksList.each(function ()- {+ let blocksList = document.querySelectorAll(".blocks-list");+ let item = {};- var list = $(this);- var type = this.dataset.type;+ blocksList.forEach(function (list, i) {+ let type = list.dataset.type;+ list.replaceChildren();- for (group in Vvveb.BlocksGroup)- {- list.append(+ for (group in Vvveb.BlocksGroup) {+ list.append(generateElements(`<li class="header" data-section="${group}" data-search=""><label class="header" for="${type}_blockhead_${group}">${group}<div class="header-arrow"></div></label><input class="header_check" type="checkbox" checked="true" id="${type}_blockhead_${group}"><ol></ol>- </li>`);+ </li>`)[0]);- var blocksSubList = list.find('li[data-section="' + group + '"] ol');+ let blocksSubList = list.querySelector('li[data-section="' + group + '"] ol');blocks = Vvveb.BlocksGroup[ group ];- for (i in blocks)- {+ for (i in blocks) {blockType = blocks[i];block = Vvveb.Blocks.get(blockType);- if (block)- {- item = $(`<li data-section="${group}" data-drag-type="block" data-type="${blockType}" data-search="${block.name.toLowerCase()}">+ if (block) {+ item = generateElements(`<li data-section="${group}" data-drag-type="block" data-type="${blockType}" data-search="${block.name.toLowerCase()}"><span class="name">${block.name}</span><img class="preview" src="" loading="lazy">- </li>`);+ </li>`)[0];if (block.image) {- var image = ((block.image.indexOf('/') == -1) ? Vvveb.imgBaseUrl:'') + block.image;-- item.css({+ let image = ((block.image.indexOf('/') == -1) ? Vvveb.imgBaseUrl:'') + block.image;+ /*+ Object.assign(item.style,{//backgroundImage: "url(" + image + ")",//backgroundRepeat: "no-repeat"- }).find("img").attr("src", image);+ });*/++ item.querySelector("img").setAttribute("src", image);}@@ -973,20 +1020,20 @@ Vvveb.Builder = {},adjustListsHeight: function () {- let left = $("#left-panel .drag-elements-sidepane > div:not(.block-preview), #left-panel .component-properties > .tab-content");- let right = $("#right-panel .drag-elements-sidepane > div:not(.block-preview), #right-panel .component-properties > .tab-content");- let wHeight = $(window).height();+ let left = document.querySelectorAll("#left-panel .drag-elements-sidepane > div:not(.block-preview), #left-panel .component-properties > .tab-content");+ let right = document.querySelectorAll("#right-panel .drag-elements-sidepane > div:not(.block-preview), #right-panel .component-properties > .tab-content");+ let wHeight = window.outerHeight;let maxOffset = 0;- function adjust(elements) {- elements.each(function (i,e) {+ function adjust(elements) {+ elements.forEach(function (e,i) {e.style.height = "";let offset = Math.floor(e.getBoundingClientRect()["top"]);if (offset >= wHeight) return;maxOffset = Math.max(maxOffset, offset);let height = wHeight - maxOffset;if (!offset) {- height += parseInt(e.dataset.offset ?? 0);+ height += parseInt(e.dataset.offset ?? 0);}e.style.height = height + "px";});@@ -999,8 +1046,8 @@ Vvveb.Builder = {loadUrl : function(url, callback) {- var self = this;- $("#select-box").hide();+ let self = this;+ document.getElementById("select-box").style.display = "none";self.initCallback = callback;if (Vvveb.Builder.iframe.src != url) Vvveb.Builder.iframe.src = url;@@ -1009,66 +1056,63 @@ Vvveb.Builder = {/* iframe */_loadIframe : function(url) {- var self = this;- self.iframe = this.documentFrame.get(0);+ let self = this;+ self.iframe = this.documentFrame;self.iframe.src = url;- return this.documentFrame.on("load", function()- {+ return this.documentFrame.addEventListener("load", function() {window.FrameWindow = self.iframe.contentWindow;window.FrameDocument = self.iframe.contentWindow.document;- var addSectionBox = $("#add-section-box");- var highlightBox = $("#highlight-box").hide();+ let addSectionBox = document.getElementById("add-section-box");+ let highlightBox = document.getElementById("highlight-box");+ let SelectBox = document.getElementById("select-box");++ highlightBox.style.display = "none";- $(window.FrameWindow).on("beforeunload", function(event) {+ window.FrameWindow.addEventListener("beforeunload", function(event) {if (Vvveb.Undo.undoIndex >= 0) {- var dialogText = "You have unsaved changes";+ let dialogText = "You have unsaved changes";event.returnValue = dialogText;return dialogText;}});- $(window.FrameWindow).on("unload", function(event) {- $(".loading-message").addClass("active");+ window.FrameWindow.addEventListener("unload", function(event) {+ document.querySelector(".loading-message").classList.add("active");Vvveb.Undo.reset();});//prevent accidental clicks on links when editing text- $(window.FrameDocument).on("click", "a", function(event) {- if (Vvveb.WysiwygEditor.isActive) {+ window.FrameDocument.addEventListener("click", function(event) {+ if (Vvveb.WysiwygEditor.isActive && event.target.closest("a")) {event.preventDefault();return false;}});- $(window.FrameWindow).on("scroll resize", function(event) {+ selectBoxPosition = function(event) {- if (self.selectedEl)- {- var offset = self.selectedEl.offset();+ if (self.selectedEl) {+ let pos = offset(self.selectedEl);- $("#select-box").css(- {"top": offset.top - self.frameDoc.scrollTop() - self.selectPadding,- "left": offset.left - self.frameDoc.scrollLeft() - self.selectPadding,- });-+ SelectBox.style.top = (pos.top - (self.frameDoc.scrollTop ?? 0) - self.selectPadding) + "px";+ SelectBox.style.left = (pos.left - (self.frameDoc.scrollLeft ?? 0) - self.selectPadding) + "px";}- if (self.highlightEl)- {- var offset = self.highlightEl.offset();-- highlightBox.css(- {"top": offset.top - self.frameDoc.scrollTop() - self.selectPadding,- "left": offset.left - self.frameDoc.scrollLeft() - self.selectPadding,- });-+ if (self.highlightEl) {+ let pos = offset(self.highlightEl);++ highlightBox.style.top = (pos.top - (self.frameDoc.scrollTop ?? 0) - self.selectPadding) + "px";+ highlightBox.style.left = (pos.left - (self.frameDoc.scrollLeft ?? 0) - self.selectPadding) + "px";- //addSectionBox.hide();+ //addSectionBox.style.display = "none";}- });+ };++ window.FrameWindow.addEventListener("scroll", selectBoxPosition);+ window.FrameWindow.addEventListener("resize", selectBoxPosition);Vvveb.WysiwygEditor.init(window.FrameDocument);Vvveb.StyleManager.init(window.FrameDocument);@@ -1083,41 +1127,44 @@ Vvveb.Builder = {_frameLoaded : function() {- var self = Vvveb.Builder;+ let self = Vvveb.Builder;- self.frameDoc = $(window.FrameDocument);- self.frameHtml = $(window.FrameDocument).find("html");- self.frameBody = $(window.FrameDocument).find("body");- self.frameHead = $(window.FrameDocument).find("head");+ self.frameDoc = window.FrameDocument;+ self.frameHtml = window.FrameDocument.querySelector("html");+ self.frameBody = window.FrameDocument.querySelector("body");+ self.frameHead = window.FrameDocument.querySelector("head");//insert editor helpers like non editable areas- self.frameHead.append('<link data-vvveb-helpers href="' + Vvveb.baseUrl + '../../css/vvvebjs-editor-helpers.css" rel="stylesheet">');+ self.frameHead.append(generateElements('<link data-vvveb-helpers href="' + Vvveb.baseUrl + '../../css/vvvebjs-editor-helpers.css" rel="stylesheet">')[0]);self._initHighlight();- $(window).triggerHandler("vvveb.iframe.loaded", self.frameDoc);- $(".loading-message").removeClass("active");-+ window.dispatchEvent(new CustomEvent("vvveb.iframe.loaded", {detail: self.frameDoc}));+ document.querySelector(".loading-message").classList.remove("active");+//enable save button only if changes are made- Vvveb.Builder.frameBody.on("vvveb.undo.add vvveb.undo.restore", function (e) {+ let setSaveButtonState = function (e) {if (Vvveb.Undo.hasChanges()){- $("#top-panel .save-btn").removeAttr("disabled");+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.removeAttribute("disabled"));} else {- $("#top-panel .save-btn").attr("disabled", "true");+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.setAttribute("disabled", "true"));}- });+ };++ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.add", setSaveButtonState);+ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.restore", setSaveButtonState);},_getElementType: function(el) {//search for component attribute- var componentName = '';- var componentAttribute = '';+ let componentName = '';+ let componentAttribute = '';if (el.attributes) {- for (var j = 0; j < el.attributes.length; j++){- var nodeName = el.attributes[j].nodeName;+ for (let j = 0; j < el.attributes.length; j++){+ let nodeName = el.attributes[j].nodeName;if (nodeName.indexOf('data-component') > -1) {componentName = nodeName.replace('data-component-', '');@@ -1149,7 +1196,7 @@ Vvveb.Builder = {loadNodeComponent: function(node) {data = Vvveb.Components.matchNode(node);- var component;+ let component;if (data)component = data.type;@@ -1163,22 +1210,20 @@ Vvveb.Builder = {moveNodeUp: function(node) {if (!node) {- node = Vvveb.Builder.selectedEl.get(0);+ node = Vvveb.Builder.selectedEl;}oldParent = node.parentNode;oldNextSibling = node.nextSibling;- next = $(node).prev();+ next = node.previousElementSibling;- if (next.length > 0)- {+ if (next) {next.before(node);- } else- {- $(node).parent().before(node);+ } else {+ node.parentNode.before(node);}-+Vvveb.Builder.selectNode(node);newParent = node.parentNode;@@ -1195,20 +1240,18 @@ Vvveb.Builder = {moveNodeDown: function(node) {if (!node) {- node = Vvveb.Builder.selectedEl.get(0);+ node = Vvveb.Builder.selectedEl;}oldParent = node.parentNode;oldNextSibling = node.nextSibling;- next = $(node).next();+ next = node.nextElementSibling;- if (next.length > 0)- {+ if (next) {next.after(node);- } else- {- $(node).parent().after(node);+ } else {+ node.parentNode.after(node);}Vvveb.Builder.selectNode(node);@@ -1229,13 +1272,13 @@ Vvveb.Builder = {node = Vvveb.Builder.selectedEl;}- clone = node.clone();+ clone = node.cloneNode(true);node.after(clone);- node = clone.click();+ node.click();- element = clone.get(0);+ element = clone;Vvveb.Undo.addMutation({type: 'childList',target: node.parentNode,@@ -1246,81 +1289,75 @@ Vvveb.Builder = {selectNode: function(node) {- var self = this;+ let self = this;+ let SelectBox = document.getElementById("select-box");- if (!node)- {- $("#select-box").hide();+ if (!node) {+ SelectBox.style.display = "none";return;}- if (self.texteditEl && self.selectedEl.get(0) != node) {+ if (self.texteditEl && (self.selectedEl != node)) {Vvveb.WysiwygEditor.destroy(self.texteditEl);self.selectPadding = 0;- $("#select-box").removeClass("text-edit").find("#select-actions").show();+ document.getElementById("select-box").classList.remove("text-edit");+ document.getElementById("select-actions").style.display = "";self.texteditEl = null;}- var target = $(node);-- if (target)- {- self.selectedEl = target;+ let target = node;+ self.selectedEl = target;- try {- var offset = target.offset();-- $("#select-box").css(- {"top": offset.top - self.frameDoc.scrollTop() - self.selectPadding,- "left": offset.left - self.frameDoc.scrollLeft() - self.selectPadding,- "width" : target.outerWidth() + self.selectPadding * 2,- "height": target.outerHeight() + self.selectPadding * 2,- "display": "block",- });-- Vvveb.Breadcrumb.loadBreadcrumb(target.get(0));-- } catch(err) {- console.log(err);- return false;- }+ try {+ let pos = offset(target);++ SelectBox.style.top = (pos.top - (self.frameDoc.scrollTop ?? 0) - self.selectPadding) + "px";+ SelectBox.style.left = (pos.left - (self.frameDoc.scrollLeft ?? 0) - self.selectPadding) + "px";+ SelectBox.style.width = ((target.offsetWidth ?? target.clientWidth) + self.selectPadding * 2) + "px";+ SelectBox.style.height = ((target.offsetHeight ?? target.clientHeight) + self.selectPadding * 2) + "px";+ SelectBox.style.display = "block";++ Vvveb.Breadcrumb.loadBreadcrumb(target);++ } catch(err) {+ console.log(err);+ return false;}let elementType = this._getElementType(node);- $("#highlight-name .type").html(elementType[0]);- $("#highlight-name .name").html(elementType[1]);+ document.querySelector("#highlight-name .type").innerHTML = elementType[0];+ document.querySelector("#highlight-name .name").innerHTML = elementType[1];},/* iframe highlight */_initHighlight: function() {- var self = Vvveb.Builder;+ let self = Vvveb.Builder;- self.frameBody.on("mousemove dragover touchmove", function(event) {+ let highlightMove = function(event) {+ if (self.highlightEnabled == true && event.target && isElement(event.target)) {- if (self.highlightEnabled == true && event.target && isElement(event.target) && event.originalEvent)- {- self.highlightEl = target = $(event.target);- var offset = target.offset();- var height = target.outerHeight();- var halfHeight = Math.max(height / 2, 5);- var width = target.outerWidth();- var halfWidth = Math.max(width / 2, 5);- var prepend = true;-- var x = event.originalEvent.x;- var y = event.originalEvent.y;+ self.highlightEl = target = event.target;+ let pos = offset(target);+ let height = target.offsetHeight;+ let halfHeight = Math.max(height / 2, 5);+ let width = target.offsetWidth;+ let halfWidth = Math.max(width / 2, 5);+ let prepend = true;+ let x = event.x;+ let y = event.y;+if (self.isResize) {if (!self.initialPosition) {self.initialPosition = {x,y};}- var deltaX = x - self.initialPosition.x;- var deltaY = y - self.initialPosition.y;+ let deltaX = x - self.initialPosition.x;+ let deltaY = y - self.initialPosition.y;- offset = self.selectedEl.offset();+ pos = offset(self.selectedEl);width = self.initialSize.width;height = self.initialSize.height;@@ -1367,22 +1404,23 @@ Vvveb.Builder = {}if (self.resizeMode == "css") {- self.selectedEl.css({width, height});+ self.selectedEl.style.width = width + "px";+ self.selectedEl.style.height = height + "px";} else {- self.selectedEl.attr({width, height});+ self.selectedEl.setAttribute("width", width);+ self.selectedEl.setAttribute("height", height);}- $("#select-box").css(- {"top": offset.top - self.frameDoc.scrollTop() ,- "left": offset.left - self.frameDoc.scrollLeft() ,- "width" : width,- "height": self.selectedEl.outerHeight(),- });++ let SelectBox = document.getElementById("select-box");+ SelectBox.style.top = pos.top - (self.frameDoc.scrollTop ?? 0) + "px";+ SelectBox.style.left = pos.left - (self.frameDoc.scrollLeft ?? 0) + "px";+ SelectBox.style.width = width + "px";+ SelectBox.style.height = self.selectedEl.offsetHeight + "px";+ SelectBox.style.display = "block";- } else- if (self.isDragging)- {- var parent = self.highlightEl;- let parentTagName = parent[0].tagName.toLowerCase();+ } else if (self.isDragging) {+ let parent = self.highlightEl;+ let parentTagName = parent.tagName.toLowerCase();let noChildren = {input: true,@@ -1397,107 +1435,93 @@ Vvveb.Builder = {br: true,wbr: true};-+try {- if ((offset.top < (event.originalEvent.pageY - halfHeight)) || (offset.left < (x - halfWidth)))- {+ if ((pos.top < (y - halfHeight)) || (pos.left < (x - halfWidth))) {if (noChildren[parentTagName]) {- self.dragElement.insertAfter(parent);+ self.dragElement.after(parent);} else {- self.dragElement.appendTo(parent);+ if (parent == self.dragElement.parenNode) {+ parent.appendChild(self.dragElement);+ } else {+ parent.append(self.dragElement);+ }}prepend = true;- } else- {+ } else {if (noChildren[parentTagName]) {- self.dragElement.insertBefore(parent);+ parent.parentNode.insertBefore(self.dragElement, parent);} else {- self.dragElement.prependTo(parent);+ parent.prepend(self.dragElement);}prepend = false;};- if (self.designerMode)- {- var parentOffset = self.dragElement.offsetParent().offset();-- self.dragElement.css({- "position": "absolute",- 'left': x - (parentOffset.left - self.frameDoc.scrollLeft()),- 'top': y - (parentOffset.top - self.frameDoc.scrollTop()),- });+ if (self.designerMode) {+ let parentOffset = offset(self.dragElement.offsetParent);+ self.dragElement.style.position = "absolute";+ self.dragElement.style.x = x - (parentOffset.left - self.frameDoc.scrollLeft);+ self.dragElement.style.y = y - (parentOffset.top - self.frameDoc.scrollTop);}- /*- $("#drop-highlight-box").css(- {"top": offset.top - self.frameDoc.scrollTop() ,- "left": offset.left - self.frameDoc.scrollLeft() ,- "width" : parentWidth,- "height": "5px",- "display" :"block",- });- */-} catch(err) {console.log(err);return false;}if (!self.designerMode && self.iconDrag) {- self.iconDrag.css({'left': x + self.leftPanelWidth + 10, 'top': y + 60});+ self.iconDrag.style.top = (y + 60) + "px";+ self.iconDrag.style.left = (x + self.leftPanelWidth + 10) + "px";}}// else //uncomment else to disable parent highlighting when dragging{//if text editor is open check if the highlighted element is not inside the editorif (Vvveb.WysiwygEditor.isActive ) {- if (self.texteditEl.get(0).contains(event.target)) {+ if (self.texteditEl.contains(event.target)) {return true;}}- $("#highlight-box").css(- {"top": offset.top - self.frameDoc.scrollTop() ,- "left": offset.left - self.frameDoc.scrollLeft() ,- "width" : width,- "height": height,- "display" : event.target.hasAttribute('contenteditable')?"none":"block",- "border":self.isDragging?"1px dashed #0d6efd":"",//when dragging highlight parent with green- });-- if (height < 50)- {- $("#section-actions").addClass("outside");- } else- {- $("#section-actions").removeClass("outside");+ document.getElementById("highlight-box").setAttribute("style",+ `top:${pos.top - (self.frameDoc.scrollTop ?? 0)}px;+ left:${pos.left - (self.frameDoc.scrollLeft ?? 0)}px;+ width:${width}px;+ height:${height}px;+ display:${event.target.hasAttribute('contenteditable') ? "none":"block"};+ border:${self.isDragging ? "1px dashed #0d6efd":""};+ `);++ if (height < 50) {+ document.getElementById("section-actions").classList.add("outside");+ } else {+ document.getElementById("section-actions").classList.remove("outside");}let elementType = self._getElementType(event.target);- $("#highlight-name .type").html(elementType[0]);- $("#highlight-name .name").html(elementType[1]);+ document.querySelector("#highlight-name .type").innerHTML = elementType[0];+ document.querySelector("#highlight-name .name").innerHTML = elementType[1];}}- });+ };++ self.frameBody.addEventListener("mousemove", highlightMove);- self.frameHtml.on("mouseup dragend touchend", function(event) {+ let highlightUp = function(event) {self.isResize = false;- $("#section-actions, #highlight-name, #select-box").show();-- if (self.isDragging)- {+ document.querySelectorAll("#section-actions, #highlight-name").forEach(el => el.style.display = "");+ if (self.isDragging) {self.isDragging = false;Vvveb.Builder.highlightEnabled = true;if (self.iconDrag) self.iconDrag.remove();- $("#component-clone").remove();+ document.getElementById("component-clone")?.remove();- if (self.dragMoveMutation === false)- {+ if (self.dragMoveMutation === false) {if (self.component.dragHtml || Vvveb.dragHtml) { //if dragHtml is set for dragging then set real component htmlif (self.component) {- newElement = $(self.component.html);+ newElement = generateElements(self.component.html)[0];self.dragElement.replaceWith(newElement);self.dragElement = newElement;}@@ -1505,27 +1529,30 @@ Vvveb.Builder = {if (self.component.afterDrop) self.dragElement = self.component.afterDrop(self.dragElement);} else {- self.dragElement.replaceWith(self.selectedEl.removeClass("is-dragged"));+ self.selectedEl.classList.remove("is-dragged");+ self.dragElement.replaceWith(self.selectedEl);self.dragElement = self.selectedEl;}-- node = self.dragElement.get(0);++ node = self.dragElement;self.selectNode(node);Vvveb.TreeList.loadComponents();Vvveb.TreeList.selectComponent(node);self.loadNodeComponent(node);//if component properties is loaded in left panel tab instead of right panel show tab- if ($(".component-properties-tab").is(":visible"))//if properites tab is enabled/visible- $('.component-properties-tab a').show().tab('show');-- if (self.dragMoveMutation === false)- {+ let propertiesTab = document.querySelector(".component-properties-tab a");+ if (propertiesTab.offsetParent) {//if properites tab is enabled/visible+ propertiesTab.style.display = "";+ const bsTab = bootstrap.Tab.getOrCreateInstance(propertiesTab);+ bsTab.show();+ }++ if (self.dragMoveMutation === false) {Vvveb.Undo.addMutation({type: 'childList',target: node.parentNode,addedNodes: [node],nextSibling: node.nextSibling});- } else- {+ } else {self.dragMoveMutation.newParent = node.parentNode;self.dragMoveMutation.newNextSibling = node.nextSibling;@@ -1533,122 +1560,143 @@ Vvveb.Builder = {self.dragMoveMutation = false;}}- });+ };++ self.frameBody.addEventListener("mouseup", highlightUp);- self.frameHtml.on("dblclick", function(event) {+ let highlightDbClick = function(event) {if (Vvveb.Builder.isPreview == false) {if (!Vvveb.WysiwygEditor.isActive) {- self.selectPadding = 10;- self.texteditEl = target = $(event.target);+ self.selectPadding = 10;+ self.texteditEl = target = event.target;- Vvveb.WysiwygEditor.edit(self.texteditEl);-- _updateSelectBox = function(event) {- if (!self.texteditEl) return;- var offset = self.selectedEl.offset();-- $("#select-box").css({- "top": offset.top - self.frameDoc.scrollTop() - self.selectPadding,- "left": offset.left - self.frameDoc.scrollLeft() - self.selectPadding,- "width" : self.texteditEl.outerWidth() + self.selectPadding *2,- "height": self.texteditEl.outerHeight() + self.selectPadding *2- });- };-- //update select box when the text size is changed- self.texteditEl.on("blur keyup paste input", _updateSelectBox);- _updateSelectBox();-- $("#select-box").addClass("text-edit").find("#select-actions").hide();- $("#highlight-box").hide();- }+ Vvveb.WysiwygEditor.edit(self.texteditEl);++ _updateSelectBox = function(event) {+ if (!self.texteditEl) return;+ let pos = offset(self.selectedEl);++ let SelectBox = document.getElementById("select-box");++ SelectBox.style.top = (pos.top - (self.frameDoc.scrollTop ?? 0) - self.selectPadding) + "px";+ SelectBox.style.left = (pos.left - (self.frameDoc.scrollLeft ?? 0) - self.selectPadding) + "px";+ SelectBox.style.width = (self.texteditEl.offsetWidth + (self.selectPadding * 2)) + "px";+ SelectBox.style.height = (self.texteditEl.offsetHeight + (self.selectPadding * 2)) + "px";+ SelectBox.style.display = "block";+ };++ //update select box when the text size is changed+ self.texteditEl.addEventListener("blur", _updateSelectBox);+ self.texteditEl.addEventListener("keyup", _updateSelectBox);+ self.texteditEl.addEventListener("paste", _updateSelectBox);+ self.texteditEl.addEventListener("input", _updateSelectBox);+ _updateSelectBox();++ document.getElementById("select-box").classList.add("text-edit")+ document.getElementById("select-actions").style.display = "none";+ document.getElementById("highlight-box").style.display = "none";+ }}- });+ };+ self.frameBody.addEventListener("dblclick", highlightDbClick);- self.frameHtml.on("click", function(event) {+ let highlightClick = function(event) {if (Vvveb.Builder.isPreview == false){if (event.target) {if (Vvveb.WysiwygEditor.isActive ) {- if (self.texteditEl.get(0).contains(event.target)) {+ if (self.texteditEl.contains(event.target)) {return true;}}//if component properties is loaded in left panel tab instead of right panel show tab- if ($(".component-properties-tab").is(":visible"))//if properites tab is enabled/visible- $('.component-properties-tab a').show().tab('show');+ let componentTab = document.querySelector(".component-properties-tab a");+ if (componentTab.offsetParent) { //if properites tab is enabled/visible+ componentTab.style.display = "";+ const bsTab = bootstrap.Tab.getOrCreateInstance(componentTab);+ bsTab.show();+ }self.selectNode(event.target);Vvveb.TreeList.selectComponent(event.target);self.loadNodeComponent(event.target);if (Vvveb.component.resizable) {- $("#select-box").addClass("resizable");+ document.getElementById("select-box").classList.add("resizable");self.resizeMode = Vvveb.component.resizeMode;} else {- $("#select-box").removeClass("resizable");+ document.getElementById("select-box").classList.remove("resizable");}- $("#add-section-box").hide();- event.preventDefault();- return false;- }++ document.getElementById("add-section-box").style.display = "none";+ event.preventDefault();+ return false;+ }}- });+ };++ self.frameBody.addEventListener("click", highlightClick);},_initBox: function() {- var self = this;+ let self = this;- $("#drag-btn").on("mousedown", function(event) {- //self.dragElement = self.selectedEl.attr("style",Vvveb.dragElementStyle);+ document.getElementById("drag-btn").addEventListener("mousedown", function(event) {+ //self.dragElement = self.selectedEl.setAttribute("style",Vvveb.dragElementStyle);if (event.which == 1) {//left click- self.isDragging = true;- $("#section-actions, #highlight-name, #select-box").hide();--- if (self.designerMode) {- self.dragElement = self.selectedEl;- } else {- self.selectedEl.css("position", "" ).css("top", "" ).css("left", "" );- self.selectedEl.addClass("is-dragged");- self.dragElement = $(Vvveb.dragHtml);- }+ self.isDragging = true;+ document.querySelectorAll("#section-actions, #highlight-name, #select-box").forEach(el => el.style.display = "");+++ if (self.designerMode) {+ self.dragElement = self.selectedEl;+ } else {+ self.selectedEl.style.position = "";+ self.selectedEl.style.top = "";+ self.selectedEl.style.left = "";- node = self.selectedEl.get(0);+ self.selectedEl.classList.add("is-dragged");+ self.dragElement = generateElements(Vvveb.dragHtml)[0];+ }- self.dragMoveMutation = {type: 'move',- target: node,- oldParent: node.parentNode,- oldNextSibling: node.nextSibling};-- //self.selectNode(false);- event.preventDefault();- return false;+ node = self.selectedEl;++ self.dragMoveMutation = {type: 'move',+ target: node,+ oldParent: node.parentNode,+ oldNextSibling: node.nextSibling};++ //self.selectNode(false);+ event.preventDefault();+ return false;}});- $(".resize > div").on("mousedown", function(event) {++ let resizeDown = function(event) {if (event.which == 1) {//left click- $("#section-actions, #highlight-name, #highlight-box").hide();-- self.isResize = true;- self.initialSize = {"width" : self.selectedEl.outerWidth(), "height" : self.selectedEl.outerHeight()};- self.initialPosition = false;- self.resizeHandler = this.className;+ document.querySelector("#section-actions, #highlight-name, #highlight-box").style.display = "none";++ self.isResize = true;+ self.initialSize = {"width" : self.selectedEl.offsetWidth, "height" : self.selectedEl.offsetHeight};+ self.initialPosition = false;+ self.resizeHandler = this.className;- event.preventDefault();- return false;+ event.preventDefault();+ return false;}- });+ };++ document.querySelectorAll(".resize > div").forEach(e => e.addEventListener("mousedown", resizeDown));- $("#down-btn").on("click", function(event) {+ document.getElementById("down-btn").addEventListener("click", function(event) {- $("#select-box").hide();+ document.getElementById("select-box").style.display = "none";Vvveb.Builder.moveNodeDown();@@ -1656,8 +1704,8 @@ Vvveb.Builder = {return false;});- $("#up-btn").on("click", function(event) {- $("#select-box").hide();+ document.getElementById("up-btn").addEventListener("click", function(event) {+ document.getElementById("select-box").style.display = "none";Vvveb.Builder.moveNodeUp();@@ -1665,7 +1713,7 @@ Vvveb.Builder = {return false;});- $("#clone-btn").on("click", function(event) {+ document.getElementById("clone-btn").addEventListener("click", function(event) {Vvveb.Builder.cloneNode();@@ -1673,9 +1721,9 @@ Vvveb.Builder = {return false;});- $("#parent-btn").on("click", function(event) {+ document.getElementById("parent-btn").addEventListener("click", function(event) {- node = self.selectedEl.parent().get(0);+ node = self.selectedEl.parentNode;self.selectNode(node);self.loadNodeComponent(node);@@ -1685,9 +1733,9 @@ Vvveb.Builder = {return false;});- $("#save-reusable-btn").on("click", function(event) {+ document.getElementById("save-reusable-btn").addEventListener("click", function(event) {- node = self.selectedEl.get(0);+ node = self.selectedEl;let type = 'block';if (node.tagName.toLowerCase() == 'section') {@@ -1703,8 +1751,8 @@ Vvveb.Builder = {return false;});- $("#edit-code-btn").on("click", function(event) {- let selectedEl = Vvveb.Builder.selectedEl.get(0);+ document.getElementById("edit-code-btn").addEventListener("click", function(event) {+ let selectedEl = Vvveb.Builder.selectedEl;let value = selectedEl.innerHTML;// uncomment to use outerHTML, not recommended//let value = selectedEl.outerHTML;@@ -1713,8 +1761,8 @@ Vvveb.Builder = {let oldValue = value;- $(window).one("vvveb.ModalCodeEditor.save", function(event, value) {- selectedEl.innerHTML = value;+ let onSave = function(event) {+ selectedEl.innerHTML = event.detail;//selectedEl.outerHTML = value;node = selectedEl;@@ -1722,32 +1770,39 @@ Vvveb.Builder = {target: node,oldValue: oldValue,newValue: node.innerHTML});- });+ };+ window.removeEventListener("vvveb.ModalCodeEditor.save", onSave);+ window.addEventListener("vvveb.ModalCodeEditor.save", onSave);++ event.preventDefault();return false;});- $("#translate-code-btn").on("click", function(event) {- let selectedEl = Vvveb.Builder.selectedEl.get(0);+ document.getElementById("translate-code-btn")?.addEventListener("click", function(event) {+ let selectedEl = Vvveb.Builder.selectedEl;let value = selectedEl.innerHTML.trim();// uncomment to use outerHTML, not recommended//let value = selectedEl.outerHTML;Vvveb.ModalCodeEditor.show();Vvveb.ModalCodeEditor.setValue(value);- //$(window).one("vvveb.ModalTranslateEditor.save", function(event, value) {- $(window).one("vvveb.ModalCodeEditor.save", function(event, value) {- selectedEl.innerHTML = value;+ let onSave = function(event) {+ selectedEl.innerHTML = event.detail;//selectedEl.outerHTML = value;- });-+ };++ window.removeEventListener("vvveb.ModalCodeEditor.save", onSave);+ window.addEventListener("vvveb.ModalCodeEditor.save", onSave);++ event.preventDefault();return false;});- $("#delete-btn").on("click", function(event) {- $("#select-box").hide();+ document.getElementById("delete-btn").addEventListener("click", function(event) {+ document.getElementById("select-box").style.display = "none";- node = self.selectedEl.get(0);+ node = self.selectedEl;Vvveb.Undo.addMutation({type: 'childList',target: node.parentNode,@@ -1760,48 +1815,42 @@ Vvveb.Builder = {return false;});- var addSectionBox = $("#add-section-box");- var addSectionElement = {};+ let addSectionBox = document.getElementById("add-section-box");+ let addSectionElement = {};- $("#add-section-btn").on("click", function(event) {+ document.getElementById("add-section-btn").addEventListener("click", function(event) {addSectionElement = self.highlightEl;+ addSectionBox.style.display = "block";- var offset = $(addSectionElement).offset();- var top = (offset.top - self.frameDoc.scrollTop()) + addSectionElement.outerHeight();- var left = (offset.left - self.frameDoc.scrollLeft()) + (addSectionElement.outerWidth() / 2) - (addSectionBox.outerWidth() / 2);- var outerHeight = $(window.FrameWindow).height() + self.frameDoc.scrollTop();+ let pos = offset(addSectionElement);+ let top = ((pos.top + window.FrameWindow.pageYOffset + addSectionElement.clientTop) - self.frameHtml.scrollTop) + addSectionElement.offsetHeight;+ let left = ((pos.left + window.FrameWindow.pageXOffset + addSectionElement.clientLeft) - self.frameHtml.scrollLeft) + (addSectionElement.offsetWidth / 2) - (addSectionBox.offsetWidth / 2);+ let outerHeight = window.FrameWindow.innerHeight + self.frameHtml.scrollTop;//check if box is out of viewport and move insideif (left < 0) left = 0;if (top < 0) top = 0;- if ((left + addSectionBox.outerWidth()) > self.frameDoc.outerWidth()) left = self.frameDoc.outerWidth() - addSectionBox.outerWidth();- if (((top + addSectionBox.outerHeight()) + self.frameDoc.scrollTop()) > outerHeight) top = top - addSectionBox.outerHeight();--- addSectionBox.css(- {"top": top,- "left": left,- "display": "block",- });+ if ((left + addSectionBox.offsetWidth) > self.frameHtml.offsetWidth) left = self.frameHtml.offsetWidth - addSectionBox.offsetWidth;+ if (((top + addSectionBox.offsetHeight) + self.frameHtml.scrollTop) > outerHeight) top = top - addSectionBox.offsetHeight;+ addSectionBox.style.top = top + "px";+ addSectionBox.style.left = left + "px";+event.preventDefault();return false;});- $("#close-section-btn").on("click", function(event) {- addSectionBox.hide();+ document.getElementById("close-section-btn").addEventListener("click", function(event) {+ addSectionBox.style.display = "none";});- function addSectionComponent(component, after = true)- {- var node = $(component.html);+ function addSectionComponent(component, after = true) {+ let node = generateElements(component.html)[0];- if (after)- {+ if (after) {addSectionElement.after(node);- } else- {+ } else {addSectionElement.append(node);}@@ -1809,7 +1858,7 @@ Vvveb.Builder = {node = component.afterDrop(node);}- node = node.get(0);+ node = node;self.selectNode(node);self.loadNodeComponent(node);Vvveb.TreeList.loadComponents();@@ -1821,29 +1870,38 @@ Vvveb.Builder = {nextSibling: node.nextSibling});}- $(".components-list li ol li", addSectionBox).on("click", function(event) {- var html = Vvveb.Components.get(this.dataset.type);+ addSectionBox.addEventListener("click", function(event) {+ let element = event.target.closest(".components-list li ol li");+ if (element) {+ let html = Vvveb.Components.get(element.dataset.type);- addSectionComponent(html, ($("[name='add-section-insert-mode']:checked").val() == "after"));+ addSectionComponent(html, (document.querySelector("[name='add-section-insert-mode']:checked").value == "after"));- addSectionBox.hide();+ addSectionBox.style.display = "none";+ }});- $(".blocks-list li ol li", addSectionBox).on("click", function(event) {- var html = Vvveb.Blocks.get(this.dataset.type);+ addSectionBox.addEventListener("click", function(event) {+ let element = event.target.closest(".blocks-list li ol li");+ if (element) {+ let html = Vvveb.Blocks.get(element.dataset.type);- addSectionComponent(html, ($("[name='add-section-insert-mode']:checked").val() == "after"));+ addSectionComponent(html, (document.querySelector("[name='add-section-insert-mode']:checked").value == "after"));- addSectionBox.hide();+ addSectionBox.style.display = "none";+ }});- $(".sections-list li ol li", addSectionBox).on("click", function(event) {- var html = Vvveb.Sections.get(this.dataset.type);+ addSectionBox.addEventListener("click", function(event) {+ let element = event.target.closest(".sections-list li ol li");+ if (element) {+ let html = Vvveb.Sections.get(element.dataset.type);- addSectionComponent(html, ($("[name='add-section-insert-mode']:checked").val() == "after"));+ addSectionComponent(html, (document.querySelector("[name='add-section-insert-mode']:checked").value == "after"));- addSectionBox.hide();+ addSectionBox.style.display = "none";+ }});},@@ -1851,106 +1909,118 @@ Vvveb.Builder = {/* drag and drop */_initDragdrop : function() {- var self = this;+ let self = this;self.isDragging = false;- $("body").on("mousedown touchstart", ".drag-elements-sidepane ul > li > ol > li[data-drag-type]", function(event) {- if (event.which == 1) {//left click- $this = $(this);-- $("#component-clone").remove();- $("#section-actions, #highlight-name, #select-box").hide();-- if ($this.data("drag-type") == "component") {- self.component = Vvveb.Components.get($this.data("type"));- }- else if ($this.data("drag-type") == "section") {- self.component = Vvveb.Sections.get($this.data("type"));- }- else if ($this.data("drag-type") == "block") {- self.component = Vvveb.Blocks.get($this.data("type"));- }-- if (self.component.dragHtml) {- html = self.component.dragHtml;- } else if (Vvveb.dragHtml) {- html = Vvveb.dragHtml;- } else {- html = self.component.html;- }+ document.addEventListener("mousedown", function(event) {+ let element = event.target.closest(".drag-elements-sidepane ul > li > ol > li[data-drag-type]");- self.dragElement = $(html);- //self.dragElement.css("border", "1px dashed #4285f4");-- if (self.component.dragStart) self.dragElement = self.component.dragStart(self.dragElement);-- self.isDragging = true;- if (Vvveb.dragIcon == 'html')- {- self.iconDrag = $(html).attr("id", "dragElement-clone").css('position', 'absolute');- }- else if (self.designerMode == false)- {- self.iconDrag = $('<img src=""/>').attr({"id": "dragElement-clone", 'src': $this.css("background-image").replace(/^url\(['"](.+)['"]\)/, '$1')}).- css({'z-index':100, 'position':'absolute', 'width':'64px', 'height':'64px', 'top': event.originalEvent.y, 'left': event.originalEvent.x});- }+ if (element && event.which == 1) {//left click+ document.getElementById("component-clone")?.remove();+ document.querySelector("#section-actions, #highlight-name, #select-box").style.display = "none";- $('body').append(self.iconDrag);-- event.preventDefault();- return false;- }- });-- $('body').on('mouseup dragend touchend', function(event) {- if (self.iconDrag && self.isDragging == true)- {- self.isDragging = false;- $("#component-clone").remove();- $("#section-actions, #highlight-name, #select-box").show();- self.iconDrag.remove();+ if (element.dataset.dragType == "component") {+ self.component = Vvveb.Components.get(element.dataset.type);+ }+ else if (element.dataset.dragType == "section") {+ self.component = Vvveb.Sections.get(element.dataset.type);+ }+ else if (element.dataset.dragType == "block") {+ self.component = Vvveb.Blocks.get(element.dataset.type);+ }++ if (self.component.dragHtml) {+ html = self.component.dragHtml;+ } else if (Vvveb.dragHtml) {+ html = Vvveb.dragHtml;+ } else {+ html = self.component.html;+ }++ self.dragElement = generateElements(html)[0];+ //self.dragElement.css("border", "1px dashed #4285f4");++ if (self.component.dragStart) self.dragElement = self.component.dragStart(self.dragElement);++ self.isDragging = true;+ if (Vvveb.dragIcon == 'html') {+ self.iconDrag = generateElements(html)[0];+ self.iconDrag.setAttribute("id", "dragElement-clone");+ self.iconDrag.style.position = "absolute";+ }+ else if (self.designerMode == false) {+ self.iconDrag = document.createElement("img");+ self.iconDrag.setAttribute("id", "dragElement-clone");+ self.iconDrag.setAttribute("src", element.style.backgroundImage.replace(/^url\(['"](.+)['"]\)/, '$1'));++ self.iconDrag.style.zIndex = "100";+ self.iconDrag.style.position = "absolute";+ self.iconDrag.style.width = "64px";+ self.iconDrag.style.height = "64px";+ self.iconDrag.style.top = event.y + "px";+ self.iconDrag.style.left = event.x + "px";+ }++ document.body.append(self.iconDrag);++ event.preventDefault();+ return false;+ }+ });++ document.addEventListener('mouseup', function(event) {+ if (self.iconDrag && self.isDragging == true) {+ self.isDragging = false;+ document.getElementById("component-clone")?.remove();+ document.querySelectorAll("#section-actions, #highlight-name, #select-box").forEach(el => el.style.display = "");+ self.iconDrag.remove();if(self.dragElement){self.dragElement.remove();}}});- $('body').on('mousemove dragover touchmove', function(event) {- if (self.iconDrag && self.isDragging == true)- {- var x = (event.clientX || event.originalEvent.clientX);- var y = (event.clientY || event.originalEvent.clientY);+ document.addEventListener('mousemove', function(event) {+ if (self.iconDrag && self.isDragging == true) {+ let x = (event.clientX || event.clientX);+ let y = (event.clientY || event.clientY);- self.iconDrag.css({'left': x - 60, 'top': y - 30});+ self.iconDrag.style.left = (x - 60) + "px";+ self.iconDrag.style.top = (y - 30) + "px";elementMouseIsOver = document.elementFromPoint(x - 60, y - 40);//if drag elements hovers over iframe switch to iframe mouseover handlerreturn;- if (elementMouseIsOver && elementMouseIsOver.tagName == 'IFRAME')- {- self.frameBody.trigger("mousemove", event);+ if (elementMouseIsOver && elementMouseIsOver.tagName == 'IFRAME') {+ self.frameBody.dispatchEvent(new MouseEvent("mousemove", {+ bubbles: true,+ cancelable: true,+ }));++ //self.frameBody.trigger("mousemove", event);event.stopPropagation();self.selectNode(false);}}});- $('.drag-elements-sidepane ul > ol > li > li').on("mouseup dragend touchend", function(event) {- self.isDragging = false;- $("#component-clone").remove()- $("#section-actions, #highlight-name, #select-box").show();;+ document.addEventListener("mouseup", function(event) {+ let element = event.target.closest(".drag-elements-sidepane ul > ol > li > li");+ if (element) {+ self.isDragging = false;+ document.getElementById("component-clone")?.remove()+ document.querySelectorAll("#section-actions, #highlight-name, #select-box").forEach(el => el.style.display = "");+ }});},- removeHelpers: function (html, keepHelperAttributes = false)- {+ removeHelpers: function (html, keepHelperAttributes = false) {//tags like stylesheets or scriptshtml = html.replace(/<[^>]+?data-vvveb-helpers.+?>/gi, "");//attributes- if (!keepHelperAttributes)- {+ if (!keepHelperAttributes) {html = html.replace(/\s*data-vvveb-\w+(=["'].*?["'])?\s*/gi, "");}@@ -1958,21 +2028,21 @@ Vvveb.Builder = {return html;},- getHtml: function(keepHelperAttributes = true)- {- var doc = window.FrameDocument;- var hasDoctpe = (doc.doctype !== null);- var html = "";+ getHtml: function(keepHelperAttributes = true) {+ let doc = window.FrameDocument;+ let hasDoctpe = (doc.doctype !== null);+ let html = "";- $("[contenteditable]", doc).removeAttr("contenteditable");- $("[spellcheckker]", doc).removeAttr("spellcheckker");+ doc.querySelectorAll("[contenteditable]").forEach(e => e.removeAttribute("contenteditable"));+ doc.querySelectorAll("[spellcheckker]").forEach(e => e.removeAttribute("spellcheckker"));+ doc.querySelectorAll('script[src^="chrome-extension://"]').forEach(e => e.remove());// scroll page to top to avoid saving the page in a different state// like saving with sticky classes set for navbar etc// this.iframe.contentWindow.scrollTo(0,0);- $(window).triggerHandler("vvveb.getHtml.before", doc);-+ window.dispatchEvent(new CustomEvent("vvveb.getHtml.before", {detail: doc}));+if (hasDoctpe) html ="<!DOCTYPE "+ doc.doctype.name@@ -1983,19 +2053,16 @@ Vvveb.Builder = {Vvveb.FontsManager.cleanUnusedFonts();- html += doc.documentElement.outerHTML;+ html += doc.documentElement.outerHTML;html = this.removeHelpers(html, keepHelperAttributes);- $(window).triggerHandler("vvveb.getHtml.after", doc);-- var filter = $(window).triggerHandler("vvveb.getHtml.filter", html);- if (filter) return filter;+ window.dispatchEvent(new CustomEvent("vvveb.getHtml.after", {detail: doc}));+ window.dispatchEvent(new CustomEvent("vvveb.getHtml.filter", {detail: html}));return html;},- setHtml: function(html)- {+ setHtml: function(html) {//documentElement.innerHTML resets <head> each time and the page flickers//return window.FrameDocument.documentElement.innerHTML = html;@@ -2013,10 +2080,12 @@ Vvveb.Builder = {}}- if (this.runJsOnSetHtml)- this.frameBody.html(getTag(html, "body"));- else+ if (this.runJsOnSetHtml) {+ this.frameBody.innerHTML = getTag(html, "body");+ }+ else {window.FrameDocument.body.innerHTML = getTag(html, "body");+ }//use outerHTML if you want to set body tag attributes//window.FrameDocument.body.outerHTML = getTag(html, "body", true);@@ -2056,12 +2125,13 @@ Vvveb.Builder = {}let data = {type, name, html:element.outerHTML};- return $.ajax({- type: "POST",- url: saveReusableUrl,//set your server side save script url- data: data,- cache: false,- }).done(function (data, text) {++ fetch(saveReusableUrl, {method: "POST", body: new URLSearchParams(data)})+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.json()+ })+ .then((data) => {if (callback) callback(data);let bg = "bg-success";if (data.success || text == "success") {@@ -2069,42 +2139,48 @@ Vvveb.Builder = {bg = "bg-danger";}- displayToast(bg, "Save", data.message ?? data);- }).fail(function (data) {+ displayToast(bg, "Save", data.message ?? data);+ })+ .catch(error => {+ console.log(error.statusText);displayToast("bg-danger", "Error", "Error saving!");- alert(data.responseText);- });+ });},- saveAjax: function(data, callback, saveUrl)- {+ saveAjax: function(data, saveUrl, callback, error ) {if (!data["file"]) {data["file"] = Vvveb.FileManager.getCurrentFileName();}data["elements"] = Vvveb.ChangeManager.getChangedElements();- if (!data["startTemplateUrl"])- {+ if (!data["startTemplateUrl"]) {data["html"] = this.getHtml();}-- return $.ajax({- type: "POST",- url: saveUrl,//set your server side save script url- data: data,- cache: false,- }).done(function (data) {++ //data['elements'] = new URLSearchParams(data['elements']);++ return fetch(saveUrl, {+ method: "POST",+ headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},+ body: nestedFormData(data)+ })+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.json()+ })+ .then((data) => {if (callback) callback(data);Vvveb.Undo.reset();- $("#top-panel .save-btn").attr("disabled", "true");- }).fail(function (data) {- alert(data.responseText);- });+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.setAttribute("disabled", "true"));+ })+ .catch((err) => {+ if (error) error(err);+ displayToast("bg-danger", "Error", "Error saving!");+ });},- setDesignerMode: function(designerMode = false)- {+ setDesignerMode: function(designerMode = false) {this.designerMode = designerMode;}@@ -2118,19 +2194,20 @@ Vvveb.ModalCodeEditor = {if (modal) {this.modal = modal;} else {- this.modal = $('#codeEditorModal');+ this.modal = document.getElementById('codeEditorModal');}if (editor) {this.editor = editor;} else {- this.editor = $('textarea', this.modal);+ this.editor = this.modal.querySelector('textarea');}let self = this;- $('.save-btn', this.modal).on("click", function(event) {- $(window).triggerHandler("vvveb.ModalCodeEditor.save", self.getValue());+ this.modal.querySelector('.save-btn').addEventListener("click", function(event) {+ window.dispatchEvent(new CustomEvent("vvveb.ModalCodeEditor.save", {detail: self.getValue()}));self.hide();+ return false;});},@@ -2138,22 +2215,25 @@ Vvveb.ModalCodeEditor = {if (!this.modal) {this.init();}- this.modal.modal('show');++ const bsModal = bootstrap.Modal.getOrCreateInstance(this.modal);+ return bsModal.show();},hide: function(value) {- this.modal.modal('hide');+ const bsModal = bootstrap.Modal.getOrCreateInstance(this.modal);+ return bsModal.hide();},getValue: function() {- return this.editor.val();;+ return this.editor.value;;},setValue: function(value) {if (!this.modal) {this.init();}- this.editor.val(value);+ this.editor.value = value;},}@@ -2164,26 +2244,25 @@ Vvveb.CodeEditor = {doc:false,init: function(doc) {- $("#vvveb-code-editor textarea").val(Vvveb.Builder.getHtml());+ document.querySelector("#vvveb-code-editor textarea").val(Vvveb.Builder.getHtml());- $("#vvveb-code-editor textarea").keyup(function () {+ document.querySelector("#vvveb-code-editor textarea").keyup(function () {delay(() => Vvveb.Builder.setHtml(this.value), 1000);});//load code on document changes- Vvveb.Builder.frameBody.on("vvveb.undo.add vvveb.undo.restore", function (e) {- Vvveb.CodeEditor.setValue();- });+ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.add", () => Vvveb.CodeEditor.setValue());+ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.restore", () => Vvveb.CodeEditor.setValue());+//load code when a new url is loaded- Vvveb.Builder.documentFrame.on("load", function (e) { Vvveb.CodeEditor.setValue();});+ Vvveb.Builder.documentFrame.addEventListener("load", () => Vvveb.CodeEditor.setValue());this.isActive = true;},setValue: function(value) {- if (this.isActive)- {- $("#vvveb-code-editor textarea").val(Vvveb.Builder.getHtml());+ if (this.isActive) {+ document.querySelector("#vvveb-code-editor textarea").val(Vvveb.Builder.getHtml());}},@@ -2192,8 +2271,7 @@ Vvveb.CodeEditor = {},toggle: function() {- if (this.isActive != true)- {+ if (this.isActive != true) {this.isActive = true;return this.init();}@@ -2204,45 +2282,37 @@ Vvveb.CodeEditor = {function displayToast(bg, title, message, id = "top-toast") {- $("#" + id + " .toast-body .message").html(message);- $("#" + id + " .toast-header").removeClass(["bg-danger", "bg-success"]).addClass(bg).text(title);- $("#" + id + " .toast").addClass("show");- delay(() => $("#" + id + " .toast").removeClass("show"), 5000);+ document.querySelector("#" + id + " .toast-body .message").innerHTML = message;+ let header = document.querySelector("#" + id + " .toast-header");+ header.classList.remove("bg-danger", "bg-success")+ header.classList.add(bg);+ header.querySelector("strong").innerHTML = title;+ document.querySelector("#" + id + " .toast").classList.add("show");+ delay(() => document.querySelector("#" + id + " .toast").classList.remove("show"), 5000);}Vvveb.Gui = {init: function() {- $("[data-vvveb-action]").each(function () {- on = "click";- if (this.dataset.vvvebOn) on = this.dataset.vvvebOn;-- $(this).on(on, Vvveb.Gui[this.dataset.vvvebAction]);- if (this.dataset.vvvebShortcut)- {- $(document).bind('keydown', this.dataset.vvvebShortcut, Vvveb.Gui[this.dataset.vvvebAction]);- $(window.FrameDocument, window.FrameWindow).bind('keydown', this.dataset.vvvebShortcut, Vvveb.Gui[this.dataset.vvvebAction]);- }+ document.querySelectorAll("[data-vvveb-action]").forEach(function (el,i) {+ on = el.dataset.vvvebOn ?? "click";+ el.addEventListener(on, Vvveb.Gui[el.dataset.vvvebAction]);});},undo : function () {- if (Vvveb.WysiwygEditor.isActive)- {+ if (Vvveb.WysiwygEditor.isActive) {Vvveb.WysiwygEditor.undo();- } else- {+ } else {Vvveb.Undo.undo();}Vvveb.Builder.selectNode();},redo : function () {- if (Vvveb.WysiwygEditor.isActive)- {+ if (Vvveb.WysiwygEditor.isActive) {Vvveb.WysiwygEditor.redo();- } else- {+ } else {Vvveb.Undo.redo();}Vvveb.Builder.selectNode();@@ -2250,8 +2320,8 @@ Vvveb.Gui = {//show modal with html contentsave : function () {- $('#textarea-modal textarea').val(Vvveb.Builder.getHtml());- $('#textarea-modal').modal();+ document.getElementById('textarea-modal textarea').val(Vvveb.Builder.getHtml());+ document.getElementById('textarea-modal').modal();},//show offcanvas with page changes@@ -2267,44 +2337,34 @@ Vvveb.Gui = {page = page ? page : "new-template";page += ".html";- $("#save-offcanvas [data-v-filename]").text(filename);- $("#save-offcanvas input[data-v-filename]").val(filename);- $("#save-offcanvas [data-v-basename]").val(page);- $("#save-offcanvas [data-v-theme-folders]").val(folder);+ document.querySelector("#save-offcanvas [data-v-filename]").text(filename);+ document.querySelector("#save-offcanvas input[data-v-filename]").val(filename);+ document.querySelector("#save-offcanvas [data-v-basename]").val(page);+ document.querySelector("#save-offcanvas [data-v-theme-folders]").val(folder);Vvveb.ChangeManager.render();},//post html content through ajax to save to filesystem/dbsaveAjax : function () {- let btn = $(this);+ let btn = this;let saveUrl = this.dataset.vvvebUrl;let file = Vvveb.FileManager.getPageData('file');//if offcanvas check if user provided new template name- if (btn.hasClass("save-offcanvas")) {- if ($("#save-offcanvas [name=template]:checked").val() == "new") {- file = $("#save-offcanvas [name=folder]").val() + "/" + $("#save-offcanvas [name=file]").val();+ if (btn.classList.contains("save-offcanvas")) {+ if (document.querySelector("#save-offcanvas [name=template]:checked").value == "new") {+ file = document.querySelector("#save-offcanvas [name=folder]").value + "/" + document.querySelector("#save-offcanvas [name=file]").value;}}- $(".loading", btn).toggleClass("d-none");- $(".button-text", btn).toggleClass("d-none");-- return Vvveb.Builder.saveAjax({file}, null, saveUrl).done(function (data, text) {- /*- //use modal to show save status- var messageModal = new bootstrap.Modal(document.getElementById('message-modal'), {- keyboard: false- });-- $("#message-modal .modal-body").html(data);- messageModal.show();- */-+ btn.querySelector(".loading").classList.toggle("d-none");+ btn.querySelector(".button-text").classList.toggle("d-none");++ return Vvveb.Builder.saveAjax({file}, saveUrl, (data) => {//use toast to show save statuslet bg = "bg-success";- if (data.success || text == "success") {- $("#top-panel .save-btn").attr("disabled", "true");+ if (data.success || data == "success") {+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.setAttribute("disabled", "true"));} else {bg = "bg-danger";}@@ -2314,13 +2374,16 @@ Vvveb.Gui = {const offcanvas = document.getElementById('save-offcanvas');if (offcanvas) {let instance = bootstrap.Offcanvas.getInstance(offcanvas);- if (instance) instance.hide();+ if (instance) instance.style.display = "none";}- }, saveUrl).fail(function (data, text, errorThrown) {++ document.querySelector(".loading", btn).classList.toggle("d-none");+ document.querySelector(".button-text", btn).classList.toggle("d-none");+ }, (error) => {+ document.querySelector(".loading", btn).classList.toggle("d-none");+ document.querySelector(".button-text", btn).classList.toggle("d-none");+displayToast("bg-danger", "Error", "Error saving!");- }, saveUrl).always(function (data) {- $(".loading", btn).toggleClass("d-none");- $(".button-text", btn).toggleClass("d-none");});},@@ -2328,9 +2391,8 @@ Vvveb.Gui = {filename = /[^\/]+$/.exec(Vvveb.Builder.iframe.src)[0];uriContent = "data:application/octet-stream," + encodeURIComponent(Vvveb.Builder.getHtml());- var link = document.createElement('a');- if ('download' in link)- {+ let link = document.createElement('a');+ if ('download' in link) {link.dataset.download = filename;link.href = uriContent;link.target = "_blank";@@ -2340,24 +2402,23 @@ Vvveb.Gui = {document.body.removeChild(link);link.remove();- } else- {+ } else {location.href = uriContent;}},viewport : function () {- $("#canvas").attr("class", this.dataset.view);- $("#iframe1").removeAttr("style");- $(".responsive-btns .active").removeClass("active");- if (this.dataset.view) $(this).addClass("active");+ document.getElementById("canvas").setAttribute("class", this.dataset.view);+ document.getElementById("iframe1").removeAttribute("style");+ document.querySelector(".responsive-btns .active").classList.remove("active");+ if (this.dataset.view) this.classList.add("active");},toggleEditor : function () {- $("#vvveb-builder").toggleClass("bottom-panel-expand");- $("#toggleEditorJsExecute").toggle();+ document.getElementById("vvveb-builder").classList.toggle("bottom-panel-expand");+ document.getElementById("toggleEditorJsExecute").classList.toggle("d-none");//hide breadcrumb when showing the editor- $(".breadcrumb-navigator .breadcrumb").toggle();+ document.querySelector(".breadcrumb-navigator .breadcrumb").classList.toggle("d-none");Vvveb.CodeEditor.toggle();},@@ -2367,8 +2428,8 @@ Vvveb.Gui = {preview : function () {(Vvveb.Builder.isPreview == true)?Vvveb.Builder.isPreview = false:Vvveb.Builder.isPreview = true;- $("#iframe-layer").toggle();- $("#vvveb-builder").toggleClass("preview");+ document.getElementById("iframe-layer").classList.toggle("d-none");+ document.getElementById("vvveb-builder").classList.toggle("preview");},fullscreen : function () {@@ -2377,44 +2438,50 @@ Vvveb.Gui = {search : function () {let searchText = this.value;- let panel = $("div > ul", this.parentNode.parentNode)-- $("li ol li", panel).each(function () {- $this = $(this);-- $this.hide();- if ($this.data("search").indexOf(searchText) > -1) $this.show();+ let panel = this.parentNode.parentNode.querySelector("div > ul");+ panel.querySelectorAll("li ol li").forEach(function (el, i) {+ el.style.display = "none";+ if (el.dataset.search.indexOf(searchText) > -1) el.style.display = "";});},clearSearch : function (e) {- $("input", this.parentNode).val("").keyup();+ let input = this.parentNode.querySelector("input");+ input.value = "";+ input.dispatchEvent(new KeyboardEvent("keyup", {+ bubbles: true,+ cancelable: true,+ }));},expand : function (e) {- $('input.header_check[type="checkbox"]', this.parentNode.parentNode.parentNode).prop("checked", true);+ this.parentNode.parentNode.parentNode.querySelectorAll('input.header_check[type="checkbox"]').forEach(e => e.checked = true);},collapse : function (e) {- $('input.header_check[type="checkbox"]', this.parentNode.parentNode.parentNode).prop("checked", false);+ this.parentNode.parentNode.parentNode.querySelectorAll('input.header_check[type="checkbox"]').forEach(e => e.checked = false);},//Pages, file/components treenewPage : function () {- var newPageModal = $('#new-page-modal');+ let newPageModal = document.getElementById('new-page-modal');+ let form = newPageModal.querySelector("form");- newPageModal.modal("show").find("form").off("submit").submit(function( e ) {+ const bsModal = bootstrap.Modal.getOrCreateInstance(newPageModal);+ bsModal.show();- var data = {};- $.each($(this).serializeArray(), function() {- data[this.name] = this.value;+ let submitForm = function(e) {++ let data = {};+ this.querySelectorAll("input[type=text],input[type=checkbox]:checked,input[type=radio]:checked, select").forEach( (el, i) => {+ if (el.offsetParent) data[el.name] = el.value;});if (data['file']) {data['title'] = data['file'].replace('/', '').replace('.html', '');- //var name = data['name'] = data['folder'].replace('/', '_') + "-" + data['title'];+ //let name = data['name'] = data['folder'].replace('/', '_') + "-" + data['title'];if (!data['name']) {data['name'] = data['title'];}@@ -2424,48 +2491,49 @@ Vvveb.Gui = {e.preventDefault();- return Vvveb.Builder.saveAjax(data, function (savedData) {+ return Vvveb.Builder.saveAjax(data, this.action, function (savedData) {data.title = data.name;if (typeof savedData === 'object' && savedData !== null) {- //Object.assign(data, savedData);data.name = savedData.name ?? data.name;data.url = savedData.url ?? data.url;data.file = savedData.file ?? data.file;data.title = savedData.title ?? data.title;}- Vvveb.FileManager.addPage(data.name, data);-+ let page = Vvveb.FileManager.addPage(data.name, data);Vvveb.FileManager.loadPage(data.name);- Vvveb.FileManager.scrollBottom();- newPageModal.modal("hide");+ Vvveb.FileManager.scrollToPage(page);+ bsModal.hide();}, this.action);- });+ };+ form.removeEventListener("submit", submitForm);+ form.addEventListener("submit", submitForm);},setDesignerMode : function () {//aria-pressed attribute is updated after action is called and we check for false instead of true- var designerMode = this.attributes["aria-pressed"].value == "true";+ let designerMode = this.attributes["aria-pressed"].value == "true";Vvveb.Builder.setDesignerMode(designerMode);},-//layout++ //layouttogglePanel: function (panel, cssVar) {- var panel = $(panel);- var body = $("body");- var prevValue = body.css(cssVar);+ panel = document.querySelector(panel);+ let body = document.querySelector("body");+ let prevValue = getComputedStyle(body).getPropertyValue(cssVar);let visible = false;if (prevValue !== "0px") {- panel.data("layout-toggle", prevValue);- body.css(cssVar, "0px");- panel.hide();+ panel.dataset.layoutToggle = prevValue;+ body.style.setProperty(cssVar, "0px");+ panel.style.display = "none";visible = false;} else {- prevValue= panel.data("layout-toggle");- body.css(cssVar, '');- panel.show();+ prevValue= panel.dataset.layoutToggle;+ body.style.setProperty(cssVar, "");+ panel.style.display = "";visible = true;}@@ -2479,16 +2547,22 @@ Vvveb.Gui = {toggleLeftColumn: function () {Vvveb.Gui.togglePanel("#left-panel", "--builder-left-panel-width");- },+ },toggleRightColumn: function (rightColumnEnabled = null) {rightColumnEnabled = Vvveb.Gui.togglePanel("#right-panel", "--builder-right-panel-width");- $("#vvveb-builder").toggleClass("no-right-panel");- $(".component-properties-tab").toggle();+ document.getElementById("vvveb-builder").classList.toggle("no-right-panel");+ document.querySelector(".component-properties-tab").classList.toggle("d-none");Vvveb.Components.componentPropertiesElement = (rightColumnEnabled ? "#right-panel" :"#left-panel #properties") + " .component-properties";- if ($("#properties").is(":visible")) $('.component-tab a').show().tab('show');+ let componentTab = document.querySelector("#components-tab");++ if (document.getElementById("properties").offsetParent) {+ const bsTab = bootstrap.Tab.getOrCreateInstance(componentTab);+ componentTab.style.display = "";+ bsTab.show();+ }Vvveb.Builder.adjustListsHeight();},@@ -2498,7 +2572,7 @@ Vvveb.Gui = {treeList.classList.toggle("d-none");if (!treeList.offsetParent) {document.getElementById("toggle-tree-list").classList.remove("active");- }+ }},}@@ -2512,8 +2586,8 @@ Vvveb.StyleManager = {init: function(doc) {if (doc) {- var style = false;- var _style = false;+ let style = false;+ let _style = false;//check if editor style is presentfor (let i = 0; i < doc.styleSheets.length; i++) {@@ -2526,8 +2600,8 @@ Vvveb.StyleManager = {//if style element does not exist create itif (!style) {- this.cssContainer = $('<style id="vvvebjs-styles"></style>');- $(doc.head).append(this.cssContainer);+ this.cssContainer = generateElements('<style id="vvvebjs-styles"></style>')[0];+ doc.head.append(this.cssContainer);return this.cssContainer;}@@ -2557,15 +2631,15 @@ Vvveb.StyleManager = {}}- return this.cssContainer = $("#vvvebjs-styles", doc);+ return this.cssContainer = doc.getElementById("vvvebjs-styles");}},getSelectorForElement: function(element) {if (!element) return '';- var currentElement = element;- var selector = [];+ let currentElement = element;+ let selector = [];while (currentElement.parentElement) {let elementSelector = "";@@ -2586,7 +2660,7 @@ Vvveb.StyleManager = {} else {//element (tag) selector- var tag = currentElement.tagName.toLowerCase();+ let tag = currentElement.tagName.toLowerCase();//exclude top most element body unless the parent element is bodyif (tag != "body" || (tag == "body" && selector.length <= 1)) {elementSelector = tag@@ -2607,7 +2681,7 @@ Vvveb.StyleManager = {if (typeof(element) == "string") {selector = element;} else {- let node = element.get(0);+ let node = element;//if propert is set with inline style attribute then override it and don't save to css//inline text editor sets properties like font-size inline that can't be later overriten from css@@ -2619,7 +2693,7 @@ Vvveb.StyleManager = {selector = this.getSelectorForElement(node);}- media = $("#canvas").hasClass("tablet") ? "tablet" : $("#canvas").hasClass("mobile") ? "mobile" : "desktop";+ media = document.getElementById("canvas").classList.contains("tablet") ? "tablet" : document.getElementById("canvas").classList.contains("mobile") ? "mobile" : "desktop";//styles[media][selector][styleProp] = valueif (!this.styles[media]) {@@ -2641,7 +2715,7 @@ Vvveb.StyleManager = {},generateCss: function (media) {- //var css = "";+ //let css = "";//for (selector in this.styles[media]) {// css += `${selector} {`;@@ -2652,10 +2726,10 @@ Vvveb.StyleManager = {// css += '}';//}- //this.cssContainer.html(css);+ //this.cssContainer.innerHTML = css;//return element;- var css = "";+ let css = "";for (media in this.styles) {if (media === "tablet" || media === "mobile") {css += `@media screen and (max-width: ${(media === 'tablet') ? this.tabletWidth : this.mobileWidth}){`@@ -2673,48 +2747,32 @@ Vvveb.StyleManager = {}}- this.cssContainer.html(css);+ this.cssContainer.innerHTML = css;},_getCssStyle: function(element, styleProp){- var value = "";- var el;-- if (element.jquery) {- if ( !element.length) return '';- value = "";- el = element.get(0);- selector = this.getSelectorForElement(el);- } else if (element.nodeType) {- el = element;- selector = this.getSelectorForElement(el);- } else if (typeof(element) == "string") {- selector = element;- element = $(selector)[0] ?? false;-- if (!element) return '';- } else {- return '';- }+ let value = "";+ let el;- media = $("#canvas").hasClass("tablet") ? "tablet" : $("#canvas").hasClass("mobile") ? "mobile" : "desktop";+ el = element;+ selector = this.getSelectorForElement(el);++ media = document.getElementById("canvas").classList.contains("tablet") ? "tablet" : document.getElementById("canvas").classList.contains("mobile") ? "mobile" : "desktop";if (el.style && el.style.length > 0 && el.style[styleProp]) {//check inline- var value = el.style[styleProp];- }- else if (this.styles[media] !== undefined && this.styles[media][selector] !== undefined && this.styles[media][selector][styleProp] !== undefined) {//check defined css- var value = this.styles[media][selector][styleProp];+ value = el.style[styleProp];+ } else if (this.styles[media] !== undefined && this.styles[media][selector] !== undefined && this.styles[media][selector][styleProp] !== undefined) {//check defined css+ value = this.styles[media][selector][styleProp];if (styleProp == 'font-family') {}} else if (window.getComputedStyle) {- var value = document.defaultView.getDefaultComputedStyle ?+ value = document.defaultView.getDefaultComputedStyle ?document.defaultView.getDefaultComputedStyle(el,null).getPropertyValue(styleProp) :window.getComputedStyle(el,null).getPropertyValue(styleProp);}-return value;},@@ -2725,19 +2783,19 @@ Vvveb.StyleManager = {Vvveb.ContentManager = {getAttr: function(element, attrName) {- return element.attr(attrName);+ return element.getAttribute(attrName);},setAttr: function(element, attrName, value) {- return element.attr(attrName, value);+ return element.setAttribute(attrName, value);},setHtml: function(element, html) {- return element.html(html);+ return element.innerHTML = html;},getHtml: function(element) {- return element.html();+ return element.innerHTML;},setText: function(element, text) {@@ -2754,7 +2812,7 @@ function getNodeTree (node, parent, allowedComponents, idToNode = {}) {function getNodeTreeTraverse (node, parent, id = '') {if (node.hasChildNodes()) {- for (var j = 0; j < node.childNodes.length; j++) {+ for (let j = 0; j < node.childNodes.length; j++) {child = node.childNodes[j];@@ -2787,8 +2845,7 @@ function getNodeTree (node, parent, allowedComponents, idToNode = {}) {idToNode[id + '-' + j] = child;element = getNodeTreeTraverse(child, element.children, id + '-' + j);- } else- {+ } else {element = getNodeTreeTraverse(child, parent, id + '-' + j);}}@@ -2801,50 +2858,49 @@ function getNodeTree (node, parent, allowedComponents, idToNode = {}) {}function drawComponentsTree(tree) {- var j = 1;- var prefix = Math.floor(Math.random() * 100);+ let j = 1;+ let prefix = Math.floor(Math.random() * 100);function drawComponentsTreeTraverse(tree) {- var html = $("<ol></ol>");+ let list = document.createElement("ol");j++;- for (i in tree)- {- var node = tree[i];- var id = node.id;+ for (i in tree) {+ let node = tree[i];+ let id = node.id;+ let li;+if (!id) {id = prefix + '-' + j + '-' + i;}- if (tree[i].children.length > 0)- {- var li = $('<li data-component="' + node.name + '">\+ if (tree[i].children.length > 0) {+ li = generateElements('<li data-component="' + node.name + '">\<label for="id' + id + '" style="background-image:url(' + Vvveb.imgBaseUrl + node.image + ')"><span>' + node.name + '</span></label>\<input type="checkbox" id="id' + id + '">\- </li>');+ </li>')[0];li.append(drawComponentsTreeTraverse(node.children));}- else- {- var li =$('<li data-component="' + node.name + '" class="file">\+ else {+ li = generateElements('<li data-component="' + node.name + '" class="file">\<label for="id' + id + '" style="background-image:url(' + Vvveb.imgBaseUrl + node.image + ')"><span>' + node.name + '</span></label>\<input type="checkbox" id="id' + id + '">\- </li>');+ </li>')[0];}- li.data("node", node.node);- html.append(li);+ li._treeNode = node.node;+ list.append(li);}- return html;+ return list;}return drawComponentsTreeTraverse(tree);}-var selected = null;-var dragover = null;+let selected = null;+let dragover = null;Vvveb.SectionList = {@@ -2855,154 +2911,195 @@ Vvveb.SectionList = {this.allowedComponents = allowedComponents;- $(this.selector).on("click", "> div .controls", function (e) {- var node = $(e.currentTarget.parentNode).data("node");- if (node) {- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- //node.click();- Vvveb.Builder.selectNode(node);- Vvveb.Builder.loadNodeComponent(node);+ document.querySelector(this.selector).addEventListener("click", function (e) {+ let element = e.target.closest(":scope > div .controls");+ if (element) {+ let node = e.currentTarget.parentNode._node;+ if (node) {+ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ //node.click();+ Vvveb.Builder.selectNode(node);+ Vvveb.Builder.loadNodeComponent(node);+ }+ }+ });++ document.querySelector(this.selector).addEventListener("dblclick", function (e) {+ let element = e.target.closest(":scope > div");+ if (element) {+ node = e.currentTarget._node;+ node.click();+ }+ });+++ document.querySelector(this.selector).addEventListener("click", function (e) {+ let element = e.target.closest("li[data-component] label");+ if (element) {+ let node = e.currentTarget.parentNode._node;+ if (node) {+ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ node.click();+ }}- }).on("dblclick", "> div", function (e) {- node = $(e.currentTarget).data("node");- node.click();});+ document.querySelector(this.selector).addEventListener("mouseenter", function (e) {+ let element = e.target.closest("li[data-component] label");+ if (element) {+ node = document.querySelector(e.currentTarget.parentNode._node);+ node.css("outline","1px dashed blue");+ }+ });- $(this.selector).on("click", "li[data-component] label ", function (e) {- node = $(e.currentTarget.parentNode).data("node");- if (node) {- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- node.click();+ document.querySelector(this.selector).addEventListener("mouseleave", function (e){+ let element = e.target.closest("li[data-component] label");+ if (element) {+ node = document.querySelector(e.currentTarget.parentNode._node);+ node.css("outline","");+ if (node.getAttribute("style") == "") node.removeAttribute("style");}- }).on("mouseenter", "li[data-component] label", function (e) {- node = $($(e.currentTarget.parentNode).data("node"));- node.css("outline","1px dashed blue");- }).on("mouseleave", "li[data-component] label", function (e){- node = $($(e.currentTarget.parentNode).data("node"));- node.css("outline","");- if (node.attr("style") == "") node.removeAttr("style");});- $(this.selector).on("dragstart", "> div", this.dragStart);- $(this.selector).on("dragover", "> div", this.dragOver);- $(this.selector).on("dragend", "> div", this.dragEnd);+ document.querySelector(this.selector).addEventListener("dragstart", this.dragStart);+ document.querySelector(this.selector).addEventListener("dragover", this.dragOver);+ document.querySelector(this.selector).addEventListener("dragend", this.dragEnd);- $(this.selector).on("click", ".delete-btn", function (e) {- var section = $(e.currentTarget).parents(".section-item");- var node = section.data("node");- node.remove();- section.remove();-- e.stopPropagation();- e.preventDefault();+ document.querySelector(this.selector).addEventListener("click", function (e) {+ let element = e.target.closest(".delete-btn");+ if (element) {+ let section = e.currentTarget.closest(".section-item");+ let node = section._node;+ node.remove();+ section.remove();++ e.stopPropagation();+ e.preventDefault();+ }});- $(".sections-list").on("mouseenter", "li[data-section]", function (e) {- var src = $("img", this).attr("src");- $(".block-preview img").attr("src", src ).show();- }).on("mouseleave", "li[data-section]", function (e) {- $(".block-preview img").attr("src", "").hide();+ document.querySelector(".sections-list").addEventListener("mouseenter", function (e) {+ let element = e.target.closest("li[data-section]");+ if (element) {+ let src = document.querySelector("img", this).getAttribute("src");+ document.querySelector(".block-preview img").setAttribute("src", src ).style.display = "";+ }+ })++ document.querySelector(".sections-list").addEventListener("mouseleave", function (e) {+ let element = e.target.closest("li[data-section]");+ if (element) {+ document.querySelector(".block-preview img").setAttribute("src", "").style.display = "none";+ }});/*- $(this.selector).on("click", ".up-btn", function (e) {- var section = $(e.currentTarget).parents(".section-item");- var node = section.data("node");+ document.querySelector(this.selector).addEventListener("click", ".up-btn", function (e) {+ let section = e.currentTarget.closest(".section-item");+ let node = section._node;Vvveb.Builder.moveNodeUp(node);- Vvveb.Builder.moveNodeUp(section.get(0));+ Vvveb.Builder.moveNodeUp(section);e.preventDefault();});- $(this.selector).on("click", ".down-btn", function (e) {- var section = $(e.currentTarget).parents(".section-item");- var node = section.data("node");+ document.querySelector(this.selector).addEventListener("click", ".down-btn", function (e) {+ let section = e.currentTarget.closest(".section-item");+ let node = section._node;Vvveb.Builder.moveNodeDown(node);- Vvveb.Builder.moveNodeDown(section.get(0));+ Vvveb.Builder.moveNodeDown(section);e.preventDefault();});*/- var self = this;- $("#sections .sections-list").on("click", " .add-section-btn", function (e) {- var section = Vvveb.Sections.get(this.parentNode.dataset.type);- var node = $(section.html);- var sectionType = node[0].tagName.toLowerCase();- var afterSection = $("> " + sectionType + ":last", Vvveb.Builder.frameBody);-- if (afterSection.length) {- afterSection.after(node);- } else {- if (sectionType == "nav") {- afterSection = $("> nav:first,> header:first", Vvveb.Builder.frameBody);-- if (afterSection.length) {- afterSection.before(node);- } else {- $(Vvveb.Builder.frameBody).append(node);- }- } else if (sectionType != "footer") {- afterSection = $("body > footer:last", Vvveb.Builder.frameBody);-- if (afterSection.length) {- afterSection.before(node);+ let self = this;+ document.querySelector(".sections-list").addEventListener("click", function (e) {+ let element = e.target.closest(".add-section-btn");+ if (element) {+ let item = element.closest("li");+ let section = Vvveb.Sections.get(item.dataset.type);+ let node = generateElements(section.html)[0];+ let sectionType = node.tagName.toLowerCase();+ let afterSection = Vvveb.Builder.frameBody.querySelector(":scope > " + sectionType + ":last-of-type");++ if (afterSection) {+ afterSection.after(node);+ } else {+ if (sectionType == "nav") {+ afterSection = Vvveb.Builder.frameBody.querySelector(":scope > nav:first,> header:last-of-type");++ if (afterSection) {+ afterSection.before(node);+ } else {+ Vvveb.Builder.frameBody.append(node);+ }+ } else if (sectionType != "footer") {+ afterSection = Vvveb.Builder.frameBody.querySelector("body > footer:last-of-type");++ if (afterSection) {+ afterSection.before(node);+ } else {+ Vvveb.Builder.frameBody.append(node);+ }} else {- $(Vvveb.Builder.frameBody).append(node);+ Vvveb.Builder.frameBody.append(node);}- } else {- $(Vvveb.Builder.frameBody).append(node);}- }-- node[0].scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- node.click();- /*- Vvveb.Builder.frameHtml.animate({- scrollTop: $(node).offset().top- }, 1000);-- delay(() => node.click(), 1000);- */--- node = node.get(0);- Vvveb.Undo.addMutation({type: 'childList',- target: node.parentNode,- addedNodes: [node],- nextSibling: node.nextSibling});++ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ //node.click();+ Vvveb.Builder.selectNode(node);+ Vvveb.Builder.loadNodeComponent(node);+ /*+ Vvveb.Builder.frameHtml.animate({+ scrollTop: node.offset().top+ }, 1000);++ delay(() => node.click(), 1000);+ */+++ node = node;+ Vvveb.Undo.addMutation({type: 'childList',+ target: node.parentNode,+ addedNodes: [node],+ nextSibling: node.nextSibling});-- self.loadSections();- Vvveb.TreeList.loadComponents();- Vvveb.TreeList.selectComponent(node);++ self.loadSections();+ Vvveb.TreeList.loadComponents();+ Vvveb.TreeList.selectComponent(node);- e.preventDefault();+ e.preventDefault();+ }});- $(this.selector).on("click", ".properties-btn", function (e) {- var section = $(e.currentTarget).parents(".section-item");- var node = section.data("node");- node.click();-- e.preventDefault();+ document.querySelector(this.selector).addEventListener("click", function (e) {+ let element = e.target.closest(".properties-btn");+ if (element) {+ let section = element.closest(".section-item");+ let node = section._node;+ node.click();++ e.preventDefault();+ }});},getSections: function() {- var sections = [];- var sectionList =- $('> section, > header, > footer, > main, > nav', window.FrameDocument.body);+ let sections = [];+ let sectionList =+ window.FrameDocument.body.querySelectorAll(':scope > section, :scope > header, :scope > footer, :scope > main, :scope > nav');- sectionList.each(function (i, node) {- var id = node.id ? node.id : (node.title ? node.title : node.className);+ sectionList.forEach(function (node, i) {+ let id = node.id ? node.id : (node.title ? node.title : node.className);if (!id) {id = 'section-' + Math.floor(Math.random() * 10000);}- var section = {+ let section = {name: id.replace(/[^\w+]+/g,' '),id: node.id,type: node.tagName.toLowerCase(),@@ -3016,26 +3113,26 @@ Vvveb.SectionList = {loadComponents: function(sectionListItem, section, allowedComponents = {}) {- var tree = [];+ let tree = [];getNodeTree(section, tree, allowedComponents);- var html = drawComponentsTree(tree);- $("ol", sectionListItem).replaceWith(html);+ let html = drawComponentsTree(tree);+ document.querySelector("ol", sectionListItem).replaceWith(html);},addSection: function(data) {- var section = $(tmpl("vvveb-section", data));- section.data("node", data.node);- $(this.selector).append(section);+ let section = generateElements(tmpl("vvveb-section", data))[0];+ section._node = data.node;+ document.querySelector(this.selector).append(section);//this.loadComponents(section, data.node, this.allowedComponents);},loadSections: function() {- var sections = this.getSections();+ let sections = this.getSections();- $(this.selector).html("");+ document.querySelector(this.selector).replaceChildren();for (i in sections) {this.addSection(sections[i]);}@@ -3044,58 +3141,69 @@ Vvveb.SectionList = {//drag and dropdragOver: function(e) {- if (e.target != dragover &&- e.target.className == "section-item") {+ let element = e.target.closest("div");+ if (element) {+ if (e.target != dragover &&+ e.target.className == "section-item") {- if (dragover) {- dragover.classList.remove("drag-over");+ if (dragover) {+ dragover.classList.remove("drag-over");+ }+ dragover = e.target;+ dragover.classList.add("drag-over");}- dragover = e.target;- dragover.classList.add("drag-over");}},dragEnd: function (e) {+ let element = e.target.closest("div");+ if (element) {- if (dragover) {- var parent = selected.parentNode;- var selectedNode = $(selected).data("node");- var replaceNode = $(dragover).data("node");-- if ((dragover.offsetTop > selected.offsetTop)) {- //replace section item list- parent.insertBefore(selected, dragover.nextElementSibling);- //replace section- replaceNode.parentNode.insertBefore(selectedNode, replaceNode.nextElementSibling);- } else {- //replace section item list- parent.insertBefore(selected, dragover);- //replace section- replaceNode.parentNode.insertBefore(selectedNode, replaceNode);+ if (dragover) {+ let parent = selected.parentNode;+ let selectedNode = selected._node;+ let replaceNode = dragover._node;++ if ((dragover.offsetTop > selected.offsetTop)) {+ //replace section item list+ parent.insertBefore(selected, dragover.nextElementSibling);+ //replace section+ replaceNode.parentNode.insertBefore(selectedNode, replaceNode.nextElementSibling);+ } else {+ //replace section item list+ parent.insertBefore(selected, dragover);+ //replace section+ replaceNode.parentNode.insertBefore(selectedNode, replaceNode);+ }++ dragover.classList.remove("drag-over");++ let node = selectedNode;++ self.dragMoveMutation = {type: 'move',+ target: node,+ oldParent: node.parentNode,+ oldNextSibling: node.nextSibling};+}-- dragover.classList.remove("drag-over");-- var node = selectedNode.get(0);-- self.dragMoveMutation = {type: 'move',- target: node,- oldParent: node.parentNode,- oldNextSibling: node.nextSibling};-- }- selected = null- dragover = null+ selected = null;+ dragover = null;+ }},dragStart: function (e) {- selected = e.target+ let element = e.target.closest("div");+ if (element) {+ selected = e.target+ }},}Vvveb.TreeList = {selector: '#tree-list',++ container: null,tree: [],@@ -3103,17 +3211,18 @@ Vvveb.TreeList = {init: function() {// header move- let div = document.querySelector(this.selector);- let header = document.querySelector(this.selector + " .header");+ this.container = document.querySelector(this.selector);+ let header = this.container.querySelector(".header");let isDown = false;let offset = [0,0];+ let self = this;header.addEventListener('mousedown', function(e) {if (e.which == 1) {//left clickisDown = true;offset = [- div.offsetLeft - e.clientX,- div.offsetTop - e.clientY+ self.container.offsetLeft - e.clientX,+ self.container.offsetTop - e.clientY];}}, true);@@ -3125,40 +3234,42 @@ Vvveb.TreeList = {document.addEventListener('mousemove', function(event) {if (isDown) {event.preventDefault();- div.style.left = (event.clientX + offset[0]) + 'px';- div.style.top = (event.clientY + offset[1]) + 'px';+ let left = Math.max(event.clientX + offset[0], 0);+ let top = Math.max(event.clientY + offset[1], 0);+ if (left >= 0 && (left < (window.innerWidth - self.container.clientWidth))) self.container.style.left = left + "px";+ if (top >= 0 && (top < (window.innerHeight - self.container.clientHeight))) self.container.style.top = top + "px";}- }, true);--- //components click- $(this.selector).on("click", "> div .controls", function (e) {- var node = $(e.currentTarget.parentNode).data("node");- if (node) {+ });++ document.querySelector(this.selector).addEventListener("click", function (e) {+ let element = e.target.closest("li[data-component]");+ if (element) {+ node = element._treeNode;node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});//node.click();Vvveb.Builder.selectNode(node);Vvveb.Builder.loadNodeComponent(node);++ document.querySelector(self.selector + " .active")?.classList.remove("active");+ element.querySelector("label").classList.add("active");}- }).on("dblclick", "> div", function (e) {- node = $(e.currentTarget).data("node");- //node.click();- Vvveb.Builder.selectNode(node);- Vvveb.Builder.loadNodeComponent(node);- });+ })+ document.querySelector(this.selector).addEventListener("mouseenter", function (e) {+ let element = e.target.closest("li[data-component]");+ if (element) {+ node = element._treeNode;+ node.css("outline","1px dashed blue");+ }+ })- $(this.selector).on("click", "li[data-component] label ", function (e) {- node = $(e.currentTarget.parentNode).data("node");- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- node.click();- }).on("mouseenter", "li[data-component] label", function (e) {- node = $($(e.currentTarget.parentNode).data("node"));- node.css("outline","1px dashed blue");- }).on("mouseleave", "li[data-component] label", function (e){- node = $($(e.currentTarget.parentNode).data("node"));- node.css("outline","");- if (node.attr("style") == "") node.removeAttr("style");+ document.querySelector(this.selector).addEventListener("mouseleave", function (e){+ let element = e.target.closest("li[data-component]");+ if (element) {+ node = element._treeNode;+ node.css("outline","");+ if (node.getAttribute("style") == "") node.removeAttribute("style");+ }});},@@ -3175,10 +3286,10 @@ Vvveb.TreeList = {if (id) {let element = document.getElementById("id" + id);- $(this.selector + " .active").removeClass("active");+ this.container.querySelector(".active")?.classList.remove("active");//collapse all- let checkboxes = document.querySelectorAll(this.selector + " input[type=checkbox]:checked");- for (var i = 0, len = checkboxes.length; i < len; i++) {+ let checkboxes = this.container.querySelectorAll("input[type=checkbox]:checked");+ for (let i = 0, len = checkboxes.length; i < len; i++) {checkboxes[i].checked = false;let label = checkboxes[i].labels[0];if (label) {@@ -3208,16 +3319,17 @@ Vvveb.TreeList = {},loadComponents: function() {- let list = $(this.selector + " .tree > ol");+ let list = this.container.querySelector(".tree > ol");//if navigator not visible don't load- if (list[0].offsetParent === null) return;+ if (list.offsetParent === null) return;this.tree = [];this.idToNode = {};getNodeTree(window.FrameDocument.body, this.tree, {}, this.idToNode);- var html = drawComponentsTree(this.tree);- $(this.selector + " .tree > ol").replaceWith(html);+ let ol = drawComponentsTree(this.tree);+ list.replaceWith(ol);+ //list.replaceWith(html);},}@@ -3230,111 +3342,135 @@ Vvveb.FileManager = {init: function(allowedComponents = {}) {this.allowedComponents = allowedComponents;- this.tree = $("#filemanager .tree > ol").html("");+ this.tree = document.querySelector("#filemanager .tree > ol");+ this.tree.replaceChildren();- $(this.tree).on("click", "a", function (e) {- e.preventDefault();- return false;+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest("a");+ if (element) {+ e.preventDefault();+ return false;+ }});- $(this.tree).on("click", ".delete", function (e) {- let element = $(e.target).closest("li");- Vvveb.FileManager.deletePage(element, e);- e.preventDefault();- return false;+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest(".delete");+ if (element) {+ Vvveb.FileManager.deletePage(element.closest("li"), e);+ e.preventDefault();+ return false;+ }});- $(this.tree).on("click", ".rename", function (e) {- let element = $(e.target).closest("li");- Vvveb.FileManager.renamePage(element, e, false);- e.preventDefault();- return false;+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest(".rename");+ if (element) {+ Vvveb.FileManager.renamePage(element.closest("li"), e, false);+ e.preventDefault();+ return false;+ }});- $(this.tree).on("click", ".duplicate", function (e) {- let element = $(e.target).closest("li");- Vvveb.FileManager.renamePage(element, e, true);- e.preventDefault();- return false;+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest(".duplicate");+ if (element) {+ Vvveb.FileManager.renamePage(element.closest("li"), e, true);+ e.preventDefault();+ return false;+ }});- $(this.tree).on("click", "li[data-page] label", function (e) {- var page = $(this.parentNode).data("page");- if (page) Vvveb.FileManager.loadPage(page, allowedComponents);- return false;- })+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest("li[data-page] label");+ if (element) {+ let page = element.parentNode.dataset.page;+ if (page) Vvveb.FileManager.loadPage(page, allowedComponents);+ return false;+ }+ });- $(this.tree).on("click", "li[data-component] label ", function (e) {- node = $(e.currentTarget.parentNode).data("node");- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- node.click();-- }).on("mouseenter", "li[data-component] label", function (e) {-- node = $(e.currentTarget.parentNode).data("node");- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest("li[data-component] label");+ if (element) {+ node = e.currentTarget.parentNode._node;+ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ node.click();+ }+ });++ this.tree.addEventListener("mouseenter", function (e) {+ let element = event.target.closest("li[data-component] label");+ if (element) {+ node = e.currentTarget.parentNode._node;+ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});- $(node).trigger("mousemove");-+ node.dispatchEvent(new MouseEvent("mousemove", {+ bubbles: true,+ cancelable: true,+ }));+ //node.trigger("mousemove");+ }});},deletePage: function(element, e) {- let page = element[0].dataset;+ let page = element.dataset;if (confirm(`Are you sure you want to delete "${page.file}"template?`)) {//allow event to change page or cancel by setting page to false- let result;- if (result = $(window).triggerHandler("vvveb.FileManager.deletePage", page))- if (result != undefined) {- page = result;- }+ window.dispatchEvent(new CustomEvent("vvveb.FileManager.deletePage", {+ detail: page+ }));if (page) {- $.ajax({- type: "POST",- url: deleteUrl,//set your server side save script url- data: {file:page.file},- success: function (data, text) {++ fetch(deleteUrl, {method: "POST", body: JSON.stringify({file:page.file})})+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.text()+ })+ .then((data) => {let bg = "bg-success";if (data.success) {- $("#top-panel .save-btn").attr("disabled", "true");+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.setAttribute("disabled", "true"));} else {bg = "bg-danger";}displayToast(bg, "Delete", data.message ?? data);- },- error: function (data) {- displayToast("bg-danger", "Error", data.responseText);- }+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error deleting page!");});+element.remove();}}},renamePage: function(element, e, duplicate = false) {- let page = element[0].dataset;+ let page = element.dataset;let newfile = prompt(`Enter new file name for "${page.file}"`, page.file);let _self = this;if (newfile) {//allow event to change page or newfile or cancel by setting page to false- let result;- if (result = $(window).triggerHandler("vvveb.FileManager.renamePage", [page, newfile])) {- [page, newfile] = result;- }+ window.dispatchEvent(new CustomEvent("vvveb.FileManager.renamePage", {+ detail: {page, newfile}+ }));if (page) {- $.ajax({- type: "POST",- url: renameUrl,//set your server side save script url- data: {file:page.file, newfile:newfile, duplicate},- success: function (data) {++ fetch(deleteUrl, {method: "POST", body: JSON.stringify({file:page.file, newfile:newfile, duplicate})})+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.text()+ })+ .then((data) => {let bg = "bg-success";if (data.success) {- $("#top-panel .save-btn").attr("disabled", "true");+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.setAttribute("disabled", "true"));} else {bg = "bg-danger";}@@ -3351,18 +3487,17 @@ Vvveb.FileManager = {} else {_self.pages[page.page]["file"] = newfile;_self.pages[page.page]["title"] = newName;- $("> label span", element).html(newName);+ document.querySelector(":scope > label span", element).innerHTML = newName;page.url = page.url.replace(page.file, newfile);page.file = newfile;_self.pages[page.page]["url"] = page.url;_self.pages[page.page]["file"] = page.file;}-- },- error: function (data) {- displayToast("bg-danger", "Error", data.responseText);- }- });+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error deleting page!");+ });}}},@@ -3370,33 +3505,31 @@ Vvveb.FileManager = {addPage: function(name, data) {//allow event to change name or cancel by setting name to false- let result;- if (result = $(window).triggerHandler("vvveb.FileManager.addPage", [name, data])) {- [name, data] = result;- }-+ window.dispatchEvent(new CustomEvent("vvveb.FileManager.addPage", {+ detail: [name, data],+ }));+if (!name) {return false;}-+this.pages[name] = data;data['name'] = name;- var folder = this.tree;- if (data.folder)- {- if (!(folder = this.tree.find('li[data-folder="' + data.folder + '"]')).length)- {+ let folder = this.tree;+ if (data.folder) {+ if ((data.folder && data.folder != "/") && !(folder = folder.querySelector('li[data-folder="' + data.folder + '"]'))) {data.folderTitle = data.folder[0].toUpperCase() + data.folder.slice(1);- folder = $(tmpl("vvveb-filemanager-folder", data));+ folder = generateElements(tmpl("vvveb-filemanager-folder", data))[0];this.tree.append(folder);}-- folder = folder.find("> ol");++ folder = folder.querySelector("ol");}- folder.append(- tmpl("vvveb-filemanager-page", data));+ let page = generateElements(tmpl("vvveb-filemanager-page", data))[0];+ folder.append(page);+ return page;},addPages: function(pages) {@@ -3406,17 +3539,17 @@ Vvveb.FileManager = {},addComponent: function(name, url, title, page) {- $("[data-page='" + page + "'] > ol", this.tree).append(+ document.querySelector("[data-page='" + page + "'] > ol", this.tree).append(tmpl("vvveb-filemanager-component", {name:name, url:url, title:title}));},loadComponents: function(allowedComponents = {}) {- var tree = [];+ let tree = [];getNodeTree(window.FrameDocument.body, tree, allowedComponents);- var html = drawComponentsTree(tree);- $("[data-page='" + this.currentPage + "'] > ol", this.tree).replaceWith(html);+ let html = drawComponentsTree(tree);+ document.querySelector("[data-page='" + this.currentPage + "'] > ol", this.tree).replaceWith(html);},getCurrentUrl: function() {@@ -3429,20 +3562,19 @@ Vvveb.FileManager = {return this.currentPage;},- getPageData: function(key) {+ getPageData: function(key) {if (this.currentPage) {return this.pages[this.currentPage][key];}},- getCurrentFileName: function() {- if (this.currentPage)- {- var folder = this.pages[this.currentPage]['folder'];- folder = folder ? folder + '/': '';- return folder + this.pages[this.currentPage]['file'];- }+ getCurrentFileName: function() {+ if (this.currentPage) {+ let folder = this.pages[this.currentPage]['folder'];+ folder = folder ? folder + '/': '';+ return folder + this.pages[this.currentPage]['file'];+ }},reloadCurrentPage: function() {@@ -3457,23 +3589,24 @@ Vvveb.FileManager = {return;}- let page = $("[data-page='" + name + "']", this.tree);+ let page = this.tree.querySelector("[data-page='" + name + "']");//remove active from current active page- $("[data-page]", this.tree).removeClass("active");+ this.tree.querySelector("[data-page].active")?.classList.remove("active");//set loaded page as active- page.addClass("active");+ page.classList.add("active");//open parent folder if closed- $("> input[type=checkbox]", $(page).parents("[data-folder]")).prop("checked", true);+ page.closest("[data-folder]")?.querySelector("input[type=checkbox]").setAttribute("checked", true);this.currentPage = name;- $(".btn-preview-url").attr("href", url);+ document.querySelector(".btn-preview-url").setAttribute("href", url);//allow event to change page or url or cancel by setting url to false- let result;- if (result = $(window).triggerHandler("vvveb.FileManager.loadPage", [name, url, this.pages[name]])) {- [name, url, this.pages[name]] = result;- }-+ let self = this;++ window.dispatchEvent(new CustomEvent("vvveb.FileManager.loadPage", {+ detail: self.pages[name],+ }));+if (url) {Vvveb.Builder.loadUrl(url + (disableCache ? (url.indexOf('?') > -1 ? '&r=':'?r=') + Math.random():''),function () {@@ -3486,9 +3619,8 @@ Vvveb.FileManager = {}},- scrollBottom: function() {- var scroll = this.tree.parent();- scroll.scrollTop(scroll.prop("scrollHeight"));+ scrollToPage: function(page) {+ page.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});},}@@ -3496,48 +3628,50 @@ Vvveb.Breadcrumb = {tree:false,init: function() {- this.tree = $(".breadcrumb-navigator > .breadcrumb").html("");+ this.tree = document.querySelector(".breadcrumb-navigator > .breadcrumb");+ this.tree.replaceChildren();- $(this.tree).on("click", ".breadcrumb-item", function (e) {- let node = $(this).data("node");- if (node) {- node.click();- node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ this.tree.addEventListener("click", function (e) {+ let element = event.target.closest(".breadcrumb-item");+ if (element) {+ let node = element._node;+ if (node) {+ //node.click();+ Vvveb.Builder.selectNode(node);+ Vvveb.Builder.loadNodeComponent(node);+ node.scrollIntoView({behavior: "smooth", block: "center", inline: "center"});+ }++ e.preventDefault();}+ });++ let currentHoverNode;+ this.tree.addEventListener("mousemove", function (e) {+ if (event.target == currentHoverNode) return;+ currentHoverNode = event.target;- $(window).triggerHandler("vvveb.Breadcrumb.click", node);-- e.preventDefault();- }).on("mouseenter", ".breadcrumb-item", function (e) {- let node = $($(this).data("node"));- node.get(0).dispatchEvent(new MouseEvent("mousemove", {- bubbles: true,- cancelable: true,- }));-- $(window).triggerHandler("vvveb.Breadcrumb.hover", node);- //node.css("outline","1px dashed blue");- /*- $(node).trigger("mousemove");- */-- })/*.on("mouseleave", ".breadcrumb-item", function (e){- let node = $($(this).data("node"));- node.css("outline","");- if (node.attr("style") == "") node.removeAttr("style");- });*/+ let element = event.target.closest(".breadcrumb-item");+ if (element) {+ let node = element._node;+ node.dispatchEvent(new MouseEvent("mousemove", {+ bubbles: true,+ cancelable: true,+ }));+ }+ })},addElement: function(data, element) {- var li = $(tmpl("vvveb-breadcrumb-navigaton-item", data));- li.data("node", element);- $(this.tree).prepend(li);+ let li = generateElements(tmpl("vvveb-breadcrumb-navigaton-item", data))[0];+ li._node = element;+ this.tree.prepend(li);},loadBreadcrumb: function(element) {- this.tree.html("");- var currentElement = element;+ this.tree.replaceChildren();+ let currentElement = element;while (currentElement.parentElement) {let elementType = Vvveb.Builder._getElementType(currentElement);@@ -3557,14 +3691,15 @@ Vvveb.Breadcrumb = {Vvveb.Revisions = {updateRevisionsDropdown: function (revisions) {- let dropdown = $(".revisions-dropdown").html("");+ let dropdown = document.querySelector(".revisions-dropdown");let count = Object.keys(revisions).length;- $(".revisions-count").html(count);+ document.querySelector(".revisions-count").innerHTML = count;+ dropdown.replaceChildren();for (let i in revisions) {let revision = revisions[i];//revision['url'] = '' + revision['file'] + ".html";- dropdown.append(tmpl('vvveb-revision-item', revision));+ dropdown.append(generateElements(tmpl('vvveb-revision-item', revision))[0]);}},@@ -3572,75 +3707,105 @@ Vvveb.Revisions = {let self = this;if (template) {- $.ajax({- type: "GET",- url: revisionsUrl,- data: {template},- }).done(function (data) {- self.updateRevisionsDropdown(data);- }).fail(function (data) {- alert(data.responseText);+ fetch(revisionsUrl + "&" + new URLSearchParams({template}))+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.json()+ })+ .then((data) => {+ self.updateRevisionsDropdown(data);+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error loading revision!");});}},init: function () {let self = this;- $(window).on("vvveb.FileManager.loadPage", function(event, name, url, data) {++ window.addEventListener("vvveb.FileManager.loadPage", function(event) {+ let data = event.detail;self.loadRevisions(data['file'] ?? false);- return [name, url, data];});- $(".revisions-dropdown").on("click", ".btn-revision-load", function (event) {- let file = this.dataset.file;+ document.querySelector(".revisions-dropdown").addEventListener("click", function (event) {+ let element = event.target.closest(".btn-revision-load");+ if (element) {++ let file = element.dataset.file;- if (file) {- $.ajax({- type: "POST",- url: revisionLoadUrl,//set your server side save script url- data: {file},- success: function (data, text) {+ if (file) {+ fetch(revisionLoadUrl, {+ method: "POST",+ headers: {+ 'Content-Type': 'application/x-www-form-urlencoded',+ },+ body: new URLSearchParams({file})+ })+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.text()+ })+ .then((data) => {Vvveb.Builder.setHtml(data);displayToast("bg-success", "Load", "Revision loaded");- $("#top-panel .save-btn").removeAttr("disabled");- },- error: function (data) {- displayToast("bg-danger", "Error", data.responseText);- }- });++ Vvveb.Builder.frameBody.querySelectorAll("[data-aos]").forEach(e => e.classList.add("aos-init","aos-animate"));+ document.querySelectorAll("#top-panel .save-btn").forEach(e => e.removeAttribute("disabled"));++ Vvveb.SectionList.loadSections();+ Vvveb.TreeList.loadComponents();+ Vvveb.StyleManager.init();+ Vvveb.ChangeManager.setOriginalContent();+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error loading revisions!");+ });+ }}});- $(".revisions-dropdown").on("click", ".btn-revision-delete", function (event) {+ document.querySelector(".revisions-dropdown").addEventListener("click", function (event) {if (confirm("Are you sure?")) {+ let element = event.target.closest(".btn-revision-delete");+ if (element) {++ let item = element.closest(".dropdown-item");+ let file = element.dataset.file;++ if (file) {+ fetch(revisionDeleteUrl, {+ method: "POST",+ headers: {+ 'Content-Type': 'application/x-www-form-urlencoded',+ },+ body: new URLSearchParams({file})+ })+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.json()+ })+ .then((data) => {+ let bg = "bg-success";+ if (data.success) {+ item.remove();+ } else {+ bg = "bg-danger";+ }- let item = $(this).parents(".dropdown-item");- let file = this.dataset.file;-- if (file) {- $.ajax({- type: "POST",- url: revisionDeleteUrl,//set your server side save script url- data: {file},- success: function (data, text) {- let bg = "bg-success";- if (data.success) {- item.remove();- } else {- bg = "bg-danger";- }-- displayToast(bg, "Delete", data.message ?? data);-- $(".revisions-count").html(function (i, html) {- let count = parseInt(html);- return Math.max(0, count - 1);- });- },- error: function (data) {- displayToast("bg-danger", "Error", data.responseText);- }- });+ displayToast(bg, "Delete", data.message ?? data);++ let count = document.querySelector(".revisions-count");+ count.innerHTML = Math.max(0, parseInt(count.innerHTML) - 1);+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error deleting revision!");+ });+ }}}});@@ -3688,6 +3853,22 @@ Vvveb.FontsManager = {};+Vvveb.ColorPalette = {+ colors: {},++ getAll: function() {+ return this.colors;+ },++ add: function(name, color) {+ this.colors[name] = color;+ },++ remove: function(color) {+ delete this.colors[name];+ },+}+function friendlyName(name) {name = name.replaceAll("--bs-","").replaceAll("-", " ").trim();return name = name[0].toUpperCase() + name.slice(1);@@ -3703,14 +3884,14 @@ Vvveb.ColorPaletteManager = {getAllCSSVariableNames: function (styleSheets = document.styleSheets, selector){- for(var i = 0; i < styleSheets.length; i++){+ for(let i = 0; i < styleSheets.length; i++){try{let cssRules = styleSheets[i].cssRules;- for( var j = 0; j < cssRules.length; j++){+ for( let j = 0; j < cssRules.length; j++){try{let style = cssRules[j].style;if (selector && cssRules[j].selectorText && cssRules[j].selectorText != selector) continue;- for(var k = 0; k < style.length; k++){+ for(let k = 0; k < style.length; k++){let name = style[k];let value = style.getPropertyValue(name).trim();let type = "";@@ -3752,15 +3933,15 @@ Vvveb.ColorPaletteManager = {let cssVars = {};let css = "";let cssStyles = "";- for(var i = 0; i < styleSheets.length; i++){+ for(let i = 0; i < styleSheets.length; i++){try{let cssRules = styleSheets[i].cssRules;- for( var j = 0; j < cssRules.length; j++){+ for( let j = 0; j < cssRules.length; j++){try{let style = cssRules[j].style;//if (selector && cssRules[j].selectorText && cssRules[j].selectorText != selector) continue;cssStyles = "";- for(var k = 0; k < style.length; k++){+ for(let k = 0; k < style.length; k++){let name = style[k];let value = style.getPropertyValue(name);if(name.startsWith('--bs-btn-')) {@@ -3786,8 +3967,19 @@ Vvveb.ColorPaletteManager = {},init: function(document) {- Vvveb.Builder.selectedEl = $(document.body);Vvveb.Components.render("config/bootstrap", "#configuration .component-properties");++ //apply current theme color palette+ //let colors = Vvveb.ColorPaletteManager.getType("color");+ let colors = this.cssVars.color;+ for (const name in colors) {+ let color = colors[name].value;++ if (color[0] == "#" && color.length == 7) {//add only valid hex color values 7 char long+ //add color as name to keep values unique+ Vvveb.ColorPalette.add(color, color);+ }+ }},};@@ -3836,10 +4028,6 @@ function launchFullScreen(document) {}}-$.ajaxSetup({- cache: true-});-let fontList = [{value: "",text: "Default"diff --git a/public/js/vvvebjs/components-bootstrap4.js b/public/js/vvvebjs/components-bootstrap4.jsdeleted file mode 100755index 5093130..0000000--- a/public/js/vvvebjs/components-bootstrap4.js+++ /dev/null@@ -1,2458 +0,0 @@-/*-Copyright 2017 Ziadin Givan--Licensed under the Apache License, Version 2.0 (the "License");-you may not use this file except in compliance with the License.-You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0--Unless required by applicable law or agreed to in writing, software-distributed under the License is distributed on an "AS IS" BASIS,-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-See the License for the specific language governing permissions and-limitations under the License.--https://github.com/givanz/Vvvebjs-*/--bgcolorClasses = ["bg-primary", "bg-secondary", "bg-success", "bg-danger", "bg-warning", "bg-info", "bg-light-subtle", "bg-dark", "bg-white"]--bgcolorSelectOptions =-[{- value: "Default",- text: ""-},-{- value: "bg-primary",- text: "Primary"-}, {- value: "bg-secondary",- text: "Secondary"-}, {- value: "bg-success",- text: "Success"-}, {- value: "bg-danger",- text: "Danger"-}, {- value: "bg-warning",- text: "Warning"-}, {- value: "bg-info",- text: "Info"-}, {- value: "bg-light-subtle",- text: "Light"-}, {- value: "bg-dark",- text: "Dark"-}, {- value: "bg-white",- text: "White"-}];--function changeNodeName(node, newNodeName)-{- var newNode;- newNode = document.createElement(newNodeName);- attributes = node.get(0).attributes;-- for (i = 0, len = attributes.length; i < len; i++) {- newNode.setAttribute(attributes[i].nodeName, attributes[i].nodeValue);- }-- $(newNode).append($(node).contents());- $(node).replaceWith(newNode);-- return newNode;-}--Vvveb.ComponentsGroup['Bootstrap 4'] =-["html/container", "html/gridrow", "html/button", "html/buttongroup", "html/buttontoolbar", "html/heading", "html/image", "html/jumbotron", "html/alert", "html/card", "html/listgroup", "html/hr", "html/taglabel", "html/badge", "html/progress", "html/navbar", "html/breadcrumbs", "html/pagination", "html/form", "html/textinput", "html/textareainput", "html/selectinput", "html/fileinput", "html/checkbox", "html/radiobutton", "html/table", "html/paragraph", "html/link", "html/video", "html/button"];---var base_sort = 100;//start sorting for base component from 100 to allow extended properties to be first-var style_section = 'style';--Vvveb.Components.add("_base", {- name: "Element",- properties: [{- key: "element_header",- inputtype: SectionInput,- name:false,- sort:base_sort++,- data: {header:"General"},- }, {- name: "Id",- key: "id",- htmlAttr: "id",- sort: base_sort++,- inline:true,- col:6,- inputtype: TextInput- }, {- name: "Class",- key: "class",- htmlAttr: "class",- sort: base_sort++,- inline:true,- col:6,- inputtype: TextInput- }- ]-});--//display-Vvveb.Components.extend("_base", "_base", {- properties: [- {- key: "display_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Display"},- }, {- name: "Display",- key: "display",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: SelectInput,- validValues: ["block", "inline", "inline-block", "none"],- data: {- options: [{- value: "block",- text: "Block"- }, {- value: "inline",- text: "Inline"- }, {- value: "inline-block",- text: "Inline Block"- }, {- value: "none",- text: "none"- }]- }- }, {- name: "Position",- key: "position",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: SelectInput,- validValues: ["static", "fixed", "relative", "absolute"],- data: {- options: [{- value: "static",- text: "Static"- }, {- value: "fixed",- text: "Fixed"- }, {- value: "relative",- text: "Relative"- }, {- value: "absolute",- text: "Absolute"- }]- }- }, {- name: "Top",- key: "top",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- parent:"",- inputtype: CssUnitInput- }, {- name: "Left",- key: "left",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- parent:"",- inputtype: CssUnitInput- }, {- name: "Bottom",- key: "bottom",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- parent:"",- inputtype: CssUnitInput- }, {- name: "Right",- key: "right",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- parent:"",- inputtype: CssUnitInput- },{- name: "Float",- key: "float",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- inputtype: RadioButtonInput,- data: {- extraclass:"btn-group-sm btn-group-fullwidth",- options: [{- value: "none",- icon:"la la-times",- //text: "None",- title: "None",- checked:true,- }, {- value: "left",- //text: "Left",- title: "Left",- icon:"la la-align-left",- checked:false,- }, {- value: "right",- //text: "Right",- title: "Right",- icon:"la la-align-right",- checked:false,- }],- }- }, {- name: "Opacity",- key: "opacity",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- parent:"",- inputtype: RangeInput,- data:{- max: 1, //max zoom level- min:0,- step:0.1- },- }, {- name: "Background Color",- key: "background-color",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- htmlAttr: "style",- inputtype: ColorInput,- }, {- name: "Text Color",- key: "color",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- htmlAttr: "style",- inputtype: ColorInput,- }]-});--//Typography-Vvveb.Components.extend("_base", "_base", {- properties: [- {- key: "typography_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Typography"},-- }, {- name: "Font size",- key: "font-size",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Font weight",- key: "font-weight",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "100",- text: "Thin"- }, {- value: "200",- text: "Extra-Light"- }, {- value: "300",- text: "Light"- }, {- value: "400",- text: "Normal"- }, {- value: "500",- text: "Medium"- }, {- value: "600",- text: "Semi-Bold"- }, {- value: "700",- text: "Bold"- }, {- value: "800",- text: "Extra-Bold"- }, {- value: "900",- text: "Ultra-Bold"- }],- }- }, {- name: "Font family",- key: "font-family",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "Arial, Helvetica, sans-serif",- text: "Arial"- }, {- value: '\'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif',- text: 'Lucida Grande'- }, {- value: '\'Palatino Linotype\', \'Book Antiqua\', Palatino, serif',- text: 'Palatino Linotype'- }, {- value: '\'Times New Roman\', Times, serif',- text: 'Times New Roman'- }, {- value: "Georgia, serif",- text: "Georgia, serif"- }, {- value: "Tahoma, Geneva, sans-serif",- text: "Tahoma"- }, {- value: '\'Comic Sans MS\', cursive, sans-serif',- text: 'Comic Sans'- }, {- value: 'Verdana, Geneva, sans-serif',- text: 'Verdana'- }, {- value: 'Impact, Charcoal, sans-serif',- text: 'Impact'- }, {- value: '\'Arial Black\', Gadget, sans-serif',- text: 'Arial Black'- }, {- value: '\'Trebuchet MS\', Helvetica, sans-serif',- text: 'Trebuchet'- }, {- value: '\'Courier New\', Courier, monospace',- text: 'Courier New'- }, {- value: '\'Brush Script MT\', sans-serif',- text: 'Brush Script'- }]- }- }, {- name: "Text align",- key: "text-align",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- inputtype: RadioButtonInput,- data: {- extraclass:"btn-group-sm btn-group-fullwidth",- options: [{- value: "",- icon:"la la-times",- //text: "None",- title: "None",- checked:true,- }, {- value: "left",- //text: "Left",- title: "Left",- icon:"la la-align-left",- checked:false,- }, {- value: "center",- //text: "Center",- title: "Center",- icon:"la la-align-center",- checked:false,- }, {- value: "right",- //text: "Right",- title: "Right",- icon:"la la-align-right",- checked:false,- }, {- value: "justify",- //text: "justify",- title: "Justify",- icon:"la la-align-justify",- checked:false,- }],- },- }, {- name: "Line height",- key: "line-height",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Letter spacing",- key: "letter-spacing",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Text decoration",- key: "text-decoration-line",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- inputtype: RadioButtonInput,- data: {- extraclass:"btn-group-sm btn-group-fullwidth",- options: [{- value: "none",- icon:"la la-times",- //text: "None",- title: "None",- checked:true,- }, {- value: "underline",- //text: "Left",- title: "underline",- icon:"la la-long-arrow-alt-down",- checked:false,- }, {- value: "overline",- //text: "Right",- title: "overline",- icon:"la la-long-arrow-alt-up",- checked:false,- }, {- value: "line-through",- //text: "Right",- title: "Line Through",- icon:"la la-strikethrough",- checked:false,- }, {- value: "underline overline",- //text: "justify",- title: "Underline Overline",- icon:"la la-arrows-alt-v",- checked:false,- }],- },- }, {- name: "Decoration Color",- key: "text-decoration-color",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- htmlAttr: "style",- inputtype: ColorInput,- }, {- name: "Decoration style",- key: "text-decoration-style",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "solid",- text: "Solid"- }, {- value: "wavy",- text: "Wavy"- }, {- value: "dotted",- text: "Dotted"- }, {- value: "dashed",- text: "Dashed"- }, {- value: "double",- text: "Double"- }],- }- }]-})--//Size-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "size_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Size", expanded:false},- }, {- name: "Width",- key: "width",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Height",- key: "height",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Min Width",- key: "min-width",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Min Height",- key: "min-height",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Max Width",- key: "max-width",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Max Height",- key: "max-height",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }]-});--//Margin-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "margins_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Margin", expanded:false},- }, {- name: "Top",- key: "margin-top",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Right",- key: "margin-right",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Bottom",- key: "margin-bottom",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Left",- key: "margin-left",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }]-});--//Padding-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "paddings_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Padding", expanded:false},- }, {- name: "Top",- key: "padding-top",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Right",- key: "padding-right",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Bottom",- key: "padding-bottom",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Left",- key: "padding-left",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }]-});---//Border-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "border_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Border", expanded:false},- }, {- name: "Style",- key: "border-style",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:12,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "solid",- text: "Solid"- }, {- value: "dotted",- text: "Dotted"- }, {- value: "dashed",- text: "Dashed"- }],- }- }, {- name: "Width",- key: "border-width",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Color",- key: "border-color",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- htmlAttr: "style",- inputtype: ColorInput,- }]-});----//Border radius-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "border_radius_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Border radius", expanded:false},- }, {- name: "Top Left",- key: "border-top-left-radius",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Top Right",- key: "border-top-right-radius",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Bottom Left",- key: "border-bottom-left-radius",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }, {- name: "Bottom Right",- key: "border-bottom-right-radius",- htmlAttr: "style",- sort: base_sort++,- section: style_section,- col:6,- inline:true,- inputtype: CssUnitInput- }]-});--//Background image-Vvveb.Components.extend("_base", "_base", {- properties: [{- key: "background_image_header",- inputtype: SectionInput,- name:false,- sort: base_sort++,- section: style_section,- data: {header:"Background Image", expanded:false},- },{- name: "Image",- key: "Image",- sort: base_sort++,- section: style_section,- //htmlAttr: "style",- inputtype: ImageInput,-- init: function(node) {- var image = $(node).css("background-image").replace(/^url\(['"]?(.+)['"]?\)/, '$1');- return image;- },-- onChange: function(node, value) {-- $(node).css('background-image', 'url(' + value + ')');-- return node;- }-- }, {- name: "Repeat",- key: "background-repeat",- sort: base_sort++,- section: style_section,- htmlAttr: "style",- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "repeat-x",- text: "repeat-x"- }, {- value: "repeat-y",- text: "repeat-y"- }, {- value: "no-repeat",- text: "no-repeat"- }],- }- }, {- name: "Size",- key: "background-size",- sort: base_sort++,- section: style_section,- htmlAttr: "style",- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "contain",- text: "contain"- }, {- value: "cover",- text: "cover"- }],- }- }, {- name: "Position x",- key: "background-position-x",- sort: base_sort++,- section: style_section,- htmlAttr: "style",- col:6,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "center",- text: "center"- }, {- value: "right",- text: "right"- }, {- value: "left",- text: "left"- }],- }- }, {- name: "Position y",- key: "background-position-y",- sort: base_sort++,- section: style_section,- htmlAttr: "style",- col:6,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "center",- text: "center"- }, {- value: "top",- text: "top"- }, {- value: "bottom",- text: "bottom"- }],- }- }]-});--Vvveb.Components.extend("_base", "html/container", {- classes: ["container", "container-fluid"],- image: "icons/container.svg",- html: '<div class="container" style="min-height:150px;"><div class="m-5">Container</div></div>',- name: "Container",- properties: [- {- name: "Type",- key: "type",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["container", "container-fluid"],- data: {- options: [{- value: "container",- text: "Default"- }, {- value: "container-fluid",- text: "Fluid"- }]- }- },- {- name: "Background",- key: "background",- htmlAttr: "class",- validValues: bgcolorClasses,- inputtype: SelectInput,- data: {- options: bgcolorSelectOptions- }- },- {- name: "Background Color",- key: "background-color",- htmlAttr: "style",- inputtype: ColorInput,- },- {- name: "Text Color",- key: "color",- htmlAttr: "style",- inputtype: ColorInput,- }],-});--Vvveb.Components.extend("_base", "html/heading", {- image: "icons/heading.svg",- name: "Heading",- nodes: ["h1", "h2","h3", "h4","h5","h6"],- html: "<h1>Heading</h1>",-- properties: [- {- name: "Size",- key: "size",- inputtype: SelectInput,-- onChange: function(node, value) {-- return changeNodeName(node, "h" + value);- },-- init: function(node) {- var regex;- regex = /H(\d)/.exec(node.nodeName);- if (regex && regex[1]) {- return regex[1]- }- return 1- },-- data:{- options: [{- value: "1",- text: "1"- }, {- value: "2",- text: "2"- }, {- value: "3",- text: "3"- }, {- value: "4",- text: "4"- }, {- value: "5",- text: "5"- }, {- value: "6",- text: "6"- }]- },- }]-});-Vvveb.Components.extend("_base", "html/link", {- nodes: ["a"],- name: "Link",- html: '<a href="#" class="d-inline-block"><span>Link</span></a>',- image: "icons/link.svg",- properties: [{- name: "Url",- key: "href",- htmlAttr: "href",- inputtype: LinkInput- }, {- name: "Target",- key: "target",- htmlAttr: "target",- inputtype: TextInput- }]-});-Vvveb.Components.extend("_base", "html/image", {- nodes: ["img"],- name: "Image",- html: '<img src="' + Vvveb.baseUrl + 'icons/image.svg" height="128" width="128">',- /*- afterDrop: function (node)- {- node.attr("src", '');- return node;- },*/- image: "icons/image.svg",- properties: [{- name: "Image",- key: "src",- htmlAttr: "src",- inputtype: ImageInput- }, {- name: "Width",- key: "width",- htmlAttr: "width",- inputtype: TextInput- }, {- name: "Height",- key: "height",- htmlAttr: "height",- inputtype: TextInput- }, {- name: "Alt",- key: "alt",- htmlAttr: "alt",- inputtype: TextInput- }]-});-Vvveb.Components.add("html/hr", {- image: "icons/hr.svg",- nodes: ["hr"],- name: "Horizontal Rule",- html: "<hr>"-});-Vvveb.Components.extend("_base", "html/label", {- name: "Label",- nodes: ["label"],- html: '<label for="">Label</label>',- properties: [{- name: "For id",- htmlAttr: "for",- key: "for",- inputtype: TextInput- }]-});-Vvveb.Components.extend("_base", "html/button", {- classes: ["btn", "btn-link"],- name: "Button",- image: "icons/button.svg",- html: '<button type="button" class="btn btn-primary">Primary</button>',- properties: [{- name: "Link To",- key: "href",- htmlAttr: "href",- inputtype: LinkInput- }, {- name: "Type",- key: "type",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["btn-default", "btn-primary", "btn-info", "btn-success", "btn-warning", "btn-info", "btn-light", "btn-dark", "btn-outline-primary", "btn-outline-info", "btn-outline-success", "btn-outline-warning", "btn-outline-info", "btn-outline-light", "btn-outline-dark", "btn-link"],- data: {- options: [{- value: "btn-default",- text: "Default"- }, {- value: "btn-primary",- text: "Primary"- }, {- value: "btn btn-info",- text: "Info"- }, {- value: "btn-success",- text: "Success"- }, {- value: "btn-warning",- text: "Warning"- }, {- value: "btn-info",- text: "Info"- }, {- value: "btn-light",- text: "Light"- }, {- value: "btn-dark",- text: "Dark"- }, {- value: "btn-outline-primary",- text: "Primary outline"- }, {- value: "btn btn-outline-info",- text: "Info outline"- }, {- value: "btn-outline-success",- text: "Success outline"- }, {- value: "btn-outline-warning",- text: "Warning outline"- }, {- value: "btn-outline-info",- text: "Info outline"- }, {- value: "btn-outline-light",- text: "Light outline"- }, {- value: "btn-outline-dark",- text: "Dark outline"- }, {- value: "btn-link",- text: "Link"- }]- }- }, {- name: "Size",- key: "size",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["btn-lg", "btn-sm"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "btn-lg",- text: "Large"- }, {- value: "btn-sm",- text: "Small"- }]- }- }, {- name: "Target",- key: "target",- htmlAttr: "target",- inputtype: TextInput- }, {- name: "Disabled",- key: "disabled",- htmlAttr: "class",- inputtype: ToggleInput,- validValues: ["disabled"],- data: {- on: "disabled",- off: null- }- }]-});-Vvveb.Components.extend("_base", "html/buttongroup", {- classes: ["btn-group"],- name: "Button Group",- image: "icons/button_group.svg",- html: '<div class="btn-group" role="group" aria-label="Basic example"><button type="button" class="btn btn-secondary">Left</button><button type="button" class="btn btn-secondary">Middle</button> <button type="button" class="btn btn-secondary">Right</button></div>',- properties: [{- name: "Size",- key: "size",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["btn-group-lg", "btn-group-sm"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "btn-group-lg",- text: "Large"- }, {- value: "btn-group-sm",- text: "Small"- }]- }- }, {- name: "Alignment",- key: "alignment",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["btn-group", "btn-group-vertical"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "btn-group",- text: "Horizontal"- }, {- value: "btn-group-vertical",- text: "Vertical"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/buttontoolbar", {- classes: ["btn-toolbar"],- name: "Button Toolbar",- image: "icons/button_toolbar.svg",- html: '<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">\- <div class="btn-group mr-2" role="group" aria-label="First group">\- <button type="button" class="btn btn-secondary">1</button>\- <button type="button" class="btn btn-secondary">2</button>\- <button type="button" class="btn btn-secondary">3</button>\- <button type="button" class="btn btn-secondary">4</button>\- </div>\- <div class="btn-group mr-2" role="group" aria-label="Second group">\- <button type="button" class="btn btn-secondary">5</button>\- <button type="button" class="btn btn-secondary">6</button>\- <button type="button" class="btn btn-secondary">7</button>\- </div>\- <div class="btn-group" role="group" aria-label="Third group">\- <button type="button" class="btn btn-secondary">8</button>\- </div>\- </div>'-});-Vvveb.Components.extend("_base","html/alert", {- classes: ["alert"],- name: "Alert",- image: "icons/alert.svg",- html: '<div class="alert alert-warning alert-dismissible fade show" role="alert">\- <button type="button" class="btn-close" data-dismiss="alert" aria-label="Close">\- <span aria-hidden="true">×</span>\- </button>\- <strong>Holy guacamole!</strong> You should check in on some of those fields below.\- </div>',- properties: [{- name: "Type",- key: "type",- htmlAttr: "class",- validValues: ["alert-primary", "alert-secondary", "alert-success", "alert-danger", "alert-warning", "alert-info", "alert-light", "alert-dark"],- inputtype: SelectInput,- data: {- options: [{- value: "alert-primary",- text: "Default"- }, {- value: "alert-secondary",- text: "Secondary"- }, {- value: "alert-success",- text: "Success"- }, {- value: "alert-danger",- text: "Danger"- }, {- value: "alert-warning",- text: "Warning"- }, {- value: "alert-info",- text: "Info"- }, {- value: "alert-light",- text: "Light"- }, {- value: "alert-dark",- text: "Dark"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/badge", {- classes: ["badge"],- image: "icons/badge.svg",- name: "Badge",- html: '<span class="badge badge-primary">Primary badge</span>',- properties: [{- name: "Color",- key: "color",- htmlAttr: "class",- validValues:["badge-primary", "badge-secondary", "badge-success", "badge-danger", "badge-warning", "badge-info", "badge-light", "badge-dark"],- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "badge-primary",- text: "Primary"- }, {- value: "badge-secondary",- text: "Secondary"- }, {- value: "badge-success",- text: "Success"- }, {- value: "badge-warning",- text: "Warning"- }, {- value: "badge-danger",- text: "Danger"- }, {- value: "badge-info",- text: "Info"- }, {- value: "badge-light",- text: "Light"- }, {- value: "badge-dark",- text: "Dark"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/card", {- classes: ["card"],- image: "icons/panel.svg",- name: "Card",- html: '<div class="card">\- <img class="card-img-top" src="../libs/builder/icons/image.svg" alt="Card image cap" width="128" height="128">\- <div class="card-body">\- <h4 class="card-title">Card title</h4>\- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card\'s content.</p>\- <a href="#" class="btn btn-primary">Go somewhere</a>\- </div>\- </div>'-});-Vvveb.Components.extend("_base", "html/listgroup", {- name: "List Group",- image: "icons/list_group.svg",- classes: ["list-group"],- html: '<ul class="list-group">\n <li class="list-group-item">\n <span class="badge">14</span>\n Cras justo odio\n </li>\n <li class="list-group-item">\n <span class="badge">2</span>\n Dapibus ac facilisis in\n </li>\n <li class="list-group-item">\n <span class="badge">1</span>\n Morbi leo risus\n </li>\n</ul>'-});-Vvveb.Components.extend("_base", "html/listitem", {- name: "List Item",- classes: ["list-group-item"],- html: '<li class="list-group-item"><span class="badge">14</span> Cras justo odio</li>'-});-Vvveb.Components.extend("_base", "html/breadcrumbs", {- classes: ["breadcrumb"],- name: "Breadcrumbs",- image: "icons/breadcrumbs.svg",- html: '<ol class="breadcrumb">\- <li class="breadcrumb-item active"><a href="#">Home</a></li>\- <li class="breadcrumb-item active"><a href="#">Library</a></li>\- <li class="breadcrumb-item active">Data 3</li>\- </ol>'-});-Vvveb.Components.extend("_base", "html/breadcrumbitem", {- classes: ["breadcrumb-item"],- name: "Breadcrumb Item",- html: '<li class="breadcrumb-item"><a href="#">Library</a></li>',- properties: [{- name: "Active",- key: "active",- htmlAttr: "class",- validValues: ["", "active"],- inputtype: ToggleInput,- data: {- on: "active",- off: ""- }- }]-});-Vvveb.Components.extend("_base", "html/pagination", {- classes: ["pagination"],- name: "Pagination",- image: "icons/pagination.svg",- html: '<nav aria-label="Page navigation example">\- <ul class="pagination">\- <li class="page-item"><a class="page-link" href="#">Previous</a></li>\- <li class="page-item"><a class="page-link" href="#">1</a></li>\- <li class="page-item"><a class="page-link" href="#">2</a></li>\- <li class="page-item"><a class="page-link" href="#">3</a></li>\- <li class="page-item"><a class="page-link" href="#">Next</a></li>\- </ul>\- </nav>',-- properties: [{- name: "Size",- key: "size",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["btn-lg", "btn-sm"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "btn-lg",- text: "Large"- }, {- value: "btn-sm",- text: "Small"- }]- }- },{- name: "Alignment",- key: "alignment",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["justify-content-center", "justify-content-end"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "justify-content-center",- text: "Center"- }, {- value: "justify-content-end",- text: "Right"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/pageitem", {- classes: ["page-item"],- html: '<li class="page-item"><a class="page-link" href="#">1</a></li>',- name: "Pagination Item",- properties: [{- name: "Link To",- key: "href",- htmlAttr: "href",- child:".page-link",- inputtype: TextInput- }, {- name: "Disabled",- key: "disabled",- htmlAttr: "class",- validValues: ["disabled"],- inputtype: ToggleInput,- data: {- on: "disabled",- off: ""- }- }]-});-Vvveb.Components.extend("_base", "html/progress", {- classes: ["progress"],- name: "Progress Bar",- image: "icons/progressbar.svg",- html: '<div class="progress"><div class="progress-bar w-25"></div></div>',- properties: [{- name: "Background",- key: "background",- htmlAttr: "class",- validValues: bgcolorClasses,- inputtype: SelectInput,- data: {- options: bgcolorSelectOptions- }- },- {- name: "Progress",- key: "background",- child:".progress-bar",- htmlAttr: "class",- validValues: ["", "w-25", "w-50", "w-75", "w-100"],- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "None"- }, {- value: "w-25",- text: "25%"- }, {- value: "w-50",- text: "50%"- }, {- value: "w-75",- text: "75%"- }, {- value: "w-100",- text: "100%"- }]- }- },- {- name: "Progress background",- key: "background",- child:".progress-bar",- htmlAttr: "class",- validValues: bgcolorClasses,- inputtype: SelectInput,- data: {- options: bgcolorSelectOptions- }- }, {- name: "Striped",- key: "striped",- child:".progress-bar",- htmlAttr: "class",- validValues: ["", "progress-bar-striped"],- inputtype: ToggleInput,- data: {- on: "progress-bar-striped",- off: "",- }- }, {- name: "Animated",- key: "animated",- child:".progress-bar",- htmlAttr: "class",- validValues: ["", "progress-bar-animated"],- inputtype: ToggleInput,- data: {- on: "progress-bar-animated",- off: "",- }- }]-});-Vvveb.Components.extend("_base", "html/jumbotron", {- classes: ["jumbotron"],- image: "icons/jumbotron.svg",- name: "Jumbotron",- html: '<div class="jumbotron">\- <h1 class="display-3">Hello, world!</h1>\- <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>\- <hr class="my-4">\- <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>\- <p class="lead">\- <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>\- </p>\- </div>'-});-Vvveb.Components.extend("_base", "html/navbar", {- classes: ["navbar"],- image: "icons/navbar.svg",- name: "Nav Bar",- html: '<nav class="navbar navbar-expand-lg navbar-light bg-light-subtle">\- <a class="navbar-brand" href="#">Navbar</a>\- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">\- <span class="navbar-toggler-icon"></span>\- </button>\- \- <div class="collapse navbar-collapse" id="navbarSupportedContent">\- <ul class="navbar-nav mr-auto">\- <li class="nav-item active">\- <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>\- </li>\- <li class="nav-item">\- <a class="nav-link" href="#">Link</a>\- </li>\- <li class="nav-item">\- <a class="nav-link disabled" href="#">Disabled</a>\- </li>\- </ul>\- <form class="form-inline my-2 my-lg-0">\- <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">\- <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>\- </form>\- </div>\- </nav>',-- properties: [{- name: "Color theme",- key: "color",- htmlAttr: "class",- validValues: ["navbar-light", "navbar-dark"],- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "navbar-light",- text: "Light"- }, {- value: "navbar-dark",- text: "Dark"- }]- }- },{- name: "Background color",- key: "background",- htmlAttr: "class",- validValues: bgcolorClasses,- inputtype: SelectInput,- data: {- options: bgcolorSelectOptions- }- }, {- name: "Placement",- key: "placement",- htmlAttr: "class",- validValues: ["fixed-top", "fixed-bottom", "sticky-top"],- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "fixed-top",- text: "Fixed Top"- }, {- value: "fixed-bottom",- text: "Fixed Bottom"- }, {- value: "sticky-top",- text: "Sticky top"- }]- }- }]-});--Vvveb.Components.extend("_base", "html/form", {- nodes: ["form"],- image: "icons/form.svg",- name: "Form",- html: '<form><div class="mb-3"><label>Text</label><input type="text" class="form-control"></div></div></form>',- properties: [{- name: "Style",- key: "style",- htmlAttr: "class",- validValues: ["", "form-search", "form-inline", "form-horizontal"],- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "Default"- }, {- value: "form-search",- text: "Search"- }, {- value: "form-inline",- text: "Inline"- }, {- value: "form-horizontal",- text: "Horizontal"- }]- }- }, {- name: "Action",- key: "action",- htmlAttr: "action",- inputtype: TextInput- }, {- name: "Method",- key: "method",- htmlAttr: "method",- inputtype: TextInput- }]-});--Vvveb.Components.extend("_base", "html/textinput", {- name: "Input",- nodes: ["input"],- //attributes: {"type":"text"},- image: "icons/text_input.svg",- html: '<div class="mb-3"><label>Text</label><input type="text" class="form-control"></div></div>',- properties: [{- name: "Value",- key: "value",- htmlAttr: "value",- inputtype: TextInput- }, {- name: "Type",- key: "type",- htmlAttr: "type",- inputtype: SelectInput,- data: {- options: [{- value: "text",- text: "text"- }, {- value: "button",- text: "button"- }, {-- value: "checkbox",- text: "checkbox"- }, {-- value: "color",- text: "color"- }, {-- value: "date",- text: "date"- }, {-- value: "datetime-local",- text: "datetime-local"- }, {-- value: "email",- text: "email"- }, {-- value: "file",- text: "file"- }, {-- value: "hidden",- text: "hidden"- }, {-- value: "image",- text: "image"- }, {-- value: "month",- text: "month"- }, {-- value: "number",- text: "number"- }, {-- value: "password",- text: "password"- }, {-- value: "radio",- text: "radio"- }, {-- value: "range",- text: "range"- }, {-- value: "reset",- text: "reset"- }, {-- value: "search",- text: "search"- }, {-- value: "submit",- text: "submit"- }, {-- value: "tel",- text: "tel"- }, {-- value: "text",- text: "text"- }, {-- value: "time",- text: "time"- }, {-- value: "url",- text: "url"- }, {-- value: "week",- text: "week"- }]- }- }, {- name: "Placeholder",- key: "placeholder",- htmlAttr: "placeholder",- inputtype: TextInput- }, {- name: "Disabled",- key: "disabled",- htmlAttr: "disabled",- col:6,- inputtype: CheckboxInput,- },{- name: "Required",- key: "required",- htmlAttr: "required",- col:6,- inputtype: CheckboxInput,- }]-});--Vvveb.Components.extend("_base", "html/selectinput", {- nodes: ["select"],- name: "Select Input",- image: "icons/select_input.svg",- html: '<div class="mb-3"><label>Choose an option </label><select class="form-control"><option value="value1">Text 1</option><option value="value2">Text 2</option><option value="value3">Text 3</option></select></div>',-- beforeInit: function (node)- {- properties = [];- var i = 0;-- $(node).find('option').each(function() {-- data = {"value": this.value, "text": this.text};-- i++;- properties.push({- name: "Option " + i,- key: "option" + i,- //index: i - 1,- optionNode: this,- inputtype: TextValueInput,- data: data,- onChange: function(node, value, input) {-- option = $(this.optionNode);-- //if remove button is clicked remove option and render row properties- if (input.nodeName == 'BUTTON')- {- option.remove();- Vvveb.Components.render("html/selectinput");- return node;- }-- if (input.name == "value") option.attr("value", value);- else if (input.name == "text") option.text(value);-- return node;- },- });- });-- //remove all option properties- this.properties = this.properties.filter(function(item) {- return item.key.indexOf("option") === -1;- });-- //add remaining properties to generated column properties- properties.push(this.properties[0]);-- this.properties = properties;- return node;- },-- properties: [{- name: "Option",- key: "option1",- inputtype: TextValueInput- }, {- name: "Option",- key: "option2",- inputtype: TextValueInput- }, {- name: "",- key: "addChild",- inputtype: ButtonInput,- data: {text:"Add option", icon:"la-plus"},- onChange: function(node)- {- $(node).append('<option value="value">Text</option>');-- //render component properties again to include the new column inputs- Vvveb.Components.render("html/selectinput");-- return node;- }- }]-});-Vvveb.Components.extend("_base", "html/textareainput", {- name: "Text Area",- image: "icons/text_area.svg",- html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>'-});-Vvveb.Components.extend("_base", "html/radiobutton", {- name: "Radio Button",- attributes: {"type":"radio"},- image: "icons/radio.svg",- html: '<label class="radio"><input type="radio"> Radio</label>',- properties: [{- name: "Name",- key: "name",- htmlAttr: "name",- inputtype: TextInput- }]-});-Vvveb.Components.extend("_base", "html/checkbox", {- name: "Checkbox",- attributes: {"type":"checkbox"},- image: "icons/checkbox.svg",- html: '<label class="checkbox"><input type="checkbox"> Checkbox</label>',- properties: [{- name: "Name",- key: "name",- htmlAttr: "name",- inputtype: TextInput- }]-});-Vvveb.Components.extend("_base", "html/fileinput", {- name: "Input group",- attributes: {"type":"file"},- image: "icons/text_input.svg",- html: '<div class="mb-3">\- <input type="file" class="form-control">\- </div>'-});-Vvveb.Components.extend("_base", "html/table", {- nodes: ["table"],- classes: ["table"],- image: "icons/table.svg",- name: "Table",- html: '<table class="table">\- <thead>\- <tr>\- <th>#</th>\- <th>First Name</th>\- <th>Last Name</th>\- <th>Username</th>\- </tr>\- </thead>\- <tbody>\- <tr>\- <th scope="row">1</th>\- <td>Mark</td>\- <td>Otto</td>\- <td>@mdo</td>\- </tr>\- <tr>\- <th scope="row">2</th>\- <td>Jacob</td>\- <td>Thornton</td>\- <td>@fat</td>\- </tr>\- <tr>\- <th scope="row">3</th>\- <td>Larry</td>\- <td>the Bird</td>\- <td>@twitter</td>\- </tr>\- </tbody>\- </table>',- properties: [- {- name: "Type",- key: "type",- htmlAttr: "class",- validValues: ["table-primary", "table-secondary", "table-success", "table-danger", "table-warning", "table-info", "table-light", "table-dark", "table-white"],- inputtype: SelectInput,- data: {- options: [{- value: "Default",- text: ""- }, {- value: "table-primary",- text: "Primary"- }, {- value: "table-secondary",- text: "Secondary"- }, {- value: "table-success",- text: "Success"- }, {- value: "table-danger",- text: "Danger"- }, {- value: "table-warning",- text: "Warning"- }, {- value: "table-info",- text: "Info"- }, {- value: "table-light",- text: "Light"- }, {- value: "table-dark",- text: "Dark"- }, {- value: "table-white",- text: "White"- }]- }- },- {- name: "Responsive",- key: "responsive",- htmlAttr: "class",- validValues: ["table-responsive"],- inputtype: ToggleInput,- data: {- on: "table-responsive",- off: ""- }- },- {- name: "Small",- key: "small",- htmlAttr: "class",- validValues: ["table-sm"],- inputtype: ToggleInput,- data: {- on: "table-sm",- off: ""- }- },- {- name: "Hover",- key: "hover",- htmlAttr: "class",- validValues: ["table-hover"],- inputtype: ToggleInput,- data: {- on: "table-hover",- off: ""- }- },- {- name: "Bordered",- key: "bordered",- htmlAttr: "class",- validValues: ["table-bordered"],- inputtype: ToggleInput,- data: {- on: "table-bordered",- off: ""- }- },- {- name: "Striped",- key: "striped",- htmlAttr: "class",- validValues: ["table-striped"],- inputtype: ToggleInput,- data: {- on: "table-striped",- off: ""- }- },- {- name: "Inverse",- key: "inverse",- htmlAttr: "class",- validValues: ["table-inverse"],- inputtype: ToggleInput,- data: {- on: "table-inverse",- off: ""- }- },- {- name: "Head options",- key: "head",- htmlAttr: "class",- child:"thead",- inputtype: SelectInput,- validValues: ["", "thead-inverse", "thead-default"],- data: {- options: [{- value: "",- text: "None"- }, {- value: "thead-default",- text: "Default"- }, {- value: "thead-inverse",- text: "Inverse"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/tablerow", {- nodes: ["tr"],- name: "Table Row",- html: "<tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td></tr>",- properties: [{- name: "Type",- key: "type",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["", "success", "danger", "warning", "active"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "success",- text: "Success"- }, {- value: "error",- text: "Error"- }, {- value: "warning",- text: "Warning"- }, {- value: "active",- text: "Active"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/tablecell", {- nodes: ["td"],- name: "Table Cell",- html: "<td>Cell</td>"-});-Vvveb.Components.extend("_base", "html/tableheadercell", {- nodes: ["th"],- name: "Table Header Cell",- html: "<th>Head</th>"-});-Vvveb.Components.extend("_base", "html/tablehead", {- nodes: ["thead"],- name: "Table Head",- html: "<thead><tr><th>Head 1</th><th>Head 2</th><th>Head 3</th></tr></thead>",- properties: [{- name: "Type",- key: "type",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["", "success", "danger", "warning", "info"],- data: {- options: [{- value: "",- text: "Default"- }, {- value: "success",- text: "Success"- }, {- value: "anger",- text: "Error"- }, {- value: "warning",- text: "Warning"- }, {- value: "info",- text: "Info"- }]- }- }]-});-Vvveb.Components.extend("_base", "html/tablebody", {- nodes: ["tbody"],- name: "Table Body",- html: "<tbody><tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td></tr></tbody>"-});--Vvveb.Components.add("html/gridcolumn", {- name: "Grid Column",- image: "icons/grid_row.svg",- classesRegex: ["col-"],- html: '<div class="col-sm-4"><h3>col-sm-4</h3></div>',- properties: [{- name: "Column",- key: "column",- inputtype: GridInput,- data: {hide_remove:true},-- beforeInit: function(node) {- _class = $(node).attr("class");-- var reg = /col-([^-\$ ]*)?-?(\d+)/g;- var match;-- while ((match = reg.exec(_class)) != null) {- this.data["col" + ((match[1] != undefined)?"_" + match[1]:"")] = match[2];- }- },-- onChange: function(node, value, input) {- var _class = node.attr("class");-- //remove previous breakpoint column size- _class = _class.replace(new RegExp(input.name + '-\\d+?'), '');- //add new column size- if (value) _class += ' ' + input.name + '-' + value;- node.attr("class", _class);-- return node;- },- }]-});-Vvveb.Components.add("html/gridrow", {- name: "Grid Row",- image: "icons/grid_row.svg",- classes: ["row"],- html: '<div class="row"><div class="col-sm-4"><h3>col-sm-4</h3></div><div class="col-sm-4 col-5"><h3>col-sm-4</h3></div><div class="col-sm-4"><h3>col-sm-4</h3></div></div>',- children :[{- name: "html/gridcolumn",- classesRegex: ["col-"],- }],- beforeInit: function (node)- {- properties = [];- var i = 0;- var j = 0;-- $(node).find('[class*="col-"]').each(function() {- _class = $(this).attr("class");-- var reg = /col-([^-\$ ]*)?-?(\d+)/g;- var match;- var data = {};-- while ((match = reg.exec(_class)) != null) {- data["col" + ((match[1] != undefined)?"_" + match[1]:"")] = match[2];- }-- i++;- properties.push({- name: "Column " + i,- key: "column" + i,- //index: i - 1,- columnNode: this,- col:12,- inline:true,- inputtype: GridInput,- data: data,- onChange: function(node, value, input) {-- //column = $('[class*="col-"]:eq(' + this.index + ')', node);- var column = $(this.columnNode);-- //if remove button is clicked remove column and render row properties- if (input.nodeName == 'BUTTON')- {- column.remove();- Vvveb.Components.render("html/gridrow");- return node;- }-- //if select input then change column class- _class = column.attr("class");-- //remove previous breakpoint column size- _class = _class.replace(new RegExp(input.name + '-\\d+?'), '');- //add new column size- if (value) _class += ' ' + input.name + '-' + value;- column.attr("class", _class);-- //console.log(this, node, value, input, input.name);-- return node;- },- });- });-- //remove all column properties- this.properties = this.properties.filter(function(item) {- return item.key.indexOf("column") === -1;- });-- //add remaining properties to generated column properties- properties.push(this.properties[0]);-- this.properties = properties;- return node;- },-- properties: [{- name: "Column",- key: "column1",- inputtype: GridInput- }, {- name: "Column",- key: "column1",- inline:true,- col:12,- inputtype: GridInput- }, {- name: "",- key: "addChild",- inputtype: ButtonInput,- data: {text:"Add column", icon:"la la-plus"},- onChange: function(node)- {- $(node).append('<div class="col-3">Col-3</div>');-- //render component properties again to include the new column inputs- Vvveb.Components.render("html/gridrow");-- return node;- }- }]-});---Vvveb.Components.extend("_base", "html/paragraph", {- nodes: ["p"],- name: "Paragraph",- image: "icons/paragraph.svg",- html: '<p>Lorem ipsum</p>',- properties: [{- name: "Text align",- key: "text-align",- htmlAttr: "class",- inputtype: SelectInput,- validValues: ["", "text-left", "text-center", "text-right"],- inputtype: RadioButtonInput,- data: {- extraclass:"btn-group-sm btn-group-fullwidth",- options: [{- value: "",- icon:"la la-times",- //text: "None",- title: "None",- checked:true,- }, {- value: "text-left",- //text: "Left",- title: "text-left",- icon:"la la-align-left",- checked:false,- }, {- value: "text-center",- //text: "Center",- title: "Center",- icon:"la la-align-center",- checked:false,- }, {- value: "text-right",- //text: "Right",- title: "Right",- icon:"la la-align-right",- checked:false,- }],- },- }]-});--Vvveb.Components.extend("_base", "html/video", {- nodes: ["video"],- name: "Video",- html: '<video width="320" height="240" playsinline loop autoplay><source src="../../media/demo/sample.webm"><video>',- dragHtml: '<img width="320" height="240" src="' + Vvveb.baseUrl + 'icons/video.svg">',- image: "icons/video.svg",- properties: [{- name: "Src",- child: "source",- key: "src",- htmlAttr: "src",- inputtype: LinkInput- },{- name: "Width",- key: "width",- htmlAttr: "width",- inputtype: TextInput- }, {- name: "Height",- key: "height",- htmlAttr: "height",- inputtype: TextInput- },{- name: "Muted",- key: "muted",- htmlAttr: "muted",- inputtype: CheckboxInput- },{- name: "Loop",- key: "loop",- htmlAttr: "loop",- inputtype: CheckboxInput- },{- name: "Autoplay",- key: "autoplay",- htmlAttr: "autoplay",- inputtype: CheckboxInput- },{- name: "Plays inline",- key: "playsinline",- htmlAttr: "playsinline",- inputtype: CheckboxInput- },{- name: "Controls",- key: "controls",- htmlAttr: "controls",- inputtype: CheckboxInput- }]-});---Vvveb.Components.extend("_base", "html/button", {- nodes: ["button"],- name: "Html Button",- image: "icons/button.svg",- html: '<button>Button</button>',- properties: [{- name: "Text",- key: "text",- htmlAttr: "innerHTML",- inputtype: TextInput- }, {- name: "Name",- key: "name",- htmlAttr: "name",- inputtype: TextInput- }, {- name: "Type",- key: "type",- htmlAttr: "type",- inputtype: SelectInput,- data: {- options: [{- value: "button",- text: "button"- }, {- value: "reset",- text: "reset"- }, {- value: "submit",- text: "submit"- }],- }- },{- name: "Autofocus",- key: "autofocus",- htmlAttr: "autofocus",- inputtype: CheckboxInput,- inline:true,- col:6,- },{- name: "Disabled",- key: "disabled",- htmlAttr: "disabled",- inputtype: CheckboxInput,- inline:true,- col:6,- }]-});--Vvveb.Components.extend("_base", "_base", {- properties: [- {- name: "Font family",- key: "font-family",- htmlAttr: "style",- sort: base_sort++,- col:6,- inline:true,- inputtype: SelectInput,- data: {- options: [{- value: "",- text: "extended"- }, {- value: "Ggoogle ",- text: "google"- }]- }- }]-});diff --git a/public/js/vvvebjs/components-bootstrap5.js b/public/js/vvvebjs/components-bootstrap5.jsindex 514e762..4a0114c 100755--- a/public/js/vvvebjs/components-bootstrap5.js+++ b/public/js/vvvebjs/components-bootstrap5.js@@ -36,13 +36,12 @@ Vvveb.Components.extend("_base", "html/container", {options: [{value: "container",text: "Default"- }, {+ },{value: "container-fluid",text: "Fluid"}]}- },- {+ },{name: "Background",key: "background",htmlAttr: "class",@@ -51,14 +50,12 @@ Vvveb.Components.extend("_base", "html/container", {data: {options: bgcolorSelectOptions}- },- {+ },{name: "Background Color",key: "background-color",htmlAttr: "style",inputtype: ColorInput,- },- {+ },{name: "Text Color",key: "color",htmlAttr: "style",@@ -82,54 +79,54 @@ Vvveb.Components.extend("html/link", "html/btn", {options: [{value: "btn-default",text: "Default"- }, {+ },{value: "btn-primary",text: "Primary"- }, {+ },{value: "btn btn-info",text: "Info"- }, {+ },{value: "btn-success",text: "Success"- }, {+ },{value: "btn-warning",text: "Warning"- }, {+ },{value: "btn-info",text: "Info"- }, {+ },{value: "btn-light",text: "Light"- }, {+ },{value: "btn-dark",text: "Dark"- }, {+ },{value: "btn-outline-primary",text: "Primary outline"- }, {+ },{value: "btn btn-outline-info",text: "Info outline"- }, {+ },{value: "btn-outline-success",text: "Success outline"- }, {+ },{value: "btn-outline-warning",text: "Warning outline"- }, {+ },{value: "btn-outline-info",text: "Info outline"- }, {+ },{value: "btn-outline-light",text: "Light outline"- }, {+ },{value: "btn-outline-dark",text: "Dark outline"- }, {+ },{value: "btn-link",text: "Link"}]}- }, {+ },{name: "Size",key: "size",htmlAttr: "class",@@ -139,10 +136,10 @@ Vvveb.Components.extend("html/link", "html/btn", {options: [{value: "",text: "Default"- }, {+ },{value: "btn-lg",text: "Large"- }, {+ },{value: "btn-sm",text: "Small"}]@@ -189,15 +186,15 @@ Vvveb.Components.extend("_base", "html/buttongroup", {options: [{value: "",text: "Default"- }, {+ },{value: "btn-group-lg",text: "Large"- }, {+ },{value: "btn-group-sm",text: "Small"}]}- }, {+ },{name: "Alignment",key: "alignment",htmlAttr: "class",@@ -207,10 +204,10 @@ Vvveb.Components.extend("_base", "html/buttongroup", {options: [{value: "",text: "Default"- }, {+ },{value: "btn-group",text: "Horizontal"- }, {+ },{value: "btn-group-vertical",text: "Vertical"}]@@ -258,25 +255,25 @@ Vvveb.Components.extend("_base","html/alert", {options: [{value: "alert-primary",text: "Default"- }, {+ },{value: "alert-secondary",text: "Secondary"- }, {+ },{value: "alert-success",text: "Success"- }, {+ },{value: "alert-danger",text: "Danger"- }, {+ },{value: "alert-warning",text: "Warning"- }, {+ },{value: "alert-info",text: "Info"- }, {+ },{value: "alert-light",text: "Light"- }, {+ },{value: "alert-dark",text: "Dark"}]@@ -298,28 +295,28 @@ Vvveb.Components.extend("_base", "html/badge", {options: [{value: "",text: "Default"- }, {+ },{value: "bg-primary",text: "Primary"- }, {+ },{value: "bg-secondary",text: "Secondary"- }, {+ },{value: "bg-success",text: "Success"- }, {+ },{value: "bg-warning",text: "Warning"- }, {+ },{value: "bg-danger",text: "Danger"- }, {+ },{value: "bg-info",text: "Info"- }, {+ },{value: "bg-body-secondary",text: "Light"- }, {+ },{value: "bg-dark",text: "Dark"}]@@ -392,28 +389,28 @@ Vvveb.Components.extend("_base", "html/listitem", {options: [{value: "",text: "Default"- }, {+ },{value: "list-group-item-primary",text: "Primary"- }, {+ },{value: "list-group-item-secondary",text: "Secondary"- }, {+ },{value: "list-group-item-success",text: "Success"- }, {+ },{value: "list-group-item-warning",text: "Warning"- }, {+ },{value: "list-group-item-danger",text: "Danger"- }, {+ },{value: "list-group-item-info",text: "Info"- }, {+ },{value: "list-group-item-light",text: "Light"- }, {+ },{value: "list-group-item-dark",text: "Dark"}]@@ -502,10 +499,10 @@ Vvveb.Components.extend("_base", "html/pagination", {options: [{value: "",text: "Default"- }, {+ },{value: "pagination-lg",text: "Large"- }, {+ },{value: "pagination-sm",text: "Small"}]@@ -520,10 +517,10 @@ Vvveb.Components.extend("_base", "html/pagination", {options: [{value: "",text: "Default"- }, {+ },{value: "justify-content-center",text: "Center"- }, {+ },{value: "justify-content-end",text: "Right"}]@@ -540,7 +537,7 @@ Vvveb.Components.extend("_base", "html/pageitem", {htmlAttr: "href",child:".page-link",inputtype: LinkInput- }, {+ },{name: "Active",key: "active",htmlAttr: "class",@@ -550,7 +547,7 @@ Vvveb.Components.extend("_base", "html/pageitem", {on: "active",off: ""}- }, {+ },{name: "Disabled",key: "disabled",htmlAttr: "class",@@ -588,16 +585,16 @@ Vvveb.Components.extend("_base", "html/progress", {options: [{value: "",text: "None"- }, {+ },{value: "w-25",text: "25%"- }, {+ },{value: "w-50",text: "50%"- }, {+ },{value: "w-75",text: "75%"- }, {+ },{value: "w-100",text: "100%"}]@@ -613,7 +610,7 @@ Vvveb.Components.extend("_base", "html/progress", {data: {options: bgcolorSelectOptions}- }, {+ },{name: "Striped",key: "striped",child:".progress-bar",@@ -624,7 +621,7 @@ Vvveb.Components.extend("_base", "html/progress", {on: "progress-bar-striped",off: "",}- }, {+ },{name: "Animated",key: "animated",child:".progress-bar",@@ -677,10 +674,10 @@ Vvveb.Components.extend("_base", "html/navbar", {options: [{value: "",text: "Default"- }, {+ },{value: "navbar-light",text: "Light"- }, {+ },{value: "navbar-dark",text: "Dark"}]@@ -694,7 +691,7 @@ Vvveb.Components.extend("_base", "html/navbar", {data: {options: bgcolorSelectOptions}- }, {+ },{name: "Placement",key: "placement",htmlAttr: "class",@@ -704,13 +701,13 @@ Vvveb.Components.extend("_base", "html/navbar", {options: [{value: "",text: "Default"- }, {+ },{value: "fixed-top",text: "Fixed Top"- }, {+ },{value: "fixed-bottom",text: "Fixed Bottom"- }, {+ },{value: "sticky-top",text: "Sticky top"}]@@ -738,10 +735,10 @@ Vvveb.Components.extend("_base", "html/gridcolumn", {data: {hide_remove:true},beforeInit: function(node) {- _class = $(node).attr("class");+ _class = node.getAttribute("class");- var reg = /col(-[^-\$ ]*)?-?(\d+)?/g;- var match;+ let reg = /col(-[^-\$ ]*)?-?(\d+)?/g;+ let match;while ((match = reg.exec(_class)) != null) {let key = "col" + ((match[1] != undefined) ? "_" + match[1].replace('-','') : "");@@ -750,13 +747,13 @@ Vvveb.Components.extend("_base", "html/gridcolumn", {},onChange: function(node, value, input) {- var _class = node.attr("class");+ let _class = node.getAttribute("class");//remove previous breakpoint column size_class = _class.replace(new RegExp(input.name + '-\\d+?'), '');//add new column sizeif (value) _class += ' ' + input.name + '-' + value;- node.attr("class", _class);+ node.setAttribute("class", _class);return node;},@@ -772,18 +769,17 @@ Vvveb.Components.extend("_base", "html/gridrow", {name: "html/gridcolumn",classesRegex: ["col-"],}],- beforeInit: function (node)- {+ beforeInit: function (node) {properties = [];- var i = 0;- var j = 0;+ let i = 0;+ let j = 0;- $(node).find('[class*="col-"],.col').each(function() {- _class = $(this).attr("class");+ node.querySelectorAll('[class*="col-"],.col').forEach(el => {+ _class = el.getAttribute("class");- var reg = /col(-[^-\$ ]*)?-?(\d+)?/g;- var match;- var data = {};+ let reg = /col(-[^-\$ ]*)?-?(\d+)?/g;+ let match;+ let data = {};while ((match = reg.exec(_class)) != null) {let key = "col" + ((match[1] != undefined) ? "_" + match[1].replace('-','') : "");@@ -795,34 +791,30 @@ Vvveb.Components.extend("_base", "html/gridrow", {name: "Column " + i,key: "column" + i,//index: i - 1,- columnNode: this,+ columnNode: el,col:12,inline:false,inputtype: GridInput,data: data,onChange: function(node, value, input) {- //column = $('[class*="col-"]:eq(' + this.index + ')', node);- var column = $(this.columnNode);+ let column = this.columnNode;//if remove button is clicked remove column and render row properties- if (input.nodeName == 'BUTTON')- {+ if (input.nodeName == 'BUTTON') {column.remove();Vvveb.Components.render("html/gridrow");return node;}//if select input then change column class- _class = column.attr("class");+ _class = column.getAttribute("class");//remove previous breakpoint column size_class = _class.replace(new RegExp(input.name + '-\\d+?'), '');//add new column sizeif (value) _class += ' ' + input.name + '-' + value;- column.attr("class", _class);-- //console.log(this, node, value, input, input.name);+ column.setAttribute("class", _class);return node;},@@ -833,10 +825,10 @@ Vvveb.Components.extend("_base", "html/gridrow", {this.properties = this.properties.filter(function(item) {return item.key.indexOf("column") === -1;});-+//add remaining properties to generated column properties, put first 2 align properties firstthis.properties = this.properties.slice(0,4).concat(properties, this.properties.slice(4));-+return node;},@@ -855,25 +847,25 @@ Vvveb.Components.extend("_base", "html/gridrow", {//text: "None",title: "Default",checked:true,- }, {+ },{value: "flex-row",//text: "Left",title: "Row - horizontal",icon:"la la-arrow-right",checked:false,- }, {+ },{value: "flex-column",//text: "Center",title: "Column - vertical",icon:"la la-arrow-down",checked:false,- }, {+ },{value: "flex-row-reverse",//text: "Right",title: "Row - reversed",icon:"la la-arrow-left",checked:false,- }, {+ },{value: "flex-column-reverse",//text: "Center",title: "Column - reversed",@@ -882,7 +874,7 @@ Vvveb.Components.extend("_base", "html/gridrow", {}],},},{- name: "Vertical align",+ name: "Vertical align",key: "vertical-align",htmlAttr: "class",inline:false,@@ -896,30 +888,30 @@ Vvveb.Components.extend("_base", "html/gridrow", {//text: "None",title: "None",checked:true,- }, {+ },{value: "align-items-start",//text: "Left",title: "Start",icon:"la la-align-left",checked:false,- }, {+ },{value: "align-items-center",//text: "Center",title: "Center",icon:"la la-align-center",checked:false,- }, {+ },{value: "align-items-end",//text: "Right",title: "End",icon:"la la-align-right",checked:false,- }, {+ },{value: "align-items-baseline",title: "Baseline",icon:"la la-indent",checked:false,- }, {+ },{value: "align-items-stretch",title: "Stretch",icon:"la la-align-justify",@@ -941,37 +933,37 @@ Vvveb.Components.extend("_base", "html/gridrow", {//text: "None",title: "None",checked:true,- }, {+ },{value: "justify-content-start",//text: "Left",title: "Start",icon:"la la-align-left",checked:false,- }, {+ },{value: "justify-content-center",//text: "Center",title: "Center",icon:"la la-align-center",checked:false,- }, {+ },{value: "justify-content-end",//text: "Right",title: "End",icon:"la la-align-right",checked:false- }, {+ },{value: "justify-content-around",//text: "Left",title: "Around",icon:"la la-indent",checked:false,- }, {+ },{value: "justify-content-between",//text: "Center",title: "Between",icon:"la la-outdent",checked:false,- }, {+ },{value: "justify-content-evenly",//text: "Right",title: "Evenly",@@ -994,13 +986,13 @@ Vvveb.Components.extend("_base", "html/gridrow", {//text: "None",title: "None",checked:true,- }, {+ },{value: "flex-wrap",//text: "Left",title: "Wrap",icon:"la la-undo",checked:false,- }, {+ },{value: "flex-nowrap",//text: "Center",title: "No wrap",@@ -1012,20 +1004,20 @@ Vvveb.Components.extend("_base", "html/gridrow", {name: "Column",key: "column1",inputtype: GridInput- }, {+ },{name: "Column",key: "column1",inline:true,col:12,inputtype: GridInput- }, {+ },{name: "",key: "addChild",inputtype: ButtonInput,data: {text:"Add column", icon:"la la-plus"},onChange: function(node){- $(node).append('<div class="col-3"><h3>Col-3</h3></div>');+ node.append(generateElements('<div class="col-3"><h3>Col-3</h3></div>')[0]);//render component properties again to include the new column inputsVvveb.Components.render("html/gridrow");diff --git a/public/js/vvvebjs/components-common.js b/public/js/vvvebjs/components-common.jsindex 456b6f4..b9588cc 100755--- a/public/js/vvvebjs/components-common.js+++ b/public/js/vvvebjs/components-common.js@@ -18,59 +18,59 @@ https://github.com/givanz/VvvebjsbgcolorClasses = ["bg-primary", "bg-secondary", "bg-success", "bg-danger", "bg-warning", "bg-info", "bg-body-secondary", "bg-dark", "bg-white"]-bgcolorSelectOptions =-[{+bgcolorSelectOptions = [{value: "Default",text: ""-},-{+},{value: "bg-primary",text: "Primary"-}, {+},{value: "bg-secondary",text: "Secondary"-}, {+},{value: "bg-success",text: "Success"-}, {+},{value: "bg-danger",text: "Danger"-}, {+},{value: "bg-warning",text: "Warning"-}, {+},{value: "bg-info",text: "Info"-}, {+},{value: "bg-body-secondary",text: "Light"-}, {+},{value: "bg-dark",text: "Dark"-}, {+},{value: "bg-white",text: "White"}];-function changeNodeName(node, newNodeName)-{- var newNode;+function changeNodeName(node, newNodeName) {+ let newNode;newNode = document.createElement(newNodeName);- attributes = node.get(0).attributes;+ attributes = node.attributes;for (i = 0, len = attributes.length; i < len; i++) {newNode.setAttribute(attributes[i].nodeName, attributes[i].nodeValue);}- $(newNode).append($(node).contents());- $(node).replaceWith(newNode);+ for (e of node.childNodes) {+ newNode.append(e);+ }++ node.replaceWith(newNode);return newNode;}-var base_sort = 100;//start sorting for base component from 100 to allow extended properties to be first-var style_section = 'style';-var advanced_section = 'advanced';+let base_sort = 100;//start sorting for base component from 100 to allow extended properties to be first+let style_section = 'style';+let advanced_section = 'advanced';Vvveb.Components.add("_base", {name: "Element",@@ -80,7 +80,7 @@ Vvveb.Components.add("_base", {name:false,sort:base_sort++,data: {header:"General"},- }, {+ },{name: "Id",key: "id",htmlAttr: "id",@@ -88,7 +88,7 @@ Vvveb.Components.add("_base", {inline:false,col:6,inputtype: TextInput- }, {+ },{name: "Class",key: "class",htmlAttr: "class",@@ -108,13 +108,13 @@ Vvveb.Components.add("_base", {options: [{value: "",text: ""- }, {+ },{value: "hover",text: "Hover"- }, {+ },{value: "active",text: "Active"- }, {+ },{value: "focus",text: "Focus"}]@@ -125,15 +125,14 @@ Vvveb.Components.add("_base", {//displayVvveb.Components.extend("_base", "_base", {- properties: [- {+ properties: [{key: "display_header",inputtype: SectionInput,name:false,sort: base_sort++,section: style_section,data: {header:"Display"},- }, {+ },{//linked styles notice messagename:"",key: "linked_styles_check",@@ -148,35 +147,44 @@ Vvveb.Components.extend("_base", "_base", {text:'This element shares styles with other <a class="linked-elements-hover" href="#"><b class="elements-count">4</b> elements</a>, to apply styles <b>only for this element</b> enter a <b>unique id</b> eg: <i>marketing-heading</i> in in <br/><a class="id-input" href="#content-tab" role="tab" aria-controls="components" aria-selected="false" href="#content-tab">Content > General > Id</a>.<br/><span class="text-muted small"></span>',},afterInit:function(node, inputElement) {- var selector = Vvveb.StyleManager.getSelectorForElement(node);- var elements = $(selector, window.FrameDocument);+ let selector = Vvveb.StyleManager.getSelectorForElement(node);+ let elements = window.FrameDocument.querySelectorAll(selector);if (elements.length <= 1) {- inputElement.hide();+ if (inputElement.style) {+ inputElement.style.display = "none";+ }} else {- $(".elements-count", inputElement).html(elements.length);- $(".text-muted", inputElement).html(selector);+ inputElement.style.display = "";+ inputElement.querySelector(".elements-count").innerHTML = elements.length;+ inputElement.querySelector(".text-muted").innerHTML = selector;- $(".id-input", inputElement).click(function (){- $(".content-tab a").each(function() {- this.click();- });+ inputElement.querySelector(".id-input", inputElement).addEventListener("click", (event) => {+ document.querySelectorAll(".content-tab a").forEach(e => e.click());- setTimeout(function () { $("[name=id]").trigger("focus") }, 700);+ setTimeout(function () {+ let idInput = document.querySelectorAll("[name=id]");+ idInput.forEach(el => {if (el.offsetParent) el.focus()});/*+ idInput.forEach(el => el .dispatchEvent(new FocusEvent("focusin", {+ bubbles: true,+ cancelable: false+ })));*/+ }, 700);+ event.preventDefault();return false;});- $(".linked-elements-hover", inputElement).- on("mouseenter", function (){- elements.css("outline","2px dotted blue");- }).- on("mouseleave", function (){- elements.css("outline","");+ inputElement.querySelector(".linked-elements-hover").addEventListener("mouseenter", function (){+ elements.forEach( e => e.style.outline = "2px dotted blue");+ });++ inputElement.querySelector(".linked-elements-hover").addEventListener("mouseleave", function (){+ elements.forEach( e => e.style.outline = "");});}},- }, {+ },{name: "Display",key: "display",htmlAttr: "style",@@ -190,48 +198,48 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "block",text: "Block"- }, {+ },{value: "inline",text: "Inline"- }, {+ },{value: "inline-block",text: "Inline Block"- }, {+ },{value: "inline-block",text: "Inline Block"- }, {+ },{value: "flex",text: "Flex"- }, {+ },{value: "inline-flex",text: "Inline Flex"- }, {+ },{value: "grid",text: "Grid"- }, {+ },{value: "inline-grid",text: "Inline grid"- }, {+ },{value: "table",text: "Table"- }, {+ },{value: "table-row",text: "Table Row"- }, {+ },{value: "list-item",text: "List Item"- }, {+ },{value: "inherit",text: "Inherit"- }, {+ },{value: "initial",text: "Initial"- }, {+ },{value: "none",text: "none"}]}- }, {+ },{name: "Position",key: "position",htmlAttr: "style",@@ -245,18 +253,18 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "static",text: "Static"- }, {+ },{value: "fixed",text: "Fixed"- }, {+ },{value: "relative",text: "Relative"- }, {+ },{value: "absolute",text: "Absolute"}]}- }, {+ },{name: "Top",key: "top",htmlAttr: "style",@@ -266,7 +274,7 @@ Vvveb.Components.extend("_base", "_base", {inline:false,parent:"",inputtype: CssUnitInput- }, {+ },{name: "Left",key: "left",htmlAttr: "style",@@ -276,7 +284,7 @@ Vvveb.Components.extend("_base", "_base", {inline:false,parent:"",inputtype: CssUnitInput- }, {+ },{name: "Bottom",key: "bottom",htmlAttr: "style",@@ -286,7 +294,7 @@ Vvveb.Components.extend("_base", "_base", {inline:false,parent:"",inputtype: CssUnitInput- }, {+ },{name: "Right",key: "right",htmlAttr: "style",@@ -313,13 +321,13 @@ Vvveb.Components.extend("_base", "_base", {//text: "None",title: "None",checked:true,- }, {+ },{value: "left",//text: "Left",title: "Left",icon:"la la-align-left",checked:false,- }, {+ },{value: "right",//text: "Right",title: "Right",@@ -327,7 +335,7 @@ Vvveb.Components.extend("_base", "_base", {checked:false,}],}- }, {+ },{name: "Opacity",key: "opacity",htmlAttr: "style",@@ -342,7 +350,7 @@ Vvveb.Components.extend("_base", "_base", {min:0,step:0.1},- }, {+ },{name: "Background Color",key: "background-color",sort: base_sort++,@@ -351,7 +359,7 @@ Vvveb.Components.extend("_base", "_base", {inline:true,htmlAttr: "style",inputtype: ColorInput,- }, {+ },{name: "Text Color",key: "color",sort: base_sort++,@@ -364,9 +372,8 @@ Vvveb.Components.extend("_base", "_base", {});//Typography-var ComponentBaseTypography = {- properties: [- {+let ComponentBaseTypography = {+ properties: [{key: "typography_header",inputtype: SectionInput,name:false,@@ -374,7 +381,7 @@ var ComponentBaseTypography = {section: style_section,data: {header:"Typography"},- }, {+ },{name: "Font size",key: "font-size",htmlAttr: "style",@@ -383,7 +390,7 @@ var ComponentBaseTypography = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Font weight",key: "font-weight",htmlAttr: "style",@@ -396,36 +403,36 @@ var ComponentBaseTypography = {options: [{value: "",text: "Default"- }, {+ },{value: "100",text: "Thin"- }, {+ },{value: "200",text: "Extra-Light"- }, {+ },{value: "300",text: "Light"- }, {+ },{value: "400",text: "Normal"- }, {+ },{value: "500",text: "Medium"- }, {+ },{value: "600",text: "Semi-Bold"- }, {+ },{value: "700",text: "Bold"- }, {+ },{value: "800",text: "Extra-Bold"- }, {+ },{value: "900",text: "Ultra-Bold"}],}- }, {+ },{name: "Font family",key: "font-family",htmlAttr: "style",@@ -437,7 +444,7 @@ var ComponentBaseTypography = {data: {options: fontList}- }, {+ },{name: "Text align",key: "text-align",htmlAttr: "style",@@ -454,25 +461,25 @@ var ComponentBaseTypography = {//text: "None",title: "None",checked:true,- }, {+ },{value: "left",//text: "Left",title: "Left",icon:"la la-align-left",checked:false,- }, {+ },{value: "center",//text: "Center",title: "Center",icon:"la la-align-center",checked:false,- }, {+ },{value: "right",//text: "Right",title: "Right",icon:"la la-align-right",checked:false,- }, {+ },{value: "justify",//text: "justify",title: "Justify",@@ -480,7 +487,7 @@ var ComponentBaseTypography = {checked:false,}],},- }, {+ },{name: "Line height",key: "line-height",htmlAttr: "style",@@ -489,7 +496,7 @@ var ComponentBaseTypography = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Letter spacing",key: "letter-spacing",htmlAttr: "style",@@ -498,7 +505,7 @@ var ComponentBaseTypography = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Text decoration",key: "text-decoration-line",htmlAttr: "style",@@ -515,25 +522,25 @@ var ComponentBaseTypography = {//text: "None",title: "None",checked:true,- }, {+ },{value: "underline",//text: "Left",title: "underline",icon:"la la-long-arrow-alt-down",checked:false,- }, {+ },{value: "overline",//text: "Right",title: "overline",icon:"la la-long-arrow-alt-up",checked:false,- }, {+ },{value: "line-through",//text: "Right",title: "Line Through",icon:"la la-strikethrough",checked:false,- }, {+ },{value: "underline overline",//text: "justify",title: "Underline Overline",@@ -541,7 +548,7 @@ var ComponentBaseTypography = {checked:false,}],},- }, {+ },{name: "Decoration Color",key: "text-decoration-color",sort: base_sort++,@@ -550,7 +557,7 @@ var ComponentBaseTypography = {inline:true,htmlAttr: "style",inputtype: ColorInput,- }, {+ },{name: "Decoration style",key: "text-decoration-style",htmlAttr: "style",@@ -563,19 +570,19 @@ var ComponentBaseTypography = {options: [{value: "",text: "Default"- }, {+ },{value: "solid",text: "Solid"- }, {+ },{value: "wavy",text: "Wavy"- }, {+ },{value: "dotted",text: "Dotted"- }, {+ },{value: "dashed",text: "Dashed"- }, {+ },{value: "double",text: "Double"}],@@ -586,7 +593,7 @@ var ComponentBaseTypography = {Vvveb.Components.extend("_base", "_base", ComponentBaseTypography);//Size-var ComponentBaseSize = {+let ComponentBaseSize = {properties: [{key: "size_header",inputtype: SectionInput,@@ -594,7 +601,7 @@ var ComponentBaseSize = {sort: base_sort++,section: style_section,data: {header:"Size", expanded:false},- }, {+ },{name: "Width",key: "width",htmlAttr: "style",@@ -603,7 +610,7 @@ var ComponentBaseSize = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Height",key: "height",htmlAttr: "style",@@ -612,7 +619,7 @@ var ComponentBaseSize = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Min Width",key: "min-width",htmlAttr: "style",@@ -621,7 +628,7 @@ var ComponentBaseSize = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Min Height",key: "min-height",htmlAttr: "style",@@ -630,7 +637,7 @@ var ComponentBaseSize = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Max Width",key: "max-width",htmlAttr: "style",@@ -639,7 +646,7 @@ var ComponentBaseSize = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Max Height",key: "max-height",htmlAttr: "style",@@ -654,7 +661,7 @@ var ComponentBaseSize = {Vvveb.Components.extend("_base", "_base", ComponentBaseSize);//Margin-var ComponentBaseMargin = {+let ComponentBaseMargin = {properties: [{key: "margins_header",inputtype: SectionInput,@@ -662,7 +669,7 @@ var ComponentBaseMargin = {sort: base_sort++,section: style_section,data: {header:"Margin", expanded:false},- }, {+ },{name: "Top",key: "margin-top",htmlAttr: "style",@@ -671,7 +678,7 @@ var ComponentBaseMargin = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Right",key: "margin-right",htmlAttr: "style",@@ -680,7 +687,7 @@ var ComponentBaseMargin = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Bottom",key: "margin-bottom",htmlAttr: "style",@@ -689,7 +696,7 @@ var ComponentBaseMargin = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Left",key: "margin-left",htmlAttr: "style",@@ -704,7 +711,7 @@ var ComponentBaseMargin = {Vvveb.Components.extend("_base", "_base", ComponentBaseMargin);//Padding-var ComponentBasePadding = {+let ComponentBasePadding = {properties: [{key: "paddings_header",@@ -713,7 +720,7 @@ var ComponentBasePadding = {sort: base_sort++,section: style_section,data: {header:"Padding", expanded:false},- }, {+ },{name: "Top",key: "padding-top",htmlAttr: "style",@@ -722,7 +729,7 @@ var ComponentBasePadding = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Right",key: "padding-right",htmlAttr: "style",@@ -731,7 +738,7 @@ var ComponentBasePadding = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Bottom",key: "padding-bottom",htmlAttr: "style",@@ -740,7 +747,7 @@ var ComponentBasePadding = {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Left",key: "padding-left",htmlAttr: "style",@@ -764,7 +771,7 @@ Vvveb.Components.extend("_base", "_base", {sort: base_sort++,section: style_section,data: {header:"Border", expanded:false},- }, {+ },{name: "Style",key: "border-style",htmlAttr: "style",@@ -777,18 +784,18 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "",text: "Default"- }, {+ },{value: "solid",text: "Solid"- }, {+ },{value: "dotted",text: "Dotted"- }, {+ },{value: "dashed",text: "Dashed"}],}- }, {+ },{name: "Width",key: "border-width",htmlAttr: "style",@@ -797,7 +804,7 @@ Vvveb.Components.extend("_base", "_base", {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Color",key: "border-color",sort: base_sort++,@@ -820,7 +827,7 @@ Vvveb.Components.extend("_base", "_base", {sort: base_sort++,section: style_section,data: {header:"Border radius", expanded:false},- }, {+ },{name: "Top Left",key: "border-top-left-radius",htmlAttr: "style",@@ -829,7 +836,7 @@ Vvveb.Components.extend("_base", "_base", {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Top Right",key: "border-top-right-radius",htmlAttr: "style",@@ -838,7 +845,7 @@ Vvveb.Components.extend("_base", "_base", {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Bottom Left",key: "border-bottom-left-radius",htmlAttr: "style",@@ -847,7 +854,7 @@ Vvveb.Components.extend("_base", "_base", {col:6,inline:false,inputtype: CssUnitInput- }, {+ },{name: "Bottom Right",key: "border-bottom-right-radius",htmlAttr: "style",@@ -877,19 +884,18 @@ Vvveb.Components.extend("_base", "_base", {inputtype: ImageInput,init: function(node) {- var image = $(node).css("background-image").replace(/url\(['"]?([^"\)$]+?)['"]?\).*/, '$1');+ let image = node.style.backgroundImage.replace(/url\(['"]?([^"\)$]+?)['"]?\).*/, '$1');return image;},onChange: function(node, value) {- Vvveb.StyleManager.setStyle($(node), "background-image", 'url(' + value + ')');- //$(node).css('background-image', 'url(' + value + ')');+ Vvveb.StyleManager.setStyle(node, "background-image", 'url(' + value + ')');return node;}- }, {+ },{name: "Repeat",key: "background-repeat",sort: base_sort++,@@ -900,18 +906,18 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "",text: "Default"- }, {+ },{value: "repeat-x",text: "repeat-x"- }, {+ },{value: "repeat-y",text: "repeat-y"- }, {+ },{value: "no-repeat",text: "no-repeat"}],}- }, {+ },{name: "Size",key: "background-size",sort: base_sort++,@@ -922,15 +928,15 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "",text: "Default"- }, {+ },{value: "contain",text: "contain"- }, {+ },{value: "cover",text: "cover"}],}- }, {+ },{name: "Position x",key: "background-position-x",sort: base_sort++,@@ -943,18 +949,18 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "",text: "Default"- }, {+ },{value: "center",text: "center"- }, {+ },{value: "right",text: "right"- }, {+ },{value: "left",text: "left"}],}- }, {+ },{name: "Position y",key: "background-position-y",sort: base_sort++,@@ -967,13 +973,13 @@ Vvveb.Components.extend("_base", "_base", {options: [{value: "",text: "Default"- }, {+ },{value: "center",text: "center"- }, {+ },{value: "top",text: "top"- }, {+ },{value: "bottom",text: "bottom"}],@@ -983,7 +989,7 @@ Vvveb.Components.extend("_base", "_base", {//Device visibility-var ComponentDeviceVisibility = {+let ComponentDeviceVisibility = {properties: [{key: "visibility_header",inputtype: SectionInput,@@ -991,7 +997,7 @@ var ComponentDeviceVisibility = {sort: base_sort++,section: advanced_section,data: {header:"Hide based on device screen width"},- }, {+ },{name: "Extra small devices",key: "hidexs",col:6,@@ -1005,7 +1011,7 @@ var ComponentDeviceVisibility = {on: "d-xs-none",off: ""}- }, {+ },{name: "Small devices",key: "hidesm",col:6,@@ -1019,7 +1025,7 @@ var ComponentDeviceVisibility = {on: "d-sm-none",off: ""}- }, {+ },{name: "Medium devices",key: "hidemd",col:6,@@ -1033,7 +1039,7 @@ var ComponentDeviceVisibility = {on: "d-md-none",off: ""}- }, {+ },{name: "Large devices",key: "hidelg",col:6,@@ -1047,7 +1053,7 @@ var ComponentDeviceVisibility = {on: "d-lg-none",off: ""}- }, {+ },{name: "Xl devices",key: "hidexl",col:6,@@ -1061,7 +1067,7 @@ var ComponentDeviceVisibility = {on: "d-xl-none",off: ""}- }, {+ },{name: "Xxl devices",key: "hidexxl",col:6,@@ -1085,8 +1091,8 @@ Vvveb.Components.add("config/bootstrap", {name: "Bootstrap Variables",beforeInit: function (node) {properties = [];- var i = 0;- var j = 0;+ let i = 0;+ let j = 0;let cssVars = Vvveb.ColorPaletteManager.getAllCSSVariableNames(window.FrameDocument.styleSheets/*, ":root"*/);diff --git a/public/js/vvvebjs/components-elements.js b/public/js/vvvebjs/components-elements.jsindex 0b04d5a..7712060 100755--- a/public/js/vvvebjs/components-elements.js+++ b/public/js/vvvebjs/components-elements.js@@ -24,7 +24,6 @@ Vvveb.ComponentsGroup['Elements'] = ["elements/carousel","elements/gallery","elements/slider",-"elements/menu",//"elements/logo","elements/tabs","elements/accordion",@@ -32,30 +31,24 @@ Vvveb.ComponentsGroup['Elements'] = ["elements/counter","elements/svg-icon","elements/figure",-"elements/testimonial",+//"elements/testimonial","elements/social-icons",-"elements/icon-list",-"elements/divider",-"elements/separator",-"elements/image-box",//card cu imagine-"elements/icon-box",-"elements/animated-headline",-"elements/price-table",-"elements/price-list",-"elements/reviews",+//"elements/icon-list",+//"elements/divider",+//"elements/separator",+//"elements/image-box",+//"elements/icon-box",+//"elements/animated-headline",+//"elements/price-table",+//"elements/price-list",+//"elements/reviews","elements/code","elements/image-compare",-"elements/back-to-top",-"elements/blob",-"elements/image-shape",-"elements/image-shape",-"elements/rating",-"elements/section",-"elements/footer",-"elements/header",-// cover-//counter-//flip box+//"elements/back-to-top",+//"elements/blob",+//"elements/image-shape",+//"elements/image-shape",+//"elements/rating",];Vvveb.Components.extend("_base","elements/figure", {@@ -69,8 +62,7 @@ Vvveb.Components.extend("_base","elements/figure", {<div class="border"></div></figure>`,- stylesheets:[- {+ stylesheets:[{//the css is added in head when the element is added to page'src': Vvveb.baseUrl + 'css/figure.css',//the css is removed on save if none of the figure elements are present in the page@@ -93,25 +85,25 @@ Vvveb.Components.extend("_base","elements/figure", {child:"img",htmlAttr: "src",inputtype: ImageInput- }, {+ },{name: "Width",key: "width",child:"img",htmlAttr: "width",inputtype: CssUnitInput- }, {+ },{name: "Height",key: "height",child:"img",htmlAttr: "height",inputtype: CssUnitInput- }, {+ },{name: "Alt",key: "alt",child:"img",htmlAttr: "alt",inputtype: TextInput- }, {+ },{name: "Caption",key: "caption",child:"figcaption",@@ -135,14 +127,15 @@ Vvveb.Components.extend("_base","elements/font-icon", {inline:true,inputtype: HtmlListSelectInput,onChange:function(element, value, input, component) {-- element.removeClass(["la", "lab", "lar"]);- element.removeClass(function (index, className) {- return (className.match (/(^|\s)la-(?!lg|2x)\S+/g) || []).join(' ');+ element.classList.remove("la", "lab", "lar");+ let className = element.getAttribute('class');+ element.classList.forEach((value, key, listObj) => {+ if (value.startsWith("la-") && value != "la-lg") {+ element.classList.remove(value);+ }});-- element.addClass(input.firstChild.className);+ element.classList.add(...input.className.split(" "));return element;},data: {@@ -155,7 +148,7 @@ Vvveb.Components.extend("_base","elements/font-icon", {text: "Line-awesome"}]},- }, {+ },{name: "Size",key: "type",htmlAttr: "class",@@ -165,10 +158,10 @@ Vvveb.Components.extend("_base","elements/font-icon", {options: [{value: "",text: "Normal"- }, {+ },{value: "la-lg",text: "Large"- }, {+ },{value: "la-2x",text: "2x"}]@@ -184,7 +177,7 @@ V.Resources.Icons ={value: `envelope.svg`,text: "Sections"-}, {+},{value: `star.svg`,text: "Flipbox"}];*/@@ -202,113 +195,115 @@ Vvveb.Components.extend("_base","elements/svg-icon", {inline:true,inputtype: HtmlListSelectInput,onChange:function(element, value, input, component) {- var newElement = $(value);- let attributes = element.prop("attributes");+ let newElement = generateElements(value)[0];+ let attributes = element.attributes;//keep old svg size and colors- $.each(attributes, function() {- if (this.name == "viewBox") return;- newElement.attr(this.name, this.value);- });-+ 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"- }]+ 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",@@ -318,7 +313,7 @@ Vvveb.Components.extend("_base","elements/svg-icon", {min:6,step:1}- }, {+ },{name: "Height",key: "height",htmlAttr: "height",@@ -328,7 +323,7 @@ Vvveb.Components.extend("_base","elements/svg-icon", {min:6,step:1}- }, {+ },{name: "Stroke width",key: "stroke-width",htmlAttr: "stroke-width",@@ -345,7 +340,7 @@ Vvveb.Components.extend("_base","elements/svg-icon", {//sort: base_sort++,section: style_section,data: {header:"Svg colors"},- }, {+ },{name: "Fill Color",key: "fill",//sort: base_sort++,@@ -408,7 +403,7 @@ Vvveb.Components.add("elements/svg-element", {section: style_section,htmlAttr: "color",inputtype: ColorInput,- }, {+ },{name: "Stroke width",key: "stroke-width",htmlAttr: "stroke-width",@@ -476,21 +471,21 @@ Vvveb.Components.add("elements/gallery", {off: "flex"},setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll(".mb-3[data-group]").forEach(el => el.style.display = "none");+ document.querySelector('.mb-3[data-group="'+ group + '"]').style.display = "";},onChange : function(node, value, input) {this.setGroup(value);return node;},init: function (node) {- if ($(node).hasClass("masonry")) {+ if (node.classList.contains("masonry")) {return "masonry";} else {return "flex";}},- }, {+ },{name: "Image shadow",key: "shadow",htmlAttr: "class",@@ -500,7 +495,7 @@ Vvveb.Components.add("elements/gallery", {on: "has-shadow",off: ""},- }, {+ },{name: "Horizontal gap",key: "column-gap",htmlAttr: "style",@@ -510,7 +505,7 @@ Vvveb.Components.add("elements/gallery", {min:0,step:1}- }, {+ },{name: "Vertical gap",key: "margin-bottom",htmlAttr: "style",@@ -521,7 +516,7 @@ Vvveb.Components.add("elements/gallery", {min:0,step:1}- }, {+ },{name: "Images per row masonry",key: "column-count",group:"masonry",@@ -532,7 +527,7 @@ Vvveb.Components.add("elements/gallery", {min:1,step:1}- }, {+ },{name: "Images per row flex",group:"flex",key: "flex-basis",@@ -552,13 +547,13 @@ Vvveb.Components.add("elements/gallery", {return value;}- }, {+ },{name: "",key: "addChild",inputtype: ButtonInput,data: {text:"Add image", icon:"la la-plus"},onChange: function(node) {- $(node).append('<div class="item"><a><img src="../../media/posts/1.jpg"></a></div>');+ node.append(generateElements('<div class="item"><a><img src="../../media/posts/1.jpg"></a></div>')[0]);//render component properties again to include the new image//Vvveb.Components.render("ellements/gallery");@@ -567,49 +562,20 @@ Vvveb.Components.add("elements/gallery", {}}],init(node) {-- $('.mb-3[data-group]').attr('style','display:none !important');++ document.querySelectorAll(".mb-3[data-group]").forEach(el => el.style.display = "none");let source = "flex";- if ($(node).hasClass("masonry")) {+ if (node.classList.contains("masonry")) {source = "masonry";} else {source = "flex";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelector('.mb-3[data-group="'+ source + '"]').style.display = "";}});-//Menu-Vvveb.Components.add("elements/Menu", {- nodes: ["i.icon"],- name: "menu",- image: "icons/navbar.svg",- html: `<section>- <div class="container>- <h1>Container</h1>- </div>- </section>`,- properties: [- ]-});--//Logo-/*-Vvveb.Components.add("elements/logo", {- nodes: ["i.icon"],- name: "Logo",- image: "icons/logo.svg",- html: `<section>- <div class="container>- <h1>Container</h1>- </div>- </section>`,- properties: [- ]-});-*///TabsVvveb.Components.add("elements/tab", {//attributes: ["data-component-tabs"],@@ -624,7 +590,7 @@ Vvveb.Components.add("elements/tab", {inline:false,col:6,inputtype: TextInput- }, {+ },{name: "Class",key: "class",htmlAttr: "class",@@ -673,7 +639,7 @@ Vvveb.Components.add("elements/tabs", {</div>`,afterDrop: function(node) {//set unique accordion id- node[0].outerHTML = node[0].outerHTML.replaceAll('parentId', Math.ceil(Math.random() * 1000));+ node.outerHTML = node.outerHTML.replaceAll('parentId', Math.ceil(Math.random() * 1000));return node;},properties: [{@@ -696,31 +662,30 @@ Vvveb.Components.add("elements/tabs", {//"newElement": ``},onChange: function(node, value, input, component, event) {- let element = node[0];+ let element = node;let tabsId = element.id.replace('tabs-','');- let nav = $("> nav .nav-tabs", node);- let content = $("> .tab-content", node);+ let nav = node.querySelector("> nav .nav-tabs");+ let content = node.querySelector("> .tab-content");if (event.action) {if (event.action == "add") {let random = Math.floor(Math.random() * 100) + 1;- let index = nav[0].childElementCount + 1;+ let index = nav.childElementCount + 1;- nav.append(`<button class="nav-link" id="nav-tab-${tabsId}-${index}-${random}" data-bs-toggle="tab" data-bs-target="#tab-${tabsId}-${index}-${random}" type="button" role="tab" aria-controls="tab-${index}-${random}" aria-selected="false">Tab ${index}</button>`);+ nav.append(generateElements(`<button class="nav-link" id="nav-tab-${tabsId}-${index}-${random}" data-bs-toggle="tab" data-bs-target="#tab-${tabsId}-${index}-${random}" type="button" role="tab" aria-controls="tab-${index}-${random}" aria-selected="false">Tab ${index}</button>`)[0]);- content.append(`<div class="tab-pane p-4" id="tab-${tabsId}-${index}-${random}" role="tabpanel" aria-labelledby="tab-${tabsId}-${index}-${random}" tabindex="0"><p>Quisque sagittis non ex eget vestibulum</p></div>`);+ content.append(generateElements(`<div class="tab-pane p-4" id="tab-${tabsId}-${index}-${random}" role="tabpanel" aria-labelledby="tab-${tabsId}-${index}-${random}" tabindex="0"><p>Quisque sagittis non ex eget vestibulum</p></div>`)[0]);//temporary solution to better update listVvveb.Components.render("elements/tabs");}if (event.action == "remove") {- $("> button:eq(" + event.index + ")", nav).remove();- $("> .tab-pane:eq(" + event.index + ")", content).remove();+ nav.querySelector("> button:nth-child(" + event.index + ")").remove();+ content.querySelector("> .tab-pane:nth-child(" + event.index + ")").remove();} else if (event.action == "select") {- let tab = $("> button:eq(" + event.index + ")", nav);- //tab[0].click();- Vvveb.Builder.iframe.contentWindow.bootstrap.Tab.getOrCreateInstance(tab[0]).show();+ let tab = nav.querySelector("> button:nth-child((" + event.index + ")");+ Vvveb.Builder.iframe.contentWindow.bootstrap.Tab.getOrCreateInstance(tab).show();}}@@ -776,7 +741,7 @@ Vvveb.Components.add("elements/accordion", {</div>`,afterDrop: function(node) {//set unique accordion id- node[0].outerHTML = node[0].outerHTML.replaceAll('parentId', Math.ceil(Math.random() * 1000));+ node.outerHTML = node.outerHTML.replaceAll('parentId', Math.ceil(Math.random() * 1000));return node;},properties: [{@@ -795,7 +760,7 @@ Vvveb.Components.add("elements/accordion", {//"newElement": ``},onChange: function(node, value, input, component, event) {- let element = node[0];+ let element = node;let accordionId = element.id.replace('accordion-','');if (event.action) {@@ -803,7 +768,7 @@ Vvveb.Components.add("elements/accordion", {let random = Math.floor(Math.random() * 100) + 1;let index = element.childElementCount + 1;- node.append(`<div class="accordion-item">+ node.append(generateElements(`<div class="accordion-item"><h2 class="accordion-header" id="heading-${index}-${random}"><button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-${index}-${random}" aria-expanded="false" aria-controls="collapseTwo">Accordion Item #${index}</button></h2>@@ -812,20 +777,20 @@ Vvveb.Components.add("elements/accordion", {<p>Mauris viverra cursus ante laoreet eleifend. Donec vel fringilla ante. Aenean finibus velit id urna vehicula, nec maximus est sollicitudin</p></div></div>- </div>`);+ </div>`)[0]);//temporary solution to better update listVvveb.Components.render("elements/accordion");}if (event.action == "remove") {- $("> .accordion-item:eq(" + event.index + ")", node).remove();+ node.querySelector("> .accordion-item:nth-child(" + event.index + ")").remove();} else if (event.action == "select") {- let btn = $("> .accordion-item:eq(" + event.index + ") .accordion-button", node);- let el = $("> .accordion-item:eq(" + event.index + ") .collapse", node);- $(".accordion-button", node).addClass("collapsed");- $(".collapse", node).removeClass("show");- btn.removeClass("collapsed");- el.addClass("show");+ let btn = node.querySelector("> .accordion-item:nth-child(" + event.index + ") .accordion-button", node);+ let el = node.querySelector("> .accordion-item:nth-child(" + event.index + ") .collapse", node);+ node.querySelector(".accordion-button", node).classList.add("collapsed");+ node.querySelector(".collapse", node).classList.remove("show");+ btn.classList.remove("collapsed");+ el.classList.add("show");//el[0].click();//Vvveb.Builder.iframe.contentWindow.bootstrap.Collapse.getOrCreateInstance(el[0]).toggle();}@@ -833,7 +798,7 @@ Vvveb.Components.add("elements/accordion", {return node;},- }, {+ },{name: "Flush",key: "flush",htmlAttr: "class",@@ -885,7 +850,7 @@ Vvveb.Components.add("elements/flip-box", {key: "width",htmlAttr: "style",inputtype: CssUnitInput- }, {+ },{name: "Height",key: "height",htmlAttr: "style",@@ -924,16 +889,7 @@ Vvveb.Components.add("elements/flip-box", {},]});-/*-Vvveb.Components.add("elements/contact-form", {- nodes: [".contact-form"],- name: "Contact form",- image: "icons/envelope.svg",- html: `<i class="font-icon la la-star"></i>`,- properties: [- ]-});-*/+Vvveb.Components.add("elements/counter", {nodes: [".counter"],name: "Counter",@@ -942,16 +898,7 @@ Vvveb.Components.add("elements/counter", {properties: []});-/*-Vvveb.Components.add("elements/subscribe-form", {- nodes: [".counter"],- name: "Subscribe form",- image: "icons/bell.svg",- html: `<i class="font-icon la la-star"></i>`,- properties: [- ]-});-*/+Vvveb.Components.add("elements/testimonial", {nodes: [".counter"],name: "Testimonial",@@ -1013,23 +960,23 @@ Vvveb.Components.add("elements/social-icons", {//"newElement": ``},onChange: function(node, value, input, component, event) {- let element = node[0];+ let element = node;if (event.action) {if (event.action == "add") {- node.append(`<li>+ node.append(generateElements(`<li><a href="https://twitter.com"><i class="lab la-twitter la-2x"></i> <span>Twitter</span></a>- </li>`);+ </li>`)[0]);//temporary solution to better update listVvveb.Components.render("elements/social-icons");}if (event.action == "remove") {- //$("> li:eq(" + event.index + ")", node).remove();+ node.querySelector(":scope > li:nth-child(" + event.index + ")").remove();} else if (event.action == "select") {- let el = $("> li:eq(" + event.index + ")", node);+ let el = node.querySelector(":scope > li:nth-child(" + event.index + ")");//el[0].click();//Vvveb.Builder.iframe.contentWindow.bootstrap.Collapse.getOrCreateInstance(el[0]).toggle();}@@ -1037,7 +984,7 @@ Vvveb.Components.add("elements/social-icons", {return node;},- }, {+ },{name: "Inline",key: "list-inline",htmlAttr: "class",@@ -1047,7 +994,7 @@ Vvveb.Components.add("elements/social-icons", {on: "list-inline",off: ""}- }, {+ },{name: "Unstyled",key: "list-unstyled",htmlAttr: "class",@@ -1063,15 +1010,23 @@ Vvveb.Components.add("elements/social-icons", {function carouselAfterDrop(node) {//check if swiper js is included and if not add it when drag starts to allow the script to loadbody = Vvveb.Builder.frameBody;-- if ($("#swiper-js", body).length == 0)- {- let swiperScript = `<script id="swiper-js" src="../../js/libs/swiper/swiper-bundle.min.js"></script>- <link id="swiper-css" href="../../js/libs/swiper/swiper-bundle.min.css" rel="stylesheet">- <script>- var swiper = [];++ if (!body.querySelector("#swiper-js")) {+ let link = document.createElement('link');+ let lib = document.createElement('script');+ let code = document.createElement('script');+ link.href = '../../libs/swiper/swiper-bundle.min.css';+ link.id = 'swiper-css';+ link.rel = 'stylesheet';+ lib.id = 'swiper-js';+ lib.type = 'text/javascript';+ lib.src = '../../libs/swiper/swiper-bundle.min.js';+ code.type = 'text/javascript';+ code.text = `+ let swiper = [];function initSwiper(onlyNew = false) {- var list = document.querySelectorAll('.swiper' + (onlyNew ? ":not(.swiper-initialized)" : "") );+ if (typeof Swiper == "undefined") return;+ let list = document.querySelectorAll('.swiper' + (onlyNew ? ":not(.swiper-initialized)" : "") );list.forEach(el => {let params = {navigation: {@@ -1092,13 +1047,21 @@ function carouselAfterDrop(node) {swiper.push(new Swiper(el, params))//swiper.push(new Swiper(el, { ...{autoplay:{delay: 500}}, ...el.dataset}))});- }- $(document).ready(function() {+ }++ if (document.readyState !== 'loading') {initSwiper();- });- </script>`;-- $(body).append(swiperScript);+ } else {+ document.addEventListener('DOMContentLoaded', initSwiper);+ }`;++ body.appendChild(link);+ body.appendChild(lib);+ body.appendChild(code);++ lib.addEventListener('load', function() {+ Vvveb.Builder.iframe.contentWindow.initSwiper();+ });} else {Vvveb.Builder.iframe.contentWindow.initSwiper(true);}@@ -1131,7 +1094,7 @@ Vvveb.Components.add("elements/carousel", {afterDrop: carouselAfterDrop,onChange: function (node, property, value) {- let element = node[0];+ let element = node;if (property.key == "autoplay" && value == true) {value = {"waitForTransition":true,"enabled":value,"delay":element.dataset.delay};}@@ -1142,8 +1105,7 @@ Vvveb.Components.add("elements/carousel", {return node;},- properties: [- {+ properties: [{name: "Slides",key: "slidesPerView",inputtype: ListInput,@@ -1157,7 +1119,7 @@ Vvveb.Components.add("elements/carousel", {//"newElement": `<div class="swiper-slide"><img src="../../media/posts/1.jpg" class="img-fluid"><p>Slide 1</p></div>`},onChange: function(node, value, input, component, event) {- let element = node[0];+ let element = node;let dataset = {};for (i in element.dataset) {dataset[i] = element.dataset[i];@@ -1167,7 +1129,7 @@ Vvveb.Components.add("elements/carousel", {if (event.action == "add") {let random = Math.floor(Math.random() * 6) + 1;let index = element.swiper.slides.length + 1;- element.swiper.appendSlide(`<div class="swiper-slide"><img src="../../media/posts/${random}.jpg" class="img-fluid"><p>Slide ${index}</p></div>`);+ element.swiper.appendSlide(generateElements(`<div class="swiper-slide"><img src="../../media/posts/${random}.jpg" class="img-fluid"><p>Slide ${index}</p></div>`)[0]);element.swiper.slideTo(index);//temporary solution to better update listVvveb.Components.render("elements/carousel");@@ -1189,26 +1151,23 @@ Vvveb.Components.add("elements/carousel", {return node;},- }, {+ },{name: "Slides per view",key: "slidesPerView",inputtype: NumberInput,htmlAttr:"data-slides-per-view",- },- {+ },{name: "Space between",key: "spaceBetween",inputtype: NumberInput,htmlAttr:"data-space-between",- },- {+ },{name: "Speed",key: "speed",inputtype: NumberInput,htmlAttr:"data-speed",data: {step:100},- },- {+ },{name: "Delay",key: "delay",inputtype: NumberInput,@@ -1233,7 +1192,7 @@ Vvveb.Components.add("elements/carousel", {inputtype: CheckboxInput,inline:true,col:4- }, {+ },{name: "Auto height",key: "autoHeight",htmlAttr:"data-auto-height",@@ -1284,8 +1243,7 @@ Vvveb.Components.add("elements/carousel", {inputtype: CheckboxInput,inline:true,col:4- },/*- {+ },/*{name: "direction",key: "direction",htmlAttr:"data-direction",@@ -1300,7 +1258,7 @@ Vvveb.Components.add("elements/carousel", {icon:"la la-arrow-down",title: "Horizontal",checked:true,- }, {+ },{value: "vertical",title: "Vertical",icon:"la la-arrow-right",diff --git a/public/js/vvvebjs/components-embeds.js b/public/js/vvvebjs/components-embeds.jsindex ec94863..4cb37c1 100755--- a/public/js/vvvebjs/components-embeds.js+++ b/public/js/vvvebjs/components-embeds.js@@ -47,24 +47,24 @@ Vvveb.Components.extend("_base", "embeds/embed", {getOembed(value).then(response => {element.innerHTML = response.html;- let containerW = node.width();- let iframe = $("iframe", element);- let ratio = containerW / iframe.width();+ let containerW = node.offsetWidth;+ let iframe = element.querySelector("iframe");+ let ratio = containerW / iframe.offsetWidth;- iframe.attr("width",(i, width) => width * ratio);- iframe.attr("height", (i, height) => height * ratio);+ iframe.setAttribute("width", (width * ratio));+ iframe.setAttribute("height", (height * ratio));}).catch(error => console.log(error));return node;},- }, {+ },{name: "Width",key: "width",child:"iframe",htmlAttr: "width",inputtype: CssUnitInput- }, {+ },{name: "Height",key: "height",child:"iframe",@@ -75,7 +75,7 @@ Vvveb.Components.extend("_base", "embeds/embed", {for (const provider of ["youtube", "vimeo", "dailymotion", "flickr", "smugmug", "scribd", "twitter", "soundcloud", "slideshare", "spotify", "imgur", "issuu", "mixcloud", "ted", "animoto", "tumblr", "kickstarter", "reverbnation", "reddit", "speakerdeck", "screencast", "amazon", "someecards", "tiktok","pinterest", "wolfram", "anghami"]) {Vvveb.Components.add("embeds/" + provider, {- name: ucFirst(provider),+ name: provider,image: "icons/code.svg",html: `<div data-component-oembed data-url=""><div class="alert alert-light m-5" role="alert">diff --git a/public/js/vvvebjs/components-html.js b/public/js/vvvebjs/components-html.jsindex ab3f89b..ffa05c8 100755--- a/public/js/vvvebjs/components-html.js+++ b/public/js/vvvebjs/components-html.js@@ -7,19 +7,18 @@ Vvveb.Components.extend("_base", "html/heading", {nodes: ["h1", "h2","h3", "h4","h5","h6"],html: "<h1>Heading</h1>",- properties: [- {+ properties: [{name: "Size",key: "size",inputtype: SelectInput,onChange: function(node, value) {-+return changeNodeName(node, "h" + value);},init: function(node) {- var regex;+ let regex;regex = /H(\d)/.exec(node.nodeName);if (regex && regex[1]) {return regex[1]@@ -66,7 +65,7 @@ let linkComponentProperties = [sort:2,htmlAttr: "href",inputtype: LinkInput- }, {+ },{name: "Rel",key: "rel",sort:3,@@ -115,7 +114,7 @@ Vvveb.Components.extend("_base", "html/link", {Vvveb.Components.extend("_base", "html/image", {nodes: ["img"],name: "Image",- html: '<img src="' + Vvveb.baseUrl + 'icons/image.svg" width="300" class="mw-100 align-center">',+ html: '<img src="' + Vvveb.baseUrl + 'icons/image.svg" class="mw-100 align-center">',image: "icons/image.svg",resizable:true,//show select box resize handlers@@ -177,7 +176,7 @@ Vvveb.Components.extend("_base", "html/image", {},{key: "link_options",inputtype: SectionInput,- name:false,+ //name:false,data: {header:"Link"},},{name: "Enable link",@@ -187,19 +186,27 @@ Vvveb.Components.extend("_base", "html/image", {className: "form-switch"},setGroup: value => {- let group = $('.mb-3[data-group="link"]');- if (value) {- group.attr('style','');- } else {- group.attr('style','display:none !important');+ let group = document.querySelectorAll('.mb-3[data-group="link"]');+ if (group.length) {+ group.forEach(el => {+ if (value) {+ el.style.display = "";+ } else {+ el.style.display = "none";+ }+ });}},onChange : function(node, value, input) {this.setGroup(value);if (value) {- $(node).wrap('<a href="#"></a>');+ const wrappingElement = document.createElement('a');+ node.replaceWith(wrappingElement);+ wrappingElement.appendChild(node);} else {- $(node).unwrap('a');+ if (node.parentNode.tagName.toLowerCase() == "a"){+ node.parentNode.replaceWith(node);+ }}return node;},@@ -214,13 +221,16 @@ Vvveb.Components.extend("_base", "html/image", {(el) => {let a = Object.assign({}, el);a["parent"] = "a";a["group"] = "link";return a})),- init(node) {-- let group = $('.mb-3[data-group="link"]');- if (node.parentNode.tagName.toLowerCase() == "a") {- group.attr('style','');- } else {- group.attr('style','display:none !important');+ init(node) {+ let group = document.querySelectorAll('.mb-3[data-group="link"]');+ if (group.length) {+ group.forEach(el => {+ if (value) {+ el.style.display = "";+ } else {+ el.style.display = "none";+ }+ });}return node;@@ -459,41 +469,39 @@ Vvveb.Components.extend("_base", "html/selectinput", {image: "icons/select_input.svg",html: '<select class="form-control"><option value="value1">Text 1</option><option value="value2">Text 2</option><option value="value3">Text 3</option></select>',- beforeInit: function (node)- {+ beforeInit: function (node) {properties = [];- var i = 0;+ let i = 0;- $(node).find('option').each(function(e) {- data = {"value": this.value, "text": this.text};+ node.querySelectorAll('option').forEach(el => {+ data = {"value": el.value, "text": el.text};i++;properties.push({name: "Option " + i,key: "option" + i,//index: i - 1,- optionNode: this,+ optionNode: el,inline:true,inputtype: TextValueInput,data: data,onChange: function(node, value, input) {- option = $(this.optionNode);+ option = this.optionNode;//if remove button is clicked remove option and render row properties- if (input.nodeName == 'BUTTON')- {+ if (input.nodeName == 'BUTTON') {option.remove();Vvveb.Components.render("html/selectinput");return node;}- if (input.name == "value") option.attr("value", value);- else if (input.name == "text") option.text(value);-+ if (input.name == "value") option.setAttribute("value", value);+ else if (input.name == "text") option.textContent = value;return node;},});});+//remove all option propertiesthis.properties = this.properties.filter(function(item) {return item.key.indexOf("option") === -1;@@ -539,7 +547,7 @@ Vvveb.Components.extend("_base", "html/selectinput", {data: {text:"Add option", icon:"la-plus"},onChange: function(node){- $(node).append('<option value="value">Text</option>');+ node.append(generateElements('<option value="value">Text</option>')[0]);//render component properties again to include the new column inputsVvveb.Components.render("html/selectinput");@@ -1003,6 +1011,7 @@ Vvveb.Components.extend("_base", "html/form", {Vvveb.Components.extend("_base", "html/tablerow", {nodes: ["tr"],+ image: "icons/table.svg",name: "Table Row",html: "<tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td></tr>",properties: [{@@ -1033,18 +1042,35 @@ Vvveb.Components.extend("_base", "html/tablerow", {});Vvveb.Components.extend("_base", "html/tablecell", {nodes: ["td"],+ image: "icons/table.svg",name: "Table Cell",html: "<td>Cell</td>"});Vvveb.Components.extend("_base", "html/tableheadercell", {nodes: ["th"],+ image: "icons/table.svg",name: "Table Header Cell",html: "<th>Head</th>"});+Vvveb.Components.extend("_base", "html/tablebody", {+ nodes: ["tbody"],+ image: "icons/table.svg",+ name: "Table Body",+ html: "<tbody>Table body</tbody>"+});++Vvveb.Components.extend("_base", "html/tablefooter", {+ nodes: ["tfooter"],+ image: "icons/table.svg",+ name: "Table Footer",+ html: "<tfooter>Table footer</tfooter>"+});+Vvveb.Components.extend("_base", "html/tablehead", {nodes: ["thead"],+ image: "icons/table.svg",name: "Table Head",html: "<thead><tr><th>Head 1</th><th>Head 2</th><th>Head 3</th></tr></thead>",properties: [{@@ -1108,8 +1134,7 @@ Vvveb.Components.extend("_base", "html/table", {</tr></tbody></table>`,- properties: [- {+ properties: [{name: "Type",key: "type",htmlAttr: "class",@@ -1122,34 +1147,33 @@ Vvveb.Components.extend("_base", "html/table", {}, {value: "table-primary",text: "Primary"- }, {+ },{value: "table-secondary",text: "Secondary"- }, {+ },{value: "table-success",text: "Success"- }, {+ },{value: "table-danger",text: "Danger"- }, {+ },{value: "table-warning",text: "Warning"- }, {+ },{value: "table-info",text: "Info"- }, {+ },{value: "table-light",text: "Light"- }, {+ },{value: "table-dark",text: "Dark"- }, {+ },{value: "table-white",text: "White"}]}- },- {+ }, {name: "Responsive",key: "responsive",htmlAttr: "class",@@ -1159,8 +1183,7 @@ Vvveb.Components.extend("_base", "html/table", {on: "table-responsive",off: ""}- },- {+ }, {name: "Small",key: "small",htmlAttr: "class",@@ -1170,8 +1193,7 @@ Vvveb.Components.extend("_base", "html/table", {on: "table-sm",off: ""}- },- {+ }, {name: "Hover",key: "hover",htmlAttr: "class",@@ -1181,8 +1203,7 @@ Vvveb.Components.extend("_base", "html/table", {on: "table-hover",off: ""}- },- {+ }, {name: "Bordered",key: "bordered",htmlAttr: "class",@@ -1192,8 +1213,7 @@ Vvveb.Components.extend("_base", "html/table", {on: "table-bordered",off: ""}- },- {+ }, {name: "Striped",key: "striped",htmlAttr: "class",@@ -1203,8 +1223,7 @@ Vvveb.Components.extend("_base", "html/table", {on: "table-striped",off: ""}- },- {+ }, {name: "Inverse",key: "inverse",htmlAttr: "class",diff --git a/public/js/vvvebjs/components-server.js b/public/js/vvvebjs/components-server.jsindex d893e0a..d61d764 100755--- a/public/js/vvvebjs/components-server.js+++ b/public/js/vvvebjs/components-server.js@@ -25,14 +25,12 @@ Vvveb.Components.add("components/product", {image: "icons/map.svg",html: '<iframe frameborder="0" src="https://maps.google.com/maps?&z=1&t=q&output=embed"></iframe>',- properties: [- {+ properties: [{name: "Id",key: "id",htmlAttr: "id",inputtype: TextInput- },- {+ },{name: "Select",key: "id",htmlAttr: "id",@@ -41,16 +39,15 @@ Vvveb.Components.add("components/product", {options: [{value: "",text: "None"- }, {+ },{value: "pull-left",text: "Left"- }, {+ },{value: "pull-right",text: "Right"}]},- },- {+ },{name: "Select 2",key: "id",htmlAttr: "id",@@ -59,13 +56,13 @@ Vvveb.Components.add("components/product", {options: [{value: "",text: "nimic"- }, {+ },{value: "pull-left",text: "gigi"- }, {+ },{value: "pull-right",text: "vasile"- }, {+ },{value: "pull-right",text: "sad34"}]@@ -81,14 +78,11 @@ Vvveb.Components.add("components/products", {image: "icons/products.svg",html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',- init: function (node)- {+ init: function (node) {$('.mb-3[data-group]').hide();- if (node.dataset.type != undefined)- {+ if (node.dataset.type != undefined) {$('.mb-3[data-group="'+ node.dataset.type + '"]').show();- } else- {+ } else {$('.mb-3[data-group]:first').show();}},@@ -106,7 +100,7 @@ Vvveb.Components.add("components/products", {title: "Autocomplete",icon:"la la-search",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -172,19 +166,19 @@ Vvveb.Components.add("components/products", {options: [{value: "price_asc",text: "Price Ascending"- }, {+ },{value: "price_desc",text: "Price Descending"- }, {+ },{value: "date_asc",text: "Date Ascending"- }, {+ },{value: "date_desc",text: "Date Descending"- }, {+ },{value: "sales_asc",text: "Sales Ascending"- }, {+ },{value: "sales_desc",text: "Sales Descending"}]@@ -263,12 +257,12 @@ Vvveb.Components.add("components/search", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -285,12 +279,12 @@ Vvveb.Components.add("components/user", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -307,12 +301,12 @@ Vvveb.Components.add("components/product_gallery", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -329,12 +323,12 @@ Vvveb.Components.add("components/cart", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -351,12 +345,12 @@ Vvveb.Components.add("components/checkout", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -373,12 +367,12 @@ Vvveb.Components.add("components/filters", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -395,12 +389,12 @@ Vvveb.Components.add("components/product", {key: "src",htmlAttr: "src",inputtype: FileUploadInput- }, {+ },{name: "34234234",key: "width",htmlAttr: "width",inputtype: TextInput- }, {+ },{name: "d32d23",key: "height",htmlAttr: "height",@@ -419,18 +413,17 @@ Vvveb.Components.add("components/slider", {image: "icons/slider.svg",html: '<div class="mb-3"><label>Your response:</label><textarea class="form-control"></textarea></div>',- beforeInit: function (node)- {+ beforeInit: function (node) {properties = [];- var i = 0;- var j = 0;+ let i = 0;+ let j = 0;$(node).find('[data-slide]').each(function() {- _class = $(this).attr("class");+ _class = $(this).getAttribute("class");- var reg = /col-([^-\$ ]*)?-?(\d+)/g;- var match;- var data = {};+ let reg = /col-([^-\$ ]*)?-?(\d+)/g;+ let match;+ let data = {};while ((match = reg.exec(_class)) != null) {data["col" + ((match[1] != undefined)?"_" + match[1]:"")] = match[2];@@ -449,26 +442,23 @@ Vvveb.Components.add("components/slider", {onChange: function(node, value, input) {//column = $('[class*="col-"]:eq(' + this.index + ')', node);- var column = $(this.columnNode);+ let column = $(this.columnNode);//if remove button is clicked remove column and render row properties- if (input.nodeName == 'BUTTON')- {+ if (input.nodeName == 'BUTTON') {column.remove();Vvveb.Components.render("html/gridrow");return node;}//if select input then change column class- _class = column.attr("class");+ _class = column.getAttribute("class");//remove previous breakpoint column size_class = _class.replace(new RegExp(input.name + '-\\d+?'), '');//add new column sizeif (value) _class += ' ' + input.name + '-' + value;- column.attr("class", _class);-- //console.log(this, node, value, input, input.name);+ column.setAttribute"class", _class);return node;},@@ -501,7 +491,7 @@ Vvveb.Components.add("components/slider", {title: "Autocomplete",icon:"la la-search",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -569,19 +559,19 @@ Vvveb.Components.add("components/slider", {options: [{value: "price_asc",text: "Price Ascending"- }, {+ },{value: "price_desc",text: "Price Descending"- }, {+ },{value: "date_asc",text: "Date Ascending"- }, {+ },{value: "date_desc",text: "Date Descending"- }, {+ },{value: "sales_asc",text: "Sales Ascending"- }, {+ },{value: "sales_desc",text: "Sales Descending"}]diff --git a/public/js/vvvebjs/components-widgets.js b/public/js/vvvebjs/components-widgets.jsindex 31d23d5..bf6f360 100755--- a/public/js/vvvebjs/components-widgets.js+++ b/public/js/vvvebjs/components-widgets.js@@ -34,10 +34,9 @@ Vvveb.Components.extend("_base", "widgets/googlemaps", {t: 'q', //map type q = roadmap, w = satellitekey: '',- init: function (node)- {- let iframe = jQuery('iframe', node);- let url = new URL(iframe.attr("src"));+ init: function (node) {+ let iframe = node.querySelector('iframe');+ let url = new URL(iframe.getAttribute("src"));let params = new URLSearchParams(url.search);this.z = params.get("z");@@ -45,20 +44,20 @@ Vvveb.Components.extend("_base", "widgets/googlemaps", {this.t = params.get("t");this.key = params.get("key");- $(".component-properties input[name=z]").val(this.z);- $(".component-properties input[name=q]").val(this.q);- $(".component-properties select[name=t]").val(this.t);- $(".component-properties input[name=key]").val(this.key);+ document.querySelector(".component-properties input[name=z]").value = this.z;+ document.querySelector(".component-properties input[name=q]").value = this.q;+ document.querySelector(".component-properties select[name=t]").value = this.t;+ document.querySelector(".component-properties input[name=key]").value = this.key;},onChange: function (node, property, value) {- map_iframe = jQuery('iframe', node);+ map_iframe = node.querySelector('iframe');this[property.key] = value;mapurl = 'https://maps.google.com/maps?q=' + this.q + '&z=' + this.z + '&t=' + this.t + '&output=embed';- map_iframe.attr("src",mapurl);+ map_iframe.setAttribute("src",mapurl);return node;},@@ -67,7 +66,7 @@ Vvveb.Components.extend("_base", "widgets/googlemaps", {name: "Address",key: "q",inputtype: TextInput- }, {+ },{name: "Map type",key: "t",inputtype: SelectInput,@@ -75,12 +74,12 @@ Vvveb.Components.extend("_base", "widgets/googlemaps", {options: [{value: "q",text: "Roadmap"- }, {+ },{value: "w",text: "Satellite"}]},- }, {+ },{name: "Zoom",key: "z",inputtype: RangeInput,@@ -89,7 +88,7 @@ Vvveb.Components.extend("_base", "widgets/googlemaps", {min:1,step:1}- }, {+ },{name: "Key",key: "key",inputtype: TextInput@@ -110,27 +109,26 @@ Vvveb.Components.extend("_base", "widgets/openstreetmap", {bbox:'',//locationlayer: 'mapnik', //map type- init: function (node)- {- let iframe = jQuery('iframe', node);- let url = new URL(iframe.attr("src"));+ init: function (node) {+ let iframe = node.querySelector('iframe');+ let url = new URL(iframe.getAttribute("src"));let params = new URLSearchParams(url.search);this.bbox = params.get("bbox");this.layer = params.get("layer");- $(".component-properties input[name=bbox]").val(this.bbox);- $(".component-properties input[name=layer]").val(this.layer);+ document.querySelector(".component-properties input[name=bbox]").value = this.bbox;+ document.querySelector(".component-properties input[name=layer]").value = this.layer;},onChange: function (node, property, value) {- map_iframe = jQuery('iframe', node);+ map_iframe = node.querySelector('iframe');this[property.key] = value;mapurl = 'https://www.openstreetmap.org/export/embed.html?bbox=' + this.bbox + '&layer=' + this.layer;- map_iframe.attr("src",mapurl);+ map_iframe.setAttribute("src",mapurl);return node;},@@ -139,7 +137,7 @@ Vvveb.Components.extend("_base", "widgets/openstreetmap", {name: "Map",key: "bbox",inputtype: TextInput-/* }, {+/* },{name: "Layer",key: "layer",inputtype: SelectInput,@@ -147,13 +145,13 @@ Vvveb.Components.extend("_base", "widgets/openstreetmap", {options: [{value: "",text: "Default"- }, {+ },{value: "Y",text: "CyclOSM"- }, {+ },{value: "C",text: "Cycle Map"- }, {+ },{value: "T",text: "Transport Map"}]@@ -183,21 +181,18 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {youtubeRegex:/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]+)/i,vimeoRegex : /(?:vimeo\.com(?:[^\d]+))(\d+)/i,- init: function (node)- {- iframe = jQuery('iframe', node);- video = jQuery('video', node);+ init: function (node) {+ iframe = node.querySelector('iframe');+ video = node.querySelector('video');- $(".component-properties [data-key=url]").hide();- $(".component-properties [data-key=poster]").hide();+ document.querySelector(".component-properties [data-key=url]").style.display = "none";+ document.querySelector(".component-properties [data-key=poster]").style.display = "none";//check if html5- if (video.length)- {+ if (video.length) {this.url = video.src;- } else if (iframe.length) //vimeo or youtube- {- let src = iframe.attr("src");+ } else if (iframe.length) {//vimeo or youtube+ let src = iframe.getAttribute("src");let match;if (src && src.indexOf("youtube") && (match = src.match(this.youtubeRegex))) {//youtube@@ -211,43 +206,42 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {}}- $(".component-properties input[name=video_id]").val(this.video_id);- $(".component-properties input[name=url]").val(this.url);- $(".component-properties select[name=t]").val(this.t);+ document.querySelector(".component-properties input[name=video_id]").value = this.video_id;+ document.querySelector(".component-properties input[name=url]").value = this.url;+ document.querySelector(".component-properties select[name=t]").value = this.t;},- onChange: function (node, property, value)- {+ onChange: function (node, property, value) {this[property.key] = value;//if (property.key == "t"){- switch (this.t)- {+ switch (this.t) {case 'y':- $(".component-properties [data-key=video_id]").show();- $(".component-properties [data-key=url]").hide();- $(".component-properties [data-key=poster]").hide();- newnode = $(`<iframe width="100%" height="100%" allowfullscreen="true" frameborder="0" allow="autoplay"+ document.querySelector(".component-properties [data-key=video_id]").style.display = "";+ document.querySelector(".component-properties [data-key=url]").style.display = "none";+ document.querySelector(".component-properties [data-key=poster]").style.display = "none";++ newnode = generateElements(`<iframe width="100%" height="100%" allowfullscreen="true" frameborder="0" allow="autoplay"src="https://www.youtube.com/embed/${this.video_id}?autoplay=${this.autoplay}&controls=${this.controls}&loop=${this.loop}&playsinline=${this.playsinline}&muted=${this.muted}">- </iframe>`);+ </iframe>`)[0];break;case 'v':- $(".component-properties [data-key=video_id]").show();- $(".component-properties [data-key=url]").hide();- $(".component-properties [data-key=poster]").hide();- newnode = $(`<iframe width="100%" height="100%" allowfullscreen="true" frameborder="0" allow="autoplay"+ document.querySelector(".component-properties [data-key=video_id]").style.display = "";+ document.querySelector(".component-properties [data-key=url]").style.display = "none";+ document.querySelector(".component-properties [data-key=poster]").style.display = "none";+ newnode = generateElements(`<iframe width="100%" height="100%" allowfullscreen="true" frameborder="0" allow="autoplay"src="https://player.vimeo.com/video/${this.video_id}?autoplay=${this.autoplay}&controls=${this.controls}&loop=${this.loop}&playsinline=${this.playsinline}&muted=${this.muted}">- </iframe>`);+ </iframe>`)[0];break;case 'h':- $(".component-properties [data-key=video_id]").hide();- $(".component-properties [data-key=url]").show();- $(".component-properties [data-key=poster]").show();- newnode = $('<video poster="' + this.poster + '" src="' + this.url + '" ' + (this.autoplay?' autoplay ':'') + (this.controls?' controls ':'') + (this.loop?' loop ':'') + (this.playsinline?' playsinline ':'') + (this.muted?' muted ':'') + ' style="height: 100%; width: 100%;"></video>');+ document.querySelector(".component-properties [data-key=video_id]").style.display = "none";+ document.querySelector(".component-properties [data-key=url]").style.display = "";+ document.querySelector(".component-properties [data-key=poster]").style.display = "";+ newnode = generateElements('<video poster="' + this.poster + '" src="' + this.url + '" ' + (this.autoplay?' autoplay ':'') + (this.controls?' controls ':'') + (this.loop?' loop ':'') + (this.playsinline?' playsinline ':'') + (this.muted?' muted ':'') + ' style="height: 100%; width: 100%;"></video>')[0];break;}- $("> iframe, > video", node).replaceWith(newnode);+ node.querySelector("> iframe, > video").replaceWith(newnode);return node;}@@ -262,7 +256,7 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {options: [{text: "Youtube",value: "y"- }, {+ },{text: "Vimeo",value: "v"},{@@ -282,8 +276,8 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {let t = false;if (((id = value.match(youtube)) && (t = "y")) || ((id = value.match(vimeo)) && (t = "v"))) {- $(".component-properties select[name=t]").val(t);- $(".component-properties select[name=video_id]").val(id[1]);+ document.querySelector(".component-properties select[name=t]").value = t;+ document.querySelector(".component-properties select[name=video_id]").value = id[1];component.t = t;component.video_id = id[1];@@ -298,7 +292,7 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {key: "poster",htmlAttr: "poster",inputtype: ImageInput- }, {+ },{name: "Url",key: "url",inputtype: TextInput@@ -309,7 +303,7 @@ Vvveb.Components.extend("_base", "widgets/embed-video", {inline:false,col:6,inputtype: CssUnitInput- }, {+ },{name: "Height",key: "height",htmlAttr: "style",@@ -376,7 +370,7 @@ Vvveb.Components.extend("_base", "widgets/facebookcomments", {image: "icons/facebook.svg",dragHtml: '<img src="' + Vvveb.baseUrl + 'icons/facebook.svg">',html: '<div data-component-facebookcomments><script>(function(d, s, id) {\- var js, fjs = d.getElementsByTagName(s)[0];\+ let js, fjs = d.getElementsByTagName(s)[0];\if (d.getElementById(id)) return;\js = d.createElement(s); js.id = id;\js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appId=";\@@ -452,10 +446,9 @@ Vvveb.Components.extend("_base", "widgets/twitter", {twitterRegex : /(?:twitter\.com(?:[^\d]+))(\d+)/i,tweet:'',//location- init: function (node)- {- let iframe = jQuery('iframe', node);- let src = iframe.attr("src");+ init: function (node) {+ let iframe = node.querySelector('iframe');+ let src = iframe.getAttribute("src");let url = new URL(src);let params = new URLSearchParams(url.search);@@ -468,18 +461,18 @@ Vvveb.Components.extend("_base", "widgets/twitter", {}- $(".component-properties input[name=tweet]").val(this.tweet);+ document.querySelector(".component-properties input[name=tweet]").value = this.tweet;},onChange: function (node, property, value) {- tweet_iframe = jQuery('iframe', node);+ tweet_iframe = node.querySelector('iframe');if (property.key == "tweet") {this[property.key] = value;tweeturl = 'https://platform.twitter.com/embed/Tweet.html?embedId=twitter-widget-0&frame=false&hideCard=false&hideThread=false&id=' + this.tweet;- tweet_iframe.attr("src",tweeturl);+ tweet_iframe.setAttribute("src",tweeturl);}return node;@@ -495,7 +488,7 @@ Vvveb.Components.extend("_base", "widgets/twitter", {let id = false;if (id = value.match(twitterRegex)) {- $(".component-properties input[name=tweet]").val(id[1]);+ document.querySelector(".component-properties input[name=tweet]").value = id[1];component.tweet = id[1];return id[1];@@ -617,12 +610,12 @@ Vvveb.Components.extend("_base", "widgets/facebookpage", {}],onChange: function(node, input, value, component) {- var newElement = $(this.html);- newElement.find(".fb-page").attr(input.htmlAttr, value);+ let newElement = generateElements(this.html)[0];+ newElement.find(".fb-page").setAttribute(input.htmlAttr, value);- $("[data-fbcssmodules]", Vvveb.Builder.frameHead).remove();- $("[data-fbcssmodules]", Vvveb.Builder.frameBody).remove();- $("script[src^='https://connect.facebook.net']", Vvveb.Builder.frameHead).remove();+ frameHead.querySelector("[data-fbcssmodules]").remove();+ frameBody.querySelector("[data-fbcssmodules]").remove();+ frameHead.querySelector("script[src^='https://connect.facebook.net']").remove();node.parent().html(newElement.html());@@ -643,7 +636,7 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {"data": [12, 19, 3, 5, 2, 3],\"fill": false,\"borderColor":"rgba(255, 99, 132, 0.2)"\- }, {\+ },{\"fill": false,\"data": [3, 15, 7, 4, 19, 12],\"borderColor": "rgba(54, 162, 235, 0.2)"\@@ -663,7 +656,7 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {data: [12, 19, 3, 5, 2, 3],fill: false,borderColor:'rgba(255, 99, 132, 0.2)',- }, {+ },{fill: false,data: [3, 15, 7, 4, 19, 12],borderColor: 'rgba(54, 162, 235, 0.2)',@@ -671,15 +664,13 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {},*/},- dragStart: function (node)- {+ dragStart: function (node) {//check if chartjs is included and if not add it when drag starts to allow the script to loadbody = Vvveb.Builder.frameBody;- if ($("#chartjs-script", body).length == 0)- {- $(body).append('<script id="chartjs-script" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>');- $(body).append('<script>\+ if (document.getElementById("#chartjs-script")) {+ body.append(generateElements('<script id="chartjs-script" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>')[0]);+ body.append(generateElements('<script>\$(document).ready(function() {\$(".chartjs").each(function () {\ctx = $("canvas", this).get(0).getContext("2d");\@@ -687,15 +678,14 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {chartjs = new Chart(ctx, config);\});\\});\- </script>');+ </script>')[0]);}return node;},- drawChart: function ()- {+ drawChart: function () {if (this.chartjs != null) this.chartjs.destroy();this.node.dataset.chart = JSON.stringify(this.config);@@ -703,10 +693,9 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {this.chartjs = new Chart(this.ctx, config);},- init: function (node)- {+ init: function (node) {this.node = node;- this.ctx = $("canvas", node).get(0).getContext("2d");+ this.ctx = node.querySelector("canvas").getContext("2d");this.config = JSON.parse(node.dataset.chart);this.drawChart();@@ -714,13 +703,11 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {},- beforeInit: function (node)- {+ beforeInit: function (node) {return node;},- properties: [- {+ properties: [{name: "Type",key: "type",inputtype: SelectInput,@@ -728,22 +715,22 @@ Vvveb.Components.extend("_base", "widgets/chartjs", {options: [{text: "Line",value: "line"- }, {+ },{text: "Bar",value: "bar"- }, {+ },{text: "Pie",value: "pie"- }, {+ },{text: "Doughnut",value: "doughnut"- }, {+ },{text: "Polar Area",value: "polarArea"- }, {+ },{text: "Bubble",value: "bubble"- }, {+ },{text: "Scatter",value: "scatter"},{diff --git a/public/js/vvvebjs/components/content/archives.js b/public/js/vvvebjs/components/content/archives.jsindex cf3128c..de8276b 100755--- a/public/js/vvvebjs/components/content/archives.js+++ b/public/js/vvvebjs/components/content/archives.js@@ -68,7 +68,7 @@ class ArchivesComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -78,8 +78,10 @@ class ArchivesComponent extends ServerComponent{},setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;},onChange : function(element, value, input) {@@ -105,18 +107,17 @@ class ArchivesComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');+ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/calendar.js b/public/js/vvvebjs/components/content/calendar.jsindex 756cc26..6e014b7 100755--- a/public/js/vvvebjs/components/content/calendar.js+++ b/public/js/vvvebjs/components/content/calendar.js@@ -50,7 +50,7 @@ class CalendarComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -60,8 +60,10 @@ class CalendarComponent extends ServerComponent{},setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;},onChange : function(element, value, input) {@@ -87,18 +89,17 @@ class CalendarComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');+ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/categories.js b/public/js/vvvebjs/components/content/categories.jsindex 306d38f..ef1ef26 100755--- a/public/js/vvvebjs/components/content/categories.js+++ b/public/js/vvvebjs/components/content/categories.js@@ -85,7 +85,7 @@ class CategoriesComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -93,12 +93,13 @@ class CategoriesComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;- },+ },onChange : function(element, value, input) {this.setGroup(input.value);return element;@@ -122,18 +123,18 @@ class CategoriesComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/comments.js b/public/js/vvvebjs/components/content/comments.jsindex 71b403f..d50a1ca 100755--- a/public/js/vvvebjs/components/content/comments.js+++ b/public/js/vvvebjs/components/content/comments.js@@ -132,7 +132,7 @@ class CommentsComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -140,12 +140,13 @@ class CommentsComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;- },+ },onChange : function(element, value, input) {this.setGroup(input.value);return element;@@ -169,18 +170,18 @@ class CommentsComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/currency.js b/public/js/vvvebjs/components/content/currency.jsindex 62c0713..aaafeb5 100755--- a/public/js/vvvebjs/components/content/currency.js+++ b/public/js/vvvebjs/components/content/currency.js@@ -86,16 +86,16 @@ class CurrencyComponent extends ServerComponent{options: [{value: "1",text: "Default"- }, {+ },{value: "2",text: "Date added 1"- }, {+ },{value: "3",text: "Date added"- }, {+ },{value: "4",text: "Date modified"- }, {+ },{value: "5",text: "Sales"}]@@ -103,16 +103,18 @@ class CurrencyComponent extends ServerComponent{}];}- init(node)- {- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/language.js b/public/js/vvvebjs/components/content/language.jsindex 8741b3d..c02b6ed 100755--- a/public/js/vvvebjs/components/content/language.js+++ b/public/js/vvvebjs/components/content/language.js@@ -78,16 +78,16 @@ class LanguageComponent extends ServerComponent{options: [{value: "1",text: "Default"- }, {+ },{value: "2",text: "Date added 1"- }, {+ },{value: "3",text: "Date added"- }, {+ },{value: "4",text: "Date modified"- }, {+ },{value: "5",text: "Sales"}]@@ -95,16 +95,18 @@ class LanguageComponent extends ServerComponent{}];}- init(node)- {- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/posts.js b/public/js/vvvebjs/components/content/posts.jsindex 855c1e2..cf6a100 100755--- a/public/js/vvvebjs/components/content/posts.js+++ b/public/js/vvvebjs/components/content/posts.js@@ -155,7 +155,7 @@ class PostsComponent extends ServerComponent{title: "Configuration",extraclass:"btn-sm",checked:true,- }, {+ },{value: "autocomplete",text: "Autocomplete",title: "Autocomplete",@@ -163,12 +163,13 @@ class PostsComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;- },+ },onChange : function(element, value, input) {this.setGroup(input.value);return element;@@ -218,10 +219,10 @@ class PostsComponent extends ServerComponent{options: [{value: "NULL",text: "Default"- }, {+ },{value: "created_at",text: "Date added"- }, {+ },{value: "updated_at",text: "Date modified"}/*, {@@ -241,7 +242,7 @@ class PostsComponent extends ServerComponent{options: [{value: "asc",text: "Ascending"- }, {+ },{value: "desc",text: "Descending"}]@@ -285,14 +286,16 @@ class PostsComponent extends ServerComponent{}init(node) {- $('.mb-3[data-group]').attr('style','display:none !important');+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/recentComments.js b/public/js/vvvebjs/components/content/recentComments.jsindex ffce619..c79b2ad 100755--- a/public/js/vvvebjs/components/content/recentComments.js+++ b/public/js/vvvebjs/components/content/recentComments.js@@ -47,7 +47,7 @@ class RecentCommentsComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -55,12 +55,13 @@ class RecentCommentsComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;- },+ },onChange : function(element, value, input) {this.setGroup(input.value);return element;@@ -84,18 +85,18 @@ class RecentCommentsComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/recentPosts.js b/public/js/vvvebjs/components/content/recentPosts.jsindex 7598737..d326d0c 100755--- a/public/js/vvvebjs/components/content/recentPosts.js+++ b/public/js/vvvebjs/components/content/recentPosts.js@@ -47,7 +47,7 @@ class RecentPostsComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -55,12 +55,13 @@ class RecentPostsComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;- },+ },onChange : function(element, value, input) {this.setGroup(input.value);return element;@@ -84,17 +85,18 @@ class RecentPostsComponent extends ServerComponent{}];}- init(node)- {- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/search.js b/public/js/vvvebjs/components/content/search.jsindex a146fe3..bc947c5 100755--- a/public/js/vvvebjs/components/content/search.js+++ b/public/js/vvvebjs/components/content/search.js@@ -60,16 +60,16 @@ class SearchComponent extends ServerComponent{options: [{value: "1",text: "Default"- }, {+ },{value: "2",text: "Date added 1"- }, {+ },{value: "3",text: "Date added"- }, {+ },{value: "4",text: "Date modified"- }, {+ },{value: "5",text: "Sales"}]@@ -77,16 +77,18 @@ class SearchComponent extends ServerComponent{}];}- init(node)- {- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/tags.js b/public/js/vvvebjs/components/content/tags.jsindex e96f418..51543e7 100755--- a/public/js/vvvebjs/components/content/tags.js+++ b/public/js/vvvebjs/components/content/tags.js@@ -71,7 +71,7 @@ class TagsComponent extends ServerComponent{icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -79,10 +79,11 @@ class TagsComponent extends ServerComponent{extraclass:"btn-sm",}],},-setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;},onChange : function(element, value, input) {@@ -108,18 +109,18 @@ class TagsComponent extends ServerComponent{}];}- init(node)- {- console.log(node);- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });- if (node.dataset.vSource != undefined)- {- $('.mb-3[data-group="'+ node.dataset.vSource + '"]').attr('style','');- } else- {- $('.mb-3[data-group]:first').attr('style','');- }+ let source = node.dataset.vSource;+ if (!source) {+ source = "automatic";+ }++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/content/user.js b/public/js/vvvebjs/components/content/user.jsindex 41ad4d3..be98419 100755--- a/public/js/vvvebjs/components/content/user.js+++ b/public/js/vvvebjs/components/content/user.js@@ -130,16 +130,16 @@ class UserComponent extends ServerComponent{options: [{value: "1",text: "Default"- }, {+ },{value: "2",text: "Date added 1"- }, {+ },{value: "3",text: "Date added"- }, {+ },{value: "4",text: "Date modified"- }, {+ },{value: "5",text: "Sales"}]@@ -147,16 +147,18 @@ class UserComponent extends ServerComponent{}];}- init(node)- {- $('.mb-3[data-group]').attr('style','display:none !important');++ init(node) {+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}-- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/ecommerce/cart.js b/public/js/vvvebjs/components/ecommerce/cart.jsindex 432d13b..80b4f15 100755--- a/public/js/vvvebjs/components/ecommerce/cart.js+++ b/public/js/vvvebjs/components/ecommerce/cart.js@@ -165,13 +165,12 @@ let template =init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/categories.js b/public/js/vvvebjs/components/ecommerce/categories.jsindex ae0658d..feb759d 100755--- a/public/js/vvvebjs/components/ecommerce/categories.js+++ b/public/js/vvvebjs/components/ecommerce/categories.js@@ -86,13 +86,12 @@ class CategoriesComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/checkout.js b/public/js/vvvebjs/components/ecommerce/checkout.jsindex bfa15c8..a370de2 100755--- a/public/js/vvvebjs/components/ecommerce/checkout.js+++ b/public/js/vvvebjs/components/ecommerce/checkout.js@@ -442,13 +442,12 @@ Place order <i class="la la-arrow-right"></i>init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/filters.js b/public/js/vvvebjs/components/ecommerce/filters.jsindex bd4b706..9a211a1 100755--- a/public/js/vvvebjs/components/ecommerce/filters.js+++ b/public/js/vvvebjs/components/ecommerce/filters.js@@ -82,7 +82,7 @@ class FiltersComponent {icon:"la la-search",extraclass:"btn-sm",checked:true,- }, {+ },{value: "automatic",icon:"la la-cog",text: "Configuration",@@ -92,9 +92,10 @@ class FiltersComponent {},setGroup: group => {- console.log(group);- $('.mb-3[data-v-group]').attr('style','display:none !important');- $('.mb-3[data-v-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });return element;},@@ -161,19 +162,19 @@ class FiltersComponent {options: [{value: "price_asc",text: "Price Ascending"- }, {+ },{value: "price_desc",text: "Price Descending"- }, {+ },{value: "date_asc",text: "Date Ascending"- }, {+ },{value: "date_desc",text: "Date Descending"- }, {+ },{value: "sales_asc",text: "Sales Ascending"- }, {+ },{value: "sales_desc",text: "Sales Descending"}]@@ -217,13 +218,12 @@ class FiltersComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/manufacturers.js b/public/js/vvvebjs/components/ecommerce/manufacturers.jsindex 967e705..f547b0e 100755--- a/public/js/vvvebjs/components/ecommerce/manufacturers.js+++ b/public/js/vvvebjs/components/ecommerce/manufacturers.js@@ -45,13 +45,12 @@ class ManufacturersComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/product.js b/public/js/vvvebjs/components/ecommerce/product.jsindex caf1640..ff3111d 100755--- a/public/js/vvvebjs/components/ecommerce/product.js+++ b/public/js/vvvebjs/components/ecommerce/product.js@@ -304,7 +304,7 @@ class ProductComponent {title: "Configuration",extraclass:"btn-sm",checked:true,- }, {+ },{value: "autocomplete",text: "Autocomplete",title: "Autocomplete",@@ -314,8 +314,10 @@ class ProductComponent {},setGroup: group => {- $('.mb-3[data-v-group]').attr('style','display:none !important');- $('.mb-3[data-v-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });return element;},@@ -382,19 +384,19 @@ class ProductComponent {options: [{value: "price_asc",text: "Price Ascending"- }, {+ },{value: "price_desc",text: "Price Descending"- }, {+ },{value: "date_asc",text: "Date Ascending"- }, {+ },{value: "date_desc",text: "Date Descending"- }, {+ },{value: "sales_asc",text: "Sales Ascending"- }, {+ },{value: "sales_desc",text: "Sales Descending"}]@@ -438,13 +440,12 @@ class ProductComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.source != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.source + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/ecommerce/productGallery.js b/public/js/vvvebjs/components/ecommerce/productGallery.jsindex ca466f8..d28d727 100755--- a/public/js/vvvebjs/components/ecommerce/productGallery.js+++ b/public/js/vvvebjs/components/ecommerce/productGallery.js@@ -36,14 +36,13 @@ class ProductGalleryComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');- }+ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");+ }}}diff --git a/public/js/vvvebjs/components/ecommerce/products.js b/public/js/vvvebjs/components/ecommerce/products.jsindex dba19e1..f9e1dcc 100755--- a/public/js/vvvebjs/components/ecommerce/products.js+++ b/public/js/vvvebjs/components/ecommerce/products.js@@ -105,7 +105,7 @@ class ProductsComponent extends ServerComponent{title: "Configuration",extraclass:"btn-sm",checked:true,- }, {+ },{value: "autocomplete",text: "Autocomplete",title: "Autocomplete",@@ -115,8 +115,10 @@ class ProductsComponent extends ServerComponent{},setGroup: group => {- $('.mb-3[data-group]').attr('style','display:none !important');- $('.mb-3[data-group="'+ group + '"]').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));+ document.querySelectorAll('.mb-3[data-group="'+ group + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });//return element;},onChange : function(element, value, input) {@@ -179,13 +181,13 @@ class ProductsComponent extends ServerComponent{options: [{value: "NULL",text: "Default"- }, {+ },{value: "price",text: "Price"- }, {+ },{value: "created_at",text: "Date added"- }, {+ },{value: "updated_at",text: "Date modified"}/*, {@@ -205,7 +207,7 @@ class ProductsComponent extends ServerComponent{options: [{value: "asc",text: "Ascending"- }, {+ },{value: "desc",text: "Descending"}]@@ -237,14 +239,16 @@ class ProductsComponent extends ServerComponent{}init(node) {-- $('.mb-3[data-group]').attr('style','display:none !important');+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });let source = node.dataset.vSource;if (!source) {source = "automatic";}- $('.mb-3[data-group="'+ source + '"]').attr('style','');++ document.querySelectorAll('.mb-3[data-group="' + source + '"]').forEach(e => e.classList.remove("d-none"));}}diff --git a/public/js/vvvebjs/components/ecommerce/vendors.js b/public/js/vvvebjs/components/ecommerce/vendors.jsindex 9b9a71d..73bc8fc 100755--- a/public/js/vvvebjs/components/ecommerce/vendors.js+++ b/public/js/vvvebjs/components/ecommerce/vendors.js@@ -45,13 +45,16 @@ class VendorsComponent {init(node){- $('.mb-3[data-v-group]').attr('style','display:none !important');- if (node.dataset.type != undefined)- {- $('.mb-3[data-v-group="'+ node.dataset.type + '"]').attr('style','');- } else- {- $('.mb-3[data-v-group]:first').attr('style','');+ document.querySelectorAll('.mb-3[data-group]').forEach((el, i) => {+ el.classList.add("d-none");+ });++ if (node.dataset.type != undefined) {+ document.querySelectorAll('.mb-3[data-group="'+ + node.dataset.type + '"]').forEach((el, i) => {+ el.classList.remove("d-none");+ });+ } else {+ document.querySelector('.mb-3[data-group]:first').classList.remove("d-none");}}}diff --git a/public/js/vvvebjs/components/server-component.js b/public/js/vvvebjs/components/server-component.jsindex 23fecb9..cd951c2 100755--- a/public/js/vvvebjs/components/server-component.js+++ b/public/js/vvvebjs/components/server-component.js@@ -31,95 +31,78 @@ class ServerComponent {this.url = "/?template=test.html";}- self.element.animate({opacity: 0.85}, 50);+ self.element.style.opacity = "0.85";- $.ajax({- url: this.url + '&_component_ajax=' + this.component + '&_component_id=' + this.index + '&_server_template=' + this.userServerTemplate + '&r=true',- type: 'post',- data: {_component_content:this.content},- //dataType: 'json',- beforeSend: function() {- },- complete: function(data) {- //$('#cart > button').button('reset');- },- success: function(data) {- //$("header [data-v-component-cart]")[0].outerHTML = data;- if (callback) callback(data);- },- error: function(xhr, ajaxOptions, thrownError) {- alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);- }+ let data = new FormData();+ data.append("_component_content", this.content);++ fetch(this.url + '&_component_ajax=' + this.component + '&_component_id=' + this.index + '&_server_template=' + this.userServerTemplate + '&r=true',{+ method: 'POST',+ body: data})- .always(function(data) {+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.text()})- .done(function(data) {-// self.element[0].outerHTML = data;-// self.element[0].click();-- //let newElement = self.element.before(data);- if (data) {+ .then((data) => {+ if (data) {++ let newElement = generateElements(data)[0];+ //set fixed height for parent to avoid page flicker+ let parent = self.element.parentNode;- let newElement = $(data);- //set fixed height for parent to avoid page flicker- let parent = self.element.parent();- //-- parent.height(parent.height());- //full update- if (this.fullUpdate) {- self.element.replaceWith(newElement);- } else {- self.element.html(newElement.html());- self.element.height(self.element.height());- }-- setTimeout(function () {- //if (this.fullUpdate)- if (parent) parent.height("");- self.element.height("");- //self.element.click();- Vvveb.Builder.selectNode(self.element);- }, 250);+ parent.style.minHeight = parent.clientHeight + "px";+ //full update+ if (this.fullUpdate) {+ self.element.replaceWith(newElement);+ } else {+ self.element.innerHTML = newElement.innerHTML;+ self.element.style.minHeight = self.element.clientHeight + "px";}-- self.element.removeAttr("style");//animate({opacity: 1}, 30);- if (callback) callback(data);+ setTimeout(function () {+ //if (this.fullUpdate)+ if (parent) parent.style.minHeight = "";+ self.element.style.minHeight = "";+ //self.element.click();+ Vvveb.Builder.selectNode(self.element);+ Vvveb.TreeList.loadComponents();+ }, 500);+ }++ self.element.removeAttribute("style");++ if (callback) callback(data);})- .fail(function(xhr, ajaxOptions, thrownError) {- alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);- });+ .catch(error => {+ console.log(error.statusText);+ });}onChange(element, property, value, input) {-- //search through all components of the same type on page and get index- //if (this.index) {- let selector = this.attributes- .map(el => {return "[" + el + "]";})- .join(",");--- this.component = this.attributes[0].replace("data-v-component-", "");- this.index = $(selector,Vvveb.Builder.frameBody).index(element);- //}--- if (this.content != element[0].outerHTML) {- let itemClone = element.clone();- $(".vvveb-hidden", itemClone).removeClass("vvveb-hidden");-- this.content = itemClone[0].outerHTML;- this.element = element;-- let self = this;- this.throttle = setTimeout(function () {- clearTimeout(this.throttle);- self.ajax();- }, 500);- }- return element;+ //search through all components of the same type on page and get index+ let selector = this.attributes+ .map(el => {return "[" + el + "]";})+ .join(",");+++ this.component = this.attributes[0].replace("data-v-component-", "");+ this.index = Array.prototype.indexOf.call(Vvveb.Builder.frameBody.querySelectorAll(selector), element);++ if (this.content != element.outerHTML) {+ let itemClone = element.cloneNode(true);+ itemClone.querySelectorAll(".vvveb-hidden").forEach(e => e.classList.remove("vvveb-hidden"));++ this.content = itemClone.outerHTML;+ this.element = element;++ let self = this;+ this.throttle = setTimeout(function () {+ clearTimeout(this.throttle);+ self.ajax();+ }, 500);+ }+ return element;}};diff --git a/public/js/vvvebjs/elements-changes.js b/public/js/vvvebjs/elements-changes.jsindex 382d6f2..f01ae84 100755--- a/public/js/vvvebjs/elements-changes.js+++ b/public/js/vvvebjs/elements-changes.js@@ -53,8 +53,6 @@ function getElements() {attr = attr.replace(type, "").toLowerCase();- //console.log(attr, value);-let nodeType = "text";if (attr == "image" || fieldNode.nodeName == "IMG") {diff --git a/public/js/vvvebjs/inputs.js b/public/js/vvvebjs/inputs.jsindex e64c94a..44f4a59 100755--- a/public/js/vvvebjs/inputs.js+++ b/public/js/vvvebjs/inputs.js@@ -16,17 +16,17 @@ limitations under the License.https://github.com/givanz/VvvebJs*/-var Input = {+let Input = {init: function(name) {},- onChange: function(event, node) {-- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [this.value, this, event]);+ onChange: function(event, node, input) {+ if (event && event.target) {+ const e = new CustomEvent('propertyChange', { detail: {value : input.value ?? this.value, input: this, origEvent:event} });+ event.currentTarget.dispatchEvent(e);+ //event.data.element.trigger('propertyChange', [this.value, this, event]);}},@@ -35,75 +35,96 @@ var Input = {},setValue: function(value) {- $('input', this.element).val(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('input');++ if (input) {+ input.value = value;+ }+ }},render: function(name, data) {- this.element = $(this.renderTemplate(name, data));+ let html = this.renderTemplate(name, data);+ this.element = generateElements(html);//bind eventsif (this.events)- for (var i in this.events)- {+ for (let i in this.events) {ev = this.events[i][0];fun = this[ this.events[i][1] ];el = this.events[i][2];- this.element.on(ev, el, {element: this.element, input:this}, fun);+ //this.element[0].querySelector(el).addEventListener(ev, function (ev, el, fun, target, event) {+ this.element[0].addEventListener(ev, function (ev, el, fun, target, event) {+ if (event.target.closest(el)) {+ //target, event, element, input+ return fun.call(event.target, event, target, this);+ }+ }.bind(this, ev, el, fun, this.element[0]));}- return this.element;+ return this.element[0];}};-var TextInput = $.extend({}, Input, {+let TextInput = { ...Input, ...{events: [//event, listener, child element- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],],init: function(data) {return this.render("textinput", data);},}-);+}-var TextareaInput = $.extend({}, Input, {+let TextareaInput = { ...Input, ...{events: [["keyup", "onChange", "textarea"],],setValue: function(value) {- $('textarea', this.element).val(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('textarea');++ if (input) {+ input.value = value;+ }+ }},init: function(data) {return this.render("textareainput", data);},- }-);+ }+}-var CheckboxInput = $.extend({}, Input, {-- onChange: function(event, node) {-- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [this.checked, this]);- }- },+let CheckboxInput = { ...Input, ...{events: [- ["change", "onChange", "input"],+ ["change", "onCheck", "input"],],+ onCheck: function(event, node, input) {+ input.value = this.checked;+ return input.onChange.call(this, event, node, input);+ },+setValue: function(value) {- if (value) {- $('input', this.element).attr("checked", true);- } else {- $('input', this.element).attr("checked", false);+ if (this.element[0]) {+ let input = this.element[0].querySelector('input');++ if (input) {+ if (value) {+ input.checked = true;+ } else {+ input.checked = false;+ }+ }}},@@ -111,9 +132,9 @@ var CheckboxInput = $.extend({}, Input, {return this.render("checkboxinput", data);},}-);+}-var SelectInput = $.extend({}, Input, {+let SelectInput = { ...Input, ...{events: [["change", "onChange", "select"],@@ -121,17 +142,22 @@ var SelectInput = $.extend({}, Input, {setValue: function(value) {- $('select', this.element).val(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('select');++ if (input) {+ input.value = value;+ }+ }},init: function(data) {return this.render("select", data);},-}-);+}-var IconSelectInput = $.extend({}, Input, {+let IconSelectInput = { ...Input, ...{events: [["change", "onChange", "select"],@@ -139,17 +165,22 @@ var IconSelectInput = $.extend({}, Input, {setValue: function(value) {- $('select', this.element).val(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('select');++ if (input) {+ input.value = value;+ }+ }},init: function(data) {return this.render("icon-select", data);},-}-);+}-var HtmlListSelectInput = $.extend({}, Input, {+let HtmlListSelectInput = { ...Input, ...{data:{},cache:{},@@ -161,76 +192,93 @@ var HtmlListSelectInput = $.extend({}, Input, {["click", "clearSearch", "button.clear-backspace"],],- clearSearch : function(event) {- let element = event.data.element;- $("input.search", element).val("").keyup();+ clearSearch : function(event, element, input) {+ let search = element.querySelector("input.search");+ if (search) {+ search.value = "";+ input.searchElement(event, element, input);+ }++ search.dispatchEvent(new KeyboardEvent("keyup", {+ bubbles: true,+ cancelable: true,+ }));},- searchElement : function(event) {- let element = event.data.element;+ searchElement : function(event, element, input) {searchText = this.value;delay(() => {-- $("li", element).hide().each(function () {- $this = $(this);- if (this.title.indexOf(searchText) > -1) $this.show();+ element.querySelectorAll("li").forEach((el, i) => {++ if (!searchText || el.title.indexOf(searchText) > -1) {+ el.style.display = '';+ } else {+ el.style.display = 'none';+ }});}, 500);},- onElementClick: function(event) {- let data = event.data.input.data;- let svg = $(data.insertElement, this);- let value = svg.get(0).outerHTML;- event.data.element.trigger('propertyChange', [value, this]);+ onElementClick: function(event, element, input) {+ let data = input.data;+ let svg = this.closest(data.insertElement);+ let value = svg.outerHTML ?? "<svg></svg>";+ input.value = value;+ let ret = input.onChange.call(this, event, element, input);++ return element;},- onListChange: function(event) {- let input = event.data.input;- let element = event.data.element;+ onListChange: function(event, element, input) {let url = input.data.url.replace('{value}', this.value);+ let elements = element.querySelector(".elements");- $(".elements", element).html(`<div class="p-4"><div class="spinner-border spinner-border-sm" role="status">+ elements.innerHTML = `<div class="p-4"><div class="spinner-border spinner-border-sm" role="status"><span class="visually-hidden">Loading...</span>- </div> Loading...</div>`);+ </div> Loading...</div>`;+//cache ajax requestsif (input.cache[url] != undefined) {- $(".elements", element).html(input.cache[url]);+ elements.innerHTML = input.cache[url];} else {- //$(".elements", element).load(url);- $.ajax({- url: url,- cache: true,- dataType: "html",- success: function(data) {- input.cache[url] = data;- $(".elements", element).html(data);- }+ fetch(url)+ .then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.text()+ })+ .then((text) => {+ input.cache[url] = text;+ elements.innerHTML = text;+ })+ .catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error loading list");});}},setValue: function(value) {- $('select', this.element).val(value);+ let select = this.element[0].querySelector("select");+ if (value && select) {+ select.value = value;+ }},init: function(data) {this.data = data;this.events.push(["click", "onElementClick", data.clickElement]);let template = this.render("html-list-select", data);- //load first set- $("select", template).change();+ let select = template.querySelector("select");+ this.onListChange.call(select, new Event('change'), template, this);return template;},-}-);+}--var LinkInput = $.extend({}, TextInput, {+let LinkInput = { ...TextInput, ...{events: [["change", "onChange", "input"],@@ -238,16 +286,16 @@ var LinkInput = $.extend({}, TextInput, {/*setValue: function(value) {//value = value.replace(/(?<!\/)www\./, 'https://www.');- $('input', this.element).val(value);+ this.element.querySelector('input').value = value;},*/init: function(data) {return this.render("textinput", data);},}-);+}-var DateInput = $.extend({}, TextInput, {+let DateInput = { ...TextInput, ...{events: [["change", "onChange", "input"],@@ -257,36 +305,32 @@ var DateInput = $.extend({}, TextInput, {return this.render("dateinput", data);},}-);+}-var RangeInput = $.extend({}, Input, {+let RangeInput = { ...Input, ...{events: [- ["change", "onChange", "input"],+ ["change", "onRangeChange", "input"],],- onChange: function(event, node) {-- if (event.data && event.data.element)- {- $('[data-input-value]', this.parentNode).val(this.value);- event.data.element.trigger('propertyChange', [this.value, this]);- }- },--+ onRangeChange: function(event, node, input) {+ this.parentNode.querySelector('input[type=number]').value = this.value;+ this.parentNode.querySelector('input[type=range]').value = this.value;+ return input.onChange.call(this, event, node, input);+ },+setValue: function(value) {- //$('[data-input-value]', this.element).text(value);- return $('input', this.element).val(value);+ this.element[0].querySelector('input[type=number]').value = value;+ this.element[0].querySelector('input[type=range]').value = value;},init: function(data) {return this.render("rangeinput", data);},}-);+}-var NumberInput = $.extend({}, Input, {+let NumberInput = { ...Input, ...{events: [["change", "onChange", "input"],@@ -296,50 +340,53 @@ var NumberInput = $.extend({}, Input, {return this.render("numberinput", data);},}-);+}-var CssUnitInput = $.extend({}, Input, {+let CssUnitInput = { ...Input, ...{number:0,unit:"px",events: [- ["change", "onChange", "select"],- ["change keyup", "onChange", "input"],+ ["change", "onInputChange", "select"],+ ["change", "onInputChange", "input"],+ ["keyup", "onInputChange", "input"],],- onChange: function(event) {- if (event.data && event.data.element)- {- let number = $("input", event.data.element).val();- let unit = $("select", event.data.element).val();- input = event.data.input;+ onInputChange: function(event, node, input) {+ if (node) {+ let number = node.querySelector("input").value;+ let unit = node.querySelector("select").value;+if (this.value != "") input[this.name] = this.value;// this.name = unit or numberif (unit == "") unit = "px";//if unit is not set use default pxlet value = "";if (unit == "auto") {- $(event.data.element).addClass("auto");+ node.classList.add("auto");value = unit;}else {- $(event.data.element).removeClass("auto");+ node.classList.remove("auto");value = number + (unit ? unit : "");}- event.data.element.trigger('propertyChange', [value, this]);+ input.value = value;++ return input.onChange.call(this, event, node, input);}},setValue: function(value) {- if (value) {+ if (value && this.element) {+ let element = this.element[0];this.number = parseFloat(value);this.unit = value.replace(this.number, '').trim();- if (this.unit == "auto") $(this.element).addClass("auto");+ if (this.unit == "auto") element.classList.add("auto");- $('input', this.element).val(this.number);- $('select', this.element).val(this.unit);+ element.querySelector("input[type=number]").value = this.number;+ element.querySelector("select").value = this.unit;}},@@ -347,9 +394,9 @@ var CssUnitInput = $.extend({}, Input, {return this.render("cssunitinput", data);},}-);+}-var ColorInput = $.extend({}, Input, {+let ColorInput = { ...Input, ...{//html5 color input only supports setting values as hex colors even if the picker returns only rgbrgb2hex: function(value) {@@ -373,35 +420,45 @@ var ColorInput = $.extend({}, Input, {],setValue: function(value) {- $('input', this.element).val(this.rgb2hex(value));+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('input');++ if (input) {+ input.value = this.rgb2hex(value);+ }+ }},init: function(data) {+ //if no palette provided use default+ if (!data.palette) {+ data.palette = Vvveb.ColorPalette.getAll();+ }+return this.render("colorinput", data);},}-);+}-var ImageInput = $.extend({}, Input, {+let ImageInput = { ...Input, ...{events: [- ["blur", "onChange", "input[type=text]"],+ ["focusout", "onChange", "input[type=text]"],["change", "onUpload", "input[type=file]"],],setValue: function(value) {//don't set blob value to avoid slowing down the page- if (value.indexOf("data:image") == -1)- {- $('input[type="text"]', this.element).val(value);+ if (value.indexOf("data:image") == -1) {+ element.querySelector('input[type="text"]').value = value;}},onUpload: function(event, node) {if (this.files && this.files[0]) {- var reader = new FileReader();+ let reader = new FileReader();reader.onload = imageIsLoaded;reader.readAsDataURL(this.files[0]);//reader.readAsBinaryString(this.files[0]);@@ -416,7 +473,7 @@ var ImageInput = $.extend({}, Input, {//return;//remove this line to enable php upload- var formData = new FormData();+ let formData = new FormData();formData.append("file", file);$.ajax({@@ -432,46 +489,49 @@ var ImageInput = $.extend({}, Input, {event.data.element.trigger('propertyChange', [data, this]);//update src input- $('input[type="text"]', event.data.element).val(data);+ event.data.element.querySelector('input[type="text"]').value = data;},error: function (data) {alert(data.responseText);}});}- },+ }+ }+}- init: function(data) {- return this.render("imageinput", data);- },- }-);--var FileUploadInput = $.extend({}, TextInput, {+let FileUploadInput = { ...TextInput, ...{events: [- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],],init: function(data) {return this.render("textinput", data);},}-);+}--var RadioInput = $.extend({}, Input, {+let RadioInput = { ...Input, ...{events: [["change", "onChange", "input"],],setValue: function(value) {- if (value && value != "") {- $('input', this.element).removeAttr('checked');-- var input = $("input[value=" + value + "]", this.element);- input.attr("checked", "true").prop('checked', true);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('input');++ if (input) {+ if (value == input.value) {+ input.setAttribute("checked", "true");+ input.checked = true;+ } else {+ input.checked = false;+ input.removeAttribute("checked");+ }++ }}},@@ -479,81 +539,102 @@ var RadioInput = $.extend({}, Input, {return this.render("radioinput", data);},}-);+}++let RadioButtonInput = { ...RadioInput, ...{++ setValue: function(value) {+ if (this.element[0] && value) {+ let inputs = this.element[0].querySelectorAll('input');+ inputs.forEach((el, i) => {+ if (value == el.value) {+ selected = el;+ } else {+ el.checked = false;+ el.removeAttribute("checked");+ }+ });++ selected.checked = true;+ selected.setAttribute("checked", "checked");+ }+ },-var RadioButtonInput = $.extend({}, RadioInput, {-init: function(data) {return this.render("radiobuttoninput", data);},}-);+}-var ToggleInput = $.extend({}, TextInput, {+let ToggleInput = { ...Input, ...{+ events: [+ ["change", "onToggleChange", "input"],+ ],- onChange: function(event, node) {- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [this.checked?this.getAttribute("data-value-on"):this.getAttribute("data-value-off"), this]);- }+ onToggleChange: function(event, node, input) {+ input.value = this.checked ? this.getAttribute("data-value-on") : this.getAttribute("data-value-off");+ return input.onChange.call(this, event, node, input);},setValue: function(value) {- if (value == $('input', this.element).attr("data-value-on")) {- $('input', this.element).attr("checked", true);- } else {- $('input', this.element).attr("checked", false);+ if (this.element[0]) {+ let input = this.element[0].querySelector('input');++ if (input) {+ if (value == input.getAttribute("data-value-on")) {+ input.checked = true;+ input.setAttribute("checked", true);+ } else {+ input.checked = false;+ input.removeAttribute("checked");+ }+ }}},- events: [- ["change", "onChange", "input"],- ],-init: function(data) {return this.render("toggle", data);},}-);+}-var ValueTextInput = $.extend({}, TextInput, {+let ValueTextInput = { ...TextInput, ...{events: [- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],],init: function(data) {return this.render("textinput", data);},}-);+}-var GridLayoutInput = $.extend({}, TextInput, {+let GridLayoutInput = { ...TextInput, ...{events: [- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],],init: function(data) {return this.render("textinput", data);},}-);+}-var ProductsInput = $.extend({}, TextInput, {+let ProductsInput = { ...TextInput, ...{events: [- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],],init: function(data) {return this.render("textinput", data);},}-);+}--var GridInput = $.extend({}, Input, {+let GridInput = { ...Input, ...{events: [@@ -563,23 +644,27 @@ var GridInput = $.extend({}, Input, {setValue: function(value) {- $('select', this.element).val(value);- //fix selected attribute not working bug- $('select option[selected]', this.element).prop( 'selected', 'selected' );+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('select');++ if (input) {+ input.value = value;+ input.querySelector("option[selected]").selected = true;+ }+ }},init: function(data) {return this.render("grid", data);},-}-);+}-var TextValueInput = $.extend({}, Input, {+let TextValueInput = { ...Input, ...{events: [- ["blur", "onChange", "input"],+ ["focusout", "onChange", "input"],["click", "onChange", "button" /*'select'*/],],@@ -590,11 +675,10 @@ var TextValueInput = $.extend({}, Input, {init: function(data) {return this.render("textvalue", data);},-}-);+}-var ButtonInput = $.extend({}, Input, {+let ButtonInput = { ...Input, ...{events: [["click", "onChange", "button" /*'select'*/],@@ -602,20 +686,25 @@ var ButtonInput = $.extend({}, Input, {setValue: function(value) {- $('button', this.element).val(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('button');++ if (input) {+ input.value = value;+ }+ }},init: function(data) {return this.render("button", data);},-}-);+}-var SectionInput = $.extend({}, Input, {+let SectionInput = { ...Input, ...{events: [- ["click", "onChange", "button" /*'select'*/],+ //["click", "onChange", "button" /*'select'*/],],@@ -626,11 +715,10 @@ var SectionInput = $.extend({}, Input, {init: function(data) {return this.render("sectioninput", data);},-}-);+}-var ListInput = $.extend({}, Input, {+let ListInput = { ...Input, ...{events: [["change", "onChange", "select"],@@ -641,12 +729,12 @@ var ListInput = $.extend({}, Input, {remove: function(event, node) {- let sectionItem = $(this).parents(".section-item");+ let sectionItem = this.closest(".section-item");let index = sectionItem.index();let data = event.data.input.data;if (data.removeElement) {- $(data.container + " " + data.selector + ":eq(" + index + ")", event.data.input.node).remove();+ event.data.input.node.querySelector(data.container + " " + data.selector + ":nth-child(" + index + ")").remove();}sectionItem.remove();@@ -656,24 +744,23 @@ var ListInput = $.extend({}, Input, {return false;},- add: function(event, node) {- let newElement = event.data.input.data.newElement ?? false;+ add: function(event, node, input) {+ let newElement = input.data.newElement ?? false;if (newElement) {- $(event.data.input.data.container, event.data.input.node).append(newElement);+ event.data.input.node.querySelector(input.data.container).append(generateElements(newElement)[0]);}event.action = "add";- event.data.input.onChange(event, node);+ input.onChange(event, node, input, this);return false;},- select: function(event, node) {- let sectionItem = $(this);- let index = sectionItem.index();+ select: function(event, node, input) {+ let index = [...this.parentNode.children].indexOf(el);//sectionItem.index();event.action = "select";event.index = index;- event.data.input.onChange(event, node);+ input.onChange(event, node, input, this);return false;},@@ -685,10 +772,10 @@ var ListInput = $.extend({}, Input, {this.selector = data.selector;this.node = node;- let elements = $(data.container + " " + this.selector, this.node);+ let elements = this.node.querySelectorAll(data.container + " " + this.selector);let options = [];- elements.each(function (i, e) {+ elements.forEach(function (e, i) {let element = e;if (data.nameElement) {element = element.querySelector(data.nameElement);@@ -706,97 +793,100 @@ var ListInput = $.extend({}, Input, {return this.render("listinput", data);},-}-);--+}-var AutocompleteInput = $.extend({}, Input, {+let AutocompleteInput = { ...Input, ...{events: [["autocomplete.change", "onAutocompleteChange", "input"],],onAutocompleteChange: function(event, value, text) {-- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [value, this]);- }+ input.value = value;+ return this.onChange(event, node);},init: function(data) {this.element = this.render("textinput", data);- $('input', this.element).autocomplete(data.url);//using default parameters+ let autocomplete = new _AutocompleteInput(this.element.querySelector("input"), {url:data.url});return this.element;}}-);+}-var AutocompleteList = $.extend({}, Input, {+let AutocompleteList = { ...Input, ...{events: [["autocompletelist.change", "onAutocompleteChange", "input"],],- onAutocompleteChange: function(event, value, text) {-- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [value, this]);- }+ onAutocompleteChange: function(event, node, input) {+ input.value = event.detail;+ //return input.onChange(event, node, input);+ return input.onChange.call(this, event, node, input);},setValue: function(value) {- $('input', this.element).data("autocompleteList").setValue(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('input');++ if (input) {+ input.dataset.autocompleteList.setValue(value);++ }+ }},init: function(data) {this.element = this.render("textinput", data);- $('input', this.element).autocompleteList(data);//using default parameters+ let autocomplete = new _AutocompleteList(this.element.querySelector("input"), {url:data.url});return this.element;}}-);+}-var TagsInput = $.extend({}, Input, {+let TagsInput = { ...Input, ...{events: [["tagsinput.change", "onTagsInputChange", "input"],],onTagsInputChange: function(event, value, text) {-- if (event.data && event.data.element)- {- event.data.element.trigger('propertyChange', [value, this]);- }+ input.value = value;+ return this.onChange(event, node);},setValue: function(value) {- $('input', this.element).data("tagsInput").setValue(value);+ if (this.element[0] && value) {+ let input = this.element[0].querySelector('select');++ if (input) {+ input.dataset.tagsInput.setValue(value);++ }+ }},init: function(data) {this.element = this.render("tagsinput", data);- $('input', this.element).tagsInput(data);//using default parameters+ let autocomplete = new _TagsInput(this.element.querySelector("input"), {url:data.url});return this.element;}}-);+}-var NoticeInput = $.extend({}, Input, {+let NoticeInput = { ...Input, ...{events: [],@@ -805,4 +895,4 @@ var NoticeInput = $.extend({}, Input, {return this.render("noticeinput", data);},}-);+}diff --git a/public/js/vvvebjs/plugin-aos.js b/public/js/vvvebjs/plugin-aos.jsindex 3d64952..4a0e8f2 100755--- a/public/js/vvvebjs/plugin-aos.js+++ b/public/js/vvvebjs/plugin-aos.js@@ -11,179 +11,179 @@ The edited page should include the aos library https://github.com/michalsnik/aos</script>*///clean aos classes on save-$(window).on("vvveb.getHtml.before", function(event, doc) {- $("[data-aos]", doc).removeClass("aos-init aos-animate");+window.addEventListener("vvveb.getHtml.before", function(event) {+ let doc = event.detail;+ doc.querySelectorAll("[data-aos]").forEach(e => e.classList.remove("aos-animate", "aos-init"));});-$(window).on("vvveb.getHtml.after", function(event, doc) {- $("[data-aos]", doc).addClass("aos-init aos-animate");+window.addEventListener("vvveb.getHtml.after", function(event) {+ let doc = event.detail;+ doc.querySelectorAll("[data-aos]").forEach(e => e.classList.add("aos-animate", "aos-init"));});//ignore aos classes for stylesVvveb.Builder.ignoreClasses = Vvveb.Builder.ignoreClasses.concat(["aos-init", "aos-animate"]);-var aosAnimations = [- {+let aosAnimations = [{value: "",text: "[none]"- }, {+ },{//Fade animationsoptgroup: "Fade animations"- }, {+ },{value: "fade",text: "Fade"- }, {+ },{value: "fade-up",text: "Fade Up"- }, {+ },{value: "fade-down",text: "Fade down"- }, {+ },{value: "fade-left",text: "Fade left"- }, {+ },{value: "fade-right",text: "Fade right"- }, {+ },{value: "fade-up-right",text: "Fade up right"- }, {+ },{value: "fade-up-left",text: "Fade up left"- }, {+ },{value: "fade-down-right",text: "Fade down right"- }, {+ },{value: "fade-down-left",text: "Fade down left"- }, {+ },{//Flip animationsoptgroup: "Flip animations"- }, {+ },{value: "flip-up",text: "Flip Up"- }, {+ },{value: "flip-down",text: "Flip Down"- }, {+ },{value: "flip-left",text: "Flip left"- }, {+ },{value: "flip-right",text: "Flip right"- }, {+ },{//Slide animationsoptgroup: "Slide animations"- }, {+ },{value: "slide-up",text: "Slide up"- }, {+ },{value: "slide-down",text: "Slide down"- }, {+ },{value: "slide-left",text: "Slide left"- }, {+ },{value: "slide-right",text: "Slide right"- }, {+ },{//Zoom animationsoptgroup: "Zoom animations"- }, {+ },{value: "zoom-in",text: "Zoom in"- }, {+ },{value: "zoom-in-up",text: "Zoom in up"- }, {+ },{value: "zoom-in-down",text: "Zoom in down"- }, {+ },{value: "zoom-in-left",text: "Zoom in left"- }, {+ },{value: "zoom-in-right",text: "Zoom in right"- }, {+ },{value: "zoom-out",text: "Zoom out"- }, {+ },{value: "zoom-out-up",text: "Zoom out up"- }, {+ },{value: "zoom-out-down",text: "Zoom out down"- }, {+ },{value: "zoom-out-left",text: "Zoom out left"- }, {+ },{value: "zoom-out-right",text: "Zoom out right"}];/*-var aosEasing = [- {+let aosEasing = [{value: "",text: "[default]"- }, {+ },{value: "linear",text: "linear"- }, {+ },{value: "ease",text: "ease"- }, {+ },{value: "ease-out",text: "ease-out"- }, {+ },{value: "ease-in-out",text: "ease-in-out"- }, {+ },{value: "ease-in-back",text: "ease-in-back"- }, {+ },{value: "ease-out-back",text: "ease-out-back"- }, {+ },{value: "ease-in-out-back",text: "ease-in-out-back"- }, {+ },{value: "ease-in-sine",text: "ease-in-sine"- }, {+ },{value: "ease-out-sine",text: "ease-out-sine"- }, {+ },{value: "ease-in-quad",text: "ease-in-quad"- }, {+ },{value: "ease-out-quad",text: "ease-out-quad"- }, {+ },{value: "ease-in-out-quad",text: "ease-in-out-quad"- }, {+ },{value: "ease-in-cubic",text: "ease-in-cubic"- }, {+ },{value: "ease-out-cubic",text: "ease-out-cubic"- }, {+ },{value: "ease-in-out-cubic",text: "ease-in-out-cubic"- }, {+ },{value: "ease-in-quart",text: "ease-in-quart"- }, {+ },{value: "ease-out-quart",text: "ease-out-quart"- }, {+ },{value: "ease-in-out-quart",text: "ease-in-out-quart"}];*/-var ComponentBaseAnimateScroll = {+let ComponentBaseAnimateScroll = {properties: [{key: "animate_header",inputtype: SectionInput,@@ -191,7 +191,7 @@ var ComponentBaseAnimateScroll = {sort: base_sort++,section: advanced_section,data: {header:"Animate on scroll"},- }, {+ },{name: "Animation type",key: "type",htmlAttr: "data-aos",@@ -202,16 +202,16 @@ var ComponentBaseAnimateScroll = {options: aosAnimations,},onChange: function(node, value) {- node.removeClass("aos-init aos-animate");+ node.classList.remove("aos-init","aos-animate");if (value == "") {- node.removeAttr("data-aos data-aos-duration data-aos-delay");+ node.removeAttribute("data-aos","data-aos-duration","data-aos-delay");} else {- delay(() => node.addClass("aos-init aos-animate"),- node.data("aos-duration") ? node.data("aos-duration") : 1000);+ delay(() => node.classList.add("aos-init","aos-animate"),+ node.dataset.aosDuration ? node.dataset.aosDuration : 1000);}return node;}-/* }, {+/* },{name: "Animation easing",key: "easing",htmlAttr: "data-aos-easing",@@ -221,7 +221,7 @@ var ComponentBaseAnimateScroll = {data: {options: aosEasing,}*/- }, {+ },{name: "Duration",key: "duration",htmlAttr: "data-aos-duration",@@ -234,7 +234,7 @@ var ComponentBaseAnimateScroll = {step:100},defaultValue: 1000- }, {+ },{name: "Delay",key: "delay",htmlAttr: "data-aos-delay",@@ -247,7 +247,7 @@ var ComponentBaseAnimateScroll = {step:100},defaultValue: "0"- }, {+ },{name: "",key: "delay",htmlAttr: "data-aos-delay",@@ -256,9 +256,9 @@ var ComponentBaseAnimateScroll = {inputtype: ButtonInput,data: {text:"Play animation", icon:"la-play"},onChange: function(node, value) {- node.removeClass("aos-init aos-animate");- delay(() => node.addClass("aos-init aos-animate"),- node.data("aos-duration") ? node.data("aos-duration") : 1000);+ node.classList.remove("aos-init","aos-animate");+ delay(() => node.classList.add("aos-init","aos-animate"),+ node.dataset.aosDuration ? node.dataset.aosDuration : 1000);return node;}}]diff --git a/public/js/vvvebjs/plugin-bootstrap-colorpicker.js b/public/js/vvvebjs/plugin-bootstrap-colorpicker.jsindex cfb340c..20de489 100755--- a/public/js/vvvebjs/plugin-bootstrap-colorpicker.js+++ b/public/js/vvvebjs/plugin-bootstrap-colorpicker.js@@ -1,18 +1,18 @@-var ColorInput = $.extend({}, ColorInput, {+let ColorInput = { ...ColorInput, ...{events: [["change", "onChange", "input"],],setValue: function(value) {- var color = this.rgb2hex(value);+ let color = this.rgb2hex(value);$('input', this.element).val();$('i', this.element).css('background-color', value);},init: function(data) {- var colorinput = this.render("bootstrap-color-picker-input", data);- var colorpicker = $('.input-group', colorinput).colorpicker();+ let colorinput = this.render("bootstrap-color-picker-input", data);+ let colorpicker = $('.input-group', colorinput).colorpicker();return colorinput;},}diff --git a/public/js/vvvebjs/plugin-codemirror.js b/public/js/vvvebjs/plugin-codemirror.jsindex 75fc158..44d7c86 100755--- a/public/js/vvvebjs/plugin-codemirror.js+++ b/public/js/vvvebjs/plugin-codemirror.js@@ -7,8 +7,7 @@ Vvveb.CodeEditor = {init: function(doc) {- if (this.codemirror == false)- {+ if (this.codemirror == false) {this.codemirror = CodeMirror.fromTextArea(document.querySelector("#vvveb-code-editor textarea"), {mode: 'text/html',lineNumbers: true,@@ -27,9 +26,11 @@ Vvveb.CodeEditor = {//load code on document changes- Vvveb.Builder.frameBody.on("vvveb.undo.add vvveb.undo.restore", function (e) { Vvveb.CodeEditor.setValue(e);});+ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.add", () => Vvveb.CodeEditor.setValue());+ Vvveb.Builder.frameBody.addEventListener("vvveb.undo.restore", () => Vvveb.CodeEditor.setValue());+//load code when a new url is loaded- Vvveb.Builder.documentFrame.on("load", function (e) { Vvveb.CodeEditor.setValue();});+ Vvveb.Builder.documentFrame.addEventListener("load", () => Vvveb.CodeEditor.setValue());this.isActive = true;this.setValue();@@ -38,9 +39,8 @@ Vvveb.CodeEditor = {},setValue: function(value) {- if (this.isActive == true)- {- var scrollInfo = this.codemirror.getScrollInfo();+ if (this.isActive == true) {+ let scrollInfo = this.codemirror.getScrollInfo();this.codemirror.setValue(Vvveb.Builder.getHtml());this.codemirror.scrollTo(scrollInfo.left, scrollInfo.top);let self = this;@@ -60,8 +60,7 @@ Vvveb.CodeEditor = {},toggle: function() {- if (this.isActive != true)- {+ if (this.isActive != true) {this.isActive = true;return this.init();}@@ -73,7 +72,7 @@ Vvveb.CodeEditor = {// override modal code editor to use code mirrorVvveb.ModalCodeEditor.init = function (modal = false, editor = false) {- this.modal = $('#codeEditorModal');+ this.modal = document.getElementById("codeEditorModal");this.editor = CodeMirror.fromTextArea(document.querySelector("#codeEditorModal textarea"), {mode: 'text/html',lineNumbers: true,@@ -84,14 +83,15 @@ Vvveb.ModalCodeEditor.init = function (modal = false, editor = false) {});let self = this;- $('.save-btn', this.modal).on("click", function(event) {- $(window).triggerHandler("vvveb.ModalCodeEditor.save", self.getValue());+ this.modal.querySelector('.save-btn').addEventListener("click", function(event) {+ window.dispatchEvent(new CustomEvent("vvveb.ModalCodeEditor.save", {detail: self.getValue()}));self.hide();+ return false;});}Vvveb.ModalCodeEditor.setValue = function (value) {- var scrollInfo = this.editor.getScrollInfo();+ let scrollInfo = this.editor.getScrollInfo();this.editor.setValue(value);this.editor.scrollTo(scrollInfo.left, scrollInfo.top);let self = this;diff --git a/public/js/vvvebjs/plugin-google-fonts.js b/public/js/vvvebjs/plugin-google-fonts.jsindex 8daf922..b637c51 100755--- a/public/js/vvvebjs/plugin-google-fonts.js+++ b/public/js/vvvebjs/plugin-google-fonts.js@@ -3,19 +3,19 @@ GoogleFontsManager = {activeFonts: [],updateFontList: function () {- let googleFontsLink = $("#google-fonts-link", Vvveb.Builder.frameHead);+ let googleFontsLink = Vvveb.Builder.frameHead.querySelector("google-fonts-link");if (this.activeFonts.length == 0) {googleFontsLink.remove();return;}- if (googleFontsLink.length < 1) {- googleFontsLink = $(`<link id="google-fonts-link" href="" rel="stylesheet">`);+ if (!googleFontsLink) {+ googleFontsLink = generateElements(`<link id="google-fonts-link" href="" rel="stylesheet">`)[0];Vvveb.Builder.frameHead.append(googleFontsLink);}-- googleFontsLink.attr("href", this.url + this.activeFonts.join("&family="));++ googleFontsLink.setAttribute("href", this.url + this.activeFonts.join("&family="));},removeFont: function (fontName) {@@ -36,40 +36,43 @@ Vvveb.FontsManager.addProvider("google", GoogleFontsManager);let googleFonts = {};let googlefontNames = [];//load google fonts list and update wyswyg font selector and style tab font-family list-$.ajax({- url: Vvveb.baseUrl + "../../resources/google-fonts.json",- cache: true,- dataType: "json",- success: function(data) {- //let json = JSON.parse(data);- googleFonts = data ;- //let fontSelect = $("#font-familly");-- let fontSelect = $("<optgroup label='Google Fonts'></optgroup>");- for (font in googleFonts) {- googlefontNames.push({"text":font, "value":font, "data-provider": "google"});- let option = new Option(font, font);- option.dataset.provider = "google";- //option.style.setProperty("font-family", font);- fontSelect.append(option);- }- $("#font-family").append(fontSelect);+fetch(Vvveb.baseUrl + "../../resources/google-fonts.json")+.then((response) => {+ if (!response.ok) { throw new Error(response) }+ return response.json()+})+.then((data) => {+ //let json = JSON.parse(data);+ googleFonts = data ;++ let fontSelect = generateElements("<optgroup label='Google Fonts'></optgroup>")[0];+ for (font in googleFonts) {+ googlefontNames.push({"text":font, "value":font, "data-provider": "google"});+ let option = new Option(font, font);+ option.dataset.provider = "google";+ //option.style.setProperty("font-family", font);+ fontSelect.append(option);+ }+ document.getElementById("font-family").append(fontSelect);- let list = Vvveb.Components.getProperty("_base", "font-family");- if (list) {- list.onChange = function (node,value, input, component) {- let option = input.options[input.selectedIndex];- Vvveb.FontsManager.addFont(option.dataset.provider, value, node);- return node;- };-- list.data.options.push({optgroup:"Google Fonts"});- list.data.options = list.data.options.concat(googlefontNames);+ let list = Vvveb.Components.getProperty("_base", "font-family");+ if (list) {+ list.onChange = function (node,value, input, component) {+ let option = input.options[input.selectedIndex];+ Vvveb.FontsManager.addFont(option.dataset.provider, value, node);+ return node;+ };++ list.data.options.push({optgroup:"Google Fonts"});+ list.data.options = list.data.options.concat(googlefontNames);- Vvveb.Components.updateProperty("_base", "font-family", {data:list.data});-- //update default font list- fontList = list.data.options;- }+ Vvveb.Components.updateProperty("_base", "font-family", {data:list.data});++ //update default font list+ fontList = list.data.options;}-});+})+.catch(error => {+ console.log(error.statusText);+ displayToast("bg-danger", "Error", "Error loading google fonts!");+});\ No newline at end of filediff --git a/public/js/vvvebjs/plugin-jszip.js b/public/js/vvvebjs/plugin-jszip.jsindex f240b56..7716073 100755--- a/public/js/vvvebjs/plugin-jszip.js+++ b/public/js/vvvebjs/plugin-jszip.js@@ -29,17 +29,17 @@ function () {let html = Vvveb.Builder.frameHtml;//stylesheets- $("link[href$='.css']", html).each(function(i, e) {+ html.querySelectorAll("link[href$='.css']", html).forEach(function(e, i) {addUrl(e.href, e.getAttribute("href"), false);});//javascripts- $("script[src$='.js']", html).each(function(i, e) {+ html.querySelectorAll("script[src$='.js']", html).forEach(function(e, i) {addUrl(e.src, e.getAttribute("src"), false);});//images- $("img[src]", html).each(function(i, e) {+ html.querySelectorAll("img[src]", html).forEach(function(e, i) {addUrl(e.src, e.getAttribute("src"), true);});@@ -90,19 +90,6 @@ function () {} catch (error) {console.error(error);}- /*- $.ajax({- url: url,- type: 'GET',-- success: function (data) {- resolve({url, href, filename, binary, data});- },- error: function (error) {- reject(error)- },- });- */}));}diff --git a/public/js/vvvebjs/plugin-media.js b/public/js/vvvebjs/plugin-media.jsindex b5f40c0..e0283e4 100755--- a/public/js/vvvebjs/plugin-media.js+++ b/public/js/vvvebjs/plugin-media.js@@ -1,49 +1,51 @@-var ImageInput = $.extend({}, ImageInput, {+ImageInput = { ...ImageInput, ...{tag: "img",events: [- ["change", "onChange", "input[type=text]"],+ ["change", "onImageChange", "input[type=text]"],["click", "onClick", "button"],["click", "onClick", "img"],],setValue: function(value) {if (value && value.indexOf("data:image") == -1 && value != "none") {- $('input[type="text"]', this.element).val(value);+ this.element[0].querySelector('input[type="text"]').value = value;+ //$('input[type="text"]', this.element).val(value);let src = (value.indexOf("//") > -1 || value.indexOf("media/") > -1 || value.indexOf("image-cache/") > -1 ? '' : Vvveb.themeBaseUrl) + value- $(this.tag, this.element).attr("src", src);+ this.element[0].querySelector(this.tag).src = src;+ //$(this.tag, this.element).attr("src", src);} else {- $(this.tag, this.element).attr("src", Vvveb.baseUrl + 'icons/image.svg');+ this.element[0].querySelector(this.tag).src = Vvveb.baseUrl + 'icons/image.svg';+ ///$(this.tag, this.element).attr("src", Vvveb.baseUrl + 'icons/image.svg');}},- onChange: function(e, node, data) {+ onImageChange: function(event, node, input) {//set initial relative path- let src = this.value;- let tag = e.data.input.tag;+ let self = this;+ let src = self.value;+ let tag = input.tag;- delay(() => {- //get full image path- let img = $(tag, e.data.element).get(0);-- if (img.src) {- src = img.getAttribute("src");- }-- if (src) {- e.data.element.trigger('propertyChange', [src, this]);- }- }, 500);+ let img = node.querySelector(tag);+ if (img.src) {+ src = img.getAttribute("src");+ }- //e.data.element.trigger('propertyChange', [src, this]);+ if (src) {+ input.value = src;+ input.onChange.call(self, event, node, input);+ //e.data.element.trigger('propertyChange', [src, this]);+ }//reselect image after loading to adjust highlight box size- Vvveb.Builder.selectedEl.get(0).onload = function () {+ let onLoad = function () {if (Vvveb.Builder.selectedEl) {Vvveb.Builder.selectedEl.click();}};++ Vvveb.Builder.selectedEl.addEventListener("load", onLoad);},@@ -60,9 +62,9 @@ var ImageInput = $.extend({}, ImageInput, {return this.render("imageinput-gallery", data);},}-);+}-var VideoInput = $.extend({}, ImageInput, {+VideoInput = { ...ImageInput, ...{tag:"video",events: [@@ -76,4 +78,4 @@ var VideoInput = $.extend({}, ImageInput, {return this.render("videoinput-gallery", data);},}-);+}diff --git a/public/js/vvvebjs/section.js b/public/js/vvvebjs/section.jsindex 3d02507..43cfadf 100644--- a/public/js/vvvebjs/section.js+++ b/public/js/vvvebjs/section.js@@ -2,8 +2,7 @@ let bgVideoTemplate = '<video playsinline loop muted autoplay src="../../media/dlet 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>';-let SectionBackground = [- {+let SectionBackground = [{key: "section_background_header",inputtype: SectionInput,name:false,@@ -22,22 +21,22 @@ let SectionBackground = [text: "None",title: "None",checked:true,- }, {+ },{value: "bg-image",icon:"la la-image",text: "Image",title: "Image",- }, {/*+ },{/*value: "gradient",icon:"la la-palette",text: "Gradient",title: "Gradient",- }, {*/+ },{*/value: "bg-video",icon:"la la-video",text: "Video",title: "Video",/*- }, {+ },{value: "slideshow",icon:"la la-arrows-alt-h",text: "Slider",@@ -45,39 +44,43 @@ let SectionBackground = [}],},hideGroups : function() {- $('.mb-3[data-group="bg-image"],.mb-3[data-group="bg-video"]').hide();+ document.querySelectorAll('.mb-3[data-group="bg-image"],.mb-3[data-group="bg-video"]').forEach(e => e.classList.add("d-none"));},onChange : function(node, value, input) {this.hideGroups();- $('.mb-3[data-group="'+ input.value + '"]').show();+ document.querySelectorAll('.mb-3[data-group="'+ input.value + '"].d-none').forEach((el, i) => {+ el.classList.remove("d-none");+ });- let container = $("> .background-container", node);- if (!container.length) {- container = $('<div class="background-container"></div>');- node.append(container);+ let container = node.querySelector(":scope > .background-container");+ if (!container) {+ container = generateElements('<div class="background-container"></div>')[0];+ node.appendChild(container);}- let img = $("> .background-container > img", node);- let video = $("> .background-container > video", node);+ let img = node.querySelector(":scope > .background-container > img");+ let video = node.querySelector(":scope > .background-container > video");- $("> *", container).addClass("d-none");+ container.querySelectorAll(":scope > *").forEach((el, i) => {+ el.classList.add("d-none");+ });switch (value) {case "bg-image":- if (img.length) {- img.removeClass("d-none");+ if (img) {+ img.classList.remove("d-none");} else {- container.append(bgImageTemplate);+ container.append(generateElements(bgImageTemplate)[0]);//reselect element to load imagenode.click();}break;case "bg-video":- if (video.length) {- video.removeClass("d-none");+ if (video) {+ video.classList.remove("d-none");} else {- container.append(bgVideoTemplate);+ container.append(generateElements(bgVideoTemplate)[0]);//reselect element to load videonode.click();}@@ -89,24 +92,24 @@ let SectionBackground = [},init: function(node) {let selected = "none";- let img = $("> .background-container img:visible", node);- let video = $("> .background-container video:visible", node);+ let img = node.querySelector(":scope > .background-container img");+ let video = node.querySelector(":scope > .background-container video");- if (img.length) {+ if (img?.offsetParent) {selected = "bg-image";}- if (video.length) {+ if (video?.offsetParent) {selected = "bg-video";}this.hideGroups();return selected;},- }, {+ },{name: "Image",key: "src",htmlAttr: "src",- child:"> .background-container > img",+ child:":scope > .background-container > img",group:"bg-image",inline:true,inputtype: ImageInput@@ -115,15 +118,15 @@ let SectionBackground = [child: "source",key: "src",htmlAttr: "src",- child:"> .background-container > video",+ child:":scope > .background-container > video",group:"bg-video",inline:true,inputtype: VideoInput- }, {+ },{name: "Poster",key: "poster",htmlAttr: "poster",- child:"> .background-container > video",+ child:":scope > .background-container > video",group:"bg-video",inline:true,inputtype: ImageInput@@ -131,8 +134,7 @@ let SectionBackground = [];-let SectionOverlay = [- {+let SectionOverlay = [{key: "section_overlay",inputtype: SectionInput,name:false,@@ -152,34 +154,34 @@ let SectionOverlay = [off: 'false'},onChange : function(node, value, input) {- let group = $('.mb-3[data-group="overlay"]');- let overlay = $("> .overlay", node);+ let group = document.querySelectorAll('.mb-3[data-group="overlay"]');+ let overlay = node.querySelector(":scope > .overlay");if (value == 'true') {- group.show();+ group.forEach(e => e.classList.remove("d-none"));- if (!overlay.length) {- overlay = $('<div class="overlay"></div>');- node.append(overlay);+ if (!overlay) {+ overlay = generateElements('<div class="overlay"></div>')[0];+ node.appendChild(overlay);} else {- overlay.removeClass("d-none");+ overlay.classList.remove("d-none");}} else {- group.hide();- overlay.addClass("d-none");+ group.forEach(e => e.classList.add("d-none"));+ if (overlay) overlay.classList.add("d-none");}return element;},init: function(node) {- let overlay = $("> .overlay:visible", node);- let group = $('.mb-3[data-group="overlay"]');-- if (overlay.length) {- group.show();+ let overlay = node.querySelector(":scope > .overlay");+ let group = document.querySelectorAll('.mb-3[data-group="overlay"]');++ if (overlay && overlay.offsetParent) {+ group.forEach(e => e.classList.remove("d-none"));return 'true';} else {- group.hide();+ group.forEach(e => e.classList.add("d-none"));return 'false';}}@@ -187,16 +189,16 @@ let SectionOverlay = [name: "Color",key: "background-color",htmlAttr: "style",- child:"> .overlay",+ child:":scope > .overlay",group:"overlay",inputtype: ColorInput- }, {+ },{name: "Opacity",key: "opacity",htmlAttr: "style",inline:false,group:"overlay",- child:"> .overlay",+ child:":scope > .overlay",inputtype: RangeInput,data:{max: 1, //max zoom level@@ -225,34 +227,34 @@ function sectionSeparatorProperties(name, title) {off: 'false'},onChange : function(node, value, input) {- let group = $(`[data-group="${name}_separator"]`);- let separator = $(`> .${name}.separator`, node);-+ let group = document.querySelectorAll(`[data-group="${name}_separator"]`);+ let separator = node.querySelector(`:scope > .${name}.separator`);+if (value == 'true') {- group.show();+ group.forEach(e => e.classList.remove("d-none"));- if (!separator.length) {- separator = $(`<div class="separator ${name}">${defaultSeparatorSvg}</div>`);- node.append(separator);+ if (!separator) {+ separator = generateElements(`<div class="separator ${name}">${defaultSeparatorSvg}</div>`)[0];+ node.appendChild(separator);} else {- separator.removeClass("d-none");+ separator.classList.remove("d-none");}} else {- group.hide();- separator.addClass("d-none");+ group.forEach(e => e.classList.add("d-none"));+ separator.classList.add("d-none");}return element;},init: function(node) {- let separator = $(`> .${name}.separator:visible`, node);- let group = $(`[data-group="${name}_separator"]`);+ let group = node.querySelectorAll(`[data-group="${name}_separator"]`);+ let separator = node.querySelector(`:scope > .${name}.separator`);- if (separator.length) {- group.show();+ if (separator && separator.offsetParent) {+ group.forEach(e => e.classList.remove("d-none"));return 'true';} else {- group.hide();+ group.forEach(e => e.classList.add("d-none"));return 'false';}}@@ -264,15 +266,17 @@ function sectionSeparatorProperties(name, title) {child:`.separator.${name} > svg`,inputtype: HtmlListSelectInput,onChange:function(element, value, input, component) {- var newElement = $(value);- let attributes = element.prop("attributes");+ let newElement = generateElements(value)[0];+ let attributes = element.attributes;//keep old svg size and colors- $.each(attributes, function() {- if (this.name == "viewBox") return;- newElement.attr(this.name, this.value);- });-+ 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;},@@ -286,7 +290,7 @@ function sectionSeparatorProperties(name, title) {text: "Red panther"}]},- }, {+ },{name: "Width",key: "width",htmlAttr: "width",@@ -298,7 +302,7 @@ function sectionSeparatorProperties(name, title) {min:6,step:1}- }, {+ },{name: "Height",key: "height",htmlAttr: "height",@@ -310,7 +314,7 @@ function sectionSeparatorProperties(name, title) {min:6,step:1}- }, {+ },{name: "Stroke width",key: "stroke-width",htmlAttr: "stroke-width",@@ -367,8 +371,7 @@ function sectionSeparatorProperties(name, title) {];}-let SectionBottomSeparator = [- {+let SectionBottomSeparator = [{key: "section_bottom_separator",inputtype: SectionInput,name:false,@@ -396,51 +399,49 @@ let ComponentSectionContent = [{key: "title",htmlAttr: "title",inputtype: TextInput- }, {+ },{name: "Container width",key: "container-width",- child:"> .container, > .container-fluid",+ child:":scope > .container, :scope > .container-fluid",htmlAttr: "class",validValues: ["container", "container-fluid"],inputtype: RadioButtonInput,data: {- extraclass:"btn-group-sm btn-group-fullwidth",+ extraclass:"btn-group-sm btn-group-fullwidth",options: [{- value: "container",- icon:"la la-box",- text: "Boxed",- title: "Boxed"- },- {- value: "container-fluid",- icon:"la la-arrows-alt-h",- title: "Full",- text: "Full"- }]- }- }, {+ value: "container",+ icon:"la la-box",+ text: "Boxed",+ title: "Boxed"+ },{+ value: "container-fluid",+ icon:"la la-arrows-alt-h",+ title: "Full",+ text: "Full"+ }]+ }+ },{name: "Container height",key: "container-height",- child:"> .container:first-child, > .container-fluid:first-child",+ child:":scope > .container:first-child, :scope > .container-fluid:first-child",htmlAttr: "class",validValues: ["", "vh-100"],inputtype: RadioButtonInput,data: {- extraclass:"btn-group-sm btn-group-fullwidth",+ extraclass:"btn-group-sm btn-group-fullwidth",options: [{- value: "container",- icon:"la la-expand",- text: "Auto",- title: "Auto",- checked:true,- },- {- value: "vh-100",- icon:"la la-arrows-alt-v",- title: "Full",- text: "Full"- }]- }+ value: "container",+ icon:"la la-expand",+ text: "Auto",+ title: "Auto",+ checked:true,+ },{+ value: "vh-100",+ icon:"la la-arrows-alt-v",+ title: "Full",+ text: "Full"+ }]+ }},...SectionBackground,...SectionOverlay,@@ -450,41 +451,40 @@ let ComponentSectionContent = [{let ComponentSectionStyle = [];/*[{- key: "Section Style",- inputtype: SectionInput,- name:false,- section: style_section,- data: {header:"Style"},-- },{+ key: "Section Style",+ inputtype: SectionInput,+ name:false,+ section: style_section,+ data: {header:"Style"},+ },{name: "Text1 Style",key: "text1",htmlAttr: "innerHTML",inputtype: TextInput,section: style_section,- }, {+ },{name: "Name1 Style",key: "name1",htmlAttr: "name",inputtype: TextInput,section: style_section,- }, {+ },{name: "Type1 Style",key: "type1",htmlAttr: "type",inputtype: SelectInput,section: style_section,data: {- options: [{- value: "button",- text: "button"- }, {- value: "reset",- text: "reset"- }, {- value: "submit",- text: "submit"- }],+ options: [{+ value: "button",+ text: "button"+ },{+ value: "reset",+ text: "reset"+ },{+ value: "submit",+ text: "submit"+ }],}},{name: "Autofocus1 Style",@@ -505,43 +505,42 @@ let ComponentSectionStyle = [];/*[{}];*/let ComponentSectionAdvanced = [];/* [{- key: "Section Advanced",- inputtype: SectionInput,- name:false,- section: advanced_section,- data: {header:"Advanced"},-- },{+ key: "Section Advanced",+ inputtype: SectionInput,+ name:false,+ section: advanced_section,+ data: {header:"Advanced"},+ },{name: "Text1 Advanced",key: "text1",htmlAttr: "innerHTML",inputtype: TextInput,section: advanced_section,- }, {+ },{name: "Name1 Advanced",key: "name1",htmlAttr: "name",inputtype: TextInput,section: advanced_section,- }, {+ },{name: "Type1 Advanced",key: "type1",htmlAttr: "type",inputtype: SelectInput,section: advanced_section,data: {- options: [{- value: "button",- text: "button"- }, {- value: "reset",- text: "reset"- }, {- value: "submit",- text: "submit"- }],- }- },{+ options: [{+ value: "button",+ text: "button"+ },{+ value: "reset",+ text: "reset"+ },{+ value: "submit",+ text: "submit"+ }],+ }+ },{name: "Autofocus1 Advanced",key: "autofocus1",htmlAttr: "autofocus",@@ -549,7 +548,7 @@ let ComponentSectionAdvanced = [];/* [{inline:true,col:6,section: advanced_section- },{+ },{name: "Disabled1 Advanced",key: "disabled1",htmlAttr: "disabled",@@ -561,33 +560,41 @@ let ComponentSectionAdvanced = [];/* [{function componentsInit(node) {- $('.mb-3[data-group]').hide();+ document.querySelectorAll('.mb-3[data-group]').forEach(e => e.classList.add("d-none"));- let img = $("> .background-container img:visible", node);- let video = $("> .background-container video:visible", node);+ let img = node.querySelector(":scope > .background-container img");+ let video = node.querySelector(":scope > .background-container video");+ let overlay = node.querySelector(":scope > .overlay");+ let separatorTop = node.querySelector(":scope > .separator.top");+ let separatorBottom = node.querySelector(":scope > .separator.bottom");let bg = "";- if (img.length) {+ if (img && img.offsetParent) {bg = "bg-image";}- if (video.length) {++ if (video && video.offsetParent) {bg = "bg-video";}+ let showSection = function (section) {+ document.querySelectorAll('.mb-3[data-group="' + section + '"]').forEach(e => e.classList.remove("d-none"));+ }+if (bg) {- $('.mb-3[data-group="' + bg + '"]').show();+ showSection(bg);}- if ($("> .overlay:visible", node).length) {- $('.mb-3[data-group="overlay"]').show();+ if (overlay && overlay.offsetParent) {+ showSection("overlay");}- if ($("> .separator.top:visible", node).length) {- $('.mb-3[data-group="top_separator"]').show();+ if (separatorTop && separatorTop.offsetParent) {+ showSection("top_separator");}- if ($("> .separator.bottom:visible", node).length) {- $('.mb-3[data-group="bottom_separator"]').show();+ if (separatorBottom && separatorBottom.offsetParent) {+ showSection("bottom_separator");}}diff --git a/public/js/vvvebjs/undo.js b/public/js/vvvebjs/undo.jsindex fe863e4..ae263b6 100755--- a/public/js/vvvebjs/undo.js+++ b/public/js/vvvebjs/undo.js@@ -33,7 +33,8 @@ Vvveb.Undo = {this.undoIndex++;*/this.mutations.splice(++this.undoIndex, this.mutations.length - this.undoIndex, mutation);- Vvveb.Builder.frameBody.trigger("vvveb.undo.add", mutation);+ const event = new CustomEvent("vvveb.undo.add", {detail: mutation});+ Vvveb.Builder.frameBody.dispatchEvent(event);},restore : function(mutation, undo) {@@ -41,50 +42,40 @@ Vvveb.Undo = {switch (mutation.type) {case 'childList':- if (undo == true)- {+ if (undo == true) {addedNodes = mutation.removedNodes;removedNodes = mutation.addedNodes;- } else //redo- {+ } else { //redoaddedNodes = mutation.addedNodes;removedNodes = mutation.removedNodes;}- if (addedNodes) for(i in addedNodes)- {+ if (addedNodes) for(i in addedNodes) {node = addedNodes[i];- if (mutation.nextSibling)- {+ if (mutation.nextSibling) {mutation.nextSibling.parentNode.insertBefore(node, mutation.nextSibling);- } else- {+ } else {mutation.target.append(node);}}- if (removedNodes) for(i in removedNodes)- {+ if (removedNodes) for(i in removedNodes) {node = removedNodes[i];node.parentNode.removeChild(node);}break;case 'move':- if (undo == true)- {+ if (undo == true) {parent = mutation.oldParent;sibling = mutation.oldNextSibling;- } else //redo- {+ } else { //redoparent = mutation.newParent;sibling = mutation.newNextSibling;}- if (sibling)- {+ if (sibling) {sibling.parentNode.insertBefore(mutation.target, sibling);- } else- {+ } else {parent.append(node);}break;@@ -92,7 +83,7 @@ Vvveb.Undo = {mutation.target.innerHTML = undo ? mutation.oldValue : mutation.newValue;break;case 'style':- $("#vvvebjs-styles", window.FrameDocument).html( undo ? mutation.oldValue : mutation.newValue );+ window.FrameDocument.getElementById("vvvebjs-styles").textContent = ( undo ? mutation.oldValue : mutation.newValue );break;case 'attributes':value = undo ? mutation.oldValue : mutation.newValue;@@ -105,7 +96,8 @@ Vvveb.Undo = {break;}- Vvveb.Builder.frameBody.trigger("vvveb.undo.restore", mutation);+ const event = new CustomEvent("vvveb.undo.restore", {detail: mutation});+ Vvveb.Builder.frameBody.dispatchEvent(event);},undo : function() {