diff --git a/app/embeds/Miro.js b/app/embeds/Miro.js index 51e7ccb2..cdc8d91b 100644 --- a/app/embeds/Miro.js +++ b/app/embeds/Miro.js @@ -2,7 +2,7 @@ import * as React from "react"; import Frame from "./components/Frame"; -const URL_REGEX = /^https:\/\/(?:realtimeboard|miro).com\/app\/board\/(.*)$/; +const URL_REGEX = /^https:\/\/(realtimeboard|miro).com\/app\/board\/(.*)$/; type Props = {| attrs: {| @@ -16,13 +16,15 @@ export default class RealtimeBoard extends React.Component { render() { const { matches } = this.props.attrs; - const boardId = matches[1]; + const domain = matches[1]; + const boardId = matches[2]; + const titleName = domain === "realtimeboard" ? "RealtimeBoard" : "Miro"; return ( ); } diff --git a/app/embeds/Miro.test.js b/app/embeds/Miro.test.js index f87cb6c1..5e65d58d 100644 --- a/app/embeds/Miro.test.js +++ b/app/embeds/Miro.test.js @@ -13,6 +13,12 @@ describe("Miro", () => { expect("https://miro.com/app/board/o9J_k0fwiss=".match(match)).toBeTruthy(); }); + test("to extract the domain as part of the match for later use", () => { + expect( + "https://realtimeboard.com/app/board/o9J_k0fwiss=".match(match)[1] + ).toBe("realtimeboard"); + }); + test("to not be enabled elsewhere", () => { expect("https://miro.com".match(match)).toBe(null); expect("https://realtimeboard.com".match(match)).toBe(null);