Compare commits

...
Author SHA1 Message Date
zsviczian 9ef7f61e86 added keyamap.popScope back, because of regression where floating modal took over keystrokes like cmd+p when keycapture is disabled. 2026-03-15 11:05:34 +01:00
zsviczian 68d7aff4ee Merge pull request #2706 from heinrich26/fix-latex-modal
Fix the floating LaTeX-Modal
2026-03-15 08:46:47 +01:00
zsviczian 9a8011ea1e updated messages 2026-03-15 08:44:30 +01:00
zsviczian 945d645c6b fixed mindmap builder icon in index-new.tsx 2026-03-15 08:32:03 +01:00
zsviczian 8d50e0e5f7 Merge pull request #2703 from heinrich26/cleanup-icons
Cleanup icons (remove lucide-react)
2026-03-15 08:24:19 +01:00
zsviczian b030fb6b6c updated paste image, paste element 2026-03-15 07:39:22 +01:00
zsviczian 7f666364ee Paste image or Excaldiraw element to mindmap 2026-03-14 23:32:01 +01:00
zsviczian 64f93e16b8 fixed tab not working after terminating tag search in inline suggester 2026-03-14 23:22:14 +01:00
zsviczian 3e965a3ac3 0.18.0-83 2026-03-12 22:49:04 +01:00
henrich26 755618eefe Cleanup icons (remove lucide-react)
* `lucide` icons are now exclusively loaded through Obsidian (see `actionIcons#getIconAsJSX`)
* the `lucide-react` package is now obsolete and has been removed.
* many hardcoded icons have been replaced by their `lucide` counterpart.
* added a style to ensure the correct icon-color for icons generated by Obsidian
* replaced many script icons, as most of them had bad stroke-widths and suitable `lucide`-icons were available anyway.
* notably: the insert-latex icon has changed (it now reflects the one used by Obsidian), it also needs to change on the `excalidraw` package, will open a PR tomorrow.

unrelated but couldn't be bothered to open a seperate PR for this:
* fixed the styling of the `.embeddable-menu` (had the same `z-index` as dropdowns etc., making them overlap)
* added a transition to the `.embeddable-menu` because _why not_ :)
2026-03-12 18:28:22 +01:00
zsviczian de4cd361a8 inline link suggester #^frame= trigger support 2026-03-11 20:59:40 +01:00
zsviczian 521ca1aa5e API change 0.18.0-82 2026-03-11 20:25:50 +01:00
Hendrik Horstmann 5da6505c95 Fix the floating LaTeX-Modal
* `FloatingModal` now respects `enableKeyCapture()` or rather `disableKeyCapture`, so that if `false`, the modal closes upon clicks outside its bounds (instead of propagating that event). (Instead of hiding the modal background using styles, we use the builtin methods from Obsidian to disable the `dim`)
* removed unnecessary poping of the superclasses keybind-scope, that only has _ESC to close_ which we previously implemented by hand.
* the FloatingModal can no longer be dragged outside the windows bounds.
* added method `FloatingModal#shouldNotStartDrag` to allow custom blocking of the drag-motion.
* cleaned up the code of `FloatingModal` by removing unnecessary assignments, try-catch blocks etc.
* styled the input of the LaTeX Modal like any other Obsidian Modal.
* disabled dragging for the `EditorView`, making it easier to select text and use the inputs drag-and-drop functionality
* centered the Latex Suite popup around the input and added anchor-positioning (with fallback), to allow a popup wider than the Modal (which previously would have clipped).
2026-03-11 18:06:09 +01:00
zsviczian b786f25745 isBindingEnabled, width fix for SVGImage in MarkdownPostProcessor 2026-03-10 21:09:21 +01:00
zsviczian b3957cc6f8 update split text by line (added await) 2026-03-09 18:23:57 +01:00
zsviczian 25b657138c bypass submap autolayout based on node settings v26.03.08 2026-03-08 14:26:22 +01:00
zsviczian c9c86382a9 text wrapping in "boxed" nodes, detecting disableAutolayout correctly 2026-03-08 12:56:56 +01:00
zsviczian b4925c096d Merge pull request #2683 from playermiller109/2026-03-01
i18n(MindmapBuilder): Revise zh to 91b4f4f
2026-03-08 11:06:02 +01:00
zsviczian 83c8a86de7 sidepanel close button styling 2026-03-08 11:05:15 +01:00
zsviczian 71ca343495 fix copyMapAsText reading originalText instead of rawText 2026-03-08 11:04:54 +01:00
zsviczian 2f22f2312b diveder line and task handling in copy/paste markdown 2026-03-08 10:50:06 +01:00
zsviczian 9a12684009 Merge pull request #2684 from TravisLEBLANC1/floatinglatex
make the latexprompt floating
2026-03-08 09:25:31 +01:00
zsviczian b7b93f780b MindMap Builder Tasks 2026-03-07 07:15:38 +01:00
zsviczian 48d6d3c725 export submap 2026-03-06 20:57:59 +01:00
zsviczian b8300221b5 font size logic when promoting / demoting nodes to/from subtrees 2026-03-04 22:04:29 +01:00
TravisLeblanc1 3463310601 make the latexprompt floating 2026-03-03 09:32:41 +01:00
playermiller109 1c420b3007 i18n(MindmapBuilder): Revise zh to 91b4f4f 2026-03-02 00:17:14 +08:00
zsviczian ca37450eb2 2.20.6, 0.18.0-81 2026-03-01 15:59:05 +01:00
zsviczian 1a32fc9c55 added setInputFieldDockStatus to api 2026-03-01 07:39:28 +01:00
zsviczian 91b4f4fc86 LayoutConfigModal changes. Added vertical layout parameters 2026-02-28 23:24:30 +01:00
zsviczian dafaa4be07 update API documentation 2026-02-28 21:13:51 +01:00
zsviczian d82d0d3364 more compact vertical layout 2026-02-28 20:12:49 +01:00
zsviczian dd8507daa2 Mindmap Builder API 0.1 2026-02-28 17:08:58 +01:00
zsviczian 2faf93c613 update boundary on LayoutConfigModal change 2026-02-28 13:45:38 +01:00
zsviczian 15637db7ab support submap roots 2026-02-28 13:33:21 +01:00
zsviczian 8b137fceb1 boundary on-off button 2026-02-28 11:38:55 +01:00
zsviczian 8de24b0f03 tighter boundary + layout setting 2026-02-28 11:22:55 +01:00
zsviczian fc0a143979 MindMap Builder move new strings to STRINGS 2026-02-28 10:45:19 +01:00
zsviczian 003983e7c7 store boundary color 2026-02-28 09:00:06 +01:00
zsviczian 03afc7513f up-down initial implementation 2026-02-28 08:46:54 +01:00
zsviczian 184bce0eb1 2.20.6-beta-1, 0.18.0-81 2026-02-27 18:12:03 +01:00
zsviczian e7844a03be updated mindmap builder.js (performance improvement) 2026-02-27 06:09:05 +01:00
zsviczian b2a97dc871 Merge pull request #2678 from rlan/feat/zh-tw/121c353
Update zh-tw.ts at 121c353
2026-02-25 19:52:33 +01:00
Rick Lan fbbd7f03e6 Update zh-tw.ts at 121c353 2026-02-24 08:00:37 -08:00
zsviczian 121c3538e4 2.20.5 2026-02-19 08:02:03 +01:00
zsviczian a42450bcd1 2.20.5-beta-3, 0.18.0-79 2026-02-18 20:55:22 +01:00
zsviczian 6c2e3f06a6 Merge pull request #2674 from playermiller109/2026-02-18
Update zh-cn.ts to 376738f
2026-02-18 19:21:21 +01:00
playermiller109 8db62c1a73 Update zh-cn.ts to 376738f 2026-02-18 13:05:10 +08:00
zsviczian 376738f894 2.20.5-beta-2, 0.18.0-78 2026-02-17 21:27:40 +01:00
zsviczian 6a69d61f2d 2.20.5-beta-1 2026-02-16 23:06:36 +01:00
zsviczian 2ddf503df8 update docs 2026-02-14 20:37:04 +01:00
zsviczian 6b55cc62b6 2.20.4, 0.18.0-77 2026-02-13 20:24:10 +01:00
zsviczian 5384105e63 2.20.4-beta-1, 0.18.0-76 2026-02-12 21:43:27 +01:00
zsviczian 37397933b2 Merge pull request #2668 from TravisLEBLANC1/latex-scaling2
add back latex scale on update
2026-02-12 21:37:06 +01:00
zsviczian 48fba1d64d fixed nativeSVG sizing in obsidian 1.12.1 2026-02-12 14:33:33 +00:00
TravisLeblanc1 eee1bec4a0 add back latex scale on update 2026-02-12 10:34:45 +01:00
zsviczian ee74a567a9 2.20.3, 0.18.0-75 2026-02-08 13:08:34 +01:00
zsviczian 45d46bdb5d Mindmap builder fixes 2026-02-07 16:58:07 +01:00
zsviczian 555046ad66 Merge pull request #2655 from superle3/feat/latex_editor_keymaps
feat: add default keymap to latex editor
2026-02-07 14:38:36 +01:00
zsviczian 90e15a1388 Merge branch 'master' of https://github.com/zsviczian/obsidian-excalidraw-plugin 2026-02-07 14:37:01 +01:00
zsviczian 059b072a2b fix main import 2026-02-07 14:36:16 +01:00
zsviczian d15e18f80c Merge pull request #2658 from Ev357/fix-build
fix: incorrect import
2026-02-07 14:35:12 +01:00
zsviczian 3a0c0a15ed addElementsToView awaits image load 2026-02-07 14:34:08 +01:00
zsviczian b465abe2f0 update stroke width and branch color when promoting / demoting 2026-02-07 12:09:38 +01:00
zsviczian a179968af4 performance optimization 2026-02-07 12:01:01 +01:00
Ev357 5cd50698fb fix: incorrect import 2026-02-07 10:59:44 +01:00
zsviczian 72206f33da optimized getDecorationAndCrossLinkIdsForBranches 2026-02-07 10:20:57 +01:00
zsviczian 8b8f5ac675 improved grouping 2026-02-07 10:07:57 +01:00
zsviczian b6d3a2b8ae LAYOUT settings update map when values are changed 2026-02-07 06:33:52 +01:00
zsviczian 4695c328a9 fixed saving layout settings 2026-02-07 05:57:30 +01:00
zsviczian f050dd5544 save LAYOUT_METADATA 2026-02-05 22:03:50 +01:00
zsviczian 26fdb744c4 autoLayoutDisabled typo 2026-02-05 21:47:14 +01:00
zsviczian 972193c236 fix deconstruct selected elements undefined check 2026-02-05 20:54:22 +01:00
superle3 efa7c93e18 feat: add default keymap to latex editor
Add default keymap of codemirror to the latex editor,
such that users can use familiar keybindings
and that deletion works properly for decorations/atomic ranges
and thus works for latex suite delayed concealment.
2026-02-05 18:16:18 +01:00
zsviczian b4226cbf78 commitEdit selective element updates 2026-02-04 22:59:40 +01:00
zsviczian 75538bb87d addElementsToView change 2026-02-04 22:42:10 +01:00
zsviczian 20e6d6da86 Merge pull request #2654 from rlan/feat/zh-tw/d9f65d00
Update zh-tw.ts at d9f65d00
2026-02-04 19:36:04 +01:00
Rick Lan a03e515ac8 Update zh-tw.ts at d9f65d00 2026-02-04 09:55:31 -08:00
zsviczian d9f65d00e8 Update styles.css 2026-02-04 13:08:18 +01:00
zsviczian 45fe0fec25 2.20.2, 0.18.0-74 2026-02-01 16:52:53 +01:00
zsviczian bb0f508e6e more robust value initialization 2026-02-01 11:18:37 +01:00
zsviczian 266e6f87c3 captureUpdte 2026-02-01 07:22:41 +01:00
zsviczian d04a6d4eae disableTabEvents 2026-01-31 22:11:09 +01:00
zsviczian 18d79c18f8 focusSelected, and zoomToFit should not activate input, if map is selected 2026-01-31 14:55:24 +01:00
zsviczian 7d22bc0970 focus inputEl, reveal sidepanel tab if not visible 2026-01-31 14:44:39 +01:00
zsviczian f5d125e21f llm doc update 2026-01-31 14:30:13 +01:00
zsviczian 92e3b44234 ontology errors 2026-01-31 14:29:55 +01:00
zsviczian 50306f5834 2.20.1, 0.18.0-73 2026-01-31 12:03:34 +01:00
zsviczian 077274f343 tab navigation on iPad, boundary z-index during paste 2026-01-31 08:07:11 +01:00
zsviczian a55e9c061f ontology hidden when not relevant 2026-01-31 07:17:49 +01:00
zsviczian e4db79addb ontology editing 2026-01-30 21:20:28 +01:00
zsviczian fe9bbbf5a8 stroke width scale 2026-01-30 18:10:18 +01:00
zsviczian 8e84be734d copy/paste mindmap branch ontology 2026-01-30 08:23:52 +00:00
zsviczian e23523c713 addUpdateArrowLabel 2026-01-30 07:38:53 +00:00
zsviczian 1969a45085 fixed fileExplorerObserver 2026-01-29 22:39:49 +01:00
zsviczian 61388ddd17 updated mindmap builder 2026-01-29 20:02:31 +01:00
zsviczian ebe9b6d357 ACTION_FOCUS, ACTION_ZOOM to select most recently active node and activate inputEl 2026-01-29 19:55:41 +01:00
zsviczian 16fbe0bff1 radial sweep, paste fix 2026-01-29 19:25:05 +01:00
zsviczian 105289a0cc fixed promote / demote, up/down 2026-01-29 18:07:17 +01:00
zsviczian 30abb1b7a7 2.2.20, 0.18.0-72 2026-01-27 20:48:39 +01:00
zsviczian 9c17d3f7a0 Merge pull request #2631 from playermiller109/2026-01-26
Update zh-cn.ts to e250835
2026-01-26 20:59:44 +01:00
playermiller109 8a74120640 Update zh-cn.ts to e250835 2026-01-26 09:37:19 +08:00
zsviczian e25083504b fix workspace freeze on load 2026-01-25 16:43:13 +01:00
zsviczian ff5780b703 shade master formatting 2026-01-25 15:51:08 +01:00
zsviczian 465b99edb8 reveal tab issue: restore tab no longer overrides new tab 2026-01-25 15:49:58 +01:00
zsviczian e977a3d9d3 2.20.0-beta-4, 0.18.0-71 2026-01-25 15:06:26 +01:00
zsviczian c3b0803676 fixed inverted color in export when export theme !== current view theme 2026-01-25 14:47:41 +01:00
zsviczian 1e696bdcc1 context menu to set image inversion 2026-01-25 13:30:30 +01:00
zsviczian 99cf5c26e2 PDF.js config fixes: wasmUrl, cMapUrl, standardFontDataUrl, iccUrl 2026-01-25 12:17:30 +01:00
zsviczian dd81b137e4 mixed pdf page dimensions #2578 2026-01-25 11:13:39 +01:00
zsviczian 82a41e7cc1 shade master migrated to sidepanel 2026-01-25 10:21:03 +01:00
zsviczian 5b7644e5a3 2.20.0-beta-3, 0.18.0-70 2026-01-24 20:38:29 +01:00
zsviczian bdd55aea2c Merge branch 'master' of https://github.com/zsviczian/obsidian-excalidraw-plugin 2026-01-24 18:35:18 +01:00
zsviczian b26cb5d067 mermaidToExcelidraw Type 2026-01-24 18:35:15 +01:00
zsviczian d2e1d72678 fix fold_all label 2026-01-24 08:06:17 +01:00
zsviczian 76e5d82c0f 2.20.0-beta-2 2026-01-23 20:28:07 +01:00
zsviczian 9391ba45a3 Merge pull request #2623 from playermiller109/2026-01-22
Update zh-cn.ts to cfa18cd
2026-01-23 20:09:15 +01:00
zsviczian e08db69c4c invert latex and SVG and ea.setTheme fixes 2026-01-23 19:31:56 +01:00
playermiller109 59d2650a99 Update zh-cn.ts to cfa18cd 2026-01-23 11:04:29 +08:00
playermiller109 fcecb19d11 feat(MindmapBuilder/i18n): Add translation 2026-01-23 11:04:12 +08:00
playermiller109 5cbe209666 fix(MindmapBuilder): Match the ACTION_FOLD_ALL tooltip 2026-01-23 09:02:12 +08:00
playermiller109 922aa5d17b fix(MindmapBuilder): Add the missing ACTION_REARRANGE key mapping 2026-01-23 09:02:12 +08:00
playermiller109 6206962185 fix(MindmapBuilder): Correct translation keys for Copy/Cut/Paste actions 2026-01-23 09:02:12 +08:00
playermiller109 0204a1d19c style(MindmapBuilder/i18n): Unify key-spacing 2026-01-23 09:02:12 +08:00
zsviczian cfa18cdd6d 2.20.0-beta-1, 0.18.0-69 2026-01-22 21:51:52 +01:00
zsviczian ab3bed01cd mindmap builder update 2026-01-22 20:58:30 +01:00
zsviczian 711142a899 save crosslink ontology to markdown, align text in containers during globalLayout 2026-01-22 19:21:16 +01:00
zsviczian cc5a3006c9 fixed mobile nav-bar and implemented new chat interface for TextToDiagram 2026-01-21 23:08:50 +01:00
zsviczian 03d3e25611 2.20.0 - draft recovered 2026-01-21 18:02:01 +01:00
zsviczian 478fca4306 2.19.2 2026-01-18 23:38:59 +01:00
zsviczian 0446b3dbed Added new mindmap builder video 2026-01-18 21:13:48 +01:00
zsviczian b0b2afb972 Merge pull request #2611 from zsviczian/mindmap-hotkeys
Mindmap hotkeys
2026-01-18 18:37:21 +01:00
zsviczian 5d5970c62d min plugin version 2026-01-18 17:50:49 +01:00
zsviczian 4bcb9be49d Fixed LayoutConfigModal and folding of groups 2026-01-18 17:47:49 +01:00
zsviczian 8d9546f4cd minor fixes 2026-01-18 16:47:51 +01:00
zsviczian 5257a0a73f fixed recursive ungrouping 2026-01-17 23:40:26 +01:00
zsviczian 955b0de308 generate library script 2026-01-17 23:28:02 +01:00
zsviczian e2739fe34c bugs 2026-01-17 23:22:43 +01:00
zsviczian 3ac427f813 fix addSibling, toggleBox 2026-01-17 20:29:48 +01:00
zsviczian 36044e41a1 fold indicator position 2026-01-17 17:57:32 +01:00
zsviczian 91156279c5 update sub-tree font size 2026-01-17 12:24:01 +01:00
zsviczian 1083c9fb10 subtreeheight to include boundary 2026-01-17 12:01:07 +01:00
zsviczian 1e40fe28db improved radial 2026-01-17 10:42:43 +01:00
zsviczian c3d8f8e5d5 side swap 2026-01-17 10:23:02 +01:00
zsviczian 49d657aad9 demote node 2026-01-17 10:04:46 +01:00
zsviczian d844daaaec Demote skeleton 2026-01-17 09:56:50 +01:00
zsviczian ecd24f57a6 promote/demote 2026-01-17 09:41:49 +01:00
zsviczian 30c901e6f3 parseImageInput file undefined 2026-01-16 13:55:34 +00:00
zsviczian 2d7873ad0d Add sibling, improve navigate children 2026-01-16 13:28:48 +00:00
zsviczian b1786a35e8 mindmap builder deploy script 2026-01-15 20:35:50 +01:00
zsviczian 7033020101 updated description 2026-01-15 20:22:47 +01:00
zsviczian 9853b6b0fc 2.19.1 2026-01-15 19:30:30 +01:00
zsviczian bfc4e4561a Merge pull request #2604 from TravisLEBLANC1/latex-scaling
latex scaling on update
2026-01-15 19:15:43 +01:00
zsviczian c557d1c0e8 workspace-drawer observer for Obsidian Mobile 2026-01-15 18:16:43 +01:00
zsviczian e912ab698b InlineLinkSuggester to support headings and block references 2026-01-15 17:39:43 +01:00
zsviczian 1657837830 validate imageInfo has value 2026-01-15 14:39:22 +00:00
TravisLeblanc1 20e305931b copy last modified latex's scaling
When creating a new latex, we copy the last
modified latex'scaling
2026-01-15 10:09:56 +01:00
TravisLeblanc1 33be7275b1 add scaleX/scaleY to ea.addLaTex 2026-01-15 10:09:15 +01:00
zsviczian 97f425b6de support for adding back of the node card to maps 2026-01-14 20:27:34 +01:00
zsviczian 46d69db8a6 updated MindMap Builder script .md 2026-01-14 19:20:33 +01:00
zsviczian 6326c62bcd fixed node.fontSize in toggleFoldIndicator 2026-01-14 19:18:37 +01:00
zsviczian f0e231a3e5 refactor triggerGlobalLayout 2026-01-14 18:36:36 +01:00
zsviczian 7b1d91ce0d touched 2026-01-14 14:14:38 +00:00
zsviczian b6fd3bd665 layout settings 2026-01-13 23:09:45 +01:00
zsviczian 7c24821011 fixed grouped root leads to blowup 2026-01-13 20:51:31 +01:00
zsviczian 9ae74c7af0 radialL1Distribution 2026-01-13 20:02:39 +01:00
zsviczian 14d5521483 refactor layoutL1nodes 2026-01-13 18:43:50 +01:00
zsviczian 6865fdf33c elliptical radial, drag and drop rearrange, removed dead code 2026-01-13 18:23:17 +01:00
zsviczian c573d2cba3 copy/paste crosslinks and boundaries 2026-01-12 22:36:14 +01:00
zsviczian 9186537a1a nodes in right-left in proper sequence 2026-01-12 20:18:45 +01:00
zsviczian d89a212c46 save settings to mindmap root, other miner fixes 2026-01-12 19:37:16 +01:00
zsviczian 6a1d773d87 unified updateRootNodeCustomData, added arrowType to customData on root, disabled editing of multi line roots. 2026-01-12 18:34:22 +01:00
zsviczian 4c23be299c fixed custom parent issues 2026-01-12 17:50:51 +01:00
TravisLeblanc1 4e9baf72ec rename "widthscale" for "scaleX" 2026-01-12 15:45:41 +01:00
zsviczian 1136f19bb6 to-do 2026-01-12 13:36:52 +00:00
zsviczian 230c0e9c4b import headings, add Embeddables, performAction 2026-01-12 13:33:09 +00:00
zsviczian a0e251af36 Merge pull request #2602 from rlan/feat/zh-tw/4ac8dcc
Update zh-tw.ts at 4ac8dcc
2026-01-12 07:41:30 +01:00
zsviczian dddd13e439 fixed handling frame, group ref embes, handling starting map from custom node, renamed manualMode to batch mode, exit key handler on escape if floating modal or input el is not active. Migrated most functions to getMindmapNodeFromSelection() from ea.getViewSelectedElement() 2026-01-11 22:08:24 +01:00
zsviczian 83337cbec7 fixed pinning boxed nodes 2026-01-11 19:47:55 +01:00
zsviczian 7c14328226 fixed navigation when boxed element 2026-01-11 17:05:28 +01:00
zsviczian dd579e8d52 fixed crosslink visibility when crosslink between decoration and node during folding / unfolding 2026-01-11 16:02:43 +01:00
zsviczian c5b34b0e50 default to Right-Left, select node if replace 2026-01-11 15:46:37 +01:00
zsviczian 6651db8c3a unified, updated comments 2026-01-11 15:10:20 +01:00
zsviczian 60a692ba7b decorations and cross links move when replacing text with imge node and vice versa 2026-01-11 14:52:05 +01:00
zsviczian a21481aae5 commitEdit handles node replacement 2026-01-11 13:59:16 +01:00
zsviczian e1ec75f7c7 extracted addImage to its own function, added leaf change to event remover 2026-01-11 13:11:54 +01:00
zsviczian b15a9cff91 folding to hide decorations and crosslinks, navigation on the left side should be reverse, always check for the existence of window.MindmapBuilder 2026-01-11 12:37:53 +01:00
TravisLeblanc1 375c29171c latex scaling on update
add current latex scaling in customData.latexscale
before updating it
2026-01-11 12:05:18 +01:00
zsviczian c7bbb0ca0f updateUI for foldAll 2026-01-11 11:49:00 +01:00
zsviczian 3dd3f6c5a3 Fold/Unfold all 2026-01-11 11:45:26 +01:00
zsviczian 3931fa95b8 batch paste and radial root arrows 2026-01-11 10:26:50 +01:00
zsviczian fc03c0bfd2 radial layout nodes are from the center 2026-01-11 10:01:05 +01:00
zsviczian 00ce6b1883 layout fixes 2026-01-11 09:39:51 +01:00
zsviczian a9a2c63873 left-right mode 2026-01-11 08:42:09 +01:00
zsviczian 4bd42bff9a deconstructed functions 2026-01-11 08:09:15 +01:00
zsviczian a2ae59965b reshuffled code 2026-01-11 07:24:07 +01:00
zsviczian 49d6e2180e paste message 2026-01-10 21:10:11 +01:00
zsviczian 75f69af2cd curved arrows 2026-01-10 20:48:09 +01:00
Rick Lan 0a5a7660fc Update zh-tw.ts 2026-01-10 10:43:20 -08:00
zsviczian f2eed2a755 reinstated fixed pinning 2026-01-10 19:07:07 +01:00
zsviczian 9b0c656e0b removed unused variables 2026-01-10 17:52:41 +01:00
zsviczian ada0caea1a fixed fold indicator positioning 2026-01-10 17:24:38 +01:00
zsviczian 37c1c2459f button row styling and inputEl focus 2026-01-10 15:50:21 +01:00
zsviczian 38ad0c9eed fixed node sort logic to use node position not nodeBox position 2026-01-10 13:19:00 +01:00
zsviczian dd37894ddd disable folding when no eligible nodes are available 2026-01-10 13:01:45 +01:00
zsviczian 54bb7558f7 improve group handling 2026-01-10 12:37:50 +01:00
zsviczian d698f2d3f7 reposition non-mindmap elements grouped with branches 2026-01-10 11:40:16 +01:00
zsviczian 135e634df3 transform non-mindmap arrow arrow during map rearrange 2026-01-10 11:01:32 +01:00
zsviczian bec690c792 Boundary layering 2026-01-10 10:46:57 +01:00
zsviczian d57d8ecc9d Added group, box, zoom, focus buttons to floating modal 2026-01-10 10:08:07 +01:00
zsviczian ab5d26078c Added unfolding extras to floating modal, removed focusInput from most actions 2026-01-10 09:35:39 +01:00
zsviczian 1b7f9c19de added isBoundary to boundary to help with updateUI 2026-01-10 09:07:40 +01:00
zsviczian 22324613f3 reverted "docked", "floating", "sidebar" modes 2026-01-10 08:36:59 +01:00
zsviczian 3baf7de216 fixed group button 2026-01-10 07:55:05 +01:00
zsviczian 250a1a14d5 DEFAULT_HOTKEYS 2026-01-10 07:26:34 +01:00
zsviczian fd0d84d240 retain buttons in sidepanel 2026-01-10 07:26:19 +01:00
zsviczian a9ffdde8e5 boundaries v1 2026-01-09 19:51:24 +01:00
zsviczian 5206aff1cf INDICATOR_OFFSET fix 2026-01-09 17:21:50 +01:00
zsviczian 8022f9a89b fixed greedy grouping 2026-01-09 13:33:27 +00:00
zsviczian 5216d81db9 added layout configuration modal 2026-01-09 12:29:19 +00:00
zsviczian 949789ec8c more compact default 2026-01-09 11:13:07 +00:00
zsviczian 53f21bca9b textElement.autoresize on edit, veritical spacing fix 2026-01-09 08:06:17 +00:00
zsviczian 1246eca2f3 Layout nodes on an ellipse instead of a circle 2026-01-09 07:37:04 +00:00
zsviczian 06014da0b7 double layout during paste 2026-01-09 07:17:24 +00:00
zsviczian 24b6a610b8 moved to commonBoundingBox 2026-01-09 07:04:40 +00:00
zsviczian 35dd6dd650 Instructions moved to language dictionary 2026-01-08 23:41:29 +01:00
zsviczian 26ce6dfe0d shortened documentation in script 2026-01-08 23:28:50 +01:00
zsviczian ebaab2702c language, unfold all, TAB support, fold buttons, restructure code 2026-01-08 23:23:47 +01:00
zsviczian 1638d9cc42 fixed special hotkeys, fixed unfold when add node, fixed ... color and display (when no child), honor number of tabs based on obsidian setting. 2026-01-08 18:29:43 +01:00
zsviczian 9bb5d7249e minor styling fixes 2026-01-08 13:48:26 +00:00
zsviczian 7986ed4000 scroll to focus element 2026-01-08 12:30:32 +00:00
zsviczian 4d9a8d90ba improved root navigate logic 2026-01-08 12:03:00 +00:00
zsviczian 3994f63e69 unfold when navigating to folded node 2026-01-08 11:36:07 +00:00
zsviczian 956cdf07ea handling pinned nodes during folding 2026-01-08 10:14:50 +00:00
zsviczian 03692dfd77 initial folding logic 2026-01-08 09:01:49 +00:00
zsviczian 5340669fd6 PDF paste 2026-01-07 21:56:39 +01:00
zsviczian 4ac8dcc4de addImage supports PDF++ image links 2026-01-07 21:35:16 +01:00
zsviczian aa6f07e652 Revert "migrating to restoreElements to follow recent Excalidraw changes"
This reverts commit 1efb8f3049.
2026-01-07 20:54:07 +01:00
zsviczian df281889ff paste single line 2026-01-07 20:46:59 +01:00
zsviczian 25629ee5eb performance fixes and memory leaks 2026-01-07 20:35:14 +01:00
zsviczian e6e61d3a99 Obsidian hotkey conflicts 2026-01-07 19:32:12 +01:00
zsviczian 7c9a2e9d57 fixed popScope 2026-01-07 18:05:12 +01:00
zsviczian 41177030ae wip - not working 2026-01-07 15:59:51 +00:00
zsviczian 6a09b3f873 hotkey isGlobal, isInputOnly, sync DEFAULT_HOTKEYS 2026-01-06 13:33:08 +00:00
zsviczian 0acacc8f9f renderLinksToText 2026-01-06 08:29:25 +00:00
zsviczian 1efb8f3049 migrating to restoreElements to follow recent Excalidraw changes 2026-01-06 08:12:37 +01:00
zsviczian 7d99259cdc button disable behavior 2026-01-05 16:57:33 +00:00
zsviczian a97d90653f working on grouping 2026-01-05 14:34:56 +00:00
zsviczian 06debd4106 group-ungroup 2026-01-05 13:07:40 +00:00
zsviczian 62ae0b8230 box node moved next to toggle 2026-01-05 11:37:25 +00:00
zsviczian 0e2044ba72 Merge pull request #2592 from playermiller109/2026-01-05
Update zh-cn.ts to 9319b39
2026-01-05 12:09:09 +01:00
playermiller109 0db8ab9cda Update zh-cn.ts to 9319b39 2026-01-05 11:23:36 +08:00
zsviczian 9319b39c96 only remove group ids for elements connected to the map 2026-01-04 19:00:20 +01:00
zsviczian 75cbc47bc5 Merge pull request #2591 from zsviczian/sidepanels
feat: Side panels, ColorPicker, Link Autocomplete, Mindmap Builder Improvements
2026-01-04 16:13:30 +01:00
110 changed files with 39384 additions and 8492 deletions

No files matched your search

-1
View File
@@ -17,7 +17,6 @@ tmp
deploy.ps1
#VSCode
.vscode
yarn.lock
.DS_Store
.lock
+30
View File
@@ -0,0 +1,30 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsserver.log": "off",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"files.exclude": {
"**/lib": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/lib": true
}
}
@@ -286,6 +286,16 @@ export declare class ExcalidrawAutomate {
* @returns {WorkspaceLeaf | null} The sidepanel leaf or null if not found.
*/
getSidepanelLeaf(): WorkspaceLeaf | null;
/**
* Queues the script to be skipped once during persisted sidepanel restoration.
* This is useful at startup when a script is launched via Command Palette/hotkey
* before the sidepanel view has opened and run its restoration sequence.
*
* The script is queued only if the sidepanel leaf is not yet available.
* @param scriptName - Optional script name. Defaults to ea.activeScript.
* @returns {boolean} True if a skip marker was queued, false otherwise.
*/
skipSidepanelScriptRestore(scriptName?: string): boolean;
/**
* Toggles the visibility of the Excalidraw sidepanel view.
* If the sidepanel is not in a leaf attached to the left or right split, no action is taken.
@@ -399,11 +409,11 @@ export declare class ExcalidrawAutomate {
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
* If not found, returns {}.
* Does not add the text element to elementsDict.
* @param element
* @param element: ExcalidrawElement | ExcalidrawElement[] - The selected container with text (an array of 2 elements) to check.
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
* @returns Object containing either eaElement or sceneElement or empty if not found.
*/
getBoundTextElement(element: ExcalidrawElement, searchInView?: boolean): {
getBoundTextElement(element: ExcalidrawElement | ExcalidrawElement[], searchInView?: boolean): {
eaElement?: Mutable<ExcalidrawTextElement>;
sceneElement?: ExcalidrawTextElement;
};
@@ -779,9 +789,11 @@ export declare class ExcalidrawAutomate {
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} tex - The LaTeX equation string.
* @param {number} [scaleX=1] - The x-scaling factor (post mathjax creation)
* @param {number} [scaleY=1] - The y-scaling factor (post mathjax creation)
* @returns {Promise<string>} Promise resolving to the ID of the added LaTeX image element.
*/
addLaTex(topX: number, topY: number, tex: string): Promise<string>;
addLaTex(topX: number, topY: number, tex: string, scaleX?: number, scaleY?: number): Promise<string>;
/**
* Returns the base64 dataURL of the LaTeX equation rendered as an SVG.
* @param {string} tex - The LaTeX equation string.
@@ -1009,7 +1021,7 @@ export declare class ExcalidrawAutomate {
* @param {boolean} [shouldRestoreElements=false] - Whether to restore legacy elements in the scene.
* @returns {Promise<boolean>} Promise resolving to true if elements were added, false otherwise.
*/
addElementsToView(repositionToCursor?: boolean, save?: boolean, newElementsOnTop?: boolean, shouldRestoreElements?: boolean): Promise<boolean>;
addElementsToView(repositionToCursor?: boolean, save?: boolean, newElementsOnTop?: boolean, shouldRestoreElements?: boolean, captureUpdate?: CaptureUpdateActionType): Promise<boolean>;
/**
* Registers this instance of EA to use for hooks with the target view.
* By default, ExcalidrawViews will check window.ExcalidrawAutomate for event hooks.
@@ -1403,6 +1415,7 @@ export declare class ExcalidrawAutomate {
cloneElement(element: ExcalidrawElement): ExcalidrawElement;
/**
* Moves the specified element to a specific position in the z-index.
* * Operates directly on the Excalidraw Scene in targetView, not through ExcalidrawAutomate elements.
* @param {number} elementId - The ID of the element to move.
* @param {number} newZIndex - The new z-index position for the element.
*/
@@ -1588,8 +1601,8 @@ export interface SidepanelTab {
setContent(content: string | DocumentFragment): this;
/** Activates this tab within the host sidepanel. */
focus(): void;
/** Marks the tab open, activates it, and triggers `onOpen`. */
open(): void;
/** Marks the tab open, activates it, and triggers `onOpen`. reveal default is true */
open(reveal?: boolean): void;
/** Runs close handlers then asks the host to remove the tab. */
close(): void;
/** Lifecycle hook called when the tab is opened/activated. */
@@ -1861,7 +1874,7 @@ export type AIRequest = {
/* ************************************** */
/* node_modules/@zsviczian/excalidraw/types/element/src/types.d.ts */
/* ************************************** */
export type ChartType = "bar" | "line";
export type ChartType = "bar" | "line" | "radar";
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
export type FontFamilyKeys = keyof typeof FONT_FAMILY;
export type FontFamilyValues = typeof FONT_FAMILY[FontFamilyKeys];
@@ -1998,6 +2011,17 @@ export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
scale: [number, number];
/** whether an element is cropped */
crop: ImageCrop | null;
customData?: {
pdfPageViewProps?: {
left: number;
bottom: number;
right: number;
top: number;
rotate?: number;
};
doNotInvertSVGInDarkMode?: boolean;
invertBitmapInDarkmode?: boolean;
};
}>;
export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
type FrameRole = null | "marker";
@@ -2166,6 +2190,7 @@ export type ConvertibleTypes = ConvertibleGenericTypes | ConvertibleLinearTypes;
/* ************************************** */
/* node_modules/@zsviczian/excalidraw/types/excalidraw/types.d.ts */
/* ************************************** */
export type { App };
export type SocketId = string & {
_brand: "SocketId";
};
@@ -2281,6 +2306,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
croppingElementId: AppState["croppingElementId"];
}>;
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
activeTool: AppState["activeTool"];
activeEmbeddable: AppState["activeEmbeddable"];
selectionElement: AppState["selectionElement"];
selectedGroupIds: AppState["selectedGroupIds"];
@@ -2288,6 +2314,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
multiElement: AppState["multiElement"];
newElement: AppState["newElement"];
isBindingEnabled: AppState["isBindingEnabled"];
invertBindingBehaviour: AppState["invertBindingBehaviour"];
suggestedBinding: AppState["suggestedBinding"];
isRotating: AppState["isRotating"];
elementsToHighlight: AppState["elementsToHighlight"];
@@ -2308,6 +2335,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
frameColor: AppState["frameColor"];
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
exportScale: AppState["exportScale"];
currentItemArrowType: AppState["currentItemArrowType"];
}>;
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
export type ObservedStandaloneAppState = {
@@ -2361,7 +2389,10 @@ export interface AppState {
selectionElement: NonDeletedExcalidrawElement | null;
isBindingEnabled: boolean;
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
suggestedBinding: NonDeleted<ExcalidrawBindableElement> | null;
suggestedBinding: {
element: NonDeleted<ExcalidrawBindableElement>;
midPoint?: GlobalPoint;
} | null;
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
frameRendering: {
enabled: boolean;
@@ -2439,6 +2470,10 @@ export interface AppState {
} | {
name: "elementLinkSelector";
sourceElementId: ExcalidrawElement["id"];
} | {
name: "charts";
data: Spreadsheet;
rawText: string;
};
/**
* Reflects user preference for whether the default sidebar should be docked.
@@ -2490,14 +2525,6 @@ export interface AppState {
/** bitmap. Use `STATS_PANELS` bit values */
panels: number;
};
currentChartType: ChartType;
pasteDialog: {
shown: false;
data: null;
} | {
shown: true;
data: Spreadsheet;
};
showHyperlinkPopup: false | "info" | "editor";
linkOpacity: number;
colorPalette?: {
@@ -2635,7 +2662,7 @@ export interface ExcalidrawProps {
button: "down" | "up";
pointersMap: Gesture["pointers"];
}) => void;
onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
onPaste?: (data: ClipboardData, event: ClipboardEvent | null, files: ParsedDataTransferFile[]) => Promise<boolean> | boolean;
onDrop?: (event: React.DragEvent<HTMLDivElement>) => Promise<boolean> | boolean;
/**
* Called when element(s) are duplicated so you can listen or modify as
@@ -2728,8 +2755,7 @@ export type UIOptions = Partial<{
* Optionally control the editor form factor and desktop UI mode from the host app.
* If not provided, we will take care of it internally.
*/
formFactor?: EditorInterface["formFactor"];
desktopUIMode?: EditorInterface["desktopUIMode"];
getFormFactor?: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
/** @deprecated does nothing. Will be removed in 0.15 */
welcomeScreen?: boolean;
}>;
@@ -2791,6 +2817,7 @@ export type AppClassProperties = {
onPointerUpEmitter: App["onPointerUpEmitter"];
updateEditorAtom: App["updateEditorAtom"];
onPointerDownEmitter: App["onPointerDownEmitter"];
lastPointerMoveCoords: App["lastPointerMoveCoords"];
bindModeHandler: App["bindModeHandler"];
};
export type PointerDownState = Readonly<{
@@ -2862,12 +2889,13 @@ export interface ExcalidrawImperativeAPI {
getSceneElementsMapIncludingDeleted: InstanceType<typeof App>["getSceneElementsMapIncludingDeleted"];
history: {
clear: InstanceType<typeof App>["resetHistory"];
undo: InstanceType<typeof App>["undo"];
redo: InstanceType<typeof App>["redo"];
};
setForceRenderAllEmbeddables: InstanceType<typeof App>["setForceRenderAllEmbeddables"];
zoomToFit: InstanceType<typeof App>["zoomToFit"];
refreshEditorInterface: InstanceType<typeof App>["refreshEditorInterface"];
isTouchScreen: InstanceType<typeof App>["isTouchScreen"];
setTrayModeEnabled: InstanceType<typeof App>["setTrayModeEnabled"];
setDesktopUIMode: InstanceType<typeof App>["setDesktopUIMode"];
setMobileModeAllowed: InstanceType<typeof App>["setMobileModeAllowed"];
isTrayModeEnabled: InstanceType<typeof App>["isTrayModeEnabled"];
@@ -2949,4 +2977,650 @@ export type Offsets = Partial<{
left: number;
}>;
/* ************************************** */
/* node_modules/@zsviczian/excalidraw/types/element/src/bounds.d.ts */
/* ************************************** */
export type RectangleBox = {
x: number;
y: number;
width: number;
height: number;
angle: number;
};
export type SceneBounds = readonly [
sceneX: number,
sceneY: number,
sceneX2: number,
sceneY2: number
];
export declare class ElementBounds {
private static boundsCache;
private static nonRotatedBoundsCache;
static getBounds(element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean): Bounds;
private static calculateBounds;
}
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
/**
* Given an element, return the line segments that make up the element.
*
* Uses helpers from /math
*/
export declare const getElementLineSegments: (element: ExcalidrawElement, elementsMap: ElementsMap) => LineSegment<GlobalPoint>[];
/**
* Scene -> Scene coords, but in x1,x2,y1,y2 format.
*
* Rectangle here means any rectangular frame, not an excalidraw element.
*/
export declare const getRectangleBoxAbsoluteCoords: (boxSceneCoords: RectangleBox) => number[];
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
export declare const getCubicBezierCurveBound: (p0: GlobalPoint, p1: GlobalPoint, p2: GlobalPoint, p3: GlobalPoint) => Bounds;
export declare const getMinMaxXYFromCurvePathOps: (ops: Op[], transformXY?: (p: GlobalPoint) => GlobalPoint) => Bounds;
export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["points"]) => Bounds;
/** @returns number in pixels */
export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
/** @returns number in degrees */
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
x: number;
y: number;
}) => number[];
export declare const getResizedElementAbsoluteCoords: (element: ExcalidrawElement, nextWidth: number, nextHeight: number, normalizePoints: boolean) => Bounds;
export declare const getElementPointsCoords: (element: ExcalidrawLinearElement, points: readonly (readonly [number, number])[]) => Bounds;
export declare const getClosestElementBounds: (elements: readonly ExcalidrawElement[], from: {
x: number;
y: number;
}) => Bounds;
export interface BoundingBox {
minX: number;
minY: number;
maxX: number;
maxY: number;
midX: number;
midY: number;
width: number;
height: number;
}
export declare const getCommonBoundingBox: (elements: readonly ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => BoundingBox;
/**
* returns scene coords of user's editor viewport (visible canvas area) bounds
*/
export declare const getVisibleSceneBounds: ({ scrollX, scrollY, width, height, zoom, }: AppState) => SceneBounds;
export declare const getCenterForBounds: (bounds: Bounds) => GlobalPoint;
/**
* Get the axis-aligned bounding box for a given element
*/
export declare const aabbForElement: (element: Readonly<ExcalidrawElement>, elementsMap: ElementsMap, offset?: [number, number, number, number]) => Bounds;
export declare const pointInsideBounds: <P extends GlobalPoint | LocalPoint>(p: P, bounds: Bounds) => boolean;
export declare const doBoundsIntersect: (bounds1: Bounds | null, bounds2: Bounds | null) => boolean;
export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMap: ElementsMap, xOffset?: number, yOffset?: number) => GlobalPoint;
/* ************************************** */
/* node_modules/@zsviczian/excalidraw/types/excalidraw/components/App.d.ts */
/* ************************************** */
export declare const ExcalidrawContainerContext: React.Context<{
container: HTMLDivElement | null;
id: string | null;
}>;
export declare const useApp: () => AppClassProperties;
export declare const useAppProps: () => AppProps;
export declare const useEditorInterface: () => Readonly<{
formFactor: "phone" | "tablet" | "desktop";
desktopUIMode: "compact" | "full" | "tray" | "mobile";
userAgent: Readonly<{
isMobileDevice: boolean;
platform: "ios" | "android" | "other" | "unknown";
}>;
isTouchScreen: boolean;
canFitSidebar: boolean;
isLandscape: boolean;
}>;
export declare const useStylesPanelMode: () => StylesPanelMode;
export declare const useExcalidrawContainer: () => {
container: HTMLDivElement | null;
id: string | null;
};
export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawElement[];
export declare const useExcalidrawAppState: () => AppState;
export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
export declare const useExcalidrawActionManager: () => ActionManager;
declare class App extends React.Component<AppProps, AppState> {
canvas: AppClassProperties["canvas"];
interactiveCanvas: AppClassProperties["interactiveCanvas"];
rc: RoughCanvas;
unmounted: boolean;
actionManager: ActionManager;
editorInterface: EditorInterface;
private stylesPanelMode;
private excalidrawContainerRef;
scene: Scene;
fonts: Fonts;
renderer: Renderer;
visibleElements: readonly NonDeletedExcalidrawElement[];
private resizeObserver;
library: AppClassProperties["library"];
libraryItemsFromStorage: LibraryItems | undefined;
id: string;
private store;
private history;
private shouldRenderAllEmbeddables;
excalidrawContainerValue: {
container: HTMLDivElement | null;
id: string;
};
files: BinaryFiles;
imageCache: AppClassProperties["imageCache"];
private iFrameRefs;
/**
* Indicates whether the embeddable's url has been validated for rendering.
* If value not set, indicates that the validation is pending.
* Initially or on url change the flag is not reset so that we can guarantee
* the validation came from a trusted source (the editor).
**/
private embedsValidationStatus;
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
* insert to DOM before user initially scrolls to them) */
private initializedEmbeds;
private handleToastClose;
private elementsPendingErasure;
flowChartCreator: FlowChartCreator;
private flowChartNavigator;
bindModeHandler: ReturnType<typeof setTimeout> | null;
hitLinkElement?: NonDeletedExcalidrawElement;
lastPointerDownEvent: React.PointerEvent<HTMLElement> | null;
lastPointerUpEvent: React.PointerEvent<HTMLElement> | PointerEvent | null;
lastPointerMoveEvent: PointerEvent | null;
/** current frame pointer cords */
lastPointerMoveCoords: {
x: number;
y: number;
} | null;
/** previous frame pointer coords */
previousPointerMoveCoords: {
x: number;
y: number;
} | null;
lastViewportPosition: {
x: number;
y: number;
};
allowMobileMode: boolean;
animationFrameHandler: AnimationFrameHandler;
laserTrails: LaserTrails;
eraserTrail: EraserTrail;
lassoTrail: LassoTrail;
onChangeEmitter: Emitter<[elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles]>;
onPointerDownEmitter: Emitter<[activeTool: {
lastActiveTool: import("../types").ActiveTool | null;
locked: boolean;
fromSelection: boolean;
} & import("../types").ActiveTool, pointerDownState: Readonly<{
origin: Readonly<{
x: number;
y: number;
}>;
originInGrid: Readonly<{
x: number;
y: number;
}>;
scrollbars: ReturnType<typeof isOverScrollBars>;
lastCoords: {
x: number;
y: number;
};
originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
resize: {
handleType: import("@excalidraw/element").MaybeTransformHandleType;
isResizing: boolean;
offset: {
x: number;
y: number;
};
arrowDirection: "origin" | "end";
center: {
x: number;
y: number;
};
};
hit: {
element: NonDeleted<ExcalidrawElement> | null;
allHitElements: NonDeleted<ExcalidrawElement>[];
wasAddedToSelection: boolean;
hasBeenDuplicated: boolean;
hasHitCommonBoundingBoxOfSelectedElements: boolean;
};
withCmdOrCtrl: boolean;
drag: {
hasOccurred: boolean;
offset: {
x: number;
y: number;
} | null;
origin: {
x: number;
y: number;
};
blockDragging: boolean;
};
eventListeners: {
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
onUp: null | ((event: PointerEvent) => void);
onKeyDown: null | ((event: KeyboardEvent) => void);
onKeyUp: null | ((event: KeyboardEvent) => void);
};
boxSelection: {
hasOccurred: boolean;
};
}>, event: React.PointerEvent<HTMLElement>]>;
onPointerUpEmitter: Emitter<[activeTool: {
lastActiveTool: import("../types").ActiveTool | null;
locked: boolean;
fromSelection: boolean;
} & import("../types").ActiveTool, pointerDownState: Readonly<{
origin: Readonly<{
x: number;
y: number;
}>;
originInGrid: Readonly<{
x: number;
y: number;
}>;
scrollbars: ReturnType<typeof isOverScrollBars>;
lastCoords: {
x: number;
y: number;
};
originalElements: Map<string, NonDeleted<ExcalidrawElement>>;
resize: {
handleType: import("@excalidraw/element").MaybeTransformHandleType;
isResizing: boolean;
offset: {
x: number;
y: number;
};
arrowDirection: "origin" | "end";
center: {
x: number;
y: number;
};
};
hit: {
element: NonDeleted<ExcalidrawElement> | null;
allHitElements: NonDeleted<ExcalidrawElement>[];
wasAddedToSelection: boolean;
hasBeenDuplicated: boolean;
hasHitCommonBoundingBoxOfSelectedElements: boolean;
};
withCmdOrCtrl: boolean;
drag: {
hasOccurred: boolean;
offset: {
x: number;
y: number;
} | null;
origin: {
x: number;
y: number;
};
blockDragging: boolean;
};
eventListeners: {
onMove: null | ReturnType<typeof import("@excalidraw/common").throttleRAF>;
onUp: null | ((event: PointerEvent) => void);
onKeyDown: null | ((event: KeyboardEvent) => void);
onKeyUp: null | ((event: KeyboardEvent) => void);
};
boxSelection: {
hasOccurred: boolean;
};
}>, event: PointerEvent]>;
onUserFollowEmitter: Emitter<[payload: OnUserFollowedPayload]>;
onScrollChangeEmitter: Emitter<[scrollX: number, scrollY: number, zoom: Readonly<{
value: import("../types").NormalizedZoomValue;
}>]>;
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
onRemoveEventListenersEmitter: Emitter<[]>;
constructor(props: AppProps);
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
private onWindowMessage;
private handleSkipBindMode;
private resetDelayedBindMode;
private previousHoveredBindableElement;
private handleDelayedBindModeChange;
private cacheEmbeddableRef;
/**
* Returns gridSize taking into account `gridModeEnabled`.
* If disabled, returns null.
*/
getEffectiveGridSize: () => NullableGridSize;
private getHTMLIFrameElement;
private handleIframeLikeElementHover;
/** @returns true if iframe-like element click handled */
private handleIframeLikeCenterClick;
private isIframeLikeElementCenter;
private updateEmbedValidationStatus;
private updateEmbeddables;
private renderEmbeddables;
private getFrameNameDOMId;
frameNameBoundsCache: FrameNameBoundsCache;
private resetEditingFrame;
private renderFrameNames;
private toggleOverscrollBehavior;
render(): import("react/jsx-runtime").JSX.Element;
focusContainer: AppClassProperties["focusContainer"];
getSceneElementsIncludingDeleted: () => readonly import("@excalidraw/element/types").OrderedExcalidrawElement[];
getSceneElementsMapIncludingDeleted: () => SceneElementsMap;
getSceneElements: () => readonly Ordered<NonDeletedExcalidrawElement>[];
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
exportingFrame: ExcalidrawFrameLikeElement | null;
}) => Promise<void>;
private magicGenerations;
private updateMagicGeneration;
plugins: {
diagramToCode?: {
generate: GenerateDiagramToCode;
};
};
setPlugins(plugins: Partial<App["plugins"]>): void;
private onMagicFrameGenerate;
private onIframeSrcCopy;
onMagicframeToolSelect: () => void;
private openEyeDropper;
dismissLinearEditor: () => void;
syncActionResult: (actionResult: ActionResult) => void;
private onBlur;
private onUnload;
private disableEvent;
private resetHistory;
private undo;
private redo;
private resetStore;
/**
* Resets scene & history.
* ! Do not use to clear scene user action !
*/
private resetScene;
private initializeScene;
private getFormFactor;
refreshEditorInterface: () => void;
private reconcileStylesPanelMode;
/** TO BE USED LATER */
private setDesktopUIMode;
private isTouchScreen;
isTrayModeEnabled: () => boolean;
private clearImageShapeCache;
componentDidMount(): Promise<void>;
componentWillUnmount(): void;
private onResize;
/** generally invoked only if fullscreen was invoked programmatically */
private onFullscreenChange;
private removeEventListeners;
private addEventListeners;
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
private renderInteractiveSceneCallback;
private onScroll;
private onCut;
private onCopy;
private static resetTapTwice;
private onTouchStart;
private onTouchEnd;
private insertClipboardContent;
pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
addElementsFromPasteOrLibrary: (opts: {
elements: readonly ExcalidrawElement[];
files: BinaryFiles | null;
position: {
clientX: number;
clientY: number;
} | "cursor" | "center";
retainSeed?: boolean;
fitToContent?: boolean;
}) => void;
private addElementsFromMixedContentPaste;
private addTextFromPaste;
setAppState: React.Component<any, AppState>["setState"];
removePointer: (event: React.PointerEvent<HTMLElement> | PointerEvent) => void;
toggleLock: (source?: "keyboard" | "ui") => void;
updateFrameRendering: (opts: Partial<AppState["frameRendering"]> | ((prevState: AppState["frameRendering"]) => Partial<AppState["frameRendering"]>)) => void;
togglePenMode: (force: boolean | null) => void;
onHandToolToggle: () => void;
/**
* Zooms on canvas viewport center
*/
zoomCanvas: (
/**
* Decimal fraction, auto-clamped between MIN_ZOOM and MAX_ZOOM.
* 1 = 100% zoom, 2 = 200% zoom, 0.5 = 50% zoom
*/
value: number) => void;
private cancelInProgressAnimation;
scrollToContent: (
/**
* target to scroll to
*
* - string - id of element or group, or url containing elementLink
* - ExcalidrawElement | ExcalidrawElement[] - element(s) objects
*/
target?: string | ExcalidrawElement | readonly ExcalidrawElement[], opts?: ({
fitToContent?: boolean;
fitToViewport?: never;
viewportZoomFactor?: number;
animate?: boolean;
duration?: number;
} | {
fitToContent?: never;
fitToViewport?: boolean;
/** when fitToViewport=true, how much screen should the content cover,
* between 0.1 (10%) and 1 (100%)
*/
viewportZoomFactor?: number;
animate?: boolean;
duration?: number;
}) & {
minZoom?: number;
maxZoom?: number;
canvasOffsets?: Offsets;
}) => void;
private maybeUnfollowRemoteUser;
/** use when changing scrollX/scrollY/zoom based on user interaction */
private translateCanvas;
setForceRenderAllEmbeddables: (force: boolean) => void;
zoomToFit: (target?: readonly ExcalidrawElement[], maxZoom?: number, //null will zoom to max based on viewport
margin?: number) => void;
getColorAtScenePoint: ({ sceneX, sceneY, }: {
sceneX: number;
sceneY: number;
}) => string | null;
startLineEditor: (el: ExcalidrawLinearElement, selectedPointsIndices?: number[] | null) => void;
refreshAllArrows: () => void;
updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
setToast: (toast: {
message: string;
closable?: boolean;
duration?: number;
} | null) => void;
restoreFileFromShare: () => Promise<void>;
/**
* adds supplied files to existing files in the appState.
* NOTE if file already exists in editor state, the file data is not updated
* */
addFiles: ExcalidrawImperativeAPI["addFiles"];
setMobileModeAllowed: (allow: boolean) => void;
private debounceClearHighlightSearchResults;
selectElements: ExcalidrawImperativeAPI["selectElements"];
bringToFront: ExcalidrawImperativeAPI["bringToFront"];
bringForward: ExcalidrawImperativeAPI["bringForward"];
sendToBack: ExcalidrawImperativeAPI["sendToBack"];
sendBackward: ExcalidrawImperativeAPI["sendBackward"];
private addMissingFiles;
updateScene: <K extends keyof AppState>(sceneData: {
elements?: SceneData["elements"];
appState?: Pick<AppState, K> | null;
collaborators?: SceneData["collaborators"];
/**
* Controls which updates should be captured by the `Store`. Captured updates are emmitted and listened to by other components, such as `History` for undo / redo purposes.
*
* - `CaptureUpdateAction.IMMEDIATELY`: Updates are immediately undoable. Use for most local updates.
* - `CaptureUpdateAction.NEVER`: Updates never make it to undo/redo stack. Use for remote updates or scene initialization.
* - `CaptureUpdateAction.EVENTUALLY`: Updates will be eventually be captured as part of a future increment.
*
* Check [API docs](https://docs.excalidraw.com/docs/@excalidraw/excalidraw/api/props/excalidraw-api#captureUpdate) for more details.
*
* @default CaptureUpdateAction.EVENTUALLY
*/
captureUpdate?: SceneData["captureUpdate"];
forceFlushSync?: boolean;
}) => void;
applyDeltas: (deltas: StoreDelta[], options?: ApplyToOptions) => [SceneElementsMap, AppState, boolean];
mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
private triggerRender;
/**
* @returns whether the menu was toggled on or off
*/
toggleSidebar: ({ name, tab, force, }: {
name: SidebarName | null;
tab?: SidebarTabName;
force?: boolean;
}) => boolean;
private updateCurrentCursorPosition;
getEditorUIOffsets: () => Offsets;
private onKeyDown;
private onKeyUp;
private isToolSupported;
setActiveTool: (tool: ({
type: ToolType;
} | {
type: "custom";
customType: string;
}) & {
locked?: boolean;
fromSelection?: boolean;
}, keepSelection?: boolean) => void;
setOpenDialog: (dialogType: AppState["openDialog"]) => void;
private setCursor;
private resetCursor;
/**
* returns whether user is making a gesture with >= 2 fingers (points)
* on o touch screen (not on a trackpad). Currently only relates to Darwin
* (iOS/iPadOS,MacOS), but may work on other devices in the future if
* GestureEvent is standardized.
*/
private isTouchScreenMultiTouchGesture;
getName: () => string;
private onGestureStart;
private onGestureChange;
private onGestureEnd;
private handleTextWysiwyg;
private deselectElements;
private getTextElementAtPosition;
private getElementAtPosition;
private getElementsAtPosition;
getElementHitThreshold(element: ExcalidrawElement): number;
private hitElement;
private getTextBindableContainerAtPosition;
private startTextEditing;
private debounceDoubleClickTimestamp;
private startImageCropping;
private finishImageCropping;
private handleCanvasDoubleClick;
private getElementLinkAtPosition;
private handleElementLinkClick;
private getTopLayerFrameAtSceneCoords;
private handleCanvasPointerMove;
private handleEraser;
private handleTouchMove;
handleHoverSelectedLinearElement(linearElementEditor: LinearElementEditor, scenePointerX: number, scenePointerY: number): void;
private handleCanvasPointerDown;
private handleCanvasPointerUp;
private maybeOpenContextMenuAfterPointerDownOnTouchDevices;
private resetContextMenuTimer;
/**
* pointerup may not fire in certian cases (user tabs away...), so in order
* to properly cleanup pointerdown state, we need to fire any hanging
* pointerup handlers manually
*/
private maybeCleanupAfterMissingPointerUp;
handleCanvasPanUsingWheelOrSpaceDrag: (event: React.PointerEvent<HTMLElement> | MouseEvent) => boolean;
private startRightClickPanning;
private updateGestureOnPointerDown;
private initialPointerDownState;
private handleDraggingScrollBar;
private clearSelectionIfNotUsingSelection;
/**
* @returns whether the pointer event has been completely handled
*/
private handleSelectionOnPointerDown;
private isASelectedElement;
private isHittingCommonBoundingBoxOfSelectedElements;
private handleTextOnPointerDown;
private handleFreeDrawElementOnPointerDown;
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
sceneX: number;
sceneY: number;
width: number;
height: number;
}) => NonDeleted<ExcalidrawIframeElement>;
insertEmbeddableElement: ({ sceneX, sceneY, link, }: {
sceneX: number;
sceneY: number;
link: string;
}) => NonDeleted<ExcalidrawEmbeddableElement> | undefined;
private newImagePlaceholder;
private handleLinearElementOnPointerDown;
private getCurrentItemRoundness;
private createGenericElementOnPointerDown;
private createFrameElementOnPointerDown;
private maybeCacheReferenceSnapPoints;
private maybeCacheVisibleGaps;
private onKeyDownFromPointerDownHandler;
private onKeyUpFromPointerDownHandler;
private onPointerMoveFromPointerDownHandler;
private handlePointerMoveOverScrollbars;
private onPointerUpFromPointerDownHandler;
private restoreReadyToEraseElements;
private eraseElements;
private initializeImage;
/**
* use during async image initialization,
* when the placeholder image could have been modified in the meantime,
* and when you don't want to loose those modifications
*/
private getLatestInitializedImageElement;
private onImageToolbarButtonClick;
private getImageNaturalDimensions;
/** updates image cache, refreshing updated elements and/or setting status
to error for images that fail during <img> element creation */
private updateImageCache;
/** adds new images to imageCache and re-renders if needed */
private addNewImagesToImageCache;
/** generally you should use `addNewImagesToImageCache()` directly if you need
* to render new images. This is just a failsafe */
private scheduleImageRefresh;
private updateBindingEnabledOnPointerMove;
setSelection(elements: readonly NonDeletedExcalidrawElement[]): void;
private clearSelection;
private handleInteractiveCanvasRef;
private insertImages;
private handleAppOnDrop;
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
private handleCanvasContextMenu;
private maybeDragNewGenericElement;
private maybeHandleCrop;
private maybeHandleResize;
private getContextMenuItems;
private handleWheel;
private getTextWysiwygSnappedToCenterPosition;
private savePointer;
private resetShouldCacheIgnoreZoomDebounced;
private updateDOMRect;
refresh: () => void;
private getCanvasOffsets;
watchState: () => void;
private updateLanguage;
}
export default App;
```
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -577,9 +577,11 @@ export declare class ExcalidrawAutomate {
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} tex - The LaTeX equation string.
* @param {number} [scaleX=1] - The x-scaling factor (post mathjax creation)
* @param {number} [scaleY=1] - The y-scaling factor (post mathjax creation)
* @returns {Promise<string>} Promise resolving to the ID of the added LaTeX image element.
*/
addLaTex(topX: number, topY: number, tex: string): Promise<string>;
addLaTex(topX: number, topY: number, tex: string, scaleX?: number, scaleY?: number): Promise<string>;
/**
* Returns the base64 dataURL of the LaTeX equation rendered as an SVG.
* @param {string} tex - The LaTeX equation string.
+482
View File
@@ -0,0 +1,482 @@
# MindMap Builder API
This page documents how **Mind Map Builder** works internally and how to automate it through `window.MindMapBuilderAPI`.
## Why this API exists
Mind Map Builder is optimized for interactive keyboard-first use in Excalidraw. The public API adds a stable automation layer so scripts and AI agents can:
- discover available methods and actions,
- validate arguments before execution,
- execute high-level operations without re-implementing layout logic,
- retrieve map structure and role-based element groups.
## Runtime model (how Mind Map Builder works)
At runtime, Mind Map Builder treats a map as a graph composed of:
- **Node elements**: text-containing Excalidraw elements representing ideas.
- **Branch arrows**: arrows with `customData.isBranch === true`, defining parent/child relationships.
- **Map roots**: top-level nodes without incoming branch arrows.
- **Additional roots (submaps)**: nodes flagged as `customData.isAdditionalRoot === true`.
- **Map config root**: settings are resolved from the node returned by internal root/settings-root logic.
- **Project elements**: branch content plus related decorations, boundaries, and crosslinks.
Most operations run through existing Mind Map Builder internals (action dispatcher + layout engine), and the API wraps those internals with structured success/error return objects.
## API entry point
```js
const mmb = window.MindMapBuilderAPI;
```
The API is available while Mind Map Builder is active.
## Result envelope
All public methods (except `ready()` and `getCapabilities()`) return:
```ts
type MMResult<T> =
| { ok: true; data: T }
| { ok: false; error: { code: string; message: string; details?: any } };
```
## Discoverability and minification-safe introspection
Because Mind Map Builder is minified in distribution, rely on runtime introspection (not source signatures):
- `spec()` for machine-readable contract,
- `help()` for human-readable docs,
- `listMethods()` for method discovery,
- `validate()` for argument validation,
- `getErrorCodes()` for stable error semantics.
## Quick start
```js
const mmb = window.MindMapBuilderAPI;
if (!mmb?.ready()) throw new Error("MindMapBuilderAPI not ready");
const methods = mmb.listMethods();
console.log(methods);
const view = mmb.getView();
console.log(view);
```
---
## Public API reference
### Metadata and introspection
#### `ready(): boolean`
Returns whether the API runtime is initialized.
#### `getCapabilities(): { actions: string[]; methods: string[] }`
Returns action constants and currently enumerable API method names.
#### `listMethods(): MMResult<{ methods: string[] }>`
Returns all documented public method names.
#### `getErrorCodes(): MMResult<{ errors: Record<string,string> }>`
Returns error code → explanation map.
#### `spec(): MMResult<{ version; actions; errors; methods }>`
Returns the full machine-readable API contract, including method parameter metadata.
#### `help(method?: string, format?: "object" | "text"): MMResult<object | string>`
Returns docs for one method or the full API.
#### `validate(method: string, args?: any): MMResult<{ valid: boolean; errors: string[]; normalizedArgs: object }>`
Validates arguments against documented method contract before execution.
### View and selection
#### `setView(view: ExcalidrawView): MMResult<{ view; filePath }>`
Sets the active Excalidraw view context used by Mind Map Builder.
#### `getView(): MMResult<{ view; filePath }>`
Returns the current Excalidraw view and backing file path.
#### `getSelection(): MMResult<{ nodeId: string | null; elementIds: string[] }>`
Returns current selected mindmap node (if resolvable) and selected element IDs.
#### `selectNode(nodeId?: string): MMResult<{ nodeId: string }>`
Selects node by ID. If omitted, resolves from current selection context.
#### `setInputFieldDockStatus({ isDocked }): Promise<MMResult<{ isDocked: boolean; isUndocked: boolean; sidepanelVisible: boolean }>>`
Forces input UI mode to docked/undocked. When docking, it docks if needed and reveals sidepanel if hidden. When undocking, it undocks if needed and hides sidepanel if currently visible.
### Map structure and node content
#### `getMindMapRoots(): MMResult<{ rootIds: string[] }>`
Returns top-level master root IDs.
#### `getMapInfo(nodeId?: string): MMResult<{ nodeId; rootId; settingsRootId; depth }>`
Returns hierarchy info for a node.
#### `getNodeText(nodeId?: string): MMResult<{ nodeId; text; ontology }>`
Returns node text and ontology (derived from incoming branch metadata text).
### Actions and layout
#### `performAction(action: string, event?: object): Promise<MMResult<void>>`
Executes one built-in action from `MindMapBuilderAPI.Actions`.
#### `refreshMapLayout(nodeId?: string): Promise<MMResult<{ rootId: string }>>`
Re-runs map layout for a selected or provided node.
### Create / import / export
#### `addNode({ text, parentId?, ontology?, follow?, position? }): Promise<MMResult<{ nodeId; arrowId; rootId }>>`
Adds a node using existing mindmap insertion logic.
#### `importMarkdown({ markdown, parentId? }): Promise<MMResult<{ addedNodeIds: string[]; rootId: string | null }>>`
Imports markdown bullet hierarchy into the map.
#### `exportMarkdown({ nodeId?, cut? }): Promise<MMResult<{ markdown: string }>>`
Copies selected branch as markdown to clipboard and returns the markdown text.
### Submaps and config
#### `toggleSubmapRoot({ nodeId?, enabled? }): Promise<MMResult<{ nodeId; enabled }>>`
Toggles additional-root status (or forces it when `enabled` is provided).
#### `getMapConfig(nodeId?): MMResult<{ rootId; settingsRootId; config }>`
Returns effective map configuration.
#### `setMapConfig({ patch, nodeId?, relayout? }): Promise<MMResult<{ rootId; settingsRootId }>>`
Patches map config and optionally relayouts.
### Element extraction for automation
#### `getBranchElementIds({ nodeId, includeDecorations?, includeCrosslinks? }): MMResult<{ ids: string[] }>`
Returns branch element IDs for targeted operations.
#### `getProjectElementIds(rootId: string): MMResult<{ ids: string[] }>`
Returns all project element IDs under a root.
#### `getElementIdsByRole(rootId: string): MMResult<{ nodes; branchArrows; crossLinks; boundaries; decorations; boundTexts }>`
Returns categorized element IDs for selective styling or export workflows.
---
## Actions enum
Use `MindMapBuilderAPI.Actions` constants with `performAction()`.
Key values include:
- `ADD`, `ADD_SIBLING_AFTER`, `ADD_SIBLING_BEFORE`,
- `ADD_FOLLOW`, `ADD_FOLLOW_FOCUS`, `ADD_FOLLOW_ZOOM`,
- `EDIT`, `PIN`, `BOX`, `TOGGLE_BOUNDARY`, `TOGGLE_SUBMAP_ROOT`, `TOGGLE_GROUP`,
- `FOLD`, `FOLD_L1`, `FOLD_ALL`,
- `COPY`, `CUT`, `PASTE`,
- `ZOOM`, `FOCUS`,
- `NAVIGATE`, `NAVIGATE_ZOOM`, `NAVIGATE_FOCUS`,
- `SORT_ORDER`, `REARRANGE`,
- `DOCK_UNDOCK`, `HIDE`,
- `UNDO`, `REDO_Z`, `REDO_Y`.
## Error codes
Retrieve full list dynamically via:
```js
window.MindMapBuilderAPI.getErrorCodes();
```
Common codes:
- `NO_VIEW`, `INVALID_VIEW`
- `INVALID_NODE`, `NO_SELECTION`, `NO_ROOT`
- `INVALID_ACTION`, `INVALID_ARGUMENT`
- `OPERATION_FAILED`
---
## Examples
### 1) Agent-safe execution flow
```js
const ea = window.ExcalidrawAutomate;
if (!ea) {
console.log("Excalidraw not running");
return;
}
ea.setView();
if (!ea.targetView) {
console.log("No Excaliidraw document open");
return;
}
let mmb = window.MindMapBuilderAPI;
if (!mmb) {
const cmd = Object.keys(app.commands.commands).find(k=>k.match(/.*Mindmap Builder$/));
if(!cmd) {
console.log("MindMap Builder not installed");
return;
}
const leaf = ea.targetView.leaf;
app.workspace.setActiveLeaf(leaf);
if (app.commands.commands[cmd].checkCallback(false)) {
console.log("Failed to initialize MindMap Builder");
return;
}
await sleep(100);
mmb = window.MindMapBuilderAPI;
if (!mmb) {
console.log("MindMap Builder API not available");
return;
}
}
const check = mmb.validate("addNode", { text: "New idea" });
if (!check.ok || !check.data.valid) {
console.log(check);
return;
}
const res = await mmb.addNode(check.data.normalizedArgs);
console.log(res);
```
### 2) Discover API at runtime
```js
const spec = window.MindMapBuilderAPI.spec();
if (spec.ok) {
console.log(spec.data.version);
console.log(Object.keys(spec.data.methods));
}
```
### 3) Add nodes then relayout
```js
await window.MindMapBuilderAPI.addNode({ text: "Topic A" });
await window.MindMapBuilderAPI.addNode({ text: "Topic B", follow: true });
await window.MindMapBuilderAPI.refreshMapLayout();
```
### 4) Execute built-in action
```js
const { Actions } = window.MindMapBuilderAPI;
await window.MindMapBuilderAPI.performAction(Actions.FOLD_ALL);
```
### 5) Read node text + ontology
```js
const res = window.MindMapBuilderAPI.getNodeText();
if (res.ok) {
console.log(res.data.text, res.data.ontology);
}
```
### 6) Force input dock/undock state
```js
await window.MindMapBuilderAPI.setInputFieldDockStatus({ isDocked: true }); // force docked input
await window.MindMapBuilderAPI.setInputFieldDockStatus({ isDocked: false }); // force floating input
```
### 7) Import markdown under selected node
```js
const md = `
# Product Strategy
- Vision
- Problem
- Outcome
- Execution
- Milestones
`;
await window.MindMapBuilderAPI.importMarkdown({ markdown: md });
```
### 8) Export a branch to markdown
```js
const out = await window.MindMapBuilderAPI.exportMarkdown({ cut: false });
if (out.ok) console.log(out.data.markdown);
```
### 9) Get role-based IDs and style with ExcalidrawAutomate
```js
const roots = window.MindMapBuilderAPI.getMindMapRoots();
if (!roots.ok || roots.data.rootIds.length === 0) return;
const roles = window.MindMapBuilderAPI.getElementIdsByRole(roots.data.rootIds[0]);
if (!roles.ok) return;
// Example: pass roles.data.nodes into your EA styling pipeline
```
### 10) Build a feature showcase mindmap (Right-Left + boundaries)
```js
(async () => {
const ensureMindMapBuilder = async () => {
const ea = window.ExcalidrawAutomate;
if (!ea) throw new Error("ExcalidrawAutomate is not available");
ea.setView();
if (!ea.targetView) {
//if no excalidraw document is avaialble create one and open it
await ea.create({onNewPane: true,silent: false});
await sleep(100);
ea.setView();
if(!ea.targetView) {
throw new Error("No Excalidraw view is open");
}
}
let mmb = window.MindMapBuilderAPI;
if (!mmb) {
const cmd = Object.keys(app.commands.commands).find((k) => /.*Mindmap Builder$/.test(k));
if (!cmd) throw new Error("MindMap Builder command not found");
app.workspace.setActiveLeaf(ea.targetView.leaf);
// checkCallback(false) returns false when the command can run.
if (app.commands.commands[cmd].checkCallback(false)) {
throw new Error("MindMap Builder could not be initialized");
}
await sleep(120);
mmb = window.MindMapBuilderAPI;
if (!mmb) throw new Error("MindMap Builder API not available after command execution");
}
const setView = mmb.setView(ea.targetView);
if (!setView.ok) throw new Error(`setView failed: ${setView.error.message}`);
return { ea, mmb };
}
const assertOk = (result, label) => {
if (!result?.ok) {
const message = result?.error?.message || "Unknown error";
const code = result?.error?.code || "UNKNOWN";
throw new Error(`${label} failed (${code}): ${message}`);
}
return result.data;
}
const { mmb } = await ensureMindMapBuilder();
// 1) Create / select root
const rootData = assertOk(await mmb.addNode({ text: "MindMapBuilder API", ontology: "Root" }), "add root");
assertOk(mmb.selectNode(rootData.nodeId), "select root");
// 2) Explicitly set growth strategy to Right-Left
assertOk(
await mmb.setMapConfig({
nodeId: rootData.nodeId,
patch: {
growthMode: "Right-Left",
multicolor: true,
boxChildren: false,
},
relayout: true,
}),
"setMapConfig",
);
// 3) Build feature branches
const features = [
{
title: "Discoverability",
ontology: "spec/help/listMethods/getErrorCodes",
items: ["spec()", "help('addNode')", "listMethods()", "getErrorCodes()"],
},
{
title: "Validation",
ontology: "validate-first automation",
items: ["validate(method,args)", "normalizedArgs", "contract checks"],
},
{
title: "Core Ops",
ontology: "create+layout",
items: ["addNode()", "refreshMapLayout()", "performAction()"],
},
{
title: "Map Data",
ontology: "query graph",
items: ["getMapInfo()", "getNodeText()", "getMindMapRoots()"],
},
{
title: "Import/Export",
ontology: "markdown bridge",
items: ["importMarkdown()", "exportMarkdown()"],
},
{
title: "Extraction",
ontology: "element grouping",
items: ["getBranchElementIds()", "getProjectElementIds()", "getElementIdsByRole()"],
},
];
const branchNodeIds = [];
for (const group of features) {
assertOk(mmb.selectNode(rootData.nodeId), `select root for ${group.title}`);
const branch = assertOk(
await mmb.addNode({ text: group.title, ontology: group.ontology, parentId: rootData.nodeId }),
`add branch ${group.title}`,
);
branchNodeIds.push(branch.nodeId);
for (const item of group.items) {
assertOk(
await mmb.addNode({ text: item, parentId: branch.nodeId }),
`add item ${group.title} -> ${item}`,
);
}
}
// 4) Add boundaries around selected branch groups
const withBoundaries = ["Discoverability", "Core Ops", "Extraction"];
for (let i = 0; i < features.length; i++) {
const group = features[i];
if (!withBoundaries.includes(group.title)) continue;
assertOk(mmb.selectNode(branchNodeIds[i]), `select for boundary ${group.title}`);
assertOk(await mmb.performAction(mmb.Actions.TOGGLE_BOUNDARY), `toggle boundary ${group.title}`);
}
// 5) Final layout + quick verification calls
assertOk(mmb.selectNode(rootData.nodeId), "reselect root");
assertOk(await mmb.refreshMapLayout(rootData.nodeId), "final relayout");
const rootInfo = assertOk(mmb.getMapInfo(rootData.nodeId), "getMapInfo root");
const rootText = assertOk(mmb.getNodeText(rootData.nodeId), "getNodeText root");
mmb.performAction(mmb.Actions.ZOOM);
console.log("Map created", { rootInfo, rootText, branchNodeIds });
})();
```
---
## ExcalidrawAutomate integration note
MindMapBuilder API focuses on mindmap-specific orchestration. For advanced canvas operations (fine-grained styling, geometry transforms, scene-level utilities, file operations), use **ExcalidrawAutomate** together with this API.
Reference:
- [ExcalidrawAutomate full library for LLM training.md](../AITrainingData/ExcalidrawAutomate%20full%20library%20for%20LLM%20training.md)
You can use MindMapBuilderAPI to identify target nodes/branches, then use ExcalidrawAutomate to apply detailed transformations.
## Compatibility
- Designed for the current MindMapBuilder public API exposed at runtime.
- Prefer `spec()` and `validate()` in automation code to remain robust against future changes.
+3 -1
View File
@@ -577,9 +577,11 @@ export declare class ExcalidrawAutomate {
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} tex - The LaTeX equation string.
* @param {number} [scaleX=1] - The x-scaling factor (post mathjax creation)
* @param {number} [scaleY=1] - The y-scaling factor (post mathjax creation)
* @returns {Promise<string>} Promise resolving to the ID of the added LaTeX image element.
*/
addLaTex(topX: number, topY: number, tex: string): Promise<string>;
addLaTex(topX: number, topY: number, tex: string, scaleX?: number, scaleY?: number): Promise<string>;
/**
* Returns the base64 dataURL of the LaTeX equation rendered as an SVG.
* @param {string} tex - The LaTeX equation string.
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 100 500 400"><path fill-rule="evenodd" d="M414.57 183.49a11.194 11.194 0 0 0-10.344 6.914 11.21 11.21 0 0 0-.851 4.285v74.086h-110.09c-5.57-47.172-45.852-83.945-94.48-83.945-52.418 0-95.2 42.715-95.2 95.145 0 52.43 42.782 95.141 95.2 95.141 48.629 0 88.91-36.773 94.48-83.945h110.09v74.145c0 1.465.293 2.93.851 4.285a11.184 11.184 0 0 0 10.344 6.91H585.2c1.465 0 2.93-.292 4.285-.85a11.184 11.184 0 0 0 6.91-10.344v-170.63c0-1.466-.293-2.93-.851-4.286a11.246 11.246 0 0 0-2.426-3.633c-1.035-1.035-2.277-1.867-3.633-2.43s-2.82-.851-4.285-.851z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-workflow"><rect width="8" height="8" x="3" y="3" rx="2"/><path d="M7 11v4a2 2 0 0 0 2 2h4"/><rect width="8" height="8" x="13" y="13" rx="2"/></svg>

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 351 B

+1 -1
View File
@@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1670131481615" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3504" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M947.2 0H76.8C33.6 0 0 33.6 0 76.8v870.4C0 990.4 33.6 1024 76.8 1024h870.4c38.4 0 72-30.4 76.8-68.8V76.8C1024 33.6 990.4 0 947.2 0zM84.8 84.8h852.8V256H84.8V84.8z m256 256h596.8v256H340.8v-256z m-256 598.4V340.8H256v596.8H84.8z m256 0v-256h596.8v256H340.8z" p-id="3505"></path></svg>
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="128" height="128"><path d="M947.2 0H76.8C33.6 0 0 33.6 0 76.8v870.4C0 990.4 33.6 1024 76.8 1024h870.4c38.4 0 72-30.4 76.8-68.8V76.8C1024 33.6 990.4 0 947.2 0zM84.8 84.8h852.8V256H84.8V84.8z m256 256h596.8v256H340.8v-256z m-256 598.4V340.8H256v596.8H84.8z m256 0v-256h596.8v256H340.8z"></path></svg>

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 382 B

+1 -5
View File
@@ -1,5 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<path
d="m 24.000085,1.5001668 c -0.386664,0 -0.771381,0.00992 -1.153418,0.029456 -0.382035,0.019538 -0.761505,0.048738 -1.138431,0.087333 -0.376928,0.038595 -0.751077,0.086489 -1.122412,0.1436604 -0.371337,0.057172 -0.740095,0.1231708 -1.105359,0.1984375 -0.365266,0.075267 -0.72701,0.1598168 -1.085722,0.2526978 -0.358713,0.092881 -0.714405,0.1943596 -1.066085,0.304374 C 16.976978,2.6261398 16.62896,2.7444758 16.284794,2.8711426 15.940628,2.9978093 15.600354,3.132931 15.264185,3.275769 14.928014,3.4186072 14.596073,3.5694093 14.26838,3.7279378 13.940685,3.8864665 13.617667,4.0523606 13.29893,4.2260986 12.980192,4.3998368 12.66565,4.5812681 12.356352,4.7697347 12.047052,4.9582013 11.74261,5.1540648 11.443229,5.356779 11.143849,5.5594932 10.849575,5.7692003 10.560596,5.9856812 10.271615,6.2021619 9.9881012,6.4251244 9.7100016,6.654891 9.4319021,6.8846574 9.1592182,7.1213204 8.8924805,7.3638916 8.6257427,7.6064628 8.3649942,7.8552043 8.1100993,8.1100993 7.8552043,8.3649942 7.6064628,8.6257427 7.3638916,8.8924805 7.1213204,9.1592182 6.8846574,9.4319021 6.654891,9.7100016 6.4251244,9.9881012 6.2021619,10.271615 5.9856812,10.560596 5.7692003,10.849575 5.5594932,11.143849 5.356779,11.443229 5.1540648,11.74261 4.9582013,12.047052 4.7697347,12.356352 4.5812681,12.66565 4.3998368,12.980192 4.2260986,13.29893 4.0523606,13.617667 3.8864665,13.940685 3.7279378,14.26838 3.5694093,14.596073 3.4186072,14.928014 3.275769,15.264185 3.132931,15.600354 2.9978093,15.940628 2.8711426,16.284794 2.7444758,16.62896 2.6261398,16.976978 2.5161255,17.328658 c -0.1100144,0.35168 -0.2114932,0.707372 -0.3043742,1.066085 -0.092881,0.358712 -0.177431,0.720456 -0.2526978,1.085722 -0.075267,0.365264 -0.1412659,0.734022 -0.1984375,1.105359 -0.057171,0.371335 -0.1050652,0.745484 -0.1436604,1.122412 -0.038595,0.376926 -0.067795,0.756396 -0.087333,1.138431 -0.019538,0.382037 -0.029456,0.766754 -0.029456,1.153418 0,0.386665 0.00992,0.770865 0.029456,1.152902 0.019538,0.382035 0.048738,0.762022 0.087333,1.138948 0.038595,0.376927 0.086489,0.751076 0.1436604,1.122412 0.057172,0.371337 0.1231708,0.739578 0.1984375,1.104842 0.075267,0.365266 0.1598168,0.727526 0.2526978,1.086239 0.092881,0.358713 0.1943598,0.713888 0.3043742,1.065568 0.1100143,0.35168 0.2283503,0.699698 0.3550171,1.043864 0.1266667,0.344166 0.2617884,0.684439 0.4046264,1.02061 0.1428382,0.336169 0.2936403,0.668627 0.4521688,0.996321 0.1585287,0.327695 0.3244228,0.650712 0.4981608,0.96945 0.1737382,0.318738 0.3551695,0.632763 0.5436361,0.942061 0.1884666,0.3093 0.3843301,0.613742 0.5870443,0.913123 0.2027142,0.299381 0.4124213,0.593654 0.6289022,0.882633 0.2164807,0.288981 0.4394432,0.573012 0.6692098,0.851111 0.2297664,0.2781 0.4664294,0.550267 0.7090006,0.817005 0.2425712,0.266737 0.4913127,0.528002 0.7462077,0.782898 0.2548949,0.254894 0.5156434,0.503637 0.7823812,0.746207 0.2667377,0.242572 0.5394216,0.478717 0.8175211,0.708484 0.2780996,0.229767 0.5616134,0.453246 0.8505944,0.669727 0.288979,0.216481 0.583253,0.426188 0.882633,0.628902 0.299381,0.202714 0.603823,0.398577 0.913123,0.587044 0.309298,0.188467 0.62384,0.369381 0.942578,0.54312 0.318737,0.173737 0.641755,0.340148 0.96945,0.498677 0.327693,0.158529 0.659634,0.309331 0.995805,0.452169 0.336169,0.142838 0.676443,0.277443 1.020609,0.40411 0.344166,0.126665 0.692184,0.24552 1.043864,0.355533 0.304779,0.09534 0.613889,0.181052 0.923975,0.26355 0.08249,0.310063 0.168215,0.618701 0.263549,0.923458 0.110015,0.351679 0.228351,0.699699 0.355018,1.043864 0.126665,0.344165 0.261788,0.684439 0.404626,1.02061 0.142838,0.336169 0.29364,0.668111 0.452169,0.995804 0.158528,0.327694 0.324423,0.65123 0.498161,0.969967 0.173736,0.318737 0.355169,0.632763 0.543636,0.942061 0.188465,0.309299 0.38433,0.613743 0.587044,0.913123 0.202714,0.29938 0.412422,0.593654 0.628902,0.882633 0.216481,0.288981 0.439444,0.573013 0.66921,0.851111 0.229766,0.2781 0.465913,0.550267 0.708484,0.817005 0.242571,0.266736 0.491831,0.528003 0.746724,0.782898 0.254895,0.254893 0.515645,0.503637 0.782381,0.746207 0.266738,0.242571 0.539422,0.478718 0.817522,0.708484 0.278098,0.229766 0.561614,0.453246 0.850594,0.669727 0.288979,0.216479 0.583253,0.426188 0.882633,0.628902 0.29938,0.202714 0.603824,0.398578 0.913123,0.587044 0.309298,0.188467 0.623324,0.369383 0.942061,0.543119 0.318737,0.173738 0.642273,0.34015 0.969967,0.498678 0.327693,0.158528 0.659634,0.309331 0.995805,0.452169 0.336169,0.142838 0.676444,0.277443 1.020609,0.40411 0.344165,0.126665 0.692185,0.245519 1.043864,0.355533 0.351679,0.110015 0.707372,0.211494 1.066085,0.304375 0.358711,0.09288 0.720457,0.176914 1.085722,0.252181 0.365263,0.07527 0.734022,0.141782 1.105359,0.198954 0.371335,0.05717 0.745485,0.105065 1.122412,0.14366 0.376925,0.0386 0.756397,0.0678 1.138431,0.08733 0.382036,0.01954 0.766755,0.02946 1.153418,0.02946 0.386665,0 0.770866,-0.0099 1.152902,-0.02946 0.382034,-0.01954 0.762023,-0.04874 1.138948,-0.08733 0.376927,-0.0386 0.751077,-0.08649 1.122412,-0.14366 0.371336,-0.05717 0.73Line truncated
/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-squares-subtract"><path d="M10 22a2 2 0 0 1-2-2"/><path d="M16 22h-2"/><path d="M16 4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-5a2 2 0 0 1 2-2h5a1 1 0 0 0 1-1z"/><path d="M20 8a2 2 0 0 1 2 2"/><path d="M22 14v2"/><path d="M22 20a2 2 0 0 1-2 2"/></svg>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 478 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="5 5 170 70" stroke="#000"><path fill="none" stroke-linecap="round" stroke-width="4" d="M10 10h60m-60 0h60m0 0v60m0-60v60m0 0H10m60 0H10m0 0V10m0 60V10M141 10c6.47 6.91 12.94 13.83 29 31m-29-31c9.29 9.93 18.57 19.86 29 31m0 0-29 29m29-29-29 29m0 0c-10.49-9.82-20.99-19.64-31-29m31 29c-7.35-6.88-14.71-13.76-31-29m0 0 31-31m-31 31 31-31"/><g stroke-linecap="round"><path fill="none" stroke-width="4" d="M80 40h20m-20 0h20"/><path fill-rule="evenodd" stroke-width="0" d="m100 40-9.06 4.23v-8.46L100 40"/><path fill="none" stroke-width="4" d="M100 40c-3.14 1.47-6.29 2.93-9.06 4.23M100 40c-3.13 1.46-6.27 2.92-9.06 4.23m0 0v-8.46m0 8.46v-8.46m0 0c3.38 1.58 6.76 3.16 9.06 4.23m-9.06-4.23c2.17 1.02 4.34 2.03 9.06 4.23m0 0s0 0 0 0m0 0s0 0 0 0"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-shapes"><path d="M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z"/><rect x="3" y="14" width="7" height="7" rx="1"/><circle cx="17.5" cy="17.5" r="3.5"/></svg>

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 403 B

-15
View File
@@ -1,17 +1,2 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.75819749055177 80.03703336574608" width="72.75819749055177" height="80.03703336574608">
<!-- svg-source:excalidraw -->
<defs>
<style class="style-fonts">
@font-face {
font-family: "Virgil";
src: url("https://excalidraw.com/Virgil.woff2");
}
@font-face {
font-family: "Cascadia";
src: url("https://excalidraw.com/Cascadia.woff2");
}
</style>
</defs>
<g stroke-linecap="round"><g transform="translate(4 4) rotate(0 12.71901889991409 17.183109917454658)"><path d="M0 0 C0 7.02, 0 14.05, 0 34.37 M0 34.37 C7.62 34.37, 15.24 34.37, 25.44 34.37" stroke="black" stroke-width="4.5" fill="none" stroke-dasharray="1.5 10"></path></g></g><mask></mask><g stroke-linecap="round"><g transform="translate(51.379765518092086 61.93633577499986) rotate(0 5.684341886080802e-14 7.050348795373111)"><path d="M0 0 C0 4.06, 0 8.11, 0 14.1" stroke="black" stroke-width="4.5" fill="none" stroke-dasharray="1.5 10"></path></g></g><mask></mask><g stroke-linecap="round" transform="translate(34.0013341989918 20.987787610339183) rotate(0 17.378431645779926 17.378431645779983)"><path d="M34.76 17.38 C34.76 18.38, 34.67 19.41, 34.49 20.4 C34.32 21.39, 34.05 22.38, 33.71 23.32 C33.36 24.27, 32.93 25.2, 32.43 26.07 C31.93 26.94, 31.34 27.78, 30.69 28.55 C30.04 29.32, 29.32 30.04, 28.55 30.69 C27.78 31.34, 26.94 31.93, 26.07 32.43 C25.2 32.93, 24.27 33.36, 23.32 33.71 C22.38 34.05, 21.39 34.32, 20.4 34.49 C19.41 34.67, 18.38 34.76, 17.38 34.76 C16.37 34.76, 15.35 34.67, 14.36 34.49 C13.37 34.32, 12.38 34.05, 11.43 33.71 C10.49 33.36, 9.56 32.93, 8.69 32.43 C7.82 31.93, 6.98 31.34, 6.21 30.69 C5.44 30.04, 4.71 29.32, 4.07 28.55 C3.42 27.78, 2.83 26.94, 2.33 26.07 C1.83 25.2, 1.39 24.27, 1.05 23.32 C0.7 22.38, 0.44 21.39, 0.26 20.4 C0.09 19.41, 0 18.38, 0 17.38 C0 16.37, 0.09 15.35, 0.26 14.36 C0.44 13.37, 0.7 12.38, 1.05 11.43 C1.39 10.49, 1.83 9.56, 2.33 8.69 C2.83 7.82, 3.42 6.98, 4.07 6.21 C4.71 5.44, 5.44 4.71, 6.21 4.07 C6.98 3.42, 7.82 2.83, 8.69 2.33 C9.56 1.83, 10.49 1.39, 11.43 1.05 C12.38 0.7, 13.37 0.44, 14.36 0.26 C15.35 0.09, 16.37 0, 17.38 0 C18.38 0, 19.41 0.09, 20.4 0.26 C21.39 0.44, 22.38 0.7, 23.32 1.05 C24.27 1.39, 25.2 1.83, 26.07 2.33 C26.94 2.83, 27.78 3.42, 28.55 4.07 C29.32 4.71, 30.04 5.44, 30.69 6.21 C31.34 6.98, 31.93 7.82, 32.43 8.69 C32.93 9.56, 33.36 10.49, 33.71 11.43 C34.05 12.38, 34.32 13.37, 34.49 14.36 C34.67 15.35, 34.71 16.88, 34.76 17.38 C34.8 17.88, 34.8 16.88, 34.76 17.38" stroke="black" stroke-width="4" fill="none"></path></g><g stroke-linecap="round"><g transform="translate(41.72257566145686 38.36621939788711) rotate(0 9.65718949485347 0)"><path d="M0 0 C4.11 0, 8.22 0, 19.31 0 M0 0 C6.95 0, 13.9 0, 19.31 0" stroke="black" stroke-width="4" fill="none"></path></g></g><mask></mask><g stroke-linecap="round"><g transform="translate(41.72257587602678 38.36622004108449) rotate(89.99999999999994 9.65718949485347 0)"><path d="M0 0 C5.31 0, 10.62 0, 19.31 0 M0 0 C4.56 0, 9.13 0, 19.31 0" stroke="black" stroke-width="4" fill="none"></path></g></g><mask></mask></svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M480 256c-17.67 0-32 14.31-32 32c0 52.94-43.06 96-96 96H192L192 344c0-9.469-5.578-18.06-14.23-21.94C169.1 318.3 159 319.8 151.9 326.2l-80 72C66.89 402.7 64 409.2 64 416s2.891 13.28 7.938 17.84l80 72C156.4 509.9 162.2 512 168 512c3.312 0 6.615-.6875 9.756-2.062C186.4 506.1 192 497.5 192 488L192 448h160c88.22 0 160-71.78 160-160C512 270.3 497.7 256 480 256zM160 128h159.1L320 168c0 9.469 5.578 18.06 14.23 21.94C337.4 191.3 340.7 192 343.1 192c5.812 0 11.57-2.125 16.07-6.156l80-72C445.1 109.3 448 102.8 448 95.1s-2.891-13.28-7.938-17.84l-80-72c-7.047-6.312-17.19-7.875-25.83-4.094C325.6 5.938 319.1 14.53 319.1 24L320 64H160C71.78 64 0 135.8 0 224c0 17.69 14.33 32 32 32s32-14.31 32-32C64 171.1 107.1 128 160 128z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-repeat"><path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/></svg>

Before

Width:  |  Height:  |  Size: 794 B

After

Width:  |  Height:  |  Size: 341 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M224 0H336C362.5 0 384 21.49 384 48V256H0V48C0 21.49 21.49 0 48 0H64L96 64L128 0H160L192 64L224 0zM384 288V320C384 355.3 355.3 384 320 384H256V448C256 483.3 227.3 512 192 512C156.7 512 128 483.3 128 448V384H64C28.65 384 0 355.3 0 320V288H384zM192 464C200.8 464 208 456.8 208 448C208 439.2 200.8 432 192 432C183.2 432 176 439.2 176 448C176 456.8 183.2 464 192 464z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-paintbrush-vertical"><path d="M10 2v2"/><path d="M14 2v4"/><path d="M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z"/><path d="M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1"/></svg>

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 452 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-squircle"><path fill="none" d="M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-squircle"><path fill="none" d="M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9"/></svg>

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 296 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scan-search"><g stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><circle cx="12" cy="12" r="3"/><path d="m16 16-1.9-1.9"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-scan-search"><g stroke-width="2"><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><circle cx="12" cy="12" r="3"/><path d="m16 16-1.9-1.9"/></g></svg>

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 446 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="120 30 500 500" stroke="#000"><path d="M365.4 56a224.009 224.009 0 0 0-158.39 65.609 223.994 223.994 0 0 0 0 316.78 224.001 224.001 0 0 0 158.39 65.609c59.41 0 116.39-23.602 158.39-65.609a223.99 223.99 0 0 0 65.605-158.39c0-39.32-10.348-77.949-30.008-112s-47.938-62.328-81.992-81.988a224 224 0 0 0-112-30.012zm92.398 243.6h-72.801v72.801l.004-.004a19.602 19.602 0 0 1-39.2 0v-72.8h-72.8v.003a19.6 19.6 0 0 1-16.974-9.8 19.59 19.59 0 0 1 0-19.603c3.5-6.062 9.97-9.8 16.973-9.8h72.801v-72.802.004a19.602 19.602 0 0 1 39.2 0V260.4h72.8v-.004a19.604 19.604 0 0 1 16.974 29.403 19.604 19.604 0 0 1-16.973 9.801z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-moon"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/></svg>

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 338 B

@@ -7,8 +7,9 @@ Select some elements in the scene. The script will take these elements and move
<a href="https://www.youtube.com/watch?v=mvMQcz401yo" target="_blank"><img src ="https://i.ytimg.com/vi/mvMQcz401yo/maxresdefault.jpg" style="width:560px;"></a>
```javascript
```js
*/
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.7.3")) {
new Notice("This script requires a newer version of Excalidraw. Please install the latest version.");
return;
@@ -21,16 +22,57 @@ const excalidrawTemplates = ea.getListOfTemplateFiles();
if(typeof window.ExcalidrawDeconstructElements === "undefined") {
window.ExcalidrawDeconstructElements = {
openDeconstructedImage: true,
templatePath: excalidrawTemplates?.[0].path??""
reuseTab: true,
templatePath: excalidrawTemplates?.[0]?.path??""
};
} else if (typeof window.ExcalidrawDeconstructElements.reuseTab === "undefined") {
window.ExcalidrawDeconstructElements.reuseTab = true;
}
const splitFolderAndFilename = (filepath) => {
const lastIndex = filepath.lastIndexOf("/");
return {
foldername: ea.obsidian.normalizePath(filepath.substring(0, lastIndex)),
filename: (lastIndex == -1 ? filepath : filepath.substring(lastIndex + 1)) + ".md"
};
// Helper class for Folder Autocomplete
class FolderSuggest extends ea.obsidian.AbstractInputSuggest {
constructor(app, inputEl) {
super(app, inputEl);
this.inputEl = inputEl;
}
getSuggestions(query) {
const folders = app.vault.getAllLoadedFiles().filter(f => f instanceof ea.obsidian.TFolder);
const lowerQuery = query.toLowerCase();
// Filter folders that match the query
const matches = folders.filter(f => f.path.toLowerCase().includes(lowerQuery));
// Custom Sort
matches.sort((a, b) => {
const aPath = a.path;
const bPath = b.path;
const aLower = aPath.toLowerCase();
const bLower = bPath.toLowerCase();
// Priority 1: Starts with query (e.g. "Projects" comes before "Hobbies/Projects")
const aStarts = aLower.startsWith(lowerQuery);
const bStarts = bLower.startsWith(lowerQuery);
if (aStarts && !bStarts) return -1;
if (!aStarts && bStarts) return 1;
// Priority 2: Alphabetical
return aPath.localeCompare(bPath);
});
return matches.map(f => f.path);
}
renderSuggestion(value, el) {
el.setText(value);
}
selectSuggestion(value, evt) {
this.inputEl.value = value;
this.inputEl.dispatchEvent(new Event('input'));
this.close();
}
}
let settings = ea.getScriptSettings();
@@ -76,12 +118,13 @@ if (els.length === 0) {
const bb = ea.getBoundingBox(els);
ea.copyViewElementsToEAforEditing(els);
// Handle Image elements logic from original script
ea.getElements().filter(el=>el.type==="image").forEach(el=>{
const img = ea.targetView.excalidrawData.getFile(el.fileId);
const path = (img?.linkParts?.original)??(img?.file?.path);
const hyperlink = img?.hyperlink;
if(img && (path || hyperlink)) {
const colorMap = ea.getColorMapForImageElement(el);
const colorMap = ea.getColorMapForImageElement(el);
ea.imagesDict[el.fileId] = {
mimeType: img.mimeType,
id: el.fileId,
@@ -96,7 +139,7 @@ ea.getElements().filter(el=>el.type==="image").forEach(el=>{
return;
}
const equation = ea.targetView.excalidrawData.getEquation(el.fileId);
eqImg = ea.targetView.getScene()?.files[el.fileId]
const eqImg = ea.targetView.getScene()?.files[el.fileId]
if(equation && eqImg) {
ea.imagesDict[el.fileId] = {
mimeType: eqImg.mimeType,
@@ -112,28 +155,107 @@ ea.getElements().filter(el=>el.type==="image").forEach(el=>{
});
// ------------
// Input prompt
// ------------
let shouldAnchor = false;
const actionButtons = [
{
caption: "Insert @100%",
tooltip: "Anchor to 100% size",
action: () => {
shouldAnchor = true;
}
},
{
caption: "Insert",
tooltip: "Insert without anchoring",
action: () => {
shouldAnchor = false;
}
}];
// ----------------------
// Execution Logic
// ----------------------
const executeDeconstruction = async (folderPath, fileName, shouldAnchor) => {
// Ensure filename has extension
if (!fileName.endsWith(".md")) fileName += ".md";
// Construct full path
// normalizePath handles cases where folderPath might be empty or root
const fullPath = ea.obsidian.normalizePath(`${folderPath}/${fileName}`);
// Separate back into folder and filename for ea.create
const pathParts = fullPath.split("/");
const finalFileName = pathParts.pop();
const finalFolderName = pathParts.join("/");
const customControls = (container) => {
new ea.obsidian.Setting(container)
// We use silent: true to prevent ea.create from opening the file automatically.
// We handle opening manually based on user preference.
const newPath = await ea.create ({
filename: finalFileName,
foldername: finalFolderName,
templatePath: window.ExcalidrawDeconstructElements.templatePath,
onNewPane: true,
silent: true
});
let f = app.vault.getAbstractFileByPath(newPath);
let counter = 0;
while((!f || !ea.isExcalidrawFile(f)) && counter++<100) {
await sleep(50);
f = app.vault.getAbstractFileByPath(newPath);
}
if(!f || !ea.isExcalidrawFile(f)) {
new Notice("Something went wrong");
return;
}
let padding = parseFloat(app.metadataCache.getCache(f.path)?.frontmatter["excalidraw-export-padding"]);
if(isNaN(padding)) {
padding = ea.plugin.settings.exportPaddingSVG;
}
// Remove elements from current view and replace with image of new file
ea.getElements().forEach(el=>el.isDeleted = true);
await ea.addImage(bb.topX-padding, bb.topY-padding, f, false, shouldAnchor);
await ea.addElementsToView(false, true, true);
ea.getExcalidrawAPI().history.clear();
if(window.ExcalidrawDeconstructElements.openDeconstructedImage) {
const reuse = window.ExcalidrawDeconstructElements.reuseTab;
if (reuse) {
ea.openFileInNewOrAdjacentLeaf(f);
} else {
// Force new tab
await app.workspace.getLeaf('tab').openFile(f);
}
} else {
new Notice("Deconstruction ready");
}
};
// ----------------------
// Floating Modal UI
// ----------------------
const modal = new ea.FloatingModal(ea.plugin.app);
modal.titleEl.setText("Deconstruct Elements");
modal.onOpen = () => {
const content = modal.contentEl;
content.empty();
// -- Folder Path Input --
const folderDiv = content.createDiv({ cls: "setting-item" });
folderDiv.createDiv({ cls: "setting-item-info" }).createEl("label", { text: "Folder path" });
const folderControl = folderDiv.createDiv({ cls: "setting-item-control" });
const folderInput = new ea.obsidian.TextComponent(folderControl);
// Set default folder to current file's parent
const currentFolder = ea.targetView.file.parent.path;
folderInput.setValue(currentFolder);
folderInput.inputEl.style.width = "100%";
// Attach Autocomplete
new FolderSuggest(ea.plugin.app, folderInput.inputEl);
// -- Filename Input --
const fileDiv = content.createDiv({ cls: "setting-item" });
fileDiv.createDiv({ cls: "setting-item-info" }).createEl("label", { text: "File name" });
const fileControl = fileDiv.createDiv({ cls: "setting-item-control" });
const fileInput = new ea.obsidian.TextComponent(fileControl);
fileInput.setValue(DEFAULT_FILENAME);
fileInput.inputEl.style.width = "100%";
// Set focus to file input
setTimeout(() => fileInput.inputEl.focus(), 50);
// -- Template Dropdown --
new ea.obsidian.Setting(content)
.setName(`Select template`)
.addDropdown(dropdown => {
templates.forEach(file => dropdown.addOption(file.path, file.basename));
@@ -143,64 +265,67 @@ const customControls = (container) => {
.onChange(value => {
window.ExcalidrawDeconstructElements.templatePath = value;
})
})
});
new ea.obsidian.Setting(container)
// -- Open Toggle --
new ea.obsidian.Setting(content)
.setName(`Open deconstructed image`)
.addToggle((toggle) => toggle
.setValue(window.ExcalidrawDeconstructElements.openDeconstructedImage)
.onChange(value => {
window.ExcalidrawDeconstructElements.openDeconstructedImage = value;
// Update visibility of the sub-toggle
reuseSetting.settingEl.style.display = value ? "" : "none";
})
)
}
);
const path = await utils.inputPrompt(
"Filename for new file",
"Filename",
await ea.getAttachmentFilepath(DEFAULT_FILENAME),
actionButtons,
2,
false,
customControls
);
// -- Reuse Tab Toggle --
const reuseSetting = new ea.obsidian.Setting(content)
.setName(`Reuse existing tab`)
.setDesc("If available, open in an adjacent tab. Otherwise open in a new tab.")
.setClass("reuse-tab-setting")
.addToggle((toggle) => toggle
.setValue(window.ExcalidrawDeconstructElements.reuseTab)
.onChange(value => {
window.ExcalidrawDeconstructElements.reuseTab = value;
})
);
// Initialize visibility and style
reuseSetting.settingEl.style.display = window.ExcalidrawDeconstructElements.openDeconstructedImage ? "" : "none";
reuseSetting.settingEl.style.borderTop = "none";
// -- Buttons --
const buttonContainer = content.createDiv({ cls: "excalidraw-dialog-buttons", style: "margin-top: 20px; display: flex; gap: 12px; justify-content: flex-end;" });
const btnInsert = new ea.obsidian.ButtonComponent(buttonContainer)
.setButtonText("Insert")
.setTooltip("Insert without anchoring")
.onClick(async () => {
const folder = folderInput.getValue();
const filename = fileInput.getValue();
if (!filename) {
new Notice("Filename is required");
return;
}
modal.close();
await executeDeconstruction(folder, filename, false);
});
if(!path) return;
const btnInsertAnchor = new ea.obsidian.ButtonComponent(buttonContainer)
.setButtonText("Insert @100%")
.setTooltip("Anchor to 100% size")
.setCta()
.onClick(async () => {
const folder = folderInput.getValue();
const filename = fileInput.getValue();
if (!filename) {
new Notice("Filename is required");
return;
}
modal.close();
await executeDeconstruction(folder, filename, true);
});
};
// ----------------------
// Execute deconstruction
// ----------------------
const {foldername, filename} = splitFolderAndFilename(path);
const newPath = await ea.create ({
filename,
foldername,
templatePath: window.ExcalidrawDeconstructElements.templatePath,
onNewPane: true,
silent: !window.ExcalidrawDeconstructElements.openDeconstructedImage
});
let f = app.vault.getAbstractFileByPath(newPath);
let counter = 0;
while((!f || !ea.isExcalidrawFile(f)) && counter++<100) {
await sleep(50);
f = app.vault.getAbstractFileByPath(newPath);
}
if(!f || !ea.isExcalidrawFile(f)) {
new Notice("Something went wrong");
return;
}
let padding = parseFloat(app.metadataCache.getCache(f.path)?.frontmatter["excalidraw-export-padding"]);
if(isNaN(padding)) {
padding = ea.plugin.settings.exportPaddingSVG;
}
ea.getElements().forEach(el=>el.isDeleted = true);
await ea.addImage(bb.topX-padding,bb.topY-padding,f,false, shouldAnchor);
await ea.addElementsToView(false, true, true);
ea.getExcalidrawAPI().history.clear();
if(!window.ExcalidrawDeconstructElements.openDeconstructedImage) {
new Notice("Deconstruction ready");
}
modal.open();
+64 -14
View File
@@ -6,12 +6,23 @@ You can download the sample Obsidian Templater file from [here](https://gist.git
You can download the demo PDF document showcased in the video from [here](https://zsviczian.github.io/DemoArticle-AtomicHabits.pdf)
```js*/
const selectedElements = ea.getViewSelectedElements();
if (selectedElements.length !== 1 || selectedElements[0].type === "arrow") {
if (!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.20.2")) {
new Notice("Please update the Excalidraw Plugin to version 2.20.2 or higher.");
return;
}
let selectedElements = ea.getViewSelectedElements();
const selectedTextElement = ea.getBoundTextElement(selectedElements, true)?.sceneElement;
if ((!selectedTextElement && selectedElements.length !== 1) || selectedElements[0].type === "arrow") {
new Notice("Select a single element that is not an arrow and not a frame");
return;
}
// Detect Mindmap Builder nodes
const startNode = selectedElements[0];
const isMindMap = typeof startNode.customData?.growthMode !== "undefined" || typeof startNode.customData?.mindmapOrder !== "undefined";
const visited = new Set(); // Avoiding recursive infinite loops
delete window.ewm;
@@ -111,9 +122,8 @@ function getImageLink(f) {
}
function getBoundText(el) {
const textId = el.boundElements?.find(x => x.type === "text")?.id;
const text = ea.getViewElements().find(x => x.id === textId)?.originalText;
return text ? text + "\n" : "";
const text = ea.getBoundTextElement(el,true)?.sceneElement?.rawText;
return text ? text + "\n" : "";
}
async function getSectionText(file, section) {
@@ -174,8 +184,9 @@ async function getBlockText(file, blockref) {
}
async function getElementText(el) {
if (el.type === "text") {
return el.originalText;
const maybeTextEl = ea.getBoundTextElement(el,true)?.sceneElement;
if (maybeTextEl) {
return maybeTextEl.rawText;
}
if (el.type === "image") {
const f = ea.getViewFileForImageElement(el);
@@ -213,16 +224,55 @@ async function crawl(el, level, isFirst = false) {
visited.add(el.id);
let result = await getElementText(el) + "\n";
let itemsToTraverse = [];
// Process all arrows connected to this element
const boundElementsData = el.boundElements.filter(x => x.type === "arrow");
const isFork = boundElementsData.length > (isFirst ? 1 : 2);
if (isMindMap) {
// --- Mindmap Traversal Logic ---
// 1. Get all elements to lookup connections
const allElements = ea.getViewElements();
// 2. Find outgoing arrows marked as branches
const branchArrows = allElements.filter(a =>
a.type === "arrow" &&
a.customData?.isBranch &&
a.startBinding?.elementId === el.id // Only traverse downwards (Parent -> Child)
);
// 3. Map arrows to their target nodes for sorting
const childNodes = branchArrows.map(arrow => {
const node = allElements.find(e => e.id === arrow.endBinding?.elementId);
return { arrow, nextEl: node };
}).filter(x => x.nextEl); // Safety check
// 4. Sort by mindmapOrder (visual order)
childNodes.sort((a, b) => {
const orderA = a.nextEl.customData?.mindmapOrder ?? 0;
const orderB = b.nextEl.customData?.mindmapOrder ?? 0;
return orderA - orderB;
});
itemsToTraverse = childNodes;
} else {
// --- Standard Traversal Logic (Legacy) ---
// Use boundElements (incoming and outgoing) in creation order
const boundElementsData = el.boundElements?.filter(x => x.type === "arrow") || [];
itemsToTraverse = boundElementsData.map(bindingData => {
const arrow = ea.getViewElements().find(x => x.id === bindingData.id);
if (!arrow) return null;
const nextEl = getNextElementFollowingArrow(el, arrow);
return { arrow, nextEl };
}).filter(x => x && x.nextEl);
}
// Determine indentation trigger (Fork)
const isFork = itemsToTraverse.length > (isFirst ? 1 : 2);
if(isFork) level++;
for(const bindingData of boundElementsData) {
const arrow = ea.getViewElements().find(x=> x.id === bindingData.id);
const nextEl = getNextElementFollowingArrow(el, arrow);
if (nextEl && !visited.has(nextEl.id)) {
// Recursive Traversal
for(const {arrow, nextEl} of itemsToTraverse) {
if (!visited.has(nextEl.id)) {
if(isFork) result += `\n${"#".repeat(level)} `;
const arrowLabel = getBoundText(arrow);
if (arrowLabel) {
+1 -2
View File
@@ -1,2 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 376.3492303436433 256.64929991179815" stroke="#000">
<g stroke-linecap="round" transform="translate(10 10) rotate(0 58.5858154296875 58.5858154296875)"><path d="M-1.64 1.57 C38.67 2.87, 77.63 0.2, 117.31 1.14 M-0.05 -0.5 C40.75 0.3, 82.48 0.12, 118.09 0.99 M116.67 0.11 C118.02 47.69, 116.43 92.18, 118.63 118.15 M117.41 0.39 C116.57 38.93, 117.51 79.53, 116.57 116.49 M118.65 117.22 C92.96 119.01, 66.56 117.46, -0.42 117.17 M117.21 116.56 C91.43 117.53, 63.4 117.03, -0.23 117.71 M1.5 116.9 C-2.3 91.83, 1.37 68.12, -0.05 -0.85 M-0.84 116.86 C-1.03 87.92, -0.86 61.1, 0.54 0.72" stroke-width="2" fill="none"></path></g><g stroke-linecap="round" transform="translate(128.96603337932902 10.2586194164669) rotate(0 58.5858154296875 58.5858154296875)"><path d="M0.05 1.78 C24.68 -1.8, 48.73 0.22, 118.17 0.33 M-0.27 0.22 C34.72 0.61, 69.52 1.58, 118.12 0.36 M117.6 1.43 C115.71 34.53, 118.33 70.74, 117.89 116.98 M116.68 -0.46 C117.9 41.7, 116.85 81.21, 116.34 117.29 M118.4 119.11 C83.22 117.59, 48.31 117.2, -1.44 117.99 M118.15 116.77 C74.14 115.56, 31.55 116.99, -0.96 117.69 M-1.69 115.77 C1.1 78.33, -0.93 41, -1.14 1.03 M-0.43 116.37 C0.72 90.14, 1.52 62.17, 0.55 -0.66" stroke-width="2" fill="none"></path></g><g stroke-linecap="round" transform="translate(248.3020093440573 10.465294492851172) rotate(0 58.5858154296875 58.5858154296875)"><path d="M0.39 -0.88 C44.51 0.1, 89.74 -0.71, 117.03 -0.11 M0.42 0.03 C30.22 0.74, 59.56 0.11, 117.15 -0.25 M116 -0.35 C118.88 36.78, 118.14 71.41, 118.16 117.65 M117.62 0.75 C115.99 39.07, 115.76 79.63, 117.09 117.91 M117.44 117.56 C81.29 118.3, 44.81 119.12, 1.29 117.25 M116.84 116.27 C88.98 117.24, 60.29 117.22, 0.21 117.92 M1.97 115.99 C0.94 82.75, -0.15 51.05, -1.24 -1.67 M-0.26 118 C1.05 86.36, 1.06 53.45, 0.95 0.65" stroke-width="2" fill="none"></path></g><g stroke-linecap="round" transform="translate(10.875590140210988 129.01237455957016) rotate(0 58.5858154296875 58.5858154296875)"><path d="M0.24 -0.16 C29.59 1.02, 57.45 2.91, 117.44 0.38 M0.41 0.64 C32.74 0.23, 66.39 0.45, 116.84 -0.9 M118.21 0.43 C119.3 32.21, 116.11 63.55, 119.15 115.99 M117.68 -0.62 C115.84 34.54, 116.24 68.9, 116.91 118 M115.86 119.08 C76.96 118.61, 32.48 117.59, -1.75 116.45 M117.39 116.77 C85.7 116.42, 54.91 116.16, 0.1 118.13 M-0.18 118.45 C-0.52 71.18, -0.96 24.41, 1.23 0.16 M0.3 117.66 C0.57 92.18, 0.07 65.33, -0.4 0.17" stroke-width="2" fill="none"></path></g><g stroke-linecap="round" transform="translate(129.84162351954 129.27099397603888) rotate(0 58.5858154296875 58.5858154296875)"><path d="M-0.16 1.48 C27.24 1.09, 56.31 0.13, 117.56 -0.42 M0.64 0.04 C34.52 0.5, 69.88 -0.81, 116.27 -0.23 M117.6 1.5 C115.78 39.75, 114.64 84.85, 115.99 117.12 M116.55 -0.84 C116.19 29.74, 115.7 60.09, 118 117.71 M119.08 118.46 C74.37 114.72, 29.76 114.66, -0.72 116.45 M116.77 116.64 C81.73 117.03, 46.47 117.52, 0.96 118.05 M1.28 117.07 C0.37 77.34, -0.95 39.83, 0.16 -1.64 M0.49 117.63 C0.17 83.07, -1.11 48.64, 0.17 0.23" stroke-width="2" fill="none"></path></g><g stroke-linecap="round" transform="translate(249.17759948426828 129.47766905242315) rotate(0 58.5858154296875 58.5858154296875)"><path d="M1.48 0.05 C26.67 2.03, 51.16 0.48, 116.75 0 M0.04 -0.61 C27.7 -1.15, 53.12 -1.65, 116.94 0.54 M118.67 -0.27 C116.09 22.53, 119.75 46.69, 117.12 116.32 M116.34 -0.31 C117.34 27.65, 117.51 57.73, 117.71 117.89 M118.46 117.96 C73.87 118.06, 32.19 117.57, -0.72 117.14 M116.64 116.71 C84.55 115.98, 52.82 117.66, 0.88 117.52 M-0.11 116.63 C-0.44 89.26, 1.33 65.24, -1.64 -0.19 M0.46 117.75 C-0.38 77.25, -0.75 38.91, 0.23 0.69" stroke-width="2" fill="none"></path></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-layout-grid"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 415 B

+1 -13
View File
@@ -1,13 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path stroke-width="2" fill="none" d="M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8z"></path>
<path stroke-width="2" fill="none" d="M12 8a2.828 2.828 0 1 0 4 4"></path>
<path stroke-width="2" fill="none" d="M12 2v2"></path>
<path stroke-width="2" fill="none" d="M12 20v2"></path>
<path stroke-width="2" fill="none" d="m4.93 4.93 1.41 1.41"></path>
<path stroke-width="2" fill="none" d="m17.66 17.66 1.41 1.41"></path>
<path stroke-width="2" fill="none" d="M2 12h2"></path>
<path stroke-width="2" fill="none" d="M20 12h2"></path>
<path stroke-width="2" fill="none" d="m6.34 17.66-1.41 1.41"></path>
<path stroke-width="2" fill="none" d="m19.07 4.93-1.41 1.41"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-sun-moon"><path d="M12 2v2"/><path d="M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715"/><path d="M16 12a4 4 0 0 0-4-4"/><path d="m19 5-1.256 1.256"/><path d="M20 12h2"/></svg>

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 444 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="50 -20 600 600"><path d="M350 0c-74.262 0-145.48 29.5-197.99 82.012a279.995 279.995 0 0 0 0 395.98 279.995 279.995 0 0 0 395.98 0 279.995 279.995 0 0 0 0-395.98A279.992 279.992 0 0 0 350 0zm140 324.8H210v-89.602h280z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-sun"><circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/></svg>

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 456 B

+1 -24
View File
@@ -1,24 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50.097575068473816 56.100231877975375" width="50.097575068473816" height="56.100231877975375" class="excalidraw-svg">
<!-- Linear calendar icon (same size/viewBox as original) -->
<g stroke="#1e1e1e" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none">
<!-- Binding rings -->
<path d="M16 3 L16 12" />
<path d="M34.5 3 L34.5 12" />
<!-- Outer calendar body -->
<rect x="4" y="9" width="42.097575068473816" height="44.100231877975375" rx="5" ry="5" />
<!-- Header separator -->
<path d="M4 19 L46.097575068473816 19" />
<!-- A single highlighted date block -->
<rect x="10" y="23" width="8" height="8" rx="1.5" ry="1.5" />
<!-- Linear agenda lines -->
<path d="M22 27 L42 27" />
<path d="M10 35 L42 35" />
<path d="M10 43 L42 43" />
<path d="M10 51 L30 51" />
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-calendar-days"><path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/><path d="M8 14h.01"/><path d="M12 14h.01"/><path d="M16 14h.01"/><path d="M8 18h.01"/><path d="M12 18h.01"/><path d="M16 18h.01"/></svg>

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 461 B

+45
View File
@@ -0,0 +1,45 @@
async function compress () {
ea = ExcalidrawAutomate;
const f = app.workspace.activeLeaf.view.file;
const data = await app.vault.read(f);
const compressed = ea.compressToBase64(data);
let result = '';
const chunkSize = 256;
for (let i = 0; i < compressed.length; i += chunkSize) {
result += compressed.slice(i, i + chunkSize) + '\n\n';
}
await app.vault.modify(f,`/*
# Mind Map Builder: Technical Specification & User Guide
## Overview
**Mind Map Builder** transforms the Obsidian-Excalidraw canvas into a rapid brainstorming environment, allowing users to build complex, structured, and visually organized mind maps using primarily keyboard shortcuts.
The script balances **automation** (auto-layout, recursive grouping, and contrast-aware coloring) with **explicit flexibility** (node pinning and redirection logic), ensuring that the mind map stays organized even as it grows to hundreds of nodes. It leverages the Excalidraw Sidepanel API to provide a persistent control interface utilizing the Obsidian sidepanel, that can also be undocked into a floating modal.
> [!Note]
> Mindmap Builder is Minified for reasons of size and performance. You can find the source here: [Mindmap Builder.js](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.js)
\`\`\`js*/
if (!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.19.0")) {
new Notice("Please update the Excalidraw Plugin to version 2.19.0 or higher.");
return;
}
const existingTab = ea.checkForActiveSidepanelTabForScript();
if (existingTab) {
const hostEA = existingTab.getHostEA();
if (hostEA && hostEA !== ea) {
hostEA.activateMindmap = true;
hostEA.setView(ea.targetView);
existingTab.open();
return;
}
};
const mmbSource = \`${result}\`;
const script = ea.decompressFromBase64(mmbSource.replaceAll("\\n", "").trim())
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
await new AsyncFunction("ea", "utils", script)(ea, utils);
`);
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="skip"><path d="m11 19-1.106-.552a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0l4.212 2.106a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619V12"/><path d="M15 5.764V12"/><path d="M18 15v6"/><path d="M21 18h-6"/><path d="M9 3.236v15"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-map-plus"><path d="m11 19-1.106-.552a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0l4.212 2.106a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619V12"/><path d="M15 5.764V12"/><path d="M18 15v6"/><path d="M21 18h-6"/><path d="M9 3.236v15"/></svg>

Before

Width:  |  Height:  |  Size: 485 B

After

Width:  |  Height:  |  Size: 505 B

+2 -17
View File
@@ -1,17 +1,2 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 297.0049715909092 210.33238636363632" width="297.0049715909092" height="210.33238636363632">
<!-- svg-source:excalidraw -->
<defs>
<style class="style-fonts">
@font-face {
font-family: "Virgil";
src: url("https://excalidraw.com/Virgil.woff2");
}
@font-face {
font-family: "Cascadia";
src: url("https://excalidraw.com/Cascadia.woff2");
}
</style>
</defs>
<rect x="0" y="0" width="297.0049715909092" height="210.33238636363632" fill="#ffffff"></rect><g transform="translate(120.73437500000006 90.6171875) rotate(0 -55.24325284090909 -43.80859375)" stroke="none"><path d="M -14.07,7.96 Q -14.07,7.96 -15.48,4.09 -16.89,0.22 -18.99,-3.55 -21.09,-7.33 -24.13,-12.89 -27.17,-18.45 -30.14,-24.36 -33.10,-30.28 -35.37,-34.93 -37.64,-39.59 -40.51,-44.80 -43.37,-50.02 -46.11,-53.71 -48.86,-57.40 -52.16,-60.58 -55.46,-63.76 -60.35,-67.14 -65.24,-70.53 -69.99,-72.77 -74.74,-75.00 -80.08,-76.54 -85.41,-78.08 -91.27,-78.91 -97.12,-79.74 -103.29,-80.06 -109.47,-80.38 -110.38,-80.46 -111.29,-80.55 -112.12,-80.91 -112.96,-81.28 -113.64,-81.90 -114.31,-82.52 -114.76,-83.32 -115.20,-84.12 -115.36,-85.02 -115.53,-85.92 -115.40,-86.82 -115.27,-87.73 -114.85,-88.54 -114.44,-89.36 -113.79,-90.00 -113.13,-90.64 -112.31,-91.04 -111.49,-91.44 -110.58,-91.55 -109.67,-91.67 -108.78,-91.49 -107.88,-91.31 -107.09,-90.85 -106.30,-90.39 -105.69,-89.71 -105.09,-89.02 -104.73,-88.18 -104.38,-87.34 -104.31,-86.42 -104.25,-85.51 -104.47,-84.63 -104.70,-83.74 -105.20,-82.97 -105.70,-82.21 -106.42,-81.64 -107.14,-81.07 -108.00,-80.77 -108.86,-80.46 -109.77,-80.44 -110.69,-80.43 -111.56,-80.70 -112.43,-80.98 -113.17,-81.52 -113.91,-82.06 -114.44,-82.81 -114.96,-83.55 -115.22,-84.43 -115.48,-85.31 -115.45,-86.22 -115.42,-87.13 -115.09,-87.99 -114.77,-88.84 -114.19,-89.55 -113.61,-90.26 -112.84,-90.75 -112.06,-91.23 -111.17,-91.44 -110.28,-91.66 -110.29,-91.66 -110.29,-91.66 -104.12,-93.28 -97.96,-94.90 -91.98,-95.45 -85.99,-96.00 -81.46,-95.64 -76.92,-95.29 -68.61,-93.08 -60.30,-90.88 -54.63,-88.23 -48.96,-85.58 -45.26,-83.31 -41.56,-81.05 -36.47,-77.03 -31.37,-73.00 -27.42,-68.77 -23.47,-64.54 -19.02,-58.37 -14.56,-52.20 -11.80,-47.74 -9.05,-43.29 -5.96,-38.13 -2.87,-32.97 0.60,-27.54 4.09,-22.12 6.49,-18.24 8.89,-14.36 11.48,-11.16 14.07,-7.96 14.81,-6.16 15.56,-4.36 15.86,-2.43 16.15,-0.51 15.98,1.43 15.81,3.37 15.17,5.21 14.54,7.05 13.48,8.69 12.43,10.33 11.01,11.67 9.59,13.00 7.90,13.96 6.20,14.92 4.33,15.45 2.45,15.98 0.50,16.04 -1.44,16.10 -3.34,15.69 -5.25,15.29 -7.00,14.43 -8.76,13.58 -10.25,12.34 -11.75,11.09 -12.91,9.52 -14.07,7.96 -14.07,7.96 L -14.07,7.96 Z"></path></g><g transform="translate(164.26775568181824 144.2109375) rotate(0 61.39737215909091 31.56072443181816)" stroke="none"><path d="M 15.66,-4.01 Q 15.66,-4.01 16.13,-0.20 16.61,3.60 17.59,8.51 18.58,13.41 19.95,17.45 21.33,21.49 24.37,24.74 27.42,27.99 31.19,30.37 34.96,32.74 39.20,35.13 43.45,37.52 48.43,39.69 53.42,41.86 58.89,43.75 64.36,45.65 70.65,46.93 76.94,48.20 82.07,49.37 87.20,50.54 94.31,51.57 101.42,52.61 105.80,53.22 110.19,53.84 116.30,55.50 122.42,57.17 123.33,57.43 124.24,57.70 125.02,58.24 125.80,58.78 126.36,59.54 126.93,60.30 127.22,61.20 127.51,62.11 127.50,63.05 127.49,64.00 127.18,64.90 126.86,65.79 126.28,66.54 125.70,67.29 124.91,67.81 124.12,68.33 123.20,68.58 122.29,68.82 121.34,68.76 120.39,68.69 119.52,68.33 118.64,67.97 117.93,67.35 117.21,66.73 116.73,65.91 116.25,65.09 116.06,64.16 115.87,63.24 115.98,62.30 116.09,61.35 116.50,60.50 116.91,59.64 117.57,58.96 118.23,58.28 119.07,57.85 119.91,57.41 120.85,57.27 121.79,57.13 122.72,57.29 123.66,57.46 124.49,57.91 125.32,58.37 125.96,59.06 126.61,59.76 127.00,60.62 127.38,61.49 127.47,62.43 127.57,63.37 127.35,64.30 127.14,65.22 126.64,66.03 126.14,66.83 125.41,67.44 124.68,68.04 123.80,68.38 122.91,68.72 121.96,68.76 121.02,68.80 121.02,68.80 121.02,68.80 115.03,68.92 109.04,69.04 104.35,68.97 99.66,68.90 91.93,68.33 84.21,67.77 79.05,67.15 73.88,66.53 66.31,65.49 58.74,64.46 52.36,62.80 45.98,61.14 39.86,59.02 33.75,56.90 28.77,54.67 23.78,52.44 16.02,48.05 8.26,43.66 4.11,40.01 -0.02,36.37 -2.76,32.84 -5.49,29.32 -7.53,25.15 -9.57,20.98 -11.19,16.07 -12.82,11.16 -14.24,7.58 -15.66,4.01 -15.91,2.08 -16.16,0.15 -15.95,-1.78 -15.73,-3.72 -15.05,-5.54 -14.38,-7.37 -13.29,-8.99 -12.20,-10.60 -10.75,-11.91 -9.30,-13.21 -7.59,-14.14 -5.87,-15.06 -3.98,-15.54 -2.09,-16.03 -0.15,-16.04 1.79,-16.06 3.69,-15.61 5.59,-15.17 7.32,-14.28 9.05,-13.39 10.53,-12.11 12.00,-10.83 13.12,-9.24 14.24,-7.64 14.95,-5.83 15.66,-4.01 15.66,-4.01 L 15.66,-4.01 Z"></path></g><g transform="translate(162.112215909091 97.65198863636371) rotate(0 65.9463778409091 -9.367897727272734)" stroke="none"><path d="M -11.89,-13.03 Q -11.89,-13.03 -9.71,-14.43 -7.53,-15.83 -3.76,-18.75 0.00,-21.67 4.98,-23.33 9.95,-24.99 15.49,-25.40 21.03,-25.81 25.86,-26.38 30.69,-26.94 36.72,-27.29 42.74,-27.64 50.18,-27.53 57.63,-27.43 63.68,-27.17 69.73,-26.92 76.87,-26.79 84.00,-26.67 89.62,-26.12 95.24,-25.57 100.83,-24.77 106.42,-23.98 111.10,-23.39 115.77,-22.79 120.60,-22.26 125.43,-21.72 128.49,-20.87 131.56,-20.02 132.45,-19.88 133.35,-19.73 134.15,-19.31 134.95,-18.88 135.57,-18.22 136.19,-17.56 136.57,-16.74 136.95,-15.92 137.05,-15.02 137.15,-14.12 136.95,-13.24 136.76,-12.35 136.29,-11.57 135.82,-10.80 135.13,-10.21 134.44,-9.63 133.60,-9.29 132.76,-8.96 131.85,-8.91 130.95,-8.86 130.08,-9Line truncated
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 297.0049715909092 210.33238636363632" width="297.0049715909092" height="210.33238636363632">
<g transform="translate(120.73437500000006 90.6171875) rotate(0 -55.24325284090909 -43.80859375)" stroke="none"><path d="M -14.07,7.96 Q -14.07,7.96 -15.48,4.09 -16.89,0.22 -18.99,-3.55 -21.09,-7.33 -24.13,-12.89 -27.17,-18.45 -30.14,-24.36 -33.10,-30.28 -35.37,-34.93 -37.64,-39.59 -40.51,-44.80 -43.37,-50.02 -46.11,-53.71 -48.86,-57.40 -52.16,-60.58 -55.46,-63.76 -60.35,-67.14 -65.24,-70.53 -69.99,-72.77 -74.74,-75.00 -80.08,-76.54 -85.41,-78.08 -91.27,-78.91 -97.12,-79.74 -103.29,-80.06 -109.47,-80.38 -110.38,-80.46 -111.29,-80.55 -112.12,-80.91 -112.96,-81.28 -113.64,-81.90 -114.31,-82.52 -114.76,-83.32 -115.20,-84.12 -115.36,-85.02 -115.53,-85.92 -115.40,-86.82 -115.27,-87.73 -114.85,-88.54 -114.44,-89.36 -113.79,-90.00 -113.13,-90.64 -112.31,-91.04 -111.49,-91.44 -110.58,-91.55 -109.67,-91.67 -108.78,-91.49 -107.88,-91.31 -107.09,-90.85 -106.30,-90.39 -105.69,-89.71 -105.09,-89.02 -104.73,-88.18 -104.38,-87.34 -104.31,-86.42 -104.25,-85.51 -104.47,-84.63 -104.70,-83.74 -105.20,-82.97 -105.70,-82.21 -106.42,-81.64 -107.14,-81.07 -108.00,-80.77 -108.86,-80.46 -109.77,-80.44 -110.69,-80.43 -111.56,-80.70 -112.43,-80.98 -113.17,-81.52 -113.91,-82.06 -114.44,-82.81 -114.96,-83.55 -115.22,-84.43 -115.48,-85.31 -115.45,-86.22 -115.42,-87.13 -115.09,-87.99 -114.77,-88.84 -114.19,-89.55 -113.61,-90.26 -112.84,-90.75 -112.06,-91.23 -111.17,-91.44 -110.28,-91.66 -110.29,-91.66 -110.29,-91.66 -104.12,-93.28 -97.96,-94.90 -91.98,-95.45 -85.99,-96.00 -81.46,-95.64 -76.92,-95.29 -68.61,-93.08 -60.30,-90.88 -54.63,-88.23 -48.96,-85.58 -45.26,-83.31 -41.56,-81.05 -36.47,-77.03 -31.37,-73.00 -27.42,-68.77 -23.47,-64.54 -19.02,-58.37 -14.56,-52.20 -11.80,-47.74 -9.05,-43.29 -5.96,-38.13 -2.87,-32.97 0.60,-27.54 4.09,-22.12 6.49,-18.24 8.89,-14.36 11.48,-11.16 14.07,-7.96 14.81,-6.16 15.56,-4.36 15.86,-2.43 16.15,-0.51 15.98,1.43 15.81,3.37 15.17,5.21 14.54,7.05 13.48,8.69 12.43,10.33 11.01,11.67 9.59,13.00 7.90,13.96 6.20,14.92 4.33,15.45 2.45,15.98 0.50,16.04 -1.44,16.10 -3.34,15.69 -5.25,15.29 -7.00,14.43 -8.76,13.58 -10.25,12.34 -11.75,11.09 -12.91,9.52 -14.07,7.96 -14.07,7.96 L -14.07,7.96 Z"></path></g><g transform="translate(164.26775568181824 144.2109375) rotate(0 61.39737215909091 31.56072443181816)" stroke="none"><path d="M 15.66,-4.01 Q 15.66,-4.01 16.13,-0.20 16.61,3.60 17.59,8.51 18.58,13.41 19.95,17.45 21.33,21.49 24.37,24.74 27.42,27.99 31.19,30.37 34.96,32.74 39.20,35.13 43.45,37.52 48.43,39.69 53.42,41.86 58.89,43.75 64.36,45.65 70.65,46.93 76.94,48.20 82.07,49.37 87.20,50.54 94.31,51.57 101.42,52.61 105.80,53.22 110.19,53.84 116.30,55.50 122.42,57.17 123.33,57.43 124.24,57.70 125.02,58.24 125.80,58.78 126.36,59.54 126.93,60.30 127.22,61.20 127.51,62.11 127.50,63.05 127.49,64.00 127.18,64.90 126.86,65.79 126.28,66.54 125.70,67.29 124.91,67.81 124.12,68.33 123.20,68.58 122.29,68.82 121.34,68.76 120.39,68.69 119.52,68.33 118.64,67.97 117.93,67.35 117.21,66.73 116.73,65.91 116.25,65.09 116.06,64.16 115.87,63.24 115.98,62.30 116.09,61.35 116.50,60.50 116.91,59.64 117.57,58.96 118.23,58.28 119.07,57.85 119.91,57.41 120.85,57.27 121.79,57.13 122.72,57.29 123.66,57.46 124.49,57.91 125.32,58.37 125.96,59.06 126.61,59.76 127.00,60.62 127.38,61.49 127.47,62.43 127.57,63.37 127.35,64.30 127.14,65.22 126.64,66.03 126.14,66.83 125.41,67.44 124.68,68.04 123.80,68.38 122.91,68.72 121.96,68.76 121.02,68.80 121.02,68.80 121.02,68.80 115.03,68.92 109.04,69.04 104.35,68.97 99.66,68.90 91.93,68.33 84.21,67.77 79.05,67.15 73.88,66.53 66.31,65.49 58.74,64.46 52.36,62.80 45.98,61.14 39.86,59.02 33.75,56.90 28.77,54.67 23.78,52.44 16.02,48.05 8.26,43.66 4.11,40.01 -0.02,36.37 -2.76,32.84 -5.49,29.32 -7.53,25.15 -9.57,20.98 -11.19,16.07 -12.82,11.16 -14.24,7.58 -15.66,4.01 -15.91,2.08 -16.16,0.15 -15.95,-1.78 -15.73,-3.72 -15.05,-5.54 -14.38,-7.37 -13.29,-8.99 -12.20,-10.60 -10.75,-11.91 -9.30,-13.21 -7.59,-14.14 -5.87,-15.06 -3.98,-15.54 -2.09,-16.03 -0.15,-16.04 1.79,-16.06 3.69,-15.61 5.59,-15.17 7.32,-14.28 9.05,-13.39 10.53,-12.11 12.00,-10.83 13.12,-9.24 14.24,-7.64 14.95,-5.83 15.66,-4.01 15.66,-4.01 L 15.66,-4.01 Z"></path></g><g transform="translate(162.112215909091 97.65198863636371) rotate(0 65.9463778409091 -9.367897727272734)" stroke="none"><path d="M -11.89,-13.03 Q -11.89,-13.03 -9.71,-14.43 -7.53,-15.83 -3.76,-18.75 0.00,-21.67 4.98,-23.33 9.95,-24.99 15.49,-25.40 21.03,-25.81 25.86,-26.38 30.69,-26.94 36.72,-27.29 42.74,-27.64 50.18,-27.53 57.63,-27.43 63.68,-27.17 69.73,-26.92 76.87,-26.79 84.00,-26.67 89.62,-26.12 95.24,-25.57 100.83,-24.77 106.42,-23.98 111.10,-23.39 115.77,-22.79 120.60,-22.26 125.43,-21.72 128.49,-20.87 131.56,-20.02 132.45,-19.88 133.35,-19.73 134.15,-19.31 134.95,-18.88 135.57,-18.22 136.19,-17.56 136.57,-16.74 136.95,-15.92 137.05,-15.02 137.15,-14.12 136.95,-13.24 136.76,-12.35 136.29,-11.57 135.82,-10.80 135.13,-10.21 134.44,-9.63 133.60,-9.29 132.76,-8.96 131.85,-8.91 130.95,-8.86 130.08,-9.10 129.20,-9.35 128.46,-9.85 127.71,-10.36 127.16,-11.08 126.61,-11.81 126.32,-12.66 126.03,-13Line truncated

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V160H256c-17.7 0-32-14.3-32-32V0H64zM256 0V128H384L256 0zM112 256H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-file-text"><path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 437 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M512 255.1C512 256.9 511.1 257.8 511.1 258.7C511.6 295.2 478.4 319.1 441.9 319.1H344C317.5 319.1 296 341.5 296 368C296 371.4 296.4 374.7 297 377.9C299.2 388.1 303.5 397.1 307.9 407.8C313.9 421.6 320 435.3 320 449.8C320 481.7 298.4 510.5 266.6 511.8C263.1 511.9 259.5 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256V255.1zM96 255.1C78.33 255.1 64 270.3 64 287.1C64 305.7 78.33 319.1 96 319.1C113.7 319.1 128 305.7 128 287.1C128 270.3 113.7 255.1 96 255.1zM128 191.1C145.7 191.1 160 177.7 160 159.1C160 142.3 145.7 127.1 128 127.1C110.3 127.1 96 142.3 96 159.1C96 177.7 110.3 191.1 128 191.1zM256 63.1C238.3 63.1 224 78.33 224 95.1C224 113.7 238.3 127.1 256 127.1C273.7 127.1 288 113.7 288 95.1C288 78.33 273.7 63.1 256 63.1zM384 191.1C401.7 191.1 416 177.7 416 159.1C416 142.3 401.7 127.1 384 127.1C366.3 127.1 352 142.3 352 159.1C352 177.7 366.3 191.1 384 191.1z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-palette"><path d="M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z"/><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 562 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="skip"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-hand"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 475 B

+1 -1
View File
@@ -1 +1 @@
<svg class="skip" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/></svg>
<svg class="svg-icon lucide-printer" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/></svg>

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 405 B

+1 -4
View File
@@ -1,4 +1 @@
<svg viewBox="0 0 50 30" xmlns="http://www.w3.org/2000/svg">
<text fill="currentColor" x="10" y="30" font-size="16px" font-weight="light">A</text>
<text fill="currentColor" x="22" y="30" font-size="36px" font-weight="light">A</text>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-a-large-small"><path d="m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"/><path d="M15.697 14h5.606"/><path d="m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"/><path d="M3.304 13h6.392"/></svg>

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 392 B

+1 -1
View File
@@ -1 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" stroke="#000" viewBox="0 0 122.88 102.06"><path stroke-linecap="round" stroke-width="4" d="M8.18,23.12h67.09v5.39H8.18c-0.77,0-1.47,0.31-1.98,0.82c-0.5,0.51-0.82,1.21-0.82,1.98v39.46c0,0.77,0.31,1.47,0.82,1.98 c0.51,0.5,1.21,0.82,1.98,0.82h67.09v5.39H8.18c-2.24,0-4.29-0.92-5.77-2.4L2.4,76.53C0.92,75.05,0,73.01,0,70.76V31.3 c0-2.24,0.92-4.29,2.4-5.77l0.01-0.01C3.89,24.04,5.94,23.12,8.18,23.12L8.18,23.12z M71.77,53.85c-1.52,0-2.75-1.23-2.75-2.75 c0-1.52,1.23-2.75,2.75-2.75h12.78V18.04c-0.39-3.8-1.56-6.62-3.34-8.6c-1.93-2.16-4.67-3.43-7.99-3.98 c-1.49-0.24-2.51-1.65-2.26-3.15c0.24-1.49,1.65-2.51,3.15-2.26c4.54,0.75,8.37,2.57,11.19,5.74c0.72,0.8,1.37,1.69,1.94,2.66 c0.72-1.25,1.58-2.35,2.56-3.32c2.94-2.92,6.88-4.51,11.59-5.1c1.51-0.18,2.88,0.89,3.06,2.4c0.18,1.51-0.89,2.88-2.4,3.06 c-3.52,0.44-6.38,1.54-8.39,3.53c-1.99,1.97-3.25,4.91-3.61,9.04v5.07h24.65c2.24,0,4.29,0.92,5.77,2.4l0.01,0.01 c1.48,1.48,2.4,3.53,2.4,5.77v39.46c0,2.24-0.92,4.29-2.4,5.77l-0.01,0.01c-1.48,1.48-3.53,2.4-5.77,2.4H90.05v5.07 c0.36,4.13,1.62,7.08,3.61,9.04c2,1.98,4.86,3.09,8.39,3.53c1.51,0.18,2.58,1.56,2.4,3.06c-0.18,1.51-1.55,2.58-3.06,2.4 c-4.7-0.59-8.65-2.18-11.59-5.1c-0.98-0.97-1.84-2.07-2.56-3.32c-0.57,0.97-1.22,1.85-1.94,2.66c-2.83,3.16-6.66,4.99-11.19,5.74 c-1.49,0.24-2.9-0.77-3.15-2.26c-0.24-1.49,0.77-2.9,2.26-3.15c3.32-0.55,6.06-1.81,7.99-3.98c1.78-1.99,2.94-4.81,3.34-8.6 l0-30.17H71.77L71.77,53.85L71.77,53.85z M90.05,28.5v19.84h12.98c1.52,0,2.75,1.23,2.75,2.75c0,1.52-1.23,2.75-2.75,2.75H90.05 v19.71h24.65c0.77,0,1.47-0.31,1.98-0.82c0.5-0.51,0.82-1.21,0.82-1.98V31.3c0-0.77-0.31-1.47-0.82-1.98 c-0.51-0.5-1.21-0.82-1.98-0.82H90.05L90.05,28.5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-file-pen"><path d="M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z"/></svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 511 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 220 120" stroke="#000"><defs/><path fill="none" stroke-linecap="round" stroke-width="4" d="M10 110h200m-200 0h200M30 90h160M30 90h160M50 70h120M50 70h120M70 50h80m-80 0h80M90 30h40m-40 0h40M110 10s0 0 0 0m0 0s0 0 0 0"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-square-stack"><path d="M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2"/><path d="M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2"/><rect width="8" height="8" x="14" y="14" rx="2"/></svg>

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 407 B

+1 -7
View File
@@ -1,7 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 256 256" enable-background="new 0 0 256 256" xml:space="preserve">
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
<g><g><g><path fill="#000000" d="M101.2,18.7c-2,0.9-38,36.6-39.2,39c-1,1.9-1.1,4.2-0.4,6.2c0.6,1.5,37.3,38.6,39.3,39.6c1.7,0.9,5.2,0.8,7.1-0.1c1.9-0.9,3.7-3.5,4.1-5.8c0.6-3.5-0.2-4.5-12.5-16.8L88.2,69.2h44.3c38.7,0,44.8,0.1,48.6,0.7c24.2,4.2,43.2,22.6,48.1,46.8c3.3,16.4-1,34.2-11.5,47.6c-3.5,4.6-4.1,6.9-2.4,10.4c1.8,3.7,6.6,5.3,10.4,3.5c2.8-1.3,8.7-9.4,12.5-17.2c10.5-20.8,10.5-45.2,0-66.2c-10.3-20.6-28.6-34.8-51.8-40c-4.6-1.1-4.8-1.1-51.3-1.2c-25.7-0.1-46.7-0.3-46.7-0.5s5.2-5.5,11.5-11.9c9.4-9.4,11.6-11.9,12-13.3C113.6,21.6,107.3,16.1,101.2,18.7z"/><path fill="#000000" d="M34.9,73.4c-1.8,0.5-5.8,4.4-9.7,9.6c-7.9,10.4-12.8,22.4-14.5,35.4c-5.3,40.1,22.9,77.3,63.1,83.3c4,0.6,11.3,0.7,45.4,0.7c24,0,40.6,0.2,40.6,0.4c0,0.2-5,5.3-11.1,11.1c-11.3,11-12.9,13-12.9,16c0,4.1,3.8,7.9,7.9,7.9c0.7,0,2.1-0.3,3.1-0.7c2.3-1,38.1-36.6,39.3-39.2c1-2.1,1.1-4.2,0.4-6.1c-0.6-1.5-37.3-38.6-39.3-39.7c-1.9-1-6.1-0.6-8.1,0.8c-2.9,2-4,6.4-2.5,9.4c0.4,0.8,5.9,6.6,12.1,12.9l11.4,11.4h-40.4c-35,0-40.9-0.1-44.7-0.7c-24.2-4.1-43.4-22.9-48.2-47.1c-1.1-5.5-1.1-16.4,0-21.9c2.1-10.7,7-20.2,14.6-28.7c2.1-2.3,3.5-4.3,3.8-5.4c1-3.6-0.7-7.3-4.2-9C38.7,72.8,37.4,72.7,34.9,73.4z"/></g></g></g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-repeat-1"><path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/><path d="M11 10h1v4"/></svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 365 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M32 176h370.8l-57.38 57.38c-12.5 12.5-12.5 32.75 0 45.25C351.6 284.9 359.8 288 368 288s16.38-3.125 22.62-9.375l112-112c12.5-12.5 12.5-32.75 0-45.25l-112-112c-12.5-12.5-32.75-12.5-45.25 0s-12.5 32.75 0 45.25L402.8 112H32c-17.69 0-32 14.31-32 32S14.31 176 32 176zM480 336H109.3l57.38-57.38c12.5-12.5 12.5-32.75 0-45.25s-32.75-12.5-45.25 0l-112 112c-12.5 12.5-12.5 32.75 0 45.25l112 112C127.6 508.9 135.8 512 144 512s16.38-3.125 22.62-9.375c12.5-12.5 12.5-32.75 0-45.25L109.3 400H480c17.69 0 32-14.31 32-32S497.7 336 480 336z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-arrow-left-right"><path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/></svg>

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 317 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 80 500 400"><path d="M307.18 443.33a193.376 193.376 0 0 1-41.418-4.664 107.213 107.213 0 0 1-65.613-41.641 107.22 107.22 0 0 1-20.254-75.027c6.3-43.398 45.266-87.5 135.92-81.082a358.117 358.117 0 0 1 97.883 20.297 218.57 218.57 0 0 0-26.832-60.664c-22.285-35-49.934-55.066-81.668-59.5-66.617-9.102-133 49.582-133.58 50.168v-.004a11.664 11.664 0 0 1-19.957-9.09 11.655 11.655 0 0 1 4.324-8.176c3.035-2.8 75.016-66.617 152.25-56 39.316 5.368 72.566 28.934 98.7 70a233.33 233.33 0 0 1 33.831 84.47 245.007 245.007 0 0 1 106.52 91.116c3.219 5.606 1.29 12.762-4.32 15.98-5.606 3.223-12.762 1.29-15.98-4.316a223.277 223.277 0 0 0-83.652-75.016 148.281 148.281 0 0 1-25.781 88.668 129.381 129.381 0 0 1-110.37 54.48zm-8.285-180.02c-63.7 0-91.465 31.035-95.898 61.715v.004a83.522 83.522 0 0 0 16.199 58.66 83.522 83.522 0 0 0 51.699 32.105c54.367 11.668 100.8-2.684 127.4-40.484h.004a128.338 128.338 0 0 0 20.3-87.148 323.793 323.793 0 0 0-104.42-24.27c-5.366-.348-10.851-.465-15.284-.465z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-line-squiggle"><path d="M7 3.5c5-2 7 2.5 3 4C1.5 10 2 15 5 16c5 2 9-10 14-7s.5 13.5-4 12c-5-2.5.5-11 6-2"/></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 317 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-filter"><polygon fill="none" stroke-width="2" points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-filter"><polygon fill="none" stroke-width="2" points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"/></svg>

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 287 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="110 80 500 400"><path d="M434 408.8a22.397 22.397 0 0 0-19.398 33.597A22.393 22.393 0 0 0 434 453.6h44.801a44.788 44.788 0 0 0 31.676-13.125 44.787 44.787 0 0 0 13.125-31.676v-257.6a44.788 44.788 0 0 0-13.125-31.676 44.787 44.787 0 0 0-31.676-13.125H434a22.403 22.403 0 0 0-19.398 33.601A22.399 22.399 0 0 0 434 151.198h44.801v56H434a22.397 22.397 0 0 0-19.398 11.199c-4 6.934-4 15.473 0 22.402A22.397 22.397 0 0 0 434 251.998h44.801v56H434a22.397 22.397 0 0 0-19.398 11.199c-4 6.93-4 15.469 0 22.402A22.397 22.397 0 0 0 434 352.798h44.801v56zM294 285.6v-97.105l28.953 28.953a22.42 22.42 0 0 0 21.648 5.8 22.42 22.42 0 0 0 15.848-15.847 22.419 22.419 0 0 0-5.8-21.648l-48.106-48.105a49.447 49.447 0 0 0-34.973-14.492 49.446 49.446 0 0 0-34.969 14.492l-48.105 48.105a22.41 22.41 0 0 0 10.047 37.496 22.419 22.419 0 0 0 21.648-5.801l29.008-28.953v183.01l-28.953-28.953a22.42 22.42 0 0 0-21.648-5.8 22.42 22.42 0 0 0-15.848 15.847 22.419 22.419 0 0 0 5.801 21.648l48.105 48.105a49.452 49.452 0 0 0 34.973 14.492 49.463 49.463 0 0 0 34.973-14.492l48.105-48.105h-.004a22.413 22.413 0 0 0-31.695-31.695L294 371.505z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-ruler-dimension-line"><path d="M10 15v-3"/><path d="M14 15v-3"/><path d="M18 15v-3"/><path d="M2 8V4"/><path d="M22 6H2"/><path d="M22 8V4"/><path d="M6 15v-3"/><rect x="2" y="12" width="20" height="8" rx="2"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 420 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM448 96H288V224H448V96zM448 288H288V416H448V288zM224 224V96H64V224H224zM64 416H224V288H64V416z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-grid-3x3"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M3 15h18"/><path d="M9 3v18"/><path d="M15 3v18"/></svg>

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 347 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111 60" stroke="#000"><path fill="none" stroke-linecap="round" stroke-width="4" d="M20 10.333H10m10 0H10m0 0v40m0-40v40m0 0h10m-10 0h10M50 10.333h10m-10 0h10m0 0v40m0-40v40m0 0H50m10 0H50M80 10c-1.65 3.33-9.87 13.22-9.92 20-.04 6.78 8.06 17.22 9.67 20.67M80 10c-1.65 3.33-9.87 13.22-9.92 20-.04 6.78 8.06 17.22 9.67 20.67M90 10.333c1.85 3.22 10.96 12.67 11.08 19.33.13 6.67-8.61 17.23-10.33 20.67m-.75-40c1.85 3.22 10.96 12.67 11.08 19.33.13 6.67-8.61 17.23-10.33 20.67"/><g stroke-linecap="round"><path stroke-width="0" d="M23 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.28-.11-.43-.03-.14-.04-.29-.04-.43s.01-.29.04-.43c.02-.15.06-.29.11-.43.05-.13.11-.26.18-.39.08-.13.16-.25.25-.36.1-.11.2-.21.31-.31.11-.09.23-.17.36-.25.13-.07.26-.13.39-.18.14-.05.28-.09.43-.11.14-.03.29-.04.43-.04s.29.01.43.04c.15.02.29.06.43.11.13.05.26.11.39.18.13.08.25.16.36.25.11.1.21.2.31.31.09.11.17.23.25.36.07.13.13.26.18.39.05.14.09.28.11.43.03.14.03.36.04.43.01.07.01-.07 0 0"/><path fill="none" stroke-width="4" d="M23 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.28-.11-.43-.03-.14-.04-.29-.04-.43s.01-.29.04-.43c.02-.15.06-.29.11-.43.05-.13.11-.26.18-.39.08-.13.16-.25.25-.36.1-.11.2-.21.31-.31.11-.09.23-.17.36-.25.13-.07.26-.13.39-.18.14-.05.28-.09.43-.11.14-.03.29-.04.43-.04s.29.01.43.04c.15.02.29.06.43.11.13.05.26.11.39.18.13.08.25.16.36.25.11.1.21.2.31.31.09.11.17.23.25.36.07.13.13.26.18.39.05.14.09.28.11.43.03.14.03.36.04.43.01.07.01-.07 0 0"/></g><g stroke-linecap="round"><path stroke-width="0" d="M38 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.28-.11-.43-.03-.14-.04-.29-.04-.43s.01-.29.04-.43c.02-.15.06-.29.11-.43.05-.13.11-.26.18-.39.08-.13.16-.25.25-.36.1-.11.2-.21.31-.31.11-.09.23-.17.36-.25.13-.07.26-.13.39-.18.14-.05.28-.09.43-.11.14-.03.29-.04.43-.04s.29.01.43.04c.15.02.29.06.43.11.13.05.26.11.39.18.13.08.25.16.36.25.11.1.21.2.31.31.09.11.17.23.25.36.07.13.13.26.18.39.05.14.09.28.11.43.03.14.03.36.04.43.01.07.01-.07 0 0"/><path fill="none" stroke-width="4" d="M38 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.28-.11-.43-.03-.14-.04-.29-.04-.43s.01-.29.04-.43c.02-.15.06-.29.11-.43.05-.13.11-.26.18-.39.08-.13.16-.25.25-.36.1-.11.2-.21.31-.31.11-.09.23-.17.36-.25.13-.07.26-.13.39-.18.14-.05.28-.09.43-.11.14-.03.29-.04.43-.04s.29.01.43.04c.15.02.29.06.43.11.13.05.26.11.39.18.13.08.25.16.36.25.11.1.21.2.31.31.09.11.17.23.25.36.07.13.13.26.18.39.05.14.09.28.11.43.03.14.03.36.04.43.01.07.01-.07 0 0"/></g><g stroke-linecap="round"><path stroke-width="0" d="M53 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.28-.11-.43-.03-.14-.04-.29-.04-.43s.01-.29.04-.43c.02-.15.06-.29.11-.43.05-.13.11-.26.18-.39.08-.13.16-.25.25-.36.1-.11.2-.21.31-.31.11-.09.23-.17.36-.25.13-.07.26-.13.39-.18.14-.05.28-.09.43-.11.14-.03.29-.04.43-.04s.29.01.43.04c.15.02.29.06.43.11.13.05.26.11.39.18.13.08.25.16.36.25.11.1.21.2.31.31.09.11.17.23.25.36.07.13.13.26.18.39.05.14.09.28.11.43.03.14.03.36.04.43.01.07.01-.07 0 0"/><path fill="none" stroke-width="4" d="M53 30.333c0 .14-.01.29-.04.43-.02.15-.06.29-.11.43-.05.13-.11.26-.18.39-.08.13-.16.25-.25.36-.1.11-.2.21-.31.31-.11.09-.23.17-.36.25-.13.07-.26.13-.39.18-.14.05-.28.09-.43.11-.14.03-.29.04-.43.04s-.29-.01-.43-.04c-.15-.02-.29-.06-.43-.11a3.39 3.39 0 0 1-.39-.18c-.13-.08-.25-.16-.36-.25-.11-.1-.21-.2-.31-.31-.09-.11-.17-.23-.25-.36a3.39 3.39 0 0 1-.18-.39c-.05-.14-.09-.Line truncated
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-link-alias"><path d="M9 8h1a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-1M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1M5.5 12h0m3 0h0M16.75 8s-1.75 1.333-1.75 4 1.75 4 1.75 4M20.25 8s1.75 1.333 1.75 4-1.75 4-1.75 4"/></svg>

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 409 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 100 500 350"><g fill-rule="evenodd"><path d="M451.65 485.81a12.407 12.407 0 0 1 8.77 3.61c2.324 2.316 3.632 5.456 3.632 8.734s-1.308 6.422-3.633 8.738a12.387 12.387 0 0 1-8.769 3.606H227.29c-6.828-.012-12.359-5.536-12.359-12.344s5.531-12.332 12.359-12.344zM415.18 49.504l-226.5 130.56 74.664 62.102 168.47-96.812zM446.52 165.6 273.6 264.725l-8.512 70.004 225.14 128.82-72.148-123.81c-16.746 3.625-34.938-3.559-43.906-19.094-11.164-19.238-4.351-44.207 14.895-55.348 6.012-3.438 12.617-5.25 19.148-5.398 14.348-.332 28.555 7.062 36.168 20.25 8.977 15.469 6.336 34.55-5.027 47.25l71.371 122.46.582-256.88z"/><path d="M408.99 284.59h-.191c-2.461.09-5.07.828-7.352 2.121-7.934 4.594-10.383 13.73-5.8 21.602 4.28 7.441 13.948 10.082 21.468 5.785 7.887-4.601 10.371-13.75 5.805-21.598-2.914-5.062-8.406-7.976-13.926-7.906z"/></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-pen-tool"><g transform="rotate(180 12 11.75)"><path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/></g><path d="M3 22h8"/></svg>

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 599 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M256 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H256C273.7 32 288 46.33 288 64C288 81.67 273.7 96 256 96zM256 352H32C14.33 352 0 337.7 0 320C0 302.3 14.33 288 32 288H256C273.7 288 288 302.3 288 320C288 337.7 273.7 352 256 352zM0 192C0 174.3 14.33 160 32 160H416C433.7 160 448 174.3 448 192C448 209.7 433.7 224 416 224H32C14.33 224 0 209.7 0 192zM416 480H32C14.33 480 0 465.7 0 448C0 430.3 14.33 416 32 416H416C433.7 416 448 430.3 448 448C448 465.7 433.7 480 416 480z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-text-align-start"><path d="M21 4.5H3 M15 9.5H3 M17 14.5H3 M15 19.5H3"/></svg>

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 281 B

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M41.37 9.372C53.87-3.124 74.13-3.124 86.63 9.372L168 90.74L221.1 37.66C249.2 9.539 294.8 9.539 322.9 37.66L474.3 189.1C502.5 217.2 502.5 262.8 474.3 290.9L283.9 481.4C246.4 518.9 185.6 518.9 148.1 481.4L30.63 363.9C-6.863 326.4-6.863 265.6 30.63 228.1L122.7 135.1L41.37 54.63C28.88 42.13 28.88 21.87 41.37 9.372V9.372zM217.4 230.6L168 181.3L75.88 273.4C71.69 277.6 68.9 282.6 67.52 288H386.7L429.1 245.7C432.2 242.5 432.2 237.5 429.1 234.3L277.7 82.91C274.5 79.79 269.5 79.79 266.3 82.91L213.3 136L262.6 185.4C275.1 197.9 275.1 218.1 262.6 230.6C250.1 243.1 229.9 243.1 217.4 230.6L217.4 230.6zM448 448C448 422.8 480.6 368.4 499.2 339.3C505.3 329.9 518.7 329.9 524.8 339.3C543.4 368.4 576 422.8 576 448C576 483.3 547.3 512 512 512C476.7 512 448 483.3 448 448H448z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-paint-bucket"><path d="M11 7 6 2"/><path d="M18.992 12H2.041"/><path d="M21.145 18.38A3.34 3.34 0 0 1 20 16.5a3.3 3.3 0 0 1-1.145 1.88c-.575.46-.855 1.02-.855 1.595A2 2 0 0 0 20 22a2 2 0 0 0 2-2.025c0-.58-.285-1.13-.855-1.595"/><path d="m8.5 4.5 2.148-2.148a1.205 1.205 0 0 1 1.704 0l7.296 7.296a1.205 1.205 0 0 1 0 1.704l-7.592 7.592a3.615 3.615 0 0 1-5.112 0l-3.888-3.888a3.615 3.615 0 0 1 0-5.112L5.67 7.33"/></svg>

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 622 B

+153 -83
View File
@@ -23,17 +23,27 @@ const HELP_TEXT = `
- Additionally if the same color is used as fill and stroke the color can only be mapped once
- This is an experimental script - contributions welcome on GitHub via PRs
😍 If you find this script helpful, please [buy me a coffee ☕](https://ko-fi.com/zsolt).
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
<a href="https://www.youtube.com/watch?v=ISuORbVKyhQ" target="_blank"><img src ="https://i.ytimg.com/vi/ISuORbVKyhQ/maxresdefault.jpg" style="max-width:560px; width:100%"></a>
`;
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.19.0")) {
new Notice("This script requires a newer version of Excalidraw. Please install the latest version.");
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.19.1")) {
new Notice("Please update the Excalidraw Plugin to version 2.19.1 or higher.");
return;
}
const existingTab = ea.checkForActiveSidepanelTabForScript();
if (existingTab) {
const hostEA = existingTab.getHostEA();
if (hostEA && hostEA !== ea) {
hostEA.setView(ea.targetView);
existingTab.open();
return;
}
}
/*
SVGColorInfo is returned by ea.getSVGColorInfoForImgElement. Color info will all the color strings in the SVG file plus "fill" which represents the default fill color for SVG icons set at the SVG root element level. Fill if not set defaults to black:
@@ -49,22 +59,10 @@ interface ColorMap {
};
*/
// Main script execution
const allElements = ea.getViewSelectedElements();
const svgImageElements = allElements.filter(el => {
if(el.type !== "image") return false;
const file = ea.getViewFileForImageElement(el);
if(!file) return false;
return el.type === "image" && (
file.extension === "svg" ||
ea.isExcalidrawFile(file)
);
});
if(allElements.length === 0) {
new Notice("Select at least one rectangle, ellipse, diamond, line, arrow, freedraw, text or SVG image elment");
return;
}
// Main script state variables
let allElements = [];
let svgImageElements = [];
let lastSelectionIds = "";
const originalColors = new Map();
const currentColors = new Map();
@@ -95,10 +93,11 @@ if(!settings[STROKE]) {
}
function getRegularElements() {
if (!ea.targetView) return [];
ea.clear();
//loading view elements again as element objects change when colors are updated
const allElements = ea.getViewSelectedElements();
return allElements.filter(el =>
const viewElements = ea.getViewSelectedElements();
return viewElements.filter(el =>
["rectangle", "ellipse", "diamond", "line", "arrow", "freedraw", "text"].includes(el.type)
);
}
@@ -120,6 +119,10 @@ function updateViewImageColors() {
}
async function storeOriginalColors() {
// Clear previous state
originalColors.clear();
currentColors.clear();
// Store colors for regular elements
for (const el of getRegularElements()) {
const key = el.id;
@@ -145,6 +148,7 @@ async function storeOriginalColors() {
}
function copyOriginalsToCurrent() {
currentColors.clear();
for (const [key, value] of originalColors.entries()) {
if(value.type === "regular") {
currentColors.set(key, {...value});
@@ -324,26 +328,40 @@ function slider(contentEl, action, min, max, step, invert) {
}
}
function showModal() {
let debounceColorPicker = true;
const modal = new ea.FloatingModal(app);
let dirty = false;
let debounceColorPicker = true;
modal.onOpen = async () => {
const { contentEl, modalEl } = modal;
const { width, height } = ea.getExcalidrawAPI().getAppState();
modal.bgOpacity = 0;
contentEl.createEl('h2', { text: 'Shade Master' });
const helpDiv = contentEl.createEl("details", {
attr: { style: "margin-bottom: 1em;background: var(--background-secondary); padding: 1em; border-radius: 4px;" }});
helpDiv.createEl("summary", { text: "Help & Usage Guide", attr: { style: "cursor: pointer; color: var(--text-accent);" } });
const helpDetailsDiv = helpDiv.createEl("div", {
attr: { style: "margin-top: 0em; " }
function renderSidepanel(contentEl) {
contentEl.empty();
contentEl.createEl('h2', { text: 'Shade Master' });
const helpDiv = contentEl.createEl("details", {
attr: { style: "margin-bottom: 1em;background: var(--background-secondary); padding: 1em; border-radius: 4px;" }});
helpDiv.createEl("summary", { text: "Help & Usage Guide", attr: { style: "cursor: pointer; color: var(--text-accent);" } });
const helpDetailsDiv = helpDiv.createEl("div", {
attr: { style: "margin-top: 0em; " }
});
ea.obsidian.MarkdownRenderer.render(ea.plugin.app, HELP_TEXT, helpDetailsDiv, "", ea.plugin);
if (!ea.targetView) {
contentEl.createEl("p", {
text: "No active Excalidraw view found. Please open a drawing and select elements to use Shade Master.",
attr: { style: "color: var(--text-muted);" }
});
//helpDetailsDiv.innerHTML = HELP_TEXT;
await ea.obsidian.MarkdownRenderer.render(ea.plugin.app, HELP_TEXT, helpDetailsDiv, "", ea.plugin);
return;
}
const { width, height } = ea.getExcalidrawAPI().getAppState();
if(allElements.length === 0) {
contentEl.createEl("p", {
text: "Select at least one rectangle, ellipse, diamond, line, arrow, freedraw, text or SVG image element",
attr: { style: "color: var(--text-warning);" }
});
// return; // Removed early return to allow rendering of the Close button
} else {
// Only render controls if elements are selected
const component = new ea.obsidian.Setting(contentEl)
.setName(FORMAT)
.setDesc("Output color format")
@@ -389,6 +407,7 @@ function showModal() {
// The range for Hue is 360 since regarless of the position on the circle moving
// the slider to the two extremes will travel the entire circle
// To modify blacks and whites, lightness first needs to be changed to value between 1% and 99%
sliderResetters.length = 0; // Clear existing resetters
sliderResetters.push(slider(contentEl, "Hue", 0, 360, 1, false));
sliderResetters.push(slider(contentEl, "Saturation", 0, 200, 1, false));
sliderResetters.push(slider(contentEl, "Lightness", 0, 200, 1, false));
@@ -404,6 +423,8 @@ function showModal() {
const colorSection = contentEl.createDiv();
colorSection.createEl('h3', { text: 'SVG Colors' });
colorInputs.clear(); // Clear old inputs map
for (const [color, info] of initialColorInfo.entries()) {
const row = new ea.obsidian.Setting(colorSection)
.setName(color === "fill" ? "SVG default" : color)
@@ -538,7 +559,7 @@ function showModal() {
paletteButton.settingEl.style.padding = "0";
paletteButton.settingEl.style.border = "0";
paletteButton.infoEl.style.display = "none";
// Store references to the components
colorInputs.set(color, {
textInput,
@@ -582,50 +603,39 @@ function showModal() {
});
}
}
}
const buttons = new ea.obsidian.Setting(contentEl);
if(svgImageElements.length > 0) {
buttons.addButton(button => button
.setButtonText("Initialize SVG Colors")
.onClick(() => {
debounceColorPicker = true;
clearSVGMapping();
})
);
}
const buttons = new ea.obsidian.Setting(contentEl);
if(svgImageElements.length > 0) {
buttons.addButton(button => button
.setButtonText("Initialize SVG Colors")
.onClick(() => {
debounceColorPicker = true;
clearSVGMapping();
})
);
}
buttons
.addButton(button => button
.setButtonText("Reset")
.onClick(() => {
for (const resetter of sliderResetters) {
resetter();
}
copyOriginalsToCurrent();
setColors(originalColors);
}))
.addButton(button => button
.setButtonText("Close")
.setCta(true)
.onClick(() => modal.close()));
const maxHeight = Math.round(height * 0.6);
const maxWidth = Math.round(width * 0.9);
modalEl.style.maxHeight = `${maxHeight}px`;
modalEl.style.maxWidth = `${maxWidth}px`;
};
if (allElements.length > 0) {
buttons.addButton(button => button
.setButtonText("Reset")
.onClick(() => {
for (const resetter of sliderResetters) {
resetter();
}
copyOriginalsToCurrent();
setColors(originalColors);
}));
}
modal.onClose = () => {
terminate = true;
if (dirty) {
ea.setScriptSettings(settings);
}
if(ea.targetView.isDirty()) {
ea.targetView.save(false);
}
};
modal.open();
buttons.addButton(button => button
.setButtonText("Close")
.onClick(() => {
if(ea.sidepanelTab) {
ea.sidepanelTab.close();
}
ea.toggleSidepanelView();
}));
}
function executeChange(isDecrease, step, action) {
@@ -711,6 +721,66 @@ function run(action="Hue", isDecrease=true, step=0) {
if (!isRunning) processQueue();
}
await storeOriginalColors();
showModal();
processQueue();
// Function to refresh internal state based on current selection
function refreshSelectionState() {
if (!ea.targetView) {
allElements = [];
svgImageElements = [];
lastSelectionIds = "";
return;
}
allElements = ea.getViewSelectedElements();
svgImageElements = allElements.filter(el => {
if(el.type !== "image") return false;
const file = ea.getViewFileForImageElement(el);
if(!file) return false;
return el.type === "image" && (
file.extension === "svg" ||
ea.isExcalidrawFile(file)
);
});
lastSelectionIds = allElements.map(e => e.id).sort().join(",");
}
// Sidepanel initialization and logic
ea.createSidepanelTab("Shade Master", false, true).then(tab => {
if (!tab) return;
const initializeAndRender = async () => {
refreshSelectionState();
await storeOriginalColors();
renderSidepanel(tab.contentEl);
processQueue();
};
tab.onOpen = async () => {
terminate = false;
// Initial load
await initializeAndRender();
};
tab.onFocus = async (view) => {
if (view && view !== ea.targetView) {
ea.setView(view);
ea.clear();
}
// Check if selection changed
const currentSelectionStr = ea.getViewSelectedElements().map(e => e.id).sort().join(",");
if (currentSelectionStr !== lastSelectionIds) {
await initializeAndRender();
}
};
tab.onClose = async () => {
terminate = true;
if (dirty) {
ea.setScriptSettings(settings);
}
if(ea.targetView && ea.targetView.isDirty()) {
ea.targetView.save(false);
}
};
tab.open();
});
+1 -1
View File
@@ -1 +1 @@
<svg class="skip" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"/><path d="M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"/><path d="M 7 17h.01"/><path d="m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"/></svg>
<svg class="svg-icon lucide-swatch-book" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"/><path d="M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"/><path d="M 7 17h.01"/><path d="m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"/></svg>

Before

Width:  |  Height:  |  Size: 434 B

After

Width:  |  Height:  |  Size: 457 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 145.438" stroke="#000" fill="#fff"><path fill="none" stroke-linecap="round" stroke-width="8" d="M20 60.438h150m-150 0h150m0 0c10 0 15 5 15 15m-15-15c10 0 15 5 15 15m0 0v30m0-30v30m0 0c0 10-5 15-15 15m15-15c0 10-5 15-15 15m0 0H20m150 0H20m0 0c-10 0-15-5-15-15m15 15c-10 0-15-5-15-15m0 0v-30m0 30v-30m0 0c0-10 5-15 15-15m-15 15c0-10 5-15 15-15"/><g stroke-linecap="round"><path fill="var(--input-bg-color)" stroke-width="8" d="M165 90.438c0 2.18-.14 4.37-.43 6.53-.28 2.15-.71 4.31-1.27 6.41-.57 2.1-1.27 4.18-2.11 6.19-.83 2.01-1.8 3.99-2.89 5.87a51.975 51.975 0 0 1-3.63 5.44 53.055 53.055 0 0 1-4.31 4.92c-1.54 1.53-3.2 2.98-4.92 4.31a51.975 51.975 0 0 1-5.44 3.63 49.145 49.145 0 0 1-5.87 2.89c-2.01.84-4.09 1.54-6.19 2.11-2.1.56-4.26.99-6.41 1.27-2.16.29-4.35.43-6.53.43-2.18 0-4.37-.14-6.53-.43-2.15-.28-4.31-.71-6.41-1.27-2.1-.57-4.18-1.27-6.19-2.11-2.01-.83-3.99-1.8-5.87-2.89a51.975 51.975 0 0 1-5.44-3.63 53.055 53.055 0 0 1-4.92-4.31c-1.53-1.54-2.98-3.2-4.31-4.92a51.975 51.975 0 0 1-3.63-5.44 49.145 49.145 0 0 1-2.89-5.87c-.84-2.01-1.54-4.09-2.11-6.19-.56-2.1-.99-4.26-1.27-6.41-.29-2.16-.43-4.35-.43-6.53 0-2.18.14-4.37.43-6.53.28-2.15.71-4.31 1.27-6.41.57-2.1 1.27-4.18 2.11-6.19.83-2.01 1.8-3.99 2.89-5.87s2.31-3.71 3.63-5.44c1.33-1.72 2.78-3.38 4.31-4.92 1.54-1.53 3.2-2.98 4.92-4.31 1.73-1.32 3.56-2.54 5.44-3.63 1.88-1.09 3.86-2.06 5.87-2.89 2.01-.84 4.09-1.54 6.19-2.11 2.1-.56 4.26-.99 6.41-1.27 2.16-.29 4.35-.43 6.53-.43 2.18 0 4.37.14 6.53.43 2.15.28 4.31.71 6.41 1.27 2.1.57 4.18 1.27 6.19 2.11 2.01.83 3.99 1.8 5.87 2.89s3.71 2.31 5.44 3.63c1.72 1.33 3.38 2.78 4.92 4.31 1.53 1.54 2.98 3.2 4.31 4.92 1.32 1.73 2.54 3.56 3.63 5.44 1.09 1.88 2.06 3.86 2.89 5.87.84 2.01 1.54 4.09 2.11 6.19.56 2.1.99 4.26 1.27 6.41.29 2.16.36 5.44.43 6.53.07 1.09.07-1.09 0 0"/><path fill="none" stroke-width="8" d="M165 90.438c0 2.18-.14 4.37-.43 6.53-.28 2.15-.71 4.31-1.27 6.41-.57 2.1-1.27 4.18-2.11 6.19-.83 2.01-1.8 3.99-2.89 5.87a51.975 51.975 0 0 1-3.63 5.44 53.055 53.055 0 0 1-4.31 4.92c-1.54 1.53-3.2 2.98-4.92 4.31a51.975 51.975 0 0 1-5.44 3.63 49.145 49.145 0 0 1-5.87 2.89c-2.01.84-4.09 1.54-6.19 2.11-2.1.56-4.26.99-6.41 1.27-2.16.29-4.35.43-6.53.43-2.18 0-4.37-.14-6.53-.43-2.15-.28-4.31-.71-6.41-1.27-2.1-.57-4.18-1.27-6.19-2.11-2.01-.83-3.99-1.8-5.87-2.89a51.975 51.975 0 0 1-5.44-3.63 53.055 53.055 0 0 1-4.92-4.31c-1.53-1.54-2.98-3.2-4.31-4.92a51.975 51.975 0 0 1-3.63-5.44 49.145 49.145 0 0 1-2.89-5.87c-.84-2.01-1.54-4.09-2.11-6.19-.56-2.1-.99-4.26-1.27-6.41-.29-2.16-.43-4.35-.43-6.53 0-2.18.14-4.37.43-6.53.28-2.15.71-4.31 1.27-6.41.57-2.1 1.27-4.18 2.11-6.19.83-2.01 1.8-3.99 2.89-5.87s2.31-3.71 3.63-5.44c1.33-1.72 2.78-3.38 4.31-4.92 1.54-1.53 3.2-2.98 4.92-4.31 1.73-1.32 3.56-2.54 5.44-3.63 1.88-1.09 3.86-2.06 5.87-2.89 2.01-.84 4.09-1.54 6.19-2.11 2.1-.56 4.26-.99 6.41-1.27 2.16-.29 4.35-.43 6.53-.43 2.18 0 4.37.14 6.53.43 2.15.28 4.31.71 6.41 1.27 2.1.57 4.18 1.27 6.19 2.11 2.01.83 3.99 1.8 5.87 2.89s3.71 2.31 5.44 3.63c1.72 1.33 3.38 2.78 4.92 4.31 1.53 1.54 2.98 3.2 4.31 4.92 1.32 1.73 2.54 3.56 3.63 5.44 1.09 1.88 2.06 3.86 2.89 5.87.84 2.01 1.54 4.09 2.11 6.19.56 2.1.99 4.26 1.27 6.41.29 2.16.36 5.44.43 6.53.07 1.09.07-1.09 0 0"/></g><path fill="none" stroke-linecap="round" stroke-width="8" d="m101 29.438-20-20m20 20-20-20M115 29.438V4.997m0 24.44V4.997M129 29.438l20-20m-20 20 20-20M25 120.438v20m0-20v20M165 120.438v20m0-20v20"/><g stroke-linecap="round"><path stroke-width="0" d="M50.244 90.111c0 .25-.02.5-.06.74-.05.24-.11.48-.2.71-.08.23-.18.46-.31.67a4.257 4.257 0 0 1-1.54 1.54c-.21.13-.44.23-.67.31-.23.09-.47.15-.71.2a4.524 4.524 0 0 1-1.47 0c-.24-.05-.48-.11-.71-.2-.23-.08-.46-.18-.67-.31a4.257 4.257 0 0 1-1.54-1.54c-.13-.21-.23-.44-.32-.67a5.71 5.71 0 0 1-.19-.71 4.524 4.524 0 0 1 0-1.47c.05-.24.11-.48.19-.71.09-.23.19-.46.32-.67a4.257 4.257 0 0 1 1.54-1.54c.21-.13.44-.23.67-.32.23-.08.47-.14.71-.19a4.493 4.493 0 0 1 1.47 0c.24.05.48.11.71.19.23.09.46.19.67.32a4.257 4.257 0 0 1 1.54 1.54c.13.21.23.44.31.67.09.23.15.47.2.71.04.24.05.61.06.73.01.13.01-.12 0 0"/><path fill="none" stroke-width="8" d="M50.244 90.111c0 .25-.02.5-.06.74-.05.24-.11.48-.2.71-.08.23-.18.46-.31.67a4.257 4.257 0 0 1-1.54 1.54c-.21.13-.44.23-.67.31-.23.09-.47.15-.71.2a4.524 4.524 0 0 1-1.47 0c-.24-.05-.48-.11-.71-.2-.23-.08-.46-.18-.67-.31a4.257 4.257 0 0 1-1.54-1.54c-.13-.21-.23-.44-.32-.67a5.71 5.71 0 0 1-.19-.71 4.524 4.524 0 0 1 0-1.47c.05-.24.11-.48.19-.71.09-.23.19-.46.32-.67a4.257 4.257 0 0 1 1.54-1.54c.21-.13.44-.23.67-.32.23-.08.47-.14.71-.19a4.493 4.493 0 0 1 1.47 0c.24.05.48.11.71.19.23.09.46.19.67.32a4.257 4.257 0 0 1 1.54 1.54c.13.21.23.44.31.67.09.23.15.47.2.71.04.24.05.61.06.73.01.13.01-.12 0 0"/></g><g stroke-linecap="round"><path stroke-width="0" d="M29.437 90.111c0 .25-.02.5-.06.74-.05.24-.11.48-.2.71-.08.23-.18.46-.31.67a4.257 4.257 0 0 1-1.54 1.54c-.21.13-.44.23-.67.31-.23.09-.47.15-.71.2a4.524 4.524 0 0 1-1.47 0c-.24-.05-.48-.11-.71-.2-.23-.08-.46-.18-.67-.31a4.Line truncated
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-projector"><path d="M5 7 3 5"/><path d="M9 6V3"/><path d="m13 7 2-2"/><circle cx="9" cy="13" r="3"/><path d="M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17"/><path d="M16 16h2"/></svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 422 B

+1 -10
View File
@@ -1,10 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 156.01944 159.27567">
<g
id="layer1"
transform="translate(-26.537155,-79.352678)">
<path
d="m 63.646518,79.35271 c -0.490272,0.0012 -0.981154,0.03861 -1.468128,0.112138 -1.298603,0.196162 -2.54592,0.646235 -3.670577,1.324467 -1.124629,0.677685 -2.104844,1.570274 -2.884578,2.626713 -0.779502,1.056481 -1.343361,2.256195 -1.65933,3.530534 -0.316216,1.274341 -0.37838,2.598559 -0.182935,3.89692 0.195591,1.298277 0.644957,2.545404 1.3224,3.67006 l 11.601876,19.253088 c -0.345867,0.1298 -0.699453,0.25003 -1.042314,0.38344 -1.048727,0.40806 -2.083433,0.83293 -3.10317,1.27434 -1.019736,0.44141 -2.024327,0.89943 -3.013769,1.37356 -0.989442,0.47413 -1.963426,0.96448 -2.921269,1.47071 -0.957843,0.50623 -1.899693,1.02809 -2.824634,1.5658 -0.92494,0.5377 -1.833131,1.09129 -2.723864,1.65984 -0.890734,0.56856 -1.765912,1.15531 -2.62413,1.7601 -0.858217,0.6048 -1.699713,1.22768 -2.522326,1.86759 -0.822614,0.63991 -1.626267,1.29703 -2.410189,1.97094 -0.783922,0.6739 -1.548156,1.36441 -2.2903,2.07119 -0.742144,0.70678 -1.462279,1.42981 -2.159558,2.16834 -0.697278,0.73853 -1.371739,1.49272 -2.021065,2.26188 -0.649326,0.76916 -1.273951,1.55312 -1.872237,2.3518 -0.598286,0.79867 -1.169949,1.61206 -1.714107,2.43912 -0.544159,0.82706 -1.060766,1.668 -1.547709,2.52233 -0.486944,0.85433 -0.944334,1.72195 -1.370976,2.60242 -0.426642,0.88048 -0.822204,1.77393 -1.185458,2.67943 -0.363253,0.9055 -0.694376,1.82288 -0.991154,2.75228 -0.296777,0.92941 -0.559301,1.8709 -0.786515,2.82309 -0.227213,0.95218 -0.419045,1.91538 -0.573608,2.88923 -0.154563,0.97384 -0.272058,1.95789 -0.350883,2.95227 -0.07882,0.99439 -0.118856,1.99894 -0.118856,3.01274 0,1.0138 0.04003,2.01835 0.118856,3.01273 0.07883,0.99439 0.19632,1.97895 0.350883,2.9528 0.154563,0.97384 0.346395,1.93704 0.573608,2.88922 0.227214,0.95219 0.489738,1.89317 0.786515,2.82257 0.296778,0.9294 0.627901,1.84731 0.991154,2.7528 0.363254,0.9055 0.758816,1.79844 1.185458,2.67891 0.426642,0.88048 0.884032,1.7481 1.370976,2.60243 0.486943,0.85432 1.00355,1.69578 1.547709,2.52284 0.544158,0.82706 1.115821,1.63994 1.714107,2.43861 0.598286,0.79867 1.222911,1.58315 1.872237,2.35231 0.649326,0.76916 1.323787,1.52335 2.021065,2.26188 0.697279,0.73853 1.417414,1.46105 2.159558,2.16783 0.742144,0.70677 1.506378,1.3978 2.2903,2.0717 0.783922,0.67391 1.587575,1.33103 2.410189,1.97094 0.822613,0.63991 1.664109,1.26228 2.522326,1.86707 0.858218,0.60479 1.733396,1.19206 2.62413,1.76062 0.890733,0.56855 1.798924,1.12162 2.723864,1.65933 0.924941,0.5377 1.866791,1.06008 2.824634,1.56631 0.957843,0.50623 1.931827,0.99658 2.921269,1.47071 0.989442,0.47414 1.994033,0.93163 3.013769,1.37305 1.019737,0.44141 2.054443,0.86627 3.10317,1.27434 1.048728,0.40806 2.111505,0.79948 3.187919,1.17357 1.076415,0.37409 2.166771,0.73124 3.269568,1.07073 1.102797,0.3395 2.218173,0.66157 3.346049,0.96584 1.127876,0.30427 2.267778,0.59043 3.41943,0.85886 1.151651,0.26842 2.31507,0.5189 3.489192,0.75086 1.174123,0.23195 2.359016,0.44541 3.554305,0.64027 1.19529,0.19485 2.401164,0.371 3.616317,0.52813 1.215153,0.15713 2.439966,0.29566 3.673678,0.41445 1.233712,0.11878 2.476453,0.21784 3.727421,0.29765 1.250967,0.0798 2.510111,0.14013 3.777029,0.18035 1.26692,0.0402 2.54146,0.0605 3.82302,0.0605 1.28157,0 2.55611,-0.0202 3.82303,-0.0605 1.26691,-0.0402 2.52606,-0.10053 3.77703,-0.18035 1.25096,-0.0798 2.49371,-0.17887 3.72742,-0.29765 1.23371,-0.11879 2.45852,-0.25732 3.67368,-0.41445 1.21515,-0.15713 2.42102,-0.33328 3.61631,-0.52813 0.93043,-0.15168 1.84907,-0.32397 2.76676,-0.49816 l 13.09997,21.73924 c 0.67785,1.12469 1.5706,2.10488 2.62723,2.88458 1.05657,0.77994 2.25644,1.34414 3.53105,1.66036 1.27473,0.31618 2.59928,0.37817 3.89796,0.18242 1.29854,-0.19585 2.54583,-0.64556 3.67057,-1.32343 0.37386,-0.22521 0.73258,-0.47466 1.07384,-0.74673 0.34117,-0.27227 0.66416,-0.5666 0.96687,-0.88108 0.3028,-0.31437 0.5847,-0.64823 0.84387,-0.99942 0.25908,-0.35128 0.49489,-0.71915 0.7059,-1.10123 0.21116,-0.38206 0.39708,-0.77755 0.55656,-1.18391 0.15933,-0.4062 0.29191,-0.8224 0.39687,-1.24592 0.10503,-0.42375 0.18219,-0.85393 0.231,-1.28777 0.0488,-0.43366 0.0692,-0.87006 0.061,-1.30638 -0.008,-0.43653 -0.045,-0.87207 -0.11007,-1.3038 -0.0652,-0.43145 -0.15861,-0.85819 -0.27957,-1.27744 -0.12076,-0.41955 -0.26887,-0.83074 -0.44338,-1.23093 -0.1746,-0.39992 -0.37519,-0.78798 -0.60048,-1.16169 l -10.43709,-17.32039 c 0.26843,-0.11306 0.54439,-0.21747 0.8108,-0.33279 1.01973,-0.44141 2.02434,-0.89892 3.01377,-1.37305 0.98944,-0.47413 1.96344,-0.96448 2.92127,-1.47071 0.95784,-0.50623 1.89971,-1.02861 2.82464,-1.56631 0.92493,-0.5377 1.83314,-1.09078 2.72386,-1.65933 0.89073,-0.56855 1.76592,-1.15583 2.62413,-1.76062 0.85821,-0.60478 1.69972,-1.22717 2.52233,-1.86707 0.8226,-0.6399 1.62679,-1.29704 2.4107,-1.97094 0.78392,-0.67389 1.54765,-1.36493 2.28979,-2.0717 0.74213,-0.70678 1.46228,-1.42931 2.15955,-2.16783 0.69728,-0.73853 1.37175,-1.49272 2.02107,-2.26188 0.64932,-0.76915 1.27396,-1.55364 1.87224,-2.35231 0.59828,-0.79866 1.16995,-1.61156 1.7141,-2.43861 0.54416,-0.82705 1.06077,-1.66852 1.54771,-2.52284 0.4Line truncated
style="stroke-linecap:round"
id="path7" />
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-ellipse-slash"><ellipse cx="12" cy="12" rx="10" ry="7"/><path d="M22 2 2 22"/></svg>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 288 B

+1 -1
View File
@@ -23,5 +23,5 @@ elements.forEach((el)=>{
ea.addText(el.x,el.y+i*el.height/text.length,text[i].trim());
}
});
ea.addElementsToView(false,false,true);
await ea.addElementsToView(false,false,true);
ea.deleteViewElements(elements);
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="100 80 500 400"><path d="M309.12 184.8c0 21.957-17.801 39.758-39.762 39.758-21.957 0-39.758-17.801-39.758-39.758 0-21.961 17.801-39.762 39.758-39.762 21.961 0 39.762 17.801 39.762 39.762M341.6 159.04h179.2v51.52H341.6zM309.12 282.24c0 21.961-17.801 39.762-39.762 39.762-21.957 0-39.758-17.801-39.758-39.762 0-21.957 17.801-39.758 39.758-39.758 21.961 0 39.762 17.801 39.762 39.758M341.6 256.48h179.2V308H341.6zM309.12 379.12c0 21.957-17.801 39.758-39.762 39.758-21.957 0-39.758-17.801-39.758-39.758 0-21.961 17.801-39.762 39.758-39.762 21.961 0 39.762 17.801 39.762 39.762M341.6 353.36h179.2v51.52H341.6z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-list"><path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/></svg>

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 337 B

+1 -17
View File
@@ -1,17 +1 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="120" height="120">
<!-- svg-source:excalidraw -->
<defs>
<style class="style-fonts">
@font-face {
font-family: "Virgil";
src: url("https://excalidraw.com/Virgil.woff2");
}
@font-face {
font-family: "Cascadia";
src: url("https://excalidraw.com/Cascadia.woff2");
}
</style>
</defs>
<g stroke-linecap="round"><g transform="translate(0 0) rotate(0 60 60)" fill-rule="evenodd"><path d="M0 0 L120 0 L120 40 L80 40 L80 120 L40 120 L40 40 L0 40 L0 0" stroke="none" stroke-width="0" fill="red" fill-rule="evenodd"></path><path d="M0 0 C41.51 0, 83.02 0, 120 0 M0 0 C30.58 0, 61.16 0, 120 0 M120 0 C120 12.11, 120 24.22, 120 40 M120 0 C120 13.92, 120 27.84, 120 40 M120 40 C108.75 40, 97.49 40, 80 40 M120 40 C107.65 40, 95.29 40, 80 40 M80 40 C80 66.51, 80 93.01, 80 120 M80 40 C80 70.33, 80 100.66, 80 120 M80 120 C66.08 120, 52.16 120, 40 120 M80 120 C70.07 120, 60.13 120, 40 120 M40 120 C40 89.21, 40 58.42, 40 40 M40 120 C40 92.66, 40 65.33, 40 40 M40 40 C25.35 40, 10.71 40, 0 40 M40 40 C27.7 40, 15.4 40, 0 40 M0 40 C0 24.03, 0 8.05, 0 0 M0 40 C0 27.82, 0 15.65, 0 0 M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0" stroke="transparent" stroke-width="0.5" fill="none"></path></g></g><mask></mask><g stroke-linecap="round"><g transform="translate(110 10) rotate(0 -50 50)" fill-rule="evenodd"><path d="M0 0 L-100 0 L-100 20 L-60 20 L-60 100 L-40 100 L-40 20 L0 20 L0 0" stroke="none" stroke-width="0" fill="currentColor" fill-rule="evenodd"></path><path d="M0 0 C-23.27 0, -46.54 0, -100 0 M0 0 C-23.31 0, -46.62 0, -100 0 M-100 0 C-100 6.13, -100 12.26, -100 20 M-100 0 C-100 5.84, -100 11.69, -100 20 M-100 20 C-87.37 20, -74.74 20, -60 20 M-100 20 C-88.34 20, -76.68 20, -60 20 M-60 20 C-60 37.78, -60 55.56, -60 100 M-60 20 C-60 39.34, -60 58.68, -60 100 M-60 100 C-52.58 100, -45.17 100, -40 100 M-60 100 C-54.72 100, -49.43 100, -40 100 M-40 100 C-40 83.83, -40 67.67, -40 20 M-40 100 C-40 77.76, -40 55.51, -40 20 M-40 20 C-25.4 20, -10.8 20, 0 20 M-40 20 C-28.47 20, -16.93 20, 0 20 M0 20 C0 15.42, 0 10.84, 0 0 M0 20 C0 14.54, 0 9.08, 0 0 M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0" stroke="currentColor" stroke-width="0.5" fill="none"></path></g></g><mask></mask></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-type-outline"><path d="M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z"/></svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 458 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" stroke="#000" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><g stroke-width="2" fill="none"><circle cx="12" cy="12" r="10"></circle><path d="M17 12h.01"></path><path d="M12 12h.01"></path><path d="M7 12h.01"></path></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-circle-ellipsis"><g stroke-width="2" fill="none"><circle cx="12" cy="12" r="10"></circle><path d="M17 12h.01"></path><path d="M12 12h.01"></path><path d="M7 12h.01"></path></g></svg>

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 375 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle stroke-width="2" cx="12" cy="5" r="1"></circle><circle stroke-width="2" cx="19" cy="5" r="1"></circle><circle stroke-width="2" cx="5" cy="5" r="1"></circle><circle stroke-width="2" cx="12" cy="12" r="1"></circle><circle stroke-width="2" cx="19" cy="12" r="1"></circle><circle stroke-width="2" cx="5" cy="12" r="1"></circle><circle stroke-width="2" cx="12" cy="19" r="1"></circle><circle stroke-width="2" cx="19" cy="19" r="1"></circle><circle stroke-width="2" cx="5" cy="19" r="1"></circle></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-grip"><circle stroke-width="2" cx="12" cy="5" r="1"></circle><circle stroke-width="2" cx="19" cy="5" r="1"></circle><circle stroke-width="2" cx="5" cy="5" r="1"></circle><circle stroke-width="2" cx="12" cy="12" r="1"></circle><circle stroke-width="2" cx="19" cy="12" r="1"></circle><circle stroke-width="2" cx="5" cy="12" r="1"></circle><circle stroke-width="2" cx="12" cy="19" r="1"></circle><circle stroke-width="2" cx="19" cy="19" r="1"></circle><circle stroke-width="2" cx="5" cy="19" r="1"></circle></svg>

Before

Width:  |  Height:  |  Size: 685 B

After

Width:  |  Height:  |  Size: 714 B

+1 -4
View File
@@ -1,4 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 567 489">
<path
d="M 20.803582,0.35478208 A 25,25 0 0 0 5.9442069,8.8176728 25,25 0 0 0 8.8172543,44.055954 L 31.254754,63.108689 c -0.121266,0.849954 -0.301322,1.680716 -0.388672,2.541015 -0.218469,2.151668 -0.330078,4.335551 -0.330078,6.544922 V 392.19462 c 0,2.20625 0.111609,4.38587 0.330078,6.53516 0.218468,2.14929 0.544482,4.26807 0.970703,6.34961 0.426219,2.08154 0.952918,4.12591 1.576172,6.12891 0.623252,2.00299 1.342775,3.96328 2.152343,5.87695 0.80957,1.91367 1.708193,3.7802 2.69336,5.59375 0.985166,1.81355 2.056984,3.57472 3.207031,5.27734 1.150047,1.70264 2.379385,3.34681 3.683594,4.92774 1.304208,1.58093 2.683206,3.09844 4.130859,4.54687 1.447654,1.44844 2.964542,2.82767 4.544922,4.13282 1.58038,1.30514 3.223392,2.53642 4.925781,3.6875 1.70239,1.15106 3.463664,2.22277 5.277344,3.20898 1.81368,0.98621 3.679496,1.88672 5.59375,2.69727 1.914254,0.81053 3.87675,1.5302 5.880859,2.15429 2.00411,0.6241 4.049565,1.15323 6.132813,1.58008 2.083248,0.42686 4.203801,0.75188 6.355469,0.9707 2.151667,0.21883 4.335552,0.33204 6.544922,0.33203 H 478.53601 c 2.20625,0 4.38587,-0.1132 6.53515,-0.33203 2.14929,-0.21882 4.26808,-0.54384 6.34961,-0.9707 0.30707,-0.063 0.59887,-0.16503 0.9043,-0.23242 l 33.48047,28.43164 a 25,25 0 0 0 35.23828,-2.87305 25,25 0 0 0 -2.87305,-35.23828 L 41.182488,5.9446259 A 25,25 0 0 0 29.485222,0.40556338 25,25 0 0 0 20.803582,0.35478208 Z M 94.536004,8.1946259 c -2.209366,0 -4.39326,0.1116097 -6.544922,0.3300781 -2.151664,0.2184684 -4.272226,0.5425319 -6.355469,0.9687499 -2.083244,0.42622 -4.128707,0.9548741 -6.132813,1.5781251 -2.004105,0.623253 -3.966609,1.340824 -5.880859,2.150391 -0.337447,0.142712 -0.651869,0.326303 -0.986328,0.474609 l 68.884767,58.498047 h 93.49024 23.52539 v 19.978516 79.392578 l 109.07422,92.6289 h 93.49218 21.4336 v 18.20313 79.39258 l 60.42383,51.31445 c 0.22119,-0.63745 0.49391,-1.25011 0.69531,-1.89648 0.62409,-2.00299 1.15127,-4.04738 1.57812,-6.12891 0.42686,-2.08153 0.75188,-4.20033 0.97071,-6.34961 0.21882,-2.14928 0.33203,-4.32892 0.33203,-6.53516 V 336.74736 271.15166 72.194626 c 0,-2.209349 -0.11321,-4.393275 -0.33203,-6.544922 -0.21882,-2.151647 -0.54386,-4.272242 -0.97071,-6.355469 -0.42685,-2.083227 -0.95403,-4.128722 -1.57812,-6.132812 -0.62409,-2.00409 -1.34376,-3.966624 -2.1543,-5.88086 -0.81054,-1.914234 -1.71302,-3.780086 -2.69922,-5.59375 -0.98619,-1.813662 -2.05792,-3.574971 -3.20898,-5.277343 -1.15106,-1.702373 -2.38041,-3.34737 -3.68555,-4.927735 -1.30514,-1.580364 -2.68439,-3.097282 -4.13281,-4.544922 -1.44842,-1.447638 -2.96596,-2.82471 -4.54688,-4.128906 -1.5809,-1.304195 -3.22708,-2.535511 -4.92968,-3.685547 -1.70262,-1.150034 -3.46187,-2.219921 -5.27539,-3.205078 -1.81353,-0.985156 -3.68011,-1.885752 -5.59375,-2.695312 -1.91366,-0.809561 -3.87593,-1.527143 -5.87891,-2.150391 -2.00298,-0.623246 -4.04739,-1.1519091 -6.12891,-1.5781251 -2.08151,-0.426215 -4.20034,-0.7502832 -6.34961,-0.9687499 -2.14925,-0.2184666 -4.32893,-0.3300781 -6.53515,-0.3300781 H 232.88952 155.64538 Z M 318.53601,72.194626 h 160 V 200.19462 H 458.97937 381.73718 318.53601 V 146.52275 80.927048 Z M 94.536004,116.84892 192.67859,200.19462 H 94.536004 Z m 0,147.3457 H 254.53601 v 128 H 94.536004 Z m 224.000006,42.87891 100.23437,85.12109 H 318.53601 Z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-grid-2x2-x"><path d="M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3"/><path d="m16 16 5 5"/><path d="m16 21 5-5"/></svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 367 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M40 352c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0zm192 0c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0zM40 320l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40zM232 192c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0zM40 160l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40L40 32C17.9 32 0 49.9 0 72l0 48c0 22.1 17.9 40 40 40zM232 32c-22.1 0-40 17.9-40 40l0 48c0 22.1 17.9 40 40 40l48 0c22.1 0 40-17.9 40-40l0-48c0-22.1-17.9-40-40-40l-48 0z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-layout-grid"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>

Before

Width:  |  Height:  |  Size: 930 B

After

Width:  |  Height:  |  Size: 415 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7c-12.23-91.55-87.28-166-178.9-177.6c-136.2-17.24-250.7 97.28-233.4 233.4c11.6 91.64 86.07 166.7 177.6 178.9c53.81 7.191 104.3-6.235 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 .0003C515.9 484.7 515.9 459.3 500.3 443.7zM288 232H231.1V288c0 13.26-10.74 24-23.1 24C194.7 312 184 301.3 184 288V232H127.1C114.7 232 104 221.3 104 208s10.74-24 23.1-24H184V128c0-13.26 10.74-24 23.1-24S231.1 114.7 231.1 128v56h56C301.3 184 312 194.7 312 208S301.3 232 288 232z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-fullscreen"><path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><rect width="10" height="8" x="7" y="8" rx="1"/></svg>

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 412 B

+1 -1
View File
@@ -1 +1 @@
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
+2 -2
View File
@@ -77,7 +77,7 @@ These are the scripts I use most often. I tried to order them by importance, but
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Fixed%20vertical%20distance.svg"/></div>|[[#Fixed vertical distance]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Golden%20Ratio.svg"/></div>|[[#Golden Ratio]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Grid%20Selected%20Images.svg"/></div>|[[#Grid selected images]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png"/></div>|[[#Mindmap Builder]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20Builder.svg"/></div>|[[#Mindmap Builder]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20format.svg"/></div>|[[#Mindmap format]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Printable%20Layout%20Wizard.svg"/></div>|[[#Printable Layout Wizard]]|
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Zoom%20to%20Fit%20Selected%20Elements.svg"/></div>|[[#Zoom to Fit Selected Elements]]|
@@ -470,7 +470,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
```excalidraw-script-install
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20Builder.md
```
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Rapid mind mapping workflow driven by keyboard shortcuts: add sibling/child nodes, auto-layout and branch styling, quick navigation, optional recursive grouping, and Markdown copy/paste import/export for bullet-list sync.<br><a href="https://www.youtube.com/watch?v=qY66yoobaX4" target="_blank"><img src ="https://i.ytimg.com/vi/qY66yoobaX4/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/qY66yoobaX4' target='_blank'>Link to video on YouTube</a><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png'></td></tr></table>
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Rapid mind mapping workflow driven by keyboard shortcuts: add sibling/child nodes, auto-layout and branch styling, quick navigation, optional recursive grouping, and Markdown copy/paste import/export for bullet-list sync.Sign up for the <a href="https://visual-thinking-workshop.com/mindmap" target="_blank">MindMap Builder Self-Paced Course</a>!<br><a href="https://www.youtube.com/watch?v=qY66yoobaX4" target="_blank"><img src ="https://i.ytimg.com/vi/qY66yoobaX4/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/qY66yoobaX4' target='_blank'>Link to video on YouTube</a><br><a href="https://www.youtube.com/watch?v=5G9QF-u9w0Q" target="_blank"><img src ="https://i.ytimg.com/vi/5G9QF-u9w0Q/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/5G9QF-u9w0Q' target='_blank'>Link to video on YouTube</a><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png'></td></tr></table>
## Mindmap connector
```excalidraw-script-install
+776
View File
@@ -0,0 +1,776 @@
/*
This is an experimental script. If you find bugs, please consider debugging yourself then submitting a PR on github with the fix, instead of raising an issue. Thank you!
This script modifies the color lightness/hue/saturation/transparency of selected Excalidraw elements and SVG and nested Excalidraw drawings. Select eligible elements in the scene, then run the script.
- The color of Excalidraw elements (lines, ellipses, rectangles, etc.) will be changed by the script.
- The color of SVG elements and nested Excalidraw drawings will only be mapped. When mapping colors, the original image remains unchanged, only a mapping table is created and the image is recolored during rendering of your Excalidraw screen. In case you want to make manual changes you can also edit the mapping in Markdown View Mode under `## Embedded Files`
If you select only a single SVG or nested Excalidraw element, then the script offers an additional feature. You can map colors one by one in the image.
```js
*/
const HELP_TEXT = `
- Select SVG images, nested Excalidraw drawings and/or regular Excalidraw elements
- For a single selected image, you can map colors individually in the color mapping section
- For Excalidraw elements: stroke and background colors are modified permanently
- For SVG/nested drawings: original files stay unchanged, color mapping is stored under \`## Embedded Files\`
- Using color maps helps maintain links between drawings while allowing different color themes
- Sliders work on relative scale - the amount of change is applied to current values
- Unlike Excalidraw's opacity setting which affects the whole element:
- Shade Master can set different opacity for stroke vs background
- **Note:** SVG/nested drawing colors are mapped at color name level, thus "black" is different from "#000000"
- Additionally if the same color is used as fill and stroke the color can only be mapped once
- This is an experimental script - contributions welcome on GitHub via PRs
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
<a href="https://www.youtube.com/watch?v=ISuORbVKyhQ" target="_blank"><img src ="https://i.ytimg.com/vi/ISuORbVKyhQ/maxresdefault.jpg" style="max-width:560px; width:100%"></a>
`;
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.19.1")) {
new Notice("Please update the Excalidraw Plugin to version 2.19.1 or higher.");
return;
}
const existingTab = ea.checkForActiveSidepanelTabForScript();
if (existingTab) {
const hostEA = existingTab.getHostEA();
if (hostEA && hostEA !== ea) {
hostEA.setView(ea.targetView);
existingTab.open();
return;
}
}
/*
SVGColorInfo is returned by ea.getSVGColorInfoForImgElement. Color info will all the color strings in the SVG file plus "fill" which represents the default fill color for SVG icons set at the SVG root element level. Fill if not set defaults to black:
type SVGColorInfo = Map<string, {
mappedTo: string;
fill: boolean;
stroke: boolean;
}>;
In the Excalidraw file under `## Embedded Files` the color map is included after the file. That color map implements ColorMap. ea.updateViewSVGImageColorMap takes a ColorMap as input.
interface ColorMap {
[color: string]: string;
};
*/
// Main script state variables
let allElements = [];
let svgImageElements = [];
let lastSelectionIds = "";
const originalColors = new Map();
const currentColors = new Map();
const colorInputs = new Map();
const sliderResetters = [];
let terminate = false;
const FORMAT = "Color Format";
const STROKE = "Modify Stroke Color";
const BACKGROUND = "Modify Background Color"
const ACTIONS = ["Hue", "Lightness", "Saturation", "Transparency"];
const precision = [1,2,2,3];
const minLigtness = 1/Math.pow(10,precision[2]);
const maxLightness = 100 - minLigtness;
const minSaturation = 1/Math.pow(10,precision[2]);
let settings = ea.getScriptSettings();
//set default values on first run
if(!settings[STROKE]) {
settings = {};
settings[FORMAT] = {
value: "HEX",
valueset: ["HSL", "RGB", "HEX"],
description: "Output color format."
};
settings[STROKE] = { value: true }
settings[BACKGROUND] = {value: true }
ea.setScriptSettings(settings);
}
function getRegularElements() {
if (!ea.targetView) return [];
ea.clear();
//loading view elements again as element objects change when colors are updated
const viewElements = ea.getViewSelectedElements();
return viewElements.filter(el =>
["rectangle", "ellipse", "diamond", "line", "arrow", "freedraw", "text"].includes(el.type)
);
}
const updatedImageElementColorMaps = new Map();
let isWaitingForSVGUpdate = false;
function updateViewImageColors() {
if(terminate || isWaitingForSVGUpdate || updatedImageElementColorMaps.size === 0) {
return;
}
isWaitingForSVGUpdate = true;
elementArray = Array.from(updatedImageElementColorMaps.keys());
colorMapArray = Array.from(updatedImageElementColorMaps.values());
updatedImageElementColorMaps.clear();
ea.updateViewSVGImageColorMap(elementArray, colorMapArray).then(()=>{
isWaitingForSVGUpdate = false;
updateViewImageColors();
});
}
async function storeOriginalColors() {
// Clear previous state
originalColors.clear();
currentColors.clear();
// Store colors for regular elements
for (const el of getRegularElements()) {
const key = el.id;
const colorData = {
type: "regular",
strokeColor: el.strokeColor,
backgroundColor: el.backgroundColor
};
originalColors.set(key, colorData);
}
// Store colors for SVG elements
for (const el of svgImageElements) {
const colorInfo = await ea.getSVGColorInfoForImgElement(el);
const svgColors = new Map();
for (const [color, info] of colorInfo.entries()) {
svgColors.set(color, {...info});
}
originalColors.set(el.id, {type: "svg",colors: svgColors});
}
copyOriginalsToCurrent();
}
function copyOriginalsToCurrent() {
currentColors.clear();
for (const [key, value] of originalColors.entries()) {
if(value.type === "regular") {
currentColors.set(key, {...value});
} else {
const newColorMap = new Map();
for (const [color, info] of value.colors.entries()) {
newColorMap.set(color, {...info});
}
currentColors.set(key, {type: "svg", colors: newColorMap});
}
}
}
function clearSVGMapping() {
for (const resetter of sliderResetters) {
resetter();
}
// Reset SVG elements
if (svgImageElements.length === 1) {
const el = svgImageElements[0];
const original = originalColors.get(el.id);
const current = currentColors.get(el.id);
if (original && original.type === "svg") {
for (const color of original.colors.keys()) {
current.colors.get(color).mappedTo = color;
}
}
} else {
for (const el of svgImageElements) {
const original = originalColors.get(el.id);
const current = currentColors.get(el.id);
if (original && original.type === "svg") {
for (const color of original.colors.keys()) {
current.colors.get(color).mappedTo = color;
}
}
}
}
run("clear");
}
// Set colors
async function setColors(colors) {
debounceColorPicker = true;
const regularElements = getRegularElements();
if (regularElements.length > 0) {
ea.copyViewElementsToEAforEditing(regularElements);
for (const el of ea.getElements()) {
const original = colors.get(el.id);
if (original && original.type === "regular") {
if (original.strokeColor) el.strokeColor = original.strokeColor;
if (original.backgroundColor) el.backgroundColor = original.backgroundColor;
}
}
await ea.addElementsToView(false, false);
}
// Reset SVG elements
if (svgImageElements.length === 1) {
const el = svgImageElements[0];
const original = colors.get(el.id);
if (original && original.type === "svg") {
const newColorMap = {};
for (const [color, info] of original.colors.entries()) {
newColorMap[color] = info.mappedTo;
// Update UI components
const inputs = colorInputs.get(color);
if (inputs) {
if(info.mappedTo === "fill") {
info.mappedTo = "black";
//"fill" is a special value in case the SVG has no fill color defined (i.e black)
inputs.textInput.setValue("black");
inputs.colorPicker.setValue("#000000");
} else {
const cm = ea.getCM(info.mappedTo);
inputs.textInput.setValue(info.mappedTo);
inputs.colorPicker.setValue(cm.stringHEX({alpha: false}).toLowerCase());
}
}
}
updatedImageElementColorMaps.set(el, newColorMap);
}
} else {
for (const el of svgImageElements) {
const original = colors.get(el.id);
if (original && original.type === "svg") {
const newColorMap = {};
for (const [color, info] of original.colors.entries()) {
newColorMap[color] = info.mappedTo;
}
updatedImageElementColorMaps.set(el, newColorMap);
}
}
}
updateViewImageColors();
}
function modifyColor(color, isDecrease, step, action) {
if (!color) return null;
const cm = ea.getCM(color);
if (!cm) return color;
let modified = cm;
if (modified.lightness === 0) modified = modified.lightnessTo(minLigtness);
if (modified.lightness === 100) modified = modified.lightnessTo(maxLightness);
if (modified.saturation === 0) modified = modified.saturationTo(minSaturation);
switch(action) {
case "Lightness":
// handles edge cases where lightness is 0 or 100 would convert saturation and hue to 0
let lightness = cm.lightness;
const shouldRoundLight = (lightness === minLigtness || lightness === maxLightness);
if (shouldRoundLight) lightness = Math.round(lightness);
lightness += isDecrease ? -step : step;
if (lightness <= 0) lightness = minLigtness;
if (lightness >= 100) lightness = maxLightness;
modified = modified.lightnessTo(lightness);
break;
case "Hue":
modified = isDecrease ? modified.hueBy(-step) : modified.hueBy(step);
break;
case "Transparency":
modified = isDecrease ? modified.alphaBy(-step) : modified.alphaBy(step);
break;
default:
let saturation = cm.saturation;
const shouldRoundSat = saturation === minSaturation;
if (shouldRoundSat) saturation = Math.round(saturation);
saturation += isDecrease ? -step : step;
if (saturation <= 0) saturation = minSaturation;
modified = modified.saturationTo(saturation);
}
const hasAlpha = modified.alpha < 1;
const opts = { alpha: hasAlpha, precision };
const format = settings[FORMAT].value;
switch(format) {
case "RGB": return modified.stringRGB(opts).toLowerCase();
case "HEX": return modified.stringHEX(opts).toLowerCase();
default: return modified.stringHSL(opts).toLowerCase();
}
}
function slider(contentEl, action, min, max, step, invert) {
let prevValue = (max-min)/2;
let debounce = false;
let sliderControl;
new ea.obsidian.Setting(contentEl)
.setName(action)
.addSlider(slider => {
sliderControl = slider;
slider
.setLimits(min, max, step)
.setValue(prevValue)
.onChange(async (value) => {
if (debounce) return;
const isDecrease = invert ? value > prevValue : value < prevValue;
const step = Math.abs(value-prevValue);
prevValue = value;
if(step>0) {
run(action, isDecrease, step);
}
});
}
);
return () => {
debounce = true;
prevValue = (max-min)/2;
sliderControl.setValue(prevValue);
debounce = false;
}
}
let debounceColorPicker = true;
function renderSidepanel(contentEl) {
contentEl.empty();
contentEl.createEl('h2', { text: 'Shade Master' });
const helpDiv = contentEl.createEl("details", {
attr: { style: "margin-bottom: 1em;background: var(--background-secondary); padding: 1em; border-radius: 4px;" }});
helpDiv.createEl("summary", { text: "Help & Usage Guide", attr: { style: "cursor: pointer; color: var(--text-accent);" } });
const helpDetailsDiv = helpDiv.createEl("div", {
attr: { style: "margin-top: 0em; " }
});
ea.obsidian.MarkdownRenderer.render(ea.plugin.app, HELP_TEXT, helpDetailsDiv, "", ea.plugin);
if (!ea.targetView) {
contentEl.createEl("p", {
text: "No active Excalidraw view found. Please open a drawing and select elements to use Shade Master.",
attr: { style: "color: var(--text-muted);" }
});
return;
}
const { width, height } = ea.getExcalidrawAPI().getAppState();
if(allElements.length === 0) {
contentEl.createEl("p", {
text: "Select at least one rectangle, ellipse, diamond, line, arrow, freedraw, text or SVG image element",
attr: { style: "color: var(--text-warning);" }
});
// return; // Removed early return to allow rendering of the Close button
} else {
// Only render controls if elements are selected
const component = new ea.obsidian.Setting(contentEl)
.setName(FORMAT)
.setDesc("Output color format")
.addDropdown(dropdown => dropdown
.addOptions({
"HSL": "HSL",
"RGB": "RGB",
"HEX": "HEX"
})
.setValue(settings[FORMAT].value)
.onChange(value => {
settings[FORMAT].value = value;
run();
dirty = true;
})
);
new ea.obsidian.Setting(contentEl)
.setName(STROKE)
.addToggle(toggle => toggle
.setValue(settings[STROKE].value)
.onChange(value => {
settings[STROKE].value = value;
dirty = true;
})
);
new ea.obsidian.Setting(contentEl)
.setName(BACKGROUND)
.addToggle(toggle => toggle
.setValue(settings[BACKGROUND].value)
.onChange(value => {
settings[BACKGROUND].value = value;
dirty = true;
})
);
sliderResetters.length = 0; // Clear existing resetters
sliderResetters.push(slider(contentEl, "Hue", 0, 360, 1, false));
sliderResetters.push(slider(contentEl, "Saturation", 0, 200, 1, false));
sliderResetters.push(slider(contentEl, "Lightness", 0, 200, 1, false));
sliderResetters.push(slider(contentEl, "Transparency", 0, 2, 0.05, true));
// Add color pickers if a single SVG image is selected
if (svgImageElements.length === 1) {
const svgElement = svgImageElements[0];
const initialColorInfo = currentColors.get(svgElement.id).colors;
const colorSection = contentEl.createDiv();
colorSection.createEl('h3', { text: 'SVG Colors' });
colorInputs.clear(); // Clear old inputs map
for (const [color, info] of initialColorInfo.entries()) {
const row = new ea.obsidian.Setting(colorSection)
.setName(color === "fill" ? "SVG default" : color)
.setDesc(`${info.fill ? "Fill" : ""}${info.fill && info.stroke ? " & " : ""}${info.stroke ? "Stroke" : ""}`);
row.descEl.style.width = "100px";
row.nameEl.style.width = "100px";
// Create color preview div
const previewDiv = row.controlEl.createDiv();
previewDiv.style.width = "50px";
previewDiv.style.height = "20px";
previewDiv.style.border = "1px solid var(--background-modifier-border)";
if (color === "transparent") {
previewDiv.style.backgroundImage = "linear-gradient(45deg, #808080 25%, transparent 25%), linear-gradient(-45deg, #808080 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #808080 75%), linear-gradient(-45deg, transparent 75%, #808080 75%)";
previewDiv.style.backgroundSize = "10px 10px";
previewDiv.style.backgroundPosition = "0 0, 0 5px, 5px -5px, -5px 0px";
} else {
previewDiv.style.backgroundColor = ea.getCM(color).stringHEX({alpha: false}).toLowerCase();
}
const resetButton = new ea.obsidian.Setting(row.controlEl)
.addButton(button => button
.setButtonText(">>")
.setClass("reset-color-button")
.onClick(async () => {
const original = originalColors.get(svgElement.id);
const current = currentColors.get(svgElement.id);
if (original?.type === "svg") {
const originalInfo = original.colors.get(color);
const currentInfo = current.colors.get(color);
if (originalInfo) {
currentInfo.mappedTo = color;
run("reset single color");
}
}
}))
resetButton.settingEl.style.padding = "0";
resetButton.settingEl.style.border = "0";
// Add text input for color value
const textInput = new ea.obsidian.TextComponent(row.controlEl)
.setValue(info.mappedTo)
.setPlaceholder("Color value");
textInput.inputEl.style.width = "100%";
textInput.onChange(value => {
const lower = value.toLowerCase();
if (lower === color) return;
textInput.setValue(lower);
})
const applyButtonComponent = new ea.obsidian.Setting(row.controlEl)
.addButton(button => button
.setIcon("check")
.setTooltip("Apply")
.onClick(async () => {
const value = textInput.getValue();
try {
if(!CSS.supports("color",value)) {
new Notice (`${value} is not a valid color string`);
return;
}
const cm = ea.getCM(value);
if (cm) {
const format = settings[FORMAT].value;
const alpha = cm.alpha < 1 ? true : false;
const newColor = format === "RGB"
? cm.stringRGB({alpha , precision }).toLowerCase()
: format === "HEX"
? cm.stringHEX({alpha}).toLowerCase()
: cm.stringHSL({alpha, precision }).toLowerCase();
textInput.setValue(newColor);
const currentInfo = currentColors.get(svgElement.id).colors;
currentInfo.get(color).mappedTo = newColor;
run("Update SVG color");
debounceColorPicker = true;
colorPicker.setValue(cm.stringHEX({alpha: false}).toLowerCase());
}
} catch (e) {
console.error("Invalid color value:", e);
}
}));
applyButtonComponent.settingEl.style.padding = "0";
applyButtonComponent.settingEl.style.border = "0";
// Add color picker
const colorPicker = new ea.obsidian.ColorComponent(row.controlEl)
.setValue(ea.getCM(info.mappedTo).stringHEX({alpha: false}).toLowerCase());
colorPicker.colorPickerEl.style.maxWidth = "2.5rem";
// Add palette picker button
const paletteButton = new ea.obsidian.Setting(row.controlEl)
.addButton(button => button
.setIcon("swatch-book")
.setTooltip("Pick from Palette")
.onClick(async () => {
const selected = await ea.showColorPicker(button.buttonEl, "elementStroke");
if (selected) {
try {
const cm = ea.getCM(selected);
if (cm) {
const format = settings[FORMAT].value;
// Preserve alpha from original color
const currentInfo = currentColors.get(svgElement.id).colors.get(color);
const originalAlpha = ea.getCM(currentInfo.mappedTo).alpha;
cm.alphaTo(originalAlpha);
const alpha = originalAlpha < 1 ? true : false;
const newColor = format === "RGB"
? cm.stringRGB({alpha , precision }).toLowerCase()
: format === "HEX"
? cm.stringHEX({alpha}).toLowerCase()
: cm.stringHSL({alpha, precision }).toLowerCase();
// Update text input
textInput.setValue(newColor);
// Update Color Picker visual
colorPicker.setValue(cm.stringHEX({alpha: false}).toLowerCase());
// Update SVG mapping
currentInfo.mappedTo = newColor;
run("Update SVG color");
}
} catch (e) {
console.error("Invalid color value:", e);
}
}
}));
paletteButton.settingEl.style.padding = "0";
paletteButton.settingEl.style.border = "0";
paletteButton.infoEl.style.display = "none";
// Store references to the components
colorInputs.set(color, {
textInput,
colorPicker,
previewDiv,
resetButton
});
colorPicker.colorPickerEl.addEventListener('click', () => {
debounceColorPicker = false;
});
colorPicker.onChange(async (value) => {
try {
if(!debounceColorPicker) {
const currentInfo = currentColors.get(svgElement.id).colors.get(color);
// Preserve alpha from original color
const originalAlpha = ea.getCM(currentInfo.mappedTo).alpha;
const cm = ea.getCM(value);
cm.alphaTo(originalAlpha);
const alpha = originalAlpha < 1 ? true : false;
const format = settings[FORMAT].value;
const newColor = format === "RGB"
? cm.stringRGB({alpha, precision }).toLowerCase()
: format === "HEX"
? cm.stringHEX({alpha}).toLowerCase()
: cm.stringHSL({alpha, precision }).toLowerCase();
// Update text input
textInput.setValue(newColor);
// Update SVG
currentInfo.mappedTo = newColor;
run("Update SVG color");
}
} catch (e) {
console.error("Invalid color value:", e);
} finally {
debounceColorPicker = true;
}
});
}
}
}
const buttons = new ea.obsidian.Setting(contentEl);
if(svgImageElements.length > 0) {
buttons.addButton(button => button
.setButtonText("Initialize SVG Colors")
.onClick(() => {
debounceColorPicker = true;
clearSVGMapping();
})
);
}
if (allElements.length > 0) {
buttons.addButton(button => button
.setButtonText("Reset")
.onClick(() => {
for (const resetter of sliderResetters) {
resetter();
}
copyOriginalsToCurrent();
setColors(originalColors);
}));
}
buttons.addButton(button => button
.setButtonText("Close")
.onClick(() => {
if(ea.sidepanelTab) {
ea.sidepanelTab.close();
}
ea.toggleSidepanelView();
}));
}
function executeChange(isDecrease, step, action) {
const modifyStroke = settings[STROKE].value;
const modifyBackground = settings[BACKGROUND].value;
const regularElements = getRegularElements();
// Process regular elements
if (regularElements.length > 0) {
for (const el of regularElements) {
const currentColor = currentColors.get(el.id);
if (modifyStroke && currentColor.strokeColor) {
currentColor.strokeColor = modifyColor(el.strokeColor, isDecrease, step, action);
}
if (modifyBackground && currentColor.backgroundColor) {
currentColor.backgroundColor = modifyColor(el.backgroundColor, isDecrease, step, action);
}
}
}
// Process SVG image elements
if (svgImageElements.length === 1) { // Only update UI for single SVG
const el = svgImageElements[0];
colorInfo = currentColors.get(el.id).colors;
// Process each color in the SVG
for (const [color, info] of colorInfo.entries()) {
let shouldModify = (modifyBackground && info.fill) || (modifyStroke && info.stroke);
if (shouldModify) {
const modifiedColor = modifyColor(info.mappedTo, isDecrease, step, action);
colorInfo.get(color).mappedTo = modifiedColor;
// Update UI components if they exist
const inputs = colorInputs.get(color);
if (inputs) {
const cm = ea.getCM(modifiedColor);
inputs.textInput.setValue(modifiedColor);
inputs.colorPicker.setValue(cm.stringHEX({alpha: false}).toLowerCase());
}
}
}
} else {
if (svgImageElements.length > 0) {
for (const el of svgImageElements) {
const colorInfo = currentColors.get(el.id).colors;
// Process each color in the SVG
for (const [color, info] of colorInfo.entries()) {
let shouldModify = (modifyBackground && info.fill) || (modifyStroke && info.stroke);
if (shouldModify) {
const modifiedColor = modifyColor(info.mappedTo, isDecrease, step, action);
colorInfo.get(color).mappedTo = modifiedColor;
}
}
}
}
}
}
let isRunning = false;
let queue = false;
function processQueue() {
if (!terminate && !isRunning && queue) {
queue = false;
isRunning = true;
setColors(currentColors).then(() => {
isRunning = false;
if (queue) processQueue();
});
}
}
function run(action="Hue", isDecrease=true, step=0) {
// passing invalid action (such as "clear") will bypass rewriting of colors using CM
// this is useful when resetting colors to original values
if(ACTIONS.includes(action)) {
executeChange(isDecrease, step, action);
}
queue = true;
if (!isRunning) processQueue();
}
// Function to refresh internal state based on current selection
function refreshSelectionState() {
if (!ea.targetView) {
allElements = [];
svgImageElements = [];
lastSelectionIds = "";
return;
}
allElements = ea.getViewSelectedElements();
svgImageElements = allElements.filter(el => {
if(el.type !== "image") return false;
const file = ea.getViewFileForImageElement(el);
if(!file) return false;
return el.type === "image" && (
file.extension === "svg" ||
ea.isExcalidrawFile(file)
);
});
lastSelectionIds = allElements.map(e => e.id).sort().join(",");
}
// Sidepanel initialization and logic
ea.createSidepanelTab("Shade Master", false, true).then(tab => {
if (!tab) return;
const initializeAndRender = async () => {
refreshSelectionState();
await storeOriginalColors();
renderSidepanel(tab.contentEl);
processQueue();
};
tab.onOpen = async () => {
terminate = false;
// Initial load
await initializeAndRender();
};
tab.onFocus = async (view) => {
if (view && view !== ea.targetView) {
ea.setView(view);
ea.clear();
}
// Check if selection changed
const currentSelectionStr = ea.getViewSelectedElements().map(e => e.id).sort().join(",");
if (currentSelectionStr !== lastSelectionIds) {
await initializeAndRender();
}
};
tab.onClose = async () => {
terminate = true;
if (dirty) {
ea.setScriptSettings(settings);
}
if(ea.targetView && ea.targetView.isDirty()) {
ea.targetView.save(false);
}
};
tab.open();
});
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.19.0",
"version": "2.20.6",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.19.0",
"version": "2.20.6",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+3307 -1510
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -17,20 +17,20 @@
"build:all": "npm run build:mathjax && npm run build",
"dev:mathjax": "cd MathjaxToSVG && npm run dev",
"dev:all": "npm run dev:mathjax && npm run dev",
"doc": "npm run lib && node scripts/generate-script-library.js"
"doc": "npm run lib && node scripts/generate-script-library.js",
"mindmap": "node scripts/deploy-mindmap-builder.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@zsviczian/excalidraw": "0.18.0-67",
"@zsviczian/excalidraw": "0.18.0-84",
"chroma-js": "^3.1.2",
"clsx": "^2.0.0",
"@zsviczian/colormaster": "^1.2.2",
"gl-matrix": "^3.4.3",
"js-yaml": "^4.1.0",
"lucide-react": "^0.479.0",
"mathjax-full": "^3.2.2",
"monkey-around": "^2.3.0",
"nanoid": "^4.0.2",
+137
View File
@@ -0,0 +1,137 @@
const path = require("path");
const fs = require("fs/promises");
const { minify } = require("uglify-js");
const LZString = require("lz-string");
const CHUNK_SIZE = 256;
const NEEDLE = "const removeKeydownHandlers";
const root = path.resolve(__dirname, "..");
const sourcePath = path.join(root, "ea-scripts", "Mindmap Builder.js");
const outputPath = path.join(root, "ea-scripts", "Mindmap Builder.md");
const HEADER = `/*
# Mind Map Builder
![](https://youtu.be/5G9QF-u9w0Q)
## Overview
**Mind Map Builder** transforms the Obsidian-Excalidraw canvas into a rapid brainstorming environment, allowing users to build complex, structured, and visually organized mind maps using primarily keyboard shortcuts.
The script balances **automation** (auto-layout, recursive grouping, and contrast-aware coloring) with **explicit flexibility** (node pinning and redirection logic), ensuring that the mind map stays organized even as it grows to hundreds of nodes. It leverages the Excalidraw Sidepanel API to provide a persistent control interface utilizing the Obsidian sidepanel, that can also be undocked into a floating modal.
> [!Tip]
> 🚀 Become a MindMap Builder Pro with the Official [MindMap Builder Course](https://www.visual-thinking-workshop.com/mindmap)!
> [!Info]
> Mindmap Builder is Minified and compressed to reduce size and improve performance. You can find the source here: [Mindmap Builder.js](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.js)
> API documentation: [MindMapBuilderAPI.md](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/docs/ea-script-docs/MindMapBuilderAPI.md)
## Show Your Love!
💖 **If you love MindMap Builder** say thank you, and [Buy me a Coffee](https://ko-fi.com/zsolt) 🍵
## The Script
\`\`\`js*/
`;
const FOOTER = `
const VERSION = "v${new Date().toISOString().slice(2, 10).replace(/-/g, ".")}";
if (!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.20.6")) {
new Notice("Please update the Excalidraw Plugin to version 2.20.6 or higher.");
return;
}
ea.skipSidepanelScriptRestore();
const existingTab = ea.checkForActiveSidepanelTabForScript();
if (existingTab) {
const hostEA = existingTab.getHostEA();
if (hostEA && hostEA !== ea) {
hostEA.activateMindmap = true;
hostEA.setView(ea.targetView);
existingTab.open(false);
return;
}
};
const mmbSource = \`
`;
const FOOTER_TAIL = `\`;
const script = ea.decompressFromBase64(mmbSource.replaceAll("\\n", "").trim())
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;
await new AsyncFunction("ea", "utils", "VERSION", script)(ea, utils, VERSION);
`;
function chunkString(input, size) {
const chunks = [];
for (let i = 0; i < input.length; i += size) {
chunks.push(input.slice(i, i + size));
}
return chunks;
}
function stripHeader(source) {
const idx = source.indexOf(NEEDLE);
if (idx === -1) {
throw new Error(`Marker "${NEEDLE}" not found in Mindmap Builder.js`);
}
return source.slice(idx);
}
function wrapAsyncIIFE(body) {
return `(async()=>{\n${body}\n})()`;
}
function minifyCode(source) {
const result = minify(source, {
compress: { passes: 3 },
mangle: true,
output: { ascii_only: true }
});
if (result.error) {
throw result.error;
}
return result.code;
}
function unwrapAsyncIIFE(minified) {
const match = minified.match(/^\(async\(\)=>\{([\s\S]*)\}\)\(\);?$/);
if (!match) {
throw new Error("Unable to strip async IIFE wrapper from minified output");
}
return match[1];
}
function compressBase64(text) {
return LZString.compressToBase64(text);
}
function formatCompressed(compressed) {
return chunkString(compressed, CHUNK_SIZE).join("\n\n");
}
async function generate() {
const raw = await fs.readFile(sourcePath, "utf8");
const body = stripHeader(raw).trim();
const wrapped = wrapAsyncIIFE(body);
const minified = minifyCode(wrapped);
const unwrapped = unwrapAsyncIIFE(minified);
const compressed = compressBase64(unwrapped);
const formatted = formatCompressed(compressed);
const output = `${HEADER}${FOOTER}${formatted}${FOOTER_TAIL}`;
await fs.writeFile(outputPath, output, "utf8");
console.log(`Mindmap Builder.md generated at ${outputPath}`);
}
generate().catch((err) => {
console.error(err);
process.exitCode = 1;
});
+5 -2
View File
@@ -261,6 +261,8 @@ const TYPE_DEF_WHITELIST = [
"lib/types/AIUtilTypes.d.ts",
"node_modules/@zsviczian/excalidraw/types/element/src/types.d.ts",
"node_modules/@zsviczian/excalidraw/types/excalidraw/types.d.ts",
"node_modules/@zsviczian/excalidraw/types/element/src/bounds.d.ts",
"node_modules/@zsviczian/excalidraw/types/excalidraw/components/App.d.ts",
];
/**
@@ -552,8 +554,9 @@ function main() {
.filter(
(d) =>
d.isFile() &&
d.name.endsWith('.md') &&
d.name.toLowerCase() !== 'index-new.md'
(d.name.endsWith('.md') || d.name.toLowerCase() === "mindmap builder.js") &&
d.name.toLowerCase() !== 'index-new.md' &&
d.name.toLowerCase() !== 'mindmap builder.md'
)
.map((d) => d.name)
.sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
+84 -441
View File
@@ -1,53 +1,38 @@
import { Bookmark, Camera, Copy, Crop, Globe, RotateCcw, Scan, Settings, TextSelect } from "lucide-react";
import * as React from "react";
import { getIcon } from "obsidian";
import { PenStyle } from "src/types/penTypes";
import React, { memo, useEffect, useRef } from "react";
const _getIconAsJSX = memo(function _getIconAsJSX({ iconId }: { iconId: string}) {
const icon = getIcon(iconId);
if (!icon) return (<svg className="svg-icon excalidraw-icon-missing"/>);
const ref = useRef<SVGSVGElement>(null);
useEffect(() => {
if (!ref.current) return;
[...icon.attributes].forEach( attr => {
ref.current.setAttribute(attr.nodeName, attr.nodeValue);
});
});
return (<svg ref={ref} dangerouslySetInnerHTML={{__html: icon.innerHTML}} />);
});
export const getIconAsJSX = (iconId: string) =>
(<_getIconAsJSX iconId={iconId}/>);
export const ICONS = {
ExportImage: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<g strokeWidth="1.25">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M15 8h.01"></path>
<path d="M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5"></path>
<path d="M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4"></path>
<path d="M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598"></path>
<path d="M19 16v6"></path>
<path d="M22 19l-3 3l-3 -3"></path>
</g>
</svg>
),
BackOfNote: (<TextSelect />),
Reload: (<RotateCcw />),
Copy: (<Copy /> ),
Globe: (<Globe />),
Crop: (<Crop />),
Bookmark: (<Bookmark />),
Camera: (<Camera />),
ZoomToSelectedElement: (<Scan />),
Properties: (<Settings />),
ZoomToSection: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
>
<text x="6" y="18" fontSize="22px">#</text>
</svg>
),
ExportImage: getIconAsJSX("image-down"),
BackOfNote: getIconAsJSX("text-select"),
Reload: getIconAsJSX("rotate-ccw"),
Copy: getIconAsJSX("copy"),
Globe: getIconAsJSX("globe"),
Crop: getIconAsJSX("crop"),
Bookmark: getIconAsJSX("bookmark"),
Camera: getIconAsJSX("camera"),
ZoomToSelectedElement: getIconAsJSX("scan"),
Properties: getIconAsJSX("settings"),
ZoomToSection: getIconAsJSX("hash"),
ZoomToBlock: (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -61,21 +46,7 @@ export const ICONS = {
<text x="1" y="18" fontSize="22px">#^</text>
</svg>
),
Learn: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z"/>
<path d="M22 10v6"/>
<path d="M6 12.5V16a6 3 0 0 0 12 0v-3.5"/>
</svg>
),
Learn: getIconAsJSX("graduation-cap"),
Discord: (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -91,71 +62,10 @@ export const ICONS = {
/>
</svg>
),
Github: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4">
</path>
<path
d="M9 18c-4.51 2-5-2-7-2">
</path>
</svg>
),
YouTube: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M12 19c-2.3 0-6.4-.2-8.1-.6-.7-.2-1.2-.7-1.4-1.4-.3-1.1-.5-3.4-.5-5s.2-3.9.5-5c.2-.7.7-1.2 1.4-1.4C5.6 5.2 9.7 5 12 5s6.4.2 8.1.6c.7.2 1.2.7 1.4 1.4.3 1.1.5 3.4.5 5s-.2 3.9-.5 5c-.2.7-.7 1.2-1.4 1.4-1.7.4-5.8.6-8.1.6 0 0 0 0 0 0z">
</path>
<polygon points="10 15 15 12 10 9"></polygon>
</svg>
)
,
heart: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M20.42 4.58a5.4 5.4 0 0 0-7.65 0l-.77.78-.77-.78a5.4 5.4 0 0 0-7.65 0C1.46 6.7 1.33 10.28 4 13l8 8 8-8c2.67-2.72 2.54-6.3.42-8.42z">
</path>
</svg>
),
twitter: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z">
</path>
</svg>
),
Github: getIconAsJSX("github"),
YouTube: getIconAsJSX("youtube"),
heart: getIconAsJSX("heart"),
twitter: getIconAsJSX("twitter"),
exportLibrary: (
<svg
aria-hidden="true"
@@ -237,142 +147,38 @@ export const ICONS = {
/>
</svg>
),
//far fa-image
insertImage: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
fill="var(--icon-fill-color)"
stroke="none"
>
<path
d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm-6 336H54a6 6 0 0 1-6-6V118a6 6 0 0 1 6-6h404a6 6 0 0 1 6 6v276a6 6 0 0 1-6 6zM128 152c-22.091 0-40 17.909-40 40s17.909 40 40 40 40-17.909 40-40-17.909-40-40-40zM96 352h320v-80l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L192 304l-39.515-39.515c-4.686-4.686-12.284-4.686-16.971 0L96 304v48z"
/>
</svg>
),
//far fa-file-alt
insertMD: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 384 512"
fill="var(--icon-fill-color)"
stroke="none"
>
<path d="M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z" />
</svg>
),
//far fa-square-root-alt
insertLaTeX: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 576 512"
stroke="none"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M571.31 251.31l-22.62-22.62c-6.25-6.25-16.38-6.25-22.63 0L480 274.75l-46.06-46.06c-6.25-6.25-16.38-6.25-22.63 0l-22.62 22.62c-6.25 6.25-6.25 16.38 0 22.63L434.75 320l-46.06 46.06c-6.25 6.25-6.25 16.38 0 22.63l22.62 22.62c6.25 6.25 16.38 6.25 22.63 0L480 365.25l46.06 46.06c6.25 6.25 16.38 6.25 22.63 0l22.62-22.62c6.25-6.25 6.25-16.38 0-22.63L525.25 320l46.06-46.06c6.25-6.25 6.25-16.38 0-22.63zM552 0H307.65c-14.54 0-27.26 9.8-30.95 23.87l-84.79 322.8-58.41-106.1A32.008 32.008 0 0 0 105.47 224H24c-13.25 0-24 10.74-24 24v48c0 13.25 10.75 24 24 24h43.62l88.88 163.73C168.99 503.5 186.3 512 204.94 512c17.27 0 44.44-9 54.28-41.48L357.03 96H552c13.25 0 24-10.75 24-24V24c0-13.26-10.75-24-24-24z" />
</svg>
),
//fas fa-link
insertLink: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
stroke="none"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z" />
</svg>
),
//fa-solid fa-magnifying-glass
search: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z" />
</svg>
),
insertImage: getIconAsJSX("image"),
insertMD: getIconAsJSX("file-text"),
insertLaTeX: getIconAsJSX("sigma"),
insertLink: getIconAsJSX("link"),
search: getIconAsJSX("search"),
ocr: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="m6 18 6-12 6 12"></path><path d="M8 14h8"></path><path d="M3 7V5a2 2 0 0 1 2-2h2"></path><path d="M17 3h2a2 2 0 0 1 2 2v2"></path><path d="M21 17v2a2 2 0 0 1-2 2h-2"></path><path d="M7 21H5a2 2 0 0 1-2-2v-2"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
viewBox="0 0 24 24" fill="none" stroke="var(--icon-fill-color)"
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"
className="svg-icon lucide-scan-line-2">
<path d="M3 7V5a2 2 0 0 1 2-2h2M17 3h2a2 2 0 0 1 2 2v2M21 17v2a2 2 0 0 1-2 2h-2M7 21H5a2 2 0 0 1-2-2v-2M7.5,17l4.05,-9.7a.5,.5 0 0 1 .9,0l4.05,9.7M8.8,14h6.4" />
</svg>
),
scriptEngine: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeLinecap="round"
strokeWidth="4"
>
<g transform="translate(-8,-8)">
<path d="M24.318 37.983c-1.234-1.232-8.433-3.903-7.401-7.387 1.057-3.484 9.893-12.443 13.669-13.517 3.776-1.074 6.142 6.523 9.012 7.073 2.87.55 6.797-1.572 8.207-3.694 1.384-2.148-3.147-7.413.15-9.168 3.298-1.755 16.389-2.646 19.611-1.284 3.247 1.363-1.611 7.335-.151 9.483 1.46 2.148 6.067 3.746 8.836 3.38 2.769-.368 4.154-6.733 7.728-5.633 3.575 1.1 12.36 8.828 13.67 12.233 1.308 3.406-5.186 5.423-5.79 8.2-.58 2.75-.026 6.705 2.265 8.355 2.266 1.65 9.642-1.78 11.404 1.598 1.762 3.38 1.007 15.35-.806 18.651-1.787 3.353-7.753-.367-9.969 1.31-2.215 1.65-3.901 5.92-3.373 8.67.504 2.777 7.754 4.48 6.445 7.885C96.49 87.543 87.15 95.454 83.5 96.685c-3.65 1.231-4.96-4.741-7.577-5.16-2.593-.393-6.57.707-8.03 2.75-1.436 2.017 2.668 7.806-.63 9.483-3.323 1.676-15.759 2.226-19.157.655-3.373-1.598.554-7.964-1.108-10.138-1.687-2.174-6.394-3.431-9.012-2.907-2.643.55-3.273 7.282-6.747 6.103-3.499-1.126-12.788-9.535-14.172-13.019-1.36-3.484 5.437-5.108 5.966-7.858.529-2.777-.68-7.073-2.744-8.697-2.064-1.624-7.93 2.41-9.642-1.126-1.737-3.537-2.441-16.765-.654-20.118 1.787-3.3 9.062 1.598 11.429.183 2.366-1.44 2.316-7.282 2.769-8.749m.126-.104c-1.234-1.232-8.433-3.903-7.401-7.387 1.057-3.484 9.893-12.443 13.669-13.517 3.776-1.074 6.142 6.523 9.012 7.073 2.87.55 6.797-1.572 8.207-3.694 1.384-2.148-3.147-7.413.15-9.168 3.298-1.755 16.389-2.646 19.611-1.284 3.247 1.363-1.611 7.335-.151 9.483 1.46 2.148 6.067 3.746 8.836 3.38 2.769-.368 4.154-6.733 7.728-5.633 3.575 1.1 12.36 8.828 13.67 12.233 1.308 3.406-5.186 5.423-5.79 8.2-.58 2.75-.026 6.705 2.265 8.355 2.266 1.65 9.642-1.78 11.404 1.598 1.762 3.38 1.007 15.35-.806 18.651-1.787 3.353-7.753-.367-9.969 1.31-2.215 1.65-3.901 5.92-3.373 8.67.504 2.777 7.754 4.48 6.445 7.885C96.49 87.543 87.15 95.454 83.5 96.685c-3.65 1.231-4.96-4.741-7.577-5.16-2.593-.393-6.57.707-8.03 2.75-1.436 2.017 2.668 7.806-.63 9.483-3.323 1.676-15.759 2.226-19.157.655-3.373-1.598.554-7.964-1.108-10.138-1.687-2.174-6.394-3.431-9.012-2.907-2.643.55-3.273 7.282-6.747 6.103-3.499-1.126-12.788-9.535-14.172-13.019-1.36-3.484 5.437-5.108 5.966-7.858.529-2.777-.68-7.073-2.744-8.697-2.064-1.624-7.93 2.41-9.642-1.126-1.737-3.537-2.441-16.765-.654-20.118 1.787-3.3 9.062 1.598 11.429.183 2.366-1.44 2.316-7.282 2.769-8.749" fill="none" strokeWidth="2"/>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeLinecap="round"
strokeWidth="4"
>
<g transform="translate(-8,-8)">
<path
d="M24.318 37.983c-1.234-1.232-8.433-3.903-7.401-7.387 1.057-3.484 9.893-12.443 13.669-13.517 3.776-1.074 6.142 6.523 9.012 7.073 2.87.55 6.797-1.572 8.207-3.694 1.384-2.148-3.147-7.413.15-9.168 3.298-1.755 16.389-2.646 19.611-1.284 3.247 1.363-1.611 7.335-.151 9.483 1.46 2.148 6.067 3.746 8.836 3.38 2.769-.368 4.154-6.733 7.728-5.633 3.575 1.1 12.36 8.828 13.67 12.233 1.308 3.406-5.186 5.423-5.79 8.2-.58 2.75-.026 6.705 2.265 8.355 2.266 1.65 9.642-1.78 11.404 1.598 1.762 3.38 1.007 15.35-.806 18.651-1.787 3.353-7.753-.367-9.969 1.31-2.215 1.65-3.901 5.92-3.373 8.67.504 2.777 7.754 4.48 6.445 7.885C96.49 87.543 87.15 95.454 83.5 96.685c-3.65 1.231-4.96-4.741-7.577-5.16-2.593-.393-6.57.707-8.03 2.75-1.436 2.017 2.668 7.806-.63 9.483-3.323 1.676-15.759 2.226-19.157.655-3.373-1.598.554-7.964-1.108-10.138-1.687-2.174-6.394-3.431-9.012-2.907-2.643.55-3.273 7.282-6.747 6.103-3.499-1.126-12.788-9.535-14.172-13.019-1.36-3.484 5.437-5.108 5.966-7.858.529-2.777-.68-7.073-2.744-8.697-2.064-1.624-7.93 2.41-9.642-1.126-1.737-3.537-2.441-16.765-.654-20.118 1.787-3.3 9.062 1.598 11.429.183 2.366-1.44 2.316-7.282 2.769-8.749m.126-.104c-1.234-1.232-8.433-3.903-7.401-7.387 1.057-3.484 9.893-12.443 13.669-13.517 3.776-1.074 6.142 6.523 9.012 7.073 2.87.55 6.797-1.572 8.207-3.694 1.384-2.148-3.147-7.413.15-9.168 3.298-1.755 16.389-2.646 19.611-1.284 3.247 1.363-1.611 7.335-.151 9.483 1.46 2.148 6.067 3.746 8.836 3.38 2.769-.368 4.154-6.733 7.728-5.633 3.575 1.1 12.36 8.828 13.67 12.233 1.308 3.406-5.186 5.423-5.79 8.2-.58 2.75-.026 6.705 2.265 8.355 2.266 1.65 9.642-1.78 11.404 1.598 1.762 3.38 1.007 15.35-.806 18.651-1.787 3.353-7.753-.367-9.969 1.31-2.215 1.65-3.901 5.92-3.373 8.67.504 2.777 7.754 4.48 6.445 7.885C96.49 87.543 87.15 95.454 83.5 96.685c-3.65 1.231-4.96-4.741-7.577-5.16-2.593-.393-6.57.707-8.03 2.75-1.436 2.017 2.668 7.806-.63 9.483-3.323 1.676-15.759 2.226-19.157.655-3.373-1.598.554-7.964-1.108-10.138-1.687-2.174-6.394-3.431-9.012-2.907-2.643.55-3.273 7.282-6.747 6.103-3.499-1.126-12.788-9.535-14.172-13.019-1.36-3.484 5.437-5.108 5.966-7.858.529-2.777-.68-7.073-2.744-8.697-2.064-1.624-7.93 2.41-9.642-1.126-1.737-3.537-2.441-16.765-.654-20.118 1.787-3.3 9.062 1.598 11.429.183 2.366-1.44 2.316-7.282 2.769-8.749" fill="none" strokeWidth="2"/>
<path d="M81.235 56.502a23.3 23.3 0 0 1-1.46 8.068 20.785 20.785 0 0 1-1.762 3.72 24.068 24.068 0 0 1-5.337 6.26 22.575 22.575 0 0 1-3.449 2.358 23.726 23.726 0 0 1-7.803 2.803 24.719 24.719 0 0 1-8.333 0 24.102 24.102 0 0 1-4.028-1.074 23.71 23.71 0 0 1-3.776-1.729 23.259 23.259 0 0 1-6.369-5.265 23.775 23.775 0 0 1-2.416-3.353 24.935 24.935 0 0 1-1.762-3.72 23.765 23.765 0 0 1-1.083-3.981 23.454 23.454 0 0 1 0-8.173c.252-1.336.604-2.698 1.083-3.956a24.935 24.935 0 0 1 1.762-3.72 22.587 22.587 0 0 1 2.416-3.378c.881-1.048 1.888-2.017 2.946-2.908a24.38 24.38 0 0 1 3.423-2.357 23.71 23.71 0 0 1 3.776-1.73 21.74 21.74 0 0 1 4.028-1.047 23.437 23.437 0 0 1 8.333 0 24.282 24.282 0 0 1 7.803 2.777 26.198 26.198 0 0 1 3.45 2.357 24.62 24.62 0 0 1 5.336 6.287 20.785 20.785 0 0 1 1.762 3.72 21.32 21.32 0 0 1 1.083 3.955c.251 1.336.302 3.405.377 4.086.05.681.05-.68 0 0" fill="none"/>
<path d="M69.404 56.633c-6.596-3.3-13.216-6.6-19.51-9.744m19.51 9.744c-6.747-3.379-13.493-6.758-19.51-9.744m0 0v19.489m0-19.49v19.49m0 0c4.355-2.148 8.71-4.322 19.51-9.745m-19.51 9.745c3.978-1.965 7.93-3.956 19.51-9.745m0 0h0m0 0h0"/>
</g>
</svg>
),
openLink: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M4 22h14a2 2 0 0 0 2-2V7.5L14.5 2H6a2 2 0 0 0-2 2v7"/>
<polyline points="14 2 14 8 20 8"/>
<path d="m10 18 3-3-3-3"/>
<path d="M4 18v-1a2 2 0 0 1 2-2h6"/>
</svg>
),
openLinkProperties: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="3"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M10 12.5 8 15l2 2.5"/>
<path d="m14 12.5 2 2.5-2 2.5"/>
<path d="M14 2v4a2 2 0 0 0 2 2h4"/>
<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z"/>
</svg>
),
openLink: getIconAsJSX("file-symlink"),
openLinkProperties: getIconAsJSX("file-code"),
//fa-brands fa-markdown
switchToMarkdown: (
<svg
@@ -388,80 +194,11 @@ export const ICONS = {
<path d="M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1zM338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z" />
</svg>
),
//fa-solid fa-expand
gotoFullScreen: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M128 32H32C14.31 32 0 46.31 0 64v96c0 17.69 14.31 32 32 32s32-14.31 32-32V96h64c17.69 0 32-14.31 32-32S145.7 32 128 32zM416 32h-96c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32V64C448 46.31 433.7 32 416 32zM128 416H64v-64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96c0 17.69 14.31 32 32 32h96c17.69 0 32-14.31 32-32S145.7 416 128 416zM416 320c-17.69 0-32 14.31-32 32v64h-64c-17.69 0-32 14.31-32 32s14.31 32 32 32h96c17.69 0 32-14.31 32-32v-96C448 334.3 433.7 320 416 320z" />
</svg>
),
//fa-solid fa-compress
exitFullScreen: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 448 512"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M128 320H32c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32v-96C160 334.3 145.7 320 128 320zM416 320h-96c-17.69 0-32 14.31-32 32v96c0 17.69 14.31 32 32 32s32-14.31 32-32v-64h64c17.69 0 32-14.31 32-32S433.7 320 416 320zM320 192h96c17.69 0 32-14.31 32-32s-14.31-32-32-32h-64V64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96C288 177.7 302.3 192 320 192zM128 32C110.3 32 96 46.31 96 64v64H32C14.31 128 0 142.3 0 160s14.31 32 32 32h96c17.69 0 32-14.31 32-32V64C160 46.31 145.7 32 128 32z" />
</svg>
),
//fa-solid fa-book-open-reader
releaseNotes: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M0 219.2v212.5c0 14.25 11.62 26.25 26.5 27C75.32 461.2 180.2 471.3 240 511.9V245.2C181.4 205.5 79.99 194.8 29.84 192C13.59 191.1 0 203.6 0 219.2zM482.2 192c-50.09 2.848-151.3 13.47-209.1 53.09C272.1 245.2 272 245.3 272 245.5v266.5c60.04-40.39 164.7-50.76 213.5-53.28C500.4 457.9 512 445.9 512 431.7V219.2C512 203.6 498.4 191.1 482.2 192zM352 96c0-53-43-96-96-96S160 43 160 96s43 96 96 96S352 149 352 96z" />
</svg>
),
rawMode: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 60"
>
<path
stroke="var(--icon-fill-color)"
strokeWidth="4"
d="M20 10H10m10 0H10m0 0v40m0-40v40m0 0h10m-10 0h10M40 10H30m10 0H30m0 0v40m0-40v40m0 0h10m-10 0h10M60 10h10m-10 0h10m0 0v40m0-40v40m0 0H60m10 0H60M80 10h10m-10 0h10m0 0v40m0-40v40m0 0H80m10 0H80"
/>
</svg>
),
//fa-solid fa-glasses
parsedMode: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 576 512"
stroke="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M574.1 280.4l-45.38-181.8c-5.875-23.63-21.62-44-43-55.75c-21.5-11.75-46.1-14.13-70.25-6.375l-15.25 5.125c-8.375 2.75-12.87 11.88-10 20.25l5 15.13c2.75 8.375 11.88 12.88 20.25 10.13l13.12-4.375c10.88-3.625 23-3.625 33.25 1.75c10.25 5.375 17.5 14.5 20.38 25.75l38.38 153.9c-22.12-6.875-49.75-12.5-81.13-12.5c-34.88 0-73.1 7-114.9 26.75H251.4C210.5 258.6 171.4 251.6 136.5 251.6c-31.38 0-59 5.625-81.12 12.5l38.38-153.9c2.875-11.25 10.12-20.38 20.5-25.75C124.4 79.12 136.5 79.12 147.4 82.74l13.12 4.375c8.375 2.75 17.5-1.75 20.25-10.13l5-15.13C188.6 53.49 184.1 44.37 175.6 41.62l-15.25-5.125c-23.13-7.75-48.75-5.375-70.13 6.375c-21.37 11.75-37.12 32.13-43 55.75L1.875 280.4C.6251 285.4 .0001 290.6 .0001 295.9v70.25C.0001 428.1 51.63 480 115.3 480h37.13c60.25 0 110.4-46 114.9-105.4l2.875-38.63h35.75l2.875 38.63C313.3 433.1 363.4 480 423.6 480h37.13c63.62 0 115.2-51 115.2-113.9V295.9C576 290.6 575.4 285.5 574.1 280.4zM203.4 369.7c-2 26-24.38 46.25-51 46.25H115.2C87 415.1 64 393.6 64 366.1v-37.5c18.12-6.5 43.38-13 72.62-13c23.88 0 47.25 4.375 69.88 13L203.4 369.7zM512 366.1c0 27.5-23 49.88-51.25 49.88h-37.13c-26.62 0-49-20.25-51-46.25l-3.125-41.13c22.62-8.625 46.13-13 70-13c29 0 54.38 6.5 72.5 13V366.1z" />
</svg>
),
gotoFullScreen: getIconAsJSX("maximize"),
exitFullScreen: getIconAsJSX("minimize"),
releaseNotes: getIconAsJSX("megaphone"),
rawMode: getIconAsJSX("code-xml"),
parsedMode: getIconAsJSX("glasses"),
convertFile: (
<svg
aria-hidden="true"
@@ -475,101 +212,20 @@ export const ICONS = {
<path d="m593.95 239.4v-1.5742c-0.85547-1.8828-2.043-3.6016-3.5-5.0742l-52.5-52.5c-1.4688-1.457-3.1875-2.6445-5.0742-3.5h-1.5742c-1.4727-0.49219-3.0039-0.78516-4.5508-0.875h-124.25c-4.6406 0-9.0938 1.8438-12.375 5.125s-5.125 7.7344-5.125 12.375v87.5h-70v-105.88-1.0508c-0.089844-1.5469-0.38281-3.0781-0.875-4.5508v-1.5742c-0.85547-1.8828-2.043-3.6016-3.5-5.0742l-52.5-52.5c-1.4727-1.457-3.1914-2.6445-5.0742-3.5h-1.5742c-1.7031-0.875-3.5352-1.4688-5.4258-1.75h-123.55c-4.6406 0-9.0938 1.8438-12.375 5.125s-5.125 7.7344-5.125 12.375v245c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125h175c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375v-52.5h70v122.5c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125h175c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375v-192.5-1.0508c-0.14453-1.5547-0.5-3.0859-1.0508-4.5508zm-313.95 110.6h-140v-210h87.5v35c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125h35v87.5h-52.5c-6.2539 0-12.031 3.3359-15.156 8.75s-3.125 12.086 0 17.5 8.9023 8.75 15.156 8.75h52.5zm140 70v-105h27.824l-5.0742 5.0742c-3.7031 3.1719-5.9141 7.7461-6.1055 12.617-0.1875 4.8711 1.668 9.6016 5.1133 13.051 3.4492 3.4453 8.1797 5.3008 13.051 5.1133 4.8711-0.19141 9.4453-2.4023 12.617-6.1055l35-35c3.2578-3.2773 5.0898-7.7148 5.0898-12.336 0-4.625-1.832-9.0586-5.0898-12.34l-35-35c-4.5078-3.8555-10.66-5.1719-16.348-3.4883-5.6875 1.6797-10.137 6.1289-11.816 11.816-1.6836 5.6914-0.37109 11.844 3.4883 16.348l5.0742 5.0742h-27.824v-69.824h87.5v35c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125h35v157.5z" />
</svg>
),
cog: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
fill="var(--icon-fill-color)"
stroke="none"
>
<path d="M495.9 166.6C499.2 175.2 496.4 184.9 489.6 191.2L446.3 230.6C447.4 238.9 448 247.4 448 256C448 264.6 447.4 273.1 446.3 281.4L489.6 320.8C496.4 327.1 499.2 336.8 495.9 345.4C491.5 357.3 486.2 368.8 480.2 379.7L475.5 387.8C468.9 398.8 461.5 409.2 453.4 419.1C447.4 426.2 437.7 428.7 428.9 425.9L373.2 408.1C359.8 418.4 344.1 427 329.2 433.6L316.7 490.7C314.7 499.7 307.7 506.1 298.5 508.5C284.7 510.8 270.5 512 255.1 512C241.5 512 227.3 510.8 213.5 508.5C204.3 506.1 197.3 499.7 195.3 490.7L182.8 433.6C167 427 152.2 418.4 138.8 408.1L83.14 425.9C74.3 428.7 64.55 426.2 58.63 419.1C50.52 409.2 43.12 398.8 36.52 387.8L31.84 379.7C25.77 368.8 20.49 357.3 16.06 345.4C12.82 336.8 15.55 327.1 22.41 320.8L65.67 281.4C64.57 273.1 64 264.6 64 256C64 247.4 64.57 238.9 65.67 230.6L22.41 191.2C15.55 184.9 12.82 175.3 16.06 166.6C20.49 154.7 25.78 143.2 31.84 132.3L36.51 124.2C43.12 113.2 50.52 102.8 58.63 92.95C64.55 85.8 74.3 83.32 83.14 86.14L138.8 103.9C152.2 93.56 167 84.96 182.8 78.43L195.3 21.33C197.3 12.25 204.3 5.04 213.5 3.51C227.3 1.201 241.5 0 256 0C270.5 0 284.7 1.201 298.5 3.51C307.7 5.04 314.7 12.25 316.7 21.33L329.2 78.43C344.1 84.96 359.8 93.56 373.2 103.9L428.9 86.14C437.7 83.32 447.4 85.8 453.4 92.95C461.5 102.8 468.9 113.2 475.5 124.2L480.2 132.3C486.2 143.2 491.5 154.7 495.9 166.6V166.6zM256 336C300.2 336 336 300.2 336 255.1C336 211.8 300.2 175.1 256 175.1C211.8 175.1 176 211.8 176 255.1C176 300.2 211.8 336 256 336z" />
</svg>
),
trayMode: (
<svg
aria-hidden="true"
focusable="false"
role="img"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 640 512"
stroke="var(--icon-fill-color)"
fill="var(--icon-fill-color)"
strokeWidth="20"
>
<path d="M618.1 97.67c-13.02-4.375-27.45 .1562-35.72 11.16L464 266.7l-118.4-157.8c-8.266-11.03-22.64-15.56-35.72-11.16C296.8 102 288 114.2 288 128v256c0 17.69 14.33 32 32 32s32-14.31 32-32v-160l86.41 115.2c12.06 16.12 39.13 16.12 51.19 0L576 224v160c0 17.69 14.33 32 32 32s32-14.31 32-32v-256C640 114.2 631.2 102 618.1 97.67zM224 96.01H32c-17.67 0-32 14.31-32 32s14.33 32 32 32h64v223.1c0 17.69 14.33 31.99 32 31.99s32-14.3 32-31.99V160h64c17.67 0 32-14.31 32-32S241.7 96.01 224 96.01z" />
</svg>
),
cog: getIconAsJSX("settings"),
copyElementLink: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 260 260"
aria-hidden="true"
focusable="false"
role="img"
>
<path
stroke="var(--icon-fill-color)"
fill="none"
strokeLinecap="round"
strokeWidth="8"
d="M10 10h40m-40 0h40m0 0v40m0-40v40m0 0H10m40 0H10m0 0V10m0 40V10M210 10h40m-40 0h40m0 0v40m0-40v40m0 0h-40m40 0h-40m0 0V10m0 40V10M210 210h40m-40 0h40m0 0v40m0-40v40m0 0h-40m40 0h-40m0 0v-40m0 40v-40M10 210h40m-40 0h40m0 0v40m0-40v40m0 0H10m40 0H10m0 0v-40m0 40v-40M30 210V50m0 160V50M50 30h160M50 30h160M230 50v160m0-160v160M50 230h160m-160 0h160"
/>
<path
stroke="var(--icon-fill-color)"
fill="none"
strokeLinecap="round"
strokeWidth="16"
d="M110 90c-6.67 1.67-30 3.11-40 10-10 6.89-20 21.37-20 31.37S60 153.56 70 160c10 6.44 33.33 8.33 40 10m0-80c-6.67 1.67-30 3.11-40 10-10 6.89-20 21.37-20 31.37S60 153.56 70 160c10 6.44 33.33 8.33 40 10M150 90c6.67 1.67 30 3.11 40 10 10 6.89 20 21.37 20 31.37s-10 22.19-20 28.63c-10 6.44-33.33 8.33-40 10m0-80c6.67 1.67 30 3.11 40 10 10 6.89 20 21.37 20 31.37s-10 22.19-20 28.63c-10 6.44-33.33 8.33-40 10"
/>
<path
stroke="var(--icon-fill-color)"
fill="none"
strokeLinecap="round"
strokeWidth="16"
d="M89.868 130.198c13.36-.03 66.78-.17 80.13-.2m-80.13.2c13.36-.03 66.78-.17 80.13-.2"
/>
</svg>
),
importSVG: (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 526 526">
<g fillRule="evenodd" strokeLinecap="round">
<path
fill="var(--input-bg-color)"
strokeWidth="0"
d="m133.462 71 .33-6.54.97-6.34 1.58-6.13 2.16-5.88 2.69-5.6 3.21-5.27 3.69-4.93 4.13-4.55 4.55-4.13 4.93-3.69 5.27-3.21 5.6-2.69 5.88-2.16 6.13-1.58 6.34-.97 6.54-.33h160v128l.16 3.28.49 3.18.79 3.07 1.07 2.94 1.35 2.8 1.6 2.63 1.84 2.47 2.06 2.27 2.27 2.06 2.47 1.84 2.63 1.6 2.8 1.35 2.94 1.07 3.07.79 3.18.49 3.28.16h128v288l-.33 6.54-.97 6.34-1.58 6.13-2.16 5.88-2.69 5.6-3.21 5.27-3.69 4.93-4.13 4.55-4.55 4.13-4.93 3.69-5.27 3.21-5.6 2.69-5.88 2.16-6.13 1.58-6.34.97-6.54.33h-256l-6.54-.33-6.34-.97-6.13-1.58-5.88-2.16-5.6-2.69-5.27-3.21-4.93-3.69-4.55-4.13-4.13-4.55-3.69-4.93-3.21-5.27-2.69-5.6-2.16-5.88-1.58-6.13-.97-6.34-.33-6.54V343h174.1l-39 39-1.65 1.83-1.43 1.94-1.22 2.05-.99 2.13-.77 2.2-.55 2.25-.33 2.29-.11 2.3.11 2.3.33 2.28.55 2.24.77 2.19.99 2.12 1.22 2.04 1.43 1.93 1.65 1.81 1.83 1.64 1.94 1.42 2.05 1.2 2.13.99 2.2.76 2.25.56 2.29.33 2.3.11 2.3-.1 2.28-.33 2.24-.54 2.19-.77 2.12-.98 2.04-1.21 1.93-1.43 1.81-1.65 80-80 1.65-1.83 1.43-1.94 1.22-2.05.99-2.13.77-2.2.55-2.25.33-2.29.11-2.3-.11-2.3-.33-2.28-.55-2.24-.77-2.19-.99-2.12-1.22-2.04-1.43-1.93-1.65-1.81-80-80-1.83-1.65-1.94-1.43-2.05-1.22-2.13-.99-2.2-.77-2.25-.55-2.29-.33-2.3-.11-2.3.11-2.28.33-2.24.55-2.19.77-2.12.99-2.04 1.22-1.93 1.43-1.81 1.65-1.64 1.83-1.42 1.94-1.2 2.05-.99 2.13-.76 2.2-.56 2.25-.33 2.29-.11 2.3.1 2.3.33 2.28.54 2.24.77 2.19.98 2.12 1.21 2.04 1.43 1.93 1.65 1.81 39 39h-174.1V71"
/>
<path
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="18"
d="M133.462 71s0 0 0 0m0 0s0 0 0 0m0 0 .33-6.54m-.33 6.54c.13-2.57.26-5.13.33-6.54m0 0c.36-2.33.72-4.67.97-6.34m-.97 6.34c.35-2.26.69-4.53.97-6.34m0 0c.51-1.99 1.03-3.98 1.58-6.13m-1.58 6.13c.4-1.56.81-3.12 1.58-6.13m0 0c.81-2.22 1.62-4.43 2.16-5.88m-2.16 5.88c.45-1.22.9-2.44 2.16-5.88m0 0c.72-1.51 1.45-3.01 2.69-5.6m-2.69 5.6c.69-1.45 1.39-2.9 2.69-5.6m0 0c.93-1.52 1.86-3.05 3.21-5.27m-3.21 5.27c.97-1.59 1.94-3.18 3.21-5.27m0 0c.86-1.15 1.71-2.29 3.69-4.93m-3.69 4.93c.78-1.04 1.56-2.08 3.69-4.93m0 0c1.53-1.69 3.07-3.38 4.13-4.55m-4.13 4.55c1.54-1.69 3.07-3.38 4.13-4.55m0 0c1.03-.93 2.06-1.87 4.55-4.13m-4.55 4.13c.98-.89 1.97-1.78 4.55-4.13m0 0c1.64-1.23 3.28-2.46 4.93-3.69m-4.93 3.69c1.72-1.29 3.45-2.58 4.93-3.69m0 0c1.11-.68 2.23-1.35 5.27-3.21m-5.27 3.21c1.5-.91 3.01-1.83 5.27-3.21m0 0c1.87-.89 3.73-1.79 5.6-2.69m-5.6 2.69c2.09-1 4.17-2.01 5.6-2.69m0 0c1.72-.64 3.44-1.27 5.88-2.16m-5.88 2.16c1.94-.72 3.89-1.43 5.88-2.16m0 0c2.3-.59 4.6-1.19 6.13-1.58m-6.13 1.58c2.32-.6 4.65-1.2 6.13-1.58m0 0c2.06-.31 4.12-.63 6.34-.97m-6.34.97c2.34-.36 4.69-.72 6.34-.97m0 0c2.05-.1 4.09-.21 6.54-.33m-6.54.33c2.06-.1 4.12-.21 6.54-.33m0 0h160m-160 0h160m0 0v128m0-128v128m0 0s0 0 0 0m0 0s0 0 0 0m0 0 .16 3.28m-.16-3.28c.06 1.16.12 2.32.16 3.28m0 0c.13.82.26 1.64.49 3.18m-.49-3.18c.18 1.13.35 2.26.49 3.18m0 0c.24.95.49 1.91.79 3.07m-.79-3.07c.28 1.1.56 2.2.79 3.07m0 0c.39 1.06.78 2.13 1.07 2.94m-1.07-2.94c.42 1.15.84 2.3 1.07 2.94m0 0c.38.79.76 1.57 1.35 2.8m-1.35-2.8c.4.82.79 1.64 1.35 2.8m0 0c.45.75.91 1.5 1.6 2.63m-1.6-2.63c.4.65.8 1.31 1.6 2.63m0 0c.56.76 1.13 1.52 1.84 2.47m-1.84-2.47c.58.79 1.17 1.57 1.84 2.47m0 0c.75.82 1.5 1.65 2.06 2.27m-2.06-2.27c.75.82 1.5 1.65 2.06 2.27m0 0c.74.66 1.47 1.33 2.27 2.06m-2.27-2.06c.89.81 1.78 1.61 2.27 2.06m0 0c.69.51 1.37 1.02 2.47 1.84m-2.47-1.84c.68.5 1.35 1.01 2.47 1.84m0 0c.81.49 1.62.99 2.63 1.6m-2.63-1.6c.74.45 1.47.9 2.63 1.6m0 0c.72.35 1.43.69 2.8 1.35m-2.8-1.35c.61.3 1.22.59 2.8 1.35m0 0c.85.31 1.69.62 2.94 1.07m-2.94-1.07c1.03.38 2.07.75 2.94 1.07m0 0c.83.22 1.67.43 3.07.79m-3.07-.79 3.07.79m0 0c1.07.16 2.14.33 3.18.49m-3.18-.49c1.2.18 2.39.36 3.18.49m0 0 3.28.16m-3.28-.16c.97.04 1.93.09 3.28.16m0 0h128m-128 0h128m0 0v288m0-288v288m0 0s0 0 0 0m0 0s0 0 0 0m0 0c-.1 2.02-.2 4.04-.33 6.54m.33-6.54c-.13 2.52-.26 5.05-.33 6.54m0 0c-.33 2.14-.66 4.29-.97 6.34m.97-6.34c-.32 2.06-.63 4.12-.97 6.34m0 0c-.59 2.28-1.17 4.55-1.58 6.13m1.58-6.13c-.53 2.07-1.07 4.14-1.58 6.13m0 0c-.73 1.99-1.46 3.97-2.16 5.88m2.16-5.88c-.72 1.97-1.44 3.94-2.16 5.88m0 0c-.94 1.97-1.89 3.93-2.69 5.6m2.69-5.6c-.91 1.89-1.82 3.77-2.69 5.6m0 0c-.89 1.46-1.78 2.92-3.21 5.27m3.21-5.27c-.65 1.05-1.29 2.11-3.21 5.27m0 0c-1.13 1.51-2.25 3.01-3.69 4.93m3.69-4.93c-1.29 1.72-2.58 3.44-3.69 4.93m0 0c-1.29 1.42-2.58 2.84-4.13 4.55m4.13-4.55-4.13 4.55m0 0-4.55 4.13m4.55-4.13-4.55 4.13m0 0c-1.2.9-2.41 1.8-4.93 3.69m4.93-3.69-4.93 3.69m0 0c-1.56.95-3.13 1.9-5.27 3.21m5.27-3.21c-1.99 1.21-3.98 2.42-5.27 3.21m0 0c-1.8.86-3.6 1.73-5.6 2.69m5.6-2.69c-1.34.64-2.67 1.28-5.6 2.69m0 0c-2.24.82-4.48 1.65-5.88 2.16m5.88-2.16c-1.38.51-2.77 1.02-5.88 2.16m0 0c-1.46.38-2.93.76-6.13 1.58m6.13-1.58c-1.54.4-3.09.79-6.13 1.58m0 0c-2.12.32-4.24.65-6.34.97m6.34-.97c-2.47.38-4.94.75-6.34.97m0 0c-2.23.11-4.46.22-6.54.33m6.54-.33c-1.97.1-3.93.2-6.54.33m0 0h-256m256 0h-256m0 0s0 0 0 0m0 0s0 0 0 0m0 0c-2.33-.12-4.66-.24-6.54-.33m6.54.33c-1.33-.07-2.65-.13-6.54-.33m0 0c-1.88-.29-3.77-.58-6.34-.97m6.34.97c-2.07-.32-4.14-.63-6.34-.97m0 0c-1.52-.39-3.04-.79-6.13-1.58m6.13 1.58c-2.02-.52-4.04-1.04-6.13-1.58m0 0c-1.6-.59-3.19-1.17-5.88-2.16m5.88 2.16c-1.9-.7-3.8-1.39-5.88-2.16m0 0c-1.41-.68-2.82-1.36-5.6-2.69m5.6 2.69c-1.6-.77-3.2-1.54-5.6-2.69m0 0c-1.4-.86-2.81-1.71-5.27-3.21m5.27 3.21c-2.08-1.27-4.17-2.54-5.27-3.21m0 0c-1.72-1.29-3.43-2.57-4.93-3.69m4.93 3.69c-1.79-1.34-3.57-2.67-4.93-3.69m0 0c-1.18-1.07-2.36-2.15-4.55-4.13m4.55 4.13c-1.64-1.49-3.27-2.97-4.55-4.13m0 0c-1.07-1.19-2.15-2.37-4.13-4.55m4.13 4.55c-1.46-1.61-2.93-3.23-4.13-4.55m0 0-3.69-4.93m3.69 4.93c-.88-1.17-1.76-2.35-3.69-4.93m0 0c-.83-1.37-1.67-2.75-3.21-5.27m3.21 5.27c-1.15-1.89-2.3-3.79-3.21-5.27m0 0c-1.03-2.14-2.05-4.27-2.69-5.6m2.69 5.6c-.68-1.43-1.37-2.85-2.69-5.6m0 0c-.8-2.17-1.59-4.34-2.16-5.88m2.16 5.88c-.82-2.22-1.63-4.44-2.16-5.88m0 0c-.47-1.82-.94-3.64-1.58-6.13m1.58 6.13c-.37-1.44-.74-2.88-1.58-6.13m0 0-.97-6.34m.97 6.34c-.3-1.98-.61-3.97-.97-6.34m0 0c-.13-2.54-.26-5.07-.33-6.54m.33 6.54-.33-6.54m0 0V343m0 112V343m0 0h174.1m-174.1 0h174.1m0 0-39 39m39-39-39 39m0 0s0 0 0 0m0 0s0 0 0 0m0 0c-.65.72-1.3 1.44-1.65 1.83m1.65-1.83c-.34.38-.68.76-1.65 1.83m0 0c-.35.47-.7.95-1.43 1.94m1.43-1.94c-.38.5-.75 1.01-1.43 1.94m0 0c-.32.54-.64 1.08-1.22 2.05m1.22-2.05c-.38.64-.76 1.28-1.22 2.05m0 0c-.2.45-.41.89-.99 2.13m.99-2.13c-.38.82-.76 1.64-.99 2.13m0 0c-.18.53-.36 1.05-.77 2.2m.77-2.2c-.3.88-.61 1.75-.77 2.2m0 0c-.15.61-.3 1.22-.55 2.25m.55-2.25c-.16.68-.33 1.35-.55 2.25m0 0-.33 2.29m.33-2.29c-.13.9-.26 1.79-.33 2.29m0 0-.11 2.3m.11-2.3c-.03.59-.06 1.19-.11 2.3m0 0c.03.Line truncated
/>
</g>
<path
fill="none"
stroke="var(--icon-fill-color)"
strokeLinecap="round"
strokeWidth="18"
d="M135 343.068H31m104 0H31m0 0s0 0 0 0m0 0s0 0 0 0m0 0c-.74-.04-1.48-.07-2.46-.12m2.46.12c-.77-.04-1.54-.08-2.46-.12m0 0c-.87-.14-1.75-.27-2.39-.37m2.39.37c-.55-.09-1.1-.17-2.39-.37m0 0c-.87-.22-1.74-.44-2.3-.59m2.3.59c-.62-.15-1.24-.31-2.3-.59m0 0c-.82-.29-1.64-.59-2.21-.8m2.21.8c-.52-.18-1.03-.37-2.21-.8m0 0c-.55-.26-1.09-.52-2.1-1.01m2.1 1.01c-.64-.31-1.28-.61-2.1-1.01m0 0c-.74-.45-1.48-.89-1.98-1.2m1.98 1.2c-.42-.25-.84-.51-1.98-1.2m0 0c-.7-.52-1.41-1.05-1.84-1.38m1.84 1.38c-.37-.28-.75-.56-1.84-1.38m0 0c-.4-.36-.8-.71-1.71-1.54m1.71 1.54c-.35-.31-.7-.63-1.71-1.54m0 0c-.43-.47-.85-.95-1.54-1.71m1.54 1.71c-.61-.68-1.23-1.36-1.54-1.71m0 0c-.29-.38-.58-.76-1.38-1.84m1.38 1.84c-.54-.71-1.08-1.43-1.38-1.84m0 0c-.46-.76-.92-1.52-1.2-1.98m1.2 1.98c-.45-.74-.89-1.47-1.2-1.98m0 0c-.37-.77-.74-1.53-1.01-2.1m1.01 2.1c-.3-.62-.6-1.25-1.01-2.1m0 0c-.2-.54-.39-1.07-.8-2.21m.8 2.21c-.2-.54-.4-1.09-.8-2.21m0 0c-.22-.85-.44-1.71-.59-2.3m.59 2.3c-.12-.46-.24-.92-.59-2.3m0 0c-.11-.72-.22-1.43-.37-2.39m.37 2.39c-.08-.48-.15-.96-.37-2.39m0 0c-.03-.74-.07-1.48-.12-2.46m.12 2.46c-.04-.79-.08-1.59-.12-2.46m0 0c.04-.74.07-1.49.12-2.46m-.12 2.46.12-2.46m0 0c.08-.53.16-1.07.37-2.39m-.37 2.39c.09-.56.17-1.12.37-2.39m0 0c.17-.69.35-1.38.59-2.3m-.59 2.3c.15-.61.31-1.23.59-2.3m0 0c.17-.48.34-.96.8-2.21m-.8 2.21c.2-.55.4-1.1.8-2.21m0 0c.25-.52.49-1.03 1.01-2.1m-1.01 2.1c.36-.76.73-1.52 1.01-2.1m0 0c.43-.72.87-1.44 1.2-1.98m-1.2 1.98c.27-.45.55-.91 1.2-1.98m0 0c.54-.73 1.09-1.47 1.38-1.84m-1.38 1.84c.4-.54.81-1.09 1.38-1.84m0 0c.53-.59 1.07-1.18 1.54-1.71m-1.54 1.71c.59-.66 1.19-1.32 1.54-1.71m0 0c.54-.49 1.08-.97 1.71-1.54m-1.71 1.54c.48-.43.95-.86 1.71-1.54m0 0c.46-.35.92-.7 1.84-1.38m-1.84 1.38c.5-.38 1.01-.76 1.84-1.38m0 0c.52-.32 1.04-.63 1.98-1.2m-1.98 1.2c.72-.44 1.44-.88 1.98-1.2m0 0 2.1-1.01m-2.1 1.01c.84-.4 1.67-.81 2.1-1.01m0 0c.45-.17.91-.33 2.21-.8m-2.21.8c.56-.21 1.12-.41 2.21-.8m0 0c.89-.23 1.79-.46 2.3-.59m-2.3.59c.48-.13.95-.25 2.3-.59m0 0c.51-.08 1.02-.16 2.39-.37m-2.39.37 2.39-.37m0 0c.52-.02 1.03-.05 2.46-.12m-2.46.12c.74-.03 1.48-.07 2.46-.12m0 0 103.34-.27m-103.34.27c30.04-.08 60.08-.16 103.34-.27"
/>
<g fillRule="evenodd" strokeLinecap="round">
<path
fill="var(--input-bg-color)"
strokeWidth="0"
d="M517.462 135h-128V7l128 128"
/>
<path
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="18"
d="M517.462 135h-128m128 0h-128m0 0V7m0 128V7m0 0 128 128m-128-128 128 128m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"
/>
</g>
</svg>
<svg className="svg-icon lucide-vector-square-link" width="24" height="24" fill="none" stroke="var(--icon-fill-color)"
strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path d="m19.5 7a24 24 0 0 1 0 10M4.5 7a24 24 0 0 0 0 10M7 19.5a24 24 0 0 0 10 0M7 4.5a24 24 0 0 1 10 0"/>
<rect x="17" y="17" width="5" height="5" rx="1"/>
<path d="m17 5v-2c0-0.554 0.446-1 1-1h3c0.554 0 1 0.446 1 1v3c0 0.554-0.446 1-1 1h-2"/>
<path d="m7 19v2c0 0.554-0.446 1-1 1h-3c-0.554 0-1-0.446-1-1v-3c0-0.554 0.446-1 1-1h2"/>
<rect x="2" y="2" width="5" height="5" rx="1"/>
<path d="m13.041 15.135-0.58926 0.58926c-2.9856 2.9856-7.2282-1.2571-4.2426-4.2426l0.58926-0.58926M10.92 8.7708m0.49474-0.49474c2.9856-2.9856 7.2282 1.2571 4.2426 4.2426l-0.49474 0.49474M10.213 13.721 l3.5355-3.5355"/>
</svg>
),
importSVG: getIconAsJSX("file-input"),
obsidian: (
<svg
//aria-hidden="true"
@@ -632,22 +288,8 @@ export const ICONS = {
<path fillRule="evenodd" clipRule="evenodd" d="M302.7 299.5c43.5 16.3 60.3 52 72.8 81.9-15.5-31.2-37-65.7-74.4-78.5-28.4-9.8-52.4-8.6-93.5.7l-.9-4c43.6-10 66.4-11.2 96 0Z" fill="url(#i)"/>
</svg>
),
"add-file": (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="var(--icon-fill-color)"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="12" x2="12" y1="18" y2="12"/>
<line x1="9" x2="15" y1="15" y2="15"/>
</svg>
),
"add-file": getIconAsJSX("file-plus"),
tray: getIconAsJSX("monitor-cog"),
};
export const SwordColors = {
@@ -754,10 +396,11 @@ export const saveIcon = (isDirty: boolean) => {
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke={isDirty?"var(--color-accent)":"var(--icon-fill-color)"}
stroke={isDirty ? "var(--color-accent)" : "var(--icon-fill-color)"}
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
className="svg-icon lucide-save"
>
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/>
<polyline points="17 21 17 13 7 13 7 21"/>
@@ -879,7 +522,7 @@ export const penIcon = (pen: PenStyle) => {
}
export const stringToSVG = (svg: string) => {
if(svg.match(/class=("|')[^"']*(lucide|skip)[^"']*("|')/)) {
if (svg.match(/class=["'][^"']*(lucide|skip)[^"']*["']/)) {
return <div dangerouslySetInnerHTML={{__html: svg}}></div>
}
svg = svg
@@ -899,4 +542,4 @@ export const LogoWrapper = ({ children }: { children: React.ReactNode }) => {
{children} {/* Render the children, including the ExcalidrawSword SVG icon */}
</div>
);
};
};
+4 -4
View File
@@ -97,7 +97,7 @@ export let {
exportToSvg,
exportToBlob,
mutateElement,
restore,
restoreElements,
mermaidToExcalidraw,
getFontFamilyString,
getContainerElement,
@@ -124,7 +124,7 @@ export function updateExcalidrawLib() {
'getCommonBoundingBox',
'measureText',
'getLineHeight',
'restore'
'restoreElements'
];
for (const fnName of requiredFunctions) {
@@ -148,7 +148,7 @@ export function updateExcalidrawLib() {
exportToSvg,
exportToBlob,
mutateElement,
restore,
restoreElements,
mermaidToExcalidraw,
getFontFamilyString,
getContainerElement,
@@ -214,7 +214,7 @@ export const ROUNDNESS = { //should at one point publish @zsviczian/excalidraw/t
PROPORTIONAL_RADIUS: 2,
ADAPTIVE_RADIUS: 3,
} as const;
export const THEME_FILTER = "invert(100%) hue-rotate(180deg) saturate(1.25)";
export const THEME_FILTER = "invert(93%) hue-rotate(180deg) saturate(1.25)";
export const GITHUB_RELEASES = "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/";
export const URLFETCHTIMEOUT = 3000;
export const PLUGIN_ID = "obsidian-excalidraw-plugin";
+26
View File
@@ -60,6 +60,7 @@ import {
isCallerFromTemplaterPlugin,
versionUpdateCheckTimer,
getFontMetrics,
calculateUIModeValue,
} from "../utils/utils";
import { foldExcalidrawSection, getExcalidrawViews, setExcalidrawView } from "../utils/obsidianUtils";
import { FileId } from "@zsviczian/excalidraw/types/element/src/types";
@@ -96,6 +97,7 @@ import { get } from "http";
import { getHighlightColor } from "src/utils/dynamicStyling";
import { InlineLinkSuggester } from "src/shared/Suggesters/InlineLinkSuggester";
import { KeyBlocker } from "src/types/excalidrawAutomateTypes";
import { UIMode } from "src/shared/Dialogs/UIModeSettingComponent";
declare const PLUGIN_VERSION:string;
declare const INITIAL_TIMESTAMP: number;
@@ -773,6 +775,26 @@ export default class ExcalidrawPlugin extends Plugin {
if(Object.keys(this.scriptEngine.scriptIconMap).length === 0) {
this.scriptEngine.loadScripts();
}
const restartSidepanelTabIfActive = async () => {
if (!this.scriptEngine || !(scriptFile instanceof TFile)) {
return;
}
const scriptName = this.scriptEngine.getScriptName(scriptFile);
const spView = ExcalidrawSidepanelView.getExisting(false);
if (!spView || !scriptName || !spView.getTabByScript(scriptName)) {
return;
}
try {
await spView.restartTabForScript(scriptName);
} catch (error) {
errorlog({
where: "ExcalidrawPlugin.registerInstallCodeblockProcessor.restartSidepanelTab",
error,
scriptName,
});
}
};
await restartSidepanelTabIfActive();
new Notice(`Installed: ${(scriptFile as TFile).basename}`);
} catch (e) {
new Notice(`Error installing script: ${fname}`);
@@ -1531,4 +1553,8 @@ export default class ExcalidrawPlugin extends Plugin {
};
return new InlineLinkSuggester(this.app, this, inputEl, getSourcePath, widthWrapper, surpessPlaceholder, containerEl);
}
public getPreferredUIMode(): UIMode {
return calculateUIModeValue(this.settings);
}
}
+3 -8
View File
@@ -1000,7 +1000,7 @@ export class CommandManager {
if(this.app.workspace.getActiveViewOfType(ExcalidrawView)) {
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
const api = view?.excalidrawAPI as ExcalidrawImperativeAPI;
if(!api.isTrayModeEnabled()) return false;
if(!api || !api.isTrayModeEnabled()) return false;
return true;
}
return false;
@@ -1025,12 +1025,7 @@ export class CommandManager {
name: t("TOGGLE_ENABLE_CONTEXT_MENU"),
checkCallback: (checking: boolean) => {
if (checking) {
if(this.app.workspace.getActiveViewOfType(ExcalidrawView)) {
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
const api = view?.excalidrawAPI as ExcalidrawImperativeAPI;
return true;
}
return false;
return Boolean(this.app.workspace.getActiveViewOfType(ExcalidrawView));
}
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
view.toggleEnableContextMenu();
@@ -1042,7 +1037,7 @@ export class CommandManager {
id: "flip-image",
name: t("FLIP_IMAGE"),
checkCallback: (checking:boolean) => {
if (!DEVICE.isDesktop) return;
if (!DEVICE.isDesktop) return false;
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
if(!view) return false;
if(!view.excalidrawAPI) return false;
+2 -16
View File
@@ -8,6 +8,7 @@ import { ExcalidrawAutomate } from "src/shared/ExcalidrawAutomate";
import { DEVICE, FRONTMATTER_KEYS, ICON_NAME, VIEW_TYPE_EXCALIDRAW } from "src/constants/constants";
import ExcalidrawView from "src/view/ExcalidrawView";
import { t } from "src/lang/helpers";
import { setMobileNavbarPosition } from "src/utils/excalidrawViewUtils";
/**
* Registers event listeners for the plugin
@@ -234,22 +235,7 @@ export class EventManager {
this.plugin.removeModalContainerObserver();
}
//!Temporary hack
//https://discord.com/channels/686053708261228577/817515900349448202/1031101635784613968
if (DEVICE.isMobile && newActiveviewEV && !previouslyActiveEV) {
const navbar = document.querySelector("body>.app-container>.mobile-navbar");
if(navbar && navbar instanceof HTMLDivElement) {
navbar.style.position="relative";
}
}
if (DEVICE.isMobile && !newActiveviewEV && previouslyActiveEV) {
const navbar = document.querySelector("body>.app-container>.mobile-navbar");
if(navbar && navbar instanceof HTMLDivElement) {
navbar.style.position="";
}
}
setMobileNavbarPosition(!!newActiveviewEV);
//----------------------
//----------------------
+24 -8
View File
@@ -150,16 +150,17 @@ const _getPNG = async ({imgAttributes,filenameParts,theme,cacheReady,img,file,ex
return img;
}
const setStyle = ({element,imgAttributes,onCanvas}:{
const setStyle = ({element,imgAttributes,onCanvas, isNativeSVG}:{
element: HTMLElement,
imgAttributes: imgElementAttributes,
onCanvas: boolean,
isNativeSVG: boolean,
}
) => {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(setStyle, `MarkdownPostProcessor.ts > setStyle`);
let style = "";
if(imgAttributes.fwidth) {
style = `max-width:${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; `; //width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886
style = `${isNativeSVG ? "max-width:" : "max-width:100%; width:"}${imgAttributes.fwidth}${imgAttributes.fwidth.match(/\d$/) ? "px":""}; `; //width:100%;`; //removed !important https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/886
} else {
style = "width: fit-content;"
}
@@ -247,7 +248,7 @@ const _getSVGIMG = async ({filenameParts,theme,cacheReady,img,file,exportSetting
return addSVGToImgSrc(img, svg, cacheReady, cacheKey);
}
const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,file,exportSettings,loader}:{
const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,file,exportSettings,loader, width}:{
filenameParts: FILENAMEPARTS,
theme: string,
cacheReady: boolean,
@@ -255,6 +256,7 @@ const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,fi
file: TFile,
exportSettings: ExportSettings,
loader: EmbeddedFilesLoader,
width?: number,
}):Promise<HTMLDivElement> => {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(_getSVGNative, `MarkdownPostProcessor.ts > _getSVGNative`);
exportSettings.skipInliningFonts = false;
@@ -302,7 +304,11 @@ const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,fi
cacheReady && imageCache.addImageToCache(cacheKey,"", svg);
}
svg.removeAttribute("width");
if(width && !isNaN(width)) {
svg.setAttribute("width", width.toString());
} else {
svg.removeAttribute("width");
}
svg.removeAttribute("height");
containerElement.append(svg);
return containerElement;
@@ -367,18 +373,28 @@ const getIMG = async (
switch (plugin.settings.previewImageType) {
case PreviewImageType.PNG: {
const img = createEl("img");
setStyle({element:img,imgAttributes,onCanvas});
setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: false});
return await _getPNG({imgAttributes,filenameParts,theme,cacheReady,img,file,exportSettings,loader});
}
case PreviewImageType.SVGIMG: {
const img = createEl("img");
setStyle({element:img,imgAttributes,onCanvas});
setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: false});
return await _getSVGIMG({filenameParts,theme,cacheReady,img,file,exportSettings,loader});
}
case PreviewImageType.SVG: {
const img = createEl("div");
setStyle({element:img,imgAttributes,onCanvas});
return await _getSVGNative({filenameParts,theme,cacheReady,containerElement: img,file,exportSettings,loader});
setStyle({element:img,imgAttributes,onCanvas, isNativeSVG: true});
return await _getSVGNative({
filenameParts,
theme,
cacheReady,
containerElement: img,file,
exportSettings,
loader,
width: imgAttributes.fwidth
? (!imgAttributes.fwidth.endsWith("%") ? parseInt(imgAttributes.fwidth) : 1000)
: undefined,
});
}
}
};
+115 -48
View File
@@ -1,6 +1,7 @@
import { debug, DEBUGGING } from "src/utils/debugHelper";
import ExcalidrawPlugin from "src/core/main";
import { CustomMutationObserver } from "src/utils/debugHelper";
import { DEVICE } from "src/constants/constants";
import { getExcalidrawViews, isObsidianThemeDark } from "src/utils/obsidianUtils";
import { App, Notice, TFile } from "obsidian";
import { ExcalidrawImperativeAPI } from "@zsviczian/excalidraw/types/excalidraw/types";
@@ -29,6 +30,9 @@ export class ObserverManager {
if(this.settings.matchThemeTrigger) this.addThemeObserver();
this.experimentalFileTypeDisplayToggle(this.settings.experimentalFileType);
this.addModalContainerObserver();
if (this.app.isMobile) {
this.addWorkspaceDrawerObserver();
}
} catch (e) {
new Notice("Error adding ObserverManager", 6000);
console.error("Error adding ObserverManager", e);
@@ -119,8 +123,9 @@ export class ObserverManager {
*/
private async experimentalFileTypeDisplay() {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.experimentalFileTypeDisplay, `ExcalidrawPlugin.experimentalFileTypeDisplay`);
const tagClassName = "excalidraw-filetype-tag";
const insertFiletype = (el: HTMLElement) => {
if (el.childElementCount !== 1) {
if (!el || el.querySelector(`.${tagClassName}`)) {
return;
}
const filename = el.getAttribute("data-path");
@@ -134,7 +139,7 @@ export class ObserverManager {
if (this.plugin.isExcalidrawFile(f)) {
el.insertAfter(
createDiv({
cls: "nav-file-tag",
cls: ["nav-file-tag", tagClassName],
text: this.settings.experimentalFileTag,
}),
el.firstChild,
@@ -144,14 +149,27 @@ export class ObserverManager {
const fileExplorerObserverFn:MutationCallback = (mutationsList) => {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(fileExplorerObserverFn, `ExcalidrawPlugin.experimentalFileTypeDisplay > fileExplorerObserverFn`, mutationsList);
const mutationsWithNodes = mutationsList.filter((mutation) => mutation.addedNodes.length > 0);
mutationsWithNodes.forEach((mutationNode) => {
mutationNode.addedNodes.forEach((node) => {
if (!(node instanceof Element)) {
return;
const ensureFiletypes = (target: Element | DocumentFragment) => {
target.querySelectorAll?.(".nav-file-title").forEach(insertFiletype);
};
mutationsList.forEach((mutation) => {
if (mutation.type === "childList") {
mutation.addedNodes.forEach((node) => {
if (node instanceof Element || node instanceof DocumentFragment) {
ensureFiletypes(node);
}
});
if (mutation.target instanceof Element) {
// Handles folders that were collapsed/expanded without adding nodes
ensureFiletypes(mutation.target);
}
node.querySelectorAll(".nav-file-title").forEach(insertFiletype);
});
return;
}
if (mutation.type === "attributes" && mutation.target instanceof Element) {
ensureFiletypes(mutation.target);
}
});
};
@@ -159,11 +177,44 @@ export class ObserverManager {
? new CustomMutationObserver(fileExplorerObserverFn, "fileExplorerObserver")
: new MutationObserver(fileExplorerObserverFn);
//the part that should only run after onLayoutReady
document.querySelectorAll(".nav-file-title").forEach(insertFiletype); //apply filetype to files already displayed
const container = document.querySelector(".nav-files-container");
if (container) {
this.fileExplorerObserver.observe(container, {
const attachObserversToContainers = (): boolean => {
const containers = Array.from(document.querySelectorAll(".nav-files-container"));
if (!containers.length) {
return false;
}
containers.forEach((container) => {
container.querySelectorAll(".nav-file-title").forEach(insertFiletype); //apply tags to items already shown
this.fileExplorerObserver.observe(container, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["class", "aria-expanded"],
});
});
return true;
};
if (!attachObserversToContainers() && DEVICE.isMobile) {
// On mobile, the file explorer lives inside drawers and may not be in the DOM yet.
const waitForFileExplorer = new MutationObserver((mutations, observer) => {
for (const mutation of mutations) {
if (mutation.type !== "childList") continue;
const added = Array.from(mutation.addedNodes ?? []);
const hasContainer = added.some((node) =>
node instanceof Element &&
(node.matches?.(".nav-files-container") || node.querySelector?.(".nav-files-container")),
);
if (!hasContainer) continue;
if (attachObserversToContainers()) {
observer.disconnect();
break;
}
}
});
waitForFileExplorer.observe(document.body, {
childList: true,
subtree: true,
});
@@ -219,44 +270,60 @@ export class ObserverManager {
private addWorkspaceDrawerObserver() {
//when the user activates the sliding drawers on Obsidian Mobile
const leftWorkspaceDrawer = document.querySelector(
".workspace-drawer.mod-left",
);
const rightWorkspaceDrawer = document.querySelector(
".workspace-drawer.mod-right",
);
if (leftWorkspaceDrawer || rightWorkspaceDrawer) {
const action = async (m: MutationRecord[]) => {
if (
m[0].oldValue !== "display: none;" ||
!this.plugin.activeExcalidrawView ||
!this.plugin.activeExcalidrawView?.isDirty()
) {
return;
if (this.workspaceDrawerLeftObserver || this.workspaceDrawerRightObserver) return;
const leftWorkspaceDrawer = document.querySelector<HTMLElement>(".workspace .workspace-drawer.mod-left");
const rightWorkspaceDrawer = document.querySelector<HTMLElement>(".workspace .workspace-drawer.mod-right");
if (!leftWorkspaceDrawer && !rightWorkspaceDrawer) return;
const parseDisplay = (value?: string | null): string => {
if (!value) return "";
const match = value.match(/display:\s*([^;]+);?/i);
return match ? match[1].trim() : "";
};
const action: MutationCallback = (mutations) => {
const activeView = this.plugin.activeExcalidrawView;
if (!activeView || activeView.semaphores?.viewunload) return;
for (const mutation of mutations) {
if (mutation.type !== "attributes" || mutation.attributeName !== "style") continue;
const target = mutation.target as HTMLElement;
const newDisplay = target.style.display;
const oldDisplay = parseDisplay(mutation.oldValue as string);
// Drawer finished closing: refresh to fix pointer offset after CSS transitions
if (newDisplay === "none" && oldDisplay !== "none") {
activeView.refresh();
continue;
}
this.plugin.activeExcalidrawView.save();
};
const options = {
attributeOldValue: true,
attributeFilter: ["style"],
};
if (leftWorkspaceDrawer) {
this.workspaceDrawerLeftObserver = DEBUGGING
? new CustomMutationObserver(action, "slidingDrawerLeftObserver")
: new MutationObserver(action);
this.workspaceDrawerLeftObserver.observe(leftWorkspaceDrawer, options);
// Drawer just opened after being hidden: keep the previous autosave safeguard
if (oldDisplay === "none" && newDisplay !== "none" && activeView.isDirty()) {
activeView.save();
}
}
};
if (rightWorkspaceDrawer) {
this.workspaceDrawerRightObserver = DEBUGGING
? new CustomMutationObserver(action, "slidingDrawerRightObserver")
: new MutationObserver(action);
this.workspaceDrawerRightObserver.observe(
rightWorkspaceDrawer,
options,
);
}
const options = {
attributes: true,
attributeOldValue: true,
attributeFilter: ["style"],
};
if (leftWorkspaceDrawer) {
this.workspaceDrawerLeftObserver = DEBUGGING
? new CustomMutationObserver(action, "slidingDrawerLeftObserver")
: new MutationObserver(action);
this.workspaceDrawerLeftObserver.observe(leftWorkspaceDrawer, options);
}
if (rightWorkspaceDrawer) {
this.workspaceDrawerRightObserver = DEBUGGING
? new CustomMutationObserver(action, "slidingDrawerRightObserver")
: new MutationObserver(action);
this.workspaceDrawerRightObserver.observe(rightWorkspaceDrawer, options);
}
}
}
+1 -1
View File
@@ -75,7 +75,7 @@ export class PackageManager {
return (
typeof lib === 'object' &&
lib !== null &&
typeof lib.restore === 'function' &&
typeof lib.restoreElements === 'function' &&
typeof lib.exportToSvg === 'function'
);
}
+5 -3
View File
@@ -92,6 +92,7 @@ export interface ExcalidrawSettings {
isLeftHanded: boolean;
desktopUIMode: UIMode;
tabletUIMode: UIMode;
phoneUIMode: UIMode;
iframeMatchExcalidrawTheme: boolean;
matchTheme: boolean;
matchThemeAlways: boolean;
@@ -283,6 +284,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
isLeftHanded: false,
desktopUIMode: "tray",
tabletUIMode: "compact",
phoneUIMode: "mobile",
iframeMatchExcalidrawTheme: true,
matchTheme: false,
matchThemeAlways: false,
@@ -429,10 +431,10 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
startupScriptPath: "",
aiEnabled: true,
openAIAPIToken: "",
openAIDefaultTextModel: "gpt-3.5-turbo-1106",
openAIDefaultTextModel: "gpt-5-mini",
openAIDefaultTextModelMaxTokens: 4096,
openAIDefaultVisionModel: "gpt-4o",
openAIDefaultImageGenerationModel: "dall-e-3",
openAIDefaultVisionModel: "gpt-5-mini",
openAIDefaultImageGenerationModel: "gpt-image-1",
openAIURL: "https://api.openai.com/v1/chat/completions",
openAIImageGenerationURL: "https://api.openai.com/v1/images/generations",
openAIImageEditsURL: "https://api.openai.com/v1/images/edits",
+11 -6
View File
@@ -93,6 +93,8 @@ export default {
CONVERT_CARD_TO_FILE: "Move back-of-note card to File",
ERROR_TRY_AGAIN: "Please try again.",
PASTE_CODEBLOCK: "Paste code block",
INVERT_IMAGES_IN_DARK_MODE: "Invert image(s) in dark mode",
DO_NOT_INVERT_IMAGES_IN_DARK_MODE: "Do not invert image(s) in dark mode",
INSERT_LATEX:
`Insert LaTeX formula (e.g. \\binom{n}{k} = \\frac{n!}{k!(n-k)!}).`,
ENTER_LATEX: "Enter a valid LaTeX expression",
@@ -315,17 +317,16 @@ export default {
AI_OPENAI_DEFAULT_MODEL_DESC:
"The default AI model to use when generating text. This is a freetext field, so you can enter any valid OpenAI model name. " +
"Find out more about the available models on the <a href='https://platform.openai.com/docs/models'>OpenAI website</a>.",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "Enter your default AI model here. e.g.: gpt-3.5-turbo-1106",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "Enter your default AI model here. e.g.: gpt-5-mini",
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "Max tokens",
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
"Maximum number of tokens to generate in the API response. Set to 0 to omit the max_tokens field (useful for models that don't support this parameter, such as GPT-5).",
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "Default Image Generation AI model",
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
"The default AI model to use when generating images. Image editing and variations are only supported by dall-e-2 at this time by OpenAI, " +
"for this reason dall-e-2 will automatically be used in such cases regardless of this setting.<br>" +
"The default AI model to use when generating images. Image editing and variations are only supported by dall-e-2 and gpt-image-1 at this time by OpenAI.<br>" +
"This is a freetext field, so you can enter any valid OpenAI model name. " +
"Find out more about the available models on the <a href='https://platform.openai.com/docs/models'>OpenAI website</a>.",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "Enter your default Image Generation AI model here e.g.: dall-e-3",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "Enter your default Image Generation AI model here e.g.: gpt-image-1",
AI_OPENAI_DEFAULT_VISION_MODEL_NAME: "Default AI vision model",
AI_OPENAI_DEFAULT_VISION_MODEL_DESC:
"The default AI vision model to use when generating text from images. This is a freetext field, so you can enter any valid OpenAI model name. " +
@@ -335,7 +336,7 @@ export default {
"The default OpenAI API URL. This is a freetext field, so you can enter any valid OpenAI API compatible URL. " +
"Excalidraw will use this URL when posting API requests to OpenAI. I am not doing any error handling on this field, so make sure you enter a valid URL and only change this if you know what you are doing. ",
AI_OPENAI_DEFAULT_IMAGE_API_URL_NAME: "OpenAI Image Generation API URL",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "Enter your default AI vision model here. e.g.: gpt-4o",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "Enter your default AI vision model here. e.g.: gpt-5-mini",
SAVING_HEAD: "Saving",
SAVING_DESC: "In the 'Saving' section of Excalidraw Settings, you can configure how your drawings are saved. This includes options for compressing Excalidraw JSON in Markdown, setting autosave intervals for both desktop and mobile, defining filename formats, and choosing whether to use the .excalidraw.md or .md file extension. ",
COMPRESS_NAME: "Compress Excalidraw JSON in Markdown",
@@ -464,9 +465,13 @@ export default {
DESKTOP_UI_MODE_DESC: "Select the default UI mode for desktop devices.",
TABLET_UI_MODE_NAME: "Preferred Tablet Mode",
TABLET_UI_MODE_DESC: "Select the default UI mode for tablet devices.",
PHONE_UI_MODE_NAME: "Preferred Phone Mode",
PHONE_UI_MODE_DESC: "Select the default UI mode for phone devices.",
MODE_FULL: "Desktop-mode",
MODE_COMPACT: "Compact-mode",
MODE_TRAY: "Tray-mode",
MODE_PHONE: "Phone-mode",
REAPPLY_UI_MODE_BUTTON: "Reapply UI mode now",
TRAY_MODE_NAME: "Enable tray-mode",
PREFER_COMPACT_MODE_DESKTOP_NAME: "Prefer compact-mode on Desktop",
PREFER_COMPACT_MODE_DESKTOP_DESC: "When toggling tray-mode on a desktop, if this option is enabled, Excalidraw will toggle between compact-mode and tray-mode. " +
@@ -1220,7 +1225,7 @@ export default {
UIFM_ANCHOR: "Anchor to 100% of original size",
UIFM_ANCHOR_DESC: "This is a pro feature, use it only if you understand how it works. If enabled even if you change the size of the imported image in Excalidraw, the next time you open the drawing this image will pop back to 100% size. This is useful when embedding an atomic Excalidraw idea into another note and preserving relative sizing of text and icons.",
UIFM_BTN_EMBEDDABLE: "as Embeddable",
UIFM_BTN_PDF: "as Pdf",
UIFM_BTN_PDF: "PDF as Image",
UIFM_BTN_IMAGE: "as Image",
//ReleaseNotes.ts
+35 -15
View File
@@ -18,7 +18,7 @@ export default {
ZIP_CURRENT_FILE: "压缩当前 Excalidraw 文件",
PUBLISH_SVG_CHECK: "Obsidian Publish:搜索过期的 SVG 和 PNG 导出文件",
EMBEDDABLE_PROPERTIES: "Embeddable 元素设置",
EMBEDDABLE_RELATIVE_ZOOM: "使元素的缩放等级等于当前绘图的缩放等级",
EMBEDDABLE_RELATIVE_ZOOM: "使元素的缩放级别等于当前绘图的缩放级别",
OPEN_IMAGE_SOURCE: "打开 Excalidraw 绘图",
INSTALL_SCRIPT: "安装此脚本",
UPDATE_SCRIPT: "有可用更新 - 点击安装",
@@ -30,13 +30,14 @@ export default {
"脚本已是最新 - 点击重新安装",
OPEN_AS_EXCALIDRAW: "打开为 Excalidraw 绘图",
TOGGLE_MODE: "在 Excalidraw 和 Markdown 模式之间切换",
DUPLICATE_IMAGE: "复制选定的图像,并分配一个不同的图像 ID",
DUPLICATE_IMAGE: "复制所选图像,并分配一个不同的图像 ID",
CONVERT_NOTE_TO_EXCALIDRAW: "转换:空白 Markdown 文档 => Excalidraw 绘图",
CONVERT_EXCALIDRAW: "转换: *.excalidraw => *.md",
CREATE_NEW: "新建绘图文件",
CONVERT_FILE_KEEP_EXT: "转换:*.excalidraw => *.excalidraw.md",
CONVERT_FILE_REPLACE_EXT: "转换:*.excalidraw => *.md (兼容 Logseq)",
DOWNLOAD_LIBRARY: "导出 stencil 库为 *.excalidrawlib 文件",
OPEN_SIDEPANEL: "打开 Excalidraw 侧边面板",
OPEN_EXISTING_NEW_PANE: "打开已有的绘图 - 于新面板",
OPEN_EXISTING_ACTIVE_PANE:
"打开已有的绘图 - 于当前面板",
@@ -92,6 +93,8 @@ export default {
CONVERT_CARD_TO_FILE: "将“背景笔记”卡片保存到文件",
ERROR_TRY_AGAIN: "请重试。",
PASTE_CODEBLOCK: "粘贴代码块",
INVERT_IMAGES_IN_DARK_MODE: "深色主题下反转颜色",
DO_NOT_INVERT_IMAGES_IN_DARK_MODE: "取消深色主题下反转颜色",
INSERT_LATEX:
`插入 LaTeX 公式到当前绘图中`,
ENTER_LATEX: "输入 LaTeX 公式",
@@ -154,6 +157,7 @@ export default {
OPEN_AS_MD: "打开为 Markdown",
EXPORT_IMAGE: `导出为图片`,
OPEN_LINK: "打开所选元素里的链接 \n(按住 Shift 在新面板打开)",
EXCALIDRAW_SIDEPANEL: "Excalidraw 侧边面板",
EXPORT_EXCALIDRAW: "导出为 .excalidraw 文件(旧版绘图文件格式)",
LINK_BUTTON_CLICK_NO_TEXT:
"请选择一个包含内部或外部链接的元素。\n",
@@ -296,7 +300,7 @@ export default {
SCRIPT_FOLDER_DESC:
"此文件夹用于存放 Excalidraw 自动化脚本。" +
"您可以在 Obsidian 命令面板中执行这些脚本," +
"还可以为喜欢的脚本分配快捷键,就像为其他 Obsidian 命令分配快捷键一样。<br>" +
"还可以为喜欢的脚本分配热键,就像为其他 Obsidian 命令分配热键一样。<br>" +
"该项不能设为仓库根目录。",
AI_HEAD: "AI(实验性)",
AI_DESC: `OpenAI GPT API 的设置。` +
@@ -313,17 +317,16 @@ export default {
AI_OPENAI_DEFAULT_MODEL_DESC:
"使用哪个 AI 模型来生成文本。请填写有效的 OpenAI 模型名称。" +
"您可访问 <a href='https://platform.openai.com/docs/models'>OpenAI 网站</a> 了解更多模型信息。",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-3.5-turbo-1106",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-5-mini",
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "最大 token 数",
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
"API 响应中生成的最大 token 数。设置为 0 以忽略 max_tokens 字段(适用于不支持该参数的模型,如 GPT-5)。",
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "默认的图片 AI 模型",
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
"使用哪个 AI 模型来生成图片。图生图会强制使用 dall-e-2 模型," +
"因为目前只有该模型支持 Image editing and variations。" +
"使用哪个 AI 模型来生成图片。图生图目前只有 dall-e-2 和 gpt-image-1 模型支持 Image editing and variations。" +
"请填写有效的 OpenAI 模型名称。" +
"您可访问 <a href='https://platform.openai.com/docs/models'>OpenAI 网站</a> 了解更多模型信息。",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "dall-e-3",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "gpt-image-1",
AI_OPENAI_DEFAULT_VISION_MODEL_NAME: "默认的 AI 视觉模型",
AI_OPENAI_DEFAULT_VISION_MODEL_DESC:
"根据文本生成图片时,使用哪个 AI 视觉模型。请填写有效的 OpenAI 模型名称。" +
@@ -333,7 +336,7 @@ export default {
"默认的 OpenAI API URL。请填写有效的 OpenAI API URL。" +
"Excalidraw 会通过该 URL 发送 API 请求给 OpenAI。我没有对该项做任何错误处理,请谨慎修改。",
AI_OPENAI_DEFAULT_IMAGE_API_URL_NAME: "OpenAI 图片生成 API URL",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "输入默认 AI 模型名称,如 gpt-4o",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "输入默认 AI 模型名称,如 gpt-5-mini",
SAVING_HEAD: "保存",
SAVING_DESC: "包括:压缩,自动保存的时间间隔,文件的命名格式和扩展名等。",
COMPRESS_NAME: "压缩 Excalidraw JSON",
@@ -462,9 +465,13 @@ export default {
DESKTOP_UI_MODE_DESC: "桌面端设备默认 UI 模式。",
TABLET_UI_MODE_NAME: "平板端偏好模式",
TABLET_UI_MODE_DESC: "平板端设备默认 UI 模式。",
PHONE_UI_MODE_NAME: "手机端偏好模式",
PHONE_UI_MODE_DESC: "手机端设备默认 UI 模式。",
MODE_FULL: "Desktop-mode",
MODE_COMPACT: "Compact-mode",
MODE_TRAY: "Tray-mode",
MODE_PHONE: "Phone-mode",
REAPPLY_UI_MODE_BUTTON: "重新应用 UI 模式",
TRAY_MODE_NAME: "启用托盘模式",
PREFER_COMPACT_MODE_DESKTOP_NAME: "在桌面端偏好紧凑模式",
PREFER_COMPACT_MODE_DESKTOP_DESC: "切换托盘模式时,开启该项,Excalidraw 将在紧凑模式与托盘模式之间切换。" +
@@ -541,7 +548,8 @@ export default {
LONG_PRESS_MOBILE_NAME: "长按打开(移动端)",
LONG_PRESS_MOBILE_DESC: "长按打开在 Markdown 文档中嵌入的 Excalidraw 绘图。单位:毫秒。",
DOUBLE_CLICK_LINK_OPEN_VIEW_MODE: "在查看模式下允许双击打开链接",
ELEMENT_LINK_SYNC_NAME: "文本元素同步正文链接",
ELEMENT_LINK_SYNC_DESC: "若开启,Excalidraw 将匹配 2.19.0 之前的行为:始终将正文第一个链接复制到元素链接字段。导出 SVG/PNG 仅在元素链接字段包含单个链接(不包括正文内的链接)时保留链接。开启:若你依赖正文链接并希望元素链接始终镜像第一个链接。关闭:若你独立管理元素链接,用于标签、行内链接本体等元数据、或多个链接,如 Dataview 风格的笔记 '(reminds me of:: [[link]]) #noteToSelf'。",
FOCUS_ON_EXISTING_TAB_NAME: "聚焦于当前标签页",
FOCUS_ON_EXISTING_TAB_DESC: "当打开一个链接时,如果该文件已经打开,Excalidraw 将会聚焦到现有的标签页上。" +
"启用该项时,如果文件已打开,将覆盖“在相邻面板中打开”,但“打开所选绘图的背景笔记”命令面板操作除外。",
@@ -564,6 +572,12 @@ export default {
"文本元素处于 PREVIEW 模式时,在内部链接的两侧显示中括号。<br>" +
"可为某个绘图单独设置该项,方法是在其 frontmatter 中添加如 <code>"
}${FRONTMATTER_KEYS["link-brackets"].name}: true/false</code> 的键值对。`,
/*LINK_DETECTION_NAME: "Do not auto-create element link from text",
LINK_DETECTION_DESC: "By default, Excalidraw will automatically create an element link when you type or paste a valid " +
"[[Obsidian link]] or a (web link) into a Text Element. This link overrides whatever element link you may have set previously. " +
"Even if you delete the element link, if the text element contains a valid link, Excalidraw will recreate the element link. " +
"If you turn this setting on, Excalidraw will not auto-create element links from text. You can still manually set element links " +
`Links in the text will still be navigable when you ${labelCTRL()} + CLICK the element.`,*/
LINK_PREFIX_NAME: "内部链接的前缀",
LINK_PREFIX_DESC: `${
"文本元素处于 PREVIEW 模式时,如果其中包含链接,则添加此前缀。<br>" +
@@ -679,7 +693,7 @@ export default {
EMBED_THEME_BACKGROUND: "图像的主题和背景色",
EMBED_IMAGE_CACHE_NAME: "为嵌入到 Markdown 文档中的绘图创建预览图缓存",
EMBED_IMAGE_CACHE_DESC: "可提高下次嵌入的速度。" +
"但如果绘图包含子绘图,(当子绘图改变时)您需要打开父绘图并手动保存,才能够更新预览图。",
"但如果绘图包含子绘图,(当子绘图改变时)预览图不会更新,直到您打开绘图并手动保存。",
SCENE_IMAGE_CACHE_NAME: "缓存场景中嵌套的绘图",
SCENE_IMAGE_CACHE_DESC: "Excalidraw 将智能地尝试识别嵌套的绘图的子元素是否发生变化,并更新缓存。" +
"这将加快渲染过程,特别是在您的场景中有深度嵌套的绘图时。<br>" +
@@ -711,7 +725,7 @@ export default {
EMBED_WIDTH_NAME: "预览图的默认宽度",
EMBED_WIDTH_DESC:
"嵌入到 Markdown 文档中的绘图的预览图的默认宽度。该项也适用于鼠标悬停时浮现的预览图。<br>" +
"可为某个要嵌入到 Markdown 文档中的绘图文件单独设置," +
"可为某个要嵌入到 Markdown 文档中的绘图单独设置," +
"方法是修改相应的内部链接格式为如 <code>![[drawing.excalidraw|100]]</code> 或 <code>[[drawing.excalidraw|100x100]]</code>。",
EMBED_HEIGHT_NAME: "预览图的默认高度",
EMBED_HEIGHT_DESC:
@@ -923,9 +937,9 @@ export default {
SELECT_FILE_TO_LINK: "选择要以链接形式插入到当前绘图中的文件",
SELECT_COMMAND_PLACEHOLDER: "选择要插入到当前绘图中的命令",
SELECT_DRAWING: "选择要以图像形式嵌入到当前绘图中的图片或绘图文件",
TYPE_FILENAME: "键入要选择的绘图名称",
TYPE_FILENAME: "输入要选择的绘图名称",
SELECT_FILE_OR_TYPE_NEW:
"选择已有绘图,或者键入新绘图文件的名称,然后按回车。",
"选择已有绘图,或者输入新绘图文件的名称,然后按回车。",
SELECT_TO_EMBED: "选择要嵌入到当前 Markdown 文档中的绘图",
SELECT_MD: "选择要以图像形式嵌入到当前绘图中的 Markdown 文档",
SELECT_PDF: "选择要以图像形式嵌入到当前绘图中的 PDF",
@@ -1017,7 +1031,7 @@ export default {
ES_FILENAME_VISIBLE: "显示页内标题",
ES_BACKGROUND_HEAD: "背景色",
ES_BACKGROUND_DESC_INFO: "点击此处查看更多颜色信息",
ES_BACKGROUND_DESC_DETAIL: "背景色仅影响预览模式的 MD-Embeddable。在编辑模式,它会根据场景(通过笔记属性设置)或插件设置,遵循 Obsidian 的深色/浅色主题。背景色有两层:元素背景色(下层颜色)和上层颜色。选择“匹配元素”表示两层都遵循元素背景色。选择“匹配绘图”或特定背景色不会改变元素背景色。设置不透明度(如 50%)会将绘图或选定的颜色与元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素属性编辑器中将元素背景色设置为透明,这样只有上层颜色生效。",
ES_BACKGROUND_DESC_DETAIL: "背景色仅影响预览模式的 MD-Embeddable。在编辑模式,它会根据场景(通过笔记属性设置)或插件设置,遵循 Obsidian 的深色/浅色主题。背景色有两层:元素背景色(下层颜色)和上层颜色。选择“匹配元素”表示两层都遵循元素背景色。选择“匹配绘图”或特定背景色不会改变元素背景色。设置不透明度(如 50%)会将绘图或所选颜色与元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素属性编辑器中将元素背景色设置为透明,这样只有上层颜色生效。",
ES_BACKGROUND_MATCH_ELEMENT: "匹配元素背景色",
ES_BACKGROUND_MATCH_CANVAS: "匹配绘图背景色",
ES_BACKGROUND_COLOR: "背景色",
@@ -1028,7 +1042,7 @@ export default {
ES_BORDER_OPACITY: "边框不透明度",
ES_EMBEDDABLE_SETTINGS: "MD-Embeddable 设置",
ES_USE_OBSIDIAN_DEFAULTS: "使用 Obsidian 默认设置",
ES_ZOOM_100_RELATIVE_DESC: "使元素的缩放等级等于当前绘图的缩放等级",
ES_ZOOM_100_RELATIVE_DESC: "使元素的缩放级别等于当前绘图的缩放级别",
ES_ZOOM_100: "Relative 100%",
//Prompts.ts
@@ -1247,4 +1261,10 @@ export default {
VERSION_MISMATCH_DISABLE_DESC: "可在以下位置重新启用:设置 → Excalidraw → 基本 → 警告插件更新不完整",
VERSION_MISMATCH_REDOWNLOAD: "重新下载插件",
VERSION_MISMATCH_IGNORE: "忽略",
//InlineLinkSuggester.ts
INLINE_HINT: "输入 [[ 以搜索并插入链接",
//SuggestionModal.ts
SUGGESTION_NOMATCH: "未找到匹配结果",
};
+44 -24
View File
@@ -18,7 +18,7 @@ export default {
ZIP_CURRENT_FILE: "壓縮當前 Excalidraw 檔案",
PUBLISH_SVG_CHECK: "Obsidian Publish:搜尋過期的 SVG 和 PNG 匯出檔案",
EMBEDDABLE_PROPERTIES: "Embeddable 元素設定",
EMBEDDABLE_RELATIVE_ZOOM: "使元素的縮放等級等於當前繪圖的縮放等級",
EMBEDDABLE_RELATIVE_ZOOM: "使元素的縮放級別等於當前繪圖的縮放級別",
OPEN_IMAGE_SOURCE: "開啟 Excalidraw 繪圖",
INSTALL_SCRIPT: "安裝此指令碼",
UPDATE_SCRIPT: "有可用更新 - 點選安裝",
@@ -30,13 +30,14 @@ export default {
"指令碼已是最新 - 點選重新安裝",
OPEN_AS_EXCALIDRAW: "開啟為 Excalidraw 繪圖",
TOGGLE_MODE: "在 Excalidraw 和 Markdown 模式之間切換",
DUPLICATE_IMAGE: "複製選定的影像,並分配一個不同的影像 ID",
DUPLICATE_IMAGE: "複製所選影像,並分配一個不同的影像 ID",
CONVERT_NOTE_TO_EXCALIDRAW: "轉換:空白 Markdown 文件 => Excalidraw 繪圖",
CONVERT_EXCALIDRAW: "轉換: *.excalidraw => *.md",
CREATE_NEW: "新建繪圖檔案",
CONVERT_FILE_KEEP_EXT: "轉換:*.excalidraw => *.excalidraw.md",
CONVERT_FILE_REPLACE_EXT: "轉換:*.excalidraw => *.md (相容 Logseq)",
DOWNLOAD_LIBRARY: "匯出 stencil 庫為 *.excalidrawlib 檔案",
OPEN_SIDEPANEL: "開啟 Excalidraw 側邊面板",
OPEN_EXISTING_NEW_PANE: "開啟已有的繪圖 - 於新面板",
OPEN_EXISTING_ACTIVE_PANE:
"開啟已有的繪圖 - 於當前面板",
@@ -63,6 +64,7 @@ export default {
MARKER_FRAME_TITLE_SHOW: "顯示標記畫框名稱",
MARKER_FRAME_TITLE_HIDE: "隱藏標記畫框名稱",
COPY_ELEMENT_LINK: "複製所選元素的 [[file#^id]] 連結",
FRAME_WITH_NAME: "按名稱複製畫框連結",
COPY_DRAWING_LINK: "複製繪圖的 ![[drawing]] 連結",
INSERT_LINK_TO_ELEMENT:
`單擊=複製所選元素的 [[file#^id]] 連結\n${labelCTRL()}=複製元素所在分組為 [[file#^group=id]] 連結\n${labelSHIFT()}=複製所選元素所在區域為 [[file#^area=id]] 連結`,
@@ -91,6 +93,8 @@ export default {
CONVERT_CARD_TO_FILE: "將“背景筆記”卡片儲存到檔案",
ERROR_TRY_AGAIN: "請重試。",
PASTE_CODEBLOCK: "貼上程式碼塊",
INVERT_IMAGES_IN_DARK_MODE: "深色主題下反轉顏色",
DO_NOT_INVERT_IMAGES_IN_DARK_MODE: "取消深色主題下反轉顏色",
INSERT_LATEX:
`插入 LaTeX 公式到當前繪圖中`,
ENTER_LATEX: "輸入 LaTeX 公式",
@@ -153,6 +157,7 @@ export default {
OPEN_AS_MD: "開啟為 Markdown",
EXPORT_IMAGE: `匯出為圖片`,
OPEN_LINK: "開啟所選元素裡的連結 \n(按住 Shift 在新面板開啟)",
EXCALIDRAW_SIDEPANEL: "Excalidraw 側邊面板",
EXPORT_EXCALIDRAW: "匯出為 .excalidraw 檔案(舊版繪圖檔案格式)",
LINK_BUTTON_CLICK_NO_TEXT:
"請選擇一個包含內部或外部連結的元素。\n",
@@ -295,7 +300,7 @@ export default {
SCRIPT_FOLDER_DESC:
"此資料夾用於存放 Excalidraw 自動化指令碼。" +
"您可以在 Obsidian 命令面板中執行這些指令碼," +
"還可以為喜歡的指令碼分配快捷鍵,就像為其他 Obsidian 命令分配快捷鍵一樣。<br>" +
"還可以為喜歡的指令碼分配熱鍵,就像為其他 Obsidian 命令分配熱鍵一樣。<br>" +
"該項不能設為倉庫根目錄。",
AI_HEAD: "AI(實驗性)",
AI_DESC: `OpenAI GPT API 的設定。` +
@@ -312,17 +317,16 @@ export default {
AI_OPENAI_DEFAULT_MODEL_DESC:
"使用哪個 AI 模型來生成文字。請填寫有效的 OpenAI 模型名稱。" +
"您可訪問 <a href='https://platform.openai.com/docs/models'>OpenAI 網站</a> 瞭解更多模型資訊。",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-3.5-turbo-1106",
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-5-mini",
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "最大 token 數",
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
"API 生成的最大 token 數。設定為 0 以忽略 max_tokens 欄位(適用於不支援該引數的模型,如 GPT-5)。",
"API 響應中生成的最大 token 數。設定為 0 以忽略 max_tokens 欄位(適用於不支援該引數的模型,如 GPT-5)。",
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "預設的圖片 AI 模型",
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
"使用哪個 AI 模型來生成圖片。圖生圖會強制使用 dall-e-2 模型," +
"因為目前只有該模型支援 Image editing and variations。" +
"使用哪個 AI 模型來生成圖片。圖生圖目前只有 dall-e-2 和 gpt-image-1 模型支援 Image editing and variations。" +
"請填寫有效的 OpenAI 模型名稱。" +
"您可訪問 <a href='https://platform.openai.com/docs/models'>OpenAI 網站</a> 瞭解更多模型資訊。",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "dall-e-3",
AI_OPENAI_DEFAULT_IMAGE_MODEL_PLACEHOLDER: "gpt-image-1",
AI_OPENAI_DEFAULT_VISION_MODEL_NAME: "預設的 AI 視覺模型",
AI_OPENAI_DEFAULT_VISION_MODEL_DESC:
"根據文字生成圖片時,使用哪個 AI 視覺模型。請填寫有效的 OpenAI 模型名稱。" +
@@ -332,7 +336,7 @@ export default {
"預設的 OpenAI API URL。請填寫有效的 OpenAI API URL。" +
"Excalidraw 會透過該 URL 傳送 API 請求給 OpenAI。我沒有對該項做任何錯誤處理,請謹慎修改。",
AI_OPENAI_DEFAULT_IMAGE_API_URL_NAME: "OpenAI 圖片生成 API URL",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "輸入預設 AI 模型名稱,如 gpt-4o",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "輸入預設 AI 模型名稱,如 gpt-5-mini",
SAVING_HEAD: "儲存",
SAVING_DESC: "包括:壓縮,自動儲存的時間間隔,檔案的命名格式和副檔名等。",
COMPRESS_NAME: "壓縮 Excalidraw JSON",
@@ -461,9 +465,13 @@ export default {
DESKTOP_UI_MODE_DESC: "桌面端裝置預設 UI 模式。",
TABLET_UI_MODE_NAME: "平板端偏好模式",
TABLET_UI_MODE_DESC: "平板端裝置預設 UI 模式。",
PHONE_UI_MODE_NAME: "手機端偏好模式",
PHONE_UI_MODE_DESC: "手機端裝置預設 UI 模式。",
MODE_FULL: "Desktop-mode",
MODE_COMPACT: "Compact-mode",
MODE_TRAY: "Tray-mode",
MODE_PHONE: "Phone-mode",
REAPPLY_UI_MODE_BUTTON: "重新應用 UI 模式",
TRAY_MODE_NAME: "啟用托盤模式",
PREFER_COMPACT_MODE_DESKTOP_NAME: "在桌面端偏好緊湊模式",
PREFER_COMPACT_MODE_DESKTOP_DESC: "切換托盤模式時,開啟該項,Excalidraw 將在緊湊模式與托盤模式之間切換。" +
@@ -508,9 +516,8 @@ export default {
GRID_DYNAMIC_COLOR_DESC:
"<b>開啟:</b>更改網格顏色以匹配繪圖顏色。<br><b>關閉:</b>將以下顏色用作網格顏色。",
GRID_COLOR_NAME: "網格顏色",
GRID_OPACITY_NAME: "網格透明度",
GRID_OPACITY_DESC: "設定網格的透明度。還將控制將箭頭繫結到元素時繫結框的透明度。" +
"0 全透明 ⟺ 100 不透明。",
GRID_OPACITY_NAME: "網格不透明度",
GRID_OPACITY_DESC: "設定網格的不透明度。0 全透明 ⟺ 100 不透明。",
GRID_DIRECTION_NAME: "網格方向",
GRID_DIRECTION_DESC: "第一個開關顯示/隱藏水平網格,第二個開關顯示/隱藏垂直網格。",
GRID_HORIZONTAL: "渲染水平網格",
@@ -541,7 +548,8 @@ export default {
LONG_PRESS_MOBILE_NAME: "長按開啟(移動端)",
LONG_PRESS_MOBILE_DESC: "長按開啟在 Markdown 文件中嵌入的 Excalidraw 繪圖。單位:毫秒。",
DOUBLE_CLICK_LINK_OPEN_VIEW_MODE: "在檢視模式下允許雙擊開啟連結",
ELEMENT_LINK_SYNC_NAME: "文字元素同步正文連結",
ELEMENT_LINK_SYNC_DESC: "若開啟,Excalidraw 將匹配 2.19.0 之前的行為:始終將正文第一個連結複製到元素連結欄位。匯出 SVG/PNG 僅在元素連結欄位包含單個連結(不包括正文內的連結)時保留連結。開啟:若你依賴正文連結並希望元素連結始終映象第一個連結。關閉:若你獨立管理元素連結,用於標籤、行內連結本體等元資料、或多個連結,如 Dataview 風格的筆記 '(reminds me of:: [[link]]) #noteToSelf'。",
FOCUS_ON_EXISTING_TAB_NAME: "聚焦於當前標籤頁",
FOCUS_ON_EXISTING_TAB_DESC: "當開啟一個連結時,如果該檔案已經開啟,Excalidraw 將會聚焦到現有的標籤頁上。" +
"啟用該項時,如果檔案已開啟,將覆蓋“在相鄰面板中開啟”,但“開啟所選繪圖的背景筆記”命令面板操作除外。",
@@ -564,6 +572,12 @@ export default {
"文字元素處於 PREVIEW 模式時,在內部連結的兩側顯示中括號。<br>" +
"可為某個繪圖單獨設定該項,方法是在其 frontmatter 中新增如 <code>"
}${FRONTMATTER_KEYS["link-brackets"].name}: true/false</code> 的鍵值對。`,
/*LINK_DETECTION_NAME: "Do not auto-create element link from text",
LINK_DETECTION_DESC: "By default, Excalidraw will automatically create an element link when you type or paste a valid " +
"[[Obsidian link]] or a (web link) into a Text Element. This link overrides whatever element link you may have set previously. " +
"Even if you delete the element link, if the text element contains a valid link, Excalidraw will recreate the element link. " +
"If you turn this setting on, Excalidraw will not auto-create element links from text. You can still manually set element links " +
`Links in the text will still be navigable when you ${labelCTRL()} + CLICK the element.`,*/
LINK_PREFIX_NAME: "內部連結的字首",
LINK_PREFIX_DESC: `${
"文字元素處於 PREVIEW 模式時,如果其中包含連結,則新增此字首。<br>" +
@@ -585,9 +599,9 @@ export default {
`<b>開啟:</b>在 Excalidraw <u>檢視模式(View)</u>下,滑鼠懸停在 <code>[[內部連結]]</code> 上即可預覽;` +
"而在<u>普通模式(Normal)</u>下,滑鼠懸停在內部連結右上角的藍色標識上即可預覽。<br>" +
`<b>關閉:</b>滑鼠懸停在 <code>[[內部連結]]</code> 上,並且按住 ${labelCTRL()} 才能預覽。`,
LINKOPACITY_NAME: "連結標識的透明度",
LINKOPACITY_NAME: "連結標識的不透明度",
LINKOPACITY_DESC:
"含有連結的元素,其右上角的連結標識的透明度。0 全透明 ⟺ 100 不透明。",
"含有連結的元素,其右上角的連結標識的不透明度。0 全透明 ⟺ 100 不透明。",
LINK_CTRL_CLICK_NAME:
`按住 ${labelCTRL()} 並點選含有 [[連結]] 或 [別名](連結) 的文字來開啟連結`,
LINK_CTRL_CLICK_DESC:
@@ -679,7 +693,7 @@ export default {
EMBED_THEME_BACKGROUND: "影像的主題和背景色",
EMBED_IMAGE_CACHE_NAME: "為嵌入到 Markdown 文件中的繪圖建立預覽圖快取",
EMBED_IMAGE_CACHE_DESC: "可提高下次嵌入的速度。" +
"但如果繪圖包含子繪圖,(當子繪圖改變時)您需要開啟父繪圖並手動儲存,才能夠更新預覽圖。",
"但如果繪圖包含子繪圖,(當子繪圖改變時)預覽圖不會更新,直到您開啟繪圖並手動儲存。",
SCENE_IMAGE_CACHE_NAME: "快取場景中巢狀的繪圖",
SCENE_IMAGE_CACHE_DESC: "Excalidraw 將智慧地嘗試識別巢狀的繪圖的子元素是否發生變化,並更新快取。" +
"這將加快渲染過程,特別是在您的場景中有深度巢狀的繪圖時。<br>" +
@@ -692,7 +706,7 @@ export default {
EMBED_REUSE_EXPORTED_IMAGE_DESC:
"該項與下方“匯出”部分“匯出設定”中的 <a href='#"+TAG_AUTOEXPORT+"'>自動匯出 SVG/PNG 副本</a> 選項配合使用。如果嵌入到 Markdown 文件中的繪圖檔案存在同名的 SVG/PNG 副本,則將其作為預覽圖,而不再重新生成。<br>" +
"該項能夠提高 Markdown 文件的開啟速度,尤其是當嵌入到 Markdown 文件中的繪圖檔案中含有大量圖片或 MD-Embed 時。" +
"但是,該項也可能導致預覽圖無法即時反應繪圖檔案或者 Obsidian 主題的修改。<br>" +
"但是,該項也可能導致預覽圖無法立即響應繪圖檔案或者 Obsidian 主題的修改。<br>" +
"該項僅作用於嵌入到 Markdown 文件中的繪圖。" +
"該項無法提升繪圖檔案的開啟速度。詳見 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.23' target='_blank'>此說明</a>。",
/*EMBED_PREVIEW_SVG_NAME: "生成 SVG 格式的預覽圖",
@@ -711,7 +725,7 @@ export default {
EMBED_WIDTH_NAME: "預覽圖的預設寬度",
EMBED_WIDTH_DESC:
"嵌入到 Markdown 文件中的繪圖的預覽圖的預設寬度。該項也適用於滑鼠懸停時浮現的預覽圖。<br>" +
"可為某個要嵌入到 Markdown 文件中的繪圖檔案單獨設定," +
"可為某個要嵌入到 Markdown 文件中的繪圖單獨設定," +
"方法是修改相應的內部連結格式為如 <code>![[drawing.excalidraw|100]]</code> 或 <code>[[drawing.excalidraw|100x100]]</code>。",
EMBED_HEIGHT_NAME: "預覽圖的預設高度",
EMBED_HEIGHT_DESC:
@@ -923,9 +937,9 @@ export default {
SELECT_FILE_TO_LINK: "選擇要以連結形式插入到當前繪圖中的檔案",
SELECT_COMMAND_PLACEHOLDER: "選擇要插入到當前繪圖中的命令",
SELECT_DRAWING: "選擇要以影像形式嵌入到當前繪圖中的圖片或繪圖檔案",
TYPE_FILENAME: "鍵入要選擇的繪圖名稱",
TYPE_FILENAME: "輸入要選擇的繪圖名稱",
SELECT_FILE_OR_TYPE_NEW:
"選擇已有繪圖,或者鍵入新繪圖檔案的名稱,然後按回車。",
"選擇已有繪圖,或者輸入新繪圖檔案的名稱,然後按回車。",
SELECT_TO_EMBED: "選擇要嵌入到當前 Markdown 文件中的繪圖",
SELECT_MD: "選擇要以影像形式嵌入到當前繪圖中的 Markdown 文件",
SELECT_PDF: "選擇要以影像形式嵌入到當前繪圖中的 PDF",
@@ -1017,18 +1031,18 @@ export default {
ES_FILENAME_VISIBLE: "顯示頁內標題",
ES_BACKGROUND_HEAD: "背景色",
ES_BACKGROUND_DESC_INFO: "點選此處檢視更多顏色資訊",
ES_BACKGROUND_DESC_DETAIL: "背景色僅影響預覽模式的 MD-Embeddable。在編輯模式,它會根據場景(透過筆記屬性設定)或外掛設定,遵循 Obsidian 的深色/淺色主題。背景色有兩層:元素背景色(下層顏色)和上層顏色。選擇“匹配元素”表示兩層都遵循元素背景色。選擇“匹配繪圖”或特定背景色不會改變元素背景色。設定透明度(如 50%)會將繪圖或選定的顏色與元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素屬性編輯器中將元素背景色設定為透明,這樣只有上層顏色生效。",
ES_BACKGROUND_DESC_DETAIL: "背景色僅影響預覽模式的 MD-Embeddable。在編輯模式,它會根據場景(透過筆記屬性設定)或外掛設定,遵循 Obsidian 的深色/淺色主題。背景色有兩層:元素背景色(下層顏色)和上層顏色。選擇“匹配元素”表示兩層都遵循元素背景色。選擇“匹配繪圖”或特定背景色不會改變元素背景色。設定不透明度(如 50%)會將繪圖或所選顏色與元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素屬性編輯器中將元素背景色設定為透明,這樣只有上層顏色生效。",
ES_BACKGROUND_MATCH_ELEMENT: "匹配元素背景色",
ES_BACKGROUND_MATCH_CANVAS: "匹配繪圖背景色",
ES_BACKGROUND_COLOR: "背景色",
ES_BORDER_HEAD: "邊框顏色",
ES_BORDER_COLOR: "邊框顏色",
ES_BORDER_MATCH_ELEMENT: "匹配元素邊框顏色",
ES_BACKGROUND_OPACITY: "背景透明度",
ES_BORDER_OPACITY: "邊框透明度",
ES_BACKGROUND_OPACITY: "背景不透明度",
ES_BORDER_OPACITY: "邊框不透明度",
ES_EMBEDDABLE_SETTINGS: "MD-Embeddable 設定",
ES_USE_OBSIDIAN_DEFAULTS: "使用 Obsidian 預設設定",
ES_ZOOM_100_RELATIVE_DESC: "使元素的縮放等級等於當前繪圖的縮放等級",
ES_ZOOM_100_RELATIVE_DESC: "使元素的縮放級別等於當前繪圖的縮放級別",
ES_ZOOM_100: "Relative 100%",
//Prompts.ts
@@ -1247,4 +1261,10 @@ export default {
VERSION_MISMATCH_DISABLE_DESC: "可在以下位置重新啟用:設定 → Excalidraw → 基本 → 警告外掛更新不完整",
VERSION_MISMATCH_REDOWNLOAD: "重新下載外掛",
VERSION_MISMATCH_IGNORE: "忽略",
//InlineLinkSuggester.ts
INLINE_HINT: "輸入 [[ 以搜尋並插入連結",
//SuggestionModal.ts
SUGGESTION_NOMATCH: "未找到匹配結果",
};
+44 -55
View File
@@ -1,4 +1,5 @@
import { App, Modal } from "obsidian";
import { clamp } from "@radix-ui/number";
function getClientPoint(e: PointerEvent | TouchEvent) {
if (e.type.startsWith("touch")) {
@@ -26,13 +27,13 @@ function isPointOnText(e: PointerEvent | TouchEvent, doc: Document): boolean {
let offset: number | null = null;
// Chromium/Firefox-ish
const caretPos = (doc as any).caretPositionFromPoint?.(pt.x, pt.y);
const caretPos = doc.caretPositionFromPoint?.(pt.x, pt.y);
if (caretPos?.offsetNode) {
offsetNode = caretPos.offsetNode;
offset = typeof caretPos.offset === "number" ? caretPos.offset : null;
} else {
// Safari/WebKit
const caretRange = (doc as any).caretRangeFromPoint?.(pt.x, pt.y);
const caretRange = doc.caretRangeFromPoint?.(pt.x, pt.y);
if (caretRange?.startContainer) {
offsetNode = caretRange.startContainer;
offset = typeof caretRange.startOffset === "number" ? caretRange.startOffset : null;
@@ -67,14 +68,13 @@ export class FloatingModal extends Modal {
private dragging = false;
private offsetX = 0;
private offsetY = 0;
private pointerDownHandler: (e: PointerEvent | TouchEvent) => void;
private pointerMoveHandler: (e: PointerEvent | TouchEvent) => void;
private pointerUpHandler: () => void;
private readonly pointerDownHandler: (e: PointerEvent | TouchEvent) => void;
private readonly pointerMoveHandler: (e: PointerEvent | TouchEvent) => void;
private readonly pointerUpHandler: () => void;
private disableKeyCapture = true; // new flag: when true, let keystrokes pass through to workspace
private previousActive: HTMLElement | null = null; // stores element focused before opening
private escListener: (e: KeyboardEvent) => void;
private modalKeydownStopHandler: (e: KeyboardEvent) => void; // store handler so we can remove it
private previousActive?: HTMLElement = null; // stores element focused before opening
private readonly modalKeydownStopHandler: (e: KeyboardEvent) => void; // store handler so we can remove it
private ownerWindow: Window = window;
private ownerDocument: Document = document;
@@ -84,8 +84,22 @@ export class FloatingModal extends Modal {
this.pointerDownHandler = this.handlePointerDown.bind(this);
this.pointerMoveHandler = this.handlePointerMove.bind(this);
this.pointerUpHandler = this.handlePointerUp.bind(this);
this.escListener = this.handleEscKey.bind(this);
this.modalKeydownStopHandler = (ev: KeyboardEvent) => ev.stopPropagation();
this.setDimBackground(false);
}
protected shouldNotStartDrag(target: HTMLElement, event: PointerEvent | TouchEvent): boolean {
return Boolean(
target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement ||
target instanceof HTMLSelectElement ||
target instanceof HTMLButtonElement ||
isPointOnText(event, this.ownerDocument) ||
target.closest(".clickable-icon") ||
// ensure close button never starts drag
target.closest(".modal-close-button")
)
}
private handlePointerDown(e: PointerEvent | TouchEvent): void {
@@ -93,15 +107,7 @@ export class FloatingModal extends Modal {
const target = e.target as HTMLElement;
// Ignore if clicking on interactive elements
if (
target instanceof HTMLInputElement ||
target instanceof HTMLTextAreaElement ||
target instanceof HTMLSelectElement ||
target instanceof HTMLButtonElement ||
isPointOnText(e, this.ownerDocument) ||
target.closest(".clickable-icon") ||
target.closest(".modal-close-button") // ensure close button never starts drag
) {
if (this.shouldNotStartDrag(target, e)) {
return;
}
@@ -149,25 +155,18 @@ export class FloatingModal extends Modal {
e.preventDefault();
if (e.type === "touchmove") e.stopPropagation();
let clientX, clientY;
const { clientX, clientY } = (e.type === "touchmove") ?
(e as TouchEvent).touches[0] : e as PointerEvent;
if (e.type === "touchmove") {
const touch = (e as TouchEvent).touches[0];
clientX = touch.clientX;
clientY = touch.clientY;
} else {
const pointerEvent = e as PointerEvent;
clientX = pointerEvent.clientX;
clientY = pointerEvent.clientY;
}
const x = clientX - this.offsetX;
const y = clientY - this.offsetY;
// Prevent moving the modal offscreen
const { width, height } = modalEl.getBoundingClientRect();
const margin = 8;
const x = clamp(clientX - this.offsetX, [margin, this.ownerWindow.innerWidth - width - margin]);
const y = clamp(clientY - this.offsetY, [margin, this.ownerWindow.innerHeight - height - margin]);
// Position the modal element
modalEl.style.left = `${x}px`;
modalEl.style.top = `${y}px`;
modalEl.style.transform = "none"; // Remove centering transform
}
private handlePointerUp(): void {
@@ -180,13 +179,6 @@ export class FloatingModal extends Modal {
this.ownerDocument.removeEventListener("touchcancel", this.pointerUpHandler);
}
private handleEscKey(e: KeyboardEvent) {
if (e.key === "Escape") {
e.stopPropagation();
this.close();
}
}
open(): void {
super.open();
this.ownerDocument = this.modalEl.ownerDocument ?? document;
@@ -195,20 +187,17 @@ export class FloatingModal extends Modal {
if (this.disableKeyCapture) {
this.previousActive = this.ownerDocument.activeElement as HTMLElement | null;
try {
// @ts-ignore pop modal's key scope so keys are not intercepted
// Release modal scope so focus and key handling can return to the workspace.
// @ts-ignore
this.app.keymap.popScope(this.scope);
} catch {}
try {
// @ts-ignore prevent automatic selection / focus restoration
this.shouldRestoreSelection = false;
} catch {}
// prevent automatic selection / focus restoration
this.shouldRestoreSelection = false;
}
setTimeout(() => {
//@ts-ignore
const { containerEl, modalEl, bgEl, headerEl } = this;
containerEl.style.pointerEvents = "none";
if (bgEl) bgEl.style.display = "none";
if (headerEl) headerEl.style.pointerEvents = "none";
// @ts-ignore
const { containerEl, modalEl, bgEl } = this;
containerEl.addClass("mod-excalidraw-draggable")
// Set initial position and make modal draggable
if (modalEl) {
@@ -224,9 +213,6 @@ export class FloatingModal extends Modal {
modalEl.style.left = `${centerX}px`;
modalEl.style.top = `${centerY}px`;
modalEl.style.transform = "none";
const modalStyle = this.ownerWindow.getComputedStyle(modalEl);
modalEl.style.borderBottomLeftRadius = modalStyle.borderTopLeftRadius;
modalEl.style.borderBottomRightRadius = modalStyle.borderTopRightRadius;
// Add event listeners for both pointer and touch events
modalEl.addEventListener("pointerdown", this.pointerDownHandler as (e: PointerEvent) => void);
@@ -237,6 +223,12 @@ export class FloatingModal extends Modal {
if (this.disableKeyCapture) {
// Prevent the modal from stealing focus
modalEl.setAttr("tabindex", "-1");
// In order to propagate keypresses, modal container and backdrop
// need to ignore (and thus propagate) any pointerEvents.
containerEl.style.pointerEvents = "none";
if (bgEl) bgEl.style.pointerEvents = "none";
// Refocus previous element (if still in DOM)
if (this.previousActive?.isConnected) {
this.previousActive.focus({ preventScroll: true });
@@ -244,8 +236,6 @@ export class FloatingModal extends Modal {
// Stop key events originating inside the modal from bubbling back
modalEl.addEventListener("keydown", this.modalKeydownStopHandler, { capture: true });
}
// Add ESC listener (capture to run before underlying workspace)
this.ownerDocument.addEventListener("keydown", this.escListener, { capture: true });
// NEW: re-enable pointer events on the close button so it is tappable on mobile
const closeBtn = containerEl.querySelector(".modal-close-button");
@@ -271,7 +261,6 @@ export class FloatingModal extends Modal {
}
// Remove any remaining document event listeners
this.handlePointerUp();
this.ownerDocument.removeEventListener("keydown", this.escListener, { capture: true });
super.close();
}
+79 -28
View File
@@ -20,6 +20,7 @@ export class InsertPDFModal extends Modal {
private lockAfterImport: boolean = true;
private pagesToImport:number[] = [];
private pageDimensions: {width: number, height: number} = {width: 0, height: 0};
private pageDimensionsByPage: Map<number, {width: number; height: number}> = new Map();
private importScale = 0.3;
private imageSizeMessage: HTMLElement;
private pdfDoc: any;
@@ -63,6 +64,7 @@ export class InsertPDFModal extends Modal {
this.pdfDoc.destroy();
this.pdfDoc = null;
}
this.pageDimensionsByPage.clear();
this.plugin = null;
this.view = null;
this.app = null;
@@ -70,23 +72,44 @@ export class InsertPDFModal extends Modal {
this.setImageSizeMessage = null;
}
private async getPDFPageDimensions (pdfDoc: any) {
try {
const scale = this.plugin.settings.pdfScale;
const canvas = createEl("canvas");
const page = await pdfDoc.getPage(1);
// Set scale
const viewport = page.getViewport({ scale });
this.pageDimensions.height = viewport.height;
this.pageDimensions.width = viewport.width;
//https://github.com/excalidraw/excalidraw/issues/4036
canvas.width = 0;
canvas.height = 0;
this.setImageSizeMessage();
} catch(e) {
console.log(e);
private async loadPageDimensions(pages?: number[]) {
if(!this.pdfDoc) return;
const scale = this.plugin.settings.pdfScale;
const pagesToLoad = pages && pages.length > 0 ? [...new Set(pages)] : [1];
for (const pageNum of pagesToLoad) {
if(this.pageDimensionsByPage.has(pageNum)) continue;
try {
const page = await this.pdfDoc.getPage(pageNum);
const viewport = page.getViewport({ scale });
this.pageDimensionsByPage.set(pageNum, { width: viewport.width, height: viewport.height });
} catch(e) {
console.log(e);
}
}
this.pageDimensions = this.getMaxSelectedPageDimensions();
this.setImageSizeMessage();
}
private getMaxSelectedPageDimensions() {
let width = 0;
let height = 0;
const pages = this.pagesToImport.length > 0
? this.pagesToImport
: Array.from(this.pageDimensionsByPage.keys());
pages.forEach((p) => {
const dims = this.pageDimensionsByPage.get(p);
if(!dims) return;
width = Math.max(width, dims.width);
height = Math.max(height, dims.height);
});
if(width === 0 || height === 0) {
const first = this.pageDimensionsByPage.values().next().value;
if(first) {
width = first.width;
height = first.height;
}
}
return { width, height };
}
@@ -118,7 +141,11 @@ export class InsertPDFModal extends Modal {
return this.pagesToImport;
}
private setImageSizeMessage = () => this.imageSizeMessage.innerText = `${Math.round(this.pageDimensions.width*this.importScale)} x ${Math.round(this.pageDimensions.height*this.importScale)}`;
private setImageSizeMessage = () => {
if(!this.imageSizeMessage) return;
const dims = this.getMaxSelectedPageDimensions();
this.imageSizeMessage.innerText = `${Math.round(dims.width*this.importScale)} x ${Math.round(dims.height*this.importScale)}`;
};
async createForm() {
await this.plugin.loadSettings();
@@ -136,7 +163,7 @@ export class InsertPDFModal extends Modal {
let numPagesMessage: HTMLParagraphElement;
let numPages: number;
let numPages: number = 0;
let importButton: ButtonComponent;
let importMessage: HTMLElement;
@@ -174,8 +201,15 @@ export class InsertPDFModal extends Modal {
let pageRangesTextComponent: TextComponent
let importPagesMessage: HTMLParagraphElement;
const rangeOnChange = (value:string) => {
const rangeOnChange = async (value:string) => {
const pages = this.createPageListFromString(value);
if(this.pdfDoc && pages.length > 0) {
await this.loadPageDimensions(pages);
} else {
this.pageDimensionsByPage.clear();
this.pageDimensions = {width: 0, height: 0};
this.setImageSizeMessage();
}
if(pages.length > 15) {
importPagesMessage.innerHTML = `You are importing <b>${pages.length}</b> pages. ⚠️ This may take a while. ⚠️`;
} else {
@@ -187,6 +221,10 @@ export class InsertPDFModal extends Modal {
const setFile = async (file: TFile) => {
if(this.pdfDoc) await this.pdfDoc.destroy();
this.pdfDoc = null;
this.pageDimensionsByPage.clear();
this.pageDimensions = {width: 0, height: 0};
numPages = 0;
this.setImageSizeMessage();
if(file) {
this.pdfDoc = await getPDFDoc(file);
@@ -194,14 +232,16 @@ export class InsertPDFModal extends Modal {
if(this.pdfDoc) {
numPages = this.pdfDoc.numPages;
pageRangesTextComponent.setValue(`1-${numPages}`);
rangeOnChange(`1-${numPages}`);
await rangeOnChange(`1-${numPages}`);
importButtonMessages();
numPagesMessages();
this.getPDFPageDimensions(this.pdfDoc);
} else {
importButton.setDisabled(true);
}
}
} else {
importButtonMessages();
numPagesMessages();
}
}
const search = new TextComponent(ce);
@@ -225,7 +265,7 @@ export class InsertPDFModal extends Modal {
pageRangesTextComponent = text;
text
.setValue("")
.onChange((value) => rangeOnChange(value))
.onChange(async (value) => { await rangeOnChange(value); })
text.inputEl.style.width = "100%";
})
importPagesMessage = ce.createEl("p", {text: ""});
@@ -382,9 +422,10 @@ export class InsertPDFModal extends Modal {
el.innerText = ` ${this.gapSize.toString()}`;
});
const initialDims = this.getMaxSelectedPageDimensions();
const importSizeSetting = new Setting(ce)
.setName("Imported page size")
.setDesc(`${this.pageDimensions.width*this.importScale} x ${this.pageDimensions.height*this.importScale}`)
.setDesc(`${Math.round(initialDims.width*this.importScale)} x ${Math.round(initialDims.height*this.importScale)}`)
.addSlider(slider => slider
.setLimits(0.1, 1.5, 0.1)
.setValue(this.importScale)
@@ -395,6 +436,7 @@ export class InsertPDFModal extends Modal {
}))
this.imageSizeMessage = importSizeSetting.descEl;
this.setImageSizeMessage();
const actionButton = new Setting(ce)
.setDesc("Select a document first")
@@ -406,13 +448,22 @@ export class InsertPDFModal extends Modal {
const ea = getEA(this.view) as ExcalidrawAutomate;
let column = 0;
let row = 0;
const imgWidth = Math.round(this.pageDimensions.width*this.importScale);
const imgHeight = Math.round(this.pageDimensions.height*this.importScale);
await this.loadPageDimensions(this.pagesToImport);
const maxPageDimensions = this.getMaxSelectedPageDimensions();
const cellWidth = Math.round(maxPageDimensions.width*this.importScale);
const cellHeight = Math.round(maxPageDimensions.height*this.importScale);
if(cellWidth === 0 || cellHeight === 0) {
importMessage.innerText = t("IPM_SELECT_PAGES_TO_IMPORT");
return;
}
for(let i = 0; i < this.pagesToImport.length; i++) {
const page = this.pagesToImport[i];
importMessage.innerText = `Importing page ${page} (${i+1} of ${this.pagesToImport.length})`;
const topX = Math.round(this.pageDimensions.width*this.importScale*column + this.gapSize*column);
const topY = Math.round(this.pageDimensions.height*this.importScale*row + this.gapSize*row);
const dims = this.pageDimensionsByPage.get(page) ?? maxPageDimensions;
const imgWidth = Math.round(dims.width*this.importScale);
const imgHeight = Math.round(dims.height*this.importScale);
const topX = Math.round(cellWidth*column + this.gapSize*column);
const topY = Math.round(cellHeight*row + this.gapSize*row);
ea.style.strokeColor = this.borderBox ? "#000000" : "transparent";
const boxID = ea.addRect(
+181
View File
@@ -16,6 +16,187 @@ export const RELEASE_NOTES: { [k: string]: string } = {
I build this plugin in my free time, as a labor of love. Curious about the philosophy behind it? Check out [📕 Sketch Your Mind](https://sketch-your-mind.com). If you find it valuable, say THANK YOU or…
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
`,
"2.21.0":`
## Fixed
- Sizing of embedded images in Markdown when image type is set to SVG. [#2685](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2685)
- Fixed Enter, Up/Down arrows, and TAB keys stop working in text element after deleting the \`#\` character [#2704](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2704)
## New
- LaTeX editor is now floating [#2684](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2684) 🙏[@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
- Inline link suggester now supports triggers \`![[drawing#^frame=\` and \`![[drawing#^clippedframe=\`, thus it is easy to reference frames like slides or parts of images in your different drawings.
- Support for mermaid Entity Relationship Diagrams, new ERD/cardinality arrowheads [#10940](https://github.com/excalidraw/excalidraw/pull/10940)
- New Context Menu options to disable arrow binding and midpoint snapping. [#10906](https://github.com/excalidraw/excalidraw/pull/10906)
- Icons aligned with Obsidian style [#2703](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2703) 🙏[@heinrich26](https://github.com/heinrich26)
`,
"2.20.6":`
<div class="excalidraw-videoWrapper">
<a href="https://www.youtube.com/watch?v=g-BiyQ7TJTM" target="_blank"><img src ="https://i.ytimg.com/vi/g-BiyQ7TJTM/maxresdefault.jpg" style="width:100%;"></a>
</div>
## New
- Inline suggester now supports searching for tags in addition to files. Trigger with "#".
- In Mindmap Builder
- Added Up-Facing, Down-Facing, and Up-Down maps
- Added submaps. You can now promote any node to be a new mindmap root (a sub-map). Sub-maps can have different layout settings such as different growth strategies, different colors, etc.
- Added experimental MindMap Builder API, accessible via \`window.MindMapBuilderAPI\`. See [MindMap Builder API documentation](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/docs/ea-script-docs/MindMapBuilderAPI.md) for more. Essentially, the API allows mindmaps to be created using the Obsidian CLI.
## New from Excalidraw.com
- Allow clicking on links and embeds with laser tool [#10797](https://github.com/excalidraw/excalidraw/pull/10797)
- Improved paste text to diagram with more options and support for more data [#10824](https://github.com/excalidraw/excalidraw/pull/10824)
try copy/pasting this into Excalidraw:
\`\`\`
skill, junior, medior, senior
business_analysis, 2, 6, 9
business_writing, 3, 7, 9
stakeholder_mgmt, 1, 6, 10
\`\`\`
## New in ExcalidrawAutomate
- Added \`skipScriptRestore(scriptName?: string): boolean\` function to the API. This allows scripts to queue a one-time skip marker so sidepanel persisted restoration will not re-run the script. Intended for startup race conditions where a script is started from the Command Palette/hotkey before the sidepanel has opened. If scriptName is omitted, the function uses ea.activeScript.
## Fixed
- Significant performance improvement of MindMap Builder and all other scripts modifying elements in large scenes containing thousands of elements.
- Multiple arrow related updates and fixes from Excalidraw.com [#10832](https://github.com/excalidraw/excalidraw/pull/10832) [#10831](https://github.com/excalidraw/excalidraw/pull/10831) [#10816](https://github.com/excalidraw/excalidraw/pull/10816)
- Hide MindMap Builder and other floating tools when creating a screenshot
`,
"2.20.5":`
## Fixed
- Obsidian Mobile: The floating navigation bar got stuck at the bottom after closing Excalidraw or switching to a markdown note. [#2673](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2673)
- "Toggle UI Mode" now includes a preference setting for Obsidian Phone as well. You can now set different default layouts for phone, tablet, and desktop. [#2670](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2670)
## New
- Added "Toggle Full Screen" button to toolbar right next to the "Obsidian menu", and the "Insert Any File" button.
`,
"2.20.4":`
## Fixed
- Fix NativeSVG embed mode into Markdown documents, ahead of the Obsidian 1.12.1 release. [#2665](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2665)
- Color picker once again supports 8-digit hex codes (Hex color string with an opacity). [#10772](https://github.com/excalidraw/excalidraw/issues/10772)
- Fixed regression that removed LaTeX scaling. [#2668](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2668) 🙏[@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
- Corrected malformed frame embeds when using marker frames.
- Context menu options **“Do not invert image(s) in dark mode”** and **“Invert image(s) in dark mode”** now properly cascade when drawings are nested as images inside other drawings.
- Improved performance of the [MindMap Builder script](https://visual-thinking-workshop.com/mindmap).
## New
- [Deconstruct Selected Elements script](https://youtu.be/HRtaaD34Zzg) now includes a folder selection option, allowing you to choose the destination folder for the generated image.
- Arrow binding midpoints. When the projected point is close to center, snap it to the exact center. This way it's easier to create neat(er) simple arrow connections. [#10611](https://github.com/excalidraw/excalidraw/pull/10611)
`,
"2.20.3":`
## Fixed
- Hover preview when hovering an element with a link in the scene was unreliable
- If a text element had a link in the text body, in some situations, the link became unresponsive to clicks. [#2660](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2660)
## New
- Added default keymap to latex editor [#2655](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2655) 🙏[superle3](https://github.com/superle3)
`,
"2.20.2":`
## New from Excalidraw.com
- Arrow focus indicator [#10613](https://github.com/excalidraw/excalidraw/pull/10613)
## Fixed
- Experimental file type display now also works in Obsidian Mobile. (Reported on Discord)
- Text to Mermaid stores chat history locally (i.e. not synchronized between devices).
- Image positioning in crop editor [#2589](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2589), [#10726](https://github.com/excalidraw/excalidraw/pull/10726)
## MindMap Builder
- Implemented better undo support (effective only for the very last MindMap Builder action). Additionally, CMD/CTRL+Z and CTRL+Y, CMD+SHIFT+Z now work when the MindMap input window is focused.
- Fixed: Double character input issue (IME Composition Error) when creating nodes [#2647](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2647)
- Fixed: More robust error handling when the MindMap is corrupted or invalid.
- Updated Excalidraw Writing Machine to support document generation from MindMaps. Writing Machine will honor the branch order. Requires update of the Writing Machine Script.
## New in ExcalidrawAutomate
- \`getBoundTextElement()\` now also accepts an \`ExcalidrawElement[]\` (2-element selection: container + text) in addition to a single element.
- \`addElementsToView()\` extended with \`captureUpdate\` parameter (default: "IMMEDIATELY"). When set to false, the addition of elements will not be recorded in the view's history.
\`\`\`ts
async addElementsToView(
repositionToCursor: boolean = false,
save: boolean = true,
newElementsOnTop: boolean = false,
shouldRestoreElements: boolean = false,
captureUpdate: CaptureUpdateActionType = CaptureUpdateAction.IMMEDIATELY,
): Promise<boolean>
\`\`\`
`,
"2.20.1":`
## Fixed
- Fixed Experimental file type display, available under miscellaneous settings. (Reported on Discord)
- Fixed image inversion in dark mode on iOS devices. [#2636](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2636)
- Fixed UI Mode switching on tablets was unreliable.
## New/Fixed in MindMap Builder
- **Connector Ontology**: Added support for labeling connection lines. A secondary input field (accessible via Shift+Tab) is now available in both docked and floating modes. Labels are preserved during copy/paste operations using inline Dataview syntax (e.g., link ontology:: node content).
- **Connector Styling**: Introduced configuration settings for branch thickness and scaling strategies, allowing a choice between Hierarchical (tapering width by depth) or Uniform connector widths.
- **Smart Resume**: The Focus and Zoom actions now target the most recently active node if no current selection is made. This automatically focuses the input field, allowing you to quickly resume mapping from where you left off.
- **Radial Fill Sweep**: Added a "Fill Sweep Angle" option for Radial layouts. When enabled, nodes are distributed evenly across the full configured arc range, even when there are only a few nodes. (Visible only when Growth Strategy is set to "Radial").
- **Radial Navigation**: Updated Level 1 node navigation in Radial maps to follow visual vertical alignment instead of rotational order. Up/Down keys now consistently move the selection visually up or down on both sides of the circle, matching the behavior of Right-Left layouts.
- **Fixed**:
- Sidepanel opens on activation of MindMap Builder even in floating mode. Requires update of both Excalidraw and the MindMap Builder script.
- **Node Reordering**: Overhauled the logic for moving nodes via CMD/CTRL+Arrow to resolve unpredictability; nodes now move consistently to the intended locations.
- **iOS Navigation**: Resolved an issue where using the Tab key to cycle focus between components in the floating input window did not work reliably on iOS.
- **Boundary Layering**: Fixed an issue where sub-branch boundaries were placed above text elements when pasting a map; they now correctly render on the layer below the text.
- **Layout Stability**: Fixed an issue where the viewport would shift unexpectedly when pasting multiple elements onto an existing node in large scenes.
> [!Tip]- Learn MindMap Builder
> Learn it fast with the low-cost [MindMap Builder course](https://visual-thinking-workshop.com/mindmap). Register before **31 Jan** to join a live Q&A:
> - Sat Jan 31 @ 18:00 CET ([local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=MindMap+Builder+Launch+Party&iso=20260131T17&p1=%3A&ah=1))
> - Sun Feb 1 @ 09:00 CET ([local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=MindMap+Builder+Launch+Party&iso=20260201T08&p1=%3A&ah=1))
`,
"2.20.0":`
<div class="excalidraw-videoWrapper">
<a href="https://www.youtube.com/watch?v=5G9QF-u9w0Q" target="_blank"><img src ="https://i.ytimg.com/vi/5G9QF-u9w0Q/maxresdefault.jpg" style="width:100%;"></a>
</div>
> [!Tip]- Learn MindMap Builder
> Learn it fast with the low-cost [MindMap Builder course](https://visual-thinking-workshop.com/mindmap). Register before **31 Jan** to join a live Q&A:
> - Sat Jan 31 @ 18:00 CET ([local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=MindMap+Builder+Launch+Party&iso=20260131T17&p1=%3A&ah=1))
> - Sun Feb 1 @ 09:00 CET ([local time](https://www.timeanddate.com/worldclock/fixedtime.html?msg=MindMap+Builder+Launch+Party&iso=20260201T08&p1=%3A&ah=1))
## Scripts
- Moved [Shade Master](https://youtu.be/ISuORbVKyhQ) to use the new Excalidraw Sidepanel API (just like MindMap Builder).
## New
- Dark theme from Excalidraw.com [#10578](https://github.com/excalidraw/excalidraw/pull/10578) (including correct emoji rendering in dark mode 😍).
- New image context-menu option (right-click an image) to control whether that image inverts in dark mode
- Default behavior: SVG-based images (including LaTeX, Mermaid, and nested Excalidraw images) invert in dark mode; bitmap images (PNG/JPG) do not.
- New from Excalidraw.com: chat-style interface for Mermaid TextToDiagrams (requires an OpenAI API key configured in Excalidraw plugin settings). [#10530](https://github.com/excalidraw/excalidraw/pull/10530)
- Breaking change: the legacy “force SVG” option for Mermaid diagrams is no longer supported. If a diagram can be rendered as Excalidraw, it will be; otherwise, an SVG will be used.
- Moved the Shade Master script to use the new Sidepanel (just like MindMap Builder).
## Fixed
- In full-screen mode on phones, a large area at the top of the screen was left unused. Also fixed an issue where the Obsidian Mobile navigation bar could overlap the Excalidraw toolbar.
- The link indicator in the top-right corner would remain visible even when an element was set to transparent [#2625](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2625)
- Importing PDFs with mixed page sizes could produce distorted pages [#2578](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2578)
- Some PDFs failed to load when importing PDFs as images (notably documents using JPEG2000-compressed images). Also improved handling of certain color profiles and cases where text rendered with missing/incorrect glyphs.
- A long-standing export issue: when exporting in a theme different from the current view (e.g., viewing in dark mode but exporting in light mode), nested Excalidraw images containing bitmap images could export with inverted colors.
`,
"2.19.2":`
## Fixed
- Minor fixes to the link autocomplete functionality:
- Link suggester "eats up text" [#2603](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2603)
- "!" triggers the link suggester prematurely
- "\[\[" will now be auto-completed to "\[\[]]". Note, this is not available in MindMap Builder currently.
## New
- When a persistent Excalidraw script is updated via the script store, it will now automatically reload so the new script takes effect immediately.
`,
"2.19.1":`
## Fixed
- Excalidraw pointer offset issue on Obsidian Mobile 1.11.4 [#2607](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2607)
## New
- Inline autocomplete link suggester now supports Heading sections and block references.
- Escaped "\\\\[" will now be rendered as "[" in text elements.
- Scaling the LaTeX element when the formula is updated. [#2604](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2604) 🙏[@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
## New in ExcalidrawAutomate
- Added PDF++ image link support to the \`addImage()\` function.
`,
"2.19.0":`
<div class="excalidraw-videoWrapper">
+40 -34
View File
@@ -7,8 +7,7 @@ import {
Instruction,
TFile,
Notice,
TextAreaComponent,
getIcon,
TextAreaComponent
} from "obsidian";
import ExcalidrawView from "../../view/ExcalidrawView";
import ExcalidrawPlugin from "../../core/main";
@@ -25,10 +24,12 @@ import { ScriptEngine } from "../Scripts";
import { openExternalLink, openTagSearch, parseObsidianLink } from "src/utils/excalidrawViewUtils";
import { ButtonDefinition } from "src/types/promptTypes";
import { EditorView, keymap } from "@codemirror/view";
import { history } from "@codemirror/commands";
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
import { parser } from "./math-only";
import { LRLanguage } from "@codemirror/language";
import { editorLivePreviewField } from "obsidian";
import { Extension } from "@codemirror/state";
import { FloatingModal } from "./FloatingModal";
export class Prompt extends Modal {
private promptEl: HTMLInputElement;
@@ -85,13 +86,13 @@ export class Prompt extends Modal {
}
}
export class LaTexPrompt extends Modal {
export class LaTexPrompt extends FloatingModal {
public waitForClose : Promise<string>;
private promptEl: HTMLInputElement;
private resolvePromise: (input: string) => void;
private rejectPromise: (reason?: any) => void;
private editorView : EditorView;
private latexsSuitePlugin : any;
private readonly latexsSuitePlugin : any;
protected constructor(
app: App,
@@ -102,6 +103,7 @@ export class LaTexPrompt extends Modal {
this.titleEl.setText(this.prompt_text);
this.contentEl.addClass("excalidraw-LatexPrompt");
this.latexsSuitePlugin = app.plugins.plugins["obsidian-latex-suite"];
super.enableKeyCapture(); // otherwise latex-suite (or Ctrl-Enter) do not get the key event
const mainContentContainer: HTMLDivElement = this.contentEl.createDiv();
this.display(default_value, mainContentContainer);
this.waitForClose = new Promise<string>((resolve, reject) => {
@@ -111,52 +113,56 @@ export class LaTexPrompt extends Modal {
this.editorView.focus();
}
protected shouldNotStartDrag(target: HTMLElement, event: PointerEvent | TouchEvent): boolean {
return target.closest(".cm-editor") != null || super.shouldNotStartDrag(target, event);
}
public static Prompt(app: App,
prompt_text?: string,
default_value?: string,
): Promise<string>{
const latexprompt = new LaTexPrompt(app, prompt_text, default_value);
const latexprompt = new this(app, prompt_text, default_value);
return latexprompt.waitForClose;
}
private display(value : string, container : HTMLDivElement) {
const minimalSetup = [
history(),
keymap.of([
...defaultKeymap,
...historyKeymap,
])
]
const extensions: Extension[] = [
// overriding default "Mod-Enter" from defaultKeymap (so first in array)
keymap.of([{
key:"Mod-Enter",
run : () => {this.submitCallback(); return true;}
}]),
// obsidian class to inherit styling
EditorView.editorAttributes.of({class: "multi-select-container"}),
minimalSetup
]
if (this.latexsSuitePlugin) {
// the language put eveything in a "math" node
// surrounded by "math-begin" and "math-end"
// so that latex-suite always thinks we are in mathmode
const language = LRLanguage.define({parser:parser});
const extensions = [
extensions.push([
language,
keymap.of([{
key:"Mod-Enter",
run : () => {this.submitCallback(); return true;}
}]),
history(),
editorLivePreviewField.init(() => false),
... this.latexsSuitePlugin.editorExtensions
];
this.editorView = new EditorView({
doc: value,
parent : container,
extensions : extensions,
});
} else {
const extensions = [
keymap.of([{
key:"Mod-Enter",
run : () => {this.submitCallback(); return true;}
}]),
history(),
];
this.editorView = new EditorView({
doc: value,
extensions : extensions,
parent : container,
});
this.latexsSuitePlugin.editorExtensions
]);
}
this.editorView = new EditorView({
doc: value,
extensions : extensions,
parent : container,
});
const buttonBarContainer: HTMLDivElement = container.createDiv();
buttonBarContainer.addClass(`excalidraw-prompt-buttonbar-bottom`);
const actionButtonContainer: HTMLDivElement = buttonBarContainer.createDiv();
@@ -1243,4 +1249,4 @@ export const templatePromt = async (files: TFile[], app: App): Promise<TFile> =>
undefined,
t("PROMPT_SELECT_TEMPLATE")
))??[null, null, null])[0];
}
}
+23 -9
View File
@@ -208,6 +208,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
"getBoundTextElement(element: ExcalidrawElement, searchInView?: boolean): { eaElement?: Mutable<ExcalidrawTextElement>; sceneElement?: ExcalidrawTextElement; };",
desc:
"Returns an object describing the bound text element.\n" +
"@param element: ExcalidrawElement | ExcalidrawElement[] - The selected container with text (an array of 2 elements) to check.\n" +
"If a text element is provided:\n" +
" - returns { eaElement } if the element is in ea.elementsDict\n" +
" - else (if searchInView is true) returns { sceneElement } if found in the targetView scene\n" +
@@ -417,11 +418,11 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
{
field: "addImage",
code: "async addImage(opts: {topX: number, topY: number, imageFile: TFile|string, scale?: boolean, anchor?: boolean, colorMap?: ColorMap}): Promise<string>;",
desc: "imageFile may be a TFile or a string that contains a hyperlink.\n"+
"imageFile may also be an obsidian filepath including a reference eg.: 'path/my.pdf#page=3'\n"+
"Set scale to false if you want to embed the image at 100% of its original size. Default is true which will insert a scaled image.\n"+
"anchor will only be evaluated if scale is false. anchor true will add |100% to the end of the filename, resulting in an image that will always pop back to 100% when the source file is updated or when the Excalidraw file is reopened.\n"+
"colorMap is only used for SVG images and nested Excalidraw images. See the Shade Master script and the Deconstruct Selected Elements script for examples using colorMap.\n"+
desc: "imageFile may be a TFile or a string that contains a hyperlink.\n" +
"imageFile may also be an obsidian filepath including a reference eg.: 'path/my.pdf#page=3'\n" +
"Set scale to false if you want to embed the image at 100% of its original size. Default is true which will insert a scaled image.\n" +
"anchor will only be evaluated if scale is false. anchor true will add |100% to the end of the filename, resulting in an image that will always pop back to 100% when the source file is updated or when the Excalidraw file is reopened.\n" +
"colorMap is only used for SVG images and nested Excalidraw images. See the Shade Master script and the Deconstruct Selected Elements script for examples using colorMap.\n" +
"type ColorMap = { [color: string]: string; }",
after: "",
},
@@ -561,7 +562,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
desc: 'Updates the color map of an SVG image element in the view. If a ColorMap is provided, it will be used directly. If an SVGColorInfo is provided, it will be converted to a ColorMap. The view will be marked as dirty (i.e. will be saved at next scheduled time) and the image will be reset using the color map.\n'+
'See "Shade Master" scritp in Script Library for an example of using this function.\n\n' +
'type SVGColorInfo = Map<string, { mappedTo: string; fill: boolean; stroke: boolean; }>\n' +
'type ColorMap = { [color: string]: string; }',
'type ColorMap = { [color: string]: string; invertInDarkMode?: boolean; }',
after: "",
},
{
@@ -569,7 +570,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
code: "getColorMapForImageElement(el: ExcalidrawElement): ColorMap",
desc: 'Retrieves the color map for an image element. The color map contains information about the mapping of colors used in the image. If the element already has a color map, it will be returned. The colorMap does not include all colors in the image, only those that have been mapped.\n' +
'See "Shade Master" scritp in Script Library for an example of using this function.\n\n' +
'type ColorMap = { [color: string]: string; }',
'type ColorMap = { [color: string]: string; invertInDarkMode?: boolean; }',
after: "",
},
{
@@ -616,8 +617,12 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
},
{
field: "addElementsToView",
code: "async addElementsToView(repositionToCursor?: boolean, save?: boolean, newElementsOnTop?: boolean,shouldRestoreElements?: boolean,): Promise<boolean>;",
desc: "Adds elements from elementsDict to the current view\nrepositionToCursor: default is false\nsave: default is true\nnewElementsOnTop: default is false, i.e. the new elements get to the bottom of the stack\nnewElementsOnTop controls whether elements created with ExcalidrawAutomate are added at the bottom of the stack or the top of the stack of elements already in the view\nNote that elements copied to the view with copyViewElementsToEAforEditing retain their position in the stack of elements in the view even if modified using EA",
code: "async addElementsToView(repositionToCursor?: boolean, save?: boolean, newElementsOnTop?: boolean,shouldRestoreElements?: boolean,captureUpdate?: CaptureUpdateActionType): Promise<boolean>;",
desc: "Adds elements from elementsDict to the current view\nrepositionToCursor: default is false\n" +
"save: default is true\n" +
"newElementsOnTop: default is false, i.e. the new elements get to the bottom of the stack\n" +
"newElementsOnTop controls whether elements created with ExcalidrawAutomate are added at the bottom of the stack or the top of the stack of elements already in the view\nNote that elements copied to the view with copyViewElementsToEAforEditing retain their position in the stack of elements in the view even if modified using EA\n" +
"captureUpdate controls undo/redo capture: 'IMMEDIATELY' records immediately (use for local updates), 'NEVER' skips undo tracking (remote/init changes), and 'EVENTUALLY' defers capture as part of multi-step async flows.",
after: "",
},
{
@@ -950,6 +955,15 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
desc: "Returns the WorkspaceLeaf hosting the Excalidraw sidepanel view, or null if the sidepanel is not present.",
after: "();"
},
{
field: "skipSidepanelScriptRestore",
code: "skipSidepanelScriptRestore(scriptName?: string): boolean;",
desc: "Queues a one-time skip marker so sidepanel persisted restoration will not re-run the script. " +
"Intended for startup race conditions where a script is started from Command Palette/hotkey before the sidepanel has opened. " +
"If scriptName is omitted the function uses ea.activeScript. " +
"The marker is queued only when getSidepanelLeaf() is null; returns true when queued, otherwise false.",
after: "();"
},
{
field: "toggleSidepanelView",
code: "toggleSidepanelView(): void;",
+37 -2
View File
@@ -4,9 +4,8 @@ import { ExcalidrawSettings } from "src/core/settings";
import { fragWithHTML, setLeftHandedMode, setUIMode } from "src/utils/utils";
import { DEVICE } from "src/constants/constants";
export type UIMode = "full" | "compact" | "tray" | "phone";
export type UIMode = "full" | "compact" | "tray" | "mobile";
//setTrayMode(this.app, this.plugin.settings);
//setDesktopUIMode(this.app, this.plugin.settings);
@@ -15,17 +14,20 @@ export class UIModeSettingsComponent {
private settings: ExcalidrawSettings;
private app: App;
private onChange: () => void;
private reapplyButtonAction: ()=>void = null;
constructor(
containerEl: HTMLElement,
settings: ExcalidrawSettings,
app: App,
onChange: () => void,
reapplyButtonAction: ()=>void = null,
) {
this.containerEl = containerEl;
this.settings = settings;
this.app = app;
this.onChange = onChange;
this.reapplyButtonAction = reapplyButtonAction;
}
render(): void {
@@ -54,6 +56,7 @@ export class UIModeSettingsComponent {
.setDesc(t("TABLET_UI_MODE_DESC"))
.addDropdown((dropdown: DropdownComponent) =>
dropdown
.addOption("full", t("MODE_FULL"))
.addOption("compact", t("MODE_COMPACT"))
.addOption("tray", t("MODE_TRAY"))
.setValue(this.settings.tabletUIMode)
@@ -66,6 +69,25 @@ export class UIModeSettingsComponent {
}),
);
new Setting(containerEl)
.setName(t("PHONE_UI_MODE_NAME"))
.setDesc(t("PHONE_UI_MODE_DESC"))
.addDropdown((dropdown: DropdownComponent) =>
dropdown
.addOption("full", t("MODE_FULL"))
.addOption("compact", t("MODE_COMPACT"))
.addOption("tray", t("MODE_TRAY"))
.addOption("mobile", t("MODE_PHONE"))
.setValue(this.settings.phoneUIMode ?? "mobile")
.onChange((value: UIMode) => {
this.settings.phoneUIMode = value;
if (DEVICE.isPhone) {
setUIMode(this.app, this.settings);
}
this.onChange();
}),
);
new Setting(containerEl)
.setName(t("LEFTHANDED_MODE_NAME"))
.setDesc(fragWithHTML(t("LEFTHANDED_MODE_DESC")))
@@ -82,5 +104,18 @@ export class UIModeSettingsComponent {
}),
);
if (this.reapplyButtonAction) {
new Setting(containerEl)
.addButton((button) =>
button
.setButtonText(t("REAPPLY_UI_MODE_BUTTON"))
.setCta()
.onClick(() => {
setUIMode(this.app, this.settings);
this.reapplyButtonAction();
}),
);
}
}
}
+1 -1
View File
@@ -1,7 +1,6 @@
import ExcalidrawPlugin from "src/core/main";
import { t } from "src/lang/helpers";
import { UIModeSettingsComponent } from "./UIModeSettingComponent";
import { FloatingModal } from "./FloatingModal";
import { Modal } from "obsidian";
export class UIModeSettings extends Modal {
@@ -31,6 +30,7 @@ export class UIModeSettings extends Modal {
this.plugin.settings,
this.app,
()=>this.applySettingsUpdate(),
()=>this.close(),
).render();
}
+21 -25
View File
@@ -155,7 +155,7 @@ export class EmbeddedFile {
}
get hasSeparateDarkAndLightVersion(): boolean {
return this.isSVGwithBitmap || (this.file && this.file.extension.toLowerCase() === "pdf");
return this.isSVGwithBitmap;
}
public resetImage(hostPath: string, imgPath: string) {
@@ -418,16 +418,33 @@ export class EmbeddedFilesLoader {
);
if (imageList.length > 0) {
hasSVGwithBitmap = true;
}
}
if (hasSVGwithBitmap && isDark && !Boolean(maybeSVG)) {
imageList.forEach((i) => {
const id = i.parentElement?.id;
if (id.endsWith("-invert-bitmap")) return;
svg.querySelectorAll(`use[href='#${id}']`).forEach((u) => {
u.setAttribute("filter", THEME_FILTER);
});
});
}
const svgsToInvert = svg.querySelectorAll("symbol[id$='-no-invert-svg']");
if (svgsToInvert.length > 0) {
hasSVGwithBitmap = true;
}
if (svgsToInvert.length > 0 && isDark && !Boolean(maybeSVG)) {
svgsToInvert.forEach((i) => {
const id = i.id;
svg.querySelectorAll(`use[href='#${id}']`).forEach((u) => {
u.setAttribute("filter", THEME_FILTER);
});
});
}
if (!hasSVGwithBitmap && svg.getAttribute("hasbitmap")) {
hasSVGwithBitmap = true;
}
@@ -670,7 +687,7 @@ export class EmbeddedFilesLoader {
created: data.created,
size: data.size,
hasSVGwithBitmap: false,
shouldScale: true
shouldScale: true,
};
files[batch].push(fileData);
}
@@ -688,8 +705,7 @@ export class EmbeddedFilesLoader {
const data = getMermaidText(element);
const result = await mermaidToExcalidraw(
data,
{ themeVariables: { fontSize: "20" } },
true
{ themeVariables: { fontSize: "20" } }
);
if(!result) {
return;
@@ -890,26 +906,6 @@ export class EmbeddedFilesLoader {
const canvas = await renderPage(pageNum);
if(canvas) {
// NEW: invert colors for dark theme (keep alpha unchanged)
if (this.isDark) {
const ctx = canvas.getContext('2d');
if (ctx) {
try {
const img = ctx.getImageData(0, 0, canvas.width, canvas.height);
const data = img.data;
for (let i = 0; i < data.length; i += 4) {
data[i] = 255 - data[i]; // R
data[i + 1] = 255 - data[i+1]; // G
data[i + 2] = 255 - data[i+2]; // B
// alpha channel (data[i+3]) remains unchanged
}
ctx.putImageData(img, 0, 0);
} catch (e) {
// If reading pixel data fails, silently fallback to non-inverted
}
}
}
const result: [DataURL,Size, PDFPageViewProps] = [`data:image/png;base64,${await new Promise((resolve, reject) => {
canvas.toBlob(async (blob) => {
const dataURL = await blobToBase64(blob);
+90 -19
View File
@@ -32,7 +32,6 @@ import {
DEVICE,
mermaidToExcalidraw,
refreshTextDimensions,
getDefaultColorPalette,
getFontFamilyString,
} from "src/constants/constants";
import { blobToBase64, checkAndCreateFolder, getDrawingFilename, getExcalidrawEmbeddedFilesFiletree, getListOfTemplateFiles, getNewUniqueFilepath, splitFolderAndFilename } from "src/utils/fileUtils";
@@ -98,6 +97,8 @@ import { patchMobileView } from "src/utils/customEmbeddableUtils";
import { ObsidianCanvasNode } from "src/view/managers/CanvasNodeFactory";
import { AIRequest } from "src/types/AIUtilTypes";
import { getAspectRatio } from "src/utils/YoutTubeUtils";
import { getPDFCropRect } from "src/utils/PDFUtils";
import { CaptureUpdateActionType } from "@zsviczian/excalidraw/types/element/src";
extendPlugins([
HarmonyPlugin,
@@ -606,12 +607,15 @@ export class ExcalidrawAutomate {
}
const tab = await spView.createTab({ title, scriptName, hostEA: this });
this.sidepanelTab = tab;
if (reveal) tab.reveal();
if (persist && this.activeScript) {
this.persistSidepanelTab();
}
return tab;
}
/**
* Returns the WorkspaceLeaf hosting the Excalidraw sidepanel view.
* @returns {WorkspaceLeaf | null} The sidepanel leaf or null if not found.
@@ -620,6 +624,27 @@ export class ExcalidrawAutomate {
return ExcalidrawSidepanelView.getExisting(false)?.leaf ?? null;
}
/**
* Queues the script to be skipped once during persisted sidepanel restoration.
* This is useful at startup when a script is launched via Command Palette/hotkey
* before the sidepanel view has opened and run its restoration sequence.
*
* The script is queued only if the sidepanel leaf is not yet available.
* @param scriptName - Optional script name. Defaults to ea.activeScript.
* @returns {boolean} True if a skip marker was queued, false otherwise.
*/
public skipSidepanelScriptRestore(scriptName?: string): boolean {
scriptName = scriptName ?? this.activeScript;
if (!scriptName) {
return false;
}
if (this.getSidepanelLeaf()) {
return false;
}
ExcalidrawSidepanelView.skipScriptRestore(scriptName);
return true;
}
/**
* Toggles the visibility of the Excalidraw sidepanel view.
* If the sidepanel is not in a leaf attached to the left or right split, no action is taken.
@@ -895,6 +920,9 @@ export class ExcalidrawAutomate {
/**
* Returns an object describing the bound text element.
*
* IMPORTANT: The returned object contains EITHER `eaElement` OR `sceneElement`, never both.
*
* If a text element is provided:
* - returns { eaElement } if the element is in ea.elementsDict
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
@@ -903,17 +931,31 @@ export class ExcalidrawAutomate {
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
* If not found, returns {}.
* Does not add the text element to elementsDict.
* @param element
*
* Recommended usage pattern for editing:
* const boundText = ea.getBoundTextElement(container, true);
* let textEl = boundText.eaElement;
* if (!textEl && boundText.sceneElement) {
* ea.copyViewElementsToEAforEditing([boundText.sceneElement]);
* textEl = ea.getElement(boundText.sceneElement.id);
* }
* if (textEl) { ... safely modify textEl ... }
* @param element: ExcalidrawElement | ExcalidrawElement[] - The selected container with text (an array of 2 elements) to check.
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
* @returns Object containing either eaElement or sceneElement or empty if not found.
*/
getBoundTextElement(element: ExcalidrawElement, searchInView: boolean = false): {
getBoundTextElement(element: ExcalidrawElement|ExcalidrawElement[], searchInView: boolean = false): {
eaElement?: Mutable<ExcalidrawTextElement>,
sceneElement?: ExcalidrawTextElement
} {
if (!element) {
return {};
}
if (Array.isArray(element) && element.length === 2) {
element = element[0];
} else if (Array.isArray(element)) {
return {};
}
if(element.type === "text") {
if(element.id in this.elementsDict) {
return {eaElement: element as Mutable<ExcalidrawTextElement>};
@@ -2189,33 +2231,39 @@ export class ExcalidrawAutomate {
colorMap = topXOrOpts.colorMap;
}
const pdfLinkRegex = /^[^#]*#page=\d*(&\w*=[^&]+){0,}&rect=\d*,\d*,\d*,\d*/;
const originalLink = typeof imageFile === "string" ? imageFile : null;
const imageFileForLoader = originalLink && pdfLinkRegex.test(originalLink)
? originalLink.split("&rect=")[0]
: imageFile;
const id = nanoid();
const loader = new EmbeddedFilesLoader(
this.plugin,
this.canvas.theme === "dark",
);
const image = (typeof imageFile === "string")
? await loader.getObsidianImage(new EmbeddedFile(this.plugin, "", imageFile),0)
: await loader.getObsidianImage(imageFile,0);
const image = (typeof imageFileForLoader === "string")
? await loader.getObsidianImage(new EmbeddedFile(this.plugin, "", imageFileForLoader),0)
: await loader.getObsidianImage(imageFileForLoader,0);
if (!image) {
return null;
}
const fileId = typeof imageFile === "string"
const fileId = typeof imageFileForLoader === "string"
? image.fileId
: imageFile.extension === "md" || imageFile.extension.toLowerCase() === "pdf" ? fileid() as FileId : image.fileId;
: imageFileForLoader.extension === "md" || imageFileForLoader.extension.toLowerCase() === "pdf" ? fileid() as FileId : image.fileId;
this.imagesDict[fileId] = {
mimeType: image.mimeType,
id: fileId,
dataURL: image.dataURL,
created: image.created,
isHyperLink: typeof imageFile === "string",
hyperlink: typeof imageFile === "string"
? imageFile
isHyperLink: typeof imageFileForLoader === "string",
hyperlink: typeof imageFileForLoader === "string"
? imageFileForLoader
: null,
file: typeof imageFile === "string"
file: typeof imageFileForLoader === "string"
? null
: imageFile.path + (scale || !anchor ? "":"|100%"),
: imageFileForLoader.path + (scale || !anchor ? "":"|100%"),
hasSVGwithBitmap: image.hasSVGwithBitmap,
latex: null,
size: { //must have the natural size here (e.g. for PDF cropping)
@@ -2243,6 +2291,22 @@ export class ExcalidrawAutomate {
newEl.fileId = fileId;
newEl.scale = [1, 1];
newEl.crop = null;
if(originalLink && pdfLinkRegex.test(originalLink)) {
const fd = this.imagesDict[fileId];
newEl.crop = getPDFCropRect({
scale: this.plugin.settings.pdfScale,
link: originalLink,
naturalHeight: fd.size.height,
naturalWidth: fd.size.width,
pdfPageViewProps: fd.pdfPageViewProps,
});
addAppendUpdateCustomData(newEl, {pdfPageViewProps: fd.pdfPageViewProps});
if(newEl.crop) {
newEl.width = newEl.crop.width/this.plugin.settings.pdfScale;
newEl.height = newEl.crop.height/this.plugin.settings.pdfScale;
}
newEl.link = `[[${originalLink}]]`;
}
if(!scale && anchor) {
newEl.customData = {isAnchored: true}
};
@@ -2254,10 +2318,12 @@ export class ExcalidrawAutomate {
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} tex - The LaTeX equation string.
* @param {number} [scaleX=1] - The x-scaling factor (post mathjax creation)
* @param {number} [scaleY=1] - The y-scaling factor (post mathjax creation)
* @returns {Promise<string>} Promise resolving to the ID of the added LaTeX image element.
*/
async addLaTex(topX: number, topY: number, tex: string): Promise<string> {
if (!tex){
async addLaTex(topX: number, topY: number, tex: string, scaleX: number = 1, scaleY: number = 1): Promise<string> {
if (!tex || !scaleX || !scaleY){
return null;
}
const id = nanoid();
@@ -2279,12 +2345,12 @@ export class ExcalidrawAutomate {
"image",
topX,
topY,
image.size.width,
image.size.height,
image.size.width * Math.abs(scaleX),
image.size.height * Math.abs(scaleY),
);
this.elementsDict[id].fileId = image.fileId;
this.addAppendUpdateCustomData(id, {latex: tex});
this.elementsDict[id].scale = [1, 1];
this.elementsDict[id].scale = [Math.sign(scaleX), Math.sign(scaleY)];
return id;
};
@@ -3078,6 +3144,7 @@ export class ExcalidrawAutomate {
save: boolean = true,
newElementsOnTop: boolean = false,
shouldRestoreElements: boolean = false,
captureUpdate: CaptureUpdateActionType = CaptureUpdateAction.IMMEDIATELY,
): Promise<boolean> {
if (!this.targetView || !this.targetView?._loaded) {
errorMessage("targetView not set", "addElementsToView()");
@@ -3094,6 +3161,7 @@ export class ExcalidrawAutomate {
images: this.imagesDict,
newElementsOnTop,
shouldRestoreElements,
captureUpdate,
});
return result;
};
@@ -3500,7 +3568,9 @@ export class ExcalidrawAutomate {
* @returns {string | null} The groupId or null if not found.
*/
getCommonGroupForElements(elements: ExcalidrawElement[]): string {
const groupId = elements.map(el=>el.groupIds).reduce((prev,cur)=>cur.filter(v=>prev.includes(v)));
const groupId = elements
.map(el=>el.groupIds)
.reduce((prev,cur)=>cur.filter(v=>prev.includes(v)));
return groupId.length > 0 ? groupId[0] : null;
}
@@ -3792,6 +3862,7 @@ export class ExcalidrawAutomate {
/**
* Moves the specified element to a specific position in the z-index.
* * Operates directly on the Excalidraw Scene in targetView, not through ExcalidrawAutomate elements.
* @param {number} elementId - The ID of the element to move.
* @param {number} newZIndex - The new z-index position for the element.
*/
+34 -8
View File
@@ -471,7 +471,7 @@ export const getExcalidrawMarkdownHeaderSection = (data:string, keys?:[string,st
export class ExcalidrawData {
public textElements: Map<
string,
{ raw: string; parsed: string}
{ raw: string; parsed: string; hasTextLink: boolean; }
> = null;
public scene: any = null;
public deletedElements: ExcalidrawElement[] = [];
@@ -709,7 +709,7 @@ export class ExcalidrawData {
this.selectedElementIds = {};
this.textElements = new Map<
string,
{ raw: string; parsed: string}
{ raw: string; parsed: string, hasTextLink: boolean }
>();
this.elementLinks = new Map<string, string>();
if (this.file !== file) {
@@ -939,10 +939,12 @@ export class ExcalidrawData {
this.textElements.set(id, {
raw: text,
parsed: parseRes.parsed,
hasTextLink: !!parseRes.link,
});
if (parseRes.link && this.plugin.settings.syncElementLinkWithText) {
textEl.link = parseRes.link;
}
textEl.hasTextLink = !!parseRes.link;
//this will set the rawText field of text elements imported from files before 1.3.14, and from other instances of Excalidraw
if (textEl && (!textEl.rawText || textEl.rawText === "")) {
textEl.rawText = text;
@@ -1037,7 +1039,7 @@ export class ExcalidrawData {
this.file = file;
this.textElements = new Map<
string,
{ raw: string; parsed: string}
{ raw: string; parsed: string; hasTextLink: boolean }
>();
this.elementLinks = new Map<string, string>();
this.setShowLinkBrackets();
@@ -1112,9 +1114,11 @@ export class ExcalidrawData {
}
if (this.textMode === TextMode.parsed) {
if (!text.parsed) {
const parseRes = await this.parse(text.raw);
this.textElements.set(id, {
raw: text.raw,
parsed: (await this.parse(text.raw)).parsed,
parsed: parseRes.parsed,
hasTextLink: !!parseRes.link,
});
}
//console.log("parsed",this.textElements.get(id).parsed);
@@ -1185,17 +1189,18 @@ export class ExcalidrawData {
this.textElements.set(id, {
raw: text.raw,
parsed: text.parsed,
hasTextLink: text.hasTextLink,
});
this.textElements.delete(te.id); //delete the old ID from the Map
}
if (!this.textElements.has(id)) {
const raw = te.rawText && te.rawText !== "" ? te.rawText : te.text; //this is for compatibility with drawings created before the rawText change on ExcalidrawTextElement
this.textElements.set(id, { raw, parsed: null});
this.textElements.set(id, { raw, parsed: null, hasTextLink: false});
this.parseasync(id, raw);
}
} else if (!this.textElements.has(te.id)) {
const raw = te.rawText && te.rawText !== "" ? te.rawText : te.text; //this is for compatibility with drawings created before the rawText change on ExcalidrawTextElement
this.textElements.set(id, { raw, parsed: null});
this.textElements.set(id, { raw, parsed: null, hasTextLink: false});
this.parseasync(id, raw);
}
@@ -1238,9 +1243,11 @@ export class ExcalidrawData {
? el[0].rawText
: (el[0].originalText ?? el[0].text);
if (text !== (el[0].originalText ?? el[0].text)) {
const parseRes = await this.parse(text);
this.textElements.set(key, {
raw,
parsed: (await this.parse(raw)).parsed,
parsed: parseRes.parsed,
hasTextLink: !!parseRes.link,
});
}
}
@@ -1248,9 +1255,11 @@ export class ExcalidrawData {
}
private async parseasync(key: string, raw: string) {
const parseRes = await this.parse(raw);
this.textElements.set(key, {
raw,
parsed: (await this.parse(raw)).parsed,
parsed: parseRes.parsed,
hasTextLink: !!parseRes.link,
});
}
@@ -1348,6 +1357,7 @@ export class ExcalidrawData {
position = parts.value.index + parts.value[0].length;
}
outString += text.substring(position, text.length);
outString = this.unescapeSquareBrackets(outString);
if (linkIcon) {
outString = this.linkPrefix + outString;
}
@@ -1368,6 +1378,10 @@ export class ExcalidrawData {
: text;
}
private unescapeSquareBrackets(text: string): string {
return text?.replaceAll(/\\\[/g, "[") ?? text;
}
/**
* Does a quick parse of the raw text. Returns the parsed string if raw text does not include a transclusion.
* Return null if raw text includes a transclusion.
@@ -1425,6 +1439,7 @@ export class ExcalidrawData {
position = parts.value.index + parts.value[0].length;
}
outString += text.substring(position, text.length);
outString = this.unescapeSquareBrackets(outString);
if (linkIcon) {
outString = this.linkPrefix + outString;
}
@@ -1770,6 +1785,14 @@ export class ExcalidrawData {
return t.parsed;
}
public getParsedResult(id: string) {
const t = this.textElements.get(id);
if (!t) {
return null;
}
return t;
}
/**
* Attempts to quickparse (sycnhronously) the raw text.
*
@@ -1799,6 +1822,7 @@ export class ExcalidrawData {
this.textElements.set(elementID, {
raw: rawOriginalText,
parsed: parseResult,
hasTextLink: !!link,
});
return [parseResult, link];
}
@@ -1808,6 +1832,7 @@ export class ExcalidrawData {
this.textElements.set(elementID, {
raw: rawOriginalText,
parsed: parsedText,
hasTextLink: !!parseRes.link,
});
if (parsedText) {
updateSceneCallback(parsedText);
@@ -1825,6 +1850,7 @@ export class ExcalidrawData {
this.textElements.set(elementID, {
raw: rawOriginalText,
parsed: parseResult.parsed,
hasTextLink: !!parseResult.link,
});
return {
parseResult: parseResult.parsed,
+577 -68
View File
@@ -1,25 +1,78 @@
import { App, FuzzyMatch } from "obsidian";
import { App, FuzzyMatch, TFile } from "obsidian";
import { SuggestionModal } from "./SuggestionModal";
import { LinkSuggestion } from "src/types/types";
import ExcalidrawPlugin from "src/core/main";
import { getLinkSuggestionsFiltered, getSortedLinkMatches, renderLinkSuggestion } from "src/shared/Suggesters/LinkSuggesterUtils";
import {
getLinkSuggestionsFiltered,
getSortedLinkMatches,
renderHeadingSuggestionRow,
renderLinkSuggestion,
renderParagraphSuggestionRow,
fuzzyMatchTextItems,
fuzzyMatchParagraphsWithId,
} from "src/shared/Suggesters/LinkSuggesterUtils";
import { KeyBlocker } from "src/types/excalidrawAutomateTypes";
import { t } from "src/lang/helpers";
import { nanoid } from "src/constants/constants";
import { sleep } from "src/utils/utils";
import { getEA } from "src/core";
type HeadingSuggestion = {
kind: "heading";
heading: string;
level: number;
anchor: string;
file: TFile;
};
type ParagraphSuggestion = {
kind: "paragraph";
text: string;
id?: string;
file: TFile;
node: any;
};
type TagSuggestion = {
kind: "tag";
tag: string;
count: number;
};
type FrameSuggestion = {
kind: "frame";
label: string;
target: string;
id: string;
file: TFile;
refKind: "frame" | "clippedframe";
};
type InlineSuggestion = LinkSuggestion | HeadingSuggestion | ParagraphSuggestion | TagSuggestion | FrameSuggestion;
/**
* Inline link suggester that attaches to a specific input element.
*/
export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> implements KeyBlocker {
export class InlineLinkSuggester extends SuggestionModal<InlineSuggestion> implements KeyBlocker {
private readonly getSourcePath: () => string | undefined;
private readonly plugin: ExcalidrawPlugin;
private readonly widthHost: HTMLElement;
private readonly hasCustomWidthHost: boolean;
private readonly handleBracketKeyDown: (event: KeyboardEvent) => void;
private block = false;
private activeOpen = -1;
private activeClose = -1;
private activeTagStart = -1;
private activeTagEnd = -1;
private caretPos = 0;
private activeAlias: string | null = null;
private activeSearchTerm = "";
private activeFile: TFile | null = null;
private mode: "file" | "heading" | "block" | "frame" | "clippedframe" | "tag" | null = null;
private headingItems: HeadingSuggestion[] = [];
private paragraphItems: ParagraphSuggestion[] = [];
private frameItems: FrameSuggestion[] = [];
private tagItems: TagSuggestion[] = [];
constructor(
app: App,
@@ -36,20 +89,48 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
this.getSourcePath = getSourcePath;
this.widthHost = widthWrapper ?? inputEl;
this.hasCustomWidthHost = Boolean(widthWrapper);
this.handleBracketKeyDown = (event: KeyboardEvent) => this.onBracketKeyDown(event);
this.limit = 20;
if (!surpessPlaceholder) {
this.setPlaceholder(t("INLINE_HINT"));
}
this.emptyStateText = "No match";
this.syncWidth();
this.inputEl.addEventListener("keydown", this.handleBracketKeyDown);
}
public isBlockingKeys() {
return this.block;
}
getItems(): LinkSuggestion[] {
return getLinkSuggestionsFiltered(this.app);
private onBracketKeyDown(event: KeyboardEvent) {
if (event.key !== "[" || event.metaKey || event.ctrlKey || event.defaultPrevented || event.isComposing) {
return;
}
const selectionStart = this.inputEl.selectionStart;
const selectionEnd = this.inputEl.selectionEnd;
if (selectionStart === null || selectionEnd === null) {
return;
}
const hasSelection = selectionStart !== selectionEnd;
const value = this.inputEl.value;
const before = value.substring(0, selectionStart);
const selected = value.substring(selectionStart, selectionEnd);
const after = value.substring(selectionEnd);
event.preventDefault();
const insertion = hasSelection ? `[${selected}]` : "[]";
const cursorPos = selectionStart + 1 + (hasSelection ? selected.length : 0);
this.inputEl.value = `${before}${insertion}${after}`;
this.inputEl.setSelectionRange(cursorPos, cursorPos);
this.dispatchInputChange();
}
getItems(): InlineSuggestion[] {
return getLinkSuggestionsFiltered(this.app) as InlineSuggestion[];
}
/**
@@ -93,93 +174,206 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
* Refreshes the suggestion data (e.g. when vault changes) without recreating the instance.
*/
public refreshItems() {
this.items = getLinkSuggestionsFiltered(this.app);
this.items = getLinkSuggestionsFiltered(this.app) as InlineSuggestion[];
}
modifyInput(input: string): string {
return input;
}
onInputChanged(): void {
async onInputChanged(): Promise<void> {
const inputStr = this.modifyInput(this.inputEl.value);
this.caretPos = this.inputEl.selectionStart ?? inputStr.length;
// Do not show suggestions while a range is selected.
if ((this.inputEl.selectionEnd ?? this.caretPos) - (this.inputEl.selectionStart ?? 0) > 0) {
this.suggester.setSuggestions([]);
if (this.popper?.deref()) {
this.popper.deref().destroy();
}
this.suggestEl.detach();
this.activeOpen = -1;
this.activeClose = -1;
this.activeAlias = null;
this.activeSearchTerm = "";
setTimeout(() => {
this.block = false;
});
this.resetSuggestions();
return;
}
const active = this.findActiveLink(inputStr, this.caretPos);
if (!active) {
this.suggester.setSuggestions([]);
if (this.popper?.deref()) {
this.popper.deref().destroy();
}
this.suggestEl.detach();
this.activeOpen = -1;
this.activeClose = -1;
this.activeAlias = null;
this.activeSearchTerm = "";
setTimeout(() => {
this.block = false;
});
return;
}
this.activeOpen = active.open;
this.activeClose = active.close;
const activeInfo = this.extractActiveInfo(inputStr, this.caretPos, active.open, active.close);
this.activeAlias = activeInfo.alias;
this.activeSearchTerm = activeInfo.searchTerm;
if (active) {
this.activeOpen = active.open;
this.activeClose = active.close;
this.activeTagStart = -1;
this.activeTagEnd = -1;
// Hide suggester when editing alias section after a pipe.
if (activeInfo.inAlias) {
this.activeSearchTerm = "";
this.suggester.setSuggestions([]);
if (this.popper?.deref()) {
this.popper.deref().destroy();
const context = this.parseLinkContext(inputStr, this.caretPos, active.open, active.close);
this.activeAlias = context.alias;
this.activeSearchTerm = context.searchTerm;
this.activeFile = context.file;
this.mode = context.mode;
if (context.inAlias) {
this.resetSuggestions();
return;
}
this.suggestEl.detach();
setTimeout(() => {
this.block = false;
});
if (this.mode === "heading") {
await this.loadHeadings(this.activeFile);
} else if (this.mode === "block") {
await this.loadParagraphs(this.activeFile);
} else if (this.mode === "frame" || this.mode === "clippedframe") {
await this.loadFrames(this.activeFile, this.mode);
} else {
this.headingItems = [];
this.paragraphItems = [];
this.frameItems = [];
}
this.tagItems = [];
this.block = true;
super.onInputChanged();
return;
}
const activeTag = this.findActiveTag(inputStr, this.caretPos);
if (!activeTag) {
this.resetSuggestions();
return;
}
this.activeOpen = -1;
this.activeClose = -1;
this.activeTagStart = activeTag.start;
this.activeTagEnd = activeTag.end;
this.activeAlias = null;
this.activeSearchTerm = activeTag.term;
this.activeFile = null;
this.mode = "tag";
this.headingItems = [];
this.paragraphItems = [];
this.frameItems = [];
this.tagItems = this.getTagSuggestions();
this.block = true;
super.onInputChanged();
await super.onInputChanged();
}
getSuggestions(query: string): FuzzyMatch<LinkSuggestion>[] {
private getTagSuggestions(): TagSuggestion[] {
const tags = (this.app.metadataCache as any).getTags?.() ?? {};
return Object.keys(tags)
.sort((a, b) => {
const countDiff = (tags[b] ?? 0) - (tags[a] ?? 0);
if (countDiff !== 0) return countDiff;
return a.localeCompare(b);
})
.map((tag) => ({
kind: "tag",
tag,
count: tags[tag] ?? 0,
}));
}
private getTagSearchValue(tag: string): string {
return tag.startsWith("#") ? tag.substring(1) : tag;
}
getSuggestions(query: string): FuzzyMatch<InlineSuggestion>[] {
if (this.mode === "tag") {
return fuzzyMatchTextItems(this.activeSearchTerm ?? "", this.tagItems, (t) => this.getTagSearchValue(t.tag));
}
if (this.activeOpen === -1) return [];
if (this.mode === "heading") {
return fuzzyMatchTextItems(this.activeSearchTerm ?? "", this.headingItems, (h) => h.heading);
}
if (this.mode === "block") {
return fuzzyMatchParagraphsWithId(this.activeSearchTerm ?? "", this.paragraphItems);
}
if (this.mode === "frame" || this.mode === "clippedframe") {
return fuzzyMatchTextItems(this.activeSearchTerm ?? "", this.frameItems, (f) => f.label);
}
const term = this.activeSearchTerm ?? "";
return getSortedLinkMatches(term, this.items);
return getSortedLinkMatches(term, this.items as LinkSuggestion[]);
}
getItemText(item: LinkSuggestion): string {
return item.path + (item.alias ? `|${item.alias}` : "");
private isHeading(item: InlineSuggestion): item is HeadingSuggestion {
return (item as HeadingSuggestion)?.kind === "heading";
}
onChooseItem(item: LinkSuggestion): void {
const linkString = this.buildLink(item);
private isParagraph(item: InlineSuggestion): item is ParagraphSuggestion {
return (item as ParagraphSuggestion)?.kind === "paragraph";
}
private isTag(item: InlineSuggestion): item is TagSuggestion {
return (item as TagSuggestion)?.kind === "tag";
}
private isFrame(item: InlineSuggestion): item is FrameSuggestion {
return (item as FrameSuggestion)?.kind === "frame";
}
getItemText(item: InlineSuggestion): string {
if (this.isHeading(item)) {
return item.heading;
}
if (this.isParagraph(item)) {
return item.text;
}
if (this.isTag(item)) {
return item.tag;
}
if (this.isFrame(item)) {
return item.label;
}
return (item as LinkSuggestion).path + ((item as LinkSuggestion).alias ? `|${(item as LinkSuggestion).alias}` : "");
}
async onChooseItem(item: InlineSuggestion | undefined): Promise<void> {
if (!item) return;
if (this.isTag(item)) {
this.insertTag(item.tag);
return;
}
if (this.isHeading(item)) {
const linktext = this.app.metadataCache.fileToLinktext(
item.file,
this.getSourcePath() ?? "",
true,
);
const aliasSuffix = this.activeAlias !== null ? `|${this.activeAlias}` : "";
this.insertLink(`[[${linktext}#${item.anchor}${aliasSuffix}]]`);
return;
}
if (this.isParagraph(item)) {
const id = await this.ensureParagraphHasId(item);
if (!id) return;
const linktext = this.app.metadataCache.fileToLinktext(
item.file,
this.getSourcePath() ?? "",
true,
);
const aliasSuffix = this.activeAlias !== null ? `|${this.activeAlias}` : "";
this.insertLink(`[[${linktext}#^${id}${aliasSuffix}]]`);
return;
}
if (this.isFrame(item)) {
const linktext = this.app.metadataCache.fileToLinktext(
item.file,
this.getSourcePath() ?? "",
true,
);
const aliasSuffix = this.activeAlias !== null ? `|${this.activeAlias}` : "";
this.insertLink(`[[${linktext}#^${item.refKind}=${item.target}${aliasSuffix}]]`);
return;
}
const linkString = this.buildLink(item as LinkSuggestion);
this.insertLink(linkString);
}
selectSuggestion(value: FuzzyMatch<LinkSuggestion>, evt: MouseEvent | KeyboardEvent) {
async selectSuggestion(value: FuzzyMatch<InlineSuggestion>, evt: MouseEvent | KeyboardEvent) {
evt?.preventDefault?.();
evt?.stopPropagation?.();
this.onChooseItem(value?.item);
await this.onChooseItem(value?.item);
}
open(): void {
@@ -189,8 +383,40 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
super.open();
}
renderSuggestion(result: FuzzyMatch<LinkSuggestion>, itemEl: HTMLElement) {
renderLinkSuggestion(this.plugin, result, itemEl, this.emptyStateText);
renderSuggestion(result: FuzzyMatch<InlineSuggestion>, itemEl: HTMLElement) {
const { item } = result || {};
if (this.isTag(item as InlineSuggestion)) {
const tagItem = item as TagSuggestion;
itemEl.createDiv({ text: tagItem.tag });
itemEl.createEl("small", { text: `${tagItem.count}` });
return;
}
if (this.isHeading(item as InlineSuggestion)) {
const note = item
? this.app.metadataCache.fileToLinktext((item as HeadingSuggestion).file, this.getSourcePath() ?? "", true)
: "";
renderHeadingSuggestionRow(result as FuzzyMatch<HeadingSuggestion>, note, itemEl);
return;
}
if (this.isParagraph(item as InlineSuggestion)) {
const note = item
? this.app.metadataCache.fileToLinktext((item as ParagraphSuggestion).file, this.getSourcePath() ?? "", true)
: "";
renderParagraphSuggestionRow(result as FuzzyMatch<ParagraphSuggestion>, note, itemEl);
return;
}
if (this.isFrame(item as InlineSuggestion)) {
const frameItem = item as FrameSuggestion;
const note = this.app.metadataCache.fileToLinktext(frameItem.file, this.getSourcePath() ?? "", true);
this.renderFrameSuggestionRow(result as FuzzyMatch<FrameSuggestion>, note, itemEl);
return;
}
renderLinkSuggestion(this.plugin, result as FuzzyMatch<LinkSuggestion>, itemEl, this.emptyStateText);
}
private buildLink(item: LinkSuggestion): string {
@@ -219,21 +445,258 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
if (start === -1) {
return;
}
const closeIndex = this.activeClose >= 0 ? this.activeClose : this.inputEl.value.indexOf("]]", start + 2);
const end = closeIndex >= 0 ? closeIndex + 2 : cursor;
const nextOpen = this.inputEl.value.indexOf("[[", start + 2);
const fallbackClose = this.inputEl.value.indexOf("]]", start + 2);
const closeBelongsToLink = this.activeClose >= 0
? true
: fallbackClose !== -1 && (nextOpen === -1 || fallbackClose < nextOpen);
const effectiveClose = this.activeClose >= 0 ? this.activeClose : closeBelongsToLink ? fallbackClose : -1;
// If no valid closing brackets are present for this link (e.g. another [[ appears first),
// only replace up to the current cursor to avoid swallowing subsequent text.
const end = effectiveClose >= 0 ? effectiveClose + 2 : cursor;
const prefix = this.inputEl.value.substring(0, start);
const suffix = this.inputEl.value.substring(end);
this.inputEl.value = prefix + link + suffix;
this.inputEl.dispatchEvent(new Event("input"));
this.dispatchInputChange();
const newPos = start + link.length;
this.inputEl.setSelectionRange(newPos, newPos);
this.close();
}
private insertTag(tag: string) {
if (this.activeTagStart < 0) {
return;
}
const start = this.activeTagStart;
const end = this.activeTagEnd >= 0 ? this.activeTagEnd : this.inputEl.selectionStart ?? this.inputEl.value.length;
const prefix = this.inputEl.value.substring(0, start);
const suffix = this.inputEl.value.substring(end);
this.inputEl.value = `${prefix}${tag}${suffix}`;
this.dispatchInputChange();
const newPos = start + tag.length;
this.inputEl.setSelectionRange(newPos, newPos);
this.close();
}
private resetSuggestions() {
this.close();
this.activeOpen = -1;
this.activeClose = -1;
this.activeTagStart = -1;
this.activeTagEnd = -1;
this.activeAlias = null;
this.activeSearchTerm = "";
this.activeFile = null;
this.mode = null;
this.headingItems = [];
this.paragraphItems = [];
this.frameItems = [];
this.tagItems = [];
}
private parseLinkContext(value: string, caret: number, open: number, close: number) {
const activeInfo = this.extractActiveInfo(value, caret, open, close);
const closeIndex = close >= 0 ? close : value.length;
const linkText = value.substring(open + 2, closeIndex);
const pipeIndex = linkText.indexOf("|");
const linkWithoutAlias = pipeIndex >= 0 ? linkText.substring(0, pipeIndex) : linkText;
const hashIndex = linkWithoutAlias.indexOf("#");
const caretInLink = Math.max(0, Math.min(caret - (open + 2), linkText.length));
const inSubpath = hashIndex >= 0 && caretInLink > hashIndex;
const basePath = hashIndex >= 0 ? linkWithoutAlias.substring(0, hashIndex) : linkWithoutAlias;
const subpathRaw = inSubpath ? linkWithoutAlias.substring(hashIndex + 1, caretInLink) : "";
const file = basePath
? this.app.metadataCache.getFirstLinkpathDest(basePath, this.getSourcePath() ?? "")
: null;
let mode: "file" | "heading" | "block" | "frame" | "clippedframe" = "file";
let searchTerm = activeInfo.searchTerm;
if (file && inSubpath) {
if (subpathRaw.startsWith("^frame=") && this.plugin.isExcalidrawFile(file)) {
mode = "frame";
searchTerm = subpathRaw.substring("^frame=".length);
} else if (subpathRaw.startsWith("^clippedframe=") && this.plugin.isExcalidrawFile(file)) {
mode = "clippedframe";
searchTerm = subpathRaw.substring("^clippedframe=".length);
} else if (file.extension === "md") {
const isBlockMode = subpathRaw.startsWith("^");
mode = isBlockMode ? "block" : "heading";
searchTerm = isBlockMode ? subpathRaw.substring(1) : subpathRaw;
}
}
return {
alias: activeInfo.alias,
inAlias: activeInfo.inAlias,
searchTerm,
file: mode === "file" ? null : file,
mode,
} as const;
}
private async loadFrames(file: TFile | null, refKind: "frame" | "clippedframe") {
this.frameItems = [];
if (!file || !this.plugin.isExcalidrawFile(file)) {
return;
}
const ea = getEA();
const scene = await ea?.getSceneFromFile?.(file);
const frames = (scene?.elements ?? []).filter((el: any) => el?.type === "frame" && !el?.isDeleted);
if (!frames.length) {
return;
}
const nameCounts = new Map<string, number>();
frames.forEach((frame: any) => {
const rawName = typeof frame?.name === "string" ? frame.name.trim() : "";
if (!rawName) {
return;
}
nameCounts.set(rawName, (nameCounts.get(rawName) ?? 0) + 1);
});
this.frameItems = frames.map((frame: any) => {
const id = frame?.id ?? "";
const rawName = typeof frame?.name === "string" ? frame.name.trim() : "";
const hasName = rawName.length > 0;
const isDuplicateName = hasName && (nameCounts.get(rawName) ?? 0) > 1;
const label = hasName
? (isDuplicateName ? `${rawName} (${id})` : rawName)
: id;
const target = hasName && !isDuplicateName ? rawName : id;
return {
kind: "frame",
label,
target,
id,
file,
refKind,
};
});
}
private async loadHeadings(file: TFile | null) {
if (!file || file.extension !== "md") {
this.headingItems = [];
return;
}
const cache = await this.app.metadataCache.blockCache.getForFile({ isCancelled: () => false }, file);
const blocks = cache?.blocks ?? [];
this.headingItems = blocks
.filter((b: any) => b.display && b.node?.type === "heading")
.map((b: any) => ({
kind: "heading",
heading: this.cleanHeading(b.display),
anchor: this.cleanHeading(b.display),
level: b.node?.depth ?? b.node?.level ?? 1,
file,
}));
}
private async loadParagraphs(file: TFile | null) {
if (!file || file.extension !== "md") {
this.paragraphItems = [];
return;
}
const cache = await this.app.metadataCache.blockCache.getForFile({ isCancelled: () => false }, file);
const blocks = cache?.blocks ?? [];
this.paragraphItems = blocks
.filter((b: any) =>
b.display &&
b.node &&
(b.node.type === "paragraph" ||
b.node.type === "blockquote" ||
b.node.type === "listItem" ||
b.node.type === "table" ||
b.node.type === "callout"),
)
.map((b: any) => ({
kind: "paragraph",
text: b.display.trim(),
id: b.node?.id,
node: b.node,
file,
}));
}
private cleanHeading(display: string): string {
return display.replace(/^#+\s*/, "").trim();
}
private renderFrameSuggestionRow(
result: FuzzyMatch<FrameSuggestion>,
note: string,
itemEl: HTMLElement,
) {
const { item, match } = result || {};
itemEl.addClass("suggestion-item");
itemEl.addClass("mod-complex");
const contentEl = itemEl.createDiv("suggestion-content");
const titleEl = contentEl.createDiv("suggestion-title");
if (!item) {
titleEl.setText(this.emptyStateText);
itemEl.addClass("is-selected");
return;
}
this.renderTextWithHighlights(titleEl, item.label, match?.matches ?? []);
const noteEl = contentEl.createDiv("suggestion-note");
noteEl.setText(note ?? "");
const auxEl = itemEl.createDiv("suggestion-aux");
const flair = auxEl.createSpan("suggestion-flair");
flair.setText(`^${item.refKind}=${item.target}`);
}
private renderTextWithHighlights(titleEl: HTMLElement, text: string, matches: [number, number][]) {
if (!matches?.length) {
titleEl.setText(text);
return;
}
const sorted = [...matches].sort((a, b) => a[0] - b[0]);
for (let i = 0; i < text.length; i++) {
const m = sorted.find((range) => range[0] === i);
if (m) {
const span = createSpan("suggestion-highlight");
span.appendText(text.substring(m[0], m[1]));
titleEl.appendChild(span);
i = m[1] - 1;
continue;
}
titleEl.appendText(text[i]);
}
}
private async ensureParagraphHasId(item: ParagraphSuggestion): Promise<string | null> {
if (item.id) return item.id;
const offset = item.node?.position?.end?.offset;
if (!offset) return null;
const fileContents = await this.plugin.app.vault.cachedRead(item.file);
const newId = nanoid();
await this.plugin.app.vault.modify(
item.file,
`${fileContents.slice(0, offset)} ^${newId}${fileContents.slice(offset)}`,
);
await sleep(200);
item.id = newId;
return newId;
}
// Keep listeners so the suggester can trigger multiple times in the same input session.
close(): void {
this.app.keymap.popScope(this.scope);
if (this.suggestEl.isConnected) {
this.app.keymap.popScope(this.scope);
}
this.suggester.setSuggestions([]);
if (this.popper?.deref()) {
this.popper.deref().destroy();
@@ -256,16 +719,52 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
while (true) {
const open = value.indexOf("[[", searchFrom);
if (open === -1 || open > pos) break;
const close = value.indexOf("]]", open + 2);
if (close === -1 || pos <= close) {
const nextOpen = value.indexOf("[[", open + 2);
const closeCandidate = value.indexOf("]]", open + 2);
const closeBelongsToLink = closeCandidate !== -1 && (nextOpen === -1 || closeCandidate < nextOpen);
const close = closeBelongsToLink ? closeCandidate : -1;
const caretInsideBrackets = pos > open + 1 && (close === -1 || pos <= close);
if (caretInsideBrackets) {
candidate = { open, close };
break;
}
searchFrom = close + 2;
if (close !== -1) {
searchFrom = close + 2;
} else if (nextOpen !== -1) {
searchFrom = nextOpen + 2;
} else {
break;
}
}
return candidate;
}
private findActiveTag(value: string, caret: number): {start: number; end: number; term: string} | null {
const beforeCaret = value.substring(0, caret);
const match = beforeCaret.match(/(?:^|[\s\(\[\{>])#([^\s#\[\]\(\)\{\}\|]*)$/);
if (!match) {
return null;
}
const matchedText = match[0];
const hashOffset = matchedText.lastIndexOf("#");
if (hashOffset === -1) {
return null;
}
const start = caret - (matchedText.length - hashOffset);
let end = caret;
while (end < value.length && !/[\s#\[\]\(\)\{\}\|]/.test(value.charAt(end))) {
end++;
}
return {
start,
end,
term: match[1] ?? "",
};
}
private extractActiveInfo(value: string, caret: number, open: number, close: number): {alias: string | null; inAlias: boolean; searchTerm: string} {
const closeIndex = close >= 0 ? close : value.length;
const linkText = value.substring(open + 2, closeIndex);
@@ -281,4 +780,14 @@ export class InlineLinkSuggester extends SuggestionModal<LinkSuggestion> impleme
return { alias, inAlias, searchTerm };
}
private dispatchInputChange() {
const eventInit = { bubbles: true, composed: true, cancelable: true };
const inputEvt = typeof InputEvent !== "undefined"
? new InputEvent("input", eventInit as InputEventInit)
: new Event("input", eventInit);
this.inputEl.dispatchEvent(inputEvt);
const changeEvt = new Event("change", eventInit);
this.inputEl.dispatchEvent(changeEvt);
}
}
+107
View File
@@ -97,6 +97,113 @@ export const getSortedLinkMatches = (
});
};
const renderTextWithHighlights = (titleEl: HTMLElement, text: string, matches: [number, number][]) => {
if (!matches?.length) {
titleEl.setText(text);
return;
}
const sorted = [...matches].sort((a, b) => a[0] - b[0]);
for (let i = 0; i < text.length; i++) {
const match = sorted.find((m) => m[0] === i);
if (match) {
const span = createSpan("suggestion-highlight");
span.appendText(text.substring(match[0], match[1]));
titleEl.appendChild(span);
i = match[1] - 1;
continue;
}
titleEl.appendText(text[i]);
}
};
export const fuzzyMatchTextItems = <T>(
term: string,
items: T[],
getText: (item: T) => string,
): FuzzyMatch<T>[] => {
const search = prepareFuzzySearch(term ?? "");
return items
.map((item) => {
const match = search(getText(item));
return match ? { item, match } : null;
})
.filter(Boolean) as FuzzyMatch<T>[];
};
export const fuzzyMatchParagraphsWithId = <T extends { id?: string; text: string }>(
term: string,
items: T[],
): FuzzyMatch<T>[] => {
const search = prepareFuzzySearch(term ?? "");
const needle = term?.trim().replace(/^\^/, "").toLowerCase();
return items
.map((item) => {
const display = `${item.id ? `^${item.id} ` : ""}${item.text}`;
const match = search(display);
if (!match) return null;
if (item.id && needle) {
const idLower = item.id.toLowerCase();
if (idLower === needle) {
match.score = Number.MAX_SAFE_INTEGER; // strongest priority for exact id
} else if (idLower.includes(needle)) {
match.score = match.score + 1000; // strong priority if id contains term
}
}
return { item, match } as FuzzyMatch<T>;
})
.filter(Boolean)
.sort((a, b) => (b.match?.score ?? 0) - (a.match?.score ?? 0)) as FuzzyMatch<T>[];
};
export const renderHeadingSuggestionRow = (
result: FuzzyMatch<{ heading: string; level?: number }>,
note: string,
itemEl: HTMLElement,
) => {
const { item, match } = result || {};
itemEl.addClass("suggestion-item");
itemEl.addClass("mod-complex");
const contentEl = itemEl.createDiv("suggestion-content");
const titleEl = contentEl.createDiv("suggestion-title");
if (!item) {
titleEl.setText("No match");
itemEl.addClass("is-selected");
return;
}
renderTextWithHighlights(titleEl, item.heading, match?.matches ?? []);
const noteEl = contentEl.createDiv("suggestion-note");
noteEl.setText(note ?? "");
const auxEl = itemEl.createDiv("suggestion-aux");
const flair = auxEl.createSpan("suggestion-flair");
flair.setText(`H${item.level ?? 1}`);
};
export const renderParagraphSuggestionRow = (
result: FuzzyMatch<{ text: string; id?: string }>,
note: string,
itemEl: HTMLElement,
) => {
const { item, match } = result || {};
itemEl.addClass("suggestion-item");
itemEl.addClass("mod-complex");
const contentEl = itemEl.createDiv("suggestion-content");
const titleEl = contentEl.createDiv("suggestion-title");
if (!item) {
titleEl.setText("No match");
itemEl.addClass("is-selected");
return;
}
const display = `${item.id ? `^${item.id} ` : ""}${item.text}`;
renderTextWithHighlights(titleEl, display, match?.matches ?? []);
const noteEl = contentEl.createDiv("suggestion-note");
noteEl.setText(note ?? "");
if (item.id) {
const auxEl = itemEl.createDiv("suggestion-aux");
const flair = auxEl.createSpan("suggestion-flair");
flair.setText(`^${item.id}`);
}
};
/**
* Standard rendering for link suggestions with icons and highlights.
*/
+1 -1
View File
@@ -112,7 +112,7 @@ export class Suggester<T> {
this.selectedItem = nIndex;
if (scroll) {
if (scroll && next) {
next.scrollIntoView(false);
}
}
+71
View File
@@ -0,0 +1,71 @@
import type { SavedChats, TTDPersistenceAdapter } from "@zsviczian/excalidraw";
const TTD_DB_NAME = "excalidraw-ttd";
const TTD_DB_VERSION = 1;
const TTD_STORE_NAME = "chats";
const TTD_STORE_KEY = "saved";
const openTTDDatabase = async (): Promise<IDBDatabase | null> => {
if (typeof indexedDB === "undefined") {
return null;
}
return await new Promise<IDBDatabase>((resolve: (value: IDBDatabase) => void, reject: (reason?: unknown) => void): void => {
const request = indexedDB.open(TTD_DB_NAME, TTD_DB_VERSION);
request.onupgradeneeded = () => {
const db = request.result;
if (!db.objectStoreNames.contains(TTD_STORE_NAME)) {
db.createObjectStore(TTD_STORE_NAME);
}
};
request.onsuccess = () => resolve(request.result);
request.onerror = () => reject(request.error);
}).catch((): null => null);
};
const readChatsFromStore = async (db: IDBDatabase): Promise<SavedChats | undefined> => {
return await new Promise((resolve, reject) => {
const tx = db.transaction(TTD_STORE_NAME, "readonly");
const store = tx.objectStore(TTD_STORE_NAME);
const request = store.get(TTD_STORE_KEY);
request.onsuccess = () => resolve(request.result as SavedChats | undefined);
request.onerror = () => reject(request.error);
});
};
const writeChatsToStore = async (db: IDBDatabase, chats: SavedChats): Promise<void> => {
return await new Promise((resolve, reject) => {
const tx = db.transaction(TTD_STORE_NAME, "readwrite");
const store = tx.objectStore(TTD_STORE_NAME);
const request = store.put(chats, TTD_STORE_KEY);
request.onsuccess = () => resolve();
request.onerror = () => reject(request.error);
});
};
export const ttdPersistenceAdapter: TTDPersistenceAdapter = {
async loadChats(): Promise<SavedChats> {
try {
const db = await openTTDDatabase();
if (!db) return [];
const chats = await readChatsFromStore(db);
return Array.isArray(chats) ? chats : [];
} catch (error) {
console.warn("TTD loadChats failed", error);
return [];
}
},
async saveChats(chats: SavedChats): Promise<void> {
try {
const db = await openTTDDatabase();
if (!db) return;
await writeChatsToStore(db, chats);
} catch (error) {
console.warn("TTD saveChats failed", error);
}
},
};
+20 -13
View File
@@ -1,8 +1,8 @@
import { RestoredDataState } from "@zsviczian/excalidraw/types/excalidraw/data/restore";
import { ImportedDataState } from "@zsviczian/excalidraw/types/excalidraw/data/types";
import { BoundingBox } from "@zsviczian/excalidraw/types/element/src";
import { ElementsMap, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFrameLikeElement, ExcalidrawTextContainer, ExcalidrawTextElement, FontFamilyValues, FontString, NonDeleted, NonDeletedExcalidrawElement, OrderedExcalidrawElement, Theme } from "@zsviczian/excalidraw/types/element/src/types";
import { FontMetadata } from "@zsviczian/excalidraw/types/common/src";
import { ElementsMap, ElementsMapOrArray, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawFrameLikeElement, ExcalidrawTextContainer, ExcalidrawTextElement, FontFamilyValues, FontString, NonDeleted, NonDeletedExcalidrawElement, OrderedExcalidrawElement, Theme } from "@zsviczian/excalidraw/types/element/src/types";
import { CombineBrandsIfNeeded, FontMetadata } from "@zsviczian/excalidraw/types/common/src";
import { AppState, BinaryFiles, DataURL, GenerateDiagramToCode, Zoom } from "@zsviczian/excalidraw/types/excalidraw/types";
import { Mutable } from "@zsviczian/excalidraw/types/common/src/utility-types";
import { GlobalPoint } from "@zsviczian/excalidraw/types/math/src/types";
@@ -67,12 +67,18 @@ declare namespace ExcalidrawLib {
) => { width: number; height: number; scale?: number };
};
function restore(
data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null,
localAppState: Partial<AppState> | null | undefined,
localElements: readonly ExcalidrawElement[] | null | undefined,
elementsConfig?: { refreshDimensions?: boolean; repairBindings?: boolean },
): RestoredDataState;
function restoreElements <T extends ExcalidrawElement>(
targetElements: readonly T[] | undefined | null,
/** used for additional context (e.g. repairing arrow bindings) */
existingElements: Readonly<ElementsMapOrArray> | null | undefined,
opts?:
| {
refreshDimensions?: boolean;
repairBindings?: boolean;
deleteInvisibleElements?: boolean;
}
| undefined,
) : CombineBrandsIfNeeded<T, OrderedExcalidrawElement>;
function exportToSvg(opts: Omit<ExportOpts, "getDimensions"> & {
elements: ExcalidrawElement[];
@@ -191,22 +197,23 @@ declare namespace ExcalidrawLib {
function getEmbedLink (link: string | null | undefined): EmbeddedLink;
function mermaidToExcalidraw(
const mermaidToExcalidraw: typeof import("@zsviczian/excalidraw/types/excalidraw/components/TTDDialog/MermaidToExcalidrawLib").mermaidToExcalidraw;
/*function mermaidToExcalidraw(
mermaidDefinition: string,
opts: MermaidConfig,
forceSVG?: boolean,
): Promise<{
elements?: ExcalidrawElement[];
files?: any;
error?: string;
} | undefined>;
} | undefined>;*/
var getSceneVersion: any;
var Excalidraw: any;
var MainMenu: any;
var WelcomeScreen: any;
var TTDDialogTrigger: any;
var TTDDialog: any;
var TTDDialogTrigger: typeof import("@zsviczian/excalidraw").TTDDialogTrigger;
var TTDDialog: typeof import("@zsviczian/excalidraw").TTDDialog;
var DiagramToCodePlugin: (props: {
generate: GenerateDiagramToCode;
}) => any;
+1
View File
@@ -67,4 +67,5 @@ export interface ViewSemaphores {
saving: boolean;
hoverSleep: boolean; //flag with timer to prevent hover preview from being triggered dozens of times
wheelTimeout:number; //used to avoid hover preview while zooming
shouldSaveImportedImage: boolean; //forceSave after image import via the Excalidraw Image Tool or by way of paste
}
+2 -2
View File
@@ -56,8 +56,8 @@ export interface SidepanelTab {
setContent(content: string | DocumentFragment): this;
/** Activates this tab within the host sidepanel. */
focus(): void;
/** Marks the tab open, activates it, and triggers `onOpen`. */
open(): void;
/** Marks the tab open, activates it, and triggers `onOpen`. reveal default is true */
open(reveal?: boolean): void;
/** Runs close handlers then asks the host to remove the tab. */
close(): void;
/** Lifecycle hook called when the tab is opened/activated. */
+11
View File
@@ -83,6 +83,17 @@ declare module "obsidian" {
interface Menu {
items: MenuItem[];
}
interface Modal {
/**
* Whether to *dim* the background behind the modal. If {@link dimmed} is `true`, the
* opacity-value from [setBackgroundOpacity]{@link Modal#setBackgroundOpacity} or
* the default of `0.85` is used.
* @note The hidden backdrop will still catch focus.
*/
setDimBackground(dimmed: boolean): Modal;
/** Sets the opacity of the Modal backdrop. */
setBackgroundOpacity(opacity: number): Modal;
}
interface Keymap {
getRootScope(): Scope;
}
+3 -2
View File
@@ -7,11 +7,12 @@ const handleImageEditPrompt = async (request: AIRequest) : Promise<RequestUrlRes
const {
openAIAPIToken,
openAIImageEditsURL,
openAIDefaultImageGenerationModel,
} = plugin.settings;
const { image, text, imageGenerationProperties} = request;
const body = new FormData();
body.append("model", "dall-e-2");
body.append("model", openAIDefaultImageGenerationModel);
text.trim() !== "" && body.append("prompt", text);
if (image) {
@@ -21,7 +22,7 @@ const handleImageEditPrompt = async (request: AIRequest) : Promise<RequestUrlRes
if (imageGenerationProperties.mask) {
const maskBlob = await fetch(imageGenerationProperties.mask).then((res) => res.blob());
body.append('mask', maskBlob, 'masik.png');
body.append('mask', maskBlob, 'mask.png');
}
imageGenerationProperties.size && body.append("size", imageGenerationProperties.size);
+6 -4
View File
@@ -32,9 +32,11 @@ export const setDynamicStyle = (
return;
}
//const doc = view.ownerDocument;
const st = view?.excalidrawAPI?.getAppState?.();
const isLightTheme =
view?.excalidrawAPI?.getAppState?.()?.theme === "light" ||
view?.excalidrawData?.scene?.appState?.theme === "light";
st?.theme === "light" ||
st?.theme === "light";
if (color==="transparent") {
color = "#ffffff";
@@ -123,8 +125,8 @@ export const setDynamicStyle = (
[`--h4-color`]: str(text),
[`color`]: str(text),
['--excalidraw-caret-color']: textBackgroundColor
? str(isLightTheme ? invertColor(textBackgroundColor) : ea.getCM(textBackgroundColor))
: str(isLightTheme ? text : cmBG()),
? str(isLightTheme ? invertColor(textBackgroundColor) : ea.getCM(textBackgroundColor))
: (isLightTheme ? str(invertColor(color)): color),
[`--select-highlight-color`]: str(gray1()),
[`--color-gray-90`]: str(isDark?text.darkerBy(5):text.lighterBy(5)), //search background
[`--color-gray-80`]: str(isDark?text.darkerBy(10):text.lighterBy(10)), //frame
+41 -23
View File
@@ -1,5 +1,5 @@
import { ExcalidrawAutomate } from "src/shared/ExcalidrawAutomate";
import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
import { BinaryFileData, DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
import ExcalidrawPlugin from "src/core/main";
import {
ExcalidrawElement,
@@ -13,13 +13,14 @@ import ExcalidrawView, { getTextMode } from "src/view/ExcalidrawView";
import {
GITHUB_RELEASES,
getCommonBoundingBox,
restore,
restoreElements,
REG_LINKINDEX_INVALIDCHARS,
THEME_FILTER,
EXCALIDRAW_PLUGIN,
getFontFamilyString,
getLineHeight,
measureText,
nanoid,
} from "src/constants/constants";
import {
//debug,
@@ -281,10 +282,19 @@ export async function getTemplate(
}
if(filenameParts.hasFrameref || filenameParts.hasClippedFrameref) {
const el = getFrameBasedOnFrameNameOrId(filenameParts.blockref,scene.elements);
if(el) {
groupElements = el.frameRole === "marker"
? plugin.ea.getElementsInArea(scene.elements, el).concat(el)
: plugin.ea.getElementsInFrame(el,scene.elements, filenameParts.hasClippedFrameref);
if(el && el.type === "frame" && el.frameRole === "marker") {
const rect = cloneElement(el);
rect.type = "rectangle";
rect.id = nanoid();
rect.opacity = 0;
rect.roundness = null;
rect.roughness = 0;
rect.strokeWidth = 0.1;
rect.fillStyle = "solid";
scene.elements.push(rect);
groupElements = plugin.ea.getElementsInArea(scene.elements, rect).concat(el);
} else {
groupElements = plugin.ea.getElementsInFrame(el,scene.elements, filenameParts.hasClippedFrameref);
}
}
if(filenameParts.hasArearef) {
@@ -394,6 +404,7 @@ export async function createPNG(
depth: number,
padding?: number,
imagesDict?: any,
overrideFiles?: Record<ExcalidrawElement["id"], BinaryFileData>,
): Promise<Blob> {
if (!loader) {
loader = new EmbeddedFilesLoader(plugin);
@@ -435,6 +446,7 @@ export async function createPNG(
},
padding,
scale,
overrideFiles,
);
}
@@ -510,6 +522,7 @@ export async function createSVG(
imagesDict?: any,
convertMarkdownLinksToObsidianURLs: boolean = false,
includeInternalLinks: boolean = true,
overrideFiles?: Record<ExcalidrawElement["id"], BinaryFileData>,
): Promise<SVGSVGElement> {
if (!loader) {
loader = new EmbeddedFilesLoader(plugin);
@@ -560,6 +573,7 @@ export async function createSVG(
},
padding,
null,
overrideFiles,
);
if (withTheme && theme === "dark") addFilterToForeignObjects(svg);
@@ -579,7 +593,7 @@ export async function createSVG(
}
const isNonMarkerFrameRef = filenameParts.hasFrameref && el.length === 1 && el[0].type === "frame" && el[0].frameRole !== "marker";
if(el.length>0 && !isNonMarkerFrameRef) {
if (el.length > 0 && !isNonMarkerFrameRef) {
const containerId = el[0].containerId;
if(containerId) {
el = el.concat(elements.filter((el: ExcalidrawElement)=>el.id === containerId));
@@ -647,28 +661,32 @@ export function repositionElementsToCursor(
element.y = element.y + offsetY;
});
return restore({elements}, null, null).elements;
return restoreElements(elements, null, {refreshDimensions: true, repairBindings: true});
}
export const insertLaTeXToView = (view: ExcalidrawView, center: boolean = false) => {
const app = view.plugin.app;
const ea = getEA(view) as ExcalidrawAutomate;
const isLatexSuitAvailable = !!app.plugins.plugins["obsidian-latex-suite"];
(isLatexSuitAvailable
? LaTexPrompt.Prompt(app, t("ENTER_LATEX"), view.plugin.settings.latexBoilerplate)
: GenericInputPrompt.Prompt(
view,
view.plugin,
app,
t("ENTER_LATEX"),
"\\color{red}\\oint_S {E_n dA = \\frac{1}{{\\varepsilon _0 }}} Q_{inside}",
view.plugin.settings.latexBoilerplate,
undefined,
3
)
).then(async (formula: string) => {
LaTexPrompt.Prompt(app, t("ENTER_LATEX"), view.plugin.settings.latexBoilerplate)
.then(async (formula: string) => {
const lastLatexEl = ea.getViewElements()
.filter((el) => el.type === "image" && view.excalidrawData.hasEquation(el.fileId))
.reduce(
(maxel, curr) => (!maxel || curr.updated > maxel.updated) ? curr : maxel,
undefined
) as ExcalidrawImageElement;
let scaleX = 1;
let scaleY = 1;
if (lastLatexEl) {
const equation = view.excalidrawData.getEquation(lastLatexEl.fileId);
const dataurl = await ea.tex2dataURL(equation.latex);
if (dataurl.size.width > 0 && dataurl.size.height > 0) {
scaleX = lastLatexEl.width/dataurl.size.width;
scaleY = lastLatexEl.height/dataurl.size.height;
}
}
if (formula) {
const id = await ea.addLaTex(0, 0, formula);
const id = await ea.addLaTex(0, 0, formula, scaleX, scaleY);
if(center) {
const el = ea.getElement(id);
let {width, height} = el;
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff. Show more