From 5ce2c333defb1fde7917d1e83adf08d82c75be70 Mon Sep 17 00:00:00 2001 From: Georgi Genov Date: Wed, 25 Feb 2026 14:16:36 +0200 Subject: [PATCH] added webcam and gdrive to video input --- .../elements/google-drive/google-drive-file-id.ts | 14 +++++++++++++- .../ui/elements/input/add-asset/add-asset-modal.ts | 1 + .../input/floating-input/floating-input.ts | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/visual-editor/src/ui/elements/google-drive/google-drive-file-id.ts b/packages/visual-editor/src/ui/elements/google-drive/google-drive-file-id.ts index 99064d07eec..85389fb4919 100644 --- a/packages/visual-editor/src/ui/elements/google-drive/google-drive-file-id.ts +++ b/packages/visual-editor/src/ui/elements/google-drive/google-drive-file-id.ts @@ -131,6 +131,9 @@ export class GoogleDriveFileId extends SignalWatcher(LitElement) { @property() accessor autoTrigger = false; + @property() + accessor allowedMimeTypes: string | null = null; + @consume({ context: scaContext }) accessor sca!: SCA; @@ -210,8 +213,17 @@ export class GoogleDriveFileId extends SignalWatcher(LitElement) { if (this.sca.env.shellHost === undefined) { return; } + const mimeTypes = this.allowedMimeTypes + ? ALLOWED_MIME_TYPES.filter((m) => { + const pattern = this.allowedMimeTypes!; + if (pattern.endsWith("/*")) { + return m.startsWith(pattern.slice(0, -1)); + } + return m === pattern; + }) + : ALLOWED_MIME_TYPES; const result = await this.sca.env.shellHost.pickDriveFiles({ - mimeTypes: ALLOWED_MIME_TYPES, + mimeTypes, }); switch (result.action) { case "cancel": { diff --git a/packages/visual-editor/src/ui/elements/input/add-asset/add-asset-modal.ts b/packages/visual-editor/src/ui/elements/input/add-asset/add-asset-modal.ts index 91e0269c27e..d9afa0dd74a 100644 --- a/packages/visual-editor/src/ui/elements/input/add-asset/add-asset-modal.ts +++ b/packages/visual-editor/src/ui/elements/input/add-asset/add-asset-modal.ts @@ -451,6 +451,7 @@ export class AddAssetModal extends LitElement { id="add-drive-proxy" ${ref(this.#addDriveInputRef)} .autoTrigger=${true} + .allowedMimeTypes=${this.allowedMimeTypes} @bbinputcancel=${() => { this.dispatchEvent(new OverlayDismissedEvent()); }} diff --git a/packages/visual-editor/src/ui/elements/input/floating-input/floating-input.ts b/packages/visual-editor/src/ui/elements/input/floating-input/floating-input.ts index 4816207f50d..9b0f4c6527d 100644 --- a/packages/visual-editor/src/ui/elements/input/floating-input/floating-input.ts +++ b/packages/visual-editor/src/ui/elements/input/floating-input/floating-input.ts @@ -399,6 +399,8 @@ export class FloatingInput extends SignalWatcher(LitElement) { supportedActions.allowedUploadMimeTypes = "video/*"; supportedActions.actions.upload = true; supportedActions.actions.youtube = true; + supportedActions.actions.gdrive = true; + supportedActions.actions.webcamVideo = true; return supportedActions; }