feat: expose fontfamily and refactor FONT_FAMILY (#3710)
* feat: expose fontfamily and refactor FONT_FAMILY for better readability * fix * fix * fix * docs * fix
This commit is contained in:
@ -19,6 +19,8 @@ Please add the latest change on the top under the correct section.
|
||||
|
||||
### Features
|
||||
|
||||
- Expose [`FONT_FAMILY`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#FONT_FAMILY) so that consumer can use when passing `initialData.appState.currentItemFontFamily`.
|
||||
|
||||
- Added prop [`autoFocus`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#autoFocus) to focus the excalidraw component on page load when enabled, defaults to false [#3691](https://github.com/excalidraw/excalidraw/pull/3691).
|
||||
|
||||
Note: Earlier Excalidraw component was focussed by default on page load, you need to enable `autoFocus` prop to retain the same behaviour.
|
||||
|
@ -840,3 +840,21 @@ This function returns a svg with the exported elements.
|
||||
| exportBackground | boolean | true | Indicates whether background should be exported |
|
||||
| viewBackgroundColor | string | #fff | The default background color |
|
||||
| exportWithDarkMode | boolean | false | Indicates whether to export with dark mode |
|
||||
|
||||
### FONT_FAMILY
|
||||
|
||||
**_Signature_**
|
||||
|
||||
```js
|
||||
import { FONT_FAMILY } from "./constants";
|
||||
```
|
||||
|
||||
`FONT_FAMILY` contains all the font families used in `Excalidraw` as explained below
|
||||
|
||||
| Font Family | Description |
|
||||
| ----------- | -------------------- |
|
||||
| Virgil | The handwritten font |
|
||||
| Helvetica | The Normal Font |
|
||||
| Cacadia | The Code Font |
|
||||
|
||||
Defaults to `FONT_FAMILY.Virgil` unless passed in `initialData.appState.currentItemFontFamily`.
|
||||
|
@ -180,3 +180,4 @@ export {
|
||||
exportToSvg,
|
||||
} from "../../packages/utils";
|
||||
export { serializeAsJSON } from "../../data/json";
|
||||
export { FONT_FAMILY } from "../../constants";
|
||||
|
Reference in New Issue
Block a user