@elementor/editor-controls 4.0.0-536 → 4.0.0-538
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 +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor-toolbar.tsx +12 -6
package/dist/index.js
CHANGED
|
@@ -6852,18 +6852,18 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
6852
6852
|
const [openInNewTab, setOpenInNewTab] = (0, import_react59.useState)(false);
|
|
6853
6853
|
const toolbarRef = (0, import_react59.useRef)(null);
|
|
6854
6854
|
const linkPopupState = (0, import_ui92.usePopupState)({ variant: "popover" });
|
|
6855
|
-
const
|
|
6855
|
+
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
6856
6856
|
const editorState = (0, import_react60.useEditorState)({
|
|
6857
6857
|
editor,
|
|
6858
6858
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
6859
6859
|
});
|
|
6860
6860
|
const formatButtonsList = (0, import_react59.useMemo)(() => {
|
|
6861
6861
|
const buttons = Object.values(formatButtons);
|
|
6862
|
-
if (
|
|
6862
|
+
if (isElementClickable) {
|
|
6863
6863
|
return buttons.filter((button) => button.action !== "link");
|
|
6864
6864
|
}
|
|
6865
6865
|
return buttons;
|
|
6866
|
-
}, [
|
|
6866
|
+
}, [isElementClickable]);
|
|
6867
6867
|
const handleLinkClick = () => {
|
|
6868
6868
|
const linkAttrs = editor.getAttributes("link");
|
|
6869
6869
|
setUrlValue(linkAttrs.href || "");
|
|
@@ -6969,7 +6969,13 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
6969
6969
|
)
|
|
6970
6970
|
);
|
|
6971
6971
|
};
|
|
6972
|
-
var
|
|
6972
|
+
var checkIfElementIsClickable = (elementId) => {
|
|
6973
|
+
const container = (0, import_editor_elements6.getContainer)(elementId);
|
|
6974
|
+
const type = container?.model.get("widgetType");
|
|
6975
|
+
const isButton = type === "e-button";
|
|
6976
|
+
const hasLink = !!(0, import_editor_elements6.getElementSetting)(elementId, "link")?.value?.destination;
|
|
6977
|
+
return isButton || hasLink;
|
|
6978
|
+
};
|
|
6973
6979
|
var toolbarButtons = {
|
|
6974
6980
|
clear: {
|
|
6975
6981
|
label: (0, import_i18n54.__)("Clear", "elementor"),
|