mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 00:40:58 +01:00
fix(iframe): disable scrolling not working (#4017)
This commit is contained in:
@@ -98,7 +98,6 @@ const optionMapping: OptionMapping = {
|
||||
allowMicrophone: (oldOptions) => oldOptions.allowMicrophone,
|
||||
allowGeolocation: (oldOptions) => oldOptions.allowGeolocation,
|
||||
allowScrolling: (oldOptions) => oldOptions.allowScrolling,
|
||||
allowTransparency: (oldOptions) => oldOptions.allowTransparency,
|
||||
},
|
||||
video: {
|
||||
feedUrl: (oldOptions) => oldOptions.FeedUrl,
|
||||
|
||||
@@ -27,6 +27,7 @@ export default function IFrameWidget({ options, isEditMode }: WidgetComponentPro
|
||||
src={embedUrl}
|
||||
title="widget iframe"
|
||||
allow={allowedPermissions.join(" ")}
|
||||
scrolling={options.allowScrolling ? "yes" : "no"}
|
||||
>
|
||||
<Text>{t("widget.iframe.error.noBrowerSupport")}</Text>
|
||||
</iframe>
|
||||
@@ -71,7 +72,9 @@ const UnsupportedProtocol = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const getAllowedPermissions = (permissions: Omit<WidgetComponentProps<"iframe">["options"], "embedUrl">) => {
|
||||
const getAllowedPermissions = (
|
||||
permissions: Omit<WidgetComponentProps<"iframe">["options"], "embedUrl" | "allowScrolling">,
|
||||
) => {
|
||||
return objectEntries(permissions)
|
||||
.filter(([_key, value]) => value)
|
||||
.map(([key]) => permissionMapping[key]);
|
||||
@@ -84,6 +87,4 @@ const permissionMapping = {
|
||||
allowGeolocation: "geolocation",
|
||||
allowMicrophone: "microphone",
|
||||
allowPayment: "payment",
|
||||
allowScrolling: "scrolling",
|
||||
allowTransparency: "transparency",
|
||||
} satisfies Record<keyof Omit<WidgetComponentProps<"iframe">["options"], "embedUrl">, string>;
|
||||
} satisfies Record<keyof Omit<WidgetComponentProps<"iframe">["options"], "embedUrl" | "allowScrolling">, string>;
|
||||
|
||||
@@ -12,7 +12,6 @@ export const { definition, componentLoader } = createWidgetDefinition("iframe",
|
||||
allowScrolling: factory.switch({
|
||||
defaultValue: true,
|
||||
}),
|
||||
allowTransparency: factory.switch(),
|
||||
allowPayment: factory.switch(),
|
||||
allowAutoPlay: factory.switch(),
|
||||
allowMicrophone: factory.switch(),
|
||||
|
||||
Reference in New Issue
Block a user