Skip to content

Commit

Permalink
Merge pull request #129 from chaitin/excalidraw-add-font
Browse files Browse the repository at this point in the history
Excalidraw add font
  • Loading branch information
phxa1 authored Jan 29, 2024
2 parents 8b4106b + d9639f5 commit ae739e8
Show file tree
Hide file tree
Showing 8 changed files with 1,583 additions and 18 deletions.
4 changes: 4 additions & 0 deletions declare.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module 'css2less';
declare module 'clean-css' {
export type Options = any;
export default any;
}
declare module 'figlet/importable-fonts/Standard.js';
declare module 'figlet/importable-fonts/1Row.js';
declare module 'figlet/importable-fonts/3D-ASCII';
Expand Down
1,568 changes: 1,556 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
}
},
"dependencies": {
"@chaitin_rivers/excalidraw": "^0.17.1",
"@chaitin_rivers/multi_river": "^0.0.23",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@excalidraw/excalidraw": "^0.17.2",
"@ffmpeg/ffmpeg": "^0.12.6",
"@ffmpeg/types": "^0.12.2",
"@ffmpeg/util": "^0.12.1",
Expand Down
5 changes: 4 additions & 1 deletion src/components/MainContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ const MainContent: React.FC<{
dom.style.position = 'unset';
dom.style.inset = '0';
dom.style.maxWidth = 'unset';
if (riverHeader) riverHeader.style.display = 'block';
if (riverHeader) {
dom.style.paddingTop = '64px';
riverHeader.style.display = 'block';
}
}
}
};
Expand Down
1 change: 1 addition & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useMemo } from 'react';
import { allTools } from '@/utils/tools';
import Head from 'next/head';
import { Header as RiverHeader } from '@chaitin_rivers/multi_river';
import '@chaitin_rivers/excalidraw/index.css';

const clientSideEmotionCache = createEmotionCache();

Expand Down
15 changes: 14 additions & 1 deletion src/pages/color_convert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ function convertColor(colorString: string): ColorConversionResult | string {
hex: rgbaToHex(rgbaValues),
};
}
if (colorString.startsWith('rgb')) {
const rgbaValues = colorString
.substring(4, colorString.length - 1)
.split(',')
.map((value) => parseFloat(value));
const rgba = `rgba(${rgbaValues[0]}, ${rgbaValues[1]}, ${rgbaValues[2]}, 1)`;
return {
rgb: rgbaTrans(rgba),
rgba,
hsl: rgbaToHsl(rgbaValues),
hex: rgbaToHex(rgbaValues),
};
}

if (colorString.startsWith('hsl')) {
const hslValues = colorString
Expand Down Expand Up @@ -246,7 +259,7 @@ const ColorConvert: React.FC = () => {
size='small'
sx={{
fontSize: '14px',
maxWidth: '100px',
width: '100px',
borderRadius: '4px',
ml: 'auto',
height: '28px',
Expand Down
4 changes: 2 additions & 2 deletions src/pages/excalidraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { useState, useEffect } from 'react';
const Board: React.FC = () => {
const [Excalidraw, setExcalidraw] = useState<any>(null);
useEffect(() => {
import('@excalidraw/excalidraw').then((comp: any) =>
import('@chaitin_rivers/excalidraw').then((comp: any) =>
setExcalidraw(comp.Excalidraw)
);
}, []);
Expand Down Expand Up @@ -35,7 +35,7 @@ const Board: React.FC = () => {
},
}}
>
{Excalidraw && <Excalidraw />}
{Excalidraw && <Excalidraw langCode='zh-CN' />}
</Box>
</MainContent>
);
Expand Down
2 changes: 1 addition & 1 deletion src/types/declare.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type SocketClient = {
};

declare module 'nextPage/nextpage';
declare module '@excalidraw/excalidraw';
declare module '@chaitin_rivers/excalidraw';
declare module 'gofmt.js';
declare module 'uuid';
declare module 'apache-crypt';
Expand Down

0 comments on commit ae739e8

Please sign in to comment.