Skip to content

Conversation

@jeremydw
Copy link
Member

This PR adds the ability to paste text (Google Drive URLs - e.g. https://drive.google.com/open?id=1q4466dGkfhb9vKArGxopAkqB3QcjnjQn&usp=drive_copy) into the file field (when focused) in order to have Root CMS download the file from gDrive then upload it to the CMS.

@jeremydw jeremydw requested a review from stevenle January 12, 2026 19:21
@jeremydw
Copy link
Member Author

FYI; I also fixed an issue where it failed to create the Google Sheet when it was contained within a Shared Drive.

const clientId = window.__ROOT_CTX.gapi!.clientId!;
const scopes = [...SCOPES, ...(options?.scopes || [])];
// De-dupe scopes.
const uniqueScopes = [...new Set(scopes)];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer to use Array.from(new Set(scopes)) instead of the spread operator. Probably better to do it in one line as well, e.g.

const scopes = Array.from(new Set([
  ...SCOPES,
  ...(options?.scopes || []),
]));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import {GapiClient} from '../hooks/useGapiClient.js';

/** Extracts the Google Drive file ID from a URL. */
export function getGoogleDriveId(url: string): string | null {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this is implemented feels error prone since any URLs from google.com could potentially be pasted here and potentially return a Google Drive ID. I think this needs to be more deterministic and possibly create unit tests to verify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@stevenle stevenle merged commit 0096834 into main Jan 14, 2026
1 check passed
@stevenle stevenle deleted the feature/paste-from-drive branch January 14, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants