elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.58k stars 1.42k forks source link

Redirect to a Different Section in Preview Reload (JS) #8997

Open riadcitaku opened 5 years ago

riadcitaku commented 5 years ago

Prerequisites

I have created some extra sections to the page settings via the document settings actions on Elementor, in some options I need to reload the preview and I am doing it via the method reloadPreview(), right after doing that I am using $e.route for >2.7.0 and .setPage for <2.7.0, everything is fine except when the preview is reloaded, I want to redirect the user to the custom section not in the general settings.

if ($e) {
  // E >= 2.7.0
  $e.route('panel/page-settings/settings');
} else {
  // E < 2.7.0
  elementor.getPanelView().setPage('page_settings');
}

Describe the solution you'd like

The ideal solution would be.

$e.route('panel/page-settings/settings/header_settings');

or

$e.route('panel/page-settings/settings', {
  section: 'header_settings'
});
mauryaratan commented 5 years ago

That'd be really helpful.

For now, I'm just getting around with this:

elementor.getPanelView().getCurrentPageView().activateSection('section')._renderChildren()
riadcitaku commented 5 years ago

Unfortunately, this is not working I have tested it on the current version 2.7.1 & 2.6.8.

elementor.getPanelView(...).getCurrentPageView(...).activateSection is not a function

mauryaratan commented 5 years ago

Weird. I've it working fine here, tested on 2.7.1:

https://github.com/mauryaratan/analogwp-templates/blob/038fd1590c860d4990f5b883f5e4024da9a15ab9/inc/elementor/js/ang-action.js#L30