From 173b40684c0f51ed7a17af0c90dae520c5f237b9 Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Sun, 28 May 2023 17:11:23 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20more=20iFrame=20attributes=20?= =?UTF-8?q?(#869)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/iframe/IFrameTile.tsx | 60 ++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/widgets/iframe/IFrameTile.tsx b/src/widgets/iframe/IFrameTile.tsx index b10c5d224..e057e607f 100644 --- a/src/widgets/iframe/IFrameTile.tsx +++ b/src/widgets/iframe/IFrameTile.tsx @@ -22,6 +22,34 @@ const definition = defineWidget({ type: 'switch', defaultValue: false, }, + allowScrolling: { + type: 'switch', + defaultValue: true, + }, + allowTransparency: { + type: 'switch', + defaultValue: false, + }, + allowPayment: { + type: 'switch', + defaultValue: false, + }, + allowAutoPlay: { + type: 'switch', + defaultValue: false, + }, + allowMicrophone: { + type: 'switch', + defaultValue: false, + }, + allowCamera: { + type: 'switch', + defaultValue: false, + }, + allowGeolocation: { + type: 'switch', + defaultValue: false, + }, }, component: IFrameTile, }); @@ -54,13 +82,43 @@ function IFrameTile({ widget }: IFrameTileProps) { ); } + const allowedPermissions: string[] = []; + + if (widget.properties.allowTransparency) { + allowedPermissions.push('transparency'); + } + + if (widget.properties.allowFullScreen) { + allowedPermissions.push('fullscreen'); + } + + if (widget.properties.allowPayment) { + allowedPermissions.push('payment'); + } + + if (widget.properties.allowAutoPlay) { + allowedPermissions.push('autoplay'); + } + + if (widget.properties.allowCamera) { + allowedPermissions.push('camera'); + } + + if (widget.properties.allowMicrophone) { + allowedPermissions.push('microphone'); + } + + if (widget.properties.allowGeolocation) { + allowedPermissions.push('geolocation'); + } + return (