@zsviczian/excalidraw 0.10.0-textfix-17 → 0.11.0-obsidian-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -84
- package/dist/excalidraw.development.js +1212 -608
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +7 -0
- package/package.json +19 -14
- package/types/actions/actionAddToLibrary.d.ts +286 -1
- package/types/actions/actionAlign.d.ts +73 -6
- package/types/actions/actionCanvas.d.ts +809 -8
- package/types/actions/actionClipboard.d.ts +523 -4
- package/types/actions/actionDeleteSelected.d.ts +310 -1
- package/types/actions/actionDistribute.d.ts +27 -2
- package/types/actions/actionDuplicateSelection.d.ts +19 -1
- package/types/actions/actionExport.d.ts +903 -8
- package/types/actions/actionFinalize.d.ts +198 -1
- package/types/actions/actionFlip.d.ts +29 -2
- package/types/actions/actionGroup.d.ts +39 -2
- package/types/actions/actionMenu.d.ts +311 -4
- package/types/actions/actionNavigate.d.ts +11 -1
- package/types/actions/actionProperties.d.ts +1232 -12
- package/types/actions/actionSelectAll.d.ts +12 -1
- package/types/actions/actionStyles.d.ts +116 -2
- package/types/actions/actionToggleGridMode.d.ts +104 -1
- package/types/actions/actionToggleStats.d.ts +103 -1
- package/types/actions/actionToggleViewMode.d.ts +103 -1
- package/types/actions/actionToggleZenMode.d.ts +103 -1
- package/types/actions/actionUnbindText.d.ts +11 -0
- package/types/actions/actionZindex.d.ts +55 -4
- package/types/actions/index.d.ts +3 -1
- package/types/actions/register.d.ts +3 -1
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +3 -2
- package/types/align.d.ts +0 -1
- package/types/analytics.d.ts +1 -1
- package/types/appState.d.ts +0 -4
- package/types/components/App.d.ts +21 -2
- package/types/components/ButtonIconSelect.d.ts +1 -0
- package/types/components/ColorPicker.d.ts +6 -1
- package/types/components/ContextMenu.d.ts +3 -0
- package/types/components/LayerUI.d.ts +2 -1
- package/types/components/MobileMenu.d.ts +2 -1
- package/types/components/PenModeButton.d.ts +13 -0
- package/types/components/Popover.d.ts +5 -1
- package/types/components/Tooltip.d.ts +7 -0
- package/types/components/icons.d.ts +4 -0
- package/types/constants.d.ts +9 -9
- package/types/disitrubte.d.ts +0 -1
- package/types/element/Hyperlink.d.ts +125 -0
- package/types/element/bounds.d.ts +4 -0
- package/types/element/collision.d.ts +1 -0
- package/types/element/dragElements.d.ts +2 -2
- package/types/element/linearElementEditor.d.ts +10 -4
- package/types/element/newElement.d.ts +6 -3
- package/types/element/resizeElements.d.ts +1 -1
- package/types/element/textElement.d.ts +9 -5
- package/types/element/textWysiwyg.d.ts +5 -5
- package/types/element/types.d.ts +2 -0
- package/types/groups.d.ts +1 -0
- package/types/keys.d.ts +6 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ar-SA-json-bad937b9c5872d8bb08c.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-bg-BG-json-b75f0626e77ba4b93a1a.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-bn-BD-json-ba2910bdfa31bf4a3b47.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ca-ES-json-d4752239985378d6687b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-cs-CZ-json-3f0957ec0784a1e70989.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-da-DK-json-30c4bddb0657ba3ec9f0.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-de-DE-json-1f36c83788d93a26c574.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-el-GR-json-c7749e93b5ee2ef46f01.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-es-ES-json-c58a268683a5a98cb339.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-eu-ES-json-a3036124af529be40107.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fa-IR-json-e49ff1b123f75b3fe6ae.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fi-FI-json-25e90ae7a679737c89fa.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-fr-FR-json-7d9dfefbcbd632631e26.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-he-IL-json-5f850f9fc31f38e08e11.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hi-IN-json-022f6946007c53005bf4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-hu-HU-json-29933e37837a1a237a79.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-id-ID-json-7dc2565e1c0b98d44e81.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-it-IT-json-30125a866f08cd0c8dce.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ja-JP-json-045af0024c647d78ff48.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-kab-KAB-json-dec84820b3b3b8cea91e.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-kk-KZ-json-a2be2aa000093bb0c4b1.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ko-KR-json-df4ca911d661a3668791.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-lt-LT-json-e9bd2413c78d8cd605c1.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-lv-LV-json-35f7377cd0651c3473cb.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-my-MM-json-4326db071b2b5ad9ebd2.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nb-NO-json-f99ea85b15d9c0fd412f.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nl-NL-json-676bbee6b2201018afea.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-nn-NO-json-1a9f7d30feff1eafa425.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-oc-FR-json-5ce59f015d4aaae56795.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pa-IN-json-5edc5b8da2685495dc6f.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pl-PL-json-2a6bca3404366166de44.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-BR-json-df0e1971ca6c9ab7ba96.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-pt-PT-json-088903851b38144d92cd.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ro-RO-json-e9e42a4eea14e9780121.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ru-RU-json-6619d335c0dc5729f858.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-si-LK-json-29566ffe4c2aab9bc9d7.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sk-SK-json-68881f095026d35935f3.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-sv-SE-json-11387dba5283047f00f2.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-ta-IN-json-fadfdd197ff5b857ed62.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-tr-TR-json-b92a92cca02f833721d4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-uk-UA-json-550e1d2467d2c10ba4c5.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-CN-json-02c2e2cacd9b605b9433.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-HK-json-24ab7abe8e695f165b3b.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/i18n-zh-TW-json-9a0e7901a1a58502bfa4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/image-b76d879db8316c30fd0d.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets/vendor-41e5c0be76c29ad2aba4.d.ts +0 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ar-SA-json-37ef19edefea75b3680e.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-bg-BG-json-7d5458f5cc2a84d8f6e2.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-bn-BD-json-448d07219c41f8dbb55b.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ca-ES-json-1b5b2fc0229d73e426e2.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-cs-CZ-json-eb093b2c8ac7708896f3.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-da-DK-json-d8afa5e01e2078a828c2.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-de-DE-json-a6cee4c1996e3aafa069.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-el-GR-json-9db54ad72bc0f1b46368.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-es-ES-json-6d364eae9cd78b062862.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-eu-ES-json-a6295f834d0adb4083eb.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-fa-IR-json-994aead70f24c0e04f88.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-fi-FI-json-0208c92c12556594091e.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-fr-FR-json-d12919b5af660f8cd0e2.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-he-IL-json-ee1c784d61ae761756b4.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-hi-IN-json-77fcce82aa2ea23ebc57.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-hu-HU-json-2afc786729254afcc04b.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-id-ID-json-261de18ed01a905bb8a7.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-it-IT-json-02005e1fe5f9ef001a3e.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ja-JP-json-ee12ac450c12bf9abd0a.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-kab-KAB-json-4b948b48bde7a5aa988b.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-kk-KZ-json-4902d8f64c4c6345ea0e.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ko-KR-json-afd4100bf8ede6c92721.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-lt-LT-json-a611d0fc2fe568829b13.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-lv-LV-json-f95d6c285bf18cdd5eaa.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-my-MM-json-84db1bbb92c1dee8e250.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-nb-NO-json-d80c0c3712700e7aaad3.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-nl-NL-json-67080c662a350e8983ec.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-nn-NO-json-5d74e695d9a164368952.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-oc-FR-json-19acf217a1bd641a3e5f.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-pa-IN-json-6070668134134cdc4cc5.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-pl-PL-json-49b6e8525a0d9ac86381.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-pt-BR-json-194bb19328e2a094db3f.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-pt-PT-json-8959660f187eb41da2fc.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ro-RO-json-a61aaf893c100b18bbb8.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ru-RU-json-8fb78f4f8f1373c5c428.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-si-LK-json-0a6676ca84d9add83859.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-sk-SK-json-bc378d74487614e52ac9.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-sv-SE-json-aadcfeee9542d5b32173.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-ta-IN-json-4e673cde4ee803280436.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-tr-TR-json-4bcb79efe0490c66f154.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-uk-UA-json-1482d7b2e2e8a0232419.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-zh-CN-json-8c7c0fec6b0765479622.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-zh-HK-json-70b4a1bb0d8d99abfa2a.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/i18n-zh-TW-json-d4e760d2810c47bf381a.d.ts +2 -0
- package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-8825d180ee32659f8996.d.ts +0 -0
- package/types/packages/excalidraw/example/App.d.ts +1 -0
- package/types/packages/excalidraw/example/index.d.ts +1 -0
- package/types/packages/excalidraw/example/initialData.d.ts +172 -0
- package/types/packages/excalidraw/example/sidebar/Sidebar.d.ts +1 -0
- package/types/packages/excalidraw/index.d.ts +1 -1
- package/types/packages/excalidraw/webpack.dev-server.config.d.ts +19 -0
- package/types/packages/excalidraw/webpack.dev.config.d.ts +15 -5
- package/types/packages/excalidraw/webpack.prod.config.d.ts +2 -1
- package/types/packages/utils.d.ts +4 -0
- package/types/renderer/renderElement.d.ts +12 -1
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/index.d.ts +1 -1
- package/types/scene/zoom.d.ts +12 -5
- package/types/shapes.d.ts +1 -1
- package/types/types.d.ts +32 -7
- package/types/utils.d.ts +19 -0
- package/dist/excalidraw-assets/Cascadia.woff2 +0 -0
- package/dist/excalidraw-assets/Virgil.woff2 +0 -0
- package/dist/excalidraw-assets/i18n-ar-SA-json-6fcb7979cd290e0e51d9.js +0 -1
- package/dist/excalidraw-assets/i18n-bg-BG-json-eb8b237a2970da7034ad.js +0 -1
- package/dist/excalidraw-assets/i18n-bn-BD-json-87d5cd14de43ad6ec162.js +0 -1
- package/dist/excalidraw-assets/i18n-ca-ES-json-93b7462bd1d0fe76d2b5.js +0 -1
- package/dist/excalidraw-assets/i18n-cs-CZ-json-1244df10086a058f2d41.js +0 -1
- package/dist/excalidraw-assets/i18n-da-DK-json-85af69d03d5a188d4d3e.js +0 -1
- package/dist/excalidraw-assets/i18n-de-DE-json-e676479528793fb9755f.js +0 -1
- package/dist/excalidraw-assets/i18n-el-GR-json-cef06f766f46d7ab798a.js +0 -1
- package/dist/excalidraw-assets/i18n-es-ES-json-2996f978aa8d44a1bc72.js +0 -1
- package/dist/excalidraw-assets/i18n-fa-IR-json-84150b1f61e3d7a0afcf.js +0 -1
- package/dist/excalidraw-assets/i18n-fi-FI-json-bb5e3af1d7bb005f0c7d.js +0 -1
- package/dist/excalidraw-assets/i18n-fr-FR-json-f470b9806c21d127df35.js +0 -1
- package/dist/excalidraw-assets/i18n-he-IL-json-dfc95883bf533087b673.js +0 -1
- package/dist/excalidraw-assets/i18n-hi-IN-json-07d3a348a9723eeb51a3.js +0 -1
- package/dist/excalidraw-assets/i18n-hu-HU-json-dbaf9c47430503d4a710.js +0 -1
- package/dist/excalidraw-assets/i18n-id-ID-json-43b313d6c7c52122220b.js +0 -1
- package/dist/excalidraw-assets/i18n-it-IT-json-1cd7244d3b42597e1555.js +0 -1
- package/dist/excalidraw-assets/i18n-ja-JP-json-c6208f4ec6ec8d61df2f.js +0 -1
- package/dist/excalidraw-assets/i18n-kab-KAB-json-7aaa4a5ea8484b941af2.js +0 -1
- package/dist/excalidraw-assets/i18n-kk-KZ-json-654dee98c29976300a26.js +0 -1
- package/dist/excalidraw-assets/i18n-ko-KR-json-fc3ee48a144b19bcca0d.js +0 -1
- package/dist/excalidraw-assets/i18n-lv-LV-json-bfb22930b5a31d1f92ee.js +0 -1
- package/dist/excalidraw-assets/i18n-my-MM-json-6d186d192f0024208fe2.js +0 -1
- package/dist/excalidraw-assets/i18n-nb-NO-json-a8b16b7360f5df195438.js +0 -1
- package/dist/excalidraw-assets/i18n-nl-NL-json-be44386cc68047e2da24.js +0 -1
- package/dist/excalidraw-assets/i18n-nn-NO-json-074a3f14a8e56d66eeb7.js +0 -1
- package/dist/excalidraw-assets/i18n-oc-FR-json-ad1cdc3ba675116187a4.js +0 -1
- package/dist/excalidraw-assets/i18n-pa-IN-json-319132bcecbfaf90ef79.js +0 -1
- package/dist/excalidraw-assets/i18n-pl-PL-json-2df7909ca92201d653d7.js +0 -1
- package/dist/excalidraw-assets/i18n-pt-BR-json-ad09ed1c16a3d2b6d4b8.js +0 -1
- package/dist/excalidraw-assets/i18n-pt-PT-json-73605e7eed8d224609aa.js +0 -1
- package/dist/excalidraw-assets/i18n-ro-RO-json-b48f7b508a0884880f63.js +0 -1
- package/dist/excalidraw-assets/i18n-ru-RU-json-cd5378c60549c20232c7.js +0 -1
- package/dist/excalidraw-assets/i18n-si-LK-json-c5e207625d8f7a06eb15.js +0 -1
- package/dist/excalidraw-assets/i18n-sk-SK-json-0261a2d60b0803cc8354.js +0 -1
- package/dist/excalidraw-assets/i18n-sv-SE-json-4b274bae10479b585716.js +0 -1
- package/dist/excalidraw-assets/i18n-ta-IN-json-f20bc85c68e334566d53.js +0 -1
- package/dist/excalidraw-assets/i18n-tr-TR-json-17f1500f11b6e08b677b.js +0 -1
- package/dist/excalidraw-assets/i18n-uk-UA-json-4798e5a14cecdddbfb50.js +0 -1
- package/dist/excalidraw-assets/i18n-zh-CN-json-a13fbd80677ff3f0122c.js +0 -1
- package/dist/excalidraw-assets/i18n-zh-HK-json-f82802143c7042511410.js +0 -1
- package/dist/excalidraw-assets/i18n-zh-TW-json-79c634b00f4602a2d9a6.js +0 -1
- package/dist/excalidraw-assets/image-87e58979d258cd38208c.js +0 -1
- package/dist/excalidraw-assets/vendor-8698157b56eb5e0ee549.js +0 -2
- package/dist/excalidraw-assets/vendor-8698157b56eb5e0ee549.js.LICENSE.txt +0 -12
- package/dist/excalidraw-assets-dev/Cascadia.woff2 +0 -0
- package/dist/excalidraw-assets-dev/Virgil.woff2 +0 -0
- package/dist/excalidraw-assets-dev/i18n-ar-SA-json-6681743eb68e3b3041cb.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-bg-BG-json-c907a37ea9ff74c38200.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-bn-BD-json-b02ff15ce32c21861fb1.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ca-ES-json-f9ecdae168e193e1819d.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-cs-CZ-json-b0c7af8af120bd1ba4ac.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-da-DK-json-bdae60049eb02dee741f.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-de-DE-json-0314c69da1a79cb476ef.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-el-GR-json-db678ec2c7b5ee5b6197.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-es-ES-json-f960cfc72c2bce33bcd9.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-fa-IR-json-3091ac88e5a7ad285607.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-fi-FI-json-b3a67612e607442c8940.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-fr-FR-json-628bf75e5684419e4522.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-he-IL-json-9fa5f88c445c6edfb81d.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-hi-IN-json-a398aa828f8d1bd25761.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-hu-HU-json-8fb512cf21c00656b011.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-id-ID-json-d18bde26a8a7165a4c7b.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-it-IT-json-612f895e69a992314230.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ja-JP-json-8fb6a4429e8c4a09e6a0.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-kab-KAB-json-01a8363dae577ccfd06c.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-kk-KZ-json-d0fff58ffff7c34c30a2.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ko-KR-json-d24a9b7640741fe02d9a.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-lv-LV-json-d9b01c32504b031e4160.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-my-MM-json-98a11afd5a8088489b91.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-nb-NO-json-de73a55ddde48cdff43c.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-nl-NL-json-88ff95be82b97ffcc7f1.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-nn-NO-json-8f60e0ec70a2e17ad33c.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-oc-FR-json-6a0ee550cb6fb3f1b259.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-pa-IN-json-9bde99f7eb773f876f85.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-pl-PL-json-bb2ca88481a524fc7a5f.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-pt-BR-json-b40463ff0ba1a0307563.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-pt-PT-json-cb72d009cf6ba3b55e0c.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ro-RO-json-b516bae00ed365b97098.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ru-RU-json-328be001476f936e0f00.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-si-LK-json-4be44d4d292b6dbf260e.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-sk-SK-json-2c5b8dc8f0812e1152f1.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-sv-SE-json-d96e772ca45119bbb532.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-ta-IN-json-9ba773bdb3a546e68ec3.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-tr-TR-json-d0b9b5ae9d184cffc8a2.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-uk-UA-json-deae797b510faf78ab8e.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-zh-CN-json-f972d84c7b7156249d21.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-zh-HK-json-239376fabfdff19a7ebd.js +0 -22
- package/dist/excalidraw-assets-dev/i18n-zh-TW-json-7ea4288fed6cce43f00c.js +0 -22
- package/dist/excalidraw-assets-dev/image-e50a452aa26d28419e39.js +0 -42
- package/dist/excalidraw-assets-dev/vendor-1bc8ceaafd8623c96dd4.js +0 -278
package/README.md
CHANGED
|
@@ -347,6 +347,31 @@ To view the full example visit :point_down:
|
|
|
347
347
|
|
|
348
348
|
</details>
|
|
349
349
|
|
|
350
|
+
### Customizing styles
|
|
351
|
+
|
|
352
|
+
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.
|
|
353
|
+
|
|
354
|
+
Make sure the selector has higher specificity, e.g. by prefixing it with your app's selector:
|
|
355
|
+
|
|
356
|
+
```css
|
|
357
|
+
.your-app .excalidraw {
|
|
358
|
+
--color-primary: red;
|
|
359
|
+
}
|
|
360
|
+
.your-app .excalidraw.theme--dark {
|
|
361
|
+
--color-primary: pink;
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Most notably, you can customize the primary colors, by overriding these variables:
|
|
366
|
+
|
|
367
|
+
- `--color-primary`
|
|
368
|
+
- `--color-primary-darker`
|
|
369
|
+
- `--color-primary-darkest`
|
|
370
|
+
- `--color-primary-light`
|
|
371
|
+
- `--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.
|
|
372
|
+
|
|
373
|
+
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.
|
|
374
|
+
|
|
350
375
|
### Props
|
|
351
376
|
|
|
352
377
|
| Name | Type | Default | Description |
|
|
@@ -365,14 +390,16 @@ To view the full example visit :point_down:
|
|
|
365
390
|
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
|
|
366
391
|
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
|
|
367
392
|
| [`libraryReturnUrl`](#libraryReturnUrl) | string | | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to |
|
|
368
|
-
| [`theme`](#theme) |
|
|
393
|
+
| [`theme`](#theme) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | [THEME.LIGHT](#THEME-1) | The theme of the Excalidraw component |
|
|
369
394
|
| [`name`](#name) | string | | Name of the drawing |
|
|
370
395
|
| [`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) |
|
|
371
|
-
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#
|
|
396
|
+
| [`onPaste`](#onPaste) | <pre>(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent | null) => boolean</pre> | | Callback to be triggered if passed when the something is pasted in to the scene |
|
|
372
397
|
| [`detectScroll`](#detectScroll) | boolean | true | Indicates whether to update the offsets when nearest ancestor is scrolled. |
|
|
373
398
|
| [`handleKeyboardGlobally`](#handleKeyboardGlobally) | boolean | false | Indicates whether to bind the keyboard events to document. |
|
|
374
399
|
| [`onLibraryChange`](#onLibraryChange) | <pre>(items: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L200">LibraryItems</a>) => void | Promise<any> </pre> | | The callback if supplied is triggered when the library is updated and receives the library items. |
|
|
375
400
|
| [`autoFocus`](#autoFocus) | boolean | false | Implies whether to focus the Excalidraw component on page load |
|
|
401
|
+
| [`generateIdForFile`](#generateIdForFile) | `(file: File) => string | Promise<string>` | Allows you to override `id` generation for files added on canvas |
|
|
402
|
+
| [`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 |
|
|
376
403
|
|
|
377
404
|
### Dimensions of Excalidraw
|
|
378
405
|
|
|
@@ -383,12 +410,14 @@ Excalidraw takes `100%` of `width` and `height` of the containing block so make
|
|
|
383
410
|
Every time component updates, this callback if passed will get triggered and has the below signature.
|
|
384
411
|
|
|
385
412
|
```js
|
|
386
|
-
(excalidrawElements, appState) => void;
|
|
413
|
+
(excalidrawElements, appState, files) => void;
|
|
387
414
|
```
|
|
388
415
|
|
|
389
416
|
1.`excalidrawElements`: Array of [excalidrawElements](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) in the scene.
|
|
390
417
|
|
|
391
|
-
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene
|
|
418
|
+
2.`appState`: [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) of the scene.
|
|
419
|
+
|
|
420
|
+
3. `files`: The [`BinaryFiles`]([BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) which are added to the scene.
|
|
392
421
|
|
|
393
422
|
Here you can try saving the data to your backend or local storage for example.
|
|
394
423
|
|
|
@@ -402,6 +431,7 @@ This helps to load Excalidraw with `initialData`. It must be an object or a [pro
|
|
|
402
431
|
| `appState` | [AppState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42) | The App state with which Excalidraw should be mounted. |
|
|
403
432
|
| `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 |
|
|
404
433
|
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L151) | This library items with which Excalidraw should be mounted. |
|
|
434
|
+
| `files` | [BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64) | The files added to the scene. |
|
|
405
435
|
|
|
406
436
|
```json
|
|
407
437
|
{
|
|
@@ -442,17 +472,20 @@ You can pass a `ref` when you want to access some excalidraw APIs. We expose the
|
|
|
442
472
|
| --- | --- | --- |
|
|
443
473
|
| ready | `boolean` | This is set to true once Excalidraw is rendered |
|
|
444
474
|
| 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) |
|
|
445
|
-
| [updateScene](#updateScene) | <pre>(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>)
|
|
475
|
+
| [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 |
|
|
476
|
+
| [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 |
|
|
446
477
|
| resetScene | `({ resetLoadingState: boolean }) => void` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. |
|
|
447
478
|
| 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 |
|
|
448
479
|
| 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 |
|
|
449
480
|
| getAppState | <pre> () => <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a></pre> | Returns current appState |
|
|
450
481
|
| history | `{ clear: () => void }` | This is the history API. `history.clear()` will clear the history |
|
|
451
482
|
| scrollToContent | <pre> (target?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a> | <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>[]) => void </pre> | Scroll the nearest element out of the elements supplied to the center. Defaults to the elements on the scene. |
|
|
483
|
+
| zoomToFit | `(target?:ExcalidrawElement[], maxZoom:number=1, margin:number=0.03) => void` | Zoom to fit elements on viewport. If no elements are supplied, the function will zoom to fit all elements. `maxZoom` is the maximum zoom level allowed (default 100%). `margin` is understood in % of viewport width and height. Default value is a minimum of 1.5% margin around the image compared to viewport . |
|
|
452
484
|
| refresh | `() => void` | Updates the offsets for the Excalidraw component so that the coordinates are computed correctly (for example the cursor position). You don't have to call this when the position is changed on page scroll or when the excalidraw container resizes (we handle that ourselves). For any other cases if the position of excalidraw is updated (example due to scroll on parent container and not page scroll) you should call this API. |
|
|
453
485
|
| [importLibrary](#importlibrary) | `(url: string, token?: string) => void` | Imports library from given URL |
|
|
454
486
|
| setToastMessage | `(message: string) => void` | This API can be used to show the toast with custom message. |
|
|
455
487
|
| [id](#id) | string | Unique ID for the excalidraw component. |
|
|
488
|
+
| [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. |
|
|
456
489
|
|
|
457
490
|
#### `readyPromise`
|
|
458
491
|
|
|
@@ -465,7 +498,7 @@ Since plain object is passed as a `ref`, the `readyPromise` is resolved as soon
|
|
|
465
498
|
### `updateScene`
|
|
466
499
|
|
|
467
500
|
<pre>
|
|
468
|
-
(<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>)
|
|
501
|
+
(scene: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L207">sceneData</a>) => void
|
|
469
502
|
</pre>
|
|
470
503
|
|
|
471
504
|
You can use this function to update the scene with the sceneData. It accepts the below attributes.
|
|
@@ -476,6 +509,13 @@ You can use this function to update the scene with the sceneData. It accepts the
|
|
|
476
509
|
| `appState` | [`ImportedDataState["appState"]`](https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L18) | The `appState` to be updated in the scene. |
|
|
477
510
|
| `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. |
|
|
478
511
|
| `commitToHistory` | `boolean` | Implies if the `history (undo/redo)` should be recorded. Defaults to `false`. |
|
|
512
|
+
| `libraryItems` | [LibraryItems](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L258) | The `libraryItems` to be update in the scene. |
|
|
513
|
+
|
|
514
|
+
### `addFiles`
|
|
515
|
+
|
|
516
|
+
<pre>(files: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts">BinaryFileData</a>) => void </pre>
|
|
517
|
+
|
|
518
|
+
Adds supplied files data to the `appState.files` cache on top of existing files present in the cache.
|
|
479
519
|
|
|
480
520
|
#### `onCollabButtonClick`
|
|
481
521
|
|
|
@@ -558,7 +598,7 @@ If supplied, this URL will be used when user tries to install a library from [li
|
|
|
558
598
|
|
|
559
599
|
#### `theme`
|
|
560
600
|
|
|
561
|
-
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.
|
|
601
|
+
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.
|
|
562
602
|
|
|
563
603
|
#### `name`
|
|
564
604
|
|
|
@@ -599,18 +639,14 @@ The below attributes can be set in `UIOptions.canvasActions.export` to customize
|
|
|
599
639
|
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.
|
|
600
640
|
|
|
601
641
|
<pre>
|
|
602
|
-
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#
|
|
642
|
+
(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/clipboard.ts#L21">ClipboardData</a>, event: ClipboardEvent | null) => boolean
|
|
603
643
|
</pre>
|
|
604
644
|
|
|
605
645
|
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.
|
|
606
646
|
|
|
607
647
|
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).
|
|
608
648
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
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).
|
|
612
|
-
|
|
613
|
-
### importLibrary
|
|
649
|
+
#### `importLibrary`
|
|
614
650
|
|
|
615
651
|
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/)).
|
|
616
652
|
|
|
@@ -632,17 +668,17 @@ useEffect(() => {
|
|
|
632
668
|
|
|
633
669
|
Try out the [Demo](#Demo) to see it in action.
|
|
634
670
|
|
|
635
|
-
|
|
671
|
+
#### `detectScroll`
|
|
636
672
|
|
|
637
673
|
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).
|
|
638
674
|
|
|
639
|
-
|
|
675
|
+
#### `handleKeyboardGlobally`
|
|
640
676
|
|
|
641
677
|
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.
|
|
642
678
|
|
|
643
679
|
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).
|
|
644
680
|
|
|
645
|
-
|
|
681
|
+
#### `onLibraryChange`
|
|
646
682
|
|
|
647
683
|
Ths callback if supplied will get triggered when the library is updated and has the below signature.
|
|
648
684
|
|
|
@@ -652,58 +688,58 @@ Ths callback if supplied will get triggered when the library is updated and has
|
|
|
652
688
|
|
|
653
689
|
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.
|
|
654
690
|
|
|
655
|
-
|
|
691
|
+
#### `id`
|
|
656
692
|
|
|
657
693
|
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).
|
|
658
694
|
|
|
659
|
-
|
|
695
|
+
#### `autoFocus`
|
|
660
696
|
|
|
661
697
|
This prop implies whether to focus the Excalidraw component on page load. Defaults to false.
|
|
662
698
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
#### `getSceneVersion`
|
|
666
|
-
|
|
667
|
-
**How to use**
|
|
668
|
-
|
|
669
|
-
<pre>
|
|
670
|
-
import { getSceneVersion } from "@excalidraw/excalidraw";
|
|
671
|
-
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
|
|
672
|
-
</pre>
|
|
673
|
-
|
|
674
|
-
This function returns the current scene version.
|
|
675
|
-
|
|
676
|
-
#### `isInvisiblySmallElement`
|
|
699
|
+
#### `generateIdForFile`
|
|
677
700
|
|
|
678
|
-
|
|
701
|
+
Allows you to override `id` generation for files added on canvas (images). By default, an SHA-1 digest of the file is used.
|
|
679
702
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
</pre>
|
|
683
|
-
|
|
684
|
-
**How to use**
|
|
685
|
-
|
|
686
|
-
```js
|
|
687
|
-
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
|
|
703
|
+
```
|
|
704
|
+
(file: File) => string | Promise<string>
|
|
688
705
|
```
|
|
689
706
|
|
|
690
|
-
|
|
707
|
+
#### `onLinkOpen`
|
|
691
708
|
|
|
692
|
-
|
|
709
|
+
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()`.
|
|
693
710
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
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>}
|
|
698
|
-
</pre>
|
|
699
|
-
|
|
700
|
-
**How to use**
|
|
711
|
+
```
|
|
712
|
+
(element: ExcalidrawElement, event: CustomEvent<{ nativeEvent: MouseEvent }>) => void
|
|
713
|
+
```
|
|
701
714
|
|
|
702
|
-
|
|
703
|
-
|
|
715
|
+
Example:
|
|
716
|
+
|
|
717
|
+
```ts
|
|
718
|
+
const history = useHistory();
|
|
719
|
+
|
|
720
|
+
// open internal links using the app's router, but opens external links in
|
|
721
|
+
// a new tab/window
|
|
722
|
+
const onLinkOpen: ExcalidrawProps["onLinkOpen"] = useCallback(
|
|
723
|
+
(element, event) => {
|
|
724
|
+
const link = element.link;
|
|
725
|
+
const { nativeEvent } = event.detail;
|
|
726
|
+
const isNewTab = nativeEvent.ctrlKey || nativeEvent.metaKey;
|
|
727
|
+
const isNewWindow = nativeEvent.shiftKey;
|
|
728
|
+
const isInternalLink =
|
|
729
|
+
link.startsWith("/") || link.includes(window.location.origin);
|
|
730
|
+
if (isInternalLink && !isNewTab && !isNewWindow) {
|
|
731
|
+
history.push(link.replace(window.location.origin, ""));
|
|
732
|
+
// signal that we're handling the redirect ourselves
|
|
733
|
+
event.preventDefault();
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
[history],
|
|
737
|
+
);
|
|
704
738
|
```
|
|
705
739
|
|
|
706
|
-
|
|
740
|
+
### Does it support collaboration ?
|
|
741
|
+
|
|
742
|
+
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).
|
|
707
743
|
|
|
708
744
|
### Restore utilities
|
|
709
745
|
|
|
@@ -761,19 +797,6 @@ import { restore } from "@excalidraw/excalidraw";
|
|
|
761
797
|
|
|
762
798
|
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).
|
|
763
799
|
|
|
764
|
-
#### `serializeAsJSON`
|
|
765
|
-
|
|
766
|
-
**_Signature_**
|
|
767
|
-
|
|
768
|
-
<pre>
|
|
769
|
-
serializeAsJSON({
|
|
770
|
-
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>,
|
|
771
|
-
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
|
|
772
|
-
}): string
|
|
773
|
-
</pre>
|
|
774
|
-
|
|
775
|
-
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).
|
|
776
|
-
|
|
777
800
|
### Export utilities
|
|
778
801
|
|
|
779
802
|
#### `exportToCanvas`
|
|
@@ -785,14 +808,17 @@ Takes the scene elements and state and returns a JSON string. Deleted `elements`
|
|
|
785
808
|
elements,
|
|
786
809
|
appState
|
|
787
810
|
getDimensions,
|
|
788
|
-
|
|
811
|
+
files
|
|
812
|
+
}: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/packages/utils.ts#L12">ExportOpts</a>
|
|
789
813
|
</pre>
|
|
790
814
|
|
|
791
815
|
| Name | Type | Default | Description |
|
|
792
816
|
| --- | --- | --- | --- |
|
|
793
817
|
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types) | | The elements to be exported to canvas |
|
|
794
818
|
| 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 |
|
|
795
|
-
| getDimensions | `(width: number, height: number) => {width: number, height: number, scale
|
|
819
|
+
| 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. |
|
|
820
|
+
| maxWidthOrHeight | `number` | undefined | The maximum width or height of the exported image. If provided, `getDimensions` is ignored. |
|
|
821
|
+
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
|
|
796
822
|
|
|
797
823
|
**How to use**
|
|
798
824
|
|
|
@@ -828,8 +854,6 @@ import { exportToBlob } from "@excalidraw/excalidraw";
|
|
|
828
854
|
|
|
829
855
|
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).
|
|
830
856
|
|
|
831
|
-
Note: `appState.exportBackground` is always set to `true` if exporting to `image/jpeg` to ensure the alpha channel isn't compressed to black.
|
|
832
|
-
|
|
833
857
|
#### `exportToSvg`
|
|
834
858
|
|
|
835
859
|
**_Signature_**
|
|
@@ -840,6 +864,7 @@ exportToSvg({
|
|
|
840
864
|
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
|
|
841
865
|
exportPadding?: number,
|
|
842
866
|
metadata?: string,
|
|
867
|
+
files?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64">BinaryFiles</a>
|
|
843
868
|
})
|
|
844
869
|
</pre>
|
|
845
870
|
|
|
@@ -848,6 +873,7 @@ exportToSvg({
|
|
|
848
873
|
| elements | [Excalidraw Element []](https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78) | | The elements to exported as svg |
|
|
849
874
|
| 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 |
|
|
850
875
|
| exportPadding | number | 10 | The padding to be added on canvas |
|
|
876
|
+
| files | [BinaryFiles](The [`BinaryFiles`](<[BinaryFiles](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L64)>) | undefined | The files added to the scene. |
|
|
851
877
|
|
|
852
878
|
This function returns a promise which resolves to svg of the exported drawing.
|
|
853
879
|
|
|
@@ -860,25 +886,49 @@ This function returns a promise which resolves to svg of the exported drawing.
|
|
|
860
886
|
| exportWithDarkMode | boolean | false | Indicates whether to export with dark mode |
|
|
861
887
|
| exportEmbedScene | boolean | false | Indicates whether scene data should be embedded in svg. This will increase the svg size. |
|
|
862
888
|
|
|
863
|
-
###
|
|
889
|
+
### Extra API's
|
|
890
|
+
|
|
891
|
+
#### `serializeAsJSON`
|
|
892
|
+
|
|
893
|
+
**_Signature_**
|
|
894
|
+
|
|
895
|
+
<pre>
|
|
896
|
+
serializeAsJSON({
|
|
897
|
+
elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>,
|
|
898
|
+
appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L42">AppState</a>,
|
|
899
|
+
}): string
|
|
900
|
+
</pre>
|
|
901
|
+
|
|
902
|
+
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).
|
|
903
|
+
|
|
904
|
+
#### `getSceneVersion`
|
|
864
905
|
|
|
865
906
|
**How to use**
|
|
866
907
|
|
|
867
|
-
|
|
868
|
-
import {
|
|
869
|
-
|
|
908
|
+
<pre>
|
|
909
|
+
import { getSceneVersion } from "@excalidraw/excalidraw";
|
|
910
|
+
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
|
|
911
|
+
</pre>
|
|
870
912
|
|
|
871
|
-
|
|
913
|
+
This function returns the current scene version.
|
|
872
914
|
|
|
873
|
-
|
|
874
|
-
| ----------- | -------------------- |
|
|
875
|
-
| Virgil | The handwritten font |
|
|
876
|
-
| Helvetica | The Normal Font |
|
|
877
|
-
| Cascadia | The Code Font |
|
|
915
|
+
#### `isInvisiblySmallElement`
|
|
878
916
|
|
|
879
|
-
|
|
917
|
+
**_Signature_**
|
|
880
918
|
|
|
881
|
-
|
|
919
|
+
<pre>
|
|
920
|
+
isInvisiblySmallElement(element: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>): boolean
|
|
921
|
+
</pre>
|
|
922
|
+
|
|
923
|
+
**How to use**
|
|
924
|
+
|
|
925
|
+
```js
|
|
926
|
+
import { isInvisiblySmallElement } from "@excalidraw/excalidraw";
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
Returns `true` if element is invisibly small (e.g. width & height are zero).
|
|
930
|
+
|
|
931
|
+
#### `loadLibraryFromBlob`
|
|
882
932
|
|
|
883
933
|
```js
|
|
884
934
|
import { loadLibraryFromBlob } from "@excalidraw/excalidraw";
|
|
@@ -892,7 +942,7 @@ loadLibraryFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/
|
|
|
892
942
|
|
|
893
943
|
This function loads the library from the blob.
|
|
894
944
|
|
|
895
|
-
|
|
945
|
+
#### `loadFromBlob`
|
|
896
946
|
|
|
897
947
|
**How to use**
|
|
898
948
|
|
|
@@ -908,7 +958,7 @@ loadFromBlob(blob: <a href="https://developer.mozilla.org/en-US/docs/Web/API/Blo
|
|
|
908
958
|
|
|
909
959
|
This function loads the scene data from the blob. If you pass `localAppState`, `localAppState` value will be preferred over the `appState` derived from `blob`
|
|
910
960
|
|
|
911
|
-
|
|
961
|
+
#### `getFreeDrawSvgPath`
|
|
912
962
|
|
|
913
963
|
**How to use**
|
|
914
964
|
|
|
@@ -924,6 +974,103 @@ getFreeDrawSvgPath(element: <a href="https://github.com/excalidraw/excalidraw/bl
|
|
|
924
974
|
|
|
925
975
|
This function returns the free draw svg path for the element.
|
|
926
976
|
|
|
977
|
+
#### `isLinearElement`
|
|
978
|
+
|
|
979
|
+
**How to use**
|
|
980
|
+
|
|
981
|
+
```js
|
|
982
|
+
import { isLinearElement } from "@excalidraw/excalidraw";
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
**Signature**
|
|
986
|
+
|
|
987
|
+
<pre>
|
|
988
|
+
isLinearElement(elementType?: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L80">ExcalidrawElement</a>): boolean
|
|
989
|
+
</pre>
|
|
990
|
+
|
|
991
|
+
This function returns true if the element is linear type (`arrow` |`line`) else returns false.
|
|
992
|
+
|
|
993
|
+
#### `getNonDeletedElements`
|
|
994
|
+
|
|
995
|
+
**How to use**
|
|
996
|
+
|
|
997
|
+
```js
|
|
998
|
+
import { getNonDeletedElements } from "@excalidraw/excalidraw";
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
**Signature**
|
|
1002
|
+
|
|
1003
|
+
<pre>
|
|
1004
|
+
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>
|
|
1005
|
+
</pre>
|
|
1006
|
+
|
|
1007
|
+
This function returns an array of deleted elements.
|
|
1008
|
+
|
|
1009
|
+
### Exported constants
|
|
1010
|
+
|
|
1011
|
+
#### `FONT_FAMILY`
|
|
1012
|
+
|
|
1013
|
+
**How to use**
|
|
1014
|
+
|
|
1015
|
+
```js
|
|
1016
|
+
import { FONT_FAMILY } from "@excalidraw/excalidraw";
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
`FONT_FAMILY` contains all the font families used in `Excalidraw` as explained below
|
|
1020
|
+
|
|
1021
|
+
| Font Family | Description |
|
|
1022
|
+
| ----------- | -------------------- |
|
|
1023
|
+
| Virgil | The handwritten font |
|
|
1024
|
+
| Helvetica | The Normal Font |
|
|
1025
|
+
| Cascadia | The Code Font |
|
|
1026
|
+
|
|
1027
|
+
Defaults to `FONT_FAMILY.Virgil` unless passed in `initialData.appState.currentItemFontFamily`.
|
|
1028
|
+
|
|
1029
|
+
#### `THEME`
|
|
1030
|
+
|
|
1031
|
+
**How to use**
|
|
1032
|
+
|
|
1033
|
+
```js
|
|
1034
|
+
import { THEME } from "@excalidraw/excalidraw";
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
`THEME` contains all the themes supported by `Excalidraw` as explained below
|
|
1038
|
+
|
|
1039
|
+
| Theme | Description |
|
|
1040
|
+
| ----- | --------------- |
|
|
1041
|
+
| LIGHT | The light theme |
|
|
1042
|
+
| DARK | The Dark theme |
|
|
1043
|
+
|
|
1044
|
+
Defaults to `THEME.LIGHT` unless passed in `initialData.appState.theme`
|
|
1045
|
+
|
|
927
1046
|
## Need help?
|
|
928
1047
|
|
|
929
1048
|
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).
|
|
1049
|
+
|
|
1050
|
+
### Development
|
|
1051
|
+
|
|
1052
|
+
#### Install the dependencies
|
|
1053
|
+
|
|
1054
|
+
```bash
|
|
1055
|
+
yarn
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
#### Start the server
|
|
1059
|
+
|
|
1060
|
+
```bash
|
|
1061
|
+
yarn start
|
|
1062
|
+
```
|
|
1063
|
+
|
|
1064
|
+
[http://localhost:3001](http://localhost:3001) will open in your default browser.
|
|
1065
|
+
|
|
1066
|
+
The example is same as the [codesandbox example](https://ehlz3.csb.app/)
|
|
1067
|
+
|
|
1068
|
+
#### Create a test release
|
|
1069
|
+
|
|
1070
|
+
You can create a test release by posting the below comment in your pull request
|
|
1071
|
+
|
|
1072
|
+
```
|
|
1073
|
+
@excalibot release package
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
Once the version is released `@excalibot` will post a comment with the release version.
|