From 4788ab3bd6ed458a8e9abad21be6525930e14a3c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 16 Aug 2023 22:20:55 +0200 Subject: [PATCH] fix: Add support for Airtable share links with app ID --- shared/editor/embeds/Airtable.test.ts | 8 ++++++++ shared/editor/embeds/Airtable.tsx | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/shared/editor/embeds/Airtable.test.ts b/shared/editor/embeds/Airtable.test.ts index efb1e716b..4b8c0c507 100644 --- a/shared/editor/embeds/Airtable.test.ts +++ b/shared/editor/embeds/Airtable.test.ts @@ -5,6 +5,14 @@ describe("Airtable", () => { test("to be enabled on share link", () => { expect("https://airtable.com/shrEoQs3erLnppMie".match(match)).toBeTruthy(); + expect( + "https://airtable.com/shrEoQs3erLnppMie/tbl232i54yebXpr1J".match(match) + ).toBeTruthy(); + expect( + "https://airtable.com/app0lrLlMprqMbz11/shrEoQs3erLnppMie/tbl232i54yebXpr1J".match( + match + ) + ).toBeTruthy(); }); test("to be enabled on embed link", () => { diff --git a/shared/editor/embeds/Airtable.tsx b/shared/editor/embeds/Airtable.tsx index 856025b1c..9dcf99b23 100644 --- a/shared/editor/embeds/Airtable.tsx +++ b/shared/editor/embeds/Airtable.tsx @@ -2,7 +2,9 @@ import * as React from "react"; import Frame from "../components/Frame"; import { EmbedProps as Props } from "."; -const URL_REGEX = new RegExp("^https://airtable.com/(?:embed/)?(shr.*)$"); +const URL_REGEX = new RegExp( + "^https://airtable.com/(?:app.*/)?(?:embed/)?(shr.*)$" +); function Airtable(props: Props) { const { matches } = props.attrs;