From 05b61f5889abf19d9f524ca317d1f00005f3e40f Mon Sep 17 00:00:00 2001 From: ObitoTM Date: Fri, 22 May 2026 17:23:47 +0300 Subject: [PATCH 1/3] FIX: multistep page detection with StyleManager wrappers https://github.com/Crocoblock/issues-tracker/issues/19698 --- assets/build/frontend/multi.step.asset.php | 2 +- assets/build/frontend/multi.step.js | 2 +- assets/src/frontend/multi.step/functions.js | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/assets/build/frontend/multi.step.asset.php b/assets/build/frontend/multi.step.asset.php index d7085aae5..5c6eae6e3 100644 --- a/assets/build/frontend/multi.step.asset.php +++ b/assets/build/frontend/multi.step.asset.php @@ -1 +1 @@ - array(), 'version' => '36b86101cee675ffda25'); + array(), 'version' => '85741bd15e67647ddae0'); diff --git a/assets/build/frontend/multi.step.js b/assets/build/frontend/multi.step.js index ad8d68bf1..65f74cc47 100644 --- a/assets/build/frontend/multi.step.js +++ b/assets/build/frontend/multi.step.js @@ -1 +1 @@ -(()=>{"use strict";const{ConditionItem:t}=JetFormBuilderAbstract;function e(){t.call(this),this.isSupported=function(t){return!!t?.page_state?.length},this.setOptions=function({page_state:t}){this.pageState=t},this.isPassed=function(){const t=this.list?.block?.page?.canSwitch?.current;return"active"===this.pageState&&!t}}e.prototype=Object.create(t.prototype);const s=e,{ReactiveVar:i,createConditionalBlock:n}=JetFormBuilderAbstract,{validateInputs:o,getOffsetTop:r,focusOnInvalidInput:a,populateInputs:c}=JetFormBuilderFunctions,{addAction:h,doAction:u}=JetPlugins.hooks;function d(t,e){this.node=t,this.index=+t.dataset.page,this.offset=+t.dataset.pageOffset,this.state=e,this.inputs=[],this.canSwitch=new i(null),this.isShow=new i(1===this.index),this.autoFocus=window.JetFormBuilderSettings?.auto_focus,this.initialObserveState=!1}d.prototype.observe=function(){this.isLast()||this.observeInputs(),this.canSwitch.make(),this.isShow.make(),this.isShow.watch((()=>{this.isShow.current?this.onShow():this.onHide()})),this.addButtonsListeners(),this.isFirst()&&(this.initialObserveState=!0,this.updateStateAsync().then((()=>{})).catch((()=>{}))),this.updateOffsetByProgress(),h("jet.fb.observe.input.manual","jet-form-builder/page-state",(t=>this.observeInput(t.nodes[0]))),u("jet.fb.multistep.page.init",this)},d.prototype.observeInputs=function(){for(const t of this.node.querySelectorAll("[data-jfb-sync]")){const e=this.observeInput(t);e&&u("jet.fb.multistep.page.observed.input",e,this)}},d.prototype.observeInput=function(t){if(!this.isNodeBelongThis(t)||!t.hasOwnProperty("jfbSync")||t.jfbSync.hasParent())return!1;const e=t.jfbSync;return this.handleInputEnter(e),e.loading.watch((()=>{e.loading.current?this.canSwitch.current=!1:this.updateState()})),e.reporting.restrictions.length?(this.inputs.push(e),e.watchValidity((()=>this.updateState())),e):e},d.prototype.observeConditionalBlocks=function(){if(!this.isLast())for(const t of this.node.querySelectorAll("[data-jfb-conditional]")){if(!this.isNodeBelongThis(t))continue;const e=n(t,this.state.getRoot());for(const t of e.list.getConditions())if(t instanceof s){e.page=this,this.canSwitch.watch((()=>e.list.onChangeRelated()));break}}},d.prototype.onShow=function(){this.node.classList.remove("jet-form-builder-page--hidden"),this.initialObserveState||(this.initialObserveState=!0,this.updateStateAsync().then((()=>{})).catch((()=>{})))},d.prototype.onHide=function(){this.node.classList.add("jet-form-builder-page--hidden")},d.prototype.updateState=function(){for(const t of this.getInputs())if(!t.reporting.validityState.current&&null!==t.reporting.validityState.current)return void(this.canSwitch.current=!1);this.canSwitch.current=!0},d.prototype.updateStateAsync=async function(t=!0){try{await o(this.getInputs(),t),this.canSwitch.current=!0}catch(t){this.canSwitch.current=!1}},d.prototype.addButtonsListeners=function(){const t=this.node.querySelectorAll(".jet-form-builder__next-page, .jet-form-builder__prev-page");for(const e of t){if(!this.isNodeBelongThis(e))continue;const t=e.classList.contains("jet-form-builder__prev-page");e.addEventListener("click",(()=>this.changePage(t)))}},d.prototype.changePage=async function(t){t?this.state.index.current=this.index-1:this.getLockState().current||(await this.updateStateAsync(!1),this.canSwitch.current?this.state.index.current=this.index+1:this.autoFocus&&a(this.getInputs()))},d.prototype.isNodeBelongThis=function(t){const e=t.closest(".jet-form-builder-page");return!!e&&e.isEqualNode(this.node)},d.prototype.getInputs=function(){return c(this.inputs)},d.prototype.getLockState=function(){var t;const e=this.state.getRoot();return(null!==(t=e?.parent?.root?.form)&&void 0!==t?t:e.form).lockState},d.prototype.isLast=function(){return this.state.isLastPage(this)},d.prototype.isFirst=function(){return this.state.isFirstPage(this)},d.prototype.handleInputEnter=function(t){t?.enterKey?.addFilter((()=>{const e=t.root.form;return e?!0===e.canTriggerEnterSubmit&&this.changePage().then((()=>{})).catch((()=>{})):this.changePage().then((()=>{})).catch((()=>{})),!1}))},d.prototype.getOffsetTop=function(){return r(this.node)-this.offset},d.prototype.updateOffsetByProgress=function(){this.state?.progress?.node&&(this.offset+=+this.state.progress.node.clientHeight)};const p=d,l=function(t,e){this.node=t,this.state=e,this.state.index.watch((()=>this.updateItems())),this.updateItems=function(){const{current:t}=this.state.index;for(const e of this.node.children){const s=+e.dataset.page;snew p(t,this))),this.elements.forEach((t=>t.observe())),this.elements.forEach((t=>t.observeConditionalBlocks()));const{submitter:e}=this.getRoot().getSubmit();e.hasOwnProperty("status")&&e.watchReset((()=>{this.index.current=1}))},this.onChangeIndex=function(){for(const t of this.getPages())t.isShow.current=t.index===this.index.current;window?.jQuery(document)?.trigger("jet-form-builder/switch-page")},this.getCurrentPage=function(){for(const t of this.getPages())if(t.isShow.current)return t;return!1},this.getPages=function(){return this.elements},this.getScopeNode=function(){var t;return null!==(t=this.block?.node)&&void 0!==t?t:this.root.rootNode},this.getRoot=function(){var t;return null!==(t=this.block?.root)&&void 0!==t?t:this.root},this.isLastPage=function(t){return this.elements.at(-1)===t},this.isFirstPage=function(t){return this.elements[0]===t},this.onReady=function(){m("jet.fb.multistep.init",this)}};function S(t){const e=new b;e.setScope(t);const s=[];for(const t of e.getScopeNode().childNodes)t?.classList?.contains("jet-form-builder-page")&&s.push(t);return s.length?(e.setProgress(),e.setPages(s),e):e}const{addAction:y,addFilter:v}=JetPlugins.hooks,{getScrollParent:w}=JetFormBuilderFunctions;y("jet.fb.observe.after","jet-form-builder/multi-step",(function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())}),15),y("jet.fb.conditional.init","jet-form-builder/multi-step",(function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())})),v("jet.fb.conditional.types","jet-form-builder/multi-step",(function(t){return[s,...t]})),y("jet.fb.multistep.init","jet-form-builder/multi-step/autoscroll",(function(t){window?.JetFormBuilderSettings?.scroll_on_next&&t.index.watch((()=>{const e=t.getCurrentPage(),s=w(e.node),i=e.getOffsetTop();s?.scrollTo?.({top:i,behavior:"smooth"})}))}))})(); \ No newline at end of file +(()=>{"use strict";const{ConditionItem:t}=JetFormBuilderAbstract;function e(){t.call(this),this.isSupported=function(t){return!!t?.page_state?.length},this.setOptions=function({page_state:t}){this.pageState=t},this.isPassed=function(){const t=this.list?.block?.page?.canSwitch?.current;return"active"===this.pageState&&!t}}e.prototype=Object.create(t.prototype);const s=e,{ReactiveVar:i,createConditionalBlock:n}=JetFormBuilderAbstract,{validateInputs:o,getOffsetTop:r,focusOnInvalidInput:a,populateInputs:c}=JetFormBuilderFunctions,{addAction:h,doAction:u}=JetPlugins.hooks;function d(t,e){this.node=t,this.index=+t.dataset.page,this.offset=+t.dataset.pageOffset,this.state=e,this.inputs=[],this.canSwitch=new i(null),this.isShow=new i(1===this.index),this.autoFocus=window.JetFormBuilderSettings?.auto_focus,this.initialObserveState=!1}d.prototype.observe=function(){this.isLast()||this.observeInputs(),this.canSwitch.make(),this.isShow.make(),this.isShow.watch(()=>{this.isShow.current?this.onShow():this.onHide()}),this.addButtonsListeners(),this.isFirst()&&(this.initialObserveState=!0,this.updateStateAsync().then(()=>{}).catch(()=>{})),this.updateOffsetByProgress(),h("jet.fb.observe.input.manual","jet-form-builder/page-state",t=>this.observeInput(t.nodes[0])),u("jet.fb.multistep.page.init",this)},d.prototype.observeInputs=function(){for(const t of this.node.querySelectorAll("[data-jfb-sync]")){const e=this.observeInput(t);e&&u("jet.fb.multistep.page.observed.input",e,this)}},d.prototype.observeInput=function(t){if(!this.isNodeBelongThis(t)||!t.hasOwnProperty("jfbSync")||t.jfbSync.hasParent())return!1;const e=t.jfbSync;return this.handleInputEnter(e),e.loading.watch(()=>{e.loading.current?this.canSwitch.current=!1:this.updateState()}),e.reporting.restrictions.length?(this.inputs.push(e),e.watchValidity(()=>this.updateState()),e):e},d.prototype.observeConditionalBlocks=function(){if(!this.isLast())for(const t of this.node.querySelectorAll("[data-jfb-conditional]")){if(!this.isNodeBelongThis(t))continue;const e=n(t,this.state.getRoot());for(const t of e.list.getConditions())if(t instanceof s){e.page=this,this.canSwitch.watch(()=>e.list.onChangeRelated());break}}},d.prototype.onShow=function(){this.node.classList.remove("jet-form-builder-page--hidden"),this.initialObserveState||(this.initialObserveState=!0,this.updateStateAsync().then(()=>{}).catch(()=>{}))},d.prototype.onHide=function(){this.node.classList.add("jet-form-builder-page--hidden")},d.prototype.updateState=function(){for(const t of this.getInputs())if(!t.reporting.validityState.current&&null!==t.reporting.validityState.current)return void(this.canSwitch.current=!1);this.canSwitch.current=!0},d.prototype.updateStateAsync=async function(t=!0){try{await o(this.getInputs(),t),this.canSwitch.current=!0}catch(t){this.canSwitch.current=!1}},d.prototype.addButtonsListeners=function(){const t=this.node.querySelectorAll(".jet-form-builder__next-page, .jet-form-builder__prev-page");for(const e of t){if(!this.isNodeBelongThis(e))continue;const t=e.classList.contains("jet-form-builder__prev-page");e.addEventListener("click",()=>this.changePage(t))}},d.prototype.changePage=async function(t){t?this.state.index.current=this.index-1:this.getLockState().current||(await this.updateStateAsync(!1),this.canSwitch.current?this.state.index.current=this.index+1:this.autoFocus&&a(this.getInputs()))},d.prototype.isNodeBelongThis=function(t){const e=t.closest(".jet-form-builder-page");return!!e&&e.isEqualNode(this.node)},d.prototype.getInputs=function(){return c(this.inputs)},d.prototype.getLockState=function(){var t;const e=this.state.getRoot();return(null!==(t=e?.parent?.root?.form)&&void 0!==t?t:e.form).lockState},d.prototype.isLast=function(){return this.state.isLastPage(this)},d.prototype.isFirst=function(){return this.state.isFirstPage(this)},d.prototype.handleInputEnter=function(t){t?.enterKey?.addFilter(()=>{const e=t.root.form;return e?!0===e.canTriggerEnterSubmit&&this.changePage().then(()=>{}).catch(()=>{}):this.changePage().then(()=>{}).catch(()=>{}),!1})},d.prototype.getOffsetTop=function(){return r(this.node)-this.offset},d.prototype.updateOffsetByProgress=function(){this.state?.progress?.node&&(this.offset+=+this.state.progress.node.clientHeight)};const l=d,p=function(t,e){this.node=t,this.state=e,this.state.index.watch(()=>this.updateItems()),this.updateItems=function(){const{current:t}=this.state.index;for(const e of this.node.children){const s=+e.dataset.page;snew l(t,this)),this.elements.forEach(t=>t.observe()),this.elements.forEach(t=>t.observeConditionalBlocks());const{submitter:e}=this.getRoot().getSubmit();e.hasOwnProperty("status")&&e.watchReset(()=>{this.index.current=1})},this.onChangeIndex=function(){for(const t of this.getPages())t.isShow.current=t.index===this.index.current;window?.jQuery(document)?.trigger("jet-form-builder/switch-page")},this.getCurrentPage=function(){for(const t of this.getPages())if(t.isShow.current)return t;return!1},this.getPages=function(){return this.elements},this.getScopeNode=function(){var t;return null!==(t=this.block?.node)&&void 0!==t?t:this.root.rootNode},this.getRoot=function(){var t;return null!==(t=this.block?.root)&&void 0!==t?t:this.root},this.isLastPage=function(t){return this.elements.at(-1)===t},this.isFirstPage=function(t){return this.elements[0]===t},this.onReady=function(){m("jet.fb.multistep.init",this)}};function S(t){const e=new b;e.setScope(t);const s=[],i=e.getScopeNode();for(const t of i.querySelectorAll(".jet-form-builder-page"))y(t,i)&&s.push(t);return s.length?(e.setProgress(),e.setPages(s),e):e}function y(t,e){const s=t.parentElement.closest(".jet-form-builder__conditional");return e.classList.contains("jet-form-builder__conditional")?e.isEqualNode(s):null===s}const{addAction:v,addFilter:w}=JetPlugins.hooks,{getScrollParent:P}=JetFormBuilderFunctions;v("jet.fb.observe.after","jet-form-builder/multi-step",function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())},15),v("jet.fb.conditional.init","jet-form-builder/multi-step",function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())}),w("jet.fb.conditional.types","jet-form-builder/multi-step",function(t){return[s,...t]}),v("jet.fb.multistep.init","jet-form-builder/multi-step/autoscroll",function(t){window?.JetFormBuilderSettings?.scroll_on_next&&t.index.watch(()=>{const e=t.getCurrentPage(),s=P(e.node),i=e.getOffsetTop();s?.scrollTo?.({top:i,behavior:"smooth"})})})})(); \ No newline at end of file diff --git a/assets/src/frontend/multi.step/functions.js b/assets/src/frontend/multi.step/functions.js index 17019ebe1..5e3cfba2f 100644 --- a/assets/src/frontend/multi.step/functions.js +++ b/assets/src/frontend/multi.step/functions.js @@ -5,12 +5,13 @@ function createMultiStep( rootOrBlock ) { multistep.setScope( rootOrBlock ); const pages = []; + const scopeNode = multistep.getScopeNode(); - for ( const child of multistep.getScopeNode().childNodes ) { - if ( !child?.classList?.contains( 'jet-form-builder-page' ) ) { + for ( const page of scopeNode.querySelectorAll( '.jet-form-builder-page' ) ) { + if ( !isPageBelongScope( page, scopeNode ) ) { continue; } - pages.push( child ); + pages.push( page ); } if ( !pages.length ) { @@ -23,4 +24,16 @@ function createMultiStep( rootOrBlock ) { return multistep; } -export { createMultiStep }; \ No newline at end of file +function isPageBelongScope( page, scopeNode ) { + const parentConditional = page.parentElement.closest( + '.jet-form-builder__conditional', + ); + + if ( scopeNode.classList.contains( 'jet-form-builder__conditional' ) ) { + return scopeNode.isEqualNode( parentConditional ); + } + + return null === parentConditional; +} + +export { createMultiStep }; From c4221732801323e600590d112a97d4bca42507f8 Mon Sep 17 00:00:00 2001 From: ObitoTM Date: Fri, 29 May 2026 16:27:47 +0300 Subject: [PATCH 2/3] Revert "FIX: multistep page detection with StyleManager wrappers https://github.com/Crocoblock/issues-tracker/issues/19698" This reverts commit 05b61f5889abf19d9f524ca317d1f00005f3e40f. --- assets/build/frontend/multi.step.asset.php | 2 +- assets/build/frontend/multi.step.js | 2 +- assets/src/frontend/multi.step/functions.js | 21 ++++----------------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/assets/build/frontend/multi.step.asset.php b/assets/build/frontend/multi.step.asset.php index 5c6eae6e3..d7085aae5 100644 --- a/assets/build/frontend/multi.step.asset.php +++ b/assets/build/frontend/multi.step.asset.php @@ -1 +1 @@ - array(), 'version' => '85741bd15e67647ddae0'); + array(), 'version' => '36b86101cee675ffda25'); diff --git a/assets/build/frontend/multi.step.js b/assets/build/frontend/multi.step.js index 65f74cc47..ad8d68bf1 100644 --- a/assets/build/frontend/multi.step.js +++ b/assets/build/frontend/multi.step.js @@ -1 +1 @@ -(()=>{"use strict";const{ConditionItem:t}=JetFormBuilderAbstract;function e(){t.call(this),this.isSupported=function(t){return!!t?.page_state?.length},this.setOptions=function({page_state:t}){this.pageState=t},this.isPassed=function(){const t=this.list?.block?.page?.canSwitch?.current;return"active"===this.pageState&&!t}}e.prototype=Object.create(t.prototype);const s=e,{ReactiveVar:i,createConditionalBlock:n}=JetFormBuilderAbstract,{validateInputs:o,getOffsetTop:r,focusOnInvalidInput:a,populateInputs:c}=JetFormBuilderFunctions,{addAction:h,doAction:u}=JetPlugins.hooks;function d(t,e){this.node=t,this.index=+t.dataset.page,this.offset=+t.dataset.pageOffset,this.state=e,this.inputs=[],this.canSwitch=new i(null),this.isShow=new i(1===this.index),this.autoFocus=window.JetFormBuilderSettings?.auto_focus,this.initialObserveState=!1}d.prototype.observe=function(){this.isLast()||this.observeInputs(),this.canSwitch.make(),this.isShow.make(),this.isShow.watch(()=>{this.isShow.current?this.onShow():this.onHide()}),this.addButtonsListeners(),this.isFirst()&&(this.initialObserveState=!0,this.updateStateAsync().then(()=>{}).catch(()=>{})),this.updateOffsetByProgress(),h("jet.fb.observe.input.manual","jet-form-builder/page-state",t=>this.observeInput(t.nodes[0])),u("jet.fb.multistep.page.init",this)},d.prototype.observeInputs=function(){for(const t of this.node.querySelectorAll("[data-jfb-sync]")){const e=this.observeInput(t);e&&u("jet.fb.multistep.page.observed.input",e,this)}},d.prototype.observeInput=function(t){if(!this.isNodeBelongThis(t)||!t.hasOwnProperty("jfbSync")||t.jfbSync.hasParent())return!1;const e=t.jfbSync;return this.handleInputEnter(e),e.loading.watch(()=>{e.loading.current?this.canSwitch.current=!1:this.updateState()}),e.reporting.restrictions.length?(this.inputs.push(e),e.watchValidity(()=>this.updateState()),e):e},d.prototype.observeConditionalBlocks=function(){if(!this.isLast())for(const t of this.node.querySelectorAll("[data-jfb-conditional]")){if(!this.isNodeBelongThis(t))continue;const e=n(t,this.state.getRoot());for(const t of e.list.getConditions())if(t instanceof s){e.page=this,this.canSwitch.watch(()=>e.list.onChangeRelated());break}}},d.prototype.onShow=function(){this.node.classList.remove("jet-form-builder-page--hidden"),this.initialObserveState||(this.initialObserveState=!0,this.updateStateAsync().then(()=>{}).catch(()=>{}))},d.prototype.onHide=function(){this.node.classList.add("jet-form-builder-page--hidden")},d.prototype.updateState=function(){for(const t of this.getInputs())if(!t.reporting.validityState.current&&null!==t.reporting.validityState.current)return void(this.canSwitch.current=!1);this.canSwitch.current=!0},d.prototype.updateStateAsync=async function(t=!0){try{await o(this.getInputs(),t),this.canSwitch.current=!0}catch(t){this.canSwitch.current=!1}},d.prototype.addButtonsListeners=function(){const t=this.node.querySelectorAll(".jet-form-builder__next-page, .jet-form-builder__prev-page");for(const e of t){if(!this.isNodeBelongThis(e))continue;const t=e.classList.contains("jet-form-builder__prev-page");e.addEventListener("click",()=>this.changePage(t))}},d.prototype.changePage=async function(t){t?this.state.index.current=this.index-1:this.getLockState().current||(await this.updateStateAsync(!1),this.canSwitch.current?this.state.index.current=this.index+1:this.autoFocus&&a(this.getInputs()))},d.prototype.isNodeBelongThis=function(t){const e=t.closest(".jet-form-builder-page");return!!e&&e.isEqualNode(this.node)},d.prototype.getInputs=function(){return c(this.inputs)},d.prototype.getLockState=function(){var t;const e=this.state.getRoot();return(null!==(t=e?.parent?.root?.form)&&void 0!==t?t:e.form).lockState},d.prototype.isLast=function(){return this.state.isLastPage(this)},d.prototype.isFirst=function(){return this.state.isFirstPage(this)},d.prototype.handleInputEnter=function(t){t?.enterKey?.addFilter(()=>{const e=t.root.form;return e?!0===e.canTriggerEnterSubmit&&this.changePage().then(()=>{}).catch(()=>{}):this.changePage().then(()=>{}).catch(()=>{}),!1})},d.prototype.getOffsetTop=function(){return r(this.node)-this.offset},d.prototype.updateOffsetByProgress=function(){this.state?.progress?.node&&(this.offset+=+this.state.progress.node.clientHeight)};const l=d,p=function(t,e){this.node=t,this.state=e,this.state.index.watch(()=>this.updateItems()),this.updateItems=function(){const{current:t}=this.state.index;for(const e of this.node.children){const s=+e.dataset.page;snew l(t,this)),this.elements.forEach(t=>t.observe()),this.elements.forEach(t=>t.observeConditionalBlocks());const{submitter:e}=this.getRoot().getSubmit();e.hasOwnProperty("status")&&e.watchReset(()=>{this.index.current=1})},this.onChangeIndex=function(){for(const t of this.getPages())t.isShow.current=t.index===this.index.current;window?.jQuery(document)?.trigger("jet-form-builder/switch-page")},this.getCurrentPage=function(){for(const t of this.getPages())if(t.isShow.current)return t;return!1},this.getPages=function(){return this.elements},this.getScopeNode=function(){var t;return null!==(t=this.block?.node)&&void 0!==t?t:this.root.rootNode},this.getRoot=function(){var t;return null!==(t=this.block?.root)&&void 0!==t?t:this.root},this.isLastPage=function(t){return this.elements.at(-1)===t},this.isFirstPage=function(t){return this.elements[0]===t},this.onReady=function(){m("jet.fb.multistep.init",this)}};function S(t){const e=new b;e.setScope(t);const s=[],i=e.getScopeNode();for(const t of i.querySelectorAll(".jet-form-builder-page"))y(t,i)&&s.push(t);return s.length?(e.setProgress(),e.setPages(s),e):e}function y(t,e){const s=t.parentElement.closest(".jet-form-builder__conditional");return e.classList.contains("jet-form-builder__conditional")?e.isEqualNode(s):null===s}const{addAction:v,addFilter:w}=JetPlugins.hooks,{getScrollParent:P}=JetFormBuilderFunctions;v("jet.fb.observe.after","jet-form-builder/multi-step",function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())},15),v("jet.fb.conditional.init","jet-form-builder/multi-step",function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())}),w("jet.fb.conditional.types","jet-form-builder/multi-step",function(t){return[s,...t]}),v("jet.fb.multistep.init","jet-form-builder/multi-step/autoscroll",function(t){window?.JetFormBuilderSettings?.scroll_on_next&&t.index.watch(()=>{const e=t.getCurrentPage(),s=P(e.node),i=e.getOffsetTop();s?.scrollTo?.({top:i,behavior:"smooth"})})})})(); \ No newline at end of file +(()=>{"use strict";const{ConditionItem:t}=JetFormBuilderAbstract;function e(){t.call(this),this.isSupported=function(t){return!!t?.page_state?.length},this.setOptions=function({page_state:t}){this.pageState=t},this.isPassed=function(){const t=this.list?.block?.page?.canSwitch?.current;return"active"===this.pageState&&!t}}e.prototype=Object.create(t.prototype);const s=e,{ReactiveVar:i,createConditionalBlock:n}=JetFormBuilderAbstract,{validateInputs:o,getOffsetTop:r,focusOnInvalidInput:a,populateInputs:c}=JetFormBuilderFunctions,{addAction:h,doAction:u}=JetPlugins.hooks;function d(t,e){this.node=t,this.index=+t.dataset.page,this.offset=+t.dataset.pageOffset,this.state=e,this.inputs=[],this.canSwitch=new i(null),this.isShow=new i(1===this.index),this.autoFocus=window.JetFormBuilderSettings?.auto_focus,this.initialObserveState=!1}d.prototype.observe=function(){this.isLast()||this.observeInputs(),this.canSwitch.make(),this.isShow.make(),this.isShow.watch((()=>{this.isShow.current?this.onShow():this.onHide()})),this.addButtonsListeners(),this.isFirst()&&(this.initialObserveState=!0,this.updateStateAsync().then((()=>{})).catch((()=>{}))),this.updateOffsetByProgress(),h("jet.fb.observe.input.manual","jet-form-builder/page-state",(t=>this.observeInput(t.nodes[0]))),u("jet.fb.multistep.page.init",this)},d.prototype.observeInputs=function(){for(const t of this.node.querySelectorAll("[data-jfb-sync]")){const e=this.observeInput(t);e&&u("jet.fb.multistep.page.observed.input",e,this)}},d.prototype.observeInput=function(t){if(!this.isNodeBelongThis(t)||!t.hasOwnProperty("jfbSync")||t.jfbSync.hasParent())return!1;const e=t.jfbSync;return this.handleInputEnter(e),e.loading.watch((()=>{e.loading.current?this.canSwitch.current=!1:this.updateState()})),e.reporting.restrictions.length?(this.inputs.push(e),e.watchValidity((()=>this.updateState())),e):e},d.prototype.observeConditionalBlocks=function(){if(!this.isLast())for(const t of this.node.querySelectorAll("[data-jfb-conditional]")){if(!this.isNodeBelongThis(t))continue;const e=n(t,this.state.getRoot());for(const t of e.list.getConditions())if(t instanceof s){e.page=this,this.canSwitch.watch((()=>e.list.onChangeRelated()));break}}},d.prototype.onShow=function(){this.node.classList.remove("jet-form-builder-page--hidden"),this.initialObserveState||(this.initialObserveState=!0,this.updateStateAsync().then((()=>{})).catch((()=>{})))},d.prototype.onHide=function(){this.node.classList.add("jet-form-builder-page--hidden")},d.prototype.updateState=function(){for(const t of this.getInputs())if(!t.reporting.validityState.current&&null!==t.reporting.validityState.current)return void(this.canSwitch.current=!1);this.canSwitch.current=!0},d.prototype.updateStateAsync=async function(t=!0){try{await o(this.getInputs(),t),this.canSwitch.current=!0}catch(t){this.canSwitch.current=!1}},d.prototype.addButtonsListeners=function(){const t=this.node.querySelectorAll(".jet-form-builder__next-page, .jet-form-builder__prev-page");for(const e of t){if(!this.isNodeBelongThis(e))continue;const t=e.classList.contains("jet-form-builder__prev-page");e.addEventListener("click",(()=>this.changePage(t)))}},d.prototype.changePage=async function(t){t?this.state.index.current=this.index-1:this.getLockState().current||(await this.updateStateAsync(!1),this.canSwitch.current?this.state.index.current=this.index+1:this.autoFocus&&a(this.getInputs()))},d.prototype.isNodeBelongThis=function(t){const e=t.closest(".jet-form-builder-page");return!!e&&e.isEqualNode(this.node)},d.prototype.getInputs=function(){return c(this.inputs)},d.prototype.getLockState=function(){var t;const e=this.state.getRoot();return(null!==(t=e?.parent?.root?.form)&&void 0!==t?t:e.form).lockState},d.prototype.isLast=function(){return this.state.isLastPage(this)},d.prototype.isFirst=function(){return this.state.isFirstPage(this)},d.prototype.handleInputEnter=function(t){t?.enterKey?.addFilter((()=>{const e=t.root.form;return e?!0===e.canTriggerEnterSubmit&&this.changePage().then((()=>{})).catch((()=>{})):this.changePage().then((()=>{})).catch((()=>{})),!1}))},d.prototype.getOffsetTop=function(){return r(this.node)-this.offset},d.prototype.updateOffsetByProgress=function(){this.state?.progress?.node&&(this.offset+=+this.state.progress.node.clientHeight)};const p=d,l=function(t,e){this.node=t,this.state=e,this.state.index.watch((()=>this.updateItems())),this.updateItems=function(){const{current:t}=this.state.index;for(const e of this.node.children){const s=+e.dataset.page;snew p(t,this))),this.elements.forEach((t=>t.observe())),this.elements.forEach((t=>t.observeConditionalBlocks()));const{submitter:e}=this.getRoot().getSubmit();e.hasOwnProperty("status")&&e.watchReset((()=>{this.index.current=1}))},this.onChangeIndex=function(){for(const t of this.getPages())t.isShow.current=t.index===this.index.current;window?.jQuery(document)?.trigger("jet-form-builder/switch-page")},this.getCurrentPage=function(){for(const t of this.getPages())if(t.isShow.current)return t;return!1},this.getPages=function(){return this.elements},this.getScopeNode=function(){var t;return null!==(t=this.block?.node)&&void 0!==t?t:this.root.rootNode},this.getRoot=function(){var t;return null!==(t=this.block?.root)&&void 0!==t?t:this.root},this.isLastPage=function(t){return this.elements.at(-1)===t},this.isFirstPage=function(t){return this.elements[0]===t},this.onReady=function(){m("jet.fb.multistep.init",this)}};function S(t){const e=new b;e.setScope(t);const s=[];for(const t of e.getScopeNode().childNodes)t?.classList?.contains("jet-form-builder-page")&&s.push(t);return s.length?(e.setProgress(),e.setPages(s),e):e}const{addAction:y,addFilter:v}=JetPlugins.hooks,{getScrollParent:w}=JetFormBuilderFunctions;y("jet.fb.observe.after","jet-form-builder/multi-step",(function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())}),15),y("jet.fb.conditional.init","jet-form-builder/multi-step",(function(t){const e=S(t);e.getPages()?.length&&(t.multistep=e,e.onReady())})),v("jet.fb.conditional.types","jet-form-builder/multi-step",(function(t){return[s,...t]})),y("jet.fb.multistep.init","jet-form-builder/multi-step/autoscroll",(function(t){window?.JetFormBuilderSettings?.scroll_on_next&&t.index.watch((()=>{const e=t.getCurrentPage(),s=w(e.node),i=e.getOffsetTop();s?.scrollTo?.({top:i,behavior:"smooth"})}))}))})(); \ No newline at end of file diff --git a/assets/src/frontend/multi.step/functions.js b/assets/src/frontend/multi.step/functions.js index 5e3cfba2f..17019ebe1 100644 --- a/assets/src/frontend/multi.step/functions.js +++ b/assets/src/frontend/multi.step/functions.js @@ -5,13 +5,12 @@ function createMultiStep( rootOrBlock ) { multistep.setScope( rootOrBlock ); const pages = []; - const scopeNode = multistep.getScopeNode(); - for ( const page of scopeNode.querySelectorAll( '.jet-form-builder-page' ) ) { - if ( !isPageBelongScope( page, scopeNode ) ) { + for ( const child of multistep.getScopeNode().childNodes ) { + if ( !child?.classList?.contains( 'jet-form-builder-page' ) ) { continue; } - pages.push( page ); + pages.push( child ); } if ( !pages.length ) { @@ -24,16 +23,4 @@ function createMultiStep( rootOrBlock ) { return multistep; } -function isPageBelongScope( page, scopeNode ) { - const parentConditional = page.parentElement.closest( - '.jet-form-builder__conditional', - ); - - if ( scopeNode.classList.contains( 'jet-form-builder__conditional' ) ) { - return scopeNode.isEqualNode( parentConditional ); - } - - return null === parentConditional; -} - -export { createMultiStep }; +export { createMultiStep }; \ No newline at end of file From 82ab2bfdfd7830761039c4be234e865157ad30bc Mon Sep 17 00:00:00 2001 From: ObitoTM Date: Fri, 29 May 2026 16:30:22 +0300 Subject: [PATCH 3/3] FIX: Prevent StyleManager wrapping form break blocks https://github.com/Crocoblock/issues-tracker/issues/19698 --- compatibility/jet-style-manager/jet-style-manager.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compatibility/jet-style-manager/jet-style-manager.php b/compatibility/jet-style-manager/jet-style-manager.php index 7eb3ae18d..22dd6be60 100644 --- a/compatibility/jet-style-manager/jet-style-manager.php +++ b/compatibility/jet-style-manager/jet-style-manager.php @@ -41,10 +41,14 @@ class_exists( 'JET_SM\Gutenberg\Controls_Manager' ) public function init_hooks() { add_action( 'init', array( $this, 'register_block_styles' ), 9 ); + add_filter( 'jet_style_manager/gutenberg/prevent_block_wrap/jet-forms/form-break-start', '__return_true' ); + add_filter( 'jet_style_manager/gutenberg/prevent_block_wrap/jet-forms/form-break-field', '__return_true' ); } public function remove_hooks() { - add_action( 'init', array( $this, 'register_block_styles' ), 9 ); + remove_action( 'init', array( $this, 'register_block_styles' ), 9 ); + remove_filter( 'jet_style_manager/gutenberg/prevent_block_wrap/jet-forms/form-break-start', '__return_true' ); + remove_filter( 'jet_style_manager/gutenberg/prevent_block_wrap/jet-forms/form-break-field', '__return_true' ); }