forked from b310-digital/excalidraw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: migrating dev docs to docusaurus :) (excalidraw#6073)
* docs: migrating existing docs to docosaraus :) * log broken links * lint :p * fix * divide the doc into diff categories * fix * order sidebars and more * fix lint * point to installation * making docs better :) * fix * renaming git * renaming git * fix links * fix * update readme * fix * resolve duplicate url and make /docs as base url * fix * move main docs as well * making docs better * support mdx * update og * fix title * upgrade docusarus to stable version * use draculla theme * fix * make entire sidebar collapsable * live editor for footer wohoo * render excalidraw only on client to fix the prod build * migrate MainMenu to live editor too :) * lint :p * cleanup integration and use live editor and tabs * fix * Add welcome screen doc * Live Collaboration comp docs * Add collaborator example * Add example * add more * remove isCollaborating * Rewrite ref and move to sidebar * change color of links inside pre * add initial data * fix lint * Add styling * fix lint * Add example for customizing styles * fix lint * fix * fix lint * Add link to livecollabtrigger * fix * rewrite UIOptions to sidebar * move initialdata to sidebar * move render props to sidebar and rewrite renderTopRightUI and renderCustomStats * rewrite renderSidebar * update og * update url for testing * fix url * update readme * fix style * tweaks * Add highlight comp to highlight text * Add bash syntax highlight * fix * tweaks * fix * rewrite export utilities * fix restore * rewrite utils * move constants to sidebar * update readme * add copyright * fix links style * Add linkedin * tweaks * rename package to @excalidraw/excalidraw * enable algolia with dummy creds * tweaks to integration doc * tweak WelcomeScreen docs to reflect upcoming API changes * tweak components intro * tweak nomenclature * fix admonition * rename `components` sidebar item and change order of components list * uncollapse package section in sidebar * show level 4 haeadings in TOC * remove algolia * remove unused assets * capitalize C * tweak * rename components to App * rename components -> children-components in the routes * move notable used tools to intro * update MainMenu docs with `onSelect` preventDefault behavior * change sidebar label for children components * use code * tweak README & docs intro * tweak package development doc * make scrollbar gutter stable * tweak api intro * add admonition for export utils * use next * wip * wip * make excalidraw examples use current color theme & prefer system * fix welcomescreen docs * use latest temp release * fix component order * revert wip changes * use next * tweak * increase height to fix welcome screen hint * tweak editor height * update excal version * wrap Excal with forwardRef to fix refs * migrate contributing.md * fix broken links --------- Co-authored-by: dwelle <[email protected]>
- Loading branch information
Showing
49 changed files
with
4,400 additions
and
2,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,3 @@ | ||
# Contributing | ||
|
||
## Setup | ||
|
||
### Option 1 - Manual | ||
|
||
1. Fork and clone the repo | ||
1. Run `yarn` to install dependencies | ||
1. Create a branch for your PR with `git checkout -b your-branch-name` | ||
|
||
> To keep `master` branch pointing to remote repository and make pull requests from branches on your fork. To do this, run: | ||
> | ||
> ```sh | ||
> git remote add upstream https://github.com/excalidraw/excalidraw.git | ||
> git fetch upstream | ||
> git branch --set-upstream-to=upstream/master master | ||
> ``` | ||
### Option 2 - CodeSandbox | ||
1. Go to https://codesandbox.io/s/github/excalidraw/excalidraw | ||
1. Connect your GitHub account | ||
1. Go to Git tab on left side | ||
1. Tap on `Fork Sandbox` | ||
1. Write your code | ||
1. Commit and PR automatically | ||
## Pull Request Guidelines | ||
Don't worry if you get any of the below wrong, or if you don't know how. We'll gladly help out. | ||
### Title | ||
Make sure the title starts with a semantic prefix: | ||
- **feat**: A new feature | ||
- **fix**: A bug fix | ||
- **docs**: Documentation only changes | ||
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | ||
- **refactor**: A code change that neither fixes a bug nor adds a feature | ||
- **perf**: A code change that improves performance | ||
- **test**: Adding missing tests or correcting existing tests | ||
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) | ||
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) | ||
- **chore**: Other changes that don't modify src or test files | ||
- **revert**: Reverts a previous commit | ||
### Changelog | ||
Add a brief description of your pull request to the changelog located here: [`src/packages/excalidraw/CHANGELOG.md`](src/packages/excalidraw/CHANGELOG.md) | ||
Notes: | ||
- Make sure to prepend to the section corresponding with the semantic prefix you selected in the title | ||
- Link to your pull request - this will require updating the CHANGELOG _after_ creating the pull request | ||
### Testing | ||
Once you submit your pull request it will automatically be tested. Be sure to check the results of the test and fix any issues that arise. | ||
It's also a good idea to consider if your change should include additional tests. This is highly recommended for new features or bug-fixes. For example, it's good practice to create a test for each bug you fix which ensures that we don't regress the code in the future. | ||
Finally - always manually test your changes using the convenient staging environment deployed for each pull request. As much as local development attempts to replicate production, there can still be subtle differences in behavior. For larger features consider testing your change in multiple browsers as well. | ||
Head over to the [docs](https://docs.excalidraw.com/docs/introduction/contributing) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,201 +1,44 @@ | ||
<div align="center" style="display:flex;flex-direction:column;"> | ||
<div align="center" style="display:flex;flex-direction:column;"}> | ||
<a href="https://excalidraw.com"> | ||
<img width="540" src="./public/og-image-sm.png" alt="Excalidraw logo: Sketch handrawn like diagrams." /> | ||
<img width="540" src="./public/og-image-sm.png" alt="Excalidraw logo: Sketch handrawn like diagrams."/> | ||
</a> | ||
<h3>Virtual whiteboard for sketching hand-drawn like diagrams.<br>Collaborative and end-to-end encrypted.</h3> | ||
<h3>Virtual whiteboard for sketching hand-drawn like diagrams.<br/>Collaborative and end-to-end encrypted.</h3> | ||
<p> | ||
<a href="https://twitter.com/Excalidraw"> | ||
<img alt="Follow Excalidraw on Twitter" src="https://img.shields.io/twitter/follow/excalidraw.svg?label=follow+excalidraw&style=social&logo=twitter"> | ||
<a href="https://twitter.com/excalidraw"> | ||
<img alt="Follow Excalidraw on Twitter" src="https://img.shields.io/twitter/follow/excalidraw.svg?label=follow+@excalidraw&style=social&logo=twitter"/> | ||
</a> | ||
<a target="_blank" href="https://crowdin.com/project/excalidraw"> | ||
<img src="https://badges.crowdin.net/excalidraw/localized.svg"> | ||
<a href="https://discord.gg/UexuTaE"> | ||
<img alt="Chat with us on Discord" src="https://img.shields.io/discord/723672430744174682?color=738ad6&label=Chat%20on%20Discord&logo=discord&logoColor=ffffff&widge=false"/> | ||
</a> | ||
</p> | ||
<p>Ask questions or hang out on our <a target="_blank" href="https://discord.gg/UexuTaE">discord.gg/UexuTaE</a>.</p> | ||
</div> | ||
|
||
## Try it now | ||
## Try now | ||
|
||
Go to [excalidraw.com](https://excalidraw.com) to start sketching. | ||
Visit [excalidraw.com](https://excalidraw.com) to start sketching. | ||
|
||
Read the latest news and updates on our [blog](https://blog.excalidraw.com). A good start is to see all the updates of [One Year of Excalidraw](https://blog.excalidraw.com/one-year-of-excalidraw/). | ||
## Community | ||
|
||
For latest updates, follow us on [twitter](https://twitter.com/excalidraw). If you need help or want to chat, join us on [Discord](https://discord.gg/UexuTaE). For releases and deep dives, check out our [blog](https://blog.excalidraw.com). Report bugs on [GitHub](https://github.com/excalidraw/excalidraw/issues). | ||
|
||
## Supporting Excalidraw | ||
|
||
If you like the project, you can become a sponsor at [Open Collective](https://opencollective.com/excalidraw). | ||
|
||
[<img src="https://opencollective.com/excalidraw/tiers/sponsors/0/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/0/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/1/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/1/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/2/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/2/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/3/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/3/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/4/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/4/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/5/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/5/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/6/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/6/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/7/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/7/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/8/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/8/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/9/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/9/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/10/avatar.svg?avatarHeight=120">](https://opencollective.com/excalidraw/tiers/sponsors/10/website) | ||
[<img src="https://opencollective.com/excalidraw/tiers/sponsors/0/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/0/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/1/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/1/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/2/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/2/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/3/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/3/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/4/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/4/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/5/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/5/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/6/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/6/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/7/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/7/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/8/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/8/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/9/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/9/website) [<img src="https://opencollective.com/excalidraw/tiers/sponsors/10/avatar.svg?avatarHeight=120"/>](https://opencollective.com/excalidraw/tiers/sponsors/10/website) | ||
|
||
<a href="https://opencollective.com/excalidraw#category-CONTRIBUTE" target="_blank"><img src="https://opencollective.com/excalidraw/tiers/backers.svg?avatarHeight=32"/></a> | ||
|
||
Last but not least, we're thankful to these companies for offering their services for free: | ||
|
||
[](https://vercel.com) [](https://sentry.io) [](https://crowdin.com) | ||
|
||
## Who's integrating Excalidraw | ||
|
||
[Google Cloud](https://googlecloudcheatsheet.withgoogle.com/architecture) • [Meta](https://meta.com/) • [CodeSandbox](https://codesandbox.io/) • [Obsidian Excalidraw](https://github.com/zsviczian/obsidian-excalidraw-plugin) • [Replit](https://replit.com/) • [Slite](https://slite.com/) • [Notion](https://notion.so/) • [HackerRank](https://www.hackerrank.com/) • | ||
|
||
## Documentation | ||
|
||
### Shortcuts | ||
|
||
You can almost do anything with shortcuts. Click on the help icon on the bottom right corner to see them all. | ||
|
||
### Curved lines and arrows | ||
|
||
Choose line or arrow and click click click instead of drag. | ||
|
||
### Charts | ||
|
||
You can easily create charts by copy pasting data from Excel or just plain comma separated text. | ||
|
||
### Translating | ||
|
||
To translate Excalidraw into other languages, please visit [our Crowdin page](https://crowdin.com/project/excalidraw). To add a new language, [open an issue](https://github.com/excalidraw/excalidraw/issues/new) so we can get things set up on our end first. | ||
|
||
Translations will be available on the app if they exceed a certain threshold of completion (currently 85%). | ||
|
||
### Create a collaboration session manually | ||
|
||
In order to create a session manually, you just need to generate a link of this form: | ||
|
||
``` | ||
https://excalidraw.com/#room=[0-9a-f]{20},[a-zA-Z0-9_-]{22} | ||
``` | ||
|
||
#### Example | ||
|
||
``` | ||
https://excalidraw.com/#room=91bd46ae3aa84dff9d20,pfLqgEoY1c2ioq8LmGwsFA | ||
``` | ||
|
||
The first set of digits is the room. This is visible from the server that’s going to dispatch messages to everyone that knows this number. | ||
|
||
The second set of digits is the encryption key. The Excalidraw server doesn’t know about it. This is what all the participants use to encrypt/decrypt the messages. | ||
|
||
> Note: Please ensure that the encryption key is 22 characters long. | ||
## Shape libraries | ||
|
||
Find a growing list of libraries containing assets for your drawings at [libraries.excalidraw.com](https://libraries.excalidraw.com). | ||
|
||
## Embedding Excalidraw in your App? | ||
|
||
Try out [`@excalidraw/excalidraw`](https://www.npmjs.com/package/@excalidraw/excalidraw). This package allows you to easily embed Excalidraw as a React component into your apps. | ||
|
||
## Development | ||
|
||
### Code Sandbox | ||
|
||
- Go to https://codesandbox.io/p/github/excalidraw/excalidraw | ||
- You may need to sign in with GitHub and reload the page | ||
- You can start coding instantly, and even send PRs from there! | ||
|
||
### Local Installation | ||
|
||
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. | ||
|
||
#### Requirements | ||
|
||
- [Node.js](https://nodejs.org/en/) | ||
- [Yarn](https://yarnpkg.com/getting-started/install) (v1 or v2.4.2+) | ||
- [Git](https://git-scm.com/downloads) | ||
|
||
#### Clone the repo | ||
## Developers | ||
|
||
```bash | ||
git clone https://github.com/excalidraw/excalidraw.git | ||
``` | ||
You can integrate Excalidraw into your app by installing our [npm component](https://npmjs.com/package/@excalidraw/excalidraw). | ||
|
||
#### Install the dependencies | ||
Visit our documentation on [https://docs.excalidraw.com](https://docs.excalidraw.com). | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
#### Start the server | ||
|
||
```bash | ||
yarn start | ||
``` | ||
|
||
Now you can open [http://localhost:3000](http://localhost:3000) and start coding in your favorite code editor. | ||
|
||
#### Collaboration | ||
|
||
For collaboration, you will need to set up [collab server](https://github.com/excalidraw/excalidraw-room) in local. | ||
|
||
#### Commands | ||
|
||
##### Install the dependencies | ||
|
||
``` | ||
yarn | ||
``` | ||
|
||
##### Run the project | ||
|
||
``` | ||
yarn start | ||
``` | ||
|
||
##### Reformat all files with Prettier | ||
|
||
``` | ||
yarn fix | ||
``` | ||
|
||
##### Run tests | ||
|
||
``` | ||
yarn test | ||
``` | ||
|
||
##### Update test snapshots | ||
|
||
``` | ||
yarn test:update | ||
``` | ||
|
||
##### Test for formatting with Prettier | ||
|
||
``` | ||
yarn test:code | ||
``` | ||
|
||
#### Docker Compose | ||
|
||
You can use docker-compose to work on Excalidraw locally if you don't want to setup a Node.js env. | ||
|
||
```sh | ||
docker-compose up --build -d | ||
``` | ||
|
||
### Self-hosting | ||
|
||
We publish a Docker image with the Excalidraw client at [excalidraw/excalidraw](https://hub.docker.com/r/excalidraw/excalidraw). You can use it to self-host your own client under your own domain, on Kubernetes, AWS ECS, etc. | ||
|
||
```sh | ||
docker build -t excalidraw/excalidraw . | ||
docker run --rm -dit --name excalidraw -p 5000:80 excalidraw/excalidraw:latest | ||
``` | ||
|
||
The Docker image is free of analytics and other tracking libraries. | ||
|
||
**At the moment, self-hosting your own instance doesn't support sharing or collaboration features.** | ||
|
||
We are working towards providing a full-fledged solution for self-hosting your own Excalidraw. | ||
|
||
## Contributing | ||
|
||
Pull requests are welcome. For major changes, please [open an issue](https://github.com/excalidraw/excalidraw/issues/new) first to discuss what you would like to change. | ||
|
||
## Notable used tools | ||
|
||
- [Create React App](https://github.com/facebook/create-react-app) | ||
- [Rough.js](https://roughjs.com) | ||
- [TypeScript](https://www.typescriptlang.org) | ||
- [Vercel](https://vercel.com) | ||
## Who's integrating Excalidraw | ||
|
||
And the main source of inspiration for starting the project is the awesome [Zwibbler](https://zwibbler.com/demo/) app. | ||
[Google Cloud](https://googlecloudcheatsheet.withgoogle.com/architecture) • [Meta](https://meta.com/) • [CodeSandbox](https://codesandbox.io/) • [Obsidian Excalidraw](https://github.com/zsviczian/obsidian-excalidraw-plugin) • [Replit](https://replit.com/) • [Slite](https://slite.com/) • [Notion](https://notion.so/) • [HackerRank](https://www.hackerrank.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
slug: /@excalidraw/excalidraw/api | ||
--- | ||
|
||
# API | ||
|
||
Currently the **API** is divided into 3 broad categories 👇 | ||
|
||
- [Props](/docs/@excalidraw/excalidraw/api/props) - The `props` you can pass to the `Excalidraw` component. | ||
- [Children components](/docs/@excalidraw/excalidraw/api/children-components) - Official components you can use to customize the UI. | ||
- [Utils](/docs/@excalidraw/excalidraw/api/utils) - Utilities and helpers you can use to export, restore and more. |
21 changes: 21 additions & 0 deletions
21
...cs/@excalidraw/excalidraw/api/children-components/children-components-intro.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
sidebar_label: Children Components | ||
slug: /@excalidraw/excalidraw/api/children-components | ||
--- | ||
|
||
# `<Excalidraw/>` children | ||
|
||
We expose several components you can render as children of the `<Excalidraw/>` component to customize the UI. | ||
|
||
:::info | ||
|
||
We have only recently started migrating to this type of component API. Some UI components are still using render props, and some UI customization isn't supported yet (such as the toolbar or the element properties panel). Stay tuned for more updates! | ||
|
||
::: | ||
|
||
Below are the currently supported components: | ||
|
||
- [MainMenu](/docs/@excalidraw/excalidraw/api/children-components/main-menu) | ||
- [WelcomeScreen](/docs/@excalidraw/excalidraw/api/children-components/welcome-screen) | ||
- [Footer](/docs/@excalidraw/excalidraw/api/children-components/footer) | ||
- [LiveCollaborationTrigger](/docs/@excalidraw/excalidraw/api/children-components/live-collaboration-trigger) |
69 changes: 69 additions & 0 deletions
69
dev-docs/docs/@excalidraw/excalidraw/api/children-components/footer.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Footer | ||
|
||
Earlier we were using `renderFooter` prop to render custom footer which was removed in [#5970](https://github.com/excalidraw/excalidraw/pull/5970). Now you can pass a `Footer` component instead to render the custom UI for footer. | ||
|
||
You will need to import the `Footer` component from the package and wrap your component with the Footer component. The `Footer` should a valid React Node. | ||
|
||
**Usage** | ||
|
||
```jsx live | ||
function App() { | ||
return ( | ||
<div style={{ height: "500px"}}> | ||
<Excalidraw> | ||
<Footer> | ||
<button | ||
className="custom-footer" | ||
onClick={() => alert("This is dummy footer")} | ||
> | ||
{" "} | ||
custom footer | ||
</button> | ||
</Footer> | ||
</Excalidraw> | ||
</div> | ||
); | ||
} | ||
``` | ||
|
||
This will only for `Desktop` devices. | ||
|
||
For `mobile` you will need to render it inside the [MainMenu](#mainmenu). You can use the [`useDevice`](#useDevice) hook to check the type of device, this will be available only inside the `children` of `Excalidraw` component. | ||
|
||
Open the `Menu` in the below playground and you will see the `custom footer` rendered. | ||
|
||
```jsx live noInline | ||
const MobileFooter = ({}) => { | ||
const device = useDevice(); | ||
if (device.isMobile) { | ||
return ( | ||
<Footer> | ||
<button | ||
className="custom-footer" | ||
style= {{ marginLeft: '20px', height: '2rem'}} | ||
onClick={() => alert("This is custom footer in mobile menu")} | ||
> | ||
custom footer | ||
</button> | ||
</Footer> | ||
); | ||
} | ||
return null; | ||
}; | ||
|
||
const App = () => ( | ||
<div style={{ height: "400px" }}> | ||
<Excalidraw> | ||
<MainMenu> | ||
<MainMenu.Item> Item1 </MainMenu.Item> | ||
<MainMenu.Item> Item 2 </MainMenu.Item> | ||
<MobileFooter /> | ||
</MainMenu> | ||
</Excalidraw> | ||
</div> | ||
); | ||
|
||
// Need to render when code is span across multiple components | ||
// in Live Code blocks editor | ||
render(<App />); | ||
``` |
Oops, something went wrong.