mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-03 23:57:01 +02:00
Compare commits
4 Commits
v0.16.2
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
39b281713d | ||
![]() |
4765f5536e | ||
![]() |
556175558a | ||
![]() |
4db73a7f95 |
@@ -894,11 +894,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
title="Excalidraw Embedded Content"
|
title="Excalidraw Embedded Content"
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
allowFullScreen={true}
|
allowFullScreen={true}
|
||||||
sandbox={`${
|
sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads"
|
||||||
embedLink?.sandbox?.allowSameOrigin
|
|
||||||
? "allow-same-origin"
|
|
||||||
: ""
|
|
||||||
} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1090,7 +1086,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
cursor: CURSOR_TYPE.MOVE,
|
cursor: CURSOR_TYPE.MOVE,
|
||||||
pointerEvents: this.state.viewModeEnabled
|
pointerEvents: this.state.viewModeEnabled
|
||||||
? POINTER_EVENTS.disabled
|
? POINTER_EVENTS.disabled
|
||||||
: POINTER_EVENTS.inheritFromUI,
|
: POINTER_EVENTS.enabled,
|
||||||
}}
|
}}
|
||||||
onPointerDown={(event) => this.handleCanvasPointerDown(event)}
|
onPointerDown={(event) => this.handleCanvasPointerDown(event)}
|
||||||
onWheel={(event) => this.handleWheel(event)}
|
onWheel={(event) => this.handleWheel(event)}
|
||||||
|
@@ -17,7 +17,6 @@ type EmbeddedLink =
|
|||||||
| ({
|
| ({
|
||||||
aspectRatio: { w: number; h: number };
|
aspectRatio: { w: number; h: number };
|
||||||
warning?: string;
|
warning?: string;
|
||||||
sandbox?: { allowSameOrigin?: boolean };
|
|
||||||
} & (
|
} & (
|
||||||
| { type: "video" | "generic"; link: string }
|
| { type: "video" | "generic"; link: string }
|
||||||
| { type: "document"; srcdoc: (theme: Theme) => string }
|
| { type: "document"; srcdoc: (theme: Theme) => string }
|
||||||
@@ -29,20 +28,20 @@ const embeddedLinkCache = new Map<string, EmbeddedLink>();
|
|||||||
const RE_YOUTUBE =
|
const RE_YOUTUBE =
|
||||||
/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/;
|
/^(?:http(?:s)?:\/\/)?(?:www\.)?youtu(?:be\.com|\.be)\/(embed\/|watch\?v=|shorts\/|playlist\?list=|embed\/videoseries\?list=)?([a-zA-Z0-9_-]+)(?:\?t=|&t=|\?start=|&start=)?([a-zA-Z0-9_-]+)?[^\s]*$/;
|
||||||
const RE_VIMEO =
|
const RE_VIMEO =
|
||||||
/^(?:http(?:s)?:\/\/)?(?:(?:w){3}\.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/;
|
/^(?:http(?:s)?:\/\/)?(?:(?:w){3}.)?(?:player\.)?vimeo\.com\/(?:video\/)?([^?\s]+)(?:\?.*)?$/;
|
||||||
const RE_FIGMA = /^https:\/\/(?:www\.)?figma\.com/;
|
const RE_FIGMA = /^https:\/\/(?:www\.)?figma\.com/;
|
||||||
|
|
||||||
const RE_GH_GIST = /^https:\/\/gist\.github\.com/;
|
const RE_GH_GIST = /^https:\/\/gist\.github\.com/;
|
||||||
const RE_GH_GIST_EMBED =
|
const RE_GH_GIST_EMBED =
|
||||||
/https?:\/\/gist\.github\.com\/([\w_-]+)\/([\w_-]+)\.js["']/i;
|
/^<script[\s\S]*?\ssrc=["'](https:\/\/gist.github.com\/.*?)\.js["']/i;
|
||||||
|
|
||||||
// not anchored to start to allow <blockquote> twitter embeds
|
// not anchored to start to allow <blockquote> twitter embeds
|
||||||
const RE_TWITTER = /(?:https?:\/\/)?(?:(?:w){3}\.)?(?:twitter|x)\.com/;
|
const RE_TWITTER = /(?:http(?:s)?:\/\/)?(?:(?:w){3}.)?twitter.com/;
|
||||||
const RE_TWITTER_EMBED =
|
const RE_TWITTER_EMBED =
|
||||||
/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:twitter|x)\.com\/[^"']*)/i;
|
/^<blockquote[\s\S]*?\shref=["'](https:\/\/twitter.com\/[^"']*)/i;
|
||||||
|
|
||||||
const RE_VALTOWN =
|
const RE_VALTOWN =
|
||||||
/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/;
|
/^https:\/\/(?:www\.)?val.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/;
|
||||||
|
|
||||||
const RE_GENERIC_EMBED =
|
const RE_GENERIC_EMBED =
|
||||||
/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i;
|
/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i;
|
||||||
@@ -137,27 +136,46 @@ export const getEmbedLink = (link: string | null | undefined): EmbeddedLink => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (RE_TWITTER.test(link)) {
|
if (RE_TWITTER.test(link)) {
|
||||||
// the embed srcdoc still supports twitter.com domain only
|
let ret: EmbeddedLink;
|
||||||
link = link.replace(/\bx.com\b/, "twitter.com");
|
// assume embed code
|
||||||
|
if (/<blockquote/.test(link)) {
|
||||||
const ret: EmbeddedLink = {
|
const srcDoc = createSrcDoc(link);
|
||||||
type: "document",
|
ret = {
|
||||||
srcdoc: (theme: string) =>
|
type: "document",
|
||||||
createSrcDoc(
|
srcdoc: () => srcDoc,
|
||||||
`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${theme}"><a href="${link}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`,
|
aspectRatio: { w: 480, h: 480 },
|
||||||
),
|
};
|
||||||
aspectRatio: { w: 480, h: 480 },
|
// assume regular tweet url
|
||||||
sandbox: { allowSameOrigin: true },
|
} else {
|
||||||
};
|
ret = {
|
||||||
|
type: "document",
|
||||||
|
srcdoc: (theme: string) =>
|
||||||
|
createSrcDoc(
|
||||||
|
`<blockquote class="twitter-tweet" data-dnt="true" data-theme="${theme}"><a href="${link}"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`,
|
||||||
|
),
|
||||||
|
aspectRatio: { w: 480, h: 480 },
|
||||||
|
};
|
||||||
|
}
|
||||||
embeddedLinkCache.set(originalLink, ret);
|
embeddedLinkCache.set(originalLink, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RE_GH_GIST.test(link)) {
|
if (RE_GH_GIST.test(link)) {
|
||||||
const ret: EmbeddedLink = {
|
let ret: EmbeddedLink;
|
||||||
type: "document",
|
// assume embed code
|
||||||
srcdoc: () =>
|
if (/<script>/.test(link)) {
|
||||||
createSrcDoc(`
|
const srcDoc = createSrcDoc(link);
|
||||||
|
ret = {
|
||||||
|
type: "document",
|
||||||
|
srcdoc: () => srcDoc,
|
||||||
|
aspectRatio: { w: 550, h: 720 },
|
||||||
|
};
|
||||||
|
// assume regular url
|
||||||
|
} else {
|
||||||
|
ret = {
|
||||||
|
type: "document",
|
||||||
|
srcdoc: () =>
|
||||||
|
createSrcDoc(`
|
||||||
<script src="${link}.js"></script>
|
<script src="${link}.js"></script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
* { margin: 0px; }
|
* { margin: 0px; }
|
||||||
@@ -165,8 +183,9 @@ export const getEmbedLink = (link: string | null | undefined): EmbeddedLink => {
|
|||||||
.gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
|
.gist .gist-file { height: calc(100vh - 2px); padding: 0px; display: grid; grid-template-rows: 1fr auto; }
|
||||||
</style>
|
</style>
|
||||||
`),
|
`),
|
||||||
aspectRatio: { w: 550, h: 720 },
|
aspectRatio: { w: 550, h: 720 },
|
||||||
};
|
};
|
||||||
|
}
|
||||||
embeddedLinkCache.set(link, ret);
|
embeddedLinkCache.set(link, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -284,8 +303,8 @@ export const extractSrc = (htmlString: string): string => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const gistMatch = htmlString.match(RE_GH_GIST_EMBED);
|
const gistMatch = htmlString.match(RE_GH_GIST_EMBED);
|
||||||
if (gistMatch && gistMatch.length === 3) {
|
if (gistMatch && gistMatch.length === 2) {
|
||||||
return `https://gist.github.com/${gistMatch[1]}/${gistMatch[2]}`;
|
return gistMatch[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const match = htmlString.match(RE_GENERIC_EMBED);
|
const match = htmlString.match(RE_GENERIC_EMBED);
|
||||||
|
@@ -11,6 +11,22 @@ The change should be grouped under one of the below section and must contain PR
|
|||||||
Please add the latest change on the top under the correct section.
|
Please add the latest change on the top under the correct section.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 0.16.1 (2023-09-21)
|
||||||
|
|
||||||
|
## Excalidraw Library
|
||||||
|
|
||||||
|
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- More eye-droper fixes [#7019](https://github.com/excalidraw/excalidraw/pull/7019)
|
||||||
|
|
||||||
|
### Refactor
|
||||||
|
|
||||||
|
- Move excalidraw-app outside src [#6987](https://github.com/excalidraw/excalidraw/pull/6987)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 0.16.0 (2023-09-19)
|
## 0.16.0 (2023-09-19)
|
||||||
|
|
||||||
- Support creating containers, linear elements, text containers, labelled arrows and arrow bindings programatically [#6546](https://github.com/excalidraw/excalidraw/pull/6546)
|
- Support creating containers, linear elements, text containers, labelled arrows and arrow bindings programatically [#6546](https://github.com/excalidraw/excalidraw/pull/6546)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@excalidraw/excalidraw",
|
"name": "@excalidraw/excalidraw",
|
||||||
"version": "0.16.2",
|
"version": "0.16.1",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"types": "types/packages/excalidraw/index.d.ts",
|
"types": "types/packages/excalidraw/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
@@ -22,5 +22,12 @@ const polyfill = () => {
|
|||||||
configurable: true,
|
configurable: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Element.prototype.replaceChildren) {
|
||||||
|
Element.prototype.replaceChildren = function (...nodes) {
|
||||||
|
this.innerHTML = "";
|
||||||
|
this.append(...nodes);
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
export default polyfill;
|
export default polyfill;
|
||||||
|
@@ -4520,9 +4520,9 @@ get-caller-file@^2.0.5:
|
|||||||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
get-func-name@^2.0.0:
|
get-func-name@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
|
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.2.tgz#0d7cf20cd13fda808669ffa88f4ffc7a3943fc41"
|
||||||
integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==
|
integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==
|
||||||
|
|
||||||
get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0:
|
get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
|
Reference in New Issue
Block a user