PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.7
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.7
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / scripts / elementor / elementorWidget.ts

elementorWidget.ts in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.0.7, at scripts/elementor/elementorWidget.ts

47 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 export default function elementorWidget(
2 elementor: any,
3 options: any,
4 callback: Function,
5 done = () => {}
6 ) {
7 return elementor.modules.controls.BaseData.extend({
8 onReady() {
9 const self = this;
10 const controlContainer = this.ui.contentEditable.prevObject[0].querySelector(
11 options.controlSelector
12 );
13 let widgetContainer = this.options.element.$el[0].querySelector(
14 options.containerSelector
15 );
16 if (widgetContainer) {
17 callback(controlContainer, widgetContainer, (args: any) =>
18 self.setValue(args)
19 );
20 } else {
21 //@ts-expect-error global
22 window.elementorFrontend.hooks.addAction(
23 `frontend/element_ready/${options.widgetName}.default`,
24 (element: HTMLElement[]) => {
25 widgetContainer = element[0].querySelector(
26 options.containerSelector
27 );
28 callback(controlContainer, widgetContainer, (args: any) =>
29 self.setValue(args)
30 );
31 }
32 );
33 }
34 },
35 saveValue(props: any) {
36 this.setValue(props);
37 },
38 onBeforeDestroy() {
39 //@ts-expect-error global
40 window.elementorFrontend.hooks.removeAction(
41 `frontend/element_ready/${options.widgetName}.default`
42 );
43 done();
44 },
45 });
46 }
47