Compare commits

...

67 Commits

Author SHA1 Message Date
zsviczian 13309a66c5 Update textWysiwyg.tsx 2022-03-14 07:15:21 +01:00
zsviczian 531829d95e Update textWysiwyg.tsx 2022-03-14 07:11:12 +01:00
zsviczian d3cbceb7fa Update textWysiwyg.tsx 2022-03-13 23:45:03 +01:00
zsviczian 73111500d3 Update textWysiwyg.tsx 2022-03-13 23:43:03 +01:00
zsviczian 9e17b64e5e Update textWysiwyg.tsx 2022-03-13 23:38:54 +01:00
zsviczian 326da61573 Update textWysiwyg.tsx 2022-03-13 23:36:05 +01:00
zsviczian 994f2a3f1e Update textWysiwyg.tsx 2022-03-13 23:30:43 +01:00
zsviczian 5dbcf64353 Update textWysiwyg.tsx 2022-03-13 23:25:37 +01:00
zsviczian eda2320dae Update textWysiwyg.tsx 2022-03-13 23:17:19 +01:00
zsviczian b610c04481 Update textWysiwyg.tsx 2022-03-13 23:04:22 +01:00
zsviczian d969849357 Update textWysiwyg.tsx 2022-03-13 23:01:04 +01:00
zsviczian 9a66fc6c05 Update textWysiwyg.tsx 2022-03-13 22:49:14 +01:00
zsviczian 158f169c43 Update textWysiwyg.tsx 2022-03-13 22:28:37 +01:00
zsviczian ce27cb6159 Update textWysiwyg.tsx 2022-03-13 22:23:08 +01:00
zsviczian 2e04bcd485 Update textWysiwyg.tsx 2022-03-13 21:59:07 +01:00
zsviczian 7436f3926b debug iOS 2022-03-13 21:55:21 +01:00
zsviczian e429b7048d Update textWysiwyg.tsx 2022-03-11 13:44:25 +01:00
zsviczian e61b447413 Update textWysiwyg.tsx 2022-03-11 13:39:19 +01:00
zsviczian 73f0d854bf Update MobileMenu.tsx 2022-03-11 13:34:42 +01:00
zsviczian cec3cf8334 Update textWysiwyg.tsx 2022-03-11 13:33:15 +01:00
zsviczian 8640e75ccf Update constants.ts 2022-03-11 13:28:21 +01:00
zsviczian ca7ce64fea Update MobileMenu.tsx 2022-03-11 12:02:07 +01:00
zsviczian e3a78fe5df Update MobileMenu.tsx 2022-03-11 11:49:18 +01:00
zsviczian 554985f749 Update MobileMenu.tsx 2022-03-11 11:46:53 +01:00
zsviczian d3857fbb35 Update MobileMenu.tsx 2022-03-11 11:41:49 +01:00
zsviczian 93c72cbb32 Update MobileMenu.tsx 2022-03-11 11:21:55 +01:00
zsviczian aeb4d39387 Update MobileMenu.tsx 2022-03-11 11:18:20 +01:00
zsviczian a0259360d6 Update MobileMenu.tsx 2022-03-11 11:15:24 +01:00
zsviczian 243d8de7a8 Update MobileMenu.tsx 2022-03-11 11:12:50 +01:00
zsviczian 81c927bab6 Update MobileMenu.tsx 2022-03-11 11:07:28 +01:00
Excalidraw Bot 5c0eff50a0 chore: Update translations from Crowdin (#4729)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-03-09 12:21:26 +01:00
Milos Vetesnik 19056d635b feat: added optional REACT_APP_WS_SERVER_URL for forks usecases (#4889)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-03-09 12:13:59 +01:00
Tom Milligan 4d5f00ff08 fix: don't crash on drop highlighted text onto canvas (#4890) 2022-03-09 11:51:13 +01:00
David Luzar 20de06ef50 fix: paste styles shortcut (#4886)
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
2022-03-09 10:59:44 +01:00
zsviczian 1849ff6ee2 fix: freedraw element's background fill color missing from SVG when exporting with package API exportToSvg() (#4871) 2022-03-06 23:35:16 +01:00
Milos Vetesnik 6765fc16be fix: improve pointer syncing performance (#4883)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-03-06 22:11:14 +00:00
Milos Vetesnik 5ca4f5bbf4 feat: rewrite collab server connecting (#4881)
Co-authored-by: dwelle <luzar.david@gmail.com>
2022-03-06 22:43:02 +01:00
David Luzar 9392ec276d fix: collab room initialization (#4882) 2022-03-06 15:59:56 +01:00
Aakansha Doshi b26e4fcf99 build: support runtime React Jsx in @excalidraw/utils (#4866)
* build: support runtime React Jsx

* revert version

* upgrade
2022-03-04 10:58:02 +05:30
David Luzar 45f3410da8 build: release @excalidraw/utils 0.1.1 (#4862) 2022-03-03 14:59:08 +01:00
David Luzar 94b387ef7b fix: ensure verticalAlign properties not shown when no element selected (#4860)
* fix: ensure verticalAlign properties not shown when no element selected

* show verticalAlign prop if selection contains at least one applicable element

* simplify
2022-03-02 23:56:20 +01:00
David Luzar 6d0716eb6b fix: binding text to non-bindable containers and not always preferring selection (#4655) 2022-03-02 17:04:09 +01:00
Aakansha Doshi 8e26d5b500 feat: support vertical text align for bound containers (#4852)
* feat: support vertical text align for bound containers

* update icons

* use const

* fix lint

* rename to  and show when text editor active

* don't update vertical align if not center

* fix svgs

* fix y coords when vertical align bottm

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-03-02 20:06:07 +05:30
luzpaz c5a7723185 chore: fix various typos (#4857)
Found via `codespell -q 3 -S ./src/locales,./yarn.lock,./src/packages/excalidraw/yarn.lock -L afterall,doubleclick,originaly,reenable,whats,sur`
2022-03-02 11:37:12 +05:30
Aakansha Doshi 49172ac2d3 feat: support custom colors 🎉 (#4843)
* feat: support custom colors 🎉

* remove canvasBackground

* fix tests

* Remove custom color when elements deleted

* persist custom color across sessions

* Choose 5 latest custom colors when populating from elements

* fix tests

* styling

* don't use up/down arrow for custom colors

* Always push latest color to the begining

* don't check if valid in custom color

* calculate custom colors on color picker open

* revert unnecessary changes

* remove newlines

* simplify state

* tweak label

* fix custom color shortcuts throwing if color not exists

* fix

* early return

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-02-28 19:04:26 +05:30
David Luzar 618a846451 chore: remove firebase-tools (#4792) 2022-02-28 10:54:20 +01:00
Aakansha Doshi d9f49ffd67 fix: Don't show align icons for single bound container element (#4846)
* fix: Don't show align icons for single bound container element

* check 2nd element as well
2022-02-28 11:08:28 +05:30
Jesse Jurman 46e43baad1 feat: Support Links in Exported SVG (#4791) 2022-02-25 21:42:10 +01:00
Aakansha Doshi bd35b682fa fix: redraw text bounding box when pasting styles (#4845) 2022-02-25 15:36:56 +05:30
David Luzar b6f9a8005e docs: list who's integrating excalidraw (#4832)
* docs: list who's integrating excalidraw

* Update README.md
2022-02-23 23:28:17 +01:00
Aakansha Doshi 1acfaf6b6e feat: Scale font size when bound text containers resized with shift pressed (#4828)
* feat: Scale font size when bound text containers resized with shift pressed

* revert fontsize once shift pressed/released after resize

* make slightly more typesafe

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-02-22 18:45:59 +05:30
Aakansha Doshi 5cf7087754 fix: restore cursor position after bound text container value updated (#4836)
* fix: restore cursor position after bound text container value updated

* only restore cursor when the cursor is not at the end of the line

* compute diff before setting the cursor
2022-02-22 18:24:06 +05:30
Aakansha Doshi b2d49155ef build:remove build packages workflow (#4835) 2022-02-22 13:50:25 +05:30
dependabot[bot] 9745461db7 chore(deps): bump browser-fs-access from 0.23.0 to 0.24.1 (#4820)
Bumps [browser-fs-access](https://github.com/GoogleChromeLabs/browser-fs-access) from 0.23.0 to 0.24.1.
- [Release notes](https://github.com/GoogleChromeLabs/browser-fs-access/releases)
- [Commits](https://github.com/GoogleChromeLabs/browser-fs-access/compare/v0.23.0...v0.24.1)

---
updated-dependencies:
- dependency-name: browser-fs-access
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-22 13:26:53 +05:30
Aakansha Doshi 21e9fcb2f5 chore: Add tracking for hyperlinks (#4703)
* chore: Add tracking for hyperlinks

* update

* fix

* remove

* tweak

* disable ga logging in dev again

* add logging for hyperlink `edit` & support for tracking in manager

* event label tweaks

* fix tests & make more typesafe

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-02-21 17:44:28 +05:30
Aakansha Doshi e203203993 refactor: don't pass array to handleBindTextResize (#4826) 2022-02-21 17:15:29 +05:30
Aakansha Doshi f224e4d596 fix: support resizing multiple bound text containers (#4824) 2022-02-21 16:46:39 +05:30
dependabot[bot] e0ca689759 chore(deps): bump url-parse from 1.5.3 to 1.5.7 (#4807)
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.5.3 to 1.5.7.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](https://github.com/unshiftio/url-parse/compare/1.5.3...1.5.7)

---
updated-dependencies:
- dependency-name: url-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-19 15:16:30 +05:30
Andelf f792eb5ae7 fix: also check overflowY: overlay in detectScroll (#4806)
* fix: also check overflowY: overlay in detectScroll

* fix lint

Co-authored-by: dwelle <luzar.david@gmail.com>
2022-02-18 19:17:43 +01:00
Aakansha Doshi 4604c8d823 fix: stuck resizing when resizing bound text container very fast beyond threshold (#4804)
* fix: stuck resizing when resizing bound text container very fast beyond threshold

* fix

* fix
2022-02-18 18:20:55 +05:30
Aakansha Doshi 0896892f8a docs: release @excalidraw/excalidraw@0.11.0 🎉 (#4799)
* docs: release @excalidraw/excalidraw@0.11.0  🎉

* Add commit link for bad commits
2022-02-17 18:52:44 +05:30
Aakansha Doshi 7fe225ee99 fix: rename --color-primary-chubb to --color-primary-contrast-offset and fallback to primary color if not present (#4803)
* fix: fallback to primary color if --color-primary-chubb not present

* rename to --color-primary-contrast-offset

* use contarst-offset

Co-authored-by: David Luzar <luzar.david@gmail.com>

* Update src/packages/excalidraw/README_NEXT.md

* remove

* Update src/packages/excalidraw/README_NEXT.md

Co-authored-by: David Luzar <luzar.david@gmail.com>

Co-authored-by: David Luzar <luzar.david@gmail.com>
2022-02-17 18:22:19 +05:30
Aakansha Doshi d2fd7be457 fix: add commits directly pushed to master in changelog (#4798) 2022-02-16 21:01:59 +05:30
David Luzar 5c61613a2e fix: don't bump element version when adding files data (#4794)
* fix: don't bump element version when adding files data

* fix lint
2022-02-16 18:26:36 +05:30
Aakansha Doshi b2767924de feat: show group/group and link action in mobile (#4795) 2022-02-16 15:41:35 +05:30
dependabot[bot] 59d0a77862 chore(deps): bump @types/react from 17.0.38 to 17.0.39 (#4757)
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 17.0.38 to 17.0.39.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-16 13:59:14 +05:30
Aakansha Doshi 987526d1e5 docs: tweak documentation for release and add examples (#4786)
* docs: tweak documentation for release

* Add image in initial data

* Add image

* remove watermark and make export work

* update readme
2022-02-15 19:13:46 +05:30
130 changed files with 3139 additions and 3472 deletions
+5 -1
View File
@@ -4,5 +4,9 @@ REACT_APP_BACKEND_V2_POST_URL=https://json-dev.excalidraw.com/api/v2/post/
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com
REACT_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
REACT_APP_SOCKET_SERVER_URL=http://localhost:3002
REACT_APP_PORTAL_URL=http://localhost:3002
# Fill to set socket server URL used for collaboration.
# Meant for forks only: excalidraw.com uses custom REACT_APP_PORTAL_URL flow
REACT_APP_WS_SERVER_URL=
REACT_APP_FIREBASE_CONFIG='{"apiKey":"AIzaSyCMkxA60XIW8KbqMYL7edC4qT5l4qHX2h8","authDomain":"excalidraw-oss-dev.firebaseapp.com","projectId":"excalidraw-oss-dev","storageBucket":"excalidraw-oss-dev.appspot.com","messagingSenderId":"664559512677","appId":"1:664559512677:web:a385181f2928d328a7aa8c"}'
+5 -1
View File
@@ -4,7 +4,11 @@ REACT_APP_BACKEND_V2_POST_URL=https://json.excalidraw.com/api/v2/post/
REACT_APP_LIBRARY_URL=https://libraries.excalidraw.com
REACT_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
REACT_APP_SOCKET_SERVER_URL=https://oss-collab-us1.excalidraw.com
REACT_APP_PORTAL_URL=https://portal.excalidraw.com
# Fill to set socket server URL used for collaboration.
# Meant for forks only: excalidraw.com uses custom REACT_APP_PORTAL_URL flow
REACT_APP_WS_SERVER_URL=
REACT_APP_FIREBASE_CONFIG='{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}'
# production-only vars
-29
View File
@@ -1,29 +0,0 @@
name: Build packages
on:
push:
branches:
- master
pull_request:
jobs:
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn --cwd src/packages/excalidraw
yarn --cwd src/packages/utils
- name: Build @excalidraw/excalidraw
run: |
yarn --cwd src/packages/excalidraw run pack
- name: Build @excalidraw/utils
run: |
yarn --cwd src/packages/utils run pack
+4
View File
@@ -32,6 +32,10 @@ Last but not least, we're thankful to these companies for offering their service
[![Vercel](./.github/assets/vercel.svg)](https://vercel.com) [![Sentry](./.github/assets/sentry.svg)](https://sentry.io) [![Crowdin](./.github/assets/crowdin.svg)](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
+2 -3
View File
@@ -26,10 +26,10 @@
"@tldraw/vec": "1.4.3",
"@types/jest": "27.4.0",
"@types/pica": "5.1.3",
"@types/react": "17.0.38",
"@types/react": "17.0.39",
"@types/react-dom": "17.0.11",
"@types/socket.io-client": "1.4.36",
"browser-fs-access": "0.23.0",
"browser-fs-access": "0.24.1",
"clsx": "1.1.1",
"fake-indexeddb": "3.1.7",
"firebase": "8.3.3",
@@ -65,7 +65,6 @@
"dotenv": "10.0.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "3.3.1",
"firebase-tools": "9.23.0",
"husky": "7.0.4",
"jest-canvas-mock": "2.3.1",
"lint-staged": "12.3.3",
-6
View File
@@ -72,12 +72,6 @@
crossorigin="anonymous"
/>
<link
href="%REACT_APP_SOCKET_SERVER_URL%/socket.io"
rel="preconnect"
crossorigin="anonymous"
/>
<link
rel="manifest"
href="manifest.json"
+18 -11
View File
@@ -20,7 +20,7 @@ const headerForType = {
perf: "Performance",
build: "Build",
};
const badCommits = [];
const getCommitHashForLastVersion = async () => {
try {
const commitMessage = `"release @excalidraw/excalidraw@${lastVersion}"`;
@@ -53,19 +53,26 @@ const getLibraryCommitsSinceLastRelease = async () => {
const messageWithoutType = commit.slice(indexOfColon + 1).trim();
const messageWithCapitalizeFirst =
messageWithoutType.charAt(0).toUpperCase() + messageWithoutType.slice(1);
const prNumber = commit.match(/\(#([0-9]*)\)/)[1];
const prMatch = commit.match(/\(#([0-9]*)\)/);
if (prMatch) {
const prNumber = prMatch[1];
// return if the changelog already contains the pr number which would happen for package updates
if (existingChangeLog.includes(prNumber)) {
return;
// return if the changelog already contains the pr number which would happen for package updates
if (existingChangeLog.includes(prNumber)) {
return;
}
const prMarkdown = `[#${prNumber}](https://github.com/excalidraw/excalidraw/pull/${prNumber})`;
const messageWithPRLink = messageWithCapitalizeFirst.replace(
/\(#[0-9]*\)/,
prMarkdown,
);
commitList[type].push(messageWithPRLink);
} else {
badCommits.push(commit);
commitList[type].push(messageWithCapitalizeFirst);
}
const prMarkdown = `[#${prNumber}](https://github.com/excalidraw/excalidraw/pull/${prNumber})`;
const messageWithPRLink = messageWithCapitalizeFirst.replace(
/\(#[0-9]*\)/,
prMarkdown,
);
commitList[type].push(messageWithPRLink);
});
console.info("Bad commits:", badCommits);
return commitList;
};
+3 -1
View File
@@ -26,7 +26,7 @@ export const actionChangeViewBackgroundColor = register({
commitToHistory: !!value.viewBackgroundColor,
};
},
PanelComponent: ({ appState, updateData }) => {
PanelComponent: ({ elements, appState, updateData }) => {
return (
<div style={{ position: "relative" }}>
<ColorPicker
@@ -39,6 +39,8 @@ export const actionChangeViewBackgroundColor = register({
updateData({ openPopup: active ? "canvasColorPicker" : null })
}
data-testid="canvas-background-picker"
elements={elements}
appState={appState}
/>
</div>
);
+5 -3
View File
@@ -7,7 +7,7 @@ import { distributeElements, Distribution } from "../disitrubte";
import { getNonDeletedElements } from "../element";
import { ExcalidrawElement } from "../element/types";
import { t } from "../i18n";
import { CODES } from "../keys";
import { CODES, KEYS } from "../keys";
import { getSelectedElements, isSomeElementSelected } from "../scene";
import { AppState } from "../types";
import { arrayToMap, getShortcutKey } from "../utils";
@@ -49,7 +49,8 @@ export const distributeHorizontally = register({
commitToHistory: true,
};
},
keyTest: (event) => event.altKey && event.code === CODES.H,
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.H,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
@@ -77,7 +78,8 @@ export const distributeVertically = register({
commitToHistory: true,
};
},
keyTest: (event) => event.altKey && event.code === CODES.V,
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.V,
PanelComponent: ({ elements, appState, updateData }) => (
<ToolButton
hidden={!enableActionGroup(elements, appState)}
+1 -1
View File
@@ -155,7 +155,7 @@ const flipElement = (
// calculate new x-coord for transformation
newNCoordsX = usingNWHandle ? element.x + 2 * width : element.x - 2 * width;
resizeSingleElement(
element,
new Map().set(element.id, element),
true,
element,
usingNWHandle ? "nw" : "ne",
+118 -39
View File
@@ -30,11 +30,15 @@ import {
TextAlignCenterIcon,
TextAlignLeftIcon,
TextAlignRightIcon,
TextAlignTopIcon,
TextAlignBottomIcon,
TextAlignMiddleIcon,
} from "../components/icons";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
FONT_FAMILY,
VERTICAL_ALIGN,
} from "../constants";
import {
getNonDeletedElements,
@@ -58,6 +62,7 @@ import {
ExcalidrawTextElement,
FontFamilyValues,
TextAlign,
VerticalAlign,
} from "../element/types";
import { getLanguage, t } from "../i18n";
import { KEYS } from "../keys";
@@ -233,6 +238,8 @@ export const actionChangeStrokeColor = register({
setActive={(active) =>
updateData({ openPopup: active ? "strokeColorPicker" : null })
}
elements={elements}
appState={appState}
/>
</>
),
@@ -273,6 +280,8 @@ export const actionChangeBackgroundColor = register({
setActive={(active) =>
updateData({ openPopup: active ? "backgroundColorPicker" : null })
}
elements={elements}
appState={appState}
/>
</>
),
@@ -709,9 +718,7 @@ export const actionChangeTextAlign = register({
if (isTextElement(oldElement)) {
const newElement: ExcalidrawTextElement = newElementWith(
oldElement,
{
textAlign: value,
},
{ textAlign: value },
);
redrawTextBoundingBox(
newElement,
@@ -732,47 +739,119 @@ export const actionChangeTextAlign = register({
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => (
<fieldset>
<legend>{t("labels.textAlign")}</legend>
<ButtonIconSelect<TextAlign | false>
group="text-align"
options={[
{
value: "left",
text: t("labels.left"),
icon: <TextAlignLeftIcon theme={appState.theme} />,
},
{
value: "center",
text: t("labels.center"),
icon: <TextAlignCenterIcon theme={appState.theme} />,
},
{
value: "right",
text: t("labels.right"),
icon: <TextAlignRightIcon theme={appState.theme} />,
},
]}
value={getFormValue(
elements,
appState,
(element) => {
if (isTextElement(element)) {
return element.textAlign;
PanelComponent: ({ elements, appState, updateData }) => {
return (
<fieldset>
<legend>{t("labels.textAlign")}</legend>
<ButtonIconSelect<TextAlign | false>
group="text-align"
options={[
{
value: "left",
text: t("labels.left"),
icon: <TextAlignLeftIcon theme={appState.theme} />,
},
{
value: "center",
text: t("labels.center"),
icon: <TextAlignCenterIcon theme={appState.theme} />,
},
{
value: "right",
text: t("labels.right"),
icon: <TextAlignRightIcon theme={appState.theme} />,
},
]}
value={getFormValue(
elements,
appState,
(element) => {
if (isTextElement(element)) {
return element.textAlign;
}
const boundTextElement = getBoundTextElement(element);
if (boundTextElement) {
return boundTextElement.textAlign;
}
return null;
},
appState.currentItemTextAlign,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
);
},
});
export const actionChangeVerticalAlign = register({
name: "changeVerticalAlign",
perform: (elements, appState, value) => {
return {
elements: changeProperty(
elements,
appState,
(oldElement) => {
if (isTextElement(oldElement)) {
const newElement: ExcalidrawTextElement = newElementWith(
oldElement,
{ verticalAlign: value },
);
redrawTextBoundingBox(
newElement,
getContainerElement(oldElement),
appState,
);
return newElement;
}
return oldElement;
},
true,
),
appState: {
...appState,
},
commitToHistory: true,
};
},
PanelComponent: ({ elements, appState, updateData }) => {
return (
<fieldset>
<ButtonIconSelect<VerticalAlign | false>
group="text-align"
options={[
{
value: VERTICAL_ALIGN.TOP,
text: t("labels.alignTop"),
icon: <TextAlignTopIcon theme={appState.theme} />,
},
{
value: VERTICAL_ALIGN.MIDDLE,
text: t("labels.centerVertically"),
icon: <TextAlignMiddleIcon theme={appState.theme} />,
},
{
value: VERTICAL_ALIGN.BOTTOM,
text: t("labels.alignBottom"),
icon: <TextAlignBottomIcon theme={appState.theme} />,
},
]}
value={getFormValue(elements, appState, (element) => {
if (isTextElement(element) && element.containerId) {
return element.verticalAlign;
}
const boundTextElement = getBoundTextElement(element);
if (boundTextElement) {
return boundTextElement.textAlign;
return boundTextElement.verticalAlign;
}
return null;
},
appState.currentItemTextAlign,
)}
onChange={(value) => updateData(value)}
/>
</fieldset>
),
})}
onChange={(value) => updateData(value)}
/>
</fieldset>
);
},
});
export const actionChangeSharpness = register({
+71
View File
@@ -0,0 +1,71 @@
import ExcalidrawApp from "../excalidraw-app";
import { t } from "../i18n";
import { CODES } from "../keys";
import { API } from "../tests/helpers/api";
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
import { fireEvent, render, screen } from "../tests/test-utils";
import { copiedStyles } from "./actionStyles";
const { h } = window;
const mouse = new Pointer("mouse");
describe("actionStyles", () => {
beforeEach(async () => {
await render(<ExcalidrawApp />);
});
it("should copy & paste styles via keyboard", () => {
UI.clickTool("rectangle");
mouse.down(10, 10);
mouse.up(20, 20);
UI.clickTool("rectangle");
mouse.down(10, 10);
mouse.up(20, 20);
// Change some styles of second rectangle
UI.clickLabeledElement("Stroke");
UI.clickLabeledElement(t("colors.c92a2a"));
UI.clickLabeledElement("Background");
UI.clickLabeledElement(t("colors.e64980"));
// Fill style
fireEvent.click(screen.getByTitle("Cross-hatch"));
// Stroke width
fireEvent.click(screen.getByTitle("Bold"));
// Stroke style
fireEvent.click(screen.getByTitle("Dotted"));
// Roughness
fireEvent.click(screen.getByTitle("Cartoonist"));
// Opacity
fireEvent.change(screen.getByLabelText("Opacity"), {
target: { value: "60" },
});
mouse.reset();
API.setSelectedElements([h.elements[1]]);
Keyboard.withModifierKeys({ ctrl: true, alt: true }, () => {
Keyboard.codeDown(CODES.C);
});
const secondRect = JSON.parse(copiedStyles);
expect(secondRect.id).toBe(h.elements[1].id);
mouse.reset();
// Paste styles to first rectangle
API.setSelectedElements([h.elements[0]]);
Keyboard.withModifierKeys({ ctrl: true, alt: true }, () => {
Keyboard.codeDown(CODES.V);
});
const firstRect = API.getSelectedElement();
expect(firstRect.id).toBe(h.elements[0].id);
expect(firstRect.strokeColor).toBe("#c92a2a");
expect(firstRect.backgroundColor).toBe("#e64980");
expect(firstRect.fillStyle).toBe("cross-hatch");
expect(firstRect.strokeWidth).toBe(2); // Bold: 2
expect(firstRect.strokeStyle).toBe("dotted");
expect(firstRect.roughness).toBe(2); // Cartoonist: 2
expect(firstRect.opacity).toBe(60);
});
});
+2 -2
View File
@@ -64,8 +64,8 @@ export const actionPasteStyles = register({
});
redrawTextBoundingBox(
element,
getContainerElement(element),
newElement,
getContainerElement(newElement),
appState,
);
}
+1
View File
@@ -17,6 +17,7 @@ export {
actionChangeFontSize,
actionChangeFontFamily,
actionChangeTextAlign,
actionChangeVerticalAlign,
} from "./actionProperties";
export {
+37 -1
View File
@@ -10,6 +10,31 @@ import {
import { ExcalidrawElement } from "../element/types";
import { AppClassProperties, AppState } from "../types";
import { MODES } from "../constants";
import { trackEvent } from "../analytics";
const trackAction = (
action: Action,
source: "ui" | "keyboard" | "api",
value: any,
) => {
if (action.trackEvent !== false) {
try {
if (action.trackEvent === true) {
trackEvent(
action.name,
source,
typeof value === "number" || typeof value === "string"
? String(value)
: undefined,
);
} else {
action.trackEvent?.(action, source, value);
}
} catch (error) {
console.error("error while logging action:", error);
}
}
};
export class ActionManager implements ActionsManagerInterface {
actions = {} as ActionsManagerInterface["actions"];
@@ -65,9 +90,15 @@ export class ActionManager implements ActionsManagerInterface {
),
);
if (data.length === 0) {
if (data.length !== 1) {
if (data.length > 1) {
console.warn("Canceling as multiple actions match this shortcut", data);
}
return false;
}
const action = data[0];
const { viewModeEnabled } = this.getAppState();
if (viewModeEnabled) {
if (!Object.values(MODES).includes(data[0].name)) {
@@ -75,6 +106,8 @@ export class ActionManager implements ActionsManagerInterface {
}
}
trackAction(action, "keyboard", null);
event.preventDefault();
this.updater(
data[0].perform(
@@ -96,6 +129,7 @@ export class ActionManager implements ActionsManagerInterface {
this.app,
),
);
trackAction(action, "api", null);
}
/**
@@ -122,6 +156,8 @@ export class ActionManager implements ActionsManagerInterface {
this.app,
),
);
trackAction(action, "ui", formState);
};
return (
+7 -4
View File
@@ -1,8 +1,10 @@
import { t } from "../i18n";
import { isDarwin } from "../keys";
import { getShortcutKey } from "../utils";
import { ActionName } from "./types";
export type ShortcutName =
export type ShortcutName = SubtypeOf<
ActionName,
| "cut"
| "copy"
| "paste"
@@ -26,7 +28,8 @@ export type ShortcutName =
| "viewMode"
| "flipHorizontal"
| "flipVertical"
| "link";
| "hyperlink"
>;
const shortcutMap: Record<ShortcutName, string[]> = {
cut: [getShortcutKey("CtrlOrCmd+X")],
@@ -63,11 +66,11 @@ const shortcutMap: Record<ShortcutName, string[]> = {
flipHorizontal: [getShortcutKey("Shift+H")],
flipVertical: [getShortcutKey("Shift+V")],
viewMode: [getShortcutKey("Alt+R")],
link: [getShortcutKey("CtrlOrCmd+K")],
hyperlink: [getShortcutKey("CtrlOrCmd+K")],
};
export const getShortcutFromShortcutName = (name: ShortcutName) => {
const shortcuts = shortcutMap[name];
// if multiple shortcuts availiable, take the first one
// if multiple shortcuts available, take the first one
return shortcuts && shortcuts.length > 0 ? shortcuts[0] : "";
};
+5 -1
View File
@@ -82,6 +82,7 @@ export type ActionName =
| "zoomToSelection"
| "changeFontFamily"
| "changeTextAlign"
| "changeVerticalAlign"
| "toggleFullScreen"
| "toggleShortcuts"
| "group"
@@ -105,7 +106,7 @@ export type ActionName =
| "increaseFontSize"
| "decreaseFontSize"
| "unbindText"
| "link";
| "hyperlink";
export type PanelComponentProps = {
elements: readonly ExcalidrawElement[];
@@ -136,6 +137,9 @@ export interface Action {
appState: AppState,
) => boolean;
checked?: (appState: Readonly<AppState>) => boolean;
trackEvent?:
| boolean
| ((action: Action, type: "ui" | "keyboard" | "api", value: any) => void);
}
export interface ActionsManagerInterface {
+5 -5
View File
@@ -3,16 +3,16 @@ export const trackEvent =
process.env?.REACT_APP_GOOGLE_ANALYTICS_ID &&
typeof window !== "undefined" &&
window.gtag
? (category: string, name: string, label?: string, value?: number) => {
window.gtag("event", name, {
? (category: string, action: string, label?: string, value?: number) => {
window.gtag("event", action, {
event_category: category,
event_label: label,
value,
});
}
: typeof process !== "undefined" && process.env?.JEST_WORKER_ID
? (category: string, name: string, label?: string, value?: number) => {}
: (category: string, name: string, label?: string, value?: number) => {
? (category: string, action: string, label?: string, value?: number) => {}
: (category: string, action: string, label?: string, value?: number) => {
// Uncomment the next line to track locally
// console.info("Track Event", category, name, label, value);
// console.info("Track Event", category, action, label, value);
};
+8 -3
View File
@@ -1,5 +1,10 @@
import colors from "./colors";
import { DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, ENV } from "./constants";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
ENV,
VERTICAL_ALIGN,
} from "./constants";
import { newElement, newLinearElement, newTextElement } from "./element";
import { NonDeletedExcalidrawElement } from "./element/types";
import { randomId } from "./random";
@@ -103,7 +108,7 @@ const transposeCells = (cells: string[][]) => {
};
export const tryParseSpreadsheet = (text: string): ParseSpreadsheetResult => {
// Copy/paste from excel, spreadhseets, tsv, csv.
// Copy/paste from excel, spreadsheets, tsv, csv.
// For now we only accept 2 columns with an optional header
// Check for tab separated values
@@ -161,7 +166,7 @@ const commonProps = {
strokeSharpness: "sharp",
strokeStyle: "solid",
strokeWidth: 1,
verticalAlign: "middle",
verticalAlign: VERTICAL_ALIGN.MIDDLE,
} as const;
const getChartDimentions = (spreadsheet: Spreadsheet) => {
+1 -1
View File
@@ -124,7 +124,7 @@ const getSystemClipboard = async (
};
/**
* Attemps to parse clipboard. Prefers system clipboard.
* Attempts to parse clipboard. Prefers system clipboard.
*/
export const parseClipboard = async (
event: ClipboardEvent | null,
+19 -5
View File
@@ -19,6 +19,7 @@ import { capitalizeString, isTransparent, setCursorForShape } from "../utils";
import Stack from "./Stack";
import { ToolButton } from "./ToolButton";
import { hasStrokeColor } from "../scene/comparisons";
import { hasBoundTextElement, isBoundToContainer } from "../element/typeChecks";
export const SelectedShapeActions = ({
appState,
@@ -35,6 +36,15 @@ export const SelectedShapeActions = ({
getNonDeletedElements(elements),
appState,
);
let isSingleElementBoundContainer = false;
if (
targetElements.length === 2 &&
(hasBoundTextElement(targetElements[0]) ||
hasBoundTextElement(targetElements[1]))
) {
isSingleElementBoundContainer = true;
}
const isEditing = Boolean(appState.editingElement);
const isMobile = useIsMobile();
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
@@ -100,6 +110,10 @@ export const SelectedShapeActions = ({
</>
)}
{targetElements.some(
(element) =>
hasBoundTextElement(element) || isBoundToContainer(element),
) && renderAction("changeVerticalAlign")}
{(canHaveArrowheads(elementType) ||
targetElements.some((element) => canHaveArrowheads(element.type))) && (
<>{renderAction("changeArrowhead")}</>
@@ -117,7 +131,7 @@ export const SelectedShapeActions = ({
</div>
</fieldset>
{targetElements.length > 1 && (
{targetElements.length > 1 && !isSingleElementBoundContainer && (
<fieldset>
<legend>{t("labels.align")}</legend>
<div className="buttonList">
@@ -150,15 +164,15 @@ export const SelectedShapeActions = ({
</div>
</fieldset>
)}
{!isMobile && !isEditing && targetElements.length > 0 && (
{!isEditing && targetElements.length > 0 && (
<fieldset>
<legend>{t("labels.actions")}</legend>
<div className="buttonList">
{renderAction("duplicateSelection")}
{renderAction("deleteSelectedElements")}
{!isMobile && renderAction("duplicateSelection")}
{!isMobile && renderAction("deleteSelectedElements")}
{renderAction("group")}
{renderAction("ungroup")}
{targetElements.length === 1 && renderAction("link")}
{targetElements.length === 1 && renderAction("hyperlink")}
</div>
</fieldset>
)}
+45 -44
View File
@@ -69,6 +69,7 @@ import {
TOUCH_CTX_MENU_TIMEOUT,
URL_HASH_KEYS,
URL_QUERY_KEYS,
VERTICAL_ALIGN,
ZOOM_STEP,
} from "../constants";
import { loadFromBlob } from "../data";
@@ -115,11 +116,7 @@ import {
updateBoundElements,
} from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
bumpVersion,
mutateElement,
newElementWith,
} from "../element/mutateElement";
import { mutateElement, newElementWith } from "../element/mutateElement";
import { deepCopyElement, newFreeDrawElement } from "../element/newElement";
import {
hasBoundTextElement,
@@ -130,6 +127,7 @@ import {
isInitializedImageElement,
isLinearElement,
isLinearElementType,
isTextBindableContainer,
} from "../element/typeChecks";
import {
ExcalidrawBindableElement,
@@ -143,6 +141,7 @@ import {
ExcalidrawImageElement,
FileId,
NonDeletedExcalidrawElement,
ExcalidrawTextContainer,
} from "../element/types";
import { getCenter, getDistance } from "../gesture";
import {
@@ -170,7 +169,7 @@ import { renderScene } from "../renderer";
import { invalidateShapeForElement } from "../renderer/renderElement";
import {
calculateScrollCenter,
getElementContainingPosition,
getTextBindableContainerAtPosition,
getElementsAtPosition,
getElementsWithinSelection,
getNormalizedZoom,
@@ -241,7 +240,7 @@ import {
bindTextToShapeAfterDuplication,
getApproxMinLineHeight,
getApproxMinLineWidth,
getBoundTextElementId,
getBoundTextElement,
} from "../element/textElement";
import { isHittingElementNotConsideringBoundingBox } from "../element/collision";
import {
@@ -1620,9 +1619,6 @@ class App extends React.Component<AppProps, AppState> {
this.files = { ...this.files, ...Object.fromEntries(filesMap) };
// bump versions for elements that reference added files so that
// we/host apps can detect the change, and invalidate the image & shape
// cache
this.scene.getElements().forEach((element) => {
if (
isInitializedImageElement(element) &&
@@ -1630,7 +1626,6 @@ class App extends React.Component<AppProps, AppState> {
) {
this.imageCache.delete(element.fileId);
invalidateShapeForElement(element);
bumpVersion(element);
}
});
this.scene.informMutation();
@@ -2164,28 +2159,40 @@ class App extends React.Component<AppProps, AppState> {
window.devicePixelRatio,
);
// bind to container when shouldBind is true or
// clicked on center of container
const container =
shouldBind || parentCenterPosition
? getElementContainingPosition(
this.scene.getElements().filter((ele) => !isTextElement(ele)),
sceneX,
sceneY,
)
: null;
let existingTextElement: NonDeleted<ExcalidrawTextElement> | null = null;
let container: ExcalidrawTextContainer | null = null;
let existingTextElement = this.getTextElementAtPosition(sceneX, sceneY);
const selectedElements = getSelectedElements(
this.scene.getElements(),
this.state,
);
// consider bounded text element if container present
if (container) {
const boundTextElementId = getBoundTextElementId(container);
if (boundTextElementId) {
existingTextElement = this.scene.getElement(
boundTextElementId,
) as ExcalidrawTextElement;
if (selectedElements.length === 1) {
if (isTextElement(selectedElements[0])) {
existingTextElement = selectedElements[0];
} else if (isTextBindableContainer(selectedElements[0])) {
container = selectedElements[0];
existingTextElement = getBoundTextElement(container);
}
}
existingTextElement =
existingTextElement ?? this.getTextElementAtPosition(sceneX, sceneY);
// bind to container when shouldBind is true or
// clicked on center of container
if (
!container &&
!existingTextElement &&
(shouldBind || parentCenterPosition)
) {
container = getTextBindableContainerAtPosition(
this.scene.getElements().filter((ele) => !isTextElement(ele)),
sceneX,
sceneY,
);
}
if (!existingTextElement && container) {
const fontString = {
fontSize: this.state.currentItemFontSize,
@@ -2233,7 +2240,7 @@ class App extends React.Component<AppProps, AppState> {
? "center"
: this.state.currentItemTextAlign,
verticalAlign: parentCenterPosition
? "middle"
? VERTICAL_ALIGN.MIDDLE
: DEFAULT_VERTICAL_ALIGN,
containerId: container?.id ?? undefined,
groupIds: container?.groupIds ?? [],
@@ -2241,19 +2248,13 @@ class App extends React.Component<AppProps, AppState> {
this.setState({ editingElement: element });
if (existingTextElement) {
// if text element is no longer centered to a container, reset
// verticalAlign to default because it's currently internal-only
if (!parentCenterPosition || element.textAlign !== "center") {
mutateElement(element, { verticalAlign: DEFAULT_VERTICAL_ALIGN });
}
} else {
if (!existingTextElement) {
this.scene.replaceAllElements([
...this.scene.getElementsIncludingDeleted(),
element,
]);
// case: creating new text not centered to parent elemenent → offset Y
// case: creating new text not centered to parent element → offset Y
// so that the text is centered to cursor position
if (!parentCenterPosition) {
mutateElement(element, {
@@ -3014,7 +3015,7 @@ class App extends React.Component<AppProps, AppState> {
/*
* Reenable next paste in case of disabled middle click paste for
* any reason:
* - rigth click paste
* - right click paste
* - empty clipboard
*/
const enableNextPaste = () => {
@@ -4750,7 +4751,7 @@ class App extends React.Component<AppProps, AppState> {
const width = height * (image.naturalWidth / image.naturalHeight);
// add current imageElement width/height to account for previous centering
// of the placholder image
// of the placeholder image
const x = imageElement.x + imageElement.width / 2 - width / 2;
const y = imageElement.y + imageElement.height / 2 - height / 2;
@@ -4931,7 +4932,7 @@ class App extends React.Component<AppProps, AppState> {
private handleAppOnDrop = async (event: React.DragEvent<HTMLDivElement>) => {
try {
const file = event.dataTransfer.files[0];
const file = event.dataTransfer.files.item(0);
if (isSupportedImageFile(file)) {
// first attempt to decode scene from the image if it's embedded
@@ -5007,7 +5008,7 @@ class App extends React.Component<AppProps, AppState> {
return;
}
const file = event.dataTransfer?.files[0];
const file = event.dataTransfer?.files.item(0);
if (
file?.type === MIME_TYPES.excalidrawlib ||
file?.name?.endsWith(".excalidrawlib")
@@ -5023,7 +5024,7 @@ class App extends React.Component<AppProps, AppState> {
this.setState({ isLoading: false, errorMessage: error.message }),
);
// default: assume an Excalidraw file regardless of extension/MimeType
} else {
} else if (file) {
this.setState({ isLoading: true });
if (nativeFileSystemSupported) {
try {
@@ -5445,7 +5446,7 @@ class App extends React.Component<AppProps, AppState> {
canvas: HTMLCanvasElement | null,
scale: number,
) {
const elementClickedInside = getElementContainingPosition(
const elementClickedInside = getTextBindableContainerAtPosition(
this.scene
.getElementsIncludingDeleted()
.filter((element) => !isTextElement(element)),
+21 -1
View File
@@ -46,7 +46,7 @@
top: -11px;
}
.color-picker-content {
.color-picker-content--default {
padding: 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
@@ -59,6 +59,26 @@
}
}
.color-picker-content--canvas {
display: flex;
flex-direction: column;
padding: 0.25rem;
&-title {
color: $oc-gray-6;
font-size: 12px;
padding: 0 0.25rem;
}
&-colors {
padding: 0.5rem 0;
.color-picker-swatch {
margin: 0 0.25rem;
}
}
}
.color-picker-content .color-input-container {
grid-column: 1 / span 5;
}
+154 -42
View File
@@ -7,6 +7,53 @@ import { isArrowKey, KEYS } from "../keys";
import { t, getLanguage } from "../i18n";
import { isWritableElement } from "../utils";
import colors from "../colors";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
const MAX_CUSTOM_COLORS = 5;
const MAX_DEFAULT_COLORS = 15;
export const getCustomColors = (
elements: readonly ExcalidrawElement[],
type: "elementBackground" | "elementStroke",
) => {
const customColors: string[] = [];
const updatedElements = elements
.filter((element) => !element.isDeleted)
.sort((ele1, ele2) => ele2.updated - ele1.updated);
let index = 0;
const elementColorTypeMap = {
elementBackground: "backgroundColor",
elementStroke: "strokeColor",
};
const colorType = elementColorTypeMap[type] as
| "backgroundColor"
| "strokeColor";
while (
index < updatedElements.length &&
customColors.length < MAX_CUSTOM_COLORS
) {
const element = updatedElements[index];
if (
customColors.length < MAX_CUSTOM_COLORS &&
isCustomColor(element[colorType], type) &&
!customColors.includes(element[colorType])
) {
customColors.push(element[colorType]);
}
index++;
}
return customColors;
};
const isCustomColor = (
color: string,
type: "elementBackground" | "elementStroke",
) => {
return !colors[type].includes(color);
};
const isValidColor = (color: string) => {
const style = new Option().style;
@@ -35,6 +82,7 @@ const keyBindings = [
["1", "2", "3", "4", "5"],
["q", "w", "e", "r", "t"],
["a", "s", "d", "f", "g"],
["z", "x", "c", "v", "b"],
].flat();
const Picker = ({
@@ -45,6 +93,7 @@ const Picker = ({
label,
showInput = true,
type,
elements,
}: {
colors: string[];
color: string | null;
@@ -53,12 +102,20 @@ const Picker = ({
label: string;
showInput: boolean;
type: "canvasBackground" | "elementBackground" | "elementStroke";
elements: readonly ExcalidrawElement[];
}) => {
const firstItem = React.useRef<HTMLButtonElement>();
const activeItem = React.useRef<HTMLButtonElement>();
const gallery = React.useRef<HTMLDivElement>();
const colorInput = React.useRef<HTMLInputElement>();
const [customColors] = React.useState(() => {
if (type === "canvasBackground") {
return [];
}
return getCustomColors(elements, type);
});
React.useEffect(() => {
// After the component is first mounted focus on first input
if (activeItem.current) {
@@ -85,23 +142,42 @@ const Picker = ({
} else if (isArrowKey(event.key)) {
const { activeElement } = document;
const isRTL = getLanguage().rtl;
const index = Array.prototype.indexOf.call(
gallery!.current!.children,
let isCustom = false;
let index = Array.prototype.indexOf.call(
gallery!.current!.querySelector(".color-picker-content--default")!
.children,
activeElement,
);
if (index === -1) {
index = Array.prototype.indexOf.call(
gallery!.current!.querySelector(
".color-picker-content--canvas-colors",
)!.children,
activeElement,
);
if (index !== -1) {
isCustom = true;
}
}
const parentSelector = isCustom
? gallery!.current!.querySelector(
".color-picker-content--canvas-colors",
)!
: gallery!.current!.querySelector(".color-picker-content--default")!;
if (index !== -1) {
const length = gallery!.current!.children.length - (showInput ? 1 : 0);
const length = parentSelector!.children.length - (showInput ? 1 : 0);
const nextIndex =
event.key === (isRTL ? KEYS.ARROW_LEFT : KEYS.ARROW_RIGHT)
? (index + 1) % length
: event.key === (isRTL ? KEYS.ARROW_RIGHT : KEYS.ARROW_LEFT)
? (length + index - 1) % length
: event.key === KEYS.ARROW_DOWN
: !isCustom && event.key === KEYS.ARROW_DOWN
? (index + 5) % length
: event.key === KEYS.ARROW_UP
: !isCustom && event.key === KEYS.ARROW_UP
? (length + index - 5) % length
: index;
(gallery!.current!.children![nextIndex] as any).focus();
(parentSelector!.children![nextIndex] as HTMLElement)?.focus();
}
event.preventDefault();
} else if (
@@ -109,7 +185,15 @@ const Picker = ({
!isWritableElement(event.target)
) {
const index = keyBindings.indexOf(event.key.toLowerCase());
(gallery!.current!.children![index] as any).focus();
const isCustom = index >= MAX_DEFAULT_COLORS;
const parentSelector = isCustom
? gallery!.current!.querySelector(
".color-picker-content--canvas-colors",
)!
: gallery!.current!.querySelector(".color-picker-content--default")!;
const actualIndex = isCustom ? index - MAX_DEFAULT_COLORS : index;
(parentSelector!.children![actualIndex] as HTMLElement)?.focus();
event.preventDefault();
} else if (event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) {
event.preventDefault();
@@ -119,6 +203,50 @@ const Picker = ({
event.stopPropagation();
};
const renderColors = (colors: Array<string>, custom: boolean = false) => {
return colors.map((_color, i) => {
const _colorWithoutHash = _color.replace("#", "");
const keyBinding = custom
? keyBindings[i + MAX_DEFAULT_COLORS]
: keyBindings[i];
const label = custom
? _colorWithoutHash
: t(`colors.${_colorWithoutHash}`);
return (
<button
className="color-picker-swatch"
onClick={(event) => {
(event.currentTarget as HTMLButtonElement).focus();
onChange(_color);
}}
title={`${label}${
!isTransparent(_color) ? ` (${_color})` : ""
}${keyBinding.toUpperCase()}`}
aria-label={label}
aria-keyshortcuts={keyBindings[i]}
style={{ color: _color }}
key={_color}
ref={(el) => {
if (!custom && el && i === 0) {
firstItem.current = el;
}
if (el && _color === color) {
activeItem.current = el;
}
}}
onFocus={() => {
onChange(_color);
}}
>
{isTransparent(_color) ? (
<div className="color-picker-transparent"></div>
) : undefined}
<span className="color-picker-keybinding">{keyBinding}</span>
</button>
);
});
};
return (
<div
className={`color-picker color-picker-type-${type}`}
@@ -138,41 +266,20 @@ const Picker = ({
}}
tabIndex={0}
>
{colors.map((_color, i) => {
const _colorWithoutHash = _color.replace("#", "");
return (
<button
className="color-picker-swatch"
onClick={(event) => {
(event.currentTarget as HTMLButtonElement).focus();
onChange(_color);
}}
title={`${t(`colors.${_colorWithoutHash}`)}${
!isTransparent(_color) ? ` (${_color})` : ""
}${keyBindings[i].toUpperCase()}`}
aria-label={t(`colors.${_colorWithoutHash}`)}
aria-keyshortcuts={keyBindings[i]}
style={{ color: _color }}
key={_color}
ref={(el) => {
if (el && i === 0) {
firstItem.current = el;
}
if (el && _color === color) {
activeItem.current = el;
}
}}
onFocus={() => {
onChange(_color);
}}
>
{isTransparent(_color) ? (
<div className="color-picker-transparent"></div>
) : undefined}
<span className="color-picker-keybinding">{keyBindings[i]}</span>
</button>
);
})}
<div className="color-picker-content--default">
{renderColors(colors)}
</div>
{!!customColors.length && (
<div className="color-picker-content--canvas">
<span className="color-picker-content--canvas-title">
{t("labels.canvasColors")}
</span>
<div className="color-picker-content--canvas-colors">
{renderColors(customColors, true)}
</div>
</div>
)}
{showInput && (
<ColorInput
color={color}
@@ -246,6 +353,8 @@ export const ColorPicker = ({
label,
isActive,
setActive,
elements,
appState,
}: {
type: "canvasBackground" | "elementBackground" | "elementStroke";
color: string | null;
@@ -253,6 +362,8 @@ export const ColorPicker = ({
label: string;
isActive: boolean;
setActive: (active: boolean) => void;
elements: readonly ExcalidrawElement[];
appState: AppState;
}) => {
const pickerButton = React.useRef<HTMLButtonElement>(null);
@@ -294,6 +405,7 @@ export const ColorPicker = ({
label={label}
showInput={false}
type={type}
elements={elements}
/>
</Popover>
) : null}
+1 -1
View File
@@ -238,7 +238,7 @@ const LayerUI = ({
className={CLASSES.SHAPE_ACTIONS_MENU}
padding={2}
style={{
// we want to make sure this doesn't overflow so substracting 200
// we want to make sure this doesn't overflow so subtracting 200
// which is approximately height of zoom footer and top left menu items with some buffer
// if active file name is displayed, subtracting 248 to account for its height
maxHeight: `${appState.height - (appState.fileHandle ? 248 : 200)}px`,
+8 -2
View File
@@ -87,8 +87,14 @@
.ToolIcon {
&:hover {
--icon-fill-color: var(--color-primary-chubb);
--keybinding-color: var(--color-primary-chubb);
--icon-fill-color: var(
--color-primary-contrast-offset,
var(--color-primary)
);
--keybinding-color: var(
--color-primary-contrast-offset,
var(--color-primary)
);
}
&:active {
--icon-fill-color: #{$oc-gray-9};
+34
View File
@@ -885,6 +885,40 @@ export const TextAlignRightIcon = React.memo(({ theme }: { theme: Theme }) =>
),
);
export const TextAlignTopIcon = React.memo(({ theme }: { theme: Theme }) =>
createIcon(
<path
d="m16,132l416,0c8.837,0 16,-7.163 16,-16l0,-40c0,-8.837 -7.163,-16 -16,-16l-416,0c-8.837,0 -16,7.163 -16,16l0,40c0,8.837 7.163,16 16,16zm0,160l416,0c8.837,0 16,-7.163 16,-16l0,-40c0,-8.837 -7.163,-16 -16,-16l-416,0c-8.837,0 -16,7.163 -16,16l0,40c0,8.837 7.163,16 16,16z"
fill={iconFillColor(theme)}
strokeLinecap="round"
/>,
{ width: 448, height: 512 },
),
);
export const TextAlignBottomIcon = React.memo(({ theme }: { theme: Theme }) =>
createIcon(
<path
d="M16,292L432,292C440.837,292 448,284.837 448,276L448,236C448,227.163 440.837,220 432,220L16,220C7.163,220 0,227.163 0,236L0,276C0,284.837 7.163,292 16,292ZM16,452L432,452C440.837,452 448,444.837 448,436L448,396C448,387.163 440.837,380 432,380L16,380C7.163,380 0,387.163 0,396L0,436C0,444.837 7.163,452 16,452Z"
fill={iconFillColor(theme)}
strokeLinecap="round"
/>,
{ width: 448, height: 512 },
),
);
export const TextAlignMiddleIcon = React.memo(({ theme }: { theme: Theme }) =>
createIcon(
<path
transform="matrix(1,0,0,1,0,80)"
d="M16,132L432,132C440.837,132 448,124.837 448,116L448,76C448,67.163 440.837,60 432,60L16,60C7.163,60 0,67.163 0,76L0,116C0,124.837 7.163,132 16,132ZM16,292L432,292C440.837,292 448,284.837 448,276L448,236C448,227.163 440.837,220 432,220L16,220C7.163,220 0,227.163 0,236L0,276C0,284.837 7.163,292 16,292Z"
fill={iconFillColor(theme)}
strokeLinecap="round"
/>,
{ width: 448, height: 512 },
),
);
export const publishIcon = createIcon(
<path
d="M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z"
+8
View File
@@ -63,6 +63,8 @@ export const ENV = {
export const CLASSES = {
SHAPE_ACTIONS_MENU: "App-menu__left",
SHAPE_ACTIONS_MOBILE_MENU: "App-mobile-menu",
MOBILE_TOOLBAR: "App-toolbar-content",
};
// 1-based in case we ever do `if(element.fontFamily)`
@@ -182,3 +184,9 @@ export const VERSIONS = {
} as const;
export const BOUND_TEXT_PADDING = 5;
export const VERTICAL_ALIGN = {
TOP: "top",
MIDDLE: "middle",
BOTTOM: "bottom",
};
-2
View File
@@ -38,7 +38,6 @@
--text-primary-color: #{$oc-gray-8};
--color-primary: #6965db;
--color-primary-chubb: #625ee0; // to offset Chubb illusion
--color-primary-darker: #5b57d1;
--color-primary-darkest: #4a47b1;
--color-primary-light: #e2e1fc;
@@ -85,7 +84,6 @@
--text-primary-color: #{$oc-gray-4};
--color-primary: #5650f0;
--color-primary-chubb: #726dff; // to offset Chubb illusion
--color-primary-darker: #4b46d8;
--color-primary-darkest: #3e39be;
--color-primary-light: #3f3d64;
+16 -2
View File
@@ -31,6 +31,7 @@ import { isPointHittingElementBoundingBox } from "./collision";
import { getElementAbsoluteCoords } from "./";
import "./Hyperlink.scss";
import { trackEvent } from "../analytics";
const CONTAINER_WIDTH = 320;
const SPACE_BOTTOM = 85;
@@ -69,6 +70,10 @@ export const Hyperlink = ({
const link = normalizeLink(inputRef.current.value);
if (!element.link && link) {
trackEvent("hyperlink", "create");
}
mutateElement(element, { link });
setAppState({ showHyperlinkPopup: "info" });
}, [element, setAppState]);
@@ -108,6 +113,7 @@ export const Hyperlink = ({
}, [appState, element, isEditing, setAppState]);
const handleRemove = useCallback(() => {
trackEvent("hyperlink", "delete");
mutateElement(element, { link: null });
if (isEditing) {
inputRef.current!.value = "";
@@ -116,13 +122,15 @@ export const Hyperlink = ({
}, [setAppState, element, isEditing]);
const onEdit = () => {
trackEvent("hyperlink", "edit", "popup-ui");
setAppState({ showHyperlinkPopup: "editor" });
};
const { x, y } = getCoordsForPopover(element, appState);
if (
appState.draggingElement ||
appState.resizingElement ||
appState.isRotating
appState.isRotating ||
appState.openMenu
) {
return null;
}
@@ -238,20 +246,25 @@ export const isLocalLink = (link: string | null) => {
};
export const actionLink = register({
name: "link",
name: "hyperlink",
perform: (elements, appState) => {
if (appState.showHyperlinkPopup === "editor") {
return false;
}
return {
elements,
appState: {
...appState,
showHyperlinkPopup: "editor",
openMenu: null,
},
commitToHistory: true,
};
},
trackEvent: (action, source) => {
trackEvent("hyperlink", "edit", source);
},
keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.K,
contextItemLabel: (elements, appState) =>
getContextMenuLabel(elements, appState),
@@ -398,6 +411,7 @@ const renderTooltip = (
},
"top",
);
trackEvent("hyperlink", "tooltip", "link-icon");
IS_HYPERLINK_TOOLTIP_VISIBLE = true;
};
+1 -1
View File
@@ -646,7 +646,7 @@ const getCorners = (
// Returns intersection of `line` with `segment`, with `segment` moved by
// `gap` in its polar direction.
// If intersection conincides with second segment point returns empty array.
// If intersection coincides with second segment point returns empty array.
const intersectSegment = (
line: GA.Line,
segment: [GA.Point, GA.Point],
+4 -7
View File
@@ -3,10 +3,9 @@ import { updateBoundElements } from "./binding";
import { getCommonBounds } from "./bounds";
import { mutateElement } from "./mutateElement";
import { getPerfectElementSize } from "./sizeHelpers";
import Scene from "../scene/Scene";
import { NonDeletedExcalidrawElement } from "./types";
import { AppState, PointerDownState } from "../types";
import { getBoundTextElementId } from "./textElement";
import { getBoundTextElement } from "./textElement";
import { isSelectedViaGroup } from "../groups";
export const dragSelectedElements = (
@@ -39,16 +38,14 @@ export const dragSelectedElements = (
// container is part of a group, but we're dragging the container directly
(appState.editingGroupId && !isSelectedViaGroup(appState, element))
) {
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const textElement =
Scene.getScene(element)!.getElement(boundTextElementId);
const textElement = getBoundTextElement(element);
if (textElement) {
updateElementCoords(
lockDirection,
distanceX,
distanceY,
pointerDownState,
textElement!,
textElement,
offset,
);
}
+1 -1
View File
@@ -401,7 +401,7 @@ export class LinearElementEditor {
ret.hitElement = element;
} else {
// You might be wandering why we are storing the binding elements on
// LinearElementEditor and passing them in, insted of calculating them
// LinearElementEditor and passing them in, instead of calculating them
// from the end points of the `linearElement` - this is to allow disabling
// binding (which needs to happen at the point the user finishes moving
// the point).
+3 -5
View File
@@ -22,8 +22,7 @@ import { getElementAbsoluteCoords } from ".";
import { adjustXYWithRotation } from "../math";
import { getResizedElementAbsoluteCoords } from "./bounds";
import { getContainerElement, measureText, wrapText } from "./textElement";
import { isBoundToContainer } from "./typeChecks";
import { BOUND_TEXT_PADDING } from "../constants";
import { BOUND_TEXT_PADDING, VERTICAL_ALIGN } from "../constants";
type ElementConstructorOpts = MarkOptional<
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">,
@@ -175,7 +174,7 @@ const getAdjustedDimensions = (
let y: number;
if (
textAlign === "center" &&
verticalAlign === "middle" &&
verticalAlign === VERTICAL_ALIGN.MIDDLE &&
!element.containerId
) {
const prevMetrics = measureText(
@@ -221,8 +220,7 @@ const getAdjustedDimensions = (
// make sure container dimensions are set properly when
// text editor overflows beyond viewport dimensions
if (isBoundToContainer(element)) {
const container = getContainerElement(element)!;
if (container) {
let height = container.height;
let width = container.width;
if (nextHeight > height - BOUND_TEXT_PADDING * 2) {
+73 -18
View File
@@ -1,4 +1,4 @@
import { SHIFT_LOCKING_ANGLE } from "../constants";
import { BOUND_TEXT_PADDING, SHIFT_LOCKING_ANGLE } from "../constants";
import { rescalePoints } from "../points";
import {
@@ -35,6 +35,7 @@ import {
import { Point, PointerDownState } from "../types";
import Scene from "../scene/Scene";
import {
getApproxMinLineHeight,
getApproxMinLineWidth,
getBoundTextElement,
getBoundTextElementId,
@@ -105,7 +106,7 @@ export const transformElements = (
updateBoundElements(element);
} else if (transformHandleType) {
resizeSingleElement(
pointerDownState.originalElements.get(element.id) as typeof element,
pointerDownState.originalElements,
shouldMaintainAspectRatio,
element,
transformHandleType,
@@ -140,7 +141,6 @@ export const transformElements = (
pointerX,
pointerY,
);
handleBindTextResize(selectedElements, transformHandleType);
return true;
}
}
@@ -397,7 +397,7 @@ const resizeSingleTextElement = (
};
export const resizeSingleElement = (
stateAtResizeStart: NonDeletedExcalidrawElement,
originalElements: PointerDownState["originalElements"],
shouldMaintainAspectRatio: boolean,
element: NonDeletedExcalidrawElement,
transformHandleDirection: TransformHandleDirection,
@@ -405,6 +405,7 @@ export const resizeSingleElement = (
pointerX: number,
pointerY: number,
) => {
const stateAtResizeStart = originalElements.get(element.id)!;
// Gets bounds corners
const [x1, y1, x2, y2] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
@@ -429,8 +430,6 @@ export const resizeSingleElement = (
element.height,
);
const boundTextElementId = getBoundTextElementId(element);
const boundsCurrentWidth = esx2 - esx1;
const boundsCurrentHeight = esy2 - esy1;
@@ -441,6 +440,9 @@ export const resizeSingleElement = (
let scaleX = atStartBoundsWidth / boundsCurrentWidth;
let scaleY = atStartBoundsHeight / boundsCurrentHeight;
let boundTextFont: { fontSize?: number; baseline?: number } = {};
const boundTextElement = getBoundTextElement(element);
if (transformHandleDirection.includes("e")) {
scaleX = (rotatedPointer[0] - startTopLeft[0]) / boundsCurrentWidth;
}
@@ -453,6 +455,7 @@ export const resizeSingleElement = (
if (transformHandleDirection.includes("n")) {
scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight;
}
// Linear elements dimensions differ from bounds dimensions
const eleInitialWidth = stateAtResizeStart.width;
const eleInitialHeight = stateAtResizeStart.height;
@@ -482,6 +485,37 @@ export const resizeSingleElement = (
}
}
if (boundTextElement) {
const stateOfBoundTextElementAtResize = originalElements.get(
boundTextElement.id,
) as typeof boundTextElement | undefined;
if (stateOfBoundTextElementAtResize) {
boundTextFont = {
fontSize: stateOfBoundTextElementAtResize.fontSize,
baseline: stateOfBoundTextElementAtResize.baseline,
};
}
if (shouldMaintainAspectRatio) {
const nextFont = measureFontSizeFromWH(
boundTextElement,
eleNewWidth - BOUND_TEXT_PADDING * 2,
eleNewHeight - BOUND_TEXT_PADDING * 2,
);
if (nextFont === null) {
return;
}
boundTextFont = {
fontSize: nextFont.size,
baseline: nextFont.baseline,
};
} else {
const minWidth = getApproxMinLineWidth(getFontString(boundTextElement));
const minHeight = getApproxMinLineHeight(getFontString(boundTextElement));
eleNewWidth = Math.ceil(Math.max(eleNewWidth, minWidth));
eleNewHeight = Math.ceil(Math.max(eleNewHeight, minHeight));
}
}
const [newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2] =
getResizedElementAbsoluteCoords(
stateAtResizeStart,
@@ -491,11 +525,6 @@ export const resizeSingleElement = (
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
// don't allow resize to negative dimensions when text is bounded to container
if ((newBoundsWidth < 0 || newBoundsHeight < 0) && boundTextElementId) {
return;
}
// Calculate new topLeft based on fixed corner during resize
let newTopLeft = [...startTopLeft] as [number, number];
if (["n", "w", "nw"].includes(transformHandleDirection)) {
@@ -588,13 +617,9 @@ export const resizeSingleElement = (
],
});
}
let minWidth = 0;
const boundTextElement = getBoundTextElement(element);
if (boundTextElement) {
minWidth = getApproxMinLineWidth(getFontString(boundTextElement));
}
if (
resizedElement.width >= minWidth &&
resizedElement.width !== 0 &&
resizedElement.height !== 0 &&
Number.isFinite(resizedElement.x) &&
Number.isFinite(resizedElement.y)
@@ -603,7 +628,10 @@ export const resizeSingleElement = (
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
handleBindTextResize([element], transformHandleDirection);
if (boundTextElement && boundTextFont) {
mutateElement(boundTextElement, { fontSize: boundTextFont.fontSize });
}
handleBindTextResize(element, transformHandleDirection);
}
};
@@ -674,7 +702,25 @@ const resizeMultipleElements = (
}
const width = element.width * scale;
const height = element.height * scale;
const boundTextElement = getBoundTextElement(element);
let font: { fontSize?: number; baseline?: number } = {};
if (boundTextElement) {
const nextFont = measureFontSizeFromWH(
boundTextElement,
width - BOUND_TEXT_PADDING * 2,
height - BOUND_TEXT_PADDING * 2,
);
if (nextFont === null) {
return null;
}
font = {
fontSize: nextFont.size,
baseline: nextFont.baseline,
};
}
if (isTextElement(element)) {
const nextFont = measureFontSizeFromWH(element, width, height);
if (nextFont === null) {
@@ -718,6 +764,15 @@ const resizeMultipleElements = (
if (updates) {
elements.forEach((element, index) => {
mutateElement(element, updates[index]);
const boundTextElement = getBoundTextElement(element);
if (boundTextElement) {
mutateElement(boundTextElement, {
fontSize: updates[index].fontSize,
baseline: updates[index].baseline,
});
handleBindTextResize(element, transformHandleType);
}
});
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ describe("getPerfectElementSize", () => {
expect(width).toEqual(135);
expect(height).toEqual(135);
});
it("should return height:0 and width:0 when width and heigh are 0", () => {
it("should return height:0 and width:0 when width and height are 0", () => {
const { height, width } = getPerfectElementSize("arrow", 0, 0);
expect(width).toEqual(0);
expect(height).toEqual(0);
+107 -78
View File
@@ -1,6 +1,5 @@
import { getFontString, arrayToMap, isTestEnv } from "../utils";
import {
ExcalidrawBindableElement,
ExcalidrawElement,
ExcalidrawTextElement,
ExcalidrawTextElementWithContainer,
@@ -8,10 +7,11 @@ import {
NonDeletedExcalidrawElement,
} from "./types";
import { mutateElement } from "./mutateElement";
import { BOUND_TEXT_PADDING } from "../constants";
import { BOUND_TEXT_PADDING, VERTICAL_ALIGN } from "../constants";
import { MaybeTransformHandleType } from "./transformHandles";
import Scene from "../scene/Scene";
import { AppState } from "../types";
import { isTextElement } from ".";
export const redrawTextBoundingBox = (
element: ExcalidrawTextElement,
@@ -39,11 +39,19 @@ export const redrawTextBoundingBox = (
let coordY = element.y;
// Resize container and vertically center align the text
if (container) {
coordY = container.y + container.height / 2 - metrics.height / 2;
let nextHeight = container.height;
if (metrics.height > container.height - BOUND_TEXT_PADDING * 2) {
nextHeight = metrics.height + BOUND_TEXT_PADDING * 2;
coordY = container.y + nextHeight / 2 - metrics.height / 2;
if (element.verticalAlign === VERTICAL_ALIGN.TOP) {
coordY = container.y + BOUND_TEXT_PADDING;
} else if (element.verticalAlign === VERTICAL_ALIGN.BOTTOM) {
coordY =
container.y + container.height - metrics.height - BOUND_TEXT_PADDING;
} else {
coordY = container.y + container.height / 2 - metrics.height / 2;
if (metrics.height > container.height - BOUND_TEXT_PADDING * 2) {
nextHeight = metrics.height + BOUND_TEXT_PADDING * 2;
coordY = container.y + nextHeight / 2 - metrics.height / 2;
}
}
mutateElement(container, { height: nextHeight });
}
@@ -71,91 +79,99 @@ export const bindTextToShapeAfterDuplication = (
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const newTextElementId = oldIdToDuplicatedId.get(boundTextElementId)!;
mutateElement(
sceneElementMap.get(newElementId) as ExcalidrawBindableElement,
{
boundElements: element.boundElements?.concat({
type: "text",
id: newTextElementId,
}),
},
);
mutateElement(
sceneElementMap.get(newTextElementId) as ExcalidrawTextElement,
{
containerId: newElementId,
},
);
const newTextElementId = oldIdToDuplicatedId.get(boundTextElementId);
if (newTextElementId) {
const newContainer = sceneElementMap.get(newElementId);
if (newContainer) {
mutateElement(newContainer, {
boundElements: element.boundElements?.concat({
type: "text",
id: newTextElementId,
}),
});
}
const newTextElement = sceneElementMap.get(newTextElementId);
if (newTextElement && isTextElement(newTextElement)) {
mutateElement(newTextElement, {
containerId: newContainer ? newElementId : null,
});
}
}
}
});
};
export const handleBindTextResize = (
elements: readonly NonDeletedExcalidrawElement[],
element: NonDeletedExcalidrawElement,
transformHandleType: MaybeTransformHandleType,
) => {
elements.forEach((element) => {
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const textElement = Scene.getScene(element)!.getElement(
boundTextElementId,
) as ExcalidrawTextElement;
if (textElement && textElement.text) {
if (!element) {
return;
}
let text = textElement.text;
let nextHeight = textElement.height;
let containerHeight = element.height;
let nextBaseLine = textElement.baseline;
if (transformHandleType !== "n" && transformHandleType !== "s") {
if (text) {
text = wrapText(
textElement.originalText,
getFontString(textElement),
element.width,
);
}
const dimensions = measureText(
text,
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const textElement = Scene.getScene(element)!.getElement(
boundTextElementId,
) as ExcalidrawTextElement;
if (textElement && textElement.text) {
if (!element) {
return;
}
let text = textElement.text;
let nextHeight = textElement.height;
let containerHeight = element.height;
let nextBaseLine = textElement.baseline;
if (transformHandleType !== "n" && transformHandleType !== "s") {
if (text) {
text = wrapText(
textElement.originalText,
getFontString(textElement),
element.width,
);
nextHeight = dimensions.height;
nextBaseLine = dimensions.baseline;
}
// increase height in case text element height exceeds
if (nextHeight > element.height - BOUND_TEXT_PADDING * 2) {
containerHeight = nextHeight + BOUND_TEXT_PADDING * 2;
const diff = containerHeight - element.height;
// fix the y coord when resizing from ne/nw/n
const updatedY =
transformHandleType === "ne" ||
transformHandleType === "nw" ||
transformHandleType === "n"
? element.y - diff
: element.y;
mutateElement(element, {
height: containerHeight,
y: updatedY,
});
}
const updatedY = element.y + containerHeight / 2 - nextHeight / 2;
mutateElement(textElement, {
const dimensions = measureText(
text,
// preserve padding and set width correctly
width: element.width - BOUND_TEXT_PADDING * 2,
height: nextHeight,
x: element.x + BOUND_TEXT_PADDING,
getFontString(textElement),
element.width,
);
nextHeight = dimensions.height;
nextBaseLine = dimensions.baseline;
}
// increase height in case text element height exceeds
if (nextHeight > element.height - BOUND_TEXT_PADDING * 2) {
containerHeight = nextHeight + BOUND_TEXT_PADDING * 2;
const diff = containerHeight - element.height;
// fix the y coord when resizing from ne/nw/n
const updatedY =
transformHandleType === "ne" ||
transformHandleType === "nw" ||
transformHandleType === "n"
? element.y - diff
: element.y;
mutateElement(element, {
height: containerHeight,
y: updatedY,
baseline: nextBaseLine,
});
}
let updatedY;
if (textElement.verticalAlign === VERTICAL_ALIGN.TOP) {
updatedY = element.y + BOUND_TEXT_PADDING;
} else if (textElement.verticalAlign === VERTICAL_ALIGN.BOTTOM) {
updatedY = element.y + element.height - nextHeight - BOUND_TEXT_PADDING;
} else {
updatedY = element.y + element.height / 2 - nextHeight / 2;
}
mutateElement(textElement, {
text,
// preserve padding and set width correctly
width: element.width - BOUND_TEXT_PADDING * 2,
height: nextHeight,
x: element.x + BOUND_TEXT_PADDING,
y: updatedY,
baseline: nextBaseLine,
});
}
});
}
};
// https://github.com/grassator/canvas-text-editor/blob/master/lib/FontMetrics.js
@@ -355,6 +371,7 @@ export const charWidth = (() => {
const width = getTextWidth(char, font);
cachedCharWidth[font][ascii] = width;
}
return cachedCharWidth[font][ascii];
};
@@ -367,14 +384,14 @@ export const charWidth = (() => {
};
})();
export const getApproxMinLineWidth = (font: FontString) => {
const minCharWidth = getMinCharWidth(font);
if (minCharWidth === 0) {
const maxCharWidth = getMaxCharWidth(font);
if (maxCharWidth === 0) {
return (
measureText(DUMMY_TEXT.split("").join("\n"), font).width +
BOUND_TEXT_PADDING * 2
);
}
return minCharWidth + BOUND_TEXT_PADDING * 2;
return maxCharWidth + BOUND_TEXT_PADDING * 2;
};
export const getApproxMinLineHeight = (font: FontString) => {
@@ -391,6 +408,15 @@ export const getMinCharWidth = (font: FontString) => {
return Math.min(...cacheWithOutEmpty);
};
export const getMaxCharWidth = (font: FontString) => {
const cache = charWidth.getCache(font);
if (!cache) {
return 0;
}
const cacheWithOutEmpty = cache.filter((val) => val !== undefined);
return Math.max(...cacheWithOutEmpty);
};
export const getApproxCharsToFitInWidth = (font: FontString, width: number) => {
// Generally lower case is used so converting to lower case
const dummyText = DUMMY_TEXT.toLocaleLowerCase();
@@ -416,7 +442,10 @@ export const getApproxCharsToFitInWidth = (font: FontString, width: number) => {
};
export const getBoundTextElementId = (container: ExcalidrawElement | null) => {
return container?.boundElements?.filter((ele) => ele.type === "text")[0]?.id;
return container?.boundElements?.length
? container?.boundElements?.filter((ele) => ele.type === "text")[0]?.id ||
null
: null;
};
export const getBoundTextElement = (element: ExcalidrawElement | null) => {
+231 -2
View File
@@ -12,6 +12,8 @@ import {
ExcalidrawTextElementWithContainer,
} from "./types";
import * as textElementUtils from "./textElement";
import { API } from "../tests/helpers/api";
import { mutateElement } from "./mutateElement";
// Unmount ReactDOM from root
ReactDOM.unmountComponentAtNode(document.getElementById("root")!);
@@ -19,7 +21,201 @@ const tab = " ";
const mouse = new Pointer("mouse");
describe("textWysiwyg", () => {
describe("Test unbounded text", () => {
describe("start text editing", () => {
const { h } = window;
beforeEach(async () => {
await render(<ExcalidrawApp />);
h.elements = [];
});
it("should prefer editing selected text element (non-bindable container present)", async () => {
const line = API.createElement({
type: "line",
width: 100,
height: 0,
points: [
[0, 0],
[100, 0],
],
});
const textSize = 20;
const text = API.createElement({
type: "text",
text: "ola",
x: line.width / 2 - textSize / 2,
y: -textSize / 2,
width: textSize,
height: textSize,
});
h.elements = [text, line];
API.setSelectedElements([text]);
Keyboard.keyPress(KEYS.ENTER);
expect(h.state.editingElement?.id).toBe(text.id);
expect(
(h.state.editingElement as ExcalidrawTextElement).containerId,
).toBe(null);
});
it("should prefer editing selected text element (bindable container present)", async () => {
const container = API.createElement({
type: "rectangle",
width: 100,
boundElements: [],
});
const textSize = 20;
const boundText = API.createElement({
type: "text",
text: "ola",
x: container.width / 2 - textSize / 2,
y: container.height / 2 - textSize / 2,
width: textSize,
height: textSize,
containerId: container.id,
});
const boundText2 = API.createElement({
type: "text",
text: "ola",
x: container.width / 2 - textSize / 2,
y: container.height / 2 - textSize / 2,
width: textSize,
height: textSize,
containerId: container.id,
});
h.elements = [container, boundText, boundText2];
mutateElement(container, {
boundElements: [{ type: "text", id: boundText.id }],
});
API.setSelectedElements([boundText2]);
Keyboard.keyPress(KEYS.ENTER);
expect(h.state.editingElement?.id).toBe(boundText2.id);
});
it("should not create bound text on ENTER if text exists at container center", () => {
const container = API.createElement({
type: "rectangle",
width: 100,
});
const textSize = 20;
const text = API.createElement({
type: "text",
text: "ola",
x: container.width / 2 - textSize / 2,
y: container.height / 2 - textSize / 2,
width: textSize,
height: textSize,
containerId: container.id,
});
h.elements = [container, text];
API.setSelectedElements([container]);
Keyboard.keyPress(KEYS.ENTER);
expect(h.state.editingElement?.id).toBe(text.id);
});
it("should edit existing bound text on ENTER even if higher z-index unbound text exists at container center", () => {
const container = API.createElement({
type: "rectangle",
width: 100,
boundElements: [],
});
const textSize = 20;
const boundText = API.createElement({
type: "text",
text: "ola",
x: container.width / 2 - textSize / 2,
y: container.height / 2 - textSize / 2,
width: textSize,
height: textSize,
containerId: container.id,
});
const boundText2 = API.createElement({
type: "text",
text: "ola",
x: container.width / 2 - textSize / 2,
y: container.height / 2 - textSize / 2,
width: textSize,
height: textSize,
containerId: container.id,
});
h.elements = [container, boundText, boundText2];
mutateElement(container, {
boundElements: [{ type: "text", id: boundText.id }],
});
API.setSelectedElements([container]);
Keyboard.keyPress(KEYS.ENTER);
expect(h.state.editingElement?.id).toBe(boundText.id);
});
it("should edit text under cursor when clicked with text tool", () => {
const text = API.createElement({
type: "text",
text: "ola",
x: 60,
y: 0,
width: 100,
height: 100,
});
h.elements = [text];
UI.clickTool("text");
mouse.clickAt(text.x + 50, text.y + 50);
const editor = document.querySelector(
".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement;
expect(editor).not.toBe(null);
expect(h.state.editingElement?.id).toBe(text.id);
expect(h.elements.length).toBe(1);
});
it("should edit text under cursor when double-clicked with selection tool", () => {
const text = API.createElement({
type: "text",
text: "ola",
x: 60,
y: 0,
width: 100,
height: 100,
});
h.elements = [text];
UI.clickTool("selection");
mouse.doubleClickAt(text.x + 50, text.y + 50);
const editor = document.querySelector(
".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement;
expect(editor).not.toBe(null);
expect(h.state.editingElement?.id).toBe(text.id);
expect(h.elements.length).toBe(1);
});
});
describe("Test container-unbound text", () => {
const { h } = window;
let textarea: HTMLTextAreaElement;
@@ -235,7 +431,7 @@ describe("textWysiwyg", () => {
});
});
describe("Test bounded text", () => {
describe("Test container-bound text", () => {
let rectangle: any;
const { h } = window;
@@ -315,6 +511,39 @@ describe("textWysiwyg", () => {
]);
});
it("shouldn't bind to non-text-bindable containers", async () => {
const line = API.createElement({
type: "line",
width: 100,
height: 0,
points: [
[0, 0],
[100, 0],
],
});
h.elements = [line];
UI.clickTool("text");
mouse.clickAt(line.x + line.width / 2, line.y + line.height / 2);
const editor = document.querySelector(
".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement;
fireEvent.change(editor, {
target: {
value: "Hello World!",
},
});
fireEvent.keyDown(editor, { key: KEYS.ESCAPE });
editor.dispatchEvent(new Event("input"));
expect(line.boundElements).toBe(null);
expect(h.elements[1].type).toBe("text");
expect((h.elements[1] as ExcalidrawTextElement).containerId).toBe(null);
});
it("should update font family correctly on undo/redo by selecting bounded text when font family was updated", async () => {
expect(h.elements.length).toBe(1);
+64 -10
View File
@@ -7,7 +7,7 @@ import {
} from "../utils";
import Scene from "../scene/Scene";
import { isBoundToContainer, isTextElement } from "./typeChecks";
import { CLASSES, BOUND_TEXT_PADDING } from "../constants";
import { CLASSES, BOUND_TEXT_PADDING, VERTICAL_ALIGN } from "../constants";
import {
ExcalidrawElement,
ExcalidrawTextElement,
@@ -105,6 +105,8 @@ export const textWysiwyg = ({
const updatedElement = Scene.getScene(element)?.getElement(
id,
) as ExcalidrawTextElement;
const { textAlign, verticalAlign } = updatedElement;
const approxLineHeight = getApproxLineHeight(getFontString(updatedElement));
if (updatedElement && isTextElement(updatedElement)) {
let coordX = updatedElement.x;
@@ -114,7 +116,7 @@ export const textWysiwyg = ({
let maxHeight = updatedElement.height;
let width = updatedElement.width;
// Set to element height by default since thats
// Set to element height by default since that's
// what is going to be used for unbounded text
let height = updatedElement.height;
if (container && updatedElement.containerId) {
@@ -140,7 +142,7 @@ export const textWysiwyg = ({
maxHeight = container.height - BOUND_TEXT_PADDING * 2;
width = maxWidth;
// The coordinates of text box set a distance of
// 30px to preserve padding
// 5px to preserve padding
coordX = container.x + BOUND_TEXT_PADDING;
// autogrow container height if text exceeds
if (height > maxHeight) {
@@ -160,12 +162,34 @@ export const textWysiwyg = ({
// is reached
else {
// vertically center align the text
coordY = container.y + container.height / 2 - height / 2;
if (verticalAlign === VERTICAL_ALIGN.MIDDLE) {
coordY = container.y + container.height / 2 - height / 2;
}
if (verticalAlign === VERTICAL_ALIGN.BOTTOM) {
coordY =
container.y + container.height - height - BOUND_TEXT_PADDING;
}
}
}
const [viewportX, viewportY] = getViewportCoords(coordX, coordY);
const { textAlign } = updatedElement;
const initialSelectionStart = editable.selectionStart;
const initialSelectionEnd = editable.selectionEnd;
const initialLength = editable.value.length;
editable.value = updatedElement.originalText;
// restore cursor position after value updated so it doesn't
// go to the end of text when container auto expanded
if (
initialSelectionStart === initialSelectionEnd &&
initialSelectionEnd !== initialLength
) {
// get diff between length and selection end and shift
// the cursor by "diff" times to position correctly
const diff = initialLength - initialSelectionEnd;
editable.selectionStart = editable.value.length - diff;
editable.selectionEnd = editable.value.length - diff;
}
const lines = updatedElement.originalText.split("\n");
const lineHeight = updatedElement.containerId
? approxLineHeight
@@ -195,6 +219,7 @@ export const textWysiwyg = ({
editorMaxHeight,
),
textAlign,
verticalAlign,
color: updatedElement.strokeColor,
opacity: updatedElement.opacity / 100,
filter: "var(--theme-filter)",
@@ -258,7 +283,7 @@ export const textWysiwyg = ({
// as that gets updated below
const lines = editable.scrollHeight / getApproxLineHeight(font);
// auto increase height only when lines > 1 so its
// measured correctly and vertically alignes for
// measured correctly and vertically aligns for
// first line as well as setting height to "auto"
// doubles the height as soon as user starts typing
if (isBoundToContainer(element) && lines > 1) {
@@ -397,7 +422,7 @@ export const textWysiwyg = ({
};
/**
* @returns indeces of start positions of selected lines, in reverse order
* @returns indices of start positions of selected lines, in reverse order
*/
const getSelectedLinesStartIndices = () => {
let { selectionStart, selectionEnd, value } = editable;
@@ -517,9 +542,29 @@ export const textWysiwyg = ({
target.closest(".color-picker-input") &&
isWritableElement(target);
const isShapeActionsPanel =
(target instanceof HTMLElement || target instanceof SVGElement) &&
(target.closest(`.${CLASSES.SHAPE_ACTIONS_MENU}`) ||
target.closest(`.${CLASSES.SHAPE_ACTIONS_MOBILE_MENU}`) ||
target.closest(`.${CLASSES.MOBILE_TOOLBAR}`));
setTimeout(() => {
editable.onblur = handleSubmit;
if (target && isTargetColorPicker) {
editable.onblur = () => {
app.setState({
toastMessage:
target instanceof HTMLElement
? target.tagName ?? "no tagName"
: "not an HTMLElement",
});
if (isShapeActionsPanel) {
return;
}
app.setState({
toastMessage: "debug: onblur",
});
handleSubmit();
};
if (target && (isTargetColorPicker || isShapeActionsPanel)) {
target.onblur = () => {
editable.focus();
};
@@ -537,13 +582,22 @@ export const textWysiwyg = ({
event.target instanceof HTMLInputElement &&
event.target.closest(".color-picker-input") &&
isWritableElement(event.target);
const isShapeActionsPanel =
(event.target instanceof HTMLElement ||
event.target instanceof SVGElement) &&
(event.target.closest(`.${CLASSES.SHAPE_ACTIONS_MENU}`) ||
event.target.closest(`.${CLASSES.SHAPE_ACTIONS_MOBILE_MENU}`) ||
event.target.closest(`.${CLASSES.MOBILE_TOOLBAR}`));
if (
((event.target instanceof HTMLElement ||
event.target instanceof SVGElement) &&
event.target.closest(`.${CLASSES.SHAPE_ACTIONS_MENU}`) &&
isShapeActionsPanel &&
!isWritableElement(event.target)) ||
isTargetColorPicker
) {
app.setState({
toastMessage: "debug: onPointerDown",
});
editable.onblur = null;
window.addEventListener("pointerup", bindBlurEvent);
// handle edge-case where pointerup doesn't fire e.g. due to user
+4 -1
View File
@@ -8,6 +8,7 @@ import {
InitializedExcalidrawImageElement,
ExcalidrawImageElement,
ExcalidrawTextElementWithContainer,
ExcalidrawTextContainer,
} from "./types";
export const isGenericElement = (
@@ -91,7 +92,9 @@ export const isBindableElement = (
);
};
export const isTextBindableContainer = (element: ExcalidrawElement | null) => {
export const isTextBindableContainer = (
element: ExcalidrawElement | null,
): element is ExcalidrawTextContainer => {
return (
element != null &&
(element.type === "rectangle" ||
+11 -3
View File
@@ -1,5 +1,5 @@
import { Point } from "../types";
import { FONT_FAMILY, THEME } from "../constants";
import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
export type ChartType = "bar" | "line";
export type FillStyle = "hachure" | "cross-hatch" | "solid";
@@ -12,7 +12,9 @@ export type PointerType = "mouse" | "pen" | "touch";
export type StrokeSharpness = "round" | "sharp";
export type StrokeStyle = "solid" | "dashed" | "dotted";
export type TextAlign = "left" | "center" | "right";
export type VerticalAlign = "top" | "middle";
type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
type _ExcalidrawElementBase = Readonly<{
id: string;
@@ -133,8 +135,14 @@ export type ExcalidrawBindableElement =
| ExcalidrawTextElement
| ExcalidrawImageElement;
export type ExcalidrawTextContainer =
| ExcalidrawRectangleElement
| ExcalidrawDiamondElement
| ExcalidrawEllipseElement
| ExcalidrawImageElement;
export type ExcalidrawTextElementWithContainer = {
containerId: ExcalidrawGenericElement["id"];
containerId: ExcalidrawTextContainer["id"];
} & ExcalidrawTextElement;
export type PointBinding = {
+1
View File
@@ -5,6 +5,7 @@ export const FILE_UPLOAD_TIMEOUT = 300;
export const LOAD_IMAGES_TIMEOUT = 500;
export const SYNC_FULL_SCENE_INTERVAL_MS = 20000;
export const SYNC_BROWSER_TABS_TIMEOUT = 50;
export const CURSOR_SYNC_TIMEOUT = 33; // ~30fps
export const FILE_UPLOAD_MAX_BYTES = 3 * 1024 * 1024; // 3 MiB
// 1 year (https://stackoverflow.com/a/25201898/927631)
+85 -40
View File
@@ -16,6 +16,7 @@ import {
withBatchedUpdates,
} from "../../utils";
import {
CURSOR_SYNC_TIMEOUT,
FILE_UPLOAD_MAX_BYTES,
FIREBASE_STORAGE_PREFIXES,
INITIAL_SCENE_UPDATE_TIMEOUT,
@@ -27,8 +28,8 @@ import {
import {
generateCollaborationLinkData,
getCollaborationLink,
getCollabServer,
SocketUpdateDataSource,
SOCKET_SERVER,
} from "../data";
import {
isSavedToFirebase,
@@ -353,32 +354,29 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
this.isCollaborating = true;
const { default: socketIOClient }: any = await import(
const { default: socketIOClient } = await import(
/* webpackChunkName: "socketIoClient" */ "socket.io-client"
);
this.portal.open(socketIOClient(SOCKET_SERVER), roomId, roomKey);
try {
const socketServerData = await getCollabServer();
if (existingRoomLinkData) {
this.excalidrawAPI.resetScene();
this.portal.socket = this.portal.open(
socketIOClient(socketServerData.url, {
transports: socketServerData.polling
? ["websocket", "polling"]
: ["websocket"],
}),
roomId,
roomKey,
);
} catch (error: any) {
console.error(error);
this.setState({ errorMessage: error.message });
return null;
}
try {
const elements = await loadFromFirebase(
roomId,
roomKey,
this.portal.socket,
);
if (elements) {
scenePromise.resolve({
elements,
scrollToContent: true,
});
}
} catch (error: any) {
// log the error and move on. other peers will sync us the scene.
console.error(error);
}
} else {
if (!existingRoomLinkData) {
const elements = this.excalidrawAPI.getSceneElements().map((element) => {
if (isImageElement(element) && element.status === "saved") {
return newElementWith(element, { status: "pending" });
@@ -402,14 +400,17 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
}
// fallback in case you're not alone in the room but still don't receive
// initial SCENE_UPDATE message
// initial SCENE_INIT message
this.socketInitializationTimer = window.setTimeout(() => {
this.initializeSocket();
this.initializeRoom({
roomLinkData: existingRoomLinkData,
fetchScene: true,
});
scenePromise.resolve(null);
}, INITIAL_SCENE_UPDATE_TIMEOUT);
// All socket listeners are moving to Portal
this.portal.socket!.on(
this.portal.socket.on(
"client-broadcast",
async (encryptedData: ArrayBuffer, iv: Uint8Array) => {
if (!this.portal.roomKey) {
@@ -427,7 +428,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
return;
case SCENE.INIT: {
if (!this.portal.socketInitialized) {
this.initializeSocket();
this.initializeRoom({ fetchScene: false });
const remoteElements = decryptedData.payload.elements;
const reconciledElements = this.reconcileElements(remoteElements);
this.handleRemoteSceneUpdate(reconciledElements, {
@@ -481,12 +482,15 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
},
);
this.portal.socket!.on("first-in-room", () => {
this.portal.socket.on("first-in-room", async () => {
if (this.portal.socket) {
this.portal.socket.off("first-in-room");
}
this.initializeSocket();
scenePromise.resolve(null);
const sceneData = await this.initializeRoom({
fetchScene: true,
roomLinkData: existingRoomLinkData,
});
scenePromise.resolve(sceneData);
});
this.initializeIdleDetector();
@@ -498,9 +502,45 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
return scenePromise;
};
private initializeSocket = () => {
this.portal.socketInitialized = true;
private initializeRoom = async ({
fetchScene,
roomLinkData,
}:
| {
fetchScene: true;
roomLinkData: { roomId: string; roomKey: string } | null;
}
| { fetchScene: false; roomLinkData?: null }) => {
clearTimeout(this.socketInitializationTimer!);
if (fetchScene && roomLinkData && this.portal.socket) {
this.excalidrawAPI.resetScene();
try {
const elements = await loadFromFirebase(
roomLinkData.roomId,
roomLinkData.roomKey,
this.portal.socket,
);
if (elements) {
this.setLastBroadcastedOrReceivedSceneVersion(
getSceneVersion(elements),
);
return {
elements,
scrollToContent: true,
};
}
} catch (error: any) {
// log the error and move on. other peers will sync us the scene.
console.error(error);
} finally {
this.portal.socketInitialized = true;
}
} else {
this.portal.socketInitialized = true;
}
return null;
};
private reconcileElements = (
@@ -564,7 +604,9 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
window.clearTimeout(this.idleTimeoutId);
this.idleTimeoutId = null;
}
this.idleTimeoutId = window.setTimeout(this.reportIdle, IDLE_THRESHOLD);
if (!this.activeIntervalId) {
this.activeIntervalId = window.setInterval(
this.reportActive,
@@ -639,15 +681,18 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
return this.excalidrawAPI.getSceneElementsIncludingDeleted();
};
onPointerUpdate = (payload: {
pointer: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["pointer"];
button: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["button"];
pointersMap: Gesture["pointers"];
}) => {
payload.pointersMap.size < 2 &&
this.portal.socket &&
this.portal.broadcastMouseLocation(payload);
};
onPointerUpdate = throttle(
(payload: {
pointer: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["pointer"];
button: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["button"];
pointersMap: Gesture["pointers"];
}) => {
payload.pointersMap.size < 2 &&
this.portal.socket &&
this.portal.broadcastMouseLocation(payload);
},
CURSOR_SYNC_TIMEOUT,
);
onIdleStateChange = (userState: UserIdleState) => {
this.setState({ userState });
+2
View File
@@ -45,6 +45,8 @@ class Portal {
this.socket.on("room-user-change", (clients: string[]) => {
this.collab.setCollaborators(clients);
});
return socket;
}
close() {
+28 -1
View File
@@ -30,7 +30,34 @@ const generateRoomId = async () => {
return bytesToHexString(buffer);
};
export const SOCKET_SERVER = process.env.REACT_APP_SOCKET_SERVER_URL;
/**
* Right now the reason why we resolve connection params (url, polling...)
* from upstream is to allow changing the params immediately when needed without
* having to wait for clients to update the SW.
*
* If REACT_APP_WS_SERVER_URL env is set, we use that instead (useful for forks)
*/
export const getCollabServer = async (): Promise<{
url: string;
polling: boolean;
}> => {
if (process.env.REACT_APP_WS_SERVER_URL) {
return {
url: process.env.REACT_APP_WS_SERVER_URL,
polling: true,
};
}
try {
const resp = await fetch(
`${process.env.REACT_APP_PORTAL_URL}/collab-server`,
);
return await resp.json();
} catch (error) {
console.error(error);
throw new Error(t("errors.cannotResolveCollabServer"));
}
};
export type EncryptedData = {
data: ArrayBuffer;
+5
View File
@@ -1,4 +1,9 @@
.excalidraw {
--color-primary-contrast-offset: #625ee0; // to offset Chubb illusion
&.theme--dark {
--color-primary-contrast-offset: #726dff; // to offset Chubb illusion
}
.layer-ui__wrapper__footer-center {
display: flex;
justify-content: space-between;
+1 -1
View File
@@ -62,7 +62,7 @@ const NVECTOR_BASE = ["1", "e0", "e1", "e2", "e01", "e20", "e12", "e012"];
export const nvector = (value: number = 0, index: number = 0): NVector => {
const result = [0, 0, 0, 0, 0, 0, 0, 0];
if (index < 0 || index > 7) {
throw new Error(`Expected \`index\` betwen 0 and 7, got \`${index}\``);
throw new Error(`Expected \`index\` between 0 and 7, got \`${index}\``);
}
if (value !== 0) {
result[index] = value;
+1 -1
View File
@@ -7,7 +7,7 @@ import { Line, Point } from "./ga";
*
* This maps to a standard formula `a * x + b * y + c`.
*
* `(-b, a)` correponds to a 2D vector parallel to the line. The lines
* `(-b, a)` corresponds to a 2D vector parallel to the line. The lines
* have a natural orientation, corresponding to that vector.
*
* The magnitude ("norm") of the line is `sqrt(a ^ 2 + b ^ 2)`.
+5 -1
View File
@@ -21,7 +21,7 @@ declare namespace NodeJS {
interface ProcessEnv {
readonly REACT_APP_BACKEND_V2_GET_URL: string;
readonly REACT_APP_BACKEND_V2_POST_URL: string;
readonly REACT_APP_SOCKET_SERVER_URL: string;
readonly REACT_APP_PORTAL_URL: string;
readonly REACT_APP_FIREBASE_CONFIG: string;
}
}
@@ -34,6 +34,10 @@ type Mutable<T> = {
-readonly [P in keyof T]: T[P];
};
/** utility type to assert that the second type is a subtype of the first type.
* Returns the subtype. */
type SubtypeOf<Supertype, Subtype extends Supertype> = Subtype;
type ResolutionType<T extends (...args: any) => any> = T extends (
...args: any
) => Promise<infer R>
+6 -15
View File
@@ -1,13 +1,7 @@
import {
GroupId,
ExcalidrawElement,
NonDeleted,
ExcalidrawTextElementWithContainer,
} from "./element/types";
import { GroupId, ExcalidrawElement, NonDeleted } from "./element/types";
import { AppState } from "./types";
import { getSelectedElements } from "./scene";
import { getBoundTextElementId } from "./element/textElement";
import Scene from "./scene/Scene";
import { getBoundTextElement } from "./element/textElement";
export const selectGroup = (
groupId: GroupId,
@@ -182,13 +176,10 @@ export const getMaximumGroups = (
const currentGroupMembers = groups.get(groupId) || [];
// Include bounded text if present when grouping
const boundTextElementId = getBoundTextElementId(element);
if (boundTextElementId) {
const textElement = Scene.getScene(element)!.getElement(
boundTextElementId,
) as ExcalidrawTextElementWithContainer;
currentGroupMembers.push(textElement);
// Include bound text if present when grouping
const boundTextElement = getBoundTextElement(element);
if (boundTextElement) {
currentGroupMembers.push(boundTextElement);
}
groups.set(groupId, [...currentGroupMembers, element]);
});
+29 -27
View File
@@ -64,6 +64,7 @@
"cartoonist": "كرتوني",
"fileTitle": "إسم الملف",
"colorPicker": "منتقي اللون",
"canvasColors": "",
"canvasBackground": "خلفية اللوحة",
"drawingCanvas": "لوحة الرسم",
"layers": "الطبقات",
@@ -107,9 +108,9 @@
"increaseFontSize": "تكبير حجم الخط",
"unbindText": "",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "تعديل الرابط",
"create": "إنشاء رابط",
"label": "رابط"
}
},
"buttons": {
@@ -167,7 +168,7 @@
"errorAddingToLibrary": "تعذر إضافة العنصر للمكتبة",
"errorRemovingFromLibrary": "تعذر إزالة العنصر من المكتبة",
"confirmAddLibrary": "هذا سيضيف {{numShapes}} شكل إلى مكتبتك. هل أنت متأكد؟",
"imageDoesNotContainScene": "",
"imageDoesNotContainScene": "يبدو أن هذه الصورة لا تحتوي على أي بيانات مشهد. هل قمت بتمكين تضمين المشهد أثناء التصدير؟",
"cannotRestoreFromImage": "تعذر استعادة المشهد من ملف الصورة",
"invalidSceneUrl": "تعذر استيراد المشهد من عنوان URL المتوفر. إما أنها مشوهة، أو لا تحتوي على بيانات Excalidraw JSON صالحة.",
"resetLibrary": "هذا سوف يمسح مكتبتك. هل أنت متأكد؟",
@@ -179,7 +180,8 @@
"imageInsertError": "تعذر إدراج الصورة. حاول مرة أخرى لاحقاً...",
"fileTooBig": "الملف كبير جداً. الحد الأقصى المسموح به للحجم هو {{maxSize}}.",
"svgImageInsertError": "تعذر إدراج صورة SVG. يبدو أن ترميز SVG غير صحيح.",
"invalidSVGString": "SVG غير صالح."
"invalidSVGString": "SVG غير صالح.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "تحديد",
@@ -217,7 +219,7 @@
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"placeImage": "",
"publishLibrary": "",
"publishLibrary": "نشر مكتبتك",
"bindTextToElement": "",
"deepBoxSelect": ""
},
@@ -289,46 +291,46 @@
"zoomToSelection": "تكبير للعنصر المحدد"
},
"clearCanvasDialog": {
"title": ""
"title": "مسح اللوحة"
},
"publishDialog": {
"title": "",
"itemName": "",
"authorName": "",
"githubUsername": "",
"twitterUsername": "",
"libraryName": "",
"libraryDesc": "",
"website": "",
"title": "نشر المكتبة",
"itemName": "إسم العنصر",
"authorName": "إسم المؤلف",
"githubUsername": "اسم المستخدم في جيت هب",
"twitterUsername": "اسم المستخدم في تويتر",
"libraryName": "اسم المكتبة",
"libraryDesc": "وصف المكتبة",
"website": "الموقع",
"placeholder": {
"authorName": "",
"libraryName": "",
"libraryDesc": "",
"authorName": "اسمك أو اسم المستخدم",
"libraryName": "اسم مكتبتك",
"libraryDesc": "وصف مكتبتك لمساعدة الناس على فهم استخدامها",
"githubHandle": "",
"twitterHandle": "",
"website": ""
},
"errors": {
"required": "مطلوب",
"website": ""
"website": "أدخل عنوان URL صالح"
},
"noteDescription": {
"pre": "",
"link": "",
"post": ""
"link": "مستودع المكتبة العامة",
"post": "ليستخدمها الآخرون في رسوماتهم."
},
"noteGuidelines": {
"pre": "",
"link": "",
"pre": "يجب الموافقة على المكتبة يدويًا أولاً. يرجى قراءة ",
"link": "الإرشادات",
"post": ""
},
"noteLicense": {
"pre": "",
"link": "",
"post": ""
"link": "رخصة إم أي تي ",
"post": "وهو ما يعني باختصار أنه يمكن لأي شخص استخدامها دون قيود."
},
"noteItems": "",
"atleastOneLibItem": ""
"noteItems": "يجب أن يكون لكل عنصر مكتبة اسمه الخاص حتى يكون قابلاً للتصفية. سيتم تضمين عناصر المكتبة التالية:",
"atleastOneLibItem": "يرجى تحديد عنصر مكتبة واحد على الأقل للبدء"
},
"publishSuccessDialog": {
"title": "تم إرسال المكتبة",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Карикатурист",
"fileTitle": "Име на файл",
"colorPicker": "Избор на цвят",
"canvasColors": "",
"canvasBackground": "Фон на платно",
"drawingCanvas": "Платно за рисуване",
"layers": "Слоеве",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Селекция",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "",
"drawingCanvas": "",
"layers": "",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+17 -15
View File
@@ -64,6 +64,7 @@
"cartoonist": "Dibuixant",
"fileTitle": "Nom del fitxer",
"colorPicker": "Selector de colors",
"canvasColors": "Usat al llenç",
"canvasBackground": "Fons del llenç",
"drawingCanvas": "Llenç de dibuix",
"layers": "Capes",
@@ -103,13 +104,13 @@
"toggleTheme": "Activa o desactiva el tema",
"personalLib": "Biblioteca personal",
"excalidrawLib": "Biblioteca d'Excalidraw",
"decreaseFontSize": "",
"increaseFontSize": "",
"unbindText": "",
"decreaseFontSize": "Redueix la mida de la lletra",
"increaseFontSize": "Augmenta la mida de la lletra",
"unbindText": "Desvincular el text",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Edita l'enllaç",
"create": "Crea un enllaç",
"label": "Enllaç"
}
},
"buttons": {
@@ -167,7 +168,7 @@
"errorAddingToLibrary": "No s'ha pogut afegir l'element a la biblioteca",
"errorRemovingFromLibrary": "No s'ha pogut eliminar l'element de la biblioteca",
"confirmAddLibrary": "Això afegirà {{numShapes}} forma(es) a la vostra biblioteca. Estàs segur?",
"imageDoesNotContainScene": "",
"imageDoesNotContainScene": "Aquesta imatge no sembla contenir cap dada d'escena. Heu activat l'incrustació de l'escena durant l'exportació?",
"cannotRestoreFromImage": "Lescena no sha pogut restaurar des daquest fitxer dimatge",
"invalidSceneUrl": "No s'ha pogut importar l'escena des de l'adreça URL proporcionada. Està malformada o no conté dades Excalidraw JSON vàlides.",
"resetLibrary": "Això buidarà la biblioteca. N'esteu segur?",
@@ -179,7 +180,8 @@
"imageInsertError": "No s'ha pogut insertar la imatge, torneu-ho a provar més tard...",
"fileTooBig": "El fitxer és massa gros. La mida màxima permesa és {{maxSize}}.",
"svgImageInsertError": "No ha estat possible inserir la imatge SVG. Les marques SVG semblen invàlides.",
"invalidSVGString": "SVG no vàlid."
"invalidSVGString": "SVG no vàlid.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Selecció",
@@ -193,8 +195,8 @@
"text": "Text",
"library": "Biblioteca",
"lock": "Mantenir activa l'eina seleccionada desprès de dibuixar",
"penMode": "",
"link": ""
"penMode": "Evita el zoom i accepta solament el dibuix lliure amb bolígraf",
"link": "Afegeix / actualitza l'enllaç per a la forma seleccionada"
},
"headings": {
"canvasActions": "Accions del llenç",
@@ -214,12 +216,12 @@
"resizeImage": "Podeu redimensionar lliurement prement MAJÚSCULA;\nper a redimensionar des del centre, premeu ALT",
"rotate": "Per restringir els angles mentre gira, mantenir premut el majúscul (SHIFT)",
"lineEditor_info": "Fes doble clic o premi Enter per editar punts",
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"lineEditor_pointSelected": "Premeu Suprimir per a eliminar el(s) punt(s), CtrlOrCmd+D per a duplicar-lo, o arrossegueu-lo per a moure'l",
"lineEditor_nothingSelected": "Seleccioneu un punt per a editar-lo (premeu SHIFT si voleu\nselecció múltiple), o manteniu Alt i feu clic per a afegir més punts",
"placeImage": "Feu clic per a col·locar la imatge o clic i arrossegar per a establir-ne la mida manualment",
"publishLibrary": "Publiqueu la vostra pròpia llibreria",
"bindTextToElement": "Premeu enter per a afegir-hi text",
"deepBoxSelect": ""
"deepBoxSelect": "Manteniu CtrlOrCmd per a selecció profunda, i per a evitar l'arrossegament"
},
"canvasError": {
"cannotShowPreview": "No es pot mostrar la previsualització",
@@ -266,7 +268,7 @@
"helpDialog": {
"blog": "Llegiu el nostre blog",
"click": "clic",
"deepSelect": "",
"deepSelect": "Selecció profunda",
"deepBoxSelect": "",
"curvedArrow": "Fletxa corba",
"curvedLine": "Línia corba",
@@ -305,7 +307,7 @@
"libraryName": "Nom de la vostra biblioteca",
"libraryDesc": "Descripció de la biblioteca per a ajudar a la gent a entendre'n el funcionament",
"githubHandle": "",
"twitterHandle": "",
"twitterHandle": "Usuari de twitter (opcional), per tal que puguem donar-vos crèdit quan fem la promoció a Twitter",
"website": "Enllaç al vostre lloc web personal o a qualsevol altre (opcional)"
},
"errors": {
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "Pozadí plátna",
"drawingCanvas": "",
"layers": "",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Výběr",
+4 -2
View File
@@ -5,7 +5,7 @@
"selectAll": "Marker alle",
"multiSelect": "",
"moveCanvas": "",
"cut": "",
"cut": "Klip",
"copy": "Kopier",
"copyAsPng": "Kopier til klippebord som PNG",
"copyAsSvg": "Kopier til klippebord som SVG",
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "Filnavn",
"colorPicker": "Farvevælger",
"canvasColors": "Brugt på lærred",
"canvasBackground": "",
"drawingCanvas": "",
"layers": "",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Karikaturist",
"fileTitle": "Dateiname",
"colorPicker": "Farbauswähler",
"canvasColors": "Auf Leinwand verwendet",
"canvasBackground": "Zeichenflächenhintergrund",
"drawingCanvas": "Leinwand",
"layers": "Ebenen",
@@ -179,7 +180,8 @@
"imageInsertError": "Das Bild konnte nicht eingefügt werden. Versuche es später erneut...",
"fileTooBig": "Die Datei ist zu groß. Die maximal zulässige Größe ist {{maxSize}}.",
"svgImageInsertError": "SVG-Bild konnte nicht eingefügt werden. Das SVG-Markup sieht ungültig aus.",
"invalidSVGString": "Ungültige SVG."
"invalidSVGString": "Ungültige SVG.",
"cannotResolveCollabServer": "Konnte keine Verbindung zum Collab-Server herstellen. Bitte lade die Seite neu und versuche es erneut."
},
"toolBar": {
"selection": "Auswahl",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Σκιτσογράφος",
"fileTitle": "Όνομα αρχείου",
"colorPicker": "Επιλογή Χρώματος",
"canvasColors": "",
"canvasBackground": "Φόντο καμβά",
"drawingCanvas": "Σχεδίαση καμβά",
"layers": "Στρώματα",
@@ -179,7 +180,8 @@
"imageInsertError": "Αδυναμία εισαγωγής εικόνας. Προσπαθήστε ξανά αργότερα...",
"fileTooBig": "Το αρχείο είναι πολύ μεγάλο. Το μέγιστο επιτρεπόμενο μέγεθος είναι {{maxSize}}.",
"svgImageInsertError": "",
"invalidSVGString": "Μη έγκυρο SVG."
"invalidSVGString": "Μη έγκυρο SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Επιλογή",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Cartoonist",
"fileTitle": "File name",
"colorPicker": "Color picker",
"canvasColors": "Used on canvas",
"canvasBackground": "Canvas background",
"drawingCanvas": "Drawing canvas",
"layers": "Layers",
@@ -179,7 +180,8 @@
"imageInsertError": "Couldn't insert image. Try again later...",
"fileTooBig": "File is too big. Maximum allowed size is {{maxSize}}.",
"svgImageInsertError": "Couldn't insert SVG image. The SVG markup looks invalid.",
"invalidSVGString": "Invalid SVG."
"invalidSVGString": "Invalid SVG.",
"cannotResolveCollabServer": "Couldn't connect to the collab server. Please reload the page and try again."
},
"toolBar": {
"selection": "Selection",
+59 -57
View File
@@ -64,6 +64,7 @@
"cartoonist": "Caricatura",
"fileTitle": "Nombre del archivo",
"colorPicker": "Selector de color",
"canvasColors": "Usado en lienzo",
"canvasBackground": "Fondo del lienzo",
"drawingCanvas": "Lienzo de dibujo",
"layers": "Capas",
@@ -101,15 +102,15 @@
"showStroke": "Mostrar selector de color de trazo",
"showBackground": "Mostrar el selector de color de fondo",
"toggleTheme": "Alternar tema",
"personalLib": "",
"excalidrawLib": "",
"decreaseFontSize": "",
"increaseFontSize": "",
"unbindText": "",
"personalLib": "Biblioteca personal",
"excalidrawLib": "Biblioteca Excalidraw",
"decreaseFontSize": "Disminuir tamaño de letra",
"increaseFontSize": "Aumentar el tamaño de letra",
"unbindText": "Desvincular texto",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Editar enlace",
"create": "Crear enlace",
"label": "Enlace"
}
},
"buttons": {
@@ -146,10 +147,10 @@
"exitZenMode": "Salir del modo Zen",
"cancel": "Cancelar",
"clear": "Borrar",
"remove": "",
"publishLibrary": "",
"submit": "",
"confirm": ""
"remove": "Eliminar",
"publishLibrary": "Publicar",
"submit": "Enviar",
"confirm": "Confirmar"
},
"alerts": {
"clearReset": "Esto limpiará todo el lienzo. Estás seguro?",
@@ -171,7 +172,7 @@
"cannotRestoreFromImage": "No se pudo restaurar la escena desde este archivo de imagen",
"invalidSceneUrl": "No se ha podido importar la escena desde la URL proporcionada. Está mal formada, o no contiene datos de Excalidraw JSON válidos.",
"resetLibrary": "Esto borrará tu biblioteca. ¿Estás seguro?",
"removeItemsFromsLibrary": "",
"removeItemsFromsLibrary": "¿Eliminar {{count}} elemento(s) de la biblioteca?",
"invalidEncryptionKey": "La clave de cifrado debe tener 22 caracteres. La colaboración en vivo está deshabilitada."
},
"errors": {
@@ -179,7 +180,8 @@
"imageInsertError": "No se pudo insertar la imagen. Inténtelo de nuevo más tarde...",
"fileTooBig": "Archivo demasiado grande. El tamaño máximo permitido es {{maxSize}}.",
"svgImageInsertError": "No se pudo insertar la imagen SVG. El código SVG parece inválido.",
"invalidSVGString": "SVG no válido."
"invalidSVGString": "SVG no válido.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Selección",
@@ -193,8 +195,8 @@
"text": "Texto",
"library": "Biblioteca",
"lock": "Mantener la herramienta seleccionada activa después de dibujar",
"penMode": "",
"link": ""
"penMode": "Evitar el zoom de pellizco y aceptar la entrada libre sólo desde el lápiz",
"link": "Añadir/Actualizar enlace para una forma seleccionada"
},
"headings": {
"canvasActions": "Acciones del lienzo",
@@ -202,7 +204,7 @@
"shapes": "Formas"
},
"hints": {
"canvasPanning": "Para mover lienzo, mantenga la rueda del ratón o la barra espaciadora mientras arrastra",
"canvasPanning": "Para mover el lienzo, mantenga la rueda del ratón o la barra de espacio mientras arrastra",
"linearElement": "Haz clic para dibujar múltiples puntos, arrastrar para solo una línea",
"freeDraw": "Haz clic y arrastra, suelta al terminar",
"text": "Consejo: también puedes añadir texto haciendo doble clic en cualquier lugar con la herramienta de selección",
@@ -214,12 +216,12 @@
"resizeImage": "Puede redimensionar libremente pulsando SHIFT,\npulse ALT para redimensionar desde el centro",
"rotate": "Puedes restringir los ángulos manteniendo presionado SHIFT mientras giras",
"lineEditor_info": "Doble clic o pulse Enter para editar puntos",
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"lineEditor_pointSelected": "Presione Suprimir para eliminar el/los punto(s), CtrlOrCmd+D para duplicarlo, o arrástrelo para moverlo",
"lineEditor_nothingSelected": "Seleccione un punto a editar (mantenga MAYÚSCULAS para seleccionar múltiples),\no mantenga pulsado Alt y haga clic para añadir nuevos puntos",
"placeImage": "Haga clic para colocar la imagen o haga clic y arrastre para establecer su tamaño manualmente",
"publishLibrary": "",
"bindTextToElement": "",
"deepBoxSelect": ""
"publishLibrary": "Publica tu propia biblioteca",
"bindTextToElement": "Presione Entrar para agregar",
"deepBoxSelect": "Mantén CtrlOrCmd para seleccionar en profundidad, y para evitar arrastrar"
},
"canvasError": {
"cannotShowPreview": "No se puede mostrar la vista previa",
@@ -266,8 +268,8 @@
"helpDialog": {
"blog": "Lea nuestro blog",
"click": "clic",
"deepSelect": "",
"deepBoxSelect": "",
"deepSelect": "Selección profunda",
"deepBoxSelect": "Seleccione en profundidad dentro de la caja, y evite arrastrar",
"curvedArrow": "Flecha curva",
"curvedLine": "Línea curva",
"documentation": "Documentación",
@@ -292,52 +294,52 @@
"title": "Borrar lienzo"
},
"publishDialog": {
"title": "",
"itemName": "",
"authorName": "",
"githubUsername": "",
"twitterUsername": "",
"libraryName": "",
"libraryDesc": "",
"website": "",
"title": "Publicar biblioteca",
"itemName": "Nombre del artículo",
"authorName": "Nombre del autor",
"githubUsername": "Nombre de usuario de Github",
"twitterUsername": "Nombre de usuario de Twitter",
"libraryName": "Nombre de la librería",
"libraryDesc": "Descripción de la biblioteca",
"website": "Sitio Web",
"placeholder": {
"authorName": "",
"libraryName": "",
"libraryDesc": "",
"githubHandle": "",
"twitterHandle": "",
"website": ""
"authorName": "Nombre o nombre de usuario",
"libraryName": "Nombre de tu biblioteca",
"libraryDesc": "Descripción de su biblioteca para ayudar a la gente a entender su uso",
"githubHandle": "GitHub maneja (opcional), así que puede editar la biblioteca una vez enviada para su revisión",
"twitterHandle": "Nombre de usuario de Twitter (opcional), así que sabemos a quién acreditar cuando se promociona en Twitter",
"website": "Enlace a su sitio web personal o en cualquier otro lugar (opcional)"
},
"errors": {
"required": "",
"website": ""
"required": "Requerido",
"website": "Introduce una URL válida"
},
"noteDescription": {
"pre": "",
"link": "",
"post": ""
"pre": "Envía tu biblioteca para ser incluida en el ",
"link": "repositorio de librería pública",
"post": "para que otras personas utilicen en sus dibujos."
},
"noteGuidelines": {
"pre": "",
"link": "",
"post": ""
"pre": "La biblioteca debe ser aprobada manualmente primero. Por favor, lea la ",
"link": "pautas",
"post": " antes de enviar. Necesitará una cuenta de GitHub para comunicarse y hacer cambios si se solicita, pero no es estrictamente necesario."
},
"noteLicense": {
"pre": "",
"link": "",
"post": ""
"pre": "Al enviar, usted acepta que la biblioteca se publicará bajo el ",
"link": "Licencia MIT ",
"post": "que en breve significa que cualquiera puede utilizarlos sin restricciones."
},
"noteItems": "",
"atleastOneLibItem": ""
"noteItems": "Cada elemento de la biblioteca debe tener su propio nombre para que sea filtrable. Los siguientes elementos de la biblioteca serán incluidos:",
"atleastOneLibItem": "Por favor, seleccione al menos un elemento de la biblioteca para empezar"
},
"publishSuccessDialog": {
"title": "",
"content": "",
"link": ""
"title": "Biblioteca enviada",
"content": "Gracias {{authorName}}. Su biblioteca ha sido enviada para ser revisada. Puede seguir el estado",
"link": "aquí"
},
"confirmDialog": {
"resetLibrary": "",
"removeItemsFromLib": ""
"resetLibrary": "Reiniciar biblioteca",
"removeItemsFromLib": "Eliminar elementos seleccionados de la biblioteca"
},
"encrypted": {
"tooltip": "Tus dibujos están cifrados de punto a punto, por lo que los servidores de Excalidraw nunca los verán.",
@@ -359,7 +361,7 @@
"width": "Ancho"
},
"toast": {
"addedToLibrary": "",
"addedToLibrary": "Añadido a la biblioteca",
"copyStyles": "Estilos copiados.",
"copyToClipboard": "Copiado en el portapapeles.",
"copyToClipboardAsPng": "Copiado {{exportSelection}} al portapapeles como PNG\n({{exportColorScheme}})",
+16 -14
View File
@@ -64,6 +64,7 @@
"cartoonist": "Marrazkilaria",
"fileTitle": "Fitxategi izena",
"colorPicker": "Kolore-hautatzailea",
"canvasColors": "",
"canvasBackground": "Oihalaren atzeko planoa",
"drawingCanvas": "Marrazteko oihala",
"layers": "Geruzak",
@@ -107,9 +108,9 @@
"increaseFontSize": "Handitu letra tamaina",
"unbindText": "Askatu testua",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Editatu esteka",
"create": "Sortu esteka",
"label": "Esteka"
}
},
"buttons": {
@@ -149,7 +150,7 @@
"remove": "Kendu",
"publishLibrary": "Argitaratu",
"submit": "Bidali",
"confirm": "Baieztatu"
"confirm": "Bai"
},
"alerts": {
"clearReset": "Honek oihal osoa garbituko du. Ziur zaude?",
@@ -179,7 +180,8 @@
"imageInsertError": "Ezin izan da irudia txertatu. Saiatu berriro geroago...",
"fileTooBig": "Fitxategia handiegia da. Onartutako gehienezko tamaina {{maxSize}} da.",
"svgImageInsertError": "Ezin izan da SVG irudia txertatu. SVG markak baliogabea dirudi.",
"invalidSVGString": "SVG baliogabea."
"invalidSVGString": "SVG baliogabea.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Hautapena",
@@ -193,8 +195,8 @@
"text": "Testua",
"library": "Liburutegia",
"lock": "Mantendu aktibo hautatutako tresna marraztu ondoren",
"penMode": "",
"link": ""
"penMode": "Saihestu txikiagotzea eta onartu marrazte libreko idazketa solik arkatza bidez",
"link": "Gehitu / Eguneratu esteka hautatutako forma baterako"
},
"headings": {
"canvasActions": "Canvas ekintzak",
@@ -219,15 +221,15 @@
"placeImage": "Egin klik irudia kokatzeko, edo egin klik eta arrastatu bere tamaina eskuz ezartzeko",
"publishLibrary": "Argitaratu zure liburutegia",
"bindTextToElement": "Sakatu Sartu testua gehitzeko",
"deepBoxSelect": ""
"deepBoxSelect": "Eutsi Ctrl edo Cmd sakatuta aukeraketa sakona egiteko eta arrastatzea saihesteko"
},
"canvasError": {
"cannotShowPreview": "",
"canvasTooBig": "",
"canvasTooBigTip": ""
"cannotShowPreview": "Ezin da oihala aurreikusi",
"canvasTooBig": "Agian oihala handiegia da.",
"canvasTooBigTip": "Aholkua: saiatu urrunen dauden elementuak pixka bat hurbiltzen."
},
"errorSplash": {
"headingMain_pre": "",
"headingMain_pre": "Errore bat aurkitu da. Saiatu ",
"headingMain_button": "orria birkargatzen.",
"clearCanvasMessage": "Birkargatzea ez bada burutzen, saiatu ",
"clearCanvasMessage_button": "oihala garbitzen.",
@@ -266,8 +268,8 @@
"helpDialog": {
"blog": "Irakurri gure bloga",
"click": "sakatu",
"deepSelect": "",
"deepBoxSelect": "",
"deepSelect": "Hautapen sakona",
"deepBoxSelect": "Hautapen sakona egin laukizuzen bidez, eta saihestu arrastatzea",
"curvedArrow": "Gezi kurbatua",
"curvedLine": "Lerro kurbatua",
"documentation": "Dokumentazioa",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "کارتونیست",
"fileTitle": "نام فایل",
"colorPicker": "انتخابگر رنگ",
"canvasColors": "",
"canvasBackground": "بوم",
"drawingCanvas": "بوم نقاشی",
"layers": "لایه ها",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "گزینش",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Sarjakuva",
"fileTitle": "Tiedostonimi",
"colorPicker": "Värin valinta",
"canvasColors": "",
"canvasBackground": "Piirtoalueen tausta",
"drawingCanvas": "Piirtoalue",
"layers": "Tasot",
@@ -179,7 +180,8 @@
"imageInsertError": "Kuvan lisääminen epäonnistui. Yritä myöhemmin uudelleen...",
"fileTooBig": "Tiedosto on liian suuri. Suurin sallittu koko on {{maxSize}}.",
"svgImageInsertError": "SVG- kuvaa ei voitu lisätä. Tiedoston SVG-sisältö näyttää virheelliseltä.",
"invalidSVGString": "Virheellinen SVG."
"invalidSVGString": "Virheellinen SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Valinta",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Caricaturiste",
"fileTitle": "Nom du fichier",
"colorPicker": "Sélecteur de couleur",
"canvasColors": "",
"canvasBackground": "Arrière-plan du canevas",
"drawingCanvas": "Zone de dessin",
"layers": "Calques",
@@ -179,7 +180,8 @@
"imageInsertError": "Impossible d'insérer l'image. Réessayez plus tard...",
"fileTooBig": "Le fichier est trop volumineux. La taille maximale autorisée est de {{maxSize}}.",
"svgImageInsertError": "Impossible d'insérer l'image SVG. Le balisage SVG semble invalide.",
"invalidSVGString": "SVG invalide."
"invalidSVGString": "SVG invalide.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Sélection",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "קריקטוריסט",
"fileTitle": "שם קובץ",
"colorPicker": "בחירת צבע",
"canvasColors": "",
"canvasBackground": "רקע הלוח",
"drawingCanvas": "לוח ציור",
"layers": "שכבות",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "בחירה",
+15 -13
View File
@@ -35,11 +35,11 @@
"arrowhead_arrow": "तीर",
"arrowhead_bar": "बार",
"arrowhead_dot": "बिंदु",
"arrowhead_triangle": "",
"arrowhead_triangle": "त्रिकोण",
"fontSize": "फ़ॉन्ट का आकार",
"fontFamily": "फ़ॉन्ट का परिवार",
"onlySelected": "केवल चयनित",
"withBackground": "",
"withBackground": "पृष्ठभूमि",
"exportEmbedScene": "",
"exportEmbedScene_details": "निर्यात एम्बेड दृश्य विवरण",
"addWatermark": "ऐड \"मेड विथ एक्सकैलिडराव\"",
@@ -64,6 +64,7 @@
"cartoonist": "व्यंग्य चित्रकार",
"fileTitle": "फ़ाइल का नाम",
"colorPicker": "रंग चयन",
"canvasColors": "",
"canvasBackground": "कैनवास बैकग्राउंड",
"drawingCanvas": "कैनवास बना रहे हैं",
"layers": "परतें",
@@ -93,18 +94,18 @@
"centerHorizontally": "क्षैतिज केन्द्रित",
"distributeHorizontally": "क्षैतिज रूप से वितरित करें",
"distributeVertically": "खड़ी रूप से वितरित करें",
"flipHorizontal": "",
"flipVertical": "",
"viewMode": "",
"flipHorizontal": "दायें बायें पलटे",
"flipVertical": "ऊपर नीचे पलटे",
"viewMode": "अलग अलग देखें",
"toggleExportColorScheme": "",
"share": "",
"share": "शेयर करें",
"showStroke": "",
"showBackground": "",
"toggleTheme": "",
"personalLib": "",
"excalidrawLib": "",
"decreaseFontSize": "",
"increaseFontSize": "",
"decreaseFontSize": "आकार घटाइऐ",
"increaseFontSize": "फ़ॉन्ट आकार बढ़ाएँ",
"unbindText": "",
"link": {
"edit": "",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "चयन",
@@ -408,11 +410,11 @@
"5f3dc4": "",
"364fc7": "",
"1864ab": "",
"0b7285": "",
"0b7285": "आसमानी",
"087f5b": "",
"2b8a3e": "",
"2b8a3e": "हरा",
"5c940d": "",
"e67700": "",
"d9480f": ""
"e67700": "पीला",
"d9480f": "नारंगी"
}
}
+184 -182
View File
@@ -35,12 +35,12 @@
"arrowhead_arrow": "Nyíl",
"arrowhead_bar": "Oszlop",
"arrowhead_dot": "Pont",
"arrowhead_triangle": "",
"arrowhead_triangle": "Háromszög",
"fontSize": "Betűméret",
"fontFamily": "Betűkészlet család",
"onlySelected": "Csak a kijelölt",
"withBackground": "",
"exportEmbedScene": "",
"withBackground": "Háttér",
"exportEmbedScene": "Jelenet beágyazása",
"exportEmbedScene_details": "A jelenetet leíró adatok hozzá lesznek adva a PNG/SVG fájlhoz, így a jelenetet vissza lehet majd tölteni belőle. Ez megnöveli a fájl méretét.",
"addWatermark": "Add hozzá, hogy \"Excalidraw-val készült\"",
"handDrawn": "Kézzel rajzolt",
@@ -62,14 +62,15 @@
"architect": "Tervezői",
"artist": "Művészi",
"cartoonist": "Karikatúrás",
"fileTitle": "",
"fileTitle": "Fájlnév",
"colorPicker": "Színválasztó",
"canvasColors": "Rajzvászonon használt",
"canvasBackground": "Vászon háttérszíne",
"drawingCanvas": "Rajzvászon",
"layers": "Rétegek",
"actions": "Műveletek",
"language": "Nyelv",
"liveCollaboration": "",
"liveCollaboration": "Élő együttműködés",
"duplicateSelection": "Duplikálás",
"untitled": "Névtelen",
"name": "Név",
@@ -78,7 +79,7 @@
"group": "Csoportosítás",
"ungroup": "Csoportbontás",
"collaborators": "Közreműködők",
"showGrid": "",
"showGrid": "Rács megjelenítése",
"addToLibrary": "Hozzáadás a könyvtárhoz",
"removeFromLibrary": "Eltávólítás a könyvtárból",
"libraryLoadingMessage": "Könyvtár betöltése…",
@@ -93,36 +94,36 @@
"centerHorizontally": "Vízszintesen középre igazított",
"distributeHorizontally": "Vízszintes elosztás",
"distributeVertically": "Függőleges elosztás",
"flipHorizontal": "",
"flipVertical": "",
"viewMode": "",
"toggleExportColorScheme": "",
"share": "",
"showStroke": "",
"showBackground": "",
"toggleTheme": "",
"personalLib": "",
"excalidrawLib": "",
"decreaseFontSize": "",
"increaseFontSize": "",
"unbindText": "",
"flipHorizontal": "Vízszintes tükrözés",
"flipVertical": "Függőleges tükrözés",
"viewMode": "Nézet",
"toggleExportColorScheme": "Exportált színséma váltása",
"share": "Megosztás",
"showStroke": "Körvonal színválasztó megjelenítése",
"showBackground": "Háttérszín-választó megjelenítése",
"toggleTheme": "Téma váltása",
"personalLib": "Személyes könyvtár",
"excalidrawLib": "Excalidraw könyvtár",
"decreaseFontSize": "Betűméret csökkentése",
"increaseFontSize": "Betűméret növelése",
"unbindText": "Szövegkötés feloldása",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Hivatkozás szerkesztése",
"create": "Hivatkozás létrehozása",
"label": "Hivatkozás"
}
},
"buttons": {
"clearReset": "Vászon törlése",
"exportJSON": "",
"exportImage": "",
"exportJSON": "Exportálás fájlba",
"exportImage": "Mentés képként",
"export": "Exportálás",
"exportToPng": "Exportálás PNG-be",
"exportToSvg": "Exportálás SVG-be",
"copyToClipboard": "Vágólapra másolás",
"copyPngToClipboard": "PNG másolása a vágólapra",
"scale": "Nagyítás",
"save": "",
"save": "Mentés az aktuális fájlba",
"saveAs": "Mentés másként",
"load": "Betöltés",
"getShareableLink": "Megosztható link létrehozása",
@@ -137,19 +138,19 @@
"edit": "Szerkesztés",
"undo": "Vissza",
"redo": "Újra",
"resetLibrary": "",
"resetLibrary": "Könyvtár alaphelyzetbe állítása",
"createNewRoom": "Új szoba létrehozása",
"fullScreen": "Teljes képernyő",
"darkMode": "Sötét mód",
"lightMode": "Világos mód",
"zenMode": "Letisztult mód",
"exitZenMode": "Kilépés a letisztult módból",
"cancel": "",
"clear": "",
"remove": "",
"publishLibrary": "",
"submit": "",
"confirm": ""
"cancel": "Mégsem",
"clear": "Kiűrítés",
"remove": "Eltávolítás",
"publishLibrary": "Közzététel",
"submit": "Elküldés",
"confirm": "Megerősítés"
},
"alerts": {
"clearReset": "Ez a művelet törli a vászont. Biztos benne?",
@@ -162,39 +163,40 @@
"decryptFailed": "Nem sikerült visszafejteni a titkosított adatot.",
"uploadedSecurly": "A feltöltést végpontok közötti titkosítással biztosítottuk, ami azt jelenti, hogy egy harmadik fél nem tudja megnézni a tartalmát, beleértve az Excalidraw szervereit is.",
"loadSceneOverridePrompt": "A betöltött külső rajz felül fogja írnia meglévőt. Szeretnéd folytatni?",
"collabStopOverridePrompt": "",
"collabStopOverridePrompt": "A munkamenet leállítása felül fogja írni az előzőleg helyben tárolt rajzot. Biztosan ezt akarod?\n(Ha meg akarod tartani a helyben tárolt rajzot, egyszerűen csak zárd be a böngésző fület)",
"errorLoadingLibrary": "Hibába ütközött a harmarmadik féltől származó könyvtár betöltése.",
"errorAddingToLibrary": "",
"errorRemovingFromLibrary": "",
"errorAddingToLibrary": "A tétel nem addható hozzá a könyvtárhoz",
"errorRemovingFromLibrary": "A tétel nem távolítható el a könyvtárból",
"confirmAddLibrary": "Ez a művelet {{numShapes}} formát fog hozzáadni a könyvtáradhoz. Biztos vagy benne?",
"imageDoesNotContainScene": "",
"imageDoesNotContainScene": "Úgy tűnik, hogy ez a kép nem tartalmaz jelenetadatokat. Engedélyezted a jelenetbeágyazást az exportálás során?",
"cannotRestoreFromImage": "A jelenet visszaállítása nem sikerült ebből a kép fájlból",
"invalidSceneUrl": "",
"resetLibrary": "",
"removeItemsFromsLibrary": "",
"invalidEncryptionKey": ""
"invalidSceneUrl": "Nem sikerült importálni a jelenetet a megadott URL-ről. Rossz formátumú, vagy nem tartalmaz érvényes Excalidraw JSON-adatokat.",
"resetLibrary": "Ezzel törlöd a könyvtárát. biztos vagy ebben?",
"removeItemsFromsLibrary": "{{count}} elemet törölsz a könyvtárból?",
"invalidEncryptionKey": "A titkosítási kulcsnak 22 karakterből kell állnia. Az élő együttműködés le van tiltva."
},
"errors": {
"unsupportedFileType": "",
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"unsupportedFileType": "Nem támogatott fájltípus.",
"imageInsertError": "Nem sikerült beszúrni a képet. Próbáld újra később...",
"fileTooBig": "A fájl túl nagy. A megengedett maximális méret {{maxSize}}.",
"svgImageInsertError": "Nem sikerült beszúrni az SVG-képet. Az SVG szintaktika érvénytelennek tűnik.",
"invalidSVGString": "Érvénytelen SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Kijelölés",
"image": "",
"image": "Kép beszúrása",
"rectangle": "Téglalap",
"diamond": "Rombusz",
"ellipse": "Ellipszis",
"arrow": "Nyíl",
"line": "Vonal",
"freedraw": "",
"freedraw": "Rajzolás",
"text": "Szöveg",
"library": "Könyvtár",
"lock": "Rajzolás után az aktív eszközt tartsa kijelölve",
"penMode": "",
"link": ""
"penMode": "Akadályozza meg a kicsinyítést, és csak tollról fogadja el a szabadkézi bevitelt",
"link": "Hivatkozás hozzáadása/frissítése a kiválasztott alakzathoz"
},
"headings": {
"canvasActions": "Vászon műveletek",
@@ -202,24 +204,24 @@
"shapes": "Alakzatok"
},
"hints": {
"canvasPanning": "",
"canvasPanning": "A vászon mozgatásához tartsd lenyomva az egér görgőjét vagy a szóköz billentyűt húzás közben",
"linearElement": "Kattintással görbe, az eger húzásával pedig egyenes nyilat rajzolhatsz",
"freeDraw": "Kattints és húzd, majd engedd el, amikor végeztél",
"text": "Tipp: A kijelölés eszközzel a dupla kattintás új szöveget hoz létre",
"text_selected": "",
"text_editing": "",
"text_selected": "Kattints duplán, vagy nyomj entert a szöveg szerkesztéséhez",
"text_editing": "Nyomjd meg az Escape vagy a Ctrl/Cmd+ENTER billentyűkombinációt a szerkesztés befejezéséhez",
"linearElementMulti": "Kattints a következő ív pozíciójára, vagy fejezd be a nyilat az Escape vagy Enter megnyomásával",
"lockAngle": "A SHIFT billentyű lenyomva tartásával korlátozhatja forgatás szögét",
"resize": "A SHIFT billentyű lenyomva tartásával az átméretezés megtartja az arányokat,\naz ALT lenyomva tartásával pedig a középpont egy helyben marad",
"resizeImage": "",
"resizeImage": "A SHIFT billentyű lenyomva tartásával szabadon átméretezheted,\ntartsd lenyomva az ALT billentyűt a középről való átméretezéshez",
"rotate": "A SHIFT billentyű lenyomva tartásával korlátozhatja a szögek illesztését",
"lineEditor_info": "Kattints duplán, vagy nyomj entert a pontok szerkesztéséhez",
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"placeImage": "",
"publishLibrary": "",
"bindTextToElement": "",
"deepBoxSelect": ""
"lineEditor_pointSelected": "Nyomd meg a Törlés gombot a pont(ok) eltávolításához,\nA Ctrl/Cmd+D a többszörözéshez, vagy húzással mozgathatja",
"lineEditor_nothingSelected": "Válaszd ki a szerkeszteni kívánt pontot (több kijelöléséhez tartsd lenyomva a SHIFT billentyűt),\nvagy Alt, és kattintson az új pontok hozzáadásához",
"placeImage": "Kattints a kép elhelyezéséhez, vagy kattints és méretezd manuálisan",
"publishLibrary": "Tedd közzé saját könyvtáradat",
"bindTextToElement": "Nyomd meg az Entert szöveg hozzáadáshoz",
"deepBoxSelect": "Tartsd lenyomva a Ctrl/Cmd billentyűt a mély kijelöléshez és a húzás megakadályozásához"
},
"canvasError": {
"cannotShowPreview": "Előnézet nem jeleníthető meg",
@@ -247,101 +249,101 @@
"desc_inProgressIntro": "Az élő együttműködési munkamenet folyamatban van.",
"desc_shareLink": "Ossza meg ezt a linket bárkivel, akivel együtt szeretne működni:",
"desc_exitSession": "Az munkamenet leállítása kilépteti önt a szobából, de folytathatja a munkát a saját gépén. Vegye figyelembe, hogy ez nem érinti más emberek munkáját és ők továbbra is együttműködhetnek a saját változatukon.",
"shareTitle": ""
"shareTitle": "Csatlakozás egy élő együttműködési munkamenethez az Excalidraw-ban"
},
"errorDialog": {
"title": "Hiba"
},
"exportDialog": {
"disk_title": "",
"disk_details": "",
"disk_button": "",
"link_title": "",
"link_details": "",
"link_button": "",
"excalidrawplus_description": "",
"excalidrawplus_button": "",
"excalidrawplus_exportError": ""
"disk_title": "Mentés lemezre",
"disk_details": "Exportálja a jelenetadatokat egy fájlba, amelyből később importálhatja.",
"disk_button": "Mentés fájlba",
"link_title": "Megosztható hivatkozás",
"link_details": "Exportálás csak olvasható hivatkozásként.",
"link_button": "Exportálás hivatkozásba",
"excalidrawplus_description": "Mentse el a jelenetet az Excalidraw+ munkaterületére.",
"excalidrawplus_button": "Exportálás",
"excalidrawplus_exportError": "Jelenleg nem lehet exportálni az Excalidraw+-ba..."
},
"helpDialog": {
"blog": "",
"click": "",
"deepSelect": "",
"deepBoxSelect": "",
"curvedArrow": "",
"curvedLine": "",
"documentation": "",
"doubleClick": "",
"drag": "",
"editor": "",
"editSelectedShape": "",
"github": "",
"howto": "",
"or": "",
"preventBinding": "",
"shapes": "",
"shortcuts": "",
"textFinish": "",
"textNewLine": "",
"title": "",
"view": "",
"zoomToFit": "",
"zoomToSelection": ""
"blog": "Olvasd a blogunkat",
"click": "kattintás",
"deepSelect": "Mély kijelölés",
"deepBoxSelect": "Mély kijelölés a dobozon belül, és a húzás megakadályozása",
"curvedArrow": "Ívelt nyíl",
"curvedLine": "Ívelt vonal",
"documentation": "Dokumentáció",
"doubleClick": "dupla kattintás",
"drag": "vonszolás",
"editor": "Szerkesztő",
"editSelectedShape": "Kijelölt alakzat szerkesztése (szöveg/nyíl/vonal)",
"github": "Hibát találtál? Küld be",
"howto": "Kövesd az útmutatóinkat",
"or": "vagy",
"preventBinding": "A nyíl ne ragadjon",
"shapes": "Alakzatok",
"shortcuts": "Gyorsbillentyűk",
"textFinish": "Szerkesztés befejezése (szöveg)",
"textNewLine": "Új sor hozzáadása (szöveg)",
"title": "Segítség",
"view": "Nézet",
"zoomToFit": "Az összes elem látótérbe hozása",
"zoomToSelection": "Kijelölésre nagyítás"
},
"clearCanvasDialog": {
"title": ""
"title": "Rajzvászon alaphelyzetbe"
},
"publishDialog": {
"title": "",
"itemName": "",
"authorName": "",
"githubUsername": "",
"twitterUsername": "",
"libraryName": "",
"libraryDesc": "",
"website": "",
"title": "Könyvtár közzététele",
"itemName": "Tétel neve",
"authorName": "Szerző neve",
"githubUsername": "GitHub felhasználónév",
"twitterUsername": "Twitter felhasználónév",
"libraryName": "Könyvtár neve",
"libraryDesc": "Könyvtár leírása",
"website": "Weboldal",
"placeholder": {
"authorName": "",
"libraryName": "",
"libraryDesc": "",
"githubHandle": "",
"twitterHandle": "",
"website": ""
"authorName": "Neved vagy felhasználóneved",
"libraryName": "A könyvtárad neve",
"libraryDesc": "A könyvtárad használatát segítő leírás",
"githubHandle": "GitHub-handle(opcionális), így szerkesztheted a könyvtárat, miután elküldted ellenőrzésre",
"twitterHandle": "Twitter-felhasználónév (opcionális), így tudjuk, kinek kell jóváírni a Twitteren keresztüli reklámozást",
"website": "Hivatkozás személyes webhelyedre vagy máshová (nem kötelező)"
},
"errors": {
"required": "",
"website": ""
"required": "Kötelező",
"website": "Adj meg egy érvényes URL-t"
},
"noteDescription": {
"pre": "",
"link": "",
"post": ""
"pre": "Küld be könyvtáradat, hogy bekerüljön a ",
"link": "nyilvános könyvtár tárolóba",
"post": "hogy mások is felhasználhassák a rajzaikban."
},
"noteGuidelines": {
"pre": "",
"link": "",
"post": ""
"pre": "A könyvtárat először manuálisan kell jóváhagyni. Kérjük, olvassa el a ",
"link": "segédletet",
"post": " benyújtása előtt. Szüksége lesz egy GitHub-fiókra a kommunikációhoz és a módosításokhoz, ha kérik, de ez nem feltétlenül szükséges."
},
"noteLicense": {
"pre": "",
"link": "",
"post": ""
"pre": "A beküldéssel elfogadja, hogy a könyvtár a következő alatt kerül közzétételre ",
"link": "MIT Licensz ",
"post": "ami röviden azt jelenti, hogy bárki korlátozás nélkül használhatja őket."
},
"noteItems": "",
"atleastOneLibItem": ""
"noteItems": "Minden könyvtárelemnek saját nevével kell rendelkeznie, hogy szűrhető legyen. A következő könyvtári tételek kerülnek bele:",
"atleastOneLibItem": "A kezdéshez válassz ki legalább egy könyvtári elemet"
},
"publishSuccessDialog": {
"title": "",
"content": "",
"link": ""
"title": "A könyvtár beküldve",
"content": "Köszönjük {{authorName}}. Könyvtáradat elküldtük felülvizsgálatra. Nyomon követheted az állapotot",
"link": "itt"
},
"confirmDialog": {
"resetLibrary": "",
"removeItemsFromLib": ""
"resetLibrary": "Könyvtár alaphelyzetbe állítása",
"removeItemsFromLib": "A kiválasztott elemek eltávolítása a könyvtárból"
},
"encrypted": {
"tooltip": "A rajzaidat végpontok közötti titkosítással tároljuk, tehát az Excalidraw szervereiről se tud más belenézni.",
"link": ""
"link": "Blogbejegyzés a végpontok közötti titkosításról az Excalidraw-ban"
},
"stats": {
"angle": "Szög",
@@ -353,66 +355,66 @@
"storage": "Tárhely",
"title": "Statisztikák",
"total": "Összesen",
"version": "",
"versionCopy": "",
"versionNotAvailable": "",
"version": "Verzió",
"versionCopy": "Kattints a másoláshoz",
"versionNotAvailable": "A verzió nem elérhető",
"width": "Szélesség"
},
"toast": {
"addedToLibrary": "",
"copyStyles": "",
"copyToClipboard": "",
"copyToClipboardAsPng": "",
"fileSaved": "",
"fileSavedToFilename": "",
"canvas": "",
"selection": ""
"addedToLibrary": "Könyvtárhoz adva",
"copyStyles": "Másolt stílusok.",
"copyToClipboard": "Vágólapra másolva.",
"copyToClipboardAsPng": "Az {{exportSelection}} PNG formátumban a vágólapra másolva \n({{exportColorScheme}})",
"fileSaved": "Fájl elmentve.",
"fileSavedToFilename": "Mentve mint {filename}",
"canvas": "rajzvászon",
"selection": "kijelölés"
},
"colors": {
"ffffff": "",
"f8f9fa": "",
"f1f3f5": "",
"fff5f5": "",
"fff0f6": "",
"f8f0fc": "",
"f3f0ff": "",
"edf2ff": "",
"e7f5ff": "",
"e3fafc": "",
"e6fcf5": "",
"ebfbee": "",
"f4fce3": "",
"fff9db": "",
"fff4e6": "",
"transparent": "",
"ced4da": "",
"868e96": "",
"fa5252": "",
"e64980": "",
"be4bdb": "",
"7950f2": "",
"4c6ef5": "",
"228be6": "",
"15aabf": "",
"12b886": "",
"40c057": "",
"82c91e": "",
"fab005": "",
"fd7e14": "",
"000000": "",
"343a40": "",
"495057": "",
"c92a2a": "",
"a61e4d": "",
"862e9c": "",
"5f3dc4": "",
"364fc7": "",
"1864ab": "",
"0b7285": "",
"087f5b": "",
"2b8a3e": "",
"5c940d": "",
"e67700": "",
"d9480f": ""
"ffffff": "Fehér",
"f8f9fa": "Szürke 0",
"f1f3f5": "Szürke 1",
"fff5f5": "Piros 0",
"fff0f6": "Pink 0",
"f8f0fc": "Szőlő 0",
"f3f0ff": "Ibolya 0",
"edf2ff": "Indigó 0",
"e7f5ff": "Kék 0",
"e3fafc": "Cián 0",
"e6fcf5": "Kékes-zöld 0",
"ebfbee": "Zöld 0",
"f4fce3": "Lime 0",
"fff9db": "Sárga 0",
"fff4e6": "Narancs 0",
"transparent": "Átlátszó",
"ced4da": "Szürke 4",
"868e96": "Szürke 6",
"fa5252": "Piros 6",
"e64980": "Pink 6",
"be4bdb": "Szőlő 6",
"7950f2": "Ibolya 6",
"4c6ef5": "Indigó 6",
"228be6": "Kék 6",
"15aabf": "Cián 6",
"12b886": "Kékes-zöld 6",
"40c057": "Zöld 6",
"82c91e": "Lime 6",
"fab005": "Sárga 6",
"fd7e14": "Narancs 6",
"000000": "Fekete",
"343a40": "Szürke 8",
"495057": "Szürke 7",
"c92a2a": "Piros 9",
"a61e4d": "Pink 9",
"862e9c": "Szőlő 9",
"5f3dc4": "Ibolya 9",
"364fc7": "Indigó 9",
"1864ab": "Kék 9",
"0b7285": "Cián 9",
"087f5b": "Kékes-zöld 9",
"2b8a3e": "Zöld 9",
"5c940d": "Lime 9",
"e67700": "Sárga 9",
"d9480f": "Narancs 9"
}
}
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Kartunis",
"fileTitle": "Nama file",
"colorPicker": "Pilihan Warna",
"canvasColors": "Digunakan di kanvas",
"canvasBackground": "Latar Kanvas",
"drawingCanvas": "Kanvas",
"layers": "Lapisan",
@@ -179,7 +180,8 @@
"imageInsertError": "Tidak dapat menyisipkan gambar. Coba lagi nanti...",
"fileTooBig": "File terlalu besar. Ukuran maksimum yang dibolehkan {{maxSize}}.",
"svgImageInsertError": "Tidak dapat menyisipkan gambar SVG. Markup SVG sepertinya tidak valid.",
"invalidSVGString": "SVG tidak valid."
"invalidSVGString": "SVG tidak valid.",
"cannotResolveCollabServer": "Tidak dapat terhubung ke server kolab. Muat ulang laman dan coba lagi."
},
"toolBar": {
"selection": "Pilihan",
+16 -14
View File
@@ -64,6 +64,7 @@
"cartoonist": "Fumettista",
"fileTitle": "Nome del file",
"colorPicker": "Selettore colore",
"canvasColors": "Usato su tela",
"canvasBackground": "Sfondo tela",
"drawingCanvas": "Area di disegno",
"layers": "Livelli",
@@ -103,13 +104,13 @@
"toggleTheme": "Cambia tema",
"personalLib": "Libreria Personale",
"excalidrawLib": "Libreria di Excalidraw",
"decreaseFontSize": "",
"increaseFontSize": "",
"unbindText": "",
"decreaseFontSize": "Riduci dimensione dei caratteri",
"increaseFontSize": "Aumenta la dimensione dei caratteri",
"unbindText": "Scollega testo",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Modifica link",
"create": "Crea link",
"label": "Link"
}
},
"buttons": {
@@ -179,7 +180,8 @@
"imageInsertError": "Non è stato possibile inserire l'immagine. Riprova più tardi...",
"fileTooBig": "Il file è troppo grande. La dimensione massima consentita è {{maxSize}}.",
"svgImageInsertError": "Impossibile inserire l'immagine SVG. Il markup SVG non sembra corretto.",
"invalidSVGString": "SVG non valido."
"invalidSVGString": "SVG non valido.",
"cannotResolveCollabServer": "Impossibile connettersi al server di collab. Ricarica la pagina e riprova."
},
"toolBar": {
"selection": "Selezione",
@@ -193,8 +195,8 @@
"text": "Testo",
"library": "Libreria",
"lock": "Mantieni lo strumento selezionato attivo dopo aver disegnato",
"penMode": "",
"link": ""
"penMode": "Impedisci il pinch-zoom e accetta l'input di disegno libero solo dalla penna",
"link": "Aggiungi/ aggiorna il link per una forma selezionata"
},
"headings": {
"canvasActions": "Azioni sulla Tela",
@@ -214,12 +216,12 @@
"resizeImage": "Puoi ridimensionare liberamente tenendo premuto SHIFT,\ntieni premuto ALT per ridimensionare dal centro",
"rotate": "Puoi mantenere gli angoli tenendo premuto SHIFT durante la rotazione",
"lineEditor_info": "Fai doppio click o premi invio per modificare i punti",
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"lineEditor_pointSelected": "Premi Elimina per rimuovere il punto(i),\nCtrlOCmd+D per duplicare o trascinare per spostare",
"lineEditor_nothingSelected": "Seleziona un punto da modificare (tieni premuto MAIUSC per selezionare più punti),\noppure tieni premuto Alt e fai clic per aggiungere nuovi punti",
"placeImage": "Fai click per posizionare l'immagine, o click e trascina per impostarne la dimensione manualmente",
"publishLibrary": "Pubblica la tua libreria",
"bindTextToElement": "Premi invio per aggiungere il testo",
"deepBoxSelect": ""
"deepBoxSelect": "Tieni premuto CtrlOCmd per selezionare in profondità e per impedire il trascinamento"
},
"canvasError": {
"cannotShowPreview": "Impossibile visualizzare l'anteprima",
@@ -266,8 +268,8 @@
"helpDialog": {
"blog": "Leggi il nostro blog",
"click": "click",
"deepSelect": "",
"deepBoxSelect": "",
"deepSelect": "Selezione profonda",
"deepBoxSelect": "Seleziona in profondità all'interno della casella e previene il trascinamento",
"curvedArrow": "Freccia curva",
"curvedLine": "Linea curva",
"documentation": "Documentazione",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "漫画風",
"fileTitle": "ファイル名",
"colorPicker": "色選択",
"canvasColors": "",
"canvasBackground": "キャンバスの背景",
"drawingCanvas": "キャンバスの描画",
"layers": "レイヤー",
@@ -179,7 +180,8 @@
"imageInsertError": "画像を挿入できませんでした。後でもう一度お試しください...",
"fileTooBig": "ファイルが大きすぎます。許可される最大サイズは {{maxSize}} です。",
"svgImageInsertError": "SVGイメージを挿入できませんでした。SVGマークアップは無効に見えます。",
"invalidSVGString": "無効なSVGです。"
"invalidSVGString": "無効なSVGです。",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "選択",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "Isem n ufaylu",
"colorPicker": "Amafran n yini",
"canvasColors": "",
"canvasBackground": "Agilal n teɣzut n usuneɣ",
"drawingCanvas": "Taɣzut n usuneɣ",
"layers": "Tissiyin",
@@ -179,7 +180,8 @@
"imageInsertError": "D awezɣi tugra n tugna. Eɛreḍ tikkelt-nniḍen ardeqqal...",
"fileTooBig": "Afaylu meqqer aṭas. Tiddi tafellayt yurgen d {{maxSize}}.",
"svgImageInsertError": "D awezɣi tugra n tugna SVG. Acraḍ SVG yettban-d d armeɣtu.",
"invalidSVGString": "SVG armeɣtu."
"invalidSVGString": "SVG armeɣtu.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Tafrayt",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "Файл атауы",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "",
"drawingCanvas": "",
"layers": "",
@@ -179,7 +180,8 @@
"imageInsertError": "Суретті жүктеу мүмкін болмады. Кейінірек қайталап көріңіз...",
"fileTooBig": "Файл өте үлкен. Максималды рұқсат етілген көлем {{maxSize}}.",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "만화가",
"fileTitle": "파일 이름",
"colorPicker": "색상 선택기",
"canvasColors": "",
"canvasBackground": "캔버스 배경",
"drawingCanvas": "캔버스 그리기",
"layers": "레이어",
@@ -179,7 +180,8 @@
"imageInsertError": "이미지를 삽입할 수 없습니다. 나중에 다시 시도 하십시오",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "선택",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "",
"fileTitle": "Failo pavadinimas",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "",
"drawingCanvas": "",
"layers": "",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Karikatūrists",
"fileTitle": "Datnes nosaukums",
"colorPicker": "Krāsu atlasītājs",
"canvasColors": "Izmantots tāfelei",
"canvasBackground": "Ainas fons",
"drawingCanvas": "Tāfele",
"layers": "Slāņi",
@@ -179,7 +180,8 @@
"imageInsertError": "Nevarēja ievietot attēlu. Mēģiniet vēlāk...",
"fileTooBig": "Datne ir par lielu. Lielākais atļautais izmērs ir {{maxSize}}.",
"svgImageInsertError": "Nevarēja ievietot SVG attēlu. Šķiet, ka SVG marķējums nav derīgs.",
"invalidSVGString": "Nederīgs SVG."
"invalidSVGString": "Nederīgs SVG.",
"cannotResolveCollabServer": "Nevarēja savienoties ar sadarbošanās serveri. Lūdzu, pārlādējiet lapu un mēģiniet vēlreiz."
},
"toolBar": {
"selection": "Atlase",
+420
View File
@@ -0,0 +1,420 @@
{
"labels": {
"paste": "चिपकवा",
"pasteCharts": "चार्ट चिपकवा",
"selectAll": "समस्त निवडा",
"multiSelect": "",
"moveCanvas": "",
"cut": "",
"copy": "",
"copyAsPng": "",
"copyAsSvg": "",
"bringForward": "",
"sendToBack": "",
"bringToFront": "",
"sendBackward": "",
"delete": "",
"copyStyles": "",
"pasteStyles": "",
"stroke": "",
"background": "",
"fill": "",
"strokeWidth": "",
"strokeStyle": "",
"strokeStyle_solid": "",
"strokeStyle_dashed": "",
"strokeStyle_dotted": "",
"sloppiness": "",
"opacity": "",
"textAlign": "",
"edges": "",
"sharp": "",
"round": "",
"arrowheads": "",
"arrowhead_none": "",
"arrowhead_arrow": "",
"arrowhead_bar": "",
"arrowhead_dot": "",
"arrowhead_triangle": "",
"fontSize": "",
"fontFamily": "",
"onlySelected": "",
"withBackground": "",
"exportEmbedScene": "",
"exportEmbedScene_details": "",
"addWatermark": "",
"handDrawn": "",
"normal": "",
"code": "",
"small": "",
"medium": "",
"large": "",
"veryLarge": "",
"solid": "",
"hachure": "",
"crossHatch": "",
"thin": "",
"bold": "",
"left": "",
"center": "",
"right": "",
"extraBold": "",
"architect": "",
"artist": "",
"cartoonist": "",
"fileTitle": "",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "",
"drawingCanvas": "",
"layers": "",
"actions": "",
"language": "",
"liveCollaboration": "",
"duplicateSelection": "",
"untitled": "",
"name": "",
"yourName": "",
"madeWithExcalidraw": "",
"group": "",
"ungroup": "",
"collaborators": "",
"showGrid": "",
"addToLibrary": "",
"removeFromLibrary": "",
"libraryLoadingMessage": "",
"libraries": "",
"loadingScene": "",
"align": "",
"alignTop": "",
"alignBottom": "",
"alignLeft": "",
"alignRight": "",
"centerVertically": "",
"centerHorizontally": "",
"distributeHorizontally": "",
"distributeVertically": "",
"flipHorizontal": "",
"flipVertical": "",
"viewMode": "",
"toggleExportColorScheme": "",
"share": "",
"showStroke": "",
"showBackground": "",
"toggleTheme": "",
"personalLib": "",
"excalidrawLib": "",
"decreaseFontSize": "",
"increaseFontSize": "",
"unbindText": "",
"link": {
"edit": "",
"create": "",
"label": ""
}
},
"buttons": {
"clearReset": "",
"exportJSON": "",
"exportImage": "",
"export": "",
"exportToPng": "",
"exportToSvg": "",
"copyToClipboard": "",
"copyPngToClipboard": "",
"scale": "",
"save": "",
"saveAs": "",
"load": "",
"getShareableLink": "",
"close": "",
"selectLanguage": "",
"scrollBackToContent": "",
"zoomIn": "",
"zoomOut": "",
"resetZoom": "",
"menu": "",
"done": "",
"edit": "",
"undo": "",
"redo": "",
"resetLibrary": "",
"createNewRoom": "",
"fullScreen": "",
"darkMode": "",
"lightMode": "",
"zenMode": "",
"exitZenMode": "",
"cancel": "",
"clear": "",
"remove": "",
"publishLibrary": "",
"submit": "",
"confirm": ""
},
"alerts": {
"clearReset": "",
"couldNotCreateShareableLink": "",
"couldNotCreateShareableLinkTooBig": "",
"couldNotLoadInvalidFile": "",
"importBackendFailed": "",
"cannotExportEmptyCanvas": "",
"couldNotCopyToClipboard": "",
"decryptFailed": "",
"uploadedSecurly": "",
"loadSceneOverridePrompt": "",
"collabStopOverridePrompt": "",
"errorLoadingLibrary": "",
"errorAddingToLibrary": "",
"errorRemovingFromLibrary": "",
"confirmAddLibrary": "",
"imageDoesNotContainScene": "",
"cannotRestoreFromImage": "",
"invalidSceneUrl": "",
"resetLibrary": "",
"removeItemsFromsLibrary": "",
"invalidEncryptionKey": ""
},
"errors": {
"unsupportedFileType": "",
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
"image": "",
"rectangle": "",
"diamond": "",
"ellipse": "",
"arrow": "",
"line": "",
"freedraw": "",
"text": "",
"library": "",
"lock": "",
"penMode": "",
"link": ""
},
"headings": {
"canvasActions": "",
"selectedShapeActions": "",
"shapes": ""
},
"hints": {
"canvasPanning": "",
"linearElement": "",
"freeDraw": "",
"text": "",
"text_selected": "",
"text_editing": "",
"linearElementMulti": "",
"lockAngle": "",
"resize": "",
"resizeImage": "",
"rotate": "",
"lineEditor_info": "",
"lineEditor_pointSelected": "",
"lineEditor_nothingSelected": "",
"placeImage": "",
"publishLibrary": "",
"bindTextToElement": "",
"deepBoxSelect": ""
},
"canvasError": {
"cannotShowPreview": "",
"canvasTooBig": "",
"canvasTooBigTip": ""
},
"errorSplash": {
"headingMain_pre": "",
"headingMain_button": "",
"clearCanvasMessage": "",
"clearCanvasMessage_button": "",
"clearCanvasCaveat": "",
"trackedToSentry_pre": "",
"trackedToSentry_post": "",
"openIssueMessage_pre": "",
"openIssueMessage_button": "",
"openIssueMessage_post": "",
"sceneContent": ""
},
"roomDialog": {
"desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_shareLink": "",
"desc_exitSession": "",
"shareTitle": ""
},
"errorDialog": {
"title": ""
},
"exportDialog": {
"disk_title": "",
"disk_details": "",
"disk_button": "",
"link_title": "",
"link_details": "",
"link_button": "",
"excalidrawplus_description": "",
"excalidrawplus_button": "",
"excalidrawplus_exportError": ""
},
"helpDialog": {
"blog": "",
"click": "",
"deepSelect": "",
"deepBoxSelect": "",
"curvedArrow": "",
"curvedLine": "",
"documentation": "",
"doubleClick": "",
"drag": "",
"editor": "",
"editSelectedShape": "",
"github": "",
"howto": "",
"or": "",
"preventBinding": "",
"shapes": "",
"shortcuts": "",
"textFinish": "",
"textNewLine": "",
"title": "",
"view": "",
"zoomToFit": "",
"zoomToSelection": ""
},
"clearCanvasDialog": {
"title": ""
},
"publishDialog": {
"title": "",
"itemName": "",
"authorName": "",
"githubUsername": "",
"twitterUsername": "",
"libraryName": "",
"libraryDesc": "",
"website": "",
"placeholder": {
"authorName": "",
"libraryName": "",
"libraryDesc": "",
"githubHandle": "",
"twitterHandle": "",
"website": ""
},
"errors": {
"required": "",
"website": ""
},
"noteDescription": {
"pre": "",
"link": "",
"post": ""
},
"noteGuidelines": {
"pre": "",
"link": "",
"post": ""
},
"noteLicense": {
"pre": "",
"link": "",
"post": ""
},
"noteItems": "",
"atleastOneLibItem": ""
},
"publishSuccessDialog": {
"title": "",
"content": "",
"link": ""
},
"confirmDialog": {
"resetLibrary": "",
"removeItemsFromLib": ""
},
"encrypted": {
"tooltip": "",
"link": ""
},
"stats": {
"angle": "",
"element": "",
"elements": "",
"height": "",
"scene": "",
"selected": "",
"storage": "",
"title": "",
"total": "",
"version": "",
"versionCopy": "",
"versionNotAvailable": "",
"width": ""
},
"toast": {
"addedToLibrary": "",
"copyStyles": "",
"copyToClipboard": "",
"copyToClipboardAsPng": "",
"fileSaved": "",
"fileSavedToFilename": "",
"canvas": "",
"selection": ""
},
"colors": {
"ffffff": "",
"f8f9fa": "",
"f1f3f5": "",
"fff5f5": "",
"fff0f6": "",
"f8f0fc": "",
"f3f0ff": "",
"edf2ff": "",
"e7f5ff": "",
"e3fafc": "",
"e6fcf5": "",
"ebfbee": "",
"f4fce3": "",
"fff9db": "",
"fff4e6": "",
"transparent": "",
"ced4da": "",
"868e96": "",
"fa5252": "",
"e64980": "",
"be4bdb": "",
"7950f2": "",
"4c6ef5": "",
"228be6": "",
"15aabf": "",
"12b886": "",
"40c057": "",
"82c91e": "",
"fab005": "",
"fd7e14": "",
"000000": "",
"343a40": "",
"495057": "",
"c92a2a": "",
"a61e4d": "",
"862e9c": "",
"5f3dc4": "",
"364fc7": "",
"1864ab": "",
"0b7285": "",
"087f5b": "",
"2b8a3e": "",
"5c940d": "",
"e67700": "",
"d9480f": ""
}
}
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "ကာတွန်း",
"fileTitle": "",
"colorPicker": "အရောင်ရွေး",
"canvasColors": "",
"canvasBackground": "ကားချပ်နောက်ခံ",
"drawingCanvas": "ပုံဆွဲကားချပ်",
"layers": "အလွှာများ",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "ရွေးချယ်",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Tegner",
"fileTitle": "Filnavn",
"colorPicker": "Fargevelger",
"canvasColors": "Brukes på lerretet",
"canvasBackground": "Lerretsbakgrunn",
"drawingCanvas": "Lerret",
"layers": "Lag",
@@ -179,7 +180,8 @@
"imageInsertError": "Kunne ikke sette inn bildet. Prøv igjen senere...",
"fileTooBig": "Filen er for stor. Maksimal tillatt størrelse er {{maxSize}}.",
"svgImageInsertError": "Kunne ikke sette inn SVG-bilde. SVG-koden ser ugyldig ut.",
"invalidSVGString": "Ugyldig SVG."
"invalidSVGString": "Ugyldig SVG.",
"cannotResolveCollabServer": "Kunne ikke koble til samarbeidsserveren. Vennligst oppdater siden og prøv på nytt."
},
"toolBar": {
"selection": "Velg",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Cartoonist",
"fileTitle": "Bestandsnaam",
"colorPicker": "Kleurenkiezer",
"canvasColors": "Gebruikt op canvas",
"canvasBackground": "Canvas achtergrond",
"drawingCanvas": "Canvas",
"layers": "Lagen",
@@ -179,7 +180,8 @@
"imageInsertError": "Afbeelding invoegen mislukt. Probeer het later opnieuw...",
"fileTooBig": "Bestand is te groot. Maximale grootte is {{maxSize}}.",
"svgImageInsertError": "",
"invalidSVGString": "Ongeldige SVG."
"invalidSVGString": "Ongeldige SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Selectie",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Teiknar",
"fileTitle": "Filnamn",
"colorPicker": "Fargeveljar",
"canvasColors": "",
"canvasBackground": "Lerretsbakgrunn",
"drawingCanvas": "Lerret",
"layers": "Lag",
@@ -179,7 +180,8 @@
"imageInsertError": "Kunne ikkje sette inn biletet. Prøv igjen seinare...",
"fileTooBig": "Fila er for stor. Maksimal tillate storleik er {{maxSize}}.",
"svgImageInsertError": "Kunne ikkje sette inn SVG-biletet. SVG-koden ser ugyldig ut.",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Vel",
+6 -4
View File
@@ -64,6 +64,7 @@
"cartoonist": "Dessenhaire",
"fileTitle": "Nom del fichièr",
"colorPicker": "Selector de color",
"canvasColors": "",
"canvasBackground": "Rèireplan del canabàs",
"drawingCanvas": "Zòna de dessenh",
"layers": "Calques",
@@ -107,9 +108,9 @@
"increaseFontSize": "Aumentar talha poliça",
"unbindText": "",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Modificar lo ligam",
"create": "Crear un ligam",
"label": "Ligam"
}
},
"buttons": {
@@ -179,7 +180,8 @@
"imageInsertError": "Insercion dimatge impossibla. Tornatz ensajar mai tard...",
"fileTooBig": "Fichièr tròp pesuc. La talha maximala autorizada es {{maxSize}}.",
"svgImageInsertError": "Insercion dimatge SVG impossibla. Las balisas SVG semblan invalidas.",
"invalidSVGString": "SVG invalid."
"invalidSVGString": "SVG invalid.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Seleccion",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "ਕਾਰਟੂਨਿਸਟ",
"fileTitle": "ਫਾਈਲ ਦਾ ਨਾਂ",
"colorPicker": "ਰੰਗ ਚੋਣਕਾਰ",
"canvasColors": "",
"canvasBackground": "ਕੈਨਵਸ ਦਾ ਬੈਕਗਰਾਉਂਡ",
"drawingCanvas": "ਡਰਾਇੰਗ ਕੈਨਵਸ",
"layers": "ਪਰਤਾਂ",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": "SVG ਨਜਾਇਜ਼ ਹੈ।"
"invalidSVGString": "SVG ਨਜਾਇਜ਼ ਹੈ।",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "ਚੋਣਕਾਰ",
+18 -17
View File
@@ -1,46 +1,47 @@
{
"ar-SA": 88,
"ar-SA": 94,
"bg-BG": 61,
"bn-BD": 0,
"ca-ES": 95,
"ca-ES": 99,
"cs-CZ": 24,
"da-DK": 16,
"da-DK": 17,
"de-DE": 99,
"el-GR": 87,
"el-GR": 86,
"en": 100,
"es-ES": 84,
"eu-ES": 96,
"es-ES": 99,
"eu-ES": 99,
"fa-IR": 63,
"fi-FI": 98,
"fr-FR": 100,
"fr-FR": 99,
"he-IL": 80,
"hi-IN": 55,
"hu-HU": 49,
"hi-IN": 58,
"hu-HU": 99,
"id-ID": 100,
"it-IT": 96,
"ja-JP": 98,
"it-IT": 100,
"ja-JP": 97,
"kab-KAB": 95,
"kk-KZ": 23,
"ko-KR": 72,
"lt-LT": 24,
"lt-LT": 23,
"lv-LV": 100,
"mr-IN": 0,
"my-MM": 46,
"nb-NO": 100,
"nl-NL": 90,
"nn-NO": 83,
"oc-FR": 97,
"pa-IN": 87,
"pa-IN": 86,
"pl-PL": 93,
"pt-BR": 98,
"pt-BR": 99,
"pt-PT": 83,
"ro-RO": 100,
"ru-RU": 99,
"si-LK": 9,
"sk-SK": 100,
"sk-SK": 99,
"sv-SE": 100,
"ta-IN": 99,
"tr-TR": 85,
"uk-UA": 82,
"tr-TR": 84,
"uk-UA": 81,
"zh-CN": 100,
"zh-HK": 28,
"zh-TW": 100
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Rysunkowy",
"fileTitle": "Nazwa pliku",
"colorPicker": "Paleta kolorów",
"canvasColors": "",
"canvasBackground": "Kolor dokumentu",
"drawingCanvas": "Obszar roboczy",
"layers": "Warstwy",
@@ -179,7 +180,8 @@
"imageInsertError": "Nie udało się wstawić obrazu. Spróbuj ponownie później...",
"fileTooBig": "Plik jest zbyt duży. Maksymalny dozwolony rozmiar to {{maxSize}}.",
"svgImageInsertError": "Nie udało się wstawić obrazu SVG. Znacznik SVG wygląda na nieprawidłowy.",
"invalidSVGString": "Nieprawidłowy SVG."
"invalidSVGString": "Nieprawidłowy SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Zaznaczenie",
+7 -5
View File
@@ -64,6 +64,7 @@
"cartoonist": "Cartunista",
"fileTitle": "Nome do arquivo",
"colorPicker": "Seletor de cores",
"canvasColors": "Usado na tela",
"canvasBackground": "Fundo da tela",
"drawingCanvas": "Tela de desenho",
"layers": "Camadas",
@@ -107,9 +108,9 @@
"increaseFontSize": "Aumentar o tamanho da fonte",
"unbindText": "Desvincular texto",
"link": {
"edit": "",
"create": "",
"label": ""
"edit": "Editar link",
"create": "Criar link",
"label": "Link"
}
},
"buttons": {
@@ -179,7 +180,8 @@
"imageInsertError": "Não foi possível inserir imagem. Tente novamente mais tarde...",
"fileTooBig": "O arquivo é muito grande. O tamanho máximo permitido é {{maxSize}}.",
"svgImageInsertError": "Não foi possível inserir a imagem SVG. A marcação SVG parece inválida.",
"invalidSVGString": "SVG Inválido."
"invalidSVGString": "SVG Inválido.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Seleção",
@@ -194,7 +196,7 @@
"library": "Biblioteca",
"lock": "Manter ativa a ferramenta selecionada após desenhar",
"penMode": "Prevenir a ação de tocar-ampliar e permitir apenas interações da caneta",
"link": ""
"link": "Adicionar/Atualizar link para uma forma selecionada"
},
"headings": {
"canvasActions": "Ações da tela",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Caricaturista",
"fileTitle": "Nome do ficheiro",
"colorPicker": "Seletor de cores",
"canvasColors": "",
"canvasBackground": "Fundo da área de desenho",
"drawingCanvas": "Área de desenho",
"layers": "Camadas",
@@ -179,7 +180,8 @@
"imageInsertError": "Não foi possível inserir a imagem, tente novamente mais tarde...",
"fileTooBig": "O ficheiro é muito grande. O tamanho máximo permitido é {{maxSize}}.",
"svgImageInsertError": "Não foi possível inserir a imagem SVG. A marcação SVG parece inválida.",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Seleção",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Caricaturist",
"fileTitle": "Nume de fișier",
"colorPicker": "Selector de culoare",
"canvasColors": "Folosite pe pânză",
"canvasBackground": "Fundalul pânzei",
"drawingCanvas": "Pânză pentru desenat",
"layers": "Straturi",
@@ -179,7 +180,8 @@
"imageInsertError": "Imaginea nu a putut fi introdusă. Reîncearcă mai târziu...",
"fileTooBig": "Fișierul este prea mare. Dimensiunea maximă permisă este de {{maxSize}}.",
"svgImageInsertError": "Imaginea SVG nu a putut fi introdus. Marcajul SVG pare invalid.",
"invalidSVGString": "SVG invalid."
"invalidSVGString": "SVG invalid.",
"cannotResolveCollabServer": "Nu a putut fi realizată conexiunea la serverul de colaborare. Reîncarcă pagina și încearcă din nou."
},
"toolBar": {
"selection": "Selecție",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Карикатурист",
"fileTitle": "Имя файла",
"colorPicker": "Выбор цвета",
"canvasColors": "",
"canvasBackground": "Фон холста",
"drawingCanvas": "Полотно",
"layers": "Слои",
@@ -179,7 +180,8 @@
"imageInsertError": "Не удалось вставить изображение. Попробуйте позже...",
"fileTooBig": "Очень большой файл. Максимально разрешенный размер {{maxSize}}.",
"svgImageInsertError": "Не удалось вставить изображение SVG. Разметка SVG выглядит недействительной.",
"invalidSVGString": "Некорректный SVG."
"invalidSVGString": "Некорректный SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Выделение области",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "සැකිලිරූකරු",
"fileTitle": "ගොනු නාමය",
"colorPicker": "පාට තෝරකය",
"canvasColors": "",
"canvasBackground": "කැන්වස පසුබිම",
"drawingCanvas": "චිත්‍රක කැන්වසය",
"layers": "ලේයර",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Ilustrátor",
"fileTitle": "Názov súboru",
"colorPicker": "Výber farby",
"canvasColors": "Použité na plátne",
"canvasBackground": "Pozadie plátna",
"drawingCanvas": "Kresliace plátno",
"layers": "Vrstvy",
@@ -179,7 +180,8 @@
"imageInsertError": "Nepodarilo sa vložiť obrázok. Skúste to znova neskôr...",
"fileTooBig": "Súbor je príliš veľký. Maximálna povolená veľkosť je {{maxSize}}.",
"svgImageInsertError": "Nepodarilo sa vložiť SVG obrázok. SVG formát je pravdepodobne nevalidný.",
"invalidSVGString": "Nevalidné SVG."
"invalidSVGString": "Nevalidné SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Výber",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Serietecknare",
"fileTitle": "Filnamn",
"colorPicker": "Färgväljare",
"canvasColors": "Används på canvas",
"canvasBackground": "Canvas-bakgrund",
"drawingCanvas": "Ritar canvas",
"layers": "Lager",
@@ -179,7 +180,8 @@
"imageInsertError": "Kunde inte infoga bild. Försök igen senare...",
"fileTooBig": "Filen är för stor. Maximal tillåten storlek är {{maxSize}}.",
"svgImageInsertError": "Kunde inte infoga SVG-bild. SVG-koden ser ogiltig ut.",
"invalidSVGString": "Ogiltig SVG."
"invalidSVGString": "Ogiltig SVG.",
"cannotResolveCollabServer": "Det gick inte att ansluta till samarbets-servern. Ladda om sidan och försök igen."
},
"toolBar": {
"selection": "Markering",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "கேலிச்சித்திர ஓவியர்",
"fileTitle": "கோப்புப் பெயர்",
"colorPicker": "நிறத் தேர்வி",
"canvasColors": "கித்தானில் பயன்படுத்தப்பட்டது",
"canvasBackground": "கித்தான் பின்னணி",
"drawingCanvas": "கித்தான் வரைகிறது",
"layers": "அடுக்குகள்",
@@ -179,7 +180,8 @@
"imageInsertError": "படத்தைப் புகுத்தவியலா. பிறகு மீண்டும் முயலவும்...",
"fileTooBig": "கோப்பு மிகப்பெரிது. அனுமதிக்கப்பட்ட அதிகபட்ச அளவு {{maxSize}}.",
"svgImageInsertError": "எஸ்விஜி படத்தைப் புகுத்தவியலா. எஸ்விஜியின் மார்க்அப் செல்லாததாக தெரிகிறது.",
"invalidSVGString": "செல்லாத SVG."
"invalidSVGString": "செல்லாத SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "தெரிவு",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Karikatürist",
"fileTitle": "Dosya adı",
"colorPicker": "Renk seçici",
"canvasColors": "",
"canvasBackground": "Tuval arka planı",
"drawingCanvas": "Çizim tuvali",
"layers": "Katmanlar",
@@ -179,7 +180,8 @@
"imageInsertError": "Görsel eklenemedi. Daha sonra tekrar deneyin...",
"fileTooBig": "Dosya çok büyük. İzin verilen maksimum boyut {{maxSize}}.",
"svgImageInsertError": "SVG resmi eklenemedi. SVG işaretlemesi geçersiz görünüyor.",
"invalidSVGString": "Geçersiz SVG."
"invalidSVGString": "Geçersiz SVG.",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Seçme",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "Карикатурист",
"fileTitle": "Назва файла",
"colorPicker": "Палітра кольорів",
"canvasColors": "",
"canvasBackground": "Тло полотна",
"drawingCanvas": "Полотно",
"layers": "Шари",
@@ -179,7 +180,8 @@
"imageInsertError": "Не вдалося вставити зображення. Повторіть спробу пізніше...",
"fileTooBig": "Занадто великий розмір файлу, максимальний розмір файлу {{maxSize}}.",
"svgImageInsertError": "Не вдалося вставити SVG-зображення. Помилка розмітки SVG.",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "Виділення",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "漫画家",
"fileTitle": "文件名",
"colorPicker": "调色盘",
"canvasColors": "画布上的",
"canvasBackground": "画布背景",
"drawingCanvas": "绘制 Canvas",
"layers": "图层",
@@ -179,7 +180,8 @@
"imageInsertError": "无法插入图像。请稍后再试……",
"fileTooBig": "文件过大。最大允许的大小为 {{maxSize}}。",
"svgImageInsertError": "无法插入 SVG 图像。该 SVG 标记似乎是无效的。",
"invalidSVGString": "无效的 SVG。"
"invalidSVGString": "无效的 SVG。",
"cannotResolveCollabServer": "无法连接到实时协作服务器。请重新加载页面并重试。"
},
"toolBar": {
"selection": "选择",
+3 -1
View File
@@ -64,6 +64,7 @@
"cartoonist": "卡通風格",
"fileTitle": "檔案名稱",
"colorPicker": "",
"canvasColors": "",
"canvasBackground": "畫布背景顏色",
"drawingCanvas": "畫布",
"layers": "圖層",
@@ -179,7 +180,8 @@
"imageInsertError": "",
"fileTooBig": "",
"svgImageInsertError": "",
"invalidSVGString": ""
"invalidSVGString": "",
"cannotResolveCollabServer": ""
},
"toolBar": {
"selection": "",
+16 -14
View File
@@ -7,19 +7,19 @@
"moveCanvas": "移動畫布",
"cut": "剪下",
"copy": "複製",
"copyAsPng": "複製 PNG 至剪貼簿",
"copyAsSvg": "複製 SVG 至剪貼簿",
"bringForward": "往前移一層",
"sendToBack": "移到最後面",
"bringToFront": "移到最前面",
"copyAsPng": "以PNG格式儲存到剪貼",
"copyAsSvg": "以SVG格式複製到剪貼",
"bringForward": "移一層",
"sendToBack": "移到最底層",
"bringToFront": "置於最頂層",
"sendBackward": "往後移一層",
"delete": "刪除",
"copyStyles": "複製樣式",
"pasteStyles": "貼上樣式",
"stroke": "筆畫",
"background": "背景",
"fill": "填",
"strokeWidth": "筆寬度",
"fill": "填滿",
"strokeWidth": "筆寬度",
"strokeStyle": "筆畫樣式",
"strokeStyle_solid": "實線",
"strokeStyle_dashed": "虛線",
@@ -33,19 +33,19 @@
"arrowheads": "箭頭",
"arrowhead_none": "無",
"arrowhead_arrow": "箭頭",
"arrowhead_bar": "",
"arrowhead_dot": "點",
"arrowhead_bar": "條狀箭頭",
"arrowhead_dot": "點箭頭",
"arrowhead_triangle": "三角形",
"fontSize": "字型大小",
"fontFamily": "字體",
"fontFamily": "字體",
"onlySelected": "僅選取物件",
"withBackground": "背景",
"withBackground": "含有背景",
"exportEmbedScene": "嵌入場景",
"exportEmbedScene_details": "用於回復場景的場景資料會被包含在輸出的 PNG/SVG 檔案中。\n會增加輸出的檔案大小。",
"addWatermark": "加上 \"Made with Excalidraw\"",
"addWatermark": "加上 \"Made with Excalidraw\" 浮水印",
"handDrawn": "手寫",
"normal": "一般",
"code": "等寬",
"code": "代碼",
"small": "小",
"medium": "中",
"large": "大",
@@ -64,6 +64,7 @@
"cartoonist": "卡通",
"fileTitle": "檔案名稱",
"colorPicker": "色彩選擇工具",
"canvasColors": "使用於畫布",
"canvasBackground": "Canvas 背景",
"drawingCanvas": "繪圖 canvas",
"layers": "圖層",
@@ -179,7 +180,8 @@
"imageInsertError": "無法插入圖片。請稍後再試…",
"fileTooBig": "檔案過大。可接受的最大尺寸為 {{maxSize}} 。",
"svgImageInsertError": "無法插入 SVG 圖片。此 SVG 檔案有問題。",
"invalidSVGString": "無效的 SVG。"
"invalidSVGString": "無效的 SVG。",
"cannotResolveCollabServer": "無法連結至 collab 伺服器。請重新整理後再試一次。"
},
"toolBar": {
"selection": "選取",
+269 -9
View File
@@ -11,7 +11,7 @@ The change should be grouped under one of the below section and must contain PR
Please add the latest change on the top under the correct section.
-->
## Unreleased
## 0.11.0 (2022-02-17)
## Excalidraw API
@@ -20,7 +20,7 @@ Please add the latest change on the top under the correct section.
- Add `onLinkOpen` prop which will be triggered when clicked on element hyperlink if present [#4694](https://github.com/excalidraw/excalidraw/pull/4694).
- Support updating library using [`updateScene`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#updateScene) API [#4546](https://github.com/excalidraw/excalidraw/pull/4546).
- Introduced primary colors to the app. The colors can be overriden. Check [readme](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#customizing-styles) on how to do so [#4387](https://github.com/excalidraw/excalidraw/pull/4387).
- Introduced primary colors to the app. The colors can be overridden. Check [readme](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#customizing-styles) on how to do so [#4387](https://github.com/excalidraw/excalidraw/pull/4387).
- [`exportToBlob`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exportToBlob) now automatically sets `appState.exportBackground` to `true` if exporting to `image/jpeg` MIME type (to ensure that alpha channel is not compressed to black color) [#4342](https://github.com/excalidraw/excalidraw/pull/4342).
@@ -33,9 +33,7 @@ Please add the latest change on the top under the correct section.
- Add `maxWidthOrHeight?: number` attribute.
- `scale` returned from `getDimensions()` is now optional (default to `1`).
- Image support.
NOTE: the unreleased API is highly unstable and may change significantly before the next stable release. As such it's largely undocumented at this point. You are encouraged to read through the [PR](https://github.com/excalidraw/excalidraw/pull/4011) description if you want to know more about the internals.
- Image support added for host [PR](https://github.com/excalidraw/excalidraw/pull/4011)
General notes:
@@ -55,7 +53,7 @@ Please add the latest change on the top under the correct section.
Other notes:
- `.excalidraw` files may now contain top-level `files` key in format of `Record<FileId, BinaryFileData>` when exporting any (image) elements.
- Changes were made to various export utilityies exported from the package so that they take `files`. For now, TypeScript should help you figure the changes out.
- Changes were made to various export utilities exported from the package so that they take `files`, you can refer to the docs for the same.
- Export [`isLinearElement`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#isLinearElement) and [`getNonDeletedElements`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#getNonDeletedElements) [#4072](https://github.com/excalidraw/excalidraw/pull/4072).
@@ -91,6 +89,268 @@ Please add the latest change on the top under the correct section.
---
## Excalidraw Library
**_This section lists the updates made to the excalidraw library and will not affect the integration._**
### Features
- Show group/group and link action in mobile [#4795](https://github.com/excalidraw/excalidraw/pull/4795)
- Support background fill for freedraw shapes [#4610](https://github.com/excalidraw/excalidraw/pull/4610)
- Keep selected tool on canvas reset [#4728](https://github.com/excalidraw/excalidraw/pull/4728)
- Make whole element clickable in view mode when it has hyperlink [#4735](https://github.com/excalidraw/excalidraw/pull/4735)
- Allow any precision when zooming [#4730](https://github.com/excalidraw/excalidraw/pull/4730)
- Throttle `pointermove` events per framerate [#4727](https://github.com/excalidraw/excalidraw/pull/4727)
- Support hyperlinks 🔥 [#4620](https://github.com/excalidraw/excalidraw/pull/4620)
- Added penMode for palm rejection [#4657](https://github.com/excalidraw/excalidraw/pull/4657)
- Support unbinding bound text [#4686](https://github.com/excalidraw/excalidraw/pull/4686)
- Sync local storage state across tabs when out of sync [#4545](https://github.com/excalidraw/excalidraw/pull/4545)
- Support contextMenuLabel to be of function type to support dynamic labels [#4654](https://github.com/excalidraw/excalidraw/pull/4654)
- Support decreasing/increasing `fontSize` via keyboard [#4553](https://github.com/excalidraw/excalidraw/pull/4553)
- Link to new LP for excalidraw plus [#4549](https://github.com/excalidraw/excalidraw/pull/4549)
- Update stroke color of bounded text along with container [#4541](https://github.com/excalidraw/excalidraw/pull/4541)
- Hints and shortcuts help around deep selection [#4502](https://github.com/excalidraw/excalidraw/pull/4502)
- Support updating text properties by clicking on container [#4499](https://github.com/excalidraw/excalidraw/pull/4499)
- Bind text to shapes when pressing enter and support sticky notes 🎉 [#4343](https://github.com/excalidraw/excalidraw/pull/4343)
- Change `boundElementIds``boundElements` [#4404](https://github.com/excalidraw/excalidraw/pull/4404)
- Support selecting multiple points when editing line [#4373](https://github.com/excalidraw/excalidraw/pull/4373)
- Horizontally center toolbar menu [commit link](https://github.com/excalidraw/excalidraw/commit/9b8ee3cacfec239617c357693cf2a3ca9972d2cb)
- Add support for rounded corners in diamond [#4369](https://github.com/excalidraw/excalidraw/pull/4369)
- Allow zooming up to 3000% [#4358](https://github.com/excalidraw/excalidraw/pull/4358)
- Stop discarding precision when rendering [#4357](https://github.com/excalidraw/excalidraw/pull/4357)
- Support Image binding [#4347](https://github.com/excalidraw/excalidraw/pull/4347)
- Add `element.updated` [#4070](https://github.com/excalidraw/excalidraw/pull/4070)
- Compress shareLink data when uploading to json server [#4225](https://github.com/excalidraw/excalidraw/pull/4225)
- Supply `version` param when installing libraries [#4305](https://github.com/excalidraw/excalidraw/pull/4305)
- Log FS abortError to console [#4279](https://github.com/excalidraw/excalidraw/pull/4279)
- Add validation for website and remove validation for library item name [#4269](https://github.com/excalidraw/excalidraw/pull/4269)
- Allow publishing libraries from UI [#4115](https://github.com/excalidraw/excalidraw/pull/4115)
- Create confirm dialog to use instead of window.confirm [#4256](https://github.com/excalidraw/excalidraw/pull/4256)
- Allow letters in IDs for storing files in backend [#4224](https://github.com/excalidraw/excalidraw/pull/4224)
- Remove support for V1 unencrypted backend [#4189](https://github.com/excalidraw/excalidraw/pull/4189)
- Use separate backend for local storage [#4187](https://github.com/excalidraw/excalidraw/pull/4187)
- Add hint around canvas panning [#4159](https://github.com/excalidraw/excalidraw/pull/4159)
- Stop using production services for development [#4113](https://github.com/excalidraw/excalidraw/pull/4113)
- Add triangle arrowhead [#4024](https://github.com/excalidraw/excalidraw/pull/4024)
- Add rewrite to webex landing page [#4102](https://github.com/excalidraw/excalidraw/pull/4102)
- Switch collab server [#4092](https://github.com/excalidraw/excalidraw/pull/4092)
- Use dialog component for clear canvas instead of window confirm [#4075](https://github.com/excalidraw/excalidraw/pull/4075)
### Fixes
- Rename --color-primary-chubb to --color-primary-contrast-offset and fallback to primary color if not present [#4803](https://github.com/excalidraw/excalidraw/pull/4803)
- Add commits directly pushed to master in changelog [#4798](https://github.com/excalidraw/excalidraw/pull/4798)
- Don't bump element version when adding files data [#4794](https://github.com/excalidraw/excalidraw/pull/4794)
- Mobile link click [#4742](https://github.com/excalidraw/excalidraw/pull/4742)
- ContextMenu timer & pointers not correctly reset on iOS [#4765](https://github.com/excalidraw/excalidraw/pull/4765)
- Use absolute coords when rendering link popover [#4753](https://github.com/excalidraw/excalidraw/pull/4753)
- Changing font size when text is not selected or edited [#4751](https://github.com/excalidraw/excalidraw/pull/4751)
- Disable contextmenu on non-secondary `pen` events or `touch` [#4675](https://github.com/excalidraw/excalidraw/pull/4675)
- Mobile context menu won't show on long press [#4741](https://github.com/excalidraw/excalidraw/pull/4741)
- Do not open links twice [#4738](https://github.com/excalidraw/excalidraw/pull/4738)
- Make link icon clickable in mobile [#4736](https://github.com/excalidraw/excalidraw/pull/4736)
- Apple Pen missing strokes [#4705](https://github.com/excalidraw/excalidraw/pull/4705)
- Freedraw slow movement jittery lines [#4726](https://github.com/excalidraw/excalidraw/pull/4726)
- Disable three finger pinch zoom in penMode [#4725](https://github.com/excalidraw/excalidraw/pull/4725)
- Remove click listener for opening popup [#4700](https://github.com/excalidraw/excalidraw/pull/4700)
- Link popup position not accounting for offsets [#4695](https://github.com/excalidraw/excalidraw/pull/4695)
- PenMode darkmode style [#4692](https://github.com/excalidraw/excalidraw/pull/4692)
- Typing `_+` in wysiwyg not working [#4681](https://github.com/excalidraw/excalidraw/pull/4681)
- Keyboard-zooming in wysiwyg should zoom canvas [#4676](https://github.com/excalidraw/excalidraw/pull/4676)
- SceneCoordsToViewportCoords, jumping text when there is an offset [#4413](https://github.com/excalidraw/excalidraw/pull/4413) (#4630)
- Right-click object menu displays partially off-screen [#4572](https://github.com/excalidraw/excalidraw/pull/4572) (#4631)
- Support collaboration in bound text [#4573](https://github.com/excalidraw/excalidraw/pull/4573)
- Cmd/ctrl native browser behavior blocked in inputs [#4589](https://github.com/excalidraw/excalidraw/pull/4589)
- Use cached width when calculating min width during resize [#4585](https://github.com/excalidraw/excalidraw/pull/4585)
- Support collaboration in bounded text [#4580](https://github.com/excalidraw/excalidraw/pull/4580)
- Port for collab server and update docs [#4569](https://github.com/excalidraw/excalidraw/pull/4569)
- Don't mutate the bounded text if not updated when submitted [#4543](https://github.com/excalidraw/excalidraw/pull/4543)
- Prevent canvas drag while editing text [#4552](https://github.com/excalidraw/excalidraw/pull/4552)
- Support shift+P for freedraw [#4550](https://github.com/excalidraw/excalidraw/pull/4550)
- Prefer spreadsheet data over image [#4533](https://github.com/excalidraw/excalidraw/pull/4533)
- Show text properties button states correctly for bounded text [#4542](https://github.com/excalidraw/excalidraw/pull/4542)
- Rotate bounded text when container is rotated before typing [#4535](https://github.com/excalidraw/excalidraw/pull/4535)
- Undo should work when selecting bounded textr [#4537](https://github.com/excalidraw/excalidraw/pull/4537)
- Reduce padding to 5px for bounded text [#4530](https://github.com/excalidraw/excalidraw/pull/4530)
- Bound text doesn't inherit container [#4521](https://github.com/excalidraw/excalidraw/pull/4521)
- Text wrapping with grid [#4505](https://github.com/excalidraw/excalidraw/pull/4505) (#4506)
- Check if process is defined before using so it works in browser [#4497](https://github.com/excalidraw/excalidraw/pull/4497)
- Pending review fixes for sticky notes [#4493](https://github.com/excalidraw/excalidraw/pull/4493)
- Pasted elements except binded text once paste action is complete [#4472](https://github.com/excalidraw/excalidraw/pull/4472)
- Don't select binded text when ungrouping [#4470](https://github.com/excalidraw/excalidraw/pull/4470)
- Set height correctly when text properties updated while editing in container until first submit [#4469](https://github.com/excalidraw/excalidraw/pull/4469)
- Align and distribute binded text in container and cleanup [#4468](https://github.com/excalidraw/excalidraw/pull/4468)
- Move binded text when moving container using keyboard [#4466](https://github.com/excalidraw/excalidraw/pull/4466)
- Support dragging binded text in container selected in a group [#4462](https://github.com/excalidraw/excalidraw/pull/4462)
- Vertically align single line when deleting text in bounded container [#4460](https://github.com/excalidraw/excalidraw/pull/4460)
- Update height correctly when updating text properties in binded text [#4459](https://github.com/excalidraw/excalidraw/pull/4459)
- Align library item previews to center [#4447](https://github.com/excalidraw/excalidraw/pull/4447)
- Vertically center align text when text deleted [#4457](https://github.com/excalidraw/excalidraw/pull/4457)
- Vertically center the first line as user starts typing in container [#4454](https://github.com/excalidraw/excalidraw/pull/4454)
- Switch cursor to center of container when adding text when dimensions are too small [#4452](https://github.com/excalidraw/excalidraw/pull/4452)
- Vertically center align the bounded text correctly when zoomed [#4444](https://github.com/excalidraw/excalidraw/pull/4444)
- Support updating stroke color for text by typing in color picker input [#4415](https://github.com/excalidraw/excalidraw/pull/4415)
- Bound text not atomic with container when changing z-index [#4414](https://github.com/excalidraw/excalidraw/pull/4414)
- Update viewport coords correctly when editing text [#4416](https://github.com/excalidraw/excalidraw/pull/4416)
- Use word-break break-word only and update text editor height only when binded to container [#4410](https://github.com/excalidraw/excalidraw/pull/4410)
- Husky not able to execute pre-commit on windows [#4370](https://github.com/excalidraw/excalidraw/pull/4370)
- Make firebase config parsing not fail on undefined env [#4381](https://github.com/excalidraw/excalidraw/pull/4381)
- Adding to library via contextmenu when no image is selected [#4356](https://github.com/excalidraw/excalidraw/pull/4356)
- Export scale quality regression [#4316](https://github.com/excalidraw/excalidraw/pull/4316)
- Remove `100%` height from tooltip container to fix layout issues [#3980](https://github.com/excalidraw/excalidraw/pull/3980)
- Inline ENV variables when building excalidraw package [#4311](https://github.com/excalidraw/excalidraw/pull/4311)
- SVG export in dark mode with embedded bitmap image [#4285](https://github.com/excalidraw/excalidraw/pull/4285)
- New FS API not working on Linux [#4280](https://github.com/excalidraw/excalidraw/pull/4280)
- Url -> URL for consistency [#4277](https://github.com/excalidraw/excalidraw/pull/4277)
- Prevent adding images to library via contextMenu [#4264](https://github.com/excalidraw/excalidraw/pull/4264)
- Account for libraries v2 when prompting [#4263](https://github.com/excalidraw/excalidraw/pull/4263)
- Skia rendering issues [#4200](https://github.com/excalidraw/excalidraw/pull/4200)
- Ellipse roughness when `0` [#4194](https://github.com/excalidraw/excalidraw/pull/4194)
- Proper string for invalid SVG [#4191](https://github.com/excalidraw/excalidraw/pull/4191)
- Images not initialized correctly [#4157](https://github.com/excalidraw/excalidraw/pull/4157)
- Image-related fixes [#4147](https://github.com/excalidraw/excalidraw/pull/4147)
- Rewrite collab element reconciliation to fix z-index issues [#4076](https://github.com/excalidraw/excalidraw/pull/4076)
- Redirect excalidraw.com/about to for-webex.excalidraw.com [#4104](https://github.com/excalidraw/excalidraw/pull/4104)
- Redirect to webex LP instead of rewrite to fix SW [#4103](https://github.com/excalidraw/excalidraw/pull/4103)
- Clear image/shape cache of affected elements when adding files [#4089](https://github.com/excalidraw/excalidraw/pull/4089)
- Clear `LibraryUnit` DOM on unmount [#4084](https://github.com/excalidraw/excalidraw/pull/4084)
- Pasting images on firefox [#4085](https://github.com/excalidraw/excalidraw/pull/4085)
### Refactor
- Simplify zoom by removing `zoom.translation` [#4477](https://github.com/excalidraw/excalidraw/pull/4477)
- Deduplicate encryption helpers [#4146](https://github.com/excalidraw/excalidraw/pull/4146)
### Performance
- Cache approx line height in textwysiwg [#4651](https://github.com/excalidraw/excalidraw/pull/4651)
### Build
- Rename release command to 'release package' [#4783](https://github.com/excalidraw/excalidraw/pull/4783)
- Deploy excalidraw package example [#4762](https://github.com/excalidraw/excalidraw/pull/4762)
- Allow package.json changes when autoreleasing next [#4068](https://github.com/excalidraw/excalidraw/pull/4068)
---
## 0.10.0 (2021-10-13)
## Excalidraw API
@@ -178,10 +438,10 @@ Please add the latest change on the top under the correct section.
- 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.
Note: Earlier Excalidraw component was focused by default on page load, you need to enable `autoFocus` prop to retain the same behaviour.
- Added prop `UIOptions.canvasActions.export.renderCustomUI` to support Custom UI rendering inside export dialog [#3666](https://github.com/excalidraw/excalidraw/pull/3666).
- Added prop `UIOptions.canvasActions.saveAsImage` to show/hide the **Save as image** button in the canvas actions. Defauls to `true` hence the **Save as Image** button is rendered [#3662](https://github.com/excalidraw/excalidraw/pull/3662).
- Added prop `UIOptions.canvasActions.saveAsImage` to show/hide the **Save as image** button in the canvas actions. Defaults to `true` hence the **Save as Image** button is rendered [#3662](https://github.com/excalidraw/excalidraw/pull/3662).
- Export dialog can be customised with [`UiOptions.canvasActions.export`](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/README.md#exportOpts) [#3658](https://github.com/excalidraw/excalidraw/pull/3658).
@@ -229,7 +489,7 @@ Please add the latest change on the top under the correct section.
- Exporting redesign [#3613](https://github.com/excalidraw/excalidraw/pull/3613)
- Auto-position tooltip and suport overflowing container [#3631](https://github.com/excalidraw/excalidraw/pull/3631)
- Auto-position tooltip and support overflowing container [#3631](https://github.com/excalidraw/excalidraw/pull/3631)
- Auto release @excalidraw/excalidraw-next on every change [#3614](https://github.com/excalidraw/excalidraw/pull/3614)
+257 -111
View File
@@ -347,6 +347,31 @@ To view the full example visit :point_down:
</details>
### Customizing styles
Excalidraw is using CSS variables to style certain components. To override them, you should set your own on the `.excalidraw` and `.excalidraw.theme--dark` (for dark mode variables) selectors.
Make sure the selector has higher specificity, e.g. by prefixing it with your app's selector:
```css
.your-app .excalidraw {
--color-primary: red;
}
.your-app .excalidraw.theme--dark {
--color-primary: pink;
}
```
Most notably, you can customize the primary colors, by overriding these variables:
- `--color-primary`
- `--color-primary-darker`
- `--color-primary-darkest`
- `--color-primary-light`
- `--color-primary-contrast-offset` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to fix contrast issues (see [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion)). It will fall back to `--color-primary` if not present.
For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/src/css/theme.scss), though most of them will not make sense to override.
### Props
| Name | Type | Default | Description |
@@ -365,14 +390,16 @@ To view the full example visit :point_down:
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
| [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
| [`theme`](#theme) | `light` or `dark` | | The theme of the Excalidraw component |
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) &#124; [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
| [`name`](#name) | string | | Name of the drawing |
| [`UIOptions`](#UIOptions) | <pre>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</pre> | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L129) | To customise UI options. Currently we support customising [`canvas actions`](#canvasActions) |
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
| [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
| [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
| [`onLibraryChange`](#onLibraryChange) | <pre>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void &#124; Promise&lt;any&gt; </pre> | | The callback if supplied is triggered when the library is updated and receives the library items. |
| [`autoFocus`](#autoFocus) | boolean | false | Implies whether to focus the Excalidraw component on page load |
| [`generateIdForFile`](#generateIdForFile) | `(file: File) => string | Promise<string>` | Allows you to override `id` generation for files added on canvas |
| [`onLinkOpen`](#onLinkOpen) | <pre>(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">NonDeletedExcalidrawElement</a>, event: CustomEvent) </pre> | | This prop if passed will be triggered when link of an element is clicked |
### Dimensions of Excalidraw
@@ -383,12 +410,14 @@ Excalidraw takes `100%` of `width` and `height` of the containing block so make
Every time component updates, this callback if passed will get triggered and has the below signature.
```js
(excalidrawElements, appState) => void;
(excalidrawElements, appState, files) => void;
```
1.`excalidrawElements`: Array of [excalidrawElements](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) in the scene.
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene.
3. `files`: The [`BinaryFiles`]([BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) which are added to the scene.
Here you can try saving the data to your backend or local storage for example.
@@ -396,12 +425,13 @@ Here you can try saving the data to your backend or local storage for example.
This helps to load Excalidraw with `initialData`. It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
| Name | Type | Descrption |
| Name | Type | Description |
| --- | --- | --- |
| `elements` | [ExcalidrawElement[]](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | The elements with which Excalidraw should be mounted. |
| `appState` | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | The App state with which Excalidraw should be mounted. |
| `scrollToContent` | boolean | This attribute implies whether to scroll to the nearest element to center once Excalidraw is mounted. By default, it will not scroll the nearest element to the center. Make sure you pass `initialData.appState.scrollX` and `initialData.appState.scrollY` when `scrollToContent` is false so that scroll positions are retained |
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L151) | This library items with which Excalidraw should be mounted. |
| `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) | The files added to the scene. |
```json
{
@@ -442,7 +472,8 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
| --- | --- | --- |
| ready | `boolean` | This is set to true once Excalidraw is rendered |
| readyPromise | [resolvablePromise](https://github.com/excalidraw/excalidraw/blob/master/src/utils.ts#L317) | This promise will be resolved with the api once excalidraw has rendered. This will be helpful when you want do some action on the host app once this promise resolves. For this to work you will have to pass ref as shown [here](#readyPromise) |
| [updateScene](#updateScene) | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>)) => void </pre> | updates the scene with the sceneData |
| [updateScene](#updateScene) | <pre>(scene: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>) => void </pre> | updates the scene with the sceneData |
| [addFiles](#addFiles) | <pre>(files: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts">BinaryFileData</a>) => void </pre> | add files data to the appState |
| resetScene | `({ resetLoadingState: boolean }) => void` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. |
| getSceneElementsIncludingDeleted | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements including the deleted in the scene |
| getSceneElements | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a></pre> | Returns all the elements excluding the deleted in the scene |
@@ -453,6 +484,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
| [importLibrary](#importlibrary) | `(url: string, token?: string) => void` | Imports library from given URL |
| setToastMessage | `(message: string) => void` | This API can be used to show the toast with custom message. |
| [id](#id) | string | Unique ID for the excalidraw component. |
| [getFiles](#getFiles) | <pre>() => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">files</a> </pre> | This API can be used to get the files present in the scene. It may contain files that aren't referenced by any element, so if you're persisting the files to a storage, you should compare them against stored elements. |
#### `readyPromise`
@@ -465,7 +497,7 @@ Since plain object is passed as a `ref`, the `readyPromise` is resolved as soon
### `updateScene`
<pre>
(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>)) => void
(scene: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>) => void
</pre>
You can use this function to update the scene with the sceneData. It accepts the below attributes.
@@ -476,6 +508,13 @@ You can use this function to update the scene with the sceneData. It accepts the
| `appState` | [`ImportedDataState["appState"]`](https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L18) | The `appState` to be updated in the scene. |
| `collaborators` | <pre>Map<string, <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L29">Collaborator></a></pre> | The list of collaborators to be updated in the scene. |
| `commitToHistory` | `boolean` | Implies if the `history (undo/redo)` should be recorded. Defaults to `false`. |
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L258) | The `libraryItems` to be update in the scene. |
### `addFiles`
<pre>(files: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts">BinaryFileData</a>) => void </pre>
Adds supplied files data to the `appState.files` cache on top of existing files present in the cache.
#### `onCollabButtonClick`
@@ -558,7 +597,7 @@ If supplied, this URL will be used when user tries to install a library from [li
#### `theme`
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app.
This prop controls Excalidraw's theme. When supplied, the value takes precedence over `intialData.appState.theme`, the theme will be fully controlled by the host app, and users won't be able to toggle it from within the app. You can use [`THEME`](#THEME-1) to specify the theme.
#### `name`
@@ -599,18 +638,14 @@ The below attributes can be set in `UIOptions.canvasActions.export` to customize
This callback is triggered if passed when something is pasted into the scene. You can use this callback in case you want to do something additional when the paste event occurs.
<pre>
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
</pre>
This callback must return a `boolean` value or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to a boolean value.
In case you want to prevent the excalidraw paste action you must return `false`, it will stop the native excalidraw clipboard management flow (nothing will be pasted into the scene).
### Does it support collaboration ?
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
### importLibrary
#### `importLibrary`
Imports library from given URL. You should call this on `hashchange`, passing the `addLibrary` value if you detect it as shown below. Optionally pass a CSRF `token` to skip prompting during installation (retrievable via `token` key from the url coming from [https://libraries.excalidraw.com](https://libraries.excalidraw.com/)).
@@ -632,19 +667,19 @@ useEffect(() => {
Try out the [Demo](#Demo) to see it in action.
### detectScroll
#### `detectScroll`
Indicates whether Excalidraw should listen for `scroll` event on the nearest scrollable container in the DOM tree and recompute the coordinates (e.g. to correctly handle the cursor) when the component's position changes. You can disable this when you either know this doesn't affect your app or you want to take care of it yourself (calling the [`refresh()`](#ref) method).
### handleKeyboardGlobally
#### `handleKeyboardGlobally`
Indicates whether to bind keyboard events to `document`. Disabled by default, meaning the keyboard events are bound to the Excalidraw component. This allows for multiple Excalidraw components to live on the same page, and ensures that Excalidraw keyboard handling doesn't collide with your app's (or the browser) when the component isn't focused.
Enable this if you want Excalidraw to handle keyboard even if the component isn't focused (e.g. a user is interacting with the navbar, sidebar, or similar).
### onLibraryChange
#### `onLibraryChange`
Ths callback if supplied will get triggered when the library is updated and has the below signature.
This callback if supplied will get triggered when the library is updated and has the below signature.
<pre>
(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any>
@@ -652,58 +687,58 @@ Ths callback if supplied will get triggered when the library is updated and has
It is invoked with empty items when user clears the library. You can use this callback when you want to do something additional when library is updated for example persisting it to local storage.
### id
#### `id`
The unique id of the excalidraw component. This can be used to identify the excalidraw component, for example importing the library items to the excalidraw component from where it was initiated when you have multiple excalidraw components rendered on the same page as shown in [multiple excalidraw demo](https://codesandbox.io/s/multiple-excalidraw-k1xx5).
### autoFocus
#### `autoFocus`
This prop implies whether to focus the Excalidraw component on page load. Defaults to false.
### Extra API's
#### `generateIdForFile`
#### `getSceneVersion`
Allows you to override `id` generation for files added on canvas (images). By default, an SHA-1 digest of the file is used.
**How to use**
<pre>
import { getSceneVersion } from "@excalidraw/excalidraw";
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
</pre>
This function returns the current scene version.
#### `isInvisiblySmallElement`
**_Signature_**
<pre>
isInvisiblySmallElement(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>): boolean
</pre>
**How to use**
```js
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
```
(file: File) => string | Promise<string>
```
Returns `true` if element is invisibly small (e.g. width & height are zero).
#### `onLinkOpen`
#### `getElementMap`
This prop if passed will be triggered when clicked on link. To handle the redirect yourself (such as when using your own router for internal links), you must call `event.preventDefault()`.
**_Signature_**
<pre>
getElementsMap(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>): {[id: string]: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>}
</pre>
**How to use**
```js
import { getElementsMap } from "@excalidraw/excalidraw";
```
(element: ExcalidrawElement, event: CustomEvent<{ nativeEvent: MouseEvent }>) => void
```
This function returns an object where each element is mapped to its id.
Example:
```ts
const history = useHistory();
// open internal links using the app's router, but opens external links in
// a new tab/window
const onLinkOpen: ExcalidrawProps["onLinkOpen"] = useCallback(
(element, event) => {
const link = element.link;
const { nativeEvent } = event.detail;
const isNewTab = nativeEvent.ctrlKey || nativeEvent.metaKey;
const isNewWindow = nativeEvent.shiftKey;
const isInternalLink =
link.startsWith("/") || link.includes(window.location.origin);
if (isInternalLink && !isNewTab && !isNewWindow) {
history.push(link.replace(window.location.origin, ""));
// signal that we're handling the redirect ourselves
event.preventDefault();
}
},
[history],
);
```
### Does it support collaboration ?
No, Excalidraw package doesn't come with collaboration built in, since the implementation is specific to each host app. We expose APIs which you can use to communicate with Excalidraw which you can use to implement it. You can check our own implementation [here](https://github.com/excalidraw/excalidraw/blob/master/src/excalidraw-app/index.tsx).
### Restore utilities
@@ -761,19 +796,6 @@ import { restore } from "@excalidraw/excalidraw";
This function makes sure elements and state is set to appropriate values and set to default value if not present. It is a combination of [restoreElements](#restoreElements) and [restoreAppState](#restoreAppState).
#### `serializeAsJSON`
**_Signature_**
<pre>
serializeAsJSON({
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>,
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
}): string
</pre>
Takes the scene elements and state and returns a JSON string. Deleted `elements`as well as most properties from `AppState` are removed from the resulting JSON. (see [`serializeAsJSON()`](https://github.com/excalidraw/excalidraw/blob/master/src/data/json.ts#L16) source for details).
### Export utilities
#### `exportToCanvas`
@@ -785,14 +807,17 @@ Takes the scene elements and state and returns a JSON string. Deleted `elements`
elements,
appState
getDimensions,
}: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L10">ExportOpts</a>
files
}: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12">ExportOpts</a>
</pre>
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types) | | The elements to be exported to canvas |
| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
| getDimensions | `(width: number, height: number) => {width: number, height: number, scale: number)` | `(width, height) => ({ width, height, scale: 1 })` | A function which returns the width, height and scale with which canvas is to be exported. |
| getDimensions | `(width: number, height: number) => { width: number, height: number, scale?: number }` | undefined | A function which returns the `width`, `height`, and optionally `scale` (defaults `1`), with which canvas is to be exported. |
| maxWidthOrHeight | `number` | undefined | The maximum width or height of the exported image. If provided, `getDimensions` is ignored. |
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
**How to use**
@@ -828,8 +853,6 @@ import { exportToBlob } from "@excalidraw/excalidraw";
Returns a promise which resolves with a [blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob). It internally uses [canvas.ToBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob).
Note: `appState.exportBackground` is always set to `true` if exporting to `image/jpeg` to ensure the alpha channel isn't compressed to black.
#### `exportToSvg`
**_Signature_**
@@ -840,6 +863,7 @@ exportToSvg({
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
exportPadding?: number,
metadata?: string,
files?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">BinaryFiles</a>
})
</pre>
@@ -848,6 +872,7 @@ exportToSvg({
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | | The elements to exported as svg |
| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
| exportPadding | number | 10 | The padding to be added on canvas |
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
This function returns a promise which resolves to svg of the exported drawing.
@@ -860,7 +885,129 @@ This function returns a promise which resolves to svg of the exported drawing.
| exportWithDarkMode | boolean | false | Indicates whether to export with dark mode |
| exportEmbedScene | boolean | false | Indicates whether scene data should be embedded in svg. This will increase the svg size. |
### FONT_FAMILY
### Extra API's
#### `serializeAsJSON`
**_Signature_**
<pre>
serializeAsJSON({
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>,
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
}): string
</pre>
Takes the scene elements and state and returns a JSON string. Deleted `elements`as well as most properties from `AppState` are removed from the resulting JSON. (see [`serializeAsJSON()`](https://github.com/excalidraw/excalidraw/blob/master/src/data/json.ts#L16) source for details).
#### `getSceneVersion`
**How to use**
<pre>
import { getSceneVersion } from "@excalidraw/excalidraw";
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
</pre>
This function returns the current scene version.
#### `isInvisiblySmallElement`
**_Signature_**
<pre>
isInvisiblySmallElement(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>): boolean
</pre>
**How to use**
```js
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
```
Returns `true` if element is invisibly small (e.g. width & height are zero).
#### `loadLibraryFromBlob`
```js
import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
```
**_Signature_**
<pre>
loadLibraryFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>)
</pre>
This function loads the library from the blob.
#### `loadFromBlob`
**How to use**
```js
import { loadFromBlob } from "@excalidraw/excalidraw";
```
**Signature**
<pre>
loadFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>, localAppState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a> | null)
</pre>
This function loads the scene data from the blob. If you pass `localAppState`, `localAppState` value will be preferred over the `appState` derived from `blob`
#### `getFreeDrawSvgPath`
**How to use**
```js
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw";
```
**Signature**
<pre>
getFreeDrawSvgPath(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L127">ExcalidrawFreeDrawElement</a>
</pre>
This function returns the free draw svg path for the element.
#### `isLinearElement`
**How to use**
```js
import { isLinearElement } from "@excalidraw/excalidraw";
```
**Signature**
<pre>
isLinearElement(elementType?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80">ExcalidrawElement</a>): boolean
</pre>
This function returns true if the element is linear type (`arrow` |`line`) else returns false.
#### `getNonDeletedElements`
**How to use**
```js
import { getNonDeletedElements } from "@excalidraw/excalidraw";
```
**Signature**
<pre>
getNonDeletedElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80"> readonly ExcalidrawElement[]</a>): as readonly <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L90">NonDeletedExcalidrawElement[]</a>
</pre>
This function returns an array of deleted elements.
### Exported constants
#### `FONT_FAMILY`
**How to use**
@@ -878,52 +1025,51 @@ import { FONT_FAMILY } from "@excalidraw/excalidraw";
Defaults to `FONT_FAMILY.Virgil` unless passed in `initialData.appState.currentItemFontFamily`.
### loadLibraryFromBlob
```js
import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
```
**_Signature_**
<pre>
loadLibraryFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>)
</pre>
This function loads the library from the blob.
### loadFromBlob
#### `THEME`
**How to use**
```js
import { loadFromBlob } from "@excalidraw/excalidraw";
import { THEME } from "@excalidraw/excalidraw";
```
**Signature**
`THEME` contains all the themes supported by `Excalidraw` as explained below
<pre>
loadFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>, localAppState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a> | null)
</pre>
| Theme | Description |
| ----- | --------------- |
| LIGHT | The light theme |
| DARK | The Dark theme |
This function loads the scene data from the blob. If you pass `localAppState`, `localAppState` value will be preferred over the `appState` derived from `blob`
### getFreeDrawSvgPath
**How to use**
```js
import { getFreeDrawSvgPath } from "@excalidraw/excalidraw";
```
**Signature**
<pre>
getFreeDrawSvgPath(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L127">ExcalidrawFreeDrawElement</a>
</pre>
This function returns the free draw svg path for the element.
Defaults to `THEME.LIGHT` unless passed in `initialData.appState.theme`
## Need help?
Check out the existing [Q&A](https://github.com/excalidraw/excalidraw/discussions?discussions_q=label%3Apackage%3Aexcalidraw). If you have any queries or need help, ask us [here](https://github.com/excalidraw/excalidraw/discussions?discussions_q=label%3Apackage%3Aexcalidraw).
### Development
#### Install the dependencies
```bash
yarn
```
#### Start the server
```bash
yarn start
```
[http://localhost:3001](http://localhost:3001) will open in your default browser.
The example is same as the [codesandbox example](https://ehlz3.csb.app/)
#### Create a test release
You can create a test release by posting the below comment in your pull request
```
@excalibot release package
```
Once the version is released `@excalibot` will post a comment with the release version.
+17 -9
View File
@@ -374,7 +374,7 @@ Most notably, you can customize the primary colors, by overriding these variable
- `--color-primary-darker`
- `--color-primary-darkest`
- `--color-primary-light`
- `--color-primary-chubb` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to account for [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion).
- `--color-primary-contrast-offset` — a slightly darker (in light mode), or lighter (in dark mode) `--color-primary` color to fix contrast issues (see [Chubb illusion](https://en.wikipedia.org/wiki/Chubb_illusion)). It will fall back to `--color-primary` if not present.
For a complete list of variables, check [theme.scss](https://github.com/excalidraw/excalidraw/blob/master/src/css/theme.scss), though most of them will not make sense to override.
@@ -399,7 +399,7 @@ For a complete list of variables, check [theme.scss](https://github.com/excalidr
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) &#124; [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
| [`name`](#name) | string | | Name of the drawing |
| [`UIOptions`](#UIOptions) | <pre>{ canvasActions: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L208"> CanvasActions<a/> }</pre> | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/src/constants.ts#L129) | To customise UI options. Currently we support customising [`canvas actions`](#canvasActions) |
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
| [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
| [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
| [`onLibraryChange`](#onLibraryChange) | <pre>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void &#124; Promise&lt;any&gt; </pre> | | The callback if supplied is triggered when the library is updated and receives the library items. |
@@ -416,12 +416,14 @@ Excalidraw takes `100%` of `width` and `height` of the containing block so make
Every time component updates, this callback if passed will get triggered and has the below signature.
```js
(excalidrawElements, appState) => void;
(excalidrawElements, appState, files) => void;
```
1.`excalidrawElements`: Array of [excalidrawElements](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) in the scene.
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene.
3. `files`: The [`BinaryFiles`]([BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) which are added to the scene.
Here you can try saving the data to your backend or local storage for example.
@@ -429,12 +431,13 @@ Here you can try saving the data to your backend or local storage for example.
This helps to load Excalidraw with `initialData`. It must be an object or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to an object containing the below optional fields.
| Name | Type | Descrption |
| Name | Type | Description |
| --- | --- | --- |
| `elements` | [ExcalidrawElement[]](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | The elements with which Excalidraw should be mounted. |
| `appState` | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | The App state with which Excalidraw should be mounted. |
| `scrollToContent` | boolean | This attribute implies whether to scroll to the nearest element to center once Excalidraw is mounted. By default, it will not scroll the nearest element to the center. Make sure you pass `initialData.appState.scrollX` and `initialData.appState.scrollY` when `scrollToContent` is false so that scroll positions are retained |
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L151) | This library items with which Excalidraw should be mounted. |
| `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) | The files added to the scene. |
```json
{
@@ -487,6 +490,7 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
| [importLibrary](#importlibrary) | `(url: string, token?: string) => void` | Imports library from given URL |
| setToastMessage | `(message: string) => void` | This API can be used to show the toast with custom message. |
| [id](#id) | string | Unique ID for the excalidraw component. |
| [getFiles](#getFiles) | <pre>() => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">files</a> </pre> | This API can be used to get the files present in the scene. It may contain files that aren't referenced by any element, so if you're persisting the files to a storage, you should compare them against stored elements. |
#### `readyPromise`
@@ -516,7 +520,7 @@ You can use this function to update the scene with the sceneData. It accepts the
<pre>(files: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts">BinaryFileData</a>) => void </pre>
Adds supplied files data to the `appState.files` cache, on top of existing files present in the cache.
Adds supplied files data to the `appState.files` cache on top of existing files present in the cache.
#### `onCollabButtonClick`
@@ -640,7 +644,7 @@ The below attributes can be set in `UIOptions.canvasActions.export` to customize
This callback is triggered if passed when something is pasted into the scene. You can use this callback in case you want to do something additional when the paste event occurs.
<pre>
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L17">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent &#124; null) => boolean
</pre>
This callback must return a `boolean` value or a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise) which resolves to a boolean value.
@@ -681,7 +685,7 @@ Enable this if you want Excalidraw to handle keyboard even if the component isn'
#### `onLibraryChange`
Ths callback if supplied will get triggered when the library is updated and has the below signature.
This callback if supplied will get triggered when the library is updated and has the below signature.
<pre>
(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any>
@@ -809,7 +813,8 @@ This function makes sure elements and state is set to appropriate values and set
elements,
appState
getDimensions,
}: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L10">ExportOpts</a>
files
}: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12">ExportOpts</a>
</pre>
| Name | Type | Default | Description |
@@ -818,6 +823,7 @@ This function makes sure elements and state is set to appropriate values and set
| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
| getDimensions | `(width: number, height: number) => { width: number, height: number, scale?: number }` | undefined | A function which returns the `width`, `height`, and optionally `scale` (defaults `1`), with which canvas is to be exported. |
| maxWidthOrHeight | `number` | undefined | The maximum width or height of the exported image. If provided, `getDimensions` is ignored. |
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
**How to use**
@@ -863,6 +869,7 @@ exportToSvg({
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
exportPadding?: number,
metadata?: string,
files?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">BinaryFiles</a>
})
</pre>
@@ -871,6 +878,7 @@ exportToSvg({
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | | The elements to exported as svg |
| appState | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | [defaultAppState](https://github.com/excalidraw/excalidraw/blob/master/src/appState.ts#L11) | The app state of the scene |
| exportPadding | number | 10 | The padding to be added on canvas |
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
This function returns a promise which resolves to svg of the exported drawing.

Some files were not shown because too many files have changed in this diff Show More