@elementor/editor-app-bar 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.14.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.13.0...@elementor/editor-app-bar@0.14.0) (2024-06-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * internal create a top bar data events collection working with mixpanel [ED-14684] ([#184](https://github.com/elementor/elementor-packages/issues/184)) ([9d25189](https://github.com/elementor/elementor-packages/commit/9d25189173a65d535347f9b2f32d377bcffb6c52))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.13.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.12.0...@elementor/editor-app-bar@0.13.0) (2024-06-02)
18
+
19
+
20
+ ### Features
21
+
22
+ * **editor-app-bar:** adjust the UI of the "View Page" link in the "Top Bar" [ED-14942] ([#183](https://github.com/elementor/elementor-packages/issues/183)) ([60d576a](https://github.com/elementor/elementor-packages/commit/60d576ad9f5afbf56984e363f2f9973c84e1f798))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.12.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.11.0...@elementor/editor-app-bar@0.12.0) (2024-05-09)
7
29
 
8
30
 
package/dist/index.js CHANGED
@@ -83,7 +83,22 @@ function SettingsButton() {
83
83
  value: "document-settings",
84
84
  selected: isActive,
85
85
  disabled: isBlocked,
86
- onChange: () => (0, import_editor_v1_adapters2.__privateOpenRoute)("panel/page-settings/settings"),
86
+ onChange: () => {
87
+ const extendedWindow = window;
88
+ const config = extendedWindow?.elementor?.editorEvents?.config;
89
+ if (config) {
90
+ extendedWindow.elementor.editorEvents.dispatchEvent(
91
+ config.names.topBar.documentSettings,
92
+ {
93
+ location: config.locations.topBar,
94
+ secondaryLocation: config.secondaryLocations["document-settings"],
95
+ trigger: config.triggers.click,
96
+ element: config.elements.buttonIcon
97
+ }
98
+ );
99
+ }
100
+ (0, import_editor_v1_adapters2.__privateOpenRoute)("panel/page-settings/settings");
101
+ },
87
102
  "aria-label": title,
88
103
  size: "small",
89
104
  sx: {
@@ -139,10 +154,27 @@ function useActionProps() {
139
154
  return {
140
155
  icon: import_icons2.EyeIcon,
141
156
  title: (0, import_i18n2.__)("Preview Changes", "elementor"),
142
- onClick: () => document2 && (0, import_editor_v1_adapters3.__privateRunCommand)("editor/documents/preview", {
143
- id: document2.id,
144
- force: true
145
- })
157
+ onClick: () => {
158
+ const extendedWindow = window;
159
+ const config = extendedWindow?.elementor?.editorEvents?.config;
160
+ if (config) {
161
+ extendedWindow.elementor.editorEvents.dispatchEvent(
162
+ config.names.topBar.previewPage,
163
+ {
164
+ location: config.locations.topBar,
165
+ secondaryLocation: config.secondaryLocations["preview-page"],
166
+ trigger: config.triggers.click,
167
+ element: config.elements.buttonIcon
168
+ }
169
+ );
170
+ }
171
+ if (document2) {
172
+ (0, import_editor_v1_adapters3.__privateRunCommand)("editor/documents/preview", {
173
+ id: document2.id,
174
+ force: true
175
+ });
176
+ }
177
+ }
146
178
  };
147
179
  }
148
180
 
@@ -213,12 +245,14 @@ var import_ui2 = require("@elementor/ui");
213
245
  var import_editor_app_bar_ui4 = require("@elementor/editor-app-bar-ui");
214
246
  var { useMenuItems } = documentOptionsMenu;
215
247
  var StyledPopoverMenu = (0, import_ui2.styled)(import_editor_app_bar_ui4.__privatePopoverMenu)`
216
- & > .MuiPopover-paper > .MuiList-root > .MuiDivider-root {
217
- &:only-child, /* A divider is being rendered lonely */
218
- &:last-child, /* The last group renders empty but renders a divider */
219
- & + .MuiDivider-root /* Multiple dividers due to multiple empty groups */ {
248
+ & > .MuiPopover-paper > .MuiList-root {
249
+ & > .MuiDivider-root {
220
250
  display: none;
221
251
  }
252
+
253
+ & > *:not(.MuiDivider-root):not(:last-of-type) + .MuiDivider-root {
254
+ display: block;
255
+ }
222
256
  }
223
257
  `;
224
258
  function PrimaryActionMenu(props) {
@@ -244,8 +278,11 @@ function PrimaryActionMenu(props) {
244
278
  index > 0 && /* @__PURE__ */ React2.createElement(import_ui2.Divider, { key: `${id}-divider` }),
245
279
  /* @__PURE__ */ React2.createElement(MenuItem, { key: id })
246
280
  ]),
247
- defaultActions.length > 0 && /* @__PURE__ */ React2.createElement(import_ui2.Divider, null),
248
- defaultActions.map(({ MenuItem, id }) => /* @__PURE__ */ React2.createElement(MenuItem, { key: id }))
281
+ saveActions.length > 0 && defaultActions.length > 0 && /* @__PURE__ */ React2.createElement(import_ui2.Divider, null),
282
+ defaultActions.map(({ MenuItem, id }, index) => [
283
+ index > 0 && /* @__PURE__ */ React2.createElement(import_ui2.Divider, { key: `${id}-divider` }),
284
+ /* @__PURE__ */ React2.createElement(MenuItem, { key: id })
285
+ ])
249
286
  );
250
287
  }
251
288
 
@@ -271,7 +308,24 @@ function PrimaryAction() {
271
308
  return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(import_ui3.ButtonGroup, { size: "large", variant: "contained" }, /* @__PURE__ */ React3.createElement(
272
309
  import_ui3.Button,
273
310
  {
274
- onClick: () => !document2.isSaving && save(),
311
+ onClick: () => {
312
+ const extendedWindow = window;
313
+ const config = extendedWindow?.elementor?.editorEvents?.config;
314
+ if (config) {
315
+ extendedWindow.elementor.editorEvents.dispatchEvent(
316
+ config.names.topBar.publishButton,
317
+ {
318
+ location: config.locations.topBar,
319
+ secondaryLocation: config.secondaryLocations["publish-button"],
320
+ trigger: config.triggers.click,
321
+ element: config.elements.mainCta
322
+ }
323
+ );
324
+ }
325
+ if (!document2.isSaving) {
326
+ save();
327
+ }
328
+ },
275
329
  sx: {
276
330
  height: "100%",
277
331
  borderRadius: 0,
@@ -345,29 +399,24 @@ function init3() {
345
399
  group: "save",
346
400
  id: "document-save-draft",
347
401
  priority: 10,
348
- // Before save as template.
349
402
  useProps: useDocumentSaveDraftProps
350
403
  });
351
404
  documentOptionsMenu.registerAction({
352
405
  group: "save",
353
406
  id: "document-save-as-template",
354
407
  priority: 20,
355
- // After save draft.
356
408
  useProps: useDocumentSaveTemplateProps
357
409
  });
358
410
  documentOptionsMenu.registerAction({
359
- group: "save",
360
- id: "document-view-page",
361
- priority: 30,
362
- // After save draft.
363
- useProps: useDocumentViewPageProps
364
- });
365
- documentOptionsMenu.registerAction({
366
- group: "save",
367
411
  id: "document-copy-and-share",
368
- priority: 40,
412
+ priority: 10,
369
413
  useProps: useDocumentCopyAndShareProps
370
414
  });
415
+ documentOptionsMenu.registerAction({
416
+ id: "document-view-page",
417
+ priority: 50,
418
+ useProps: useDocumentViewPageProps
419
+ });
371
420
  }
372
421
 
373
422
  // src/extensions/elements/sync/sync-panel-title.ts
@@ -415,7 +464,22 @@ function useActionProps2() {
415
464
  return {
416
465
  title: (0, import_i18n9.__)("Add Element", "elementor"),
417
466
  icon: import_icons8.PlusIcon,
418
- onClick: () => (0, import_editor_v1_adapters7.__privateOpenRoute)("panel/elements/categories"),
467
+ onClick: () => {
468
+ const extendedWindow = window;
469
+ const config = extendedWindow?.elementor?.editorEvents?.config;
470
+ if (config) {
471
+ extendedWindow.elementor.editorEvents.dispatchEvent(
472
+ config.names.topBar.widgetPanel,
473
+ {
474
+ location: config.locations.topBar,
475
+ secondaryLocation: config.secondaryLocations["widget-panel"],
476
+ trigger: config.triggers.toggleClick,
477
+ element: config.elements.buttonIcon
478
+ }
479
+ );
480
+ }
481
+ (0, import_editor_v1_adapters7.__privateOpenRoute)("panel/elements/categories");
482
+ },
419
483
  selected: isActive,
420
484
  disabled: isBlocked
421
485
  };
@@ -446,7 +510,22 @@ function useActionProps3() {
446
510
  return {
447
511
  title: (0, import_i18n10.__)("Finder", "elementor"),
448
512
  icon: import_icons9.SearchIcon,
449
- onClick: () => (0, import_editor_v1_adapters8.__privateRunCommand)("finder/toggle"),
513
+ onClick: () => {
514
+ const extendedWindow = window;
515
+ const config = extendedWindow?.elementor?.editorEvents?.config;
516
+ if (config) {
517
+ extendedWindow.elementor.editorEvents.dispatchEvent(
518
+ config.names.topBar.finder,
519
+ {
520
+ location: config.locations.topBar,
521
+ secondaryLocation: config.secondaryLocations.finder,
522
+ trigger: config.triggers.toggleClick,
523
+ element: config.elements.buttonIcon
524
+ }
525
+ );
526
+ }
527
+ (0, import_editor_v1_adapters8.__privateRunCommand)("finder/toggle");
528
+ },
450
529
  disabled: isBlocked
451
530
  };
452
531
  }
@@ -475,7 +554,22 @@ function init6() {
475
554
  title: (0, import_i18n11.__)("Help", "elementor"),
476
555
  href: "https://go.elementor.com/editor-top-bar-learn/",
477
556
  icon: import_icons10.HelpIcon,
478
- target: "_blank"
557
+ target: "_blank",
558
+ onClick: () => {
559
+ const extendedWindow = window;
560
+ const config = extendedWindow?.elementor?.editorEvents?.config;
561
+ if (config) {
562
+ extendedWindow.elementor.editorEvents.dispatchEvent(
563
+ config.names.topBar.help,
564
+ {
565
+ location: config.locations.topBar,
566
+ secondaryLocation: config.secondaryLocations.help,
567
+ trigger: config.triggers.click,
568
+ element: config.elements.buttonIcon
569
+ }
570
+ );
571
+ }
572
+ }
479
573
  };
480
574
  }
481
575
  });
@@ -493,7 +587,22 @@ function useActionProps4() {
493
587
  return {
494
588
  title: (0, import_i18n12.__)("History", "elementor"),
495
589
  icon: import_icons11.HistoryIcon,
496
- onClick: () => (0, import_editor_v1_adapters9.__privateOpenRoute)("panel/history/actions"),
590
+ onClick: () => {
591
+ const extendedWindow = window;
592
+ const config = extendedWindow?.elementor?.editorEvents?.config;
593
+ if (config) {
594
+ extendedWindow.elementor.editorEvents.dispatchEvent(
595
+ config.names.topBar.history,
596
+ {
597
+ location: config.locations.topBar,
598
+ secondaryLocation: config.secondaryLocations.elementorLogo,
599
+ trigger: config.triggers.click,
600
+ element: config.elements.link
601
+ }
602
+ );
603
+ }
604
+ (0, import_editor_v1_adapters9.__privateOpenRoute)("panel/history/actions");
605
+ },
497
606
  selected: isActive,
498
607
  disabled: isBlocked
499
608
  };
@@ -519,7 +628,22 @@ function useActionProps5() {
519
628
  return {
520
629
  icon: import_icons12.KeyboardIcon,
521
630
  title: (0, import_i18n13.__)("Keyboard Shortcuts", "elementor"),
522
- onClick: () => (0, import_editor_v1_adapters10.__privateRunCommand)("shortcuts/open")
631
+ onClick: () => {
632
+ const extendedWindow = window;
633
+ const config = extendedWindow?.elementor?.editorEvents?.config;
634
+ if (config) {
635
+ extendedWindow.elementor.editorEvents.dispatchEvent(
636
+ config.names.topBar.keyboardShortcuts,
637
+ {
638
+ location: config.locations.topBar,
639
+ secondaryLocation: config.secondaryLocations.elementorLogo,
640
+ trigger: config.triggers.click,
641
+ element: config.elements.link
642
+ }
643
+ );
644
+ }
645
+ (0, import_editor_v1_adapters10.__privateRunCommand)("shortcuts/open");
646
+ }
523
647
  };
524
648
  }
525
649
 
@@ -606,7 +730,26 @@ function useActionProps6() {
606
730
  return {
607
731
  title: (0, import_i18n15.__)("Site Settings", "elementor"),
608
732
  icon: import_icons13.AdjustmentsHorizontalIcon,
609
- onClick: () => isActive ? (0, import_editor_v1_adapters12.__privateRunCommand)("panel/global/close") : (0, import_editor_v1_adapters12.__privateRunCommand)("panel/global/open"),
733
+ onClick: () => {
734
+ const extendedWindow = window;
735
+ const config = extendedWindow?.elementor?.editorEvents?.config;
736
+ if (config) {
737
+ extendedWindow.elementor.editorEvents.dispatchEvent(
738
+ config.names.topBar.siteSettings,
739
+ {
740
+ location: config.locations.topBar,
741
+ secondaryLocation: config.secondaryLocations.siteSettings,
742
+ trigger: config.triggers.toggleClick,
743
+ element: config.elements.buttonIcon
744
+ }
745
+ );
746
+ }
747
+ if (isActive) {
748
+ (0, import_editor_v1_adapters12.__privateRunCommand)("panel/global/close");
749
+ } else {
750
+ (0, import_editor_v1_adapters12.__privateRunCommand)("panel/global/open");
751
+ }
752
+ },
610
753
  selected: isActive,
611
754
  disabled: isBlocked
612
755
  };
@@ -637,7 +780,22 @@ function useActionProps7() {
637
780
  return {
638
781
  title: (0, import_i18n16.__)("Structure", "elementor"),
639
782
  icon: import_icons14.StructureIcon,
640
- onClick: () => (0, import_editor_v1_adapters13.__privateRunCommand)("navigator/toggle"),
783
+ onClick: () => {
784
+ const extendedWindow = window;
785
+ const config = extendedWindow?.elementor?.editorEvents?.config;
786
+ if (config) {
787
+ extendedWindow.elementor.editorEvents.dispatchEvent(
788
+ config.names.topBar.structure,
789
+ {
790
+ location: config.locations.topBar,
791
+ secondaryLocation: config.secondaryLocations.structure,
792
+ trigger: config.triggers.toggleClick,
793
+ element: config.elements.buttonIcon
794
+ }
795
+ );
796
+ }
797
+ (0, import_editor_v1_adapters13.__privateRunCommand)("navigator/toggle");
798
+ },
641
799
  selected: isActive,
642
800
  disabled: isBlocked
643
801
  };
@@ -663,7 +821,22 @@ function useActionProps8() {
663
821
  return {
664
822
  icon: import_icons15.ThemeBuilderIcon,
665
823
  title: (0, import_i18n17.__)("Theme Builder", "elementor"),
666
- onClick: () => (0, import_editor_v1_adapters14.__privateRunCommand)("app/open")
824
+ onClick: () => {
825
+ const extendedWindow = window;
826
+ const config = extendedWindow?.elementor?.editorEvents?.config;
827
+ if (config) {
828
+ extendedWindow.elementor.editorEvents.dispatchEvent(
829
+ config.names.topBar.themeBuilder,
830
+ {
831
+ location: config.locations.topBar,
832
+ secondaryLocation: config.secondaryLocations.elementorLogo,
833
+ trigger: config.triggers.click,
834
+ element: config.elements.link
835
+ }
836
+ );
837
+ }
838
+ (0, import_editor_v1_adapters14.__privateRunCommand)("app/open");
839
+ }
667
840
  };
668
841
  }
669
842
 
@@ -687,7 +860,22 @@ function useActionProps9() {
687
860
  return {
688
861
  icon: import_icons16.ToggleRightIcon,
689
862
  title: (0, import_i18n18.__)("User Preferences", "elementor"),
690
- onClick: () => (0, import_editor_v1_adapters15.__privateOpenRoute)("panel/editor-preferences"),
863
+ onClick: () => {
864
+ const extendedWindow = window;
865
+ const config = extendedWindow?.elementor?.editorEvents?.config;
866
+ if (config) {
867
+ extendedWindow.elementor.editorEvents.dispatchEvent(
868
+ config.names.topBar.userPreferences,
869
+ {
870
+ location: config.locations.topBar,
871
+ secondaryLocation: config.secondaryLocations.elementorLogo,
872
+ trigger: config.triggers.click,
873
+ element: config.elements.link
874
+ }
875
+ );
876
+ }
877
+ (0, import_editor_v1_adapters15.__privateOpenRoute)("panel/editor-preferences");
878
+ },
691
879
  selected: isActive,
692
880
  disabled: isBlocked
693
881
  };
@@ -717,7 +905,22 @@ function init13() {
717
905
  return {
718
906
  title: (0, import_i18n19.__)("Exit to WordPress", "elementor"),
719
907
  href: document2?.links?.platformEdit,
720
- icon: import_icons17.WordpressIcon
908
+ icon: import_icons17.WordpressIcon,
909
+ onClick: () => {
910
+ const extendedWindow = window;
911
+ const config = extendedWindow?.elementor?.editorEvents?.config;
912
+ if (config) {
913
+ extendedWindow.elementor.editorEvents.dispatchEvent(
914
+ config.names.topBar.exitToWordpress,
915
+ {
916
+ location: config.locations.topBar,
917
+ secondaryLocation: config.secondaryLocations.elementorLogo,
918
+ trigger: config.triggers.click,
919
+ element: config.elements.link
920
+ }
921
+ );
922
+ }
923
+ }
721
924
  };
722
925
  }
723
926
  });