@elementor/editor-app-bar 4.4.0-1064 → 4.4.0-1066
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/dist/index.js +35 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/extensions/angie/hooks/use-action-props.ts +2 -2
- package/src/hooks/use-is-angie-available.ts +33 -0
package/dist/index.mjs
CHANGED
|
@@ -766,15 +766,44 @@ function AppBar() {
|
|
|
766
766
|
}
|
|
767
767
|
|
|
768
768
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
769
|
-
import { useEffect as
|
|
770
|
-
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
769
|
+
import { useEffect as useEffect6 } from "react";
|
|
771
770
|
import { trackEvent } from "@elementor/events";
|
|
772
771
|
import { AngieIcon } from "@elementor/icons";
|
|
773
772
|
import { __ as __7 } from "@wordpress/i18n";
|
|
773
|
+
|
|
774
|
+
// src/hooks/use-is-angie-available.ts
|
|
775
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
776
|
+
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
777
|
+
function useIsAngieAvailable() {
|
|
778
|
+
const [available, setAvailable] = useState5(() => isAngieAvailable());
|
|
779
|
+
useEffect5(() => {
|
|
780
|
+
if (available) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
if (isAngieAvailable()) {
|
|
784
|
+
setAvailable(true);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
const observer = new MutationObserver(() => {
|
|
788
|
+
if (isAngieAvailable()) {
|
|
789
|
+
observer.disconnect();
|
|
790
|
+
setAvailable(true);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
observer.observe(document.body, {
|
|
794
|
+
childList: true,
|
|
795
|
+
subtree: true
|
|
796
|
+
});
|
|
797
|
+
return () => observer.disconnect();
|
|
798
|
+
}, [available]);
|
|
799
|
+
return available;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// src/extensions/angie/hooks/use-action-props.ts
|
|
774
803
|
function useActionProps() {
|
|
775
|
-
const hasAngieInstalled =
|
|
804
|
+
const hasAngieInstalled = useIsAngieAvailable();
|
|
776
805
|
const visible = !hasAngieInstalled;
|
|
777
|
-
|
|
806
|
+
useEffect6(() => {
|
|
778
807
|
if (!visible) {
|
|
779
808
|
return;
|
|
780
809
|
}
|