PluginProbe
Elementor Website Builder – more than just a page builder / trunk
Elementor Website Builder – more than just a page builder vtrunk
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 All 456 releases
← All changes | assets/js/packages/editor-controls/editor-controls.js +10 -8 4.3.2 → trunk View file →
@@ -10787,29 +10787,31 @@
10787 10787 const [isActive, setIsActive] = (0, react.useState)(!!value || !!linkPlaceholder);
10788 10788 const { allowCustomValues = true, queryOptions, placeholder, minInputLength = 2, context: { elementId }, label = (0, _wordpress_i18n.__)("Link", "elementor"), ariaLabel } = props || {};
10789 10789 const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, react.useState)((0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
10790 10790 const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
10791 - const debouncedCheckRestriction = (0, _elementor_utils.useDebouncedCallback)(() => {
10791 + const syncLinkRestriction = (clearActiveLinkWhen = "restricted") => {
10792 10792 const newRestriction = (0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder);
10793 - if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
10793 + const becameRestricted = newRestriction.shouldRestrict && !linkInLinkRestriction.shouldRestrict;
10794 + if ((clearActiveLinkWhen === "newly-restricted" ? becameRestricted : newRestriction.shouldRestrict) && isActive && !linkPlaceholder) {
10794 10795 setIsActive(false);
10795 10796 if (value !== null) setValue(null);
10796 10797 }
10797 10798 setLinkInLinkRestriction((prev) => isSameRestriction(prev, newRestriction) ? prev : newRestriction);
10798 - }, 300);
10799 + };
10800 + const debouncedSyncLinkRestriction = (0, _elementor_utils.useDebouncedCallback)((clearActiveLinkWhen = "restricted") => syncLinkRestriction(clearActiveLinkWhen), 300);
10799 10801 (0, _elementor_editor_v1_adapters.__privateUseListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/set-settings"), () => {
10800 - debouncedCheckRestriction();
10801 - }, [debouncedCheckRestriction]);
10802 + debouncedSyncLinkRestriction("newly-restricted");
10803 + }, [debouncedSyncLinkRestriction]);
10802 10804 (0, react.useEffect)(() => {
10803 - debouncedCheckRestriction();
10805 + debouncedSyncLinkRestriction();
10804 10806 const handleInlineLinkChanged = () => {
10805 - debouncedCheckRestriction();
10807 + debouncedSyncLinkRestriction();
10806 10808 };
10807 10809 window.addEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
10808 10810 return () => {
10809 10811 window.removeEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
10810 10812 };
10811 - }, [elementId, debouncedCheckRestriction]);
10813 + }, [elementId, debouncedSyncLinkRestriction]);
10812 10814 const onEnabledChange = () => {
10813 10815 setLinkInLinkRestriction((0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
10814 10816 if (linkInLinkRestriction.shouldRestrict && !isActive) return;
10815 10817 const newState = !isActive;