feat: Add support SmartSuite embeds

This commit is contained in:
Tom Moor
2024-02-07 22:37:23 -05:00
parent 105c84b4e9
commit fc2ff691f7
3 changed files with 15 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -45,7 +45,7 @@ const EmbedComponent = ({
<Frame
src={src}
isSelected={isSelected}
canonicalUrl={node.attrs.href}
canonicalUrl={embed.hideToolbar ? undefined : node.attrs.href}
title={embed.title}
referrerPolicy="origin"
border

View File

@@ -51,6 +51,8 @@ export class EmbedDescriptor {
tooltip?: string;
/** Whether the embed should be hidden in menus by default */
defaultHidden?: boolean;
/** Whether the bottom toolbar should be hidden use this when the embed itself includes a footer */
hideToolbar?: boolean;
/** A regex that will be used to match the embed when pasting a URL */
regexMatch?: RegExp[];
/**
@@ -81,6 +83,7 @@ export class EmbedDescriptor {
this.keywords = options.keywords;
this.tooltip = options.tooltip;
this.defaultHidden = options.defaultHidden;
this.hideToolbar = options.hideToolbar;
this.regexMatch = options.regexMatch;
this.transformMatch = options.transformMatch;
this.attrs = options.attrs;
@@ -512,6 +515,17 @@ const embeds: EmbedDescriptor[] = [
`https://scribehow.com/embed/${matches[1]}`,
icon: <Img src="/images/scribe.png" alt="Scribe" />,
}),
new EmbedDescriptor({
title: "SmartSuite",
regexMatch: [
new RegExp("^https?://app\\.smartsuite\\.com/shared/(.*)(?:\\?)?(?:.*)$"),
],
icon: <Img src="/images/smartsuite.png" alt="SmartSuite" />,
defaultHidden: true,
hideToolbar: true,
transformMatch: (matches: RegExpMatchArray) =>
`https://app.smartsuite.com/shared/${matches[1]}?embed=true&header=false&toolbar=true`,
}),
new EmbedDescriptor({
title: "Spotify",
keywords: "music",