Skip to content

Commit f5462d3

Browse files
Mrazatordwelle
authored andcommitted
feat: introduce font picker (excalidraw#8012)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
1 parent ea5f455 commit f5462d3

File tree

120 files changed

+3390
-1106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+3390
-1106
lines changed

dev-docs/src/css/custom.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pre a {
5959
padding: 5px;
6060
background: #70b1ec;
6161
color: white;
62-
font-weight: bold;
62+
font-weight: 700;
6363
border: none;
6464
}
6565

examples/excalidraw/components/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ export default function App({
872872
files: excalidrawAPI.getFiles(),
873873
});
874874
const ctx = canvas.getContext("2d")!;
875-
ctx.font = "30px Virgil";
875+
ctx.font = "30px Excalifont";
876876
ctx.strokeText("My custom text", 50, 60);
877877
setCanvasUrl(canvas.toDataURL());
878878
}}
@@ -893,7 +893,7 @@ export default function App({
893893
files: excalidrawAPI.getFiles(),
894894
});
895895
const ctx = canvas.getContext("2d")!;
896-
ctx.font = "30px Virgil";
896+
ctx.font = "30px Excalifont";
897897
ctx.strokeText("My custom text", 50, 60);
898898
setCanvasUrl(canvas.toDataURL());
899899
}}

examples/excalidraw/initialData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const elements: ExcalidrawElementSkeleton[] = [
4646
];
4747
export default {
4848
elements,
49-
appState: { viewBackgroundColor: "#AFEEEE", currentItemFontFamily: 1 },
49+
appState: { viewBackgroundColor: "#AFEEEE", currentItemFontFamily: 5 },
5050
scrollToContent: true,
5151
libraryItems: [
5252
[

examples/excalidraw/with-nextjs/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
# copied assets
39+
public/*.woff2

examples/excalidraw/with-nextjs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"build:workspace": "yarn workspace @excalidraw/excalidraw run build:esm",
6+
"build:workspace": "yarn workspace @excalidraw/excalidraw run build:esm && yarn copy:assets",
7+
"copy:assets": "cp ../../../packages/excalidraw/dist/browser/prod/excalidraw-assets/*.woff2 ./public",
78
"dev": "yarn build:workspace && next dev -p 3005",
89
"build": "yarn build:workspace && next build",
910
"start": "next start -p 3006",

examples/excalidraw/with-nextjs/src/app/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import dynamic from "next/dynamic";
2+
import Script from "next/script";
23
import "../common.scss";
34

45
// Since client components get prerenderd on server as well hence importing the excalidraw stuff dynamically
@@ -15,7 +16,9 @@ export default function Page() {
1516
<>
1617
<a href="/excalidraw-in-pages">Switch to Pages router</a>
1718
<h1 className="page-title">App Router</h1>
18-
19+
<Script id="load-env-variables" strategy="beforeInteractive">
20+
{`window["EXCALIDRAW_ASSET_PATH"] = window.origin;`}
21+
</Script>
1922
{/* @ts-expect-error - https://github.com/vercel/next.js/issues/42292 */}
2023
<ExcalidrawWithClientOnly />
2124
</>

examples/excalidraw/with-nextjs/src/common.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ a {
77
color: #1c7ed6;
88
font-size: 20px;
99
text-decoration: none;
10-
font-weight: 550;
10+
font-weight: 500;
1111
}
1212

1313
.page-title {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# copied assets
2+
public/*.woff2

examples/excalidraw/with-script-in-browser/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<title>React App</title>
1212
<script>
1313
window.name = "codesandbox";
14+
window.EXCALIDRAW_ASSET_PATH = window.origin;
1415
</script>
1516
<link rel="stylesheet" href="/dist/browser/dev/index.css" />
1617
</head>

examples/excalidraw/with-script-in-browser/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
"typescript": "^5"
1313
},
1414
"scripts": {
15-
"start": "yarn workspace @excalidraw/excalidraw run build:esm && vite",
16-
"build": "yarn workspace @excalidraw/excalidraw run build:esm && vite build",
15+
"build:workspace": "yarn workspace @excalidraw/excalidraw run build:esm && yarn copy:assets",
16+
"copy:assets": "cp ../../../packages/excalidraw/dist/browser/prod/excalidraw-assets/*.woff2 ./public",
17+
"start": "yarn build:workspace && vite",
18+
"build": "yarn build:workspace && vite build",
1719
"build:preview": "yarn build && vite preview --port 5002"
1820
}
1921
}

0 commit comments

Comments
 (0)