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:
Aakansha Doshi 2021-06-13 21:26:55 +05:30 committed by GitHub
parent 74a2f16501
commit 6dee02e320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 83 additions and 45 deletions

View file

@ -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.

View file

@ -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`.

View file

@ -180,3 +180,4 @@ export {
exportToSvg,
} from "../../packages/utils";
export { serializeAsJSON } from "../../data/json";
export { FONT_FAMILY } from "../../constants";