diff --git a/src/components/manage/Blocks/DetailedLink/View.jsx b/src/components/manage/Blocks/DetailedLink/View.jsx
index f1bca4f7..ba57670a 100644
--- a/src/components/manage/Blocks/DetailedLink/View.jsx
+++ b/src/components/manage/Blocks/DetailedLink/View.jsx
@@ -63,7 +63,7 @@ const View = (props) => {
onClick={(e) => e.preventDefault}
to={getPath(detailedLink.path)}
>
- {buttonTitle || detailedLink.title || 'Go'}
+ {buttonTitle || detailedLink.title || 'Go'}
>
diff --git a/src/components/manage/Blocks/Iframe/View.jsx b/src/components/manage/Blocks/Iframe/View.jsx
index 08e49b0f..ac851076 100644
--- a/src/components/manage/Blocks/Iframe/View.jsx
+++ b/src/components/manage/Blocks/Iframe/View.jsx
@@ -36,17 +36,37 @@ const View = ({ content, ...props }) => {
/* eslint-disable-next-line */
}, [props.data.queryParameters])
+ useEffect(() => {
+ try {
+ new URL(url);
+ const newUrl = getUrl(url);
+ if (props.mode === 'edit' && url !== newUrl) {
+ props.onChangeBlock(props.block, {
+ ...props.data,
+ url: newUrl,
+ });
+ }
+ } catch {}
+
+ /* eslint-disable-next-line */
+ }, [url])
+
const getUrl = (url) => {
const newUrl = new URL(url);
return newUrl.protocol + '//' + newUrl.host + newUrl.pathname;
};
const applyQueryParameters = (url, query) => {
- const queryParameters = {
- ...query,
- ':toolbar': hideToolbar ? 'n' : 'y',
- ':embed': 'y',
- };
- return `${getUrl(url)}?${qs.stringify(queryParameters)}`;
+ try {
+ new URL(url);
+ const queryParameters = {
+ ...query,
+ ':toolbar': hideToolbar ? 'n' : 'y',
+ ':embed': 'y',
+ };
+ return `${getUrl(url)}?${qs.stringify(queryParameters)}`;
+ } catch {
+ return '';
+ }
};
return (
@@ -59,6 +79,7 @@ const View = ({ content, ...props }) => {
display="initial"
position="relative"
overflow={overflow ? 'visible' : 'hidden'}
+ scrolling={false}
/>
);
diff --git a/src/components/manage/Blocks/QueryParamButton/Edit.jsx b/src/components/manage/Blocks/QueryParamButton/Edit.jsx
index 2edcdf3c..aa094841 100644
--- a/src/components/manage/Blocks/QueryParamButton/Edit.jsx
+++ b/src/components/manage/Blocks/QueryParamButton/Edit.jsx
@@ -36,6 +36,14 @@ const getSchema = (props) => {
['link', 'Outside link'],
],
},
+ visible: {
+ title: 'Visible when',
+ type: 'array',
+ choices: [
+ ['hasQuery', 'Query parameter exists'],
+ ['always', 'Always'],
+ ],
+ },
leftText: {
title: 'Left text',
widget: 'textarea',
diff --git a/src/components/manage/Blocks/QueryParamButton/View.jsx b/src/components/manage/Blocks/QueryParamButton/View.jsx
index 791512d4..d283f725 100644
--- a/src/components/manage/Blocks/QueryParamButton/View.jsx
+++ b/src/components/manage/Blocks/QueryParamButton/View.jsx
@@ -17,6 +17,7 @@ const View = ({ content, ...props }) => {
link = '',
linkTarget = '_self',
use = '',
+ visible = 'always',
} = data;
const queryText = props.search[queryParam] || '';
@@ -24,7 +25,11 @@ const View = ({ content, ...props }) => {
const hasText = leftText || queryText || rightText;
+ const buttonMayRender =
+ (visible === 'always' && hasText) || (visible === 'hasQuery' && queryText);
+
let parsedInlineStyle;
+
try {
parsedInlineStyle = JSON.parse(inlineStyle);
} catch {
@@ -33,8 +38,12 @@ const View = ({ content, ...props }) => {
return (
<>
- {props.mode === 'edit' && !hasText ? Query param button
: ''}
- {hasText ? (
+ {props.mode === 'edit' && !buttonMayRender ? (
+ Query param button
+ ) : (
+ ''
+ )}
+ {buttonMayRender ? (