mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Merge remote-tracking branch 'origin/master' into aakansha-create-text-containers-programmatically
This commit is contained in:
commit
2ff0528a4f
186 changed files with 8275 additions and 1805 deletions
|
@ -15,6 +15,8 @@ Please add the latest change on the top under the correct section.
|
|||
|
||||
### Features
|
||||
|
||||
- Add support for `opts.fitToViewport` and `opts.viewportZoomFactor` in the [`ExcalidrawAPI.scrollToContent`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/ref#scrolltocontent) API. [#6581](https://github.com/excalidraw/excalidraw/pull/6581).
|
||||
- Properly sanitize element `link` urls. [#6728](https://github.com/excalidraw/excalidraw/pull/6728).
|
||||
- Sidebar component now supports tabs — for more detailed description of new behavior and breaking changes, see the linked PR. [#6213](https://github.com/excalidraw/excalidraw/pull/6213)
|
||||
- Exposed `DefaultSidebar` component to allow modifying the default sidebar, such as adding custom tabs to it. [#6213](https://github.com/excalidraw/excalidraw/pull/6213)
|
||||
|
||||
|
@ -63,7 +65,7 @@ Please add the latest change on the top under the correct section.
|
|||
|
||||
### Features
|
||||
|
||||
- [`ExcalidrawAPI.scrolToContent`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/ref#scrolltocontent) has new opts object allowing you to fit viewport to content, and animate the scrolling. [#6319](https://github.com/excalidraw/excalidraw/pull/6319)
|
||||
- [`ExcalidrawAPI.scrollToContent`](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/ref#scrolltocontent) has new opts object allowing you to fit viewport to content, and animate the scrolling. [#6319](https://github.com/excalidraw/excalidraw/pull/6319)
|
||||
|
||||
- Expose `useI18n()` hook return an object containing `t()` i18n helper and current `langCode`. You can use this in components you render as `<Excalidraw>` children to render any of our i18n locale strings. [#6224](https://github.com/excalidraw/excalidraw/pull/6224)
|
||||
|
||||
|
|
|
@ -43,3 +43,7 @@ Head over to the [docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/
|
|||
## API
|
||||
|
||||
Head over to the [docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api)
|
||||
|
||||
## Contributing
|
||||
|
||||
Head over to the [docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/contributing)
|
||||
|
|
|
@ -31,6 +31,7 @@ import { ImportedLibraryData } from "../../../data/types";
|
|||
import CustomFooter from "./CustomFooter";
|
||||
import MobileFooter from "./MobileFooter";
|
||||
import { KEYS } from "../../../keys";
|
||||
import { convertToExcalidrawElements } from "../../../data/transform";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
@ -140,7 +141,11 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) {
|
|||
];
|
||||
|
||||
//@ts-ignore
|
||||
initialStatePromiseRef.current.promise.resolve(initialData);
|
||||
initialStatePromiseRef.current.promise.resolve({
|
||||
...initialData,
|
||||
//@ts-ignore
|
||||
elements: convertToExcalidrawElements(initialData.elements),
|
||||
});
|
||||
excalidrawAPI.addFiles(imagesArray);
|
||||
};
|
||||
};
|
||||
|
@ -786,7 +791,6 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) {
|
|||
<div className="export export-blob">
|
||||
<img src={blobUrl} alt="" />
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (!excalidrawAPI) {
|
||||
|
@ -808,6 +812,78 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) {
|
|||
>
|
||||
Export to Canvas
|
||||
</button>
|
||||
<button
|
||||
onClick={async () => {
|
||||
if (!excalidrawAPI) {
|
||||
return;
|
||||
}
|
||||
const canvas = await exportToCanvas({
|
||||
elements: excalidrawAPI.getSceneElements(),
|
||||
appState: {
|
||||
...initialData.appState,
|
||||
exportWithDarkMode,
|
||||
},
|
||||
files: excalidrawAPI.getFiles(),
|
||||
});
|
||||
const ctx = canvas.getContext("2d")!;
|
||||
ctx.font = "30px Virgil";
|
||||
ctx.strokeText("My custom text", 50, 60);
|
||||
setCanvasUrl(canvas.toDataURL());
|
||||
}}
|
||||
>
|
||||
Export to Canvas
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!excalidrawAPI) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = excalidrawAPI.getSceneElements();
|
||||
excalidrawAPI.scrollToContent(elements[0], {
|
||||
fitToViewport: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Fit to viewport, first element
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!excalidrawAPI) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = excalidrawAPI.getSceneElements();
|
||||
excalidrawAPI.scrollToContent(elements[0], {
|
||||
fitToContent: true,
|
||||
});
|
||||
|
||||
excalidrawAPI.scrollToContent(elements[0], {
|
||||
fitToContent: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Fit to content, first element
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
if (!excalidrawAPI) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = excalidrawAPI.getSceneElements();
|
||||
excalidrawAPI.scrollToContent(elements[0], {
|
||||
fitToContent: true,
|
||||
});
|
||||
|
||||
excalidrawAPI.scrollToContent(elements[0]);
|
||||
}}
|
||||
>
|
||||
Scroll to first element, no fitToContent, no fitToViewport
|
||||
</button>
|
||||
<div className="export export-canvas">
|
||||
<img src={canvasUrl} alt="" />
|
||||
</div>
|
||||
|
|
|
@ -43,6 +43,7 @@ export default {
|
|||
roughness: 1,
|
||||
opacity: 100,
|
||||
groupIds: [],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
seed: 707269846,
|
||||
version: 143,
|
||||
|
@ -79,6 +80,7 @@ export default {
|
|||
height: 103.65107323746608,
|
||||
seed: 1445523839,
|
||||
groupIds: [],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -118,6 +120,7 @@ export default {
|
|||
height: 113.8575037534261,
|
||||
seed: 1513238033,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -167,6 +170,7 @@ export default {
|
|||
height: 9.797916664247975,
|
||||
seed: 683951089,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -205,6 +209,7 @@ export default {
|
|||
height: 9.797916664247975,
|
||||
seed: 1817746897,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -243,6 +248,7 @@ export default {
|
|||
height: 17.72670397681366,
|
||||
seed: 1409727409,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: ["bxuMGTzXLn7H-uBCptINx"],
|
||||
},
|
||||
|
@ -266,6 +272,7 @@ export default {
|
|||
height: 13.941904362416096,
|
||||
seed: 1073094033,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -289,6 +296,7 @@ export default {
|
|||
height: 13.941904362416096,
|
||||
seed: 526271345,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -312,6 +320,7 @@ export default {
|
|||
height: 13.941904362416096,
|
||||
seed: 243707217,
|
||||
groupIds: ["N2YAi9nU-wlRb0rDaDZoe"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -337,6 +346,7 @@ export default {
|
|||
height: 36.77344700318558,
|
||||
seed: 511870335,
|
||||
groupIds: ["M6ByXuSmtHCr3RtPPKJQh"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -360,6 +370,7 @@ export default {
|
|||
height: 36.77344700318558,
|
||||
seed: 1283079231,
|
||||
groupIds: ["M6ByXuSmtHCr3RtPPKJQh"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -383,6 +394,7 @@ export default {
|
|||
height: 36.77344700318558,
|
||||
seed: 996251633,
|
||||
groupIds: ["M6ByXuSmtHCr3RtPPKJQh"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -406,6 +418,7 @@ export default {
|
|||
height: 36.77344700318558,
|
||||
seed: 1764842481,
|
||||
groupIds: ["M6ByXuSmtHCr3RtPPKJQh"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -431,6 +444,7 @@ export default {
|
|||
height: 154.56722543646003,
|
||||
seed: 1424381745,
|
||||
groupIds: ["HSrtfEf-CssQTf160Fb6R"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -480,6 +494,7 @@ export default {
|
|||
height: 12.698053371678215,
|
||||
seed: 726657713,
|
||||
groupIds: ["HSrtfEf-CssQTf160Fb6R"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -518,6 +533,7 @@ export default {
|
|||
height: 10.178760037658167,
|
||||
seed: 1977326481,
|
||||
groupIds: ["HSrtfEf-CssQTf160Fb6R"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -556,6 +572,7 @@ export default {
|
|||
height: 22.797152568995934,
|
||||
seed: 1774660383,
|
||||
groupIds: ["HSrtfEf-CssQTf160Fb6R"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: ["bxuMGTzXLn7H-uBCptINx"],
|
||||
},
|
||||
|
@ -581,6 +598,7 @@ export default {
|
|||
height: 107.25081879410921,
|
||||
seed: 371096063,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [
|
||||
"CFu0B4Mw_1wC1Hbgx8Fs0",
|
||||
|
@ -608,6 +626,7 @@ export default {
|
|||
height: 107.25081879410921,
|
||||
seed: 685932433,
|
||||
groupIds: ["0RJwA-yKP5dqk5oMiSeot", "9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [
|
||||
"CFu0B4Mw_1wC1Hbgx8Fs0",
|
||||
|
@ -635,6 +654,7 @@ export default {
|
|||
height: 107.25081879410921,
|
||||
seed: 58634943,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [
|
||||
"CFu0B4Mw_1wC1Hbgx8Fs0",
|
||||
|
@ -662,6 +682,7 @@ export default {
|
|||
height: 3.249953844290203,
|
||||
seed: 1673003743,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -693,6 +714,7 @@ export default {
|
|||
height: 2.8032978840147194,
|
||||
seed: 1821527807,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -724,6 +746,7 @@ export default {
|
|||
height: 4.280657518731036,
|
||||
seed: 1485707039,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -756,6 +779,7 @@ export default {
|
|||
height: 2.9096445412231735,
|
||||
seed: 1042012991,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -789,6 +813,7 @@ export default {
|
|||
height: 2.4757501798128,
|
||||
seed: 295443295,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -820,6 +845,7 @@ export default {
|
|||
height: 2.4757501798128,
|
||||
seed: 1734301567,
|
||||
groupIds: ["9ppmKFUbA4iKjt8FaDFox"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
points: [
|
||||
|
@ -854,6 +880,7 @@ export default {
|
|||
height: 76.53703389977764,
|
||||
seed: 106569279,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -877,6 +904,7 @@ export default {
|
|||
height: 0,
|
||||
seed: 73916127,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -909,6 +937,7 @@ export default {
|
|||
height: 5.001953125,
|
||||
seed: 387857791,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -932,6 +961,7 @@ export default {
|
|||
height: 5.001953125,
|
||||
seed: 1486370207,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -955,6 +985,7 @@ export default {
|
|||
height: 5.001953125,
|
||||
seed: 610150847,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -978,6 +1009,7 @@ export default {
|
|||
height: 42.72020253937572,
|
||||
seed: 144280593,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1001,6 +1033,7 @@ export default {
|
|||
height: 24.44112284281997,
|
||||
seed: 29167967,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -1053,6 +1086,7 @@ export default {
|
|||
height: 0,
|
||||
seed: 1443027377,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -1085,6 +1119,7 @@ export default {
|
|||
height: 5.711199931375845,
|
||||
seed: 244310513,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -1123,6 +1158,7 @@ export default {
|
|||
height: 44.82230388130942,
|
||||
seed: 683572113,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1146,6 +1182,7 @@ export default {
|
|||
height: 5.896061363392446,
|
||||
seed: 318798801,
|
||||
groupIds: ["TC0RSM64Cxmu17MlE12-o"],
|
||||
frameId: null,
|
||||
strokeSharpness: "round",
|
||||
boundElementIds: [],
|
||||
startBinding: null,
|
||||
|
@ -1185,6 +1222,7 @@ export default {
|
|||
height: 108.30428902193904,
|
||||
seed: 1914896753,
|
||||
groupIds: ["GMZ-NW9lG7c1AtfBInZ0n"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1208,6 +1246,7 @@ export default {
|
|||
height: 82.83278895375764,
|
||||
seed: 1306468145,
|
||||
groupIds: ["GMZ-NW9lG7c1AtfBInZ0n"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1231,6 +1270,7 @@ export default {
|
|||
height: 11.427824006438863,
|
||||
seed: 93422161,
|
||||
groupIds: ["GMZ-NW9lG7c1AtfBInZ0n"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1254,6 +1294,7 @@ export default {
|
|||
height: 19.889460471185775,
|
||||
seed: 11646495,
|
||||
groupIds: ["GMZ-NW9lG7c1AtfBInZ0n"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
@ -1277,6 +1318,7 @@ export default {
|
|||
height: 19.889460471185775,
|
||||
seed: 291717649,
|
||||
groupIds: ["GMZ-NW9lG7c1AtfBInZ0n"],
|
||||
frameId: null,
|
||||
strokeSharpness: "sharp",
|
||||
boundElementIds: [],
|
||||
},
|
||||
|
|
|
@ -247,3 +247,5 @@ export { WelcomeScreen };
|
|||
export { LiveCollaborationTrigger };
|
||||
|
||||
export { DefaultSidebar } from "../../components/DefaultSidebar";
|
||||
|
||||
export { normalizeLink } from "../../data/url";
|
||||
|
|
|
@ -44,7 +44,8 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.(ts|tsx|js|jsx|mjs)$/,
|
||||
exclude: /node_modules\/(?!browser-fs-access)/,
|
||||
exclude:
|
||||
/node_modules\/(?!(browser-fs-access|canvas-roundrect-polyfill))/,
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
|
|
|
@ -46,7 +46,9 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.(ts|tsx|js|jsx|mjs)$/,
|
||||
exclude: /node_modules\/(?!browser-fs-access)/,
|
||||
exclude:
|
||||
/node_modules\/(?!(browser-fs-access|canvas-roundrect-polyfill))/,
|
||||
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue