Skip to content

Commit ff71e52

Browse files
authored
Merge pull request #28 from vinpac/master
Add support for Figma Embed Link
2 parents f6f987a + 28e3159 commit ff71e52

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.8.0",
2+
"version": "0.8.1",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

src/block.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ export const Block: React.FC<Block> = props => {
240240

241241
case "image":
242242
case "embed":
243+
case "figma":
243244
case "video":
244245
const value = block.value as ContentValueType;
245246

src/components/asset.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { BlockType, ContentValueType, MapImageUrl } from "../types";
33

4-
const types = ["video", "image", "embed"];
4+
const types = ["video", "image", "embed", "figma"];
55

66
const Asset: React.FC<{
77
block: BlockType;
@@ -24,15 +24,18 @@ const Asset: React.FC<{
2424

2525
const aspectRatio = block_aspect_ratio || block_height / block_width;
2626

27-
if (type === "embed" || type === "video") {
27+
if (type === "embed" || type === "video" || type === "figma") {
2828
return (
2929
<div
3030
style={{
3131
paddingBottom: `${aspectRatio * 100}%`,
3232
position: "relative"
3333
}}
3434
>
35-
<iframe className="notion-image-inset" src={display_source} />
35+
<iframe
36+
className="notion-image-inset"
37+
src={type === "figma" ? value.properties.source[0][0] : display_source}
38+
/>
3639
</div>
3740
);
3841
}

src/types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ interface ImageValueType extends ContentValueType {
214214
interface EmbedValueType extends ContentValueType {
215215
type: "embed";
216216
}
217+
218+
interface FigmaValueType extends ContentValueType {
219+
type: "figma";
220+
}
221+
217222
interface VideoValueType extends ContentValueType {
218223
type: "video";
219224
}
@@ -273,6 +278,7 @@ export type BlockValueType =
273278
| ImageValueType
274279
| VideoValueType
275280
| EmbedValueType
281+
| FigmaValueType
276282
| CalloutValueType
277283
| BookmarkValueType
278284
| ToggleValueType

0 commit comments

Comments
 (0)