Skip to content

Commit baa1bda

Browse files
committed
add how it works page
1 parent 0bdca99 commit baa1bda

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/how-it-works.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
11
---
22
sidebar_position: 8
33
---
4-
# How it works
4+
5+
# How it works
6+
7+
drawDB is a simple ReactJS app. Below is a high-level overview of how things are constructed but generally if you're wondering how something works, the first thing that comes to mind is most probably it.
8+
9+
## Editor canvas
10+
11+
The canvas is a an `<svg/>` element and all interaction is handled through pointer events. The tables, areas, and notes are `<foreignObject/>` elements, relationships are `<path/>`-s which get calculated based on the start and end field coordinates and widths.
12+
13+
## Storing diagrams
14+
15+
The diagrams and tables get stored in the browser, specifically IndexedDB. Since everything is stored in the browser, before resetting or moving to a different browser, if you want to save your diagrams export them as JSON files.
16+
17+
In addition, when you share a diagram a gist gets created containing the diagram in JSON.
18+
19+
## Exporting
20+
21+
All export functions take the diagram and generate a string using predefined string templates.
22+
23+
## Importing
24+
25+
You can import diagrams from JSON or from SQL.
26+
27+
When you import from SQL the source code gets passed to a parser and then the resulting AST is used to construct a diagram object.
28+
29+
## Internationalization
30+
31+
i18n is used for internationalization. In order to add a new language, all you need to do is add `<your-language.js>` similar to [`en.js`](https://github.com/drawdb-io/drawdb/blob/main/src/i18n/locales/en.js) but with translated values in `src/i18n/locales`.
32+
33+
<br/>
34+
35+
P.S. if you have any questions hit me up on discord.

0 commit comments

Comments
 (0)