Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../js/editor/componen...
File: undomanager.mjs
((api,topWindowDoc,_CLICK_)=>{
[0] Fix | Delete
"use strict";
[1] Fix | Delete
api.undoManager = class {
[2] Fix | Delete
static #items=[];
[3] Fix | Delete
isWorking= false;
[4] Fix | Delete
isDisabled=false;
[5] Fix | Delete
stack=[];
[6] Fix | Delete
state=new Map;
[7] Fix | Delete
index=-1;
[8] Fix | Delete
btnUndo;
[9] Fix | Delete
btnRedo;
[10] Fix | Delete
compactBtn;
[11] Fix | Delete
#cid;
[12] Fix | Delete
#type;
[13] Fix | Delete
constructor(btnUndo,btnRedo,compactBtn){
[14] Fix | Delete
const toolbarEl=api.ToolBar.el,
[15] Fix | Delete
isEmpty=this.constructor.get(0)===undefined;
[16] Fix | Delete
this.btnUndo = btnUndo;
[17] Fix | Delete
this.btnRedo = btnRedo;
[18] Fix | Delete
this.compactBtn = compactBtn;
[19] Fix | Delete
if(isEmpty && toolbarEl.contains(btnUndo)){
[20] Fix | Delete
toolbarEl.tfClass('menu_undo')[0].tfOn(_CLICK_,e=>{
[21] Fix | Delete
if(e.target!==this.compactBtn){
[22] Fix | Delete
e.preventDefault();
[23] Fix | Delete
e.stopPropagation();
[24] Fix | Delete
const target=e.target.closest('.undo_redo');
[25] Fix | Delete
if(target!==null && !target.classList.contains('disabled')){
[26] Fix | Delete
this.constructor.doChange(target.classList.contains('undo'));
[27] Fix | Delete
}
[28] Fix | Delete
}
[29] Fix | Delete
});
[30] Fix | Delete
}else{
[31] Fix | Delete
for(let items=[btnUndo,btnRedo],i=items.length-1;i>-1;--i){
[32] Fix | Delete
items[i].tfOn(_CLICK_,e=>{
[33] Fix | Delete
e.stopPropagation();
[34] Fix | Delete
this.constructor.doChange(e.target.classList.contains('undo'));
[35] Fix | Delete
});
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
if (isEmpty && !Themify.isTouch && !themifyBuilder.disableShortcuts) {
[40] Fix | Delete
topWindowDoc.tfOn('keydown auxclick',e=>{
[41] Fix | Delete
this.constructor.keypres(e);
[42] Fix | Delete
});
[43] Fix | Delete
if (api.isFrontend) {
[44] Fix | Delete
doc.tfOn('keydown auxclick',e=>{
[45] Fix | Delete
this.constructor.keypres(e);
[46] Fix | Delete
});
[47] Fix | Delete
}
[48] Fix | Delete
}
[49] Fix | Delete
this.constructor.#items.push(this);
[50] Fix | Delete
}
[51] Fix | Delete
hasUndo() {
[52] Fix | Delete
return this.index>-1;
[53] Fix | Delete
}
[54] Fix | Delete
hasRedo() {
[55] Fix | Delete
return this.index < (this.stack.length - 1);
[56] Fix | Delete
}
[57] Fix | Delete
destroy(){
[58] Fix | Delete
for(let items=this.constructor.#items,i=items.length-1;i>-1;--i){
[59] Fix | Delete
if(items[i]===this){
[60] Fix | Delete
items.splice(i,1);
[61] Fix | Delete
break;
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
this.stack=this.state=this.btnUndo=this.btnRedo=this.compactBtn=null;
[65] Fix | Delete
this.constructor.updateUndoBtns();
[66] Fix | Delete
}
[67] Fix | Delete
static get(index){
[68] Fix | Delete
index??= this.#items.length-1;
[69] Fix | Delete
return this.#items[index];
[70] Fix | Delete
}
[71] Fix | Delete
static setActive(undoItem){
[72] Fix | Delete
for(let items=this.#items,len=items.length-1,i=len;i>-1;--i){
[73] Fix | Delete
if(items[i]===undoItem){
[74] Fix | Delete
[items[i], items[len]] = [items[len], items[i]];
[75] Fix | Delete
break;
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
}
[79] Fix | Delete
static start(type,cid){
[80] Fix | Delete
const _this = this.get();
[81] Fix | Delete
if(this.has(type)===true){
[82] Fix | Delete
console.warn('UndoManager:'+type+' is already started');
[83] Fix | Delete
return false;
[84] Fix | Delete
}
[85] Fix | Delete
_this.#type=type;
[86] Fix | Delete
_this.#cid=cid;
[87] Fix | Delete
_this.state.set(type,this.getCurrentState(type,cid));
[88] Fix | Delete
}
[89] Fix | Delete
static end(type){
[90] Fix | Delete
const _this = this.get();
[91] Fix | Delete
type??=_this.#type;
[92] Fix | Delete
if(this.has(type)===false){
[93] Fix | Delete
console.warn('UndoManager:'+type+' isn`t started');
[94] Fix | Delete
return false;
[95] Fix | Delete
}
[96] Fix | Delete
Themify.trigger('tb_undo_add',type);
[97] Fix | Delete
const diff=this.getDiff(type,this.getState(type),this.getCurrentState(type,_this.#cid));
[98] Fix | Delete
if(Object.keys(diff).length>0){
[99] Fix | Delete
this.push(diff);
[100] Fix | Delete
}
[101] Fix | Delete
_this.state.delete(type);
[102] Fix | Delete
_this.#type=_this.#cid=null;
[103] Fix | Delete
}
[104] Fix | Delete
static getCurrentState(type){
[105] Fix | Delete
const styles={},
[106] Fix | Delete
result={builder:api.Helper.cloneObject(api.Builder.get().toJSON(false))},
[107] Fix | Delete
breakpoints=api.breakpointsReverse;
[108] Fix | Delete
for(let i=breakpoints.length-1;i>-1;--i){
[109] Fix | Delete
let bp=breakpoints[i],
[110] Fix | Delete
rules=ThemifyStyles.getSheet(bp).cssRules,
[111] Fix | Delete
gsRules=ThemifyStyles.getSheet(bp,true).cssRules;
[112] Fix | Delete
styles[bp]={st:{},gs:{}};
[113] Fix | Delete
for(let j=rules.length-1;j>-1;--j){
[114] Fix | Delete
styles[bp].st[rules[j].selectorText]=rules[j].style.cssText;
[115] Fix | Delete
}
[116] Fix | Delete
for(let j=gsRules.length-1;j>-1;--j){
[117] Fix | Delete
styles[bp].gs[gsRules[j].selectorText]=gsRules[j].style.cssText;
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
result.style=styles;
[121] Fix | Delete
return result;
[122] Fix | Delete
}
[123] Fix | Delete
static getState(type){
[124] Fix | Delete
return this.get().state.get(type);
[125] Fix | Delete
}
[126] Fix | Delete
static has(type){
[127] Fix | Delete
return !!this.get().state.has(type);
[128] Fix | Delete
}
[129] Fix | Delete
static clear(type){
[130] Fix | Delete
const _this = this.get();
[131] Fix | Delete
if(type===_this.#type){
[132] Fix | Delete
_this.#type=null;
[133] Fix | Delete
}
[134] Fix | Delete
_this.state.delete(type);
[135] Fix | Delete
_this.#cid=null;
[136] Fix | Delete
}
[137] Fix | Delete
static hasRedo() {
[138] Fix | Delete
return this.get().hasRedo();
[139] Fix | Delete
}
[140] Fix | Delete
static hasUndo() {
[141] Fix | Delete
return this.get().hasUndo();
[142] Fix | Delete
}
[143] Fix | Delete
static disable() {
[144] Fix | Delete
const _this = this.get();
[145] Fix | Delete
_this.isDisabled=true;
[146] Fix | Delete
_this.btnUndo.classList.add('disabled');
[147] Fix | Delete
_this.btnRedo.classList.add('disabled');
[148] Fix | Delete
_this.compactBtn?.classList.add('disabled');
[149] Fix | Delete
}
[150] Fix | Delete
static enable() {
[151] Fix | Delete
const _this = this.get();
[152] Fix | Delete
_this.isDisabled=false;
[153] Fix | Delete
this.updateUndoBtns();
[154] Fix | Delete
}
[155] Fix | Delete
static update(is_undo){
[156] Fix | Delete
const _this = this.get();
[157] Fix | Delete
if (is_undo===true) {
[158] Fix | Delete
--_this.index;
[159] Fix | Delete
} else {
[160] Fix | Delete
++_this.index;
[161] Fix | Delete
}
[162] Fix | Delete
this.updateUndoBtns();
[163] Fix | Delete
api.ModulePageBreak.countModules();
[164] Fix | Delete
}
[165] Fix | Delete
static updateUndoBtns() {
[166] Fix | Delete
const _this = this.get();
[167] Fix | Delete
if(_this.isDisabled!==true){
[168] Fix | Delete
const undo = _this.hasUndo(),
[169] Fix | Delete
redo = _this.hasRedo();
[170] Fix | Delete
_this.btnUndo.classList.toggle('disabled', !undo);
[171] Fix | Delete
_this.btnRedo.classList.toggle('disabled', !redo);
[172] Fix | Delete
_this.compactBtn?.classList.toggle('disabled', !(undo || redo));
[173] Fix | Delete
}
[174] Fix | Delete
}
[175] Fix | Delete
static reset() {
[176] Fix | Delete
const _this = this.get();
[177] Fix | Delete
_this.stack = [];
[178] Fix | Delete
_this.state.clear();
[179] Fix | Delete
_this.index = -1;
[180] Fix | Delete
this.updateUndoBtns();
[181] Fix | Delete
}
[182] Fix | Delete
static push(data) {
[183] Fix | Delete
const _this = this.get();
[184] Fix | Delete
_this.stack.splice(_this.index + 1, _this.stack.length - _this.index);
[185] Fix | Delete
_this.stack.push(data);
[186] Fix | Delete
_this.index = _this.stack.length - 1;
[187] Fix | Delete
this.updateUndoBtns();
[188] Fix | Delete
Themify.trigger('add_undo');
[189] Fix | Delete
api.Builder.get().isSaved=false;
[190] Fix | Delete
}
[191] Fix | Delete
static async doChange(is_undo) {
[192] Fix | Delete
const _this = this.get();
[193] Fix | Delete
if (_this.isWorking === false && _this.isDisabled===false) {
[194] Fix | Delete
_this.isWorking = true;
[195] Fix | Delete
await this.changes(is_undo);
[196] Fix | Delete
_this.isWorking = false;
[197] Fix | Delete
}
[198] Fix | Delete
}
[199] Fix | Delete
static getDiff(type,oldState,newState){
[200] Fix | Delete
[201] Fix | Delete
//compare builder
[202] Fix | Delete
const oldBuilder=oldState.builder,
[203] Fix | Delete
newBuilder=newState.builder,
[204] Fix | Delete
builderChanges=new Map,
[205] Fix | Delete
rowsIds= new Set;
[206] Fix | Delete
for(let i=0;i<oldBuilder.length;++i){
[207] Fix | Delete
let oldB=oldBuilder[i],
[208] Fix | Delete
newB=newBuilder[i],
[209] Fix | Delete
id=oldB.element_id;
[210] Fix | Delete
if(newBuilder[i]?.element_id===id){
[211] Fix | Delete
if(api.Helper.compareObject(oldB,newB)){
[212] Fix | Delete
builderChanges.set(id,{old:oldB,new:newB});
[213] Fix | Delete
}
[214] Fix | Delete
}else{
[215] Fix | Delete
let found=false;
[216] Fix | Delete
[217] Fix | Delete
for(let j=newBuilder.length-1;j>-1;--j){
[218] Fix | Delete
if(newBuilder[j].element_id===id){
[219] Fix | Delete
if(type==='delete' && api.Helper.compareObject(oldB,newBuilder[j])){
[220] Fix | Delete
builderChanges.set(id,{old:oldB,new:newBuilder[j]});
[221] Fix | Delete
}
[222] Fix | Delete
else if(type==='move' && newBuilder.length===oldBuilder.length && !builderChanges.has('sort')){//row position changed
[223] Fix | Delete
let oldSort=[],
[224] Fix | Delete
newSort=[];
[225] Fix | Delete
for(let i=0;i<oldBuilder.length;++i){
[226] Fix | Delete
oldSort.push(oldBuilder[i].element_id);
[227] Fix | Delete
}
[228] Fix | Delete
for(let i=0;i<newBuilder.length;++i){
[229] Fix | Delete
newSort.push(newBuilder[i].element_id);
[230] Fix | Delete
}
[231] Fix | Delete
builderChanges.set('sort',{old:oldSort,new:newSort});
[232] Fix | Delete
}
[233] Fix | Delete
found=true;
[234] Fix | Delete
break;
[235] Fix | Delete
}
[236] Fix | Delete
}
[237] Fix | Delete
if(!found){//row not found it's deleted
[238] Fix | Delete
builderChanges.set(id,{old:oldB,index:i});
[239] Fix | Delete
}
[240] Fix | Delete
}
[241] Fix | Delete
rowsIds.add(id);
[242] Fix | Delete
}
[243] Fix | Delete
if(newBuilder.length>oldBuilder.length){//check new rows
[244] Fix | Delete
for(let i=0;i<newBuilder.length;++i){
[245] Fix | Delete
let newB=newBuilder[i],
[246] Fix | Delete
id=newB.element_id;
[247] Fix | Delete
if(!rowsIds.has(id)){
[248] Fix | Delete
builderChanges.set(id,{new:newB,index:i});
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
rowsIds.clear();
[254] Fix | Delete
let oldStyles=oldState.style,
[255] Fix | Delete
currentStyles=newState.style,
[256] Fix | Delete
stylesChanges={},
[257] Fix | Delete
parseCssText=cssText=>{
[258] Fix | Delete
cssText=cssText.split('; ');
[259] Fix | Delete
const res={};
[260] Fix | Delete
for(let i=cssText.length-1;i>-1;--i){
[261] Fix | Delete
let index = cssText[i].indexOf(':'),
[262] Fix | Delete
prop = cssText[i].substring(0, index);
[263] Fix | Delete
res[prop]=cssText[i].substring(index + 1).trim();
[264] Fix | Delete
let len=res[prop].length;
[265] Fix | Delete
if (res[prop][len - 1] === ';') {
[266] Fix | Delete
res[prop] = res[prop].slice(0, -1);
[267] Fix | Delete
}
[268] Fix | Delete
else if(res[prop][len - 1]==='"' && res[prop][len - 2]===';'){
[269] Fix | Delete
let index=len - 2;
[270] Fix | Delete
res[prop]=res[prop].substring(0, index)+res[prop].substring(index+1);
[271] Fix | Delete
}
[272] Fix | Delete
}
[273] Fix | Delete
return res;
[274] Fix | Delete
},
[275] Fix | Delete
diffStyles=(oldStyles,newStyles)=>{
[276] Fix | Delete
let diff={old:{},new:{}};
[277] Fix | Delete
for(let sel in oldStyles){//check changes
[278] Fix | Delete
if(newStyles[sel]!==undefined){
[279] Fix | Delete
if(newStyles[sel]!==oldStyles[sel]){
[280] Fix | Delete
let oldCss=parseCssText(oldStyles[sel]),
[281] Fix | Delete
newCss= parseCssText(newStyles[sel]);
[282] Fix | Delete
[283] Fix | Delete
for(let prop in oldCss){//check props changes
[284] Fix | Delete
if(newCss[prop]!==oldCss[prop]){
[285] Fix | Delete
let oldV=oldCss[prop].trim(),
[286] Fix | Delete
newV=newCss[prop]?.trim()??'';
[287] Fix | Delete
if(newV!==oldV){
[288] Fix | Delete
diff.old[sel]??={};
[289] Fix | Delete
diff.new[sel]??={};
[290] Fix | Delete
diff.old[sel][prop]=oldV;
[291] Fix | Delete
diff.new[sel][prop]=newV;
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
}
[295] Fix | Delete
for(let prop in newCss){//new props
[296] Fix | Delete
if(oldCss[prop]===undefined){
[297] Fix | Delete
diff.old[sel]??={};
[298] Fix | Delete
diff.new[sel]??={};
[299] Fix | Delete
diff.old[sel][prop]='';
[300] Fix | Delete
diff.new[sel][prop]=newCss[prop].trim();
[301] Fix | Delete
}
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
else{
[307] Fix | Delete
diff.old[sel]=parseCssText(oldStyles[sel]);
[308] Fix | Delete
diff.new[sel]='';
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
for(let sel in newStyles){//new selectors
[313] Fix | Delete
if(oldStyles[sel]===undefined){
[314] Fix | Delete
diff.new[sel]=parseCssText(newStyles[sel]);
[315] Fix | Delete
diff.old[sel]='';
[316] Fix | Delete
}
[317] Fix | Delete
}
[318] Fix | Delete
if(Object.keys(diff.old).length===0){
[319] Fix | Delete
delete diff.old;
[320] Fix | Delete
}
[321] Fix | Delete
if(Object.keys(diff.new).length===0){
[322] Fix | Delete
delete diff.new;
[323] Fix | Delete
}
[324] Fix | Delete
return diff;
[325] Fix | Delete
};
[326] Fix | Delete
[327] Fix | Delete
for(let bp in oldStyles){
[328] Fix | Delete
if(currentStyles[bp]!==undefined){
[329] Fix | Delete
let stChanges=diffStyles(oldStyles[bp].st,currentStyles[bp].st),
[330] Fix | Delete
gsChanges=diffStyles(oldStyles[bp].gs,currentStyles[bp].gs);
[331] Fix | Delete
if(Object.keys(stChanges).length>0){
[332] Fix | Delete
stylesChanges[bp]={st:stChanges};
[333] Fix | Delete
}
[334] Fix | Delete
if(Object.keys(gsChanges).length>0){
[335] Fix | Delete
stylesChanges[bp]={gs:gsChanges};
[336] Fix | Delete
}
[337] Fix | Delete
}
[338] Fix | Delete
}
[339] Fix | Delete
for(let bp in currentStyles){//new breakpoints
[340] Fix | Delete
if(oldStyles[bp]===undefined){
[341] Fix | Delete
let stChanges=diffStyles({},currentStyles[bp].st),
[342] Fix | Delete
gsChanges=diffStyles({},currentStyles[bp].gs);
[343] Fix | Delete
if(Object.keys(stChanges).length>0){
[344] Fix | Delete
stylesChanges[bp]={st:stChanges};
[345] Fix | Delete
}
[346] Fix | Delete
if(Object.keys(gsChanges).length>0){
[347] Fix | Delete
stylesChanges[bp]={gs:gsChanges};
[348] Fix | Delete
}
[349] Fix | Delete
}
[350] Fix | Delete
}
[351] Fix | Delete
newState=currentStyles=oldStyles=null;
[352] Fix | Delete
const data={};
[353] Fix | Delete
if(Object.keys(stylesChanges).length>0){
[354] Fix | Delete
data.styles=stylesChanges;
[355] Fix | Delete
}
[356] Fix | Delete
if(builderChanges.size>0){
[357] Fix | Delete
data.html=builderChanges;
[358] Fix | Delete
}
[359] Fix | Delete
if(data.html || data.styles){
[360] Fix | Delete
data.type=type;
[361] Fix | Delete
}
[362] Fix | Delete
return data;
[363] Fix | Delete
}
[364] Fix | Delete
static keypres(e) {
[365] Fix | Delete
const _this = this.get();
[366] Fix | Delete
if (_this.isWorking === false && _this.isDisabled===false && (e.button===3 || e.button===4 || true === e.ctrlKey || true === e.metaKey)){
[367] Fix | Delete
const activeTag = doc.activeElement.tagName,
[368] Fix | Delete
topActiveTag = topWindowDoc.activeElement.tagName,
[369] Fix | Delete
key = e.code;
[370] Fix | Delete
if (activeTag !== 'INPUT' && activeTag !== 'TEXTAREA' && topActiveTag !== 'INPUT' && topActiveTag !== 'TEXTAREA' && !api.LightBox.el.contains(e.target)) {
[371] Fix | Delete
if ('KeyY' === key || e.button===4 || ('KeyZ' === key && true === e.shiftKey)) {// Redo
[372] Fix | Delete
if (this.hasRedo()) {
[373] Fix | Delete
e.preventDefault();
[374] Fix | Delete
this.changes(false);
[375] Fix | Delete
}
[376] Fix | Delete
}
[377] Fix | Delete
else if (('KeyZ' === key || e.button===3) && this.hasUndo()) { // UNDO
[378] Fix | Delete
e.preventDefault();
[379] Fix | Delete
this.changes(true);
[380] Fix | Delete
}
[381] Fix | Delete
}
[382] Fix | Delete
}
[383] Fix | Delete
}
[384] Fix | Delete
static async changes(is_undo) {
[385] Fix | Delete
api.ActionBar.clearClicked();
[386] Fix | Delete
if (api.activeModel !== null && (!api.isVisual || (!doc.activeElement.isContentEditable && api.activeModel.el.contains(doc.activeElement)))) {
[387] Fix | Delete
await api.LightBox.save();
[388] Fix | Delete
return this.changes(is_undo);
[389] Fix | Delete
}
[390] Fix | Delete
const _this = this.get(),
[391] Fix | Delete
index = is_undo===true ? 0 : 1,
[392] Fix | Delete
stack = _this.stack[_this.index + index];
[393] Fix | Delete
if (stack !== undefined) {
[394] Fix | Delete
const type=is_undo===true?'old':'new';
[395] Fix | Delete
if(stack.html){
[396] Fix | Delete
await this.domChanges(stack.html,type,stack.type);
[397] Fix | Delete
}
[398] Fix | Delete
if(stack.styles){
[399] Fix | Delete
this.styleChanges(stack.styles,type,!stack.html);
[400] Fix | Delete
}
[401] Fix | Delete
this.update(is_undo);
[402] Fix | Delete
}
[403] Fix | Delete
}
[404] Fix | Delete
[405] Fix | Delete
static styleChanges(styles,mode,runJs){
[406] Fix | Delete
//replace styles
[407] Fix | Delete
const selectors=new Set;
[408] Fix | Delete
for(let bp in styles){
[409] Fix | Delete
for(let k in styles[bp]){
[410] Fix | Delete
let sheet=ThemifyStyles.getSheet(bp,k==='gs'),
[411] Fix | Delete
rules=sheet.cssRules;
[412] Fix | Delete
for(let sel in styles[bp][k][mode]){
[413] Fix | Delete
let vals=styles[bp][k][mode][sel],
[414] Fix | Delete
index=api.Utils.findCssRule(rules, sel);
[415] Fix | Delete
if(vals!==''){
[416] Fix | Delete
if(index === false || rules[index]===undefined){
[417] Fix | Delete
let cssText='';
[418] Fix | Delete
for(let prop in vals){
[419] Fix | Delete
cssText+=prop + ':' + vals[prop] + ';';
[420] Fix | Delete
}
[421] Fix | Delete
sheet.insertRule(sel + '{' + cssText + ';}', rules.length);
[422] Fix | Delete
}
[423] Fix | Delete
else{
[424] Fix | Delete
for(let prop in vals){
[425] Fix | Delete
let val=vals[prop].trim(),
[426] Fix | Delete
priority = val !== '' && val.includes('!important')? 'important' : '';
[427] Fix | Delete
if (priority !== '') {
[428] Fix | Delete
val = val.replace('!important', '').trim();
[429] Fix | Delete
}
[430] Fix | Delete
rules[index].style.setProperty(prop, val,priority);
[431] Fix | Delete
}
[432] Fix | Delete
}
[433] Fix | Delete
}
[434] Fix | Delete
else if(index !== false && rules[index]!==undefined){
[435] Fix | Delete
sheet.deleteRule(index);
[436] Fix | Delete
}
[437] Fix | Delete
if(runJs===true){
[438] Fix | Delete
selectors.add(sel);
[439] Fix | Delete
}
[440] Fix | Delete
}
[441] Fix | Delete
}
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
if(selectors.size>0){
[445] Fix | Delete
for(let sel of selectors){
[446] Fix | Delete
let item=doc.querySelector(sel);
[447] Fix | Delete
if(item){
[448] Fix | Delete
api.Utils.runJs(item);
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
}
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
static async domChanges(changes,mode,type){
[455] Fix | Delete
let builder=api.Builder.get().el,
[456] Fix | Delete
ids=new Set,
[457] Fix | Delete
rows=new Set,
[458] Fix | Delete
Registry=api.Registry,
[459] Fix | Delete
sort=changes.get('sort')?.[mode],
[460] Fix | Delete
model=api.activeModel,
[461] Fix | Delete
rowSizes,
[462] Fix | Delete
cid=model?.id,
[463] Fix | Delete
componentType=model?.type,
[464] Fix | Delete
loop = items => {
[465] Fix | Delete
for (let i = items.length - 1; i > -1; --i) {
[466] Fix | Delete
let item=items[i],
[467] Fix | Delete
mod_settings=item.mod_settings;
[468] Fix | Delete
if(item.element_id===cid){
[469] Fix | Delete
ThemifyConstructor.setStylingValues(api.activeBreakPoint);//save current breakpoint style tab
[470] Fix | Delete
let settings = {...api.Helper.cloneObject(ThemifyConstructor.values),...api.Forms.serialize('tb_options_setting', true)};
[471] Fix | Delete
if (componentType !== 'column') {
[472] Fix | Delete
settings={...settings,...api.Forms.serialize('tb_options_animation', true),...api.Forms.serialize('tb_options_visibility', true)};
[473] Fix | Delete
}
[474] Fix | Delete
if(componentType==='module'){
[475] Fix | Delete
item.mod_settings=settings;
[476] Fix | Delete
}
[477] Fix | Delete
else{
[478] Fix | Delete
if(componentType!=='column'){
[479] Fix | Delete
rowSizes={...item.sizes};
[480] Fix | Delete
}
[481] Fix | Delete
item.styling=settings;
[482] Fix | Delete
}
[483] Fix | Delete
return true;
[484] Fix | Delete
}
[485] Fix | Delete
if ((item.cols?.length>0 && loop(item.cols)) || (item.modules?.length>0 && loop(item.modules))) {
[486] Fix | Delete
return;
[487] Fix | Delete
}
[488] Fix | Delete
if(mod_settings){
[489] Fix | Delete
let nestedBuilder=mod_settings.content_accordion || mod_settings.tab_content_tab;
[490] Fix | Delete
if(nestedBuilder){
[491] Fix | Delete
for(let j=nestedBuilder.length-1;j>-1;--j){
[492] Fix | Delete
if(nestedBuilder[j].builder_content){
[493] Fix | Delete
loop(nestedBuilder[j].builder_content);
[494] Fix | Delete
}
[495] Fix | Delete
}
[496] Fix | Delete
}
[497] Fix | Delete
}
[498] Fix | Delete
}
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function