Compare commits

...
47 Commits
Author SHA1 Message Date
zsviczian 83eda9b3f5 Update README.md 2024-08-04 11:01:12 +02:00
zsviczian 9bfbf47963 2.3.0 2024-08-04 10:37:06 +02:00
zsviczian 252bf411b1 2.3.0-beta-1 2024-08-03 21:26:47 +02:00
zsviczian 5622c019dd rebuild view DEVICE.isDesktop 2024-08-02 17:55:23 +02:00
zsviczian b32fab7865 2.2.13-1 2024-08-01 22:18:16 +02:00
zsviczian cafdad1f7a onWindowMigrated 2024-07-30 18:54:54 +02:00
zsviczian 9da40944ab 2.2.13 2024-07-29 18:13:13 +02:00
zsviczian f678203a64 Merge pull request #1908 from dmscode/master
Update zh-cn.ts to 2.2.11
2024-07-29 17:32:14 +02:00
zsviczian a9572e08e9 Merge branch 'master' into master 2024-07-29 17:31:58 +02:00
dmscode ee9b042cdf Update zh-cn.ts to 2.2.11 2024-07-28 20:42:41 +08:00
zsviczian bc138fa78a fixed storeAction, replaced "none" with "update" #1906 2024-07-28 10:06:31 +02:00
zsviczian 67dbe256f7 2.2.12 2024-07-28 06:55:27 +02:00
zsviczian 8b066d46e2 fix rename and skip inline fonts to cache key 2024-07-28 06:24:30 +02:00
zsviczian 1769a65a82 2.2.11 2024-07-27 21:25:23 +02:00
zsviczian 941eb56769 updated ExcaliAI 2024-07-27 07:09:19 +02:00
zsviczian a317613ef4 Merge pull request #1859 from Saik0s/patch-1
Update ExcaliAI.md to fix incorrect request json for openai api
2024-07-27 07:05:58 +02:00
zsviczian 173571846f 2.2.10-2 2024-07-26 20:11:20 +02:00
zsviczian ab1078d393 Fourth Font 2.2.10-1 2024-07-25 21:59:42 +02:00
zsviczian 681321a595 2.2.10-1 fontpicker beta 2024-07-25 21:52:47 +02:00
zsviczian fcd50d4bc2 Merge pull request #1897 from dmscode/master
Updated zh-cn.ts to 2.2.10
2024-07-23 17:49:00 +02:00
dmscode 7e214e5aaa Updated zh-cn.ts to 2.2.10 2024-07-23 09:54:43 +08:00
zsviczian de39053857 2.2.10 2024-07-22 22:01:36 +02:00
zsviczian f543e3218e clippedframe, framesettings 2024-07-21 17:54:00 +02:00
zsviczian e668aea214 Merge pull request #1890 from dmscode/master
Fixed link path
2024-07-20 08:33:09 +02:00
zsviczian d810daa735 bump excalidraw version 2024-07-19 12:20:21 +02:00
zsviczian b94b3118eb improved error message when getPNG fails 2024-07-19 12:19:48 +02:00
dmscode 06cbd0c92d Fixed link path 2024-07-19 12:44:50 +08:00
zsviczian 96ebbbf11d tolerate ! for embedded files 2024-07-17 21:05:01 +02:00
zsviczian fc1467b05b Support for area, group, frame references in image embeds 2024-07-17 20:31:36 +02:00
zsviczian 53c27f2a59 2.2.9 2024-07-13 17:34:19 +02:00
zsviczian db80f5c715 allows opacity 0% 2024-07-09 16:45:06 +02:00
zsviczian 405c98ca50 2.2.8 2024-07-05 07:00:42 +02:00
zsviczian 4892aed9e6 Merge pull request #1825 from dmscode/master
Updated and formated zh-cn.ts
2024-07-04 20:33:30 +02:00
zsviczian 1b04b94db2 Merge pull request #1843 from tobybaratta/patch-1
Documentation: Update Custom Pens documentation links
2024-07-04 20:33:01 +02:00
zsviczian 4a430f5fe7 pre-2.2.8 2024-07-04 20:15:33 +02:00
zsviczian 325bfd825f 2.2.7-5 beta 2024-07-04 09:23:49 +02:00
zsviczian 471553f913 2.2.7-4 2024-07-03 00:46:55 +02:00
zsviczian a43d0689d8 2.2.7-3 without slob 2024-07-01 20:57:47 +02:00
zsviczian afacb8a94b 2.2.7-2 2024-07-01 20:51:01 +02:00
zsviczian afe5300e00 2.2.7-1 beta release after refactoring 2024-06-30 23:19:12 +02:00
zsviczian ef85d0e323 select similar elements 2024-06-30 11:37:22 +02:00
Igor Tarasenko d3aeedb9f6 Update ExcaliAI.md to fix incorrect request json for openai api 2024-06-28 21:03:58 +02:00
Toby Baratta 7718f69269 Fixing links to file names with spaces
commonmark spec thank you for working with spaces now
2024-06-20 19:17:00 -07:00
Toby Baratta af50b0c5c6 Update Custom Pens documentation links
**Problem:**
- The README right now contains a broken link to a not-on-main file documenting how to add custom pens. (That document was archived -- I found the original via searching and tried to find the corresponding PRs for the details on the replacement functionality but couldn't find that PR.) 
- Pens are now handled in settings with a different YouTube video showing how to set them up (I think). 
- Adds links to the Hardware Eraser functionality & Auto Draw for Pen. 

Question:
- I think it might be useful to link to the freestyle docs here still, or have some sort of master "Alternative Pens" link that still shows how to do the JSON setup? Not sure if necessary.
2024-06-20 18:55:35 -07:00
dmscode b576faad82 Updated zh-cn.ts to 2.2.7 2024-06-21 09:34:15 +08:00
稻米鼠 4583e603e9 Merge branch 'zsviczian:master' into master 2024-06-21 09:24:12 +08:00
dmscode 7dca225691 Updated and formated zh-cn.ts
- Updated to 2.2.6
- Some punctuation to Chinese punctuation
- Add space between Chinese and English
- Change keyname to just first letter upper
- Remove space at line end
2024-06-13 08:23:22 +08:00
67 changed files with 4039 additions and 2385 deletions

No files matched your search

+9 -2
View File
@@ -63,6 +63,13 @@ The Obsidian-Excalidraw plugin integrates [Excalidraw](https://excalidraw.com/),
<a href="https://youtu.be/4N6efq1DtH0" target="_blank"><img src="https://user-images.githubusercontent.com/14358394/158008902-12c6a851-237e-4edd-a631-d48e81c904b2.jpg" width="100" style="vertical-align: middle;"/>&nbsp;&nbsp;Eraser, left-handed mode, improved filename configuration</a><br>
</details>
### Beta testing
The plugin follows a monthly release schedule. If you want to receive more frequent updates with new features (e.g. shiny new stuff available on excalidraw.com, but not yet in Obsidian) and minor bug fixes, then join the beta community.
[![Thumbnail - 20240803 Excalidraw Release Approach (Custom)](https://github.com/user-attachments/assets/ab40648c-f73f-4bda-a416-52839f918f2a)](https://youtu.be/2poSS-Z91lY)
[![Excalidraw Plugin Release Strategy (Phone)](https://github.com/user-attachments/assets/87f1f379-782c-4c32-8b5b-d27fe2d3ac4b)](https://github.com/user-attachments/assets/120a0790-7239-48ae-bfbd-eb249f8b518d)
---
## Features
@@ -243,11 +250,11 @@ Drag the desired file from the Obsidian file explorer and hold down <kbd>SHIFT</
- In plugin settings, you can add a custom fourth font. For more details, see this [video](https://youtu.be/eKFmrSQhFA4)
- The plugin includes OCR support using Taskbone OCR. For more details, see this [video](https://youtu.be/7gu4ETx7zro)
- You can convert SVG files into Excalidraw drawings (with some limitation). For more details, see this [video](https://youtu.be/vlC1-iBvIfo)
- You can define custom freedraw pens. See documentation [here].(https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Alternative%20Pens.md), [video](https://youtu.be/uZz5MgzWXiM)
- You can define custom pens and higlighters and pin them to the sidebar. For more details, see this [video](https://youtu.be/OjNhjaH2KjI). Using ExcalidrawAutomate, you can add support for [auto-toggling](<ea-scripts/Auto Draw for Pen.md>) pen & support for [hardware eraser buttons](<ea-scripts/Hardware Eraser Support.md>).
### Script Engine
- Since 1.5.0, you can easily execute ExcalidrawAutomate macros and assign command palette shortcuts to them, using the ScriptEngine. You will find an intro video and a growing library of ready to install scripts [here](https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/ea-scripts).
- Since 1.5.0, you can easily execute ExcalidrawAutomate macros and assign command palette shortcuts to them, using the ScriptEngine. You will find an intro video and a growing library of ready to install scripts [here](ea-scripts/README.md).
- You can organize scripts into groups on the Obsidian Tools Panel in Excalidraw by moving scripts and accompanying SVG icon files to folders. See the demo [video](https://youtu.be/wTtaXmRJ7wg?t=16).
### Other
+2 -2
View File
@@ -6,7 +6,7 @@ import * as obsidian_module from "obsidian";
import ExcalidrawView, { ExportSettings } from "src/ExcalidrawView";
import { AppState, BinaryFileData, DataURL, ExcalidrawImperativeAPI, Point } from "@zsviczian/excalidraw/types/excalidraw/types";
import { EmbeddedFilesLoader } from "src/EmbeddedFileLoader";
import { ConnectionPoint, DeviceType } from "src/types";
import { ConnectionPoint, DeviceType } from "src/types/types";
import { ColorMaster } from "colormaster";
import { TInput } from "colormaster/types";
import { ClipboardData } from "@zsviczian/excalidraw/types/excalidraw/clipboard";
@@ -123,7 +123,7 @@ export declare class ExcalidrawAutomate {
* @param val //1: Virgil, 2:Helvetica, 3:Cascadia
* @returns
*/
setFontFamily(val: number): "Virgil, Segoe UI Emoji" | "Helvetica, Segoe UI Emoji" | "Cascadia, Segoe UI Emoji" | "LocalFont";
setFontFamily(val: number): "Virgil, Segoe UI Emoji" | "Helvetica, Segoe UI Emoji" | "Cascadia, Segoe UI Emoji" | "Local Font";
/**
* @param val //0:"light", 1:"dark"
* @returns
+2 -2
View File
@@ -427,7 +427,7 @@ const run = async (text) => {
const requestObject = isImageEditRequest
? {
...imageDataURL ? {image: imageDataURL} : {},
...imageDataURL ? {image: {url: imageDataURL}} : {},
...(text && text.trim() !== "") ? {text} : {},
imageGenerationProperties: {
size: imageSize,
@@ -437,7 +437,7 @@ const run = async (text) => {
},
}
: {
...imageDataURL ? {image: imageDataURL} : {},
...imageDataURL ? {image: {url: imageDataURL}} : {},
...(text && text.trim() !== "") ? {text} : {},
systemPrompt: systemPrompt.prompt,
instruction: outputType.instruction,
+14 -14
View File
@@ -33,8 +33,8 @@ const run = () => {
((typeof config.fillStyle === "undefined") || (el.fillStyle === config.fillStyle)) &&
((typeof config.fontFamily === "undefined") || (el.fontFamily === config.fontFamily)) &&
((typeof config.fontSize === "undefined") || (el.fontSize === config.fontSize)) &&
((typeof config.height === "undefined") || Math.abs(el.height - config.height) < 0.01) &&
((typeof config.width === "undefined") || Math.abs(el.width - config.width) < 0.01) &&
((typeof config.height === "undefined") || Math.abs(el.height - config.height) < 0.01) &&
((typeof config.width === "undefined") || Math.abs(el.width - config.width) < 0.01) &&
((typeof config.opacity === "undefined") || (el.opacity === config.opacity)) &&
((typeof config.roughness === "undefined") || (el.roughness === config.roughness)) &&
((typeof config.roundness === "undefined") || (el.roundness === config.roundness)) &&
@@ -56,7 +56,7 @@ const run = () => {
const showInstructions = () => {
const instructionsModal = new ea.obsidian.Modal(app);
instructionsModal.onOpen = () => {
instructionsModal.contentEl.createEl("h2", {text: "Instructions"});
instructionsModal.contentEl.createEl("h2", {text: "Instructions"});
instructionsModal.contentEl.createEl("p", {text: "Step 1: Choose the attributes that you want the selected elements to match."});
instructionsModal.contentEl.createEl("p", {text: "Step 2: Select an action:"});
instructionsModal.contentEl.createEl("ul", {}, el => {
@@ -71,14 +71,14 @@ const showInstructions = () => {
const selectAttributesToCopy = () => {
const configModal = new ea.obsidian.Modal(app);
configModal.onOpen = () => {
config = {};
config = {};
configModal.contentEl.createEl("h1", {text: "Select Similar Elements"});
new ea.obsidian.Setting(configModal.contentEl)
.setDesc("Choose the attributes you want the selected elements to match, then select an action.")
.addButton(button => button
.setButtonText("Instructions")
.onClick(showInstructions)
);
new ea.obsidian.Setting(configModal.contentEl)
.setDesc("Choose the attributes you want the selected elements to match, then select an action.")
.addButton(button => button
.setButtonText("Instructions")
.onClick(showInstructions)
);
// Add Toggles for the rest of the attributes
@@ -103,7 +103,7 @@ const selectAttributesToCopy = () => {
attributes.forEach(attr => {
const attrValue = elements[0][attr.key];
if(attrValue || (attr.key === "startArrowhead" && elements[0].type === "arrow") || (attr.key === "endArrowhead" && elements[0].type === "arrow")) {
if((typeof attrValue !== "undefined" && attrValue !== null) || (attr.key === "startArrowhead" && elements[0].type === "arrow") || (attr.key === "endArrowhead" && elements[0].type === "arrow")) {
let description = '';
switch(attr.key) {
@@ -144,8 +144,6 @@ const selectAttributesToCopy = () => {
description = `${attrValue}`;
break;
default:
console.log(attr.key);
console.log(attrValue);
description = `${attrValue.charAt(0).toUpperCase() + attrValue.slice(1)}`;
break;
}
@@ -192,7 +190,9 @@ const selectAttributesToCopy = () => {
configModal.onClose = () => {
setTimeout(()=>delete configModal);
setTimeout(()=>{
delete configModal
});
}
configModal.open();
+1 -1
View File
@@ -1 +1 @@
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1645305706000},{"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":1682228345043},{"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":1645305706Line truncated
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1645305706000},{"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":1682228345043},{"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":1645305706Line truncated
+1 -1
View File
@@ -20,7 +20,7 @@ If you want to modify scripts, I recommend moving them to the `Excalidraw Automa
I would love to include your contribution in the script library. If you have a script of your own that you would like to share with the community, please open a [PR](https://github.com/zsviczian/obsidian-excalidraw-plugin/pulls) on GitHub. Be sure to include the following in your pull request
- The [script file](https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/ea-scripts) with a self explanetory name. The name of the file will be the name of the script in the Command Palette.
- An [image](https://github.com/zsviczian/obsidian-excalidraw-plugin/tree/master/images) explaining the scripts purpose. Remember a picture speaks thousand words!
- An update to this file [ea-scripts/index.md](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/index.md)
- An update to this file [ea-scripts/index-new.md](https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/index-new.md)
---
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.1.8.2-beta-1",
"version": "2.3.0",
"minAppVersion": "1.1.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.2.7",
"version": "2.3.0",
"minAppVersion": "1.1.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
+5 -2
View File
@@ -19,7 +19,7 @@
"license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@zsviczian/excalidraw": "0.17.1-obsidian-29",
"@zsviczian/excalidraw": "0.17.1-obsidian-36",
"chroma-js": "^2.4.2",
"clsx": "^2.0.0",
"colormaster": "^1.2.1",
@@ -32,7 +32,9 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"roughjs": "^4.5.2",
"js-yaml": "^4.1.0"
"js-yaml": "^4.1.0",
"opentype.js": "^1.3.4",
"woff2sfnt-sfnt2woff": "^1.0.0"
},
"devDependencies": {
"dotenv": "^16.4.5",
@@ -52,6 +54,7 @@
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/js-yaml": "^4.0.9",
"@types/opentype.js": "^1.3.8",
"@zerollup/ts-transform-paths": "^1.7.18",
"cross-env": "^7.0.3",
"cssnano": "^6.0.2",
+5 -5
View File
@@ -54,11 +54,11 @@ if (!isLib) console.log(manifest.version);
const packageString = isLib
? ""
: ';' + lzstring_pkg +
'\nconst EXCALIDRAW_PACKAGES = "' + LZString.compressToBase64(react_pkg + reactdom_pkg + excalidraw_pkg) + '";\n' +
'const {react, reactDOM, excalidrawLib} = window.eval.call(window, `(function() {' +
'${LZString.decompressFromBase64(EXCALIDRAW_PACKAGES)};' +
'\nlet EXCALIDRAW_PACKAGES = LZString.decompressFromBase64("' + LZString.compressToBase64(react_pkg + reactdom_pkg + excalidraw_pkg) + '");\n' +
'let {react, reactDOM, excalidrawLib} = window.eval.call(window, `(function() {' +
'${EXCALIDRAW_PACKAGES};' +
'return {react: React, reactDOM: ReactDOM, excalidrawLib: ExcalidrawLib};})();`);\n' +
'const PLUGIN_VERSION="' + manifest.version + '";';
'let PLUGIN_VERSION="' + manifest.version + '";';
const BASE_CONFIG = {
input: 'src/main.ts',
@@ -107,7 +107,7 @@ const BUILD_CONFIG = {
babel({
presets: [['@babel/preset-env', {
targets: {
esmodules: true,
ios: "15", // ios Compatibility //esmodules: true,
},
}]],
exclude: "node_modules/**",
+4
View File
@@ -12,6 +12,10 @@ export class EditorHandler {
constructor(private plugin: ExcalidrawPlugin) {}
destroy(): void {
this.plugin = null;
}
setup(): void {
this.plugin.registerEditorExtension(this.activeEditorExtensions);
this.updateCMExtensionState(EDITOR_FADEOUT, this.plugin.settings.fadeOutExcalidrawMarkup);
+102 -36
View File
@@ -4,11 +4,6 @@
import { ExcalidrawElement, FileId } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { BinaryFileData, DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
import { App, MarkdownRenderer, Notice, TFile } from "obsidian";
import {
ASSISTANT_FONT,
CASCADIA_FONT,
VIRGIL_FONT,
} from "./constants/constFonts";
import {
DEFAULT_MD_EMBED_CSS,
fileid,
@@ -16,6 +11,7 @@ import {
nanoid,
THEME_FILTER,
FRONTMATTER_KEYS,
getFontDefinition,
} from "./constants/constants";
import { createSVG } from "./ExcalidrawAutomate";
import { ExcalidrawData, getTransclusion } from "./ExcalidrawData";
@@ -38,13 +34,13 @@ import {
LinkParts,
svgToBase64,
isMaskFile,
embedFontsInSVG,
getEmbeddedFilenameParts,
} from "./utils/Utils";
import { ValueOf } from "./types";
import { ValueOf } from "./types/types";
import { getMermaidImageElements, getMermaidText, shouldRenderMermaid } from "./utils/MermaidUtils";
import { mermaidToExcalidraw } from "src/constants/constants";
import { ImageKey, imageCache } from "./utils/ImageCache";
import { PreviewImageType } from "./utils/UtilTypes";
import { FILENAMEPARTS, PreviewImageType } from "./utils/UtilTypes";
//An ugly workaround for the following situation.
//File A is a markdown file that has an embedded Excalidraw file B
@@ -145,8 +141,6 @@ const replaceSVGColors = (svg: SVGSVGElement | string, colorMap: ColorMap | null
return svg;
}
export class EmbeddedFile {
public file: TFile = null;
public isSVGwithBitmap: boolean = false;
@@ -157,6 +151,7 @@ export class EmbeddedFile {
public mimeType: MimeType = "application/octet-stream";
public size: Size = { height: 0, width: 0 };
public linkParts: LinkParts;
public filenameparts: FILENAMEPARTS
private hostPath: string;
public attemptCounter: number = 0;
public isHyperLink: boolean = false;
@@ -204,7 +199,7 @@ export class EmbeddedFile {
if (!this.linkParts.height) {
this.linkParts.height = this.plugin.settings.mdSVGmaxHeight;
}
this.file = app.metadataCache.getFirstLinkpathDest(
this.file = this.plugin.app.metadataCache.getFirstLinkpathDest(
this.linkParts.path,
hostPath,
);
@@ -215,6 +210,9 @@ export class EmbeddedFile {
5000,
);
}
} else {
this.filenameparts = getEmbeddedFilenameParts(imgPath);
this.filenameparts.filepath = this.file.path;
}
}
@@ -360,26 +358,36 @@ export class EmbeddedFilesLoader {
: false,
withTheme: !!forceTheme,
isMask,
skipInliningFonts: false,
};
const hasColorMap = Boolean(inFile instanceof EmbeddedFile ? inFile.colorMap : null);
const shouldUseCache = !hasColorMap && this.plugin.settings.allowImageCacheInScene && file && imageCache.isReady();
const hasFilenameParts = Boolean((inFile instanceof EmbeddedFile) && inFile.filenameparts);
const filenameParts = hasFilenameParts ? (inFile as EmbeddedFile).filenameparts : null;
const cacheKey:ImageKey = {
filepath: file.path,
blockref: null,
sectionref: null,
...hasFilenameParts? {
...filenameParts,
inlineFonts: !exportSettings.skipInliningFonts,
}: {
filepath: file.path,
hasBlockref: false,
hasGroupref: false,
hasTaskbone: false,
hasArearef: false,
hasFrameref: false,
hasClippedFrameref: false,
hasSectionref: false,
inlineFonts: !exportSettings.skipInliningFonts,
blockref: null,
sectionref: null,
linkpartReference: null,
linkpartAlias: null,
},
isDark,
previewImageType: PreviewImageType.SVG,
scale: 1,
isTransparent: !exportSettings.withBackground,
hasBlockref: false,
hasGroupref: false,
hasTaskbone: false,
hasArearef: false,
hasFrameref: false,
hasSectionref: false,
linkpartReference: null,
linkpartAlias: null,
}
const maybeSVG = shouldUseCache
@@ -390,9 +398,17 @@ export class EmbeddedFilesLoader {
? maybeSVG
: replaceSVGColors(
await createSVG(
file?.path,
hasFilenameParts
? (filenameParts.hasGroupref || filenameParts.hasBlockref ||
filenameParts.hasSectionref || filenameParts.hasFrameref ||
filenameParts.hasClippedFrameref
? filenameParts.filepath + filenameParts.linkpartReference
: file.path)
: file?.path,
false, //false
exportSettings,
hasFilenameParts && filenameParts.hasClippedFrameref
? {...exportSettings, frameRendering: {enabled: true, name: false, outline: false, clip: true}}
: exportSettings,
this,
forceTheme,
null,
@@ -429,16 +445,16 @@ export class EmbeddedFilesLoader {
//see svgWithFont below
imageCache.addImageToCache(cacheKey,"", svg);
}
const svgWithFont = embedFontsInSVG(svg, this.plugin);
if(!svgWithFont.hasAttribute("width") && svgWithFont.hasAttribute("viewBox")){
if(!svg.hasAttribute("width") && svg.hasAttribute("viewBox")){
//2024.06.09
//this addresses backward compatibility issues where the cache does not have the width and height attributes
//this should be removed in the future
const vb = svgWithFont.getAttr("viewBox").split(" ");
Boolean(vb[2]) && svgWithFont.setAttribute("width", vb[2]);
Boolean(vb[3]) && svgWithFont.setAttribute("height", vb[3]);
const vb = svg.getAttr("viewBox").split(" ");
Boolean(vb[2]) && svg.setAttribute("width", vb[2]);
Boolean(vb[3]) && svg.setAttribute("height", vb[3]);
}
const dURL = svgToBase64(svgWithFont.outerHTML) as DataURL;
const dURL = svgToBase64(svg.outerHTML) as DataURL;
return {dataURL: dURL as DataURL, hasSVGwithBitmap};
};
@@ -556,7 +572,8 @@ export class EmbeddedFilesLoader {
return {
mimeType,
fileId: await generateIdFromFile(
isHyperLink || isPDF ? (new TextEncoder()).encode(dataURL as string) : ab
isHyperLink || isPDF ? (new TextEncoder()).encode(dataURL as string) : ab,
inFile instanceof EmbeddedFile ? inFile.filenameparts?.linkpartReference : undefined
),
dataURL,
created: isHyperLink || isLocalLink ? 0 : file.stat.mtime,
@@ -799,13 +816,29 @@ export class EmbeddedFilesLoader {
}
switch (fontName) {
case "Virgil":
fontDef = VIRGIL_FONT;
fontDef = await getFontDefinition(1);
break;
case "Cascadia":
fontDef = CASCADIA_FONT;
fontDef = await getFontDefinition(3);
break;
case "Assistant":
fontDef = ASSISTANT_FONT;
case "Assistant":
case "Helvetica":
fontDef = await getFontDefinition(2);
break;
case "Excalifont":
fontDef = await getFontDefinition(5);
break;
case "Nunito":
fontDef = await getFontDefinition(6);
break;
case "Lilita One":
fontDef = await getFontDefinition(7);
break;
case "Comic Shanns":
fontDef = await getFontDefinition(8);
break;
case "Liberation Sans":
fontDef = await getFontDefinition(9);
break;
case "":
fontDef = "";
@@ -1005,7 +1038,7 @@ const getSVGData = async (app: App, file: TFile, colorMap: ColorMap | null): Pro
return svgToBase64(svg) as DataURL;
};
export const generateIdFromFile = async (file: ArrayBuffer): Promise<FileId> => {
/*export const generateIdFromFile = async (file: ArrayBuffer): Promise<FileId> => {
let id: FileId;
try {
const hashBuffer = await window.crypto.subtle.digest("SHA-1", file);
@@ -1020,4 +1053,37 @@ export const generateIdFromFile = async (file: ArrayBuffer): Promise<FileId> =>
id = fileid() as FileId;
}
return id;
};*/
export const generateIdFromFile = async (file: ArrayBuffer, key?: string): Promise<FileId> => {
let id: FileId;
try {
// Convert the file ArrayBuffer to a Uint8Array
const fileArray = new Uint8Array(file);
// If a key is provided, concatenate it to the file data
let dataToHash: Uint8Array;
if (key) {
const encoder = new TextEncoder();
const keyArray = encoder.encode(key);
dataToHash = new Uint8Array(fileArray.length + keyArray.length);
dataToHash.set(fileArray);
dataToHash.set(keyArray, fileArray.length);
} else {
dataToHash = fileArray;
}
// Hash the combined data (file and key, if provided)
const hashBuffer = await window.crypto.subtle.digest("SHA-1", dataToHash);
id =
// Convert buffer to byte array
Array.from(new Uint8Array(hashBuffer))
// Convert to hex string
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("") as FileId;
} catch (error) {
errorlog({ where: "EmbeddedFileLoader.generateIdFromFile", error });
id = fileid() as FileId;
}
return id;
};
+59 -41
View File
@@ -27,7 +27,7 @@ import {
GITHUB_RELEASES,
determineFocusDistance,
getCommonBoundingBox,
getDefaultLineHeight,
getLineHeight,
getMaximumGroups,
intersectElementWithLine,
measureText,
@@ -37,11 +37,11 @@ import {
THEME_FILTER,
mermaidToExcalidraw,
refreshTextDimensions,
getFontFamilyString,
} from "src/constants/constants";
import { blobToBase64, checkAndCreateFolder, getDrawingFilename, getExcalidrawEmbeddedFilesFiletree, getListOfTemplateFiles, getNewUniqueFilepath, hasExcalidrawEmbeddedImagesTreeChanged, } from "src/utils/FileUtils";
import {
//debug,
embedFontsInSVG,
errorlog,
getEmbeddedFilenameParts,
getImageSize,
@@ -61,7 +61,7 @@ import { tex2dataURL } from "src/LaTeX";
import { GenericInputPrompt, NewFileActions } from "src/dialogs/Prompt";
import { t } from "src/lang/helpers";
import { ScriptEngine } from "src/Scripts";
import { ConnectionPoint, DeviceType } from "src/types";
import { ConnectionPoint, DeviceType } from "src/types/types";
import CM, { ColorMaster, extendPlugins } from "colormaster";
import HarmonyPlugin from "colormaster/plugins/harmony";
import MixPlugin from "colormaster/plugins/mix"
@@ -92,7 +92,7 @@ import {
import { EXCALIDRAW_AUTOMATE_INFO, EXCALIDRAW_SCRIPTENGINE_INFO } from "./dialogs/SuggesterInfo";
import { addBackOfTheNoteCard, getFrameBasedOnFrameNameOrId } from "./utils/ExcalidrawViewUtils";
import { log } from "./utils/DebugHelper";
import { auto } from "@popperjs/core";
import { ExcalidrawLib } from "./ExcalidrawLib";
extendPlugins([
HarmonyPlugin,
@@ -112,6 +112,7 @@ extendPlugins([
declare const PLUGIN_VERSION:string;
declare var LZString: any;
declare const excalidrawLib: typeof ExcalidrawLib;
const GAP = 4;
@@ -387,7 +388,7 @@ export class ExcalidrawAutomate {
opacity: number;
strokeSharpness?: StrokeRoundness; //defaults to undefined, use strokeRoundess and roundess instead. Only kept for legacy script compatibility type StrokeRoundness = "round" | "sharp"
roundness: null | { type: RoundnessType; value?: number };
fontFamily: number; //1: Virgil, 2:Helvetica, 3:Cascadia, 4:LocalFont
fontFamily: number; //1: Virgil, 2:Helvetica, 3:Cascadia, 4:Local Font
fontSize: number;
textAlign: string; //"left"|"right"|"center"
verticalAlign: string; //"top"|"bottom"|"middle" :for future use, has no effect currently
@@ -1192,7 +1193,7 @@ export class ExcalidrawAutomate {
element.text,
element.fontSize,
element.fontFamily,
getDefaultLineHeight(element.fontFamily)
getLineHeight(element.fontFamily)
);
element.width = w;
element.height = h;
@@ -1237,7 +1238,7 @@ export class ExcalidrawAutomate {
text,
this.style.fontSize,
this.style.fontFamily,
getDefaultLineHeight(this.style.fontFamily)
getLineHeight(this.style.fontFamily)
);
const width = formatting?.width ? formatting.width : w;
const height = formatting?.height ? formatting.height : h;
@@ -1295,7 +1296,7 @@ export class ExcalidrawAutomate {
containerId: isContainerBound ? boxId : null,
originalText: isContainerBound ? originalText : text,
rawText: isContainerBound ? originalText : text,
lineHeight: getDefaultLineHeight(this.style.fontFamily),
lineHeight: getLineHeight(this.style.fontFamily),
autoResize: formatting?.box ? true : (formatting?.autoResize ?? true),
};
if (boxId && formatting?.box === "blob") {
@@ -1996,7 +1997,7 @@ export class ExcalidrawAutomate {
appState: {
viewModeEnabled: !isFullscreen,
},
storeAction: "none",
storeAction: "update",
});
this.targetView.toolsPanelRef?.current?.setExcalidrawViewMode(!isFullscreen);
}
@@ -2015,7 +2016,7 @@ export class ExcalidrawAutomate {
return;
}
const view = this.targetView as ExcalidrawView;
view.updateScene({appState:{viewModeEnabled: enabled}});
view.updateScene({appState:{viewModeEnabled: enabled}, storeAction: "update"});
view.toolsPanelRef?.current?.setExcalidrawViewMode(enabled);
}
@@ -2041,7 +2042,7 @@ export class ExcalidrawAutomate {
return;
}
if (!Boolean(scene.storeAction)) {
scene.storeAction = scene.commitToHistory ? "capture" : "none";
scene.storeAction = scene.commitToHistory ? "capture" : "update";
}
this.targetView.updateScene({
@@ -2417,13 +2418,19 @@ export class ExcalidrawAutomate {
/**
* Gets all the elements from elements[] that are contained in the frame.
* @param element
* @param elements - typically all the non-deleted elements in the scene
* @param frameElement - the frame element for which to get the elements
* @param elements - typically all the non-deleted elements in the scene
* @param shouldIncludeFrame - if true, the frame element will be included in the returned array
* this is useful when generating an image in which you want the frame to be clipped
* @returns
*/
getElementsInFrame(frameElement: ExcalidrawElement, elements: ExcalidrawElement[]): ExcalidrawElement[] {
getElementsInFrame(
frameElement: ExcalidrawElement,
elements: ExcalidrawElement[],
shouldIncludeFrame: boolean = false,
): ExcalidrawElement[] {
if(!frameElement || !elements || frameElement.type !== "frame") return [];
return elements.filter(el=>el.frameId === frameElement.id);
return elements.filter(el=>(el.frameId === frameElement.id) || (shouldIncludeFrame && el.id === frameElement.id));
}
/**
@@ -2489,7 +2496,7 @@ export class ExcalidrawAutomate {
text,
this.style.fontSize,
this.style.fontFamily,
getDefaultLineHeight(this.style.fontFamily),
getLineHeight(this.style.fontFamily),
);
return { width: size.w ?? 0, height: size.h ?? 0 };
};
@@ -2702,6 +2709,20 @@ export class ExcalidrawAutomate {
this.copyViewElementsToEAforEditing(res.content);
return true;
}
destroy(): void {
this.targetView = null;
this.plugin = null;
this.elementsDict = {};
this.imagesDict = {};
this.mostRecentMarkdownSVG = null;
this.activeScript = null;
//@ts-ignore
this.style = {};
//@ts-ignore
this.canvas = {};
this.colorPalette = {};
}
};
export async function initExcalidrawAutomate(
@@ -2714,10 +2735,6 @@ export async function initExcalidrawAutomate(
return ea;
}
export function destroyExcalidrawAutomate() {
delete window.ExcalidrawAutomate;
}
function normalizeLinePoints(
points: [x: number, y: number][],
//box: { x: number; y: number; w: number; h: number },
@@ -2741,22 +2758,15 @@ function getLineBox(points: [x: number, y: number][]) {
}
function getFontFamily(id: number) {
switch (id) {
case 1:
return "Virgil, Segoe UI Emoji";
case 2:
return "Helvetica, Segoe UI Emoji";
case 3:
return "Cascadia, Segoe UI Emoji";
case 4:
return "LocalFont";
}
getFontFamilyString({fontFamily:id})
}
async function initFonts() {
for (let i = 1; i <= 3; i++) {
await (document as any).fonts.load(`20px ${getFontFamily(i)}`);
}
export async function initFonts() {
await excalidrawLib.registerFontsInCSS();
const fonts = excalidrawLib.getFontFamilies();
for(let i=0;i<fonts.length;i++) {
if(fonts[i] !== "Local Font") await (document as any).fonts.load(`16px ${fonts[i]}`);
};
}
export function _measureText(
@@ -2771,7 +2781,7 @@ export function _measureText(
}
if (!fontFamily) {
fontFamily = 1;
lineHeight = getDefaultLineHeight(fontFamily);
lineHeight = getLineHeight(fontFamily);
}
const metrics = measureText(
newText,
@@ -2866,15 +2876,14 @@ async function getTemplate(
groupElements = plugin.ea.getElementsInTheSameGroupWithElement(el[0],scene.elements)
}
}
if(filenameParts.hasFrameref) {
if(filenameParts.hasFrameref || filenameParts.hasClippedFrameref) {
const el = getFrameBasedOnFrameNameOrId(filenameParts.blockref,scene.elements);
if(el) {
groupElements = plugin.ea.getElementsInFrame(el,scene.elements)
groupElements = plugin.ea.getElementsInFrame(el,scene.elements, filenameParts.hasClippedFrameref);
}
}
if(filenameParts.hasTaskbone) {
groupElements = groupElements.filter( el =>
el.type==="freedraw" ||
@@ -2883,6 +2892,7 @@ async function getTemplate(
));
}
excalidrawData.destroy();
return {
elements: convertMarkdownLinksToObsidianURLs
? updateElementLinksToObsidianLinks({
@@ -2951,6 +2961,7 @@ export async function createPNG(
theme: forceTheme ?? template?.appState?.theme ?? canvasTheme,
viewBackgroundColor:
template?.appState?.viewBackgroundColor ?? canvasBackgroundColor,
...template?.appState?.frameRendering ? {frameRendering: template.appState.frameRendering} : {},
},
files,
},
@@ -3030,6 +3041,9 @@ export async function createSVG(
if (!loader) {
loader = new EmbeddedFilesLoader(plugin);
}
if(typeof exportSettings.skipInliningFonts === "undefined") {
exportSettings.skipInliningFonts = !embedFont;
}
const template = templatePath
? await getTemplate(plugin, templatePath, true, loader, depth, convertMarkdownLinksToObsidianURLs)
: null;
@@ -3046,6 +3060,7 @@ export async function createSVG(
const theme = forceTheme ?? template?.appState?.theme ?? canvasTheme;
const withTheme = exportSettings?.withTheme ?? plugin.settings.exportWithTheme;
const filenameParts = getEmbeddedFilenameParts(templatePath);
const svg = await getSVG(
{
//createAndOpenDrawing
@@ -3057,6 +3072,7 @@ export async function createSVG(
theme,
viewBackgroundColor:
template?.appState?.viewBackgroundColor ?? canvasBackgroundColor,
...template?.appState?.frameRendering ? {frameRendering: template.appState.frameRendering} : {},
},
files,
},
@@ -3065,6 +3081,9 @@ export async function createSVG(
exportSettings?.withBackground ?? plugin.settings.exportWithBackground,
withTheme,
isMask: exportSettings?.isMask ?? false,
...filenameParts?.hasClippedFrameref
? {frameRendering: {enabled: true, name: false, outline: false, clip: true}}
: {},
},
padding,
null,
@@ -3072,9 +3091,8 @@ export async function createSVG(
if (withTheme && theme === "dark") addFilterToForeignObjects(svg);
const filenameParts = getEmbeddedFilenameParts(templatePath);
if(
!(filenameParts.hasGroupref || filenameParts.hasFrameref) &&
!(filenameParts.hasGroupref || filenameParts.hasFrameref || filenameParts.hasClippedFrameref) &&
(filenameParts.hasBlockref || filenameParts.hasSectionref)
) {
let el = filenameParts.hasSectionref
@@ -3096,7 +3114,7 @@ export async function createSVG(
if (template?.hasSVGwithBitmap) {
svg.setAttribute("hasbitmap", "true");
}
return embedFont ? embedFontsInSVG(svg, plugin) : svg;
return svg;
}
function estimateLineBound(points: any): [number, number, number, number] {
+26 -4
View File
@@ -11,7 +11,7 @@ import {
fileid,
DEVICE,
EMBEDDABLE_THEME_FRONTMATTER_VALUES,
getDefaultLineHeight,
getLineHeight,
ERROR_IFRAME_CONVERSION_CANCELED,
JSON_parse,
FRONTMATTER_KEYS,
@@ -438,12 +438,34 @@ export class ExcalidrawData {
constructor(
private plugin: ExcalidrawPlugin,
) {
this.app = plugin.app;
this.app = this.plugin.app;
this.files = new Map<FileId, EmbeddedFile>();
this.equations = new Map<FileId, { latex: string; isLoaded: boolean }>();
this.mermaids = new Map<FileId, { mermaid: string; isLoaded: boolean }>();
}
public destroy() {
this.textElements = null;
this.scene = null;
this.deletedElements = [];
this.file = null;
this.app = null;
this.showLinkBrackets = null;
this.linkPrefix = null;
this.embeddableTheme = null;
this.urlPrefix = null;
this.autoexportPreference = null;
this.textMode = null;
this.loaded = false;
this.elementLinks = null;
this.files = null;
this.equations = null;
this.mermaids = null;
this.compatibilityMode = null;
this.textElementCommentedOut = null;
this.selectedElementIds = null;
}
/**
* 1.5.4: for backward compatibility following the release of container bound text elements and the depreciation boundElementIds field
*/
@@ -527,7 +549,7 @@ export class ExcalidrawData {
}
if (el.type === "text" && !el.hasOwnProperty("lineHeight")) {
el.lineHeight = getDefaultLineHeight(el.fontFamily);
el.lineHeight = getLineHeight(el.fontFamily);
}
if (el.type === "image" && !el.hasOwnProperty("roundness")) {
@@ -865,7 +887,7 @@ export class ExcalidrawData {
? data.substring(indexOfNewEmbeddedFiles + embeddedFilesNewLength)
: data.substring(indexOfOldEmbeddedFiles + embeddedFilesOldLength);
//Load Embedded files
const REG_FILEID_FILEPATH = /([\w\d]*):\s*\[\[([^\]]*)]]\s*(\{[^}]*})?\n/gm;
const REG_FILEID_FILEPATH = /([\w\d]*):\s*\!?\[\[([^\]]*)]]\s*(\{[^}]*})?\n/gm;
res = data.matchAll(REG_FILEID_FILEPATH);
while (!(parts = res.next()).done) {
const embeddedFile = new EmbeddedFile(
+26 -4
View File
@@ -2,7 +2,8 @@ import { RestoredDataState } from "@zsviczian/excalidraw/types/excalidraw/data/r
import { ImportedDataState } from "@zsviczian/excalidraw/types/excalidraw/data/types";
import { BoundingBox } from "@zsviczian/excalidraw/types/excalidraw/element/bounds";
import { ElementsMap, ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawFrameElement, ExcalidrawTextContainer, ExcalidrawTextElement, FontFamilyValues, FontString, NonDeleted, NonDeletedExcalidrawElement, Theme } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { AppState, BinaryFiles, ExportOpts, Point, Zoom } from "@zsviczian/excalidraw/types/excalidraw/types";
import { FontMetadata } from "@zsviczian/excalidraw/types/excalidraw/fonts/metadata";
import { AppState, BinaryFiles, Point, Zoom } from "@zsviczian/excalidraw/types/excalidraw/types";
import { Mutable } from "@zsviczian/excalidraw/types/excalidraw/utility-types";
type EmbeddedLink =
@@ -46,6 +47,7 @@ declare namespace ExcalidrawLib {
exportPadding?: number;
exportingFrame: ExcalidrawFrameElement | null | undefined;
renderEmbeddables?: boolean;
skipInliningFonts?: boolean;
}): Promise<SVGSVGElement>;
function sceneCoordsToViewportCoords(
@@ -116,8 +118,7 @@ declare namespace ExcalidrawLib {
lineHeight: number,
): { width: number; height: number; };
function getDefaultLineHeight(fontFamily: FontFamilyValues): number;
function getLineHeight (fontFamily: FontFamilyValues):number;
function wrapText(text: string, font: FontString, maxWidth: number): string;
function getFontString({
@@ -128,6 +129,13 @@ declare namespace ExcalidrawLib {
fontFamily: FontFamilyValues;
}): FontString;
function getFontFamilyString ({
fontFamily,
}: {
fontFamily: number;
}): string;
function getBoundTextMaxWidth(container: ExcalidrawElement): number;
function exportToBlob(
@@ -155,4 +163,18 @@ declare namespace ExcalidrawLib {
files?: any;
error?: string;
} | undefined>;
}
var getSceneVersion: any;
var Excalidraw: any;
var MainMenu: any;
var WelcomeScreen: any;
var TTDDialogTrigger: any;
var TTDDialog: any;
function destroyObsidianUtils(): void;
function registerLocalFont(fontMetrics: FontMetadata, uri: string): void;
function getFontFamilies(): string[];
function registerFontsInCSS(): Promise<void>;
function getFontDefinition(fontFamily: number): Promise<string>;
}
+1171 -891
View File
File diff suppressed because it is too large. Load diff
+9 -5
View File
@@ -7,21 +7,18 @@ import {RegisterHTMLHandler} from 'mathjax-full/js/handlers/html.js';
import {AllPackages} from 'mathjax-full/js/input/tex/AllPackages.js';
import ExcalidrawView from "./ExcalidrawView";
import ExcalidrawPlugin from "./main";
import { FileData, MimeType } from "./EmbeddedFileLoader";
import { FileId } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { getImageSize, svgToBase64 } from "./utils/Utils";
import { fileid } from "./constants/constants";
import { TFile } from "obsidian";
import { MathDocument } from "mathjax-full/js/core/MathDocument";
import { stripVTControlCharacters } from "util";
export const updateEquation = async (
equation: string,
fileId: string,
view: ExcalidrawView,
addFiles: Function,
plugin: ExcalidrawPlugin,
) => {
const data = await tex2dataURL(equation);
if (data) {
@@ -40,11 +37,15 @@ export const updateEquation = async (
};
let adaptor: LiteAdaptor;
let input: TeX<unknown, unknown, unknown>;
let output: SVG<unknown, unknown, unknown>;
let html: MathDocument<any, any, any>;
let preamble: string;
export const clearMathJaxVariables = () => {
adaptor = null;
html = null;
preamble = null;
};
//https://github.com/xldenis/obsidian-latex/blob/master/main.ts
const loadPreamble = async () => {
const file = app.vault.getAbstractFileByPath("preamble.sty");
@@ -63,6 +64,9 @@ export async function tex2dataURL(
created: number;
size: { height: number; width: number };
}> {
let input: TeX<unknown, unknown, unknown>;
let output: SVG<unknown, unknown, unknown>;
if(!adaptor) {
await loadPreamble();
adaptor = liteAdaptor();
+51 -23
View File
@@ -12,7 +12,6 @@ import { ExportSettings } from "./ExcalidrawView";
import ExcalidrawPlugin from "./main";
import {getIMGFilename,} from "./utils/FileUtils";
import {
embedFontsInSVG,
getEmbeddedFilenameParts,
getExportTheme,
getQuickImagePreview,
@@ -86,7 +85,14 @@ const _getPNG = async ({imgAttributes,filenameParts,theme,cacheReady,img,file,ex
? 2
: 1;
const cacheKey = {...filenameParts, isDark: theme==="dark", previewImageType: PreviewImageType.PNG, scale, isTransparent: !exportSettings.withBackground};
const cacheKey = {
...filenameParts,
isDark: theme==="dark",
previewImageType: PreviewImageType.PNG,
scale,
isTransparent: !exportSettings.withBackground,
inlineFonts: true, //though for PNG this makes no difference, but the key requires it
};
if(cacheReady) {
const src = await imageCache.getImageFromCache(cacheKey);
@@ -105,11 +111,13 @@ const _getPNG = async ({imgAttributes,filenameParts,theme,cacheReady,img,file,ex
const png =
quickPNG ??
(await createPNG(
(filenameParts.hasGroupref || filenameParts.hasFrameref)
(filenameParts.hasGroupref || filenameParts.hasFrameref || filenameParts.hasClippedFrameref)
? filenameParts.filepath + filenameParts.linkpartReference
: file.path,
scale,
exportSettings,
filenameParts.hasClippedFrameref
? { ...exportSettings, frameRendering: { enabled: true, name: false, outline: false, clip: true}}
: exportSettings,
loader,
theme,
null,
@@ -163,7 +171,16 @@ const _getSVGIMG = async ({filenameParts,theme,cacheReady,img,file,exportSetting
exportSettings: ExportSettings,
loader: EmbeddedFilesLoader,
}):Promise<HTMLImageElement> => {
const cacheKey = {...filenameParts, isDark: theme==="dark", previewImageType: PreviewImageType.SVGIMG, scale:1, isTransparent: !exportSettings.withBackground};
exportSettings.skipInliningFonts = false;
const cacheKey = {
...filenameParts,
isDark: theme==="dark",
previewImageType: PreviewImageType.SVGIMG,
scale:1,
isTransparent: !exportSettings.withBackground,
inlineFonts: !exportSettings.skipInliningFonts,
};
if(cacheReady) {
const src = await imageCache.getImageFromCache(cacheKey);
if(src && typeof src === "string") {
@@ -182,13 +199,15 @@ const _getSVGIMG = async ({filenameParts,theme,cacheReady,img,file,exportSetting
}
}
let svg = convertSVGStringToElement((
const svg = convertSVGStringToElement((
await createSVG(
filenameParts.hasGroupref || filenameParts.hasBlockref || filenameParts.hasSectionref || filenameParts.hasFrameref
filenameParts.hasGroupref || filenameParts.hasBlockref || filenameParts.hasSectionref || filenameParts.hasFrameref || filenameParts.hasClippedFrameref
? filenameParts.filepath + filenameParts.linkpartReference
: file.path,
true,
exportSettings,
filenameParts?.hasClippedFrameref
? { ...exportSettings, frameRendering: { enabled: true, name: false, outline: false, clip: true}}
: exportSettings,
loader,
theme,
null,
@@ -204,7 +223,6 @@ const _getSVGIMG = async ({filenameParts,theme,cacheReady,img,file,exportSetting
return null;
}
svg = embedFontsInSVG(svg, plugin, false);
//need to remove width and height attributes to support area= embeds
svg.removeAttribute("width");
svg.removeAttribute("height");
@@ -220,20 +238,30 @@ const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,fi
exportSettings: ExportSettings,
loader: EmbeddedFilesLoader,
}):Promise<HTMLDivElement> => {
const cacheKey = {...filenameParts, isDark: theme==="dark", previewImageType: PreviewImageType.SVG, scale:1, isTransparent: !exportSettings.withBackground};
exportSettings.skipInliningFonts = false;
const cacheKey = {
...filenameParts,
isDark: theme==="dark",
previewImageType: PreviewImageType.SVG,
scale:1,
isTransparent: !exportSettings.withBackground,
inlineFonts: !exportSettings.skipInliningFonts,
};
let maybeSVG;
if(cacheReady) {
maybeSVG = await imageCache.getImageFromCache(cacheKey);
}
let svg = (maybeSVG && (maybeSVG instanceof SVGSVGElement))
const svg = (maybeSVG && (maybeSVG instanceof SVGSVGElement))
? maybeSVG
: convertSVGStringToElement((await createSVG(
filenameParts.hasGroupref || filenameParts.hasBlockref || filenameParts.hasSectionref || filenameParts.hasFrameref
filenameParts.hasGroupref || filenameParts.hasBlockref || filenameParts.hasSectionref || filenameParts.hasFrameref || filenameParts.hasClippedFrameref
? filenameParts.filepath + filenameParts.linkpartReference
: file.path,
false,
exportSettings,
filenameParts.hasClippedFrameref
? { ...exportSettings, frameRendering: { enabled: true, name: false, outline: false, clip: true}}
: exportSettings,
loader,
theme,
null,
@@ -254,7 +282,7 @@ const _getSVGNative = async ({filenameParts,theme,cacheReady,containerElement,fi
if(!Boolean(maybeSVG)) {
cacheReady && imageCache.addImageToCache(cacheKey,"", svg);
}
svg = embedFontsInSVG(svg, plugin, true);
svg.removeAttribute("width");
svg.removeAttribute("height");
containerElement.append(svg);
@@ -361,7 +389,7 @@ const createImgElement = async (
imgOrDiv.setAttribute("draggable","false");
imgOrDiv.setAttribute("onCanvas",onCanvas?"true":"false");
let timer:NodeJS.Timeout;
let timer:number;
const clickEvent = (ev:PointerEvent) => {
if(!(ev.target instanceof Element)) {
return;
@@ -414,7 +442,7 @@ const createImgElement = async (
eventElement.addEventListener("pointermove",(ev)=>{
if(!timer) return;
if(Math.abs(ev.screenX-pointerDownEvent.screenX)>10 || Math.abs(ev.screenY-pointerDownEvent.screenY)>10) {
clearTimeout(timer);
window.clearTimeout(timer);
timer = null;
}
});
@@ -423,11 +451,11 @@ const createImgElement = async (
//@ts-ignore
const PLUGIN = app.plugins.plugins["obsidian-excalidraw-plugin"] as ExcalidrawPlugin;
const timeoutValue = DEVICE.isDesktop ? PLUGIN.settings.longPressDesktop : PLUGIN.settings.longPressMobile;
timer = setTimeout(()=>clickEvent(ev),timeoutValue);
timer = window.setTimeout(()=>clickEvent(ev),timeoutValue);
pointerDownEvent = ev;
});
eventElement.addEventListener("pointerup",()=>{
if(timer) clearTimeout(timer);
if(timer) window.clearTimeout(timer);
timer = null;
})
eventElement.addEventListener("dblclick",clickEvent);
@@ -571,7 +599,7 @@ const isTextOnlyEmbed = (internalEmbedEl: Element):boolean => {
const src = internalEmbedEl.getAttribute("src");
if(!src) return true; //technically this does not mean this is a text only embed, but still should abort further processing
const fnameParts = getEmbeddedFilenameParts(src);
return !(fnameParts.hasArearef || fnameParts.hasGroupref || fnameParts.hasFrameref) &&
return !(fnameParts.hasArearef || fnameParts.hasGroupref || fnameParts.hasFrameref || fnameParts.hasClippedFrameref) &&
(fnameParts.hasBlockref || fnameParts.hasSectionref)
}
@@ -661,7 +689,7 @@ const tmpObsidianWYSIWYG = async (
} else {
const warningEl = el.querySelector("div>h3[data-heading^='Unable to find section #^");
if(warningEl) {
const ref = warningEl.getAttr("data-heading").match(/Unable to find section (#\^(?:group=|area=|frame=)[^ ]*)/)?.[1];
const ref = warningEl.getAttr("data-heading").match(/Unable to find section (#\^(?:group=|area=|frame=|clippedframe=)[^ ]*)/)?.[1];
if(ref) {
attr.fname = file.path + ref;
areaPreview = true;
@@ -711,15 +739,15 @@ const tmpObsidianWYSIWYG = async (
internalEmbedDiv.appendChild(imgDiv);
//timer to avoid the image flickering when the user is typing
let timer: NodeJS.Timeout = null;
let timer: number = null;
const markdownObserverFn: MutationCallback = (m) => {
if (!["alt", "width", "height"].contains(m[0]?.attributeName)) {
return;
}
if (timer) {
clearTimeout(timer);
window.clearTimeout(timer);
}
timer = setTimeout(async () => {
timer = window.setTimeout(async () => {
timer = null;
internalEmbedDiv.empty();
const imgDiv = await processInternalEmbed(internalEmbedDiv,file);
+89 -56
View File
@@ -12,6 +12,8 @@ import { ButtonDefinition, GenericInputPrompt, GenericSuggester } from "./dialog
import { getIMGFilename } from "./utils/FileUtils";
import { splitFolderAndFilename } from "./utils/FileUtils";
import { getEA } from "src";
import { ExcalidrawAutomate } from "./ExcalidrawAutomate";
import { WeakArray } from "./utils/WeakArray";
export type ScriptIconMap = {
[key: string]: { name: string; group: string; svgString: string };
@@ -22,6 +24,7 @@ export class ScriptEngine {
private scriptPath: string;
//https://stackoverflow.com/questions/60218638/how-to-force-re-render-if-map-value-changes
public scriptIconMap: ScriptIconMap;
eaInstances = new WeakArray<ExcalidrawAutomate>();
constructor(plugin: ExcalidrawPlugin) {
this.plugin = plugin;
@@ -30,65 +33,95 @@ export class ScriptEngine {
this.registerEventHandlers();
}
registerEventHandlers() {
const handleSvgFileChange = (path: string) => {
if (!path.endsWith(".svg")) {
return;
public removeViewEAs(view: ExcalidrawView) {
const eas = new Set<ExcalidrawAutomate>();
this.eaInstances.forEach((ea) => {
if (ea.targetView === view) {
eas.add(ea);
ea.destroy();
}
const scriptFile = app.vault.getAbstractFileByPath(
getIMGFilename(path, "md"),
);
if (scriptFile && scriptFile instanceof TFile) {
this.unloadScript(this.getScriptName(scriptFile), scriptFile.path);
this.loadScript(scriptFile);
}
};
});
this.eaInstances.removeObjects(eas);
}
const deleteEventHandler = async (file: TFile) => {
if (!(file instanceof TFile)) {
return;
}
if (!file.path.startsWith(this.scriptPath)) {
return;
}
this.unloadScript(this.getScriptName(file), file.path);
handleSvgFileChange(file.path);
};
this.plugin.registerEvent(
app.vault.on("delete", deleteEventHandler),
public destroy() {
this.eaInstances.forEach((ea) => ea.destroy());
this.eaInstances.clear();
this.eaInstances = null;
this.scriptIconMap = null;
this.plugin = null;
this.scriptPath = null;
}
private handleSvgFileChange (path: string) {
if (!path.endsWith(".svg")) {
return;
}
const scriptFile = app.vault.getAbstractFileByPath(
getIMGFilename(path, "md"),
);
if (scriptFile && scriptFile instanceof TFile) {
this.unloadScript(this.getScriptName(scriptFile), scriptFile.path);
this.loadScript(scriptFile);
}
}
const createEventHandler = async (file: TFile) => {
if (!(file instanceof TFile)) {
return;
}
if (!file.path.startsWith(this.scriptPath)) {
return;
}
private async deleteEventHandler (file: TFile) {
if (!(file instanceof TFile)) {
return;
}
if (!file.path.startsWith(this.scriptPath)) {
return;
}
this.unloadScript(this.getScriptName(file), file.path);
this.handleSvgFileChange(file.path);
};
private async createEventHandler (file: TFile) {
if (!(file instanceof TFile)) {
return;
}
if (!file.path.startsWith(this.scriptPath)) {
return;
}
this.loadScript(file);
this.handleSvgFileChange(file.path);
};
private async renameEventHandler (file: TAbstractFile, oldPath: string) {
if (!(file instanceof TFile)) {
return;
}
const oldFileIsScript = oldPath.startsWith(this.scriptPath);
const newFileIsScript = file.path.startsWith(this.scriptPath);
if (oldFileIsScript) {
this.unloadScript(this.getScriptName(oldPath), oldPath);
this.handleSvgFileChange(oldPath);
}
if (newFileIsScript) {
this.loadScript(file);
handleSvgFileChange(file.path);
};
this.plugin.registerEvent(
app.vault.on("create", createEventHandler),
);
this.handleSvgFileChange(file.path);
}
}
const renameEventHandler = async (file: TAbstractFile, oldPath: string) => {
if (!(file instanceof TFile)) {
return;
}
const oldFileIsScript = oldPath.startsWith(this.scriptPath);
const newFileIsScript = file.path.startsWith(this.scriptPath);
if (oldFileIsScript) {
this.unloadScript(this.getScriptName(oldPath), oldPath);
handleSvgFileChange(oldPath);
}
if (newFileIsScript) {
this.loadScript(file);
handleSvgFileChange(file.path);
}
};
registerEventHandlers() {
this.plugin.registerEvent(
app.vault.on("rename", renameEventHandler),
this.plugin.app.vault.on(
"delete",
(file: TFile)=>this.deleteEventHandler(file)
),
);
this.plugin.registerEvent(
this.plugin.app.vault.on(
"create",
(file: TFile)=>this.createEventHandler(file)
),
);
this.plugin.registerEvent(
this.plugin.app.vault.on(
"rename",
(file: TAbstractFile, oldPath: string)=>this.renameEventHandler(file, oldPath)
),
);
}
@@ -215,6 +248,7 @@ export class ScriptEngine {
}
script = script.replace(/^---.*?---\n/gs, "");
const ea = getEA(view);
this.eaInstances.push(ea);
ea.activeScript = title;
//https://stackoverflow.com/questions/45381204/get-asyncfunction-constructor-in-typescript changed tsconfig to es2017
@@ -253,7 +287,7 @@ export class ScriptEngine {
instructions?: Instruction[],
) =>
ScriptEngine.suggester(
app,
this.plugin.app,
displayItems,
items,
hint,
@@ -265,13 +299,12 @@ export class ScriptEngine {
new Notice(t("SCRIPT_EXECUTION_ERROR"), 4000);
errorlog({ script: this.plugin.ea.activeScript, error: e });
}*/
//ea.activeScript = null;
return result;
return result;
}
private updateToolPannels() {
const leaves =
app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW);
this.plugin.app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW);
leaves.forEach((leaf: WorkspaceLeaf) => {
const excalidrawView = leaf.view as ExcalidrawView;
excalidrawView.toolsPanelRef?.current?.updateScriptIconMap(
-7
View File
@@ -1,7 +0,0 @@
export const FONTS_STYLE_ID = "excalidraw-fonts";
export const VIRGIL_DATAURL = `data:application/font-woff;charset=utf-8;base64,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 Line truncated
export const VIRGIL_FONT = ` @font-face {font-display: swap;font-family: "Virgil";src: url("${VIRGIL_DATAURL}") format("woff2");}`;
export const CASCADIA_FONT = ` @font-face {font-display: swap;font-family: "Cascadia";src: url("data:application/font-woff;charset=utf-8;base64,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 Line truncated
export const ASSISTANT_FONT = ` @font-face {font-display: swap;font-family: "Assistant";src: url("data:application/font-woff;charset=utf-8;base64,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 Line truncated
+6 -2
View File
@@ -1,5 +1,5 @@
import { customAlphabet } from "nanoid";
import { DeviceType } from "../types";
import { DeviceType } from "../types/types";
import { ExcalidrawLib } from "../ExcalidrawLib";
import { moment } from "obsidian";
import ExcalidrawPlugin from "src/main";
@@ -85,7 +85,7 @@ export const {
getCommonBoundingBox,
getMaximumGroups,
measureText,
getDefaultLineHeight,
getLineHeight,
wrapText,
getFontString,
getBoundTextMaxWidth,
@@ -94,10 +94,14 @@ export const {
mutateElement,
restore,
mermaidToExcalidraw,
getFontFamilyString,
getContainerElement,
refreshTextDimensions,
getFontDefinition,
} = excalidrawLib;
export const FONTS_STYLE_ID = "excalidraw-custom-fonts";
export function JSON_parse(x: string): any {
return JSON.parse(x.replaceAll("&#91;", "["));
}
+35 -25
View File
@@ -19,20 +19,22 @@ declare module "obsidian" {
}
}
const getTheme = (view: ExcalidrawView, theme:string): string => view.excalidrawData.embeddableTheme === "dark"
function getTheme (view: ExcalidrawView, theme:string): string {
return view.excalidrawData.embeddableTheme === "dark"
? "theme-dark"
: view.excalidrawData.embeddableTheme === "light"
? "theme-light"
: view.excalidrawData.embeddableTheme === "auto"
? theme === "dark" ? "theme-dark" : "theme-light"
: isObsidianThemeDark() ? "theme-dark" : "theme-light";
}
//--------------------------------------------------------------------------------
//Render webview for anything other than Vimeo and Youtube
//Vimeo and Youtube are rendered by Excalidraw because of the window messaging
//required to control the video
//--------------------------------------------------------------------------------
export const renderWebView = (src: string, view: ExcalidrawView, id: string, appState: UIAppState):JSX.Element =>{
export function renderWebView (src: string, view: ExcalidrawView, id: string, _: UIAppState):JSX.Element {
const isDataURL = src.startsWith("data:");
if(DEVICE.isDesktop && !isDataURL) {
return (
@@ -86,36 +88,36 @@ function RenderObsidianView(
if (!file) {
return null;
}
const react = view.plugin.getPackage(view.ownerWindow).react;
const React = view.packages.react;
//@ts-ignore
const leafRef = react.useRef<{leaf: WorkspaceLeaf; node?: ObsidianCanvasNode, editNode?: Function} | null>(null);
const isEditingRef = react.useRef(false);
const isActiveRef = react.useRef(false);
const themeRef = react.useRef(theme);
const elementRef = react.useRef(element);
const leafRef = React.useRef<{leaf: WorkspaceLeaf; node?: ObsidianCanvasNode, editNode?: Function} | null>(null);
const isEditingRef = React.useRef(false);
const isActiveRef = React.useRef(false);
const themeRef = React.useRef(theme);
const elementRef = React.useRef(element);
// Update themeRef when theme changes
react.useEffect(() => {
React.useEffect(() => {
themeRef.current = theme;
}, [theme]);
// Update elementRef when element changes
react.useEffect(() => {
React.useEffect(() => {
elementRef.current = element;
}, [element]);
//--------------------------------------------------------------------------------
//block propagation of events to the parent if the iframe element is active
//--------------------------------------------------------------------------------
const stopPropagation = react.useCallback((event:React.PointerEvent<HTMLElement>) => {
const stopPropagation = React.useCallback((event:React.PointerEvent<HTMLElement>) => {
if(isActiveRef.current) {
event.stopPropagation(); // Stop the event from propagating up the DOM tree
}
}, [isActiveRef.current]);
//runs once after mounting of the component and when the component is unmounted
react.useEffect(() => {
React.useEffect(() => {
if(!containerRef?.current) {
return;
}
@@ -134,7 +136,7 @@ function RenderObsidianView(
}, []);
//blocking or not the propagation of events to the parent if the iframe is active
react.useEffect(() => {
React.useEffect(() => {
EXTENDED_EVENT_TYPES.forEach((type) => containerRef.current.removeEventListener(type, stopPropagation));
if(!containerRef?.current) {
return;
@@ -156,7 +158,7 @@ function RenderObsidianView(
//--------------------------------------------------------------------------------
//Mount the workspace leaf or the canvas node depending on subpath
//--------------------------------------------------------------------------------
react.useEffect(() => {
React.useEffect(() => {
if(!containerRef?.current) {
return;
}
@@ -175,7 +177,7 @@ function RenderObsidianView(
rootSplit.containerEl.style.height = '100%';
rootSplit.containerEl.style.borderRadius = "var(--embeddable-radius)";
leafRef.current = {
leaf: app.workspace.createLeafInParent(rootSplit, 0),
leaf: view.app.workspace.createLeafInParent(rootSplit, 0),
node: null,
editNode: null,
};
@@ -221,20 +223,29 @@ function RenderObsidianView(
} else {
const workspaceLeaf:HTMLDivElement = rootSplit.containerEl.querySelector("div.workspace-leaf");
if(workspaceLeaf) workspaceLeaf.style.borderRadius = "var(--embeddable-radius)";
rootSplit.containerEl.addClass("mod-visible");
containerRef.current.appendChild(rootSplit.containerEl);
setColors(containerRef.current, element, mdProps, canvasColor);
}
patchMobileView(view);
view.updateEmbeddableLeafRef(element.id, leafRef.current);
})();
}
return () => {}; //cleanup on unmount
return () => {
if(!leafRef.current) {
return;
}
view.canvasNodeFactory.removeNode(leafRef.current.node);
leafRef.current.leaf?.detach();
leafRef.current = null;
}; //cleanup on unmount
}, [linkText, subpath, containerRef]);
//--------------------------------------------------------------------------------
//Set colors of the canvas node
//--------------------------------------------------------------------------------
const setColors = (canvasNode: HTMLDivElement, element: NonDeletedExcalidrawElement, mdProps: EmbeddableMDCustomProps, canvasColor: string) => {
function setColors (canvasNode: HTMLDivElement, element: NonDeletedExcalidrawElement, mdProps: EmbeddableMDCustomProps, canvasColor: string) {
if(!mdProps) return;
if (!leafRef.current?.hasOwnProperty("node")) return;
@@ -296,7 +307,7 @@ function RenderObsidianView(
//--------------------------------------------------------------------------------
//Set colors of the canvas node
//--------------------------------------------------------------------------------
react.useEffect(() => {
React.useEffect(() => {
if(!containerRef.current) {
return;
}
@@ -314,7 +325,7 @@ function RenderObsidianView(
//--------------------------------------------------------------------------------
//Switch to preview mode when the iframe is not active
//--------------------------------------------------------------------------------
react.useEffect(() => {
React.useEffect(() => {
if(isEditingRef.current) {
if(leafRef.current?.node) {
containerRef.current?.addClasses(["is-editing", "is-focused"]);
@@ -324,11 +335,10 @@ function RenderObsidianView(
}
}, [isEditingRef.current, leafRef]);
//--------------------------------------------------------------------------------
//Switch to edit mode when markdown view is clicked
//--------------------------------------------------------------------------------
const handleClick = react.useCallback((event?: React.PointerEvent<HTMLElement>) => {
const handleClick = React.useCallback((event?: React.PointerEvent<HTMLElement>) => {
if(isActiveRef.current) {
event?.stopPropagation();
}
@@ -361,7 +371,7 @@ function RenderObsidianView(
if(leafRef.current) leafRef.current.editNode = handleClick;
// Event listener for key press
react.useEffect(() => {
React.useEffect(() => {
const handleKeyPress = (event: KeyboardEvent) => {
if (event.key === "Enter") {
handleClick(event); // Call handleClick function when Enter key is pressed
@@ -378,7 +388,7 @@ function RenderObsidianView(
//--------------------------------------------------------------------------------
// Set isActiveRef and switch to preview mode when the iframe is not active
//--------------------------------------------------------------------------------
react.useEffect(() => {
React.useEffect(() => {
if(!containerRef?.current || !leafRef?.current) {
return;
}
@@ -426,8 +436,8 @@ function RenderObsidianView(
export const CustomEmbeddable: React.FC<{element: NonDeletedExcalidrawElement; view: ExcalidrawView; appState: UIAppState; linkText: string}> = ({ element, view, appState, linkText }) => {
const react = view.plugin.getPackage(view.ownerWindow).react;
const containerRef: React.RefObject<HTMLDivElement> = react.useRef(null);
const React = view.packages.react;
const containerRef: React.RefObject<HTMLDivElement> = React.useRef(null);
const theme = getTheme(view, appState.theme);
const mdProps: EmbeddableMDCustomProps = element.customData?.mdProps || null;
return (
+15 -11
View File
@@ -62,7 +62,6 @@ export class EmbeddableSettings extends Modal {
this.mdCustomData.borderColor = borderCM.stringHEX({alpha: false});
this.mdCustomData.borderOpacity = element.opacity;
}
}
onOpen(): void {
@@ -73,8 +72,16 @@ export class EmbeddableSettings extends Modal {
onClose() {
this.containerEl.removeEventListener("keydown",this.onKeyDown);
this.plugin = null;
this.view = null;
this.file = null;
this.element = null;
this.ea.destroy();
this.ea = null;
this.mdCustomData = null;
}
async createForm() {
this.contentEl.createEl("h1",{text: t("ES_TITLE")});
@@ -140,16 +147,14 @@ export class EmbeddableSettings extends Modal {
button
.setButtonText(t("PROMPT_BUTTON_CANCEL"))
.setTooltip("ESC")
.onClick(() => {
this.close();
})
.onClick(this.close.bind(this))
)
.addButton(button =>
button
.setButtonText(t("PROMPT_BUTTON_OK"))
.setTooltip("CTRL/Opt+Enter")
.setCta()
.onClick(()=>this.applySettings())
.onClick(this.applySettings.bind(this))
)
@@ -163,8 +168,6 @@ export class EmbeddableSettings extends Modal {
this.containerEl.ownerDocument.addEventListener("keydown",onKeyDown);
}
private async applySettings() {
let dirty = false;
const el = this.ea.getElement(this.element.id) as Mutable<ExcalidrawEmbeddableElement>;
@@ -181,7 +184,7 @@ export class EmbeddableSettings extends Modal {
new Notice("File rename failed. A file with this name already exists.\n"+newPath,10000);
} else {
try {
await this.app.vault.rename(this.file,newPath);
await this.app.fileManager.renameFile(this.file,newPath);
el.link = this.element.link.replace(
/(\[\[)([^#\]]*)([^\]]*]])/,`$1${
this.plugin.app.metadataCache.fileToLinktext(
@@ -223,11 +226,12 @@ export class EmbeddableSettings extends Modal {
(async() => {
await this.ea.addElementsToView();
//@ts-ignore
this.ea.viewUpdateScene({appState: {}});
this.ea.viewUpdateScene({appState: {}, storeAction: "update"});
this.close(); //close should only run once update scene is done
})();
} else {
this.close();
}
this.close();
};
}
+14 -1
View File
@@ -33,7 +33,7 @@ export class ExportDialog extends Modal {
private view: ExcalidrawView,
private file: TFile,
) {
super(app);
super(plugin.app);
this.ea = getEA(this.view);
this.api = this.ea.getExcalidrawAPI() as ExcalidrawImperativeAPI;
this.padding = getExportPadding(this.plugin,this.file);
@@ -47,6 +47,19 @@ export class ExportDialog extends Modal {
this.saveSettings = false;
}
destroy() {
this.app = null;
this.plugin = null;
this.ea.destroy();
this.ea = null;
this.view = null;
this.file = null;
this.api = null;
this.theme = null;
this.selectedOnlySetting = null;
this.containerEl.remove();
}
onOpen(): void {
this.containerEl.classList.add("excalidraw-release");
this.titleEl.setText(`Export Image`);
+10 -7
View File
@@ -11,7 +11,6 @@ import {
SuggestModal,
Scope,
} from "obsidian";
import { t } from "../lang/helpers";
import { createPopper, Instance as PopperInstance } from "@popperjs/core";
class Suggester<T> {
@@ -132,7 +131,7 @@ class Suggester<T> {
export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
items: T[] = [];
suggestions: HTMLDivElement[];
popper: PopperInstance;
popper: WeakRef<PopperInstance>;
//@ts-ignore
scope: Scope = new Scope(this.app.scope);
suggester: Suggester<FuzzyMatch<T>>;
@@ -197,7 +196,7 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
this.app.keymap.pushScope(this.scope);
this.inputEl.ownerDocument.body.appendChild(this.suggestEl);
this.popper = createPopper(this.inputEl, this.suggestEl, {
this.popper = new WeakRef(createPopper(this.inputEl, this.suggestEl, {
placement: "bottom-start",
modifiers: [
{
@@ -213,7 +212,7 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
},
},
],
});
}));
}
onEscape(): void {
@@ -225,11 +224,15 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
this.app.keymap.popScope(this.scope);
this.suggester.setSuggestions([]);
if (this.popper) {
this.popper.destroy();
if (this.popper?.deref()) {
this.popper.deref().destroy();
}
this.suggestEl.detach();
this.inputEl.removeEventListener("input", this.onInputChanged.bind(this));
this.inputEl.removeEventListener("focus", this.onFocus.bind(this));
this.inputEl.removeEventListener("blur", this.close.bind(this));
this.suggestEl.detach();
}
createPrompt(prompts: HTMLSpanElement[]) {
if (!this.promptEl) {
+83
View File
@@ -0,0 +1,83 @@
import { ExcalidrawAutomate } from "src/ExcalidrawAutomate";
import { t } from "src/lang/helpers";
export const showFrameSettings = (ea: ExcalidrawAutomate) => {
const {enabled, clip, name, outline} = ea.getExcalidrawAPI().getAppState().frameRendering;
// Create modal dialog
const frameSettingsModal = new ea.obsidian.Modal(app);
frameSettingsModal.onOpen = () => {
const {contentEl} = frameSettingsModal;
contentEl.createEl("h1", {text: t("FRAME_SETTINGS_TITLE")});
const settings = { enabled, clip, name, outline };
// Add toggles
const enableFramesSetting = new ea.obsidian.Setting(contentEl)
.setName(t("FRAME_SETTINGS_ENABLE"))
.addToggle(toggle => toggle
.setValue(settings.enabled)
.onChange(value => {
settings.enabled = value;
hideComponent(displayFrameNameSetting, !value);
hideComponent(displayFrameOutlineSetting, !value);
hideComponent(enableFrameClippingSetting, !value);
})
);
const displayFrameNameSetting = new ea.obsidian.Setting(contentEl)
.setName(t("FRAME_SETTIGNS_NAME"))
.addToggle(toggle => toggle
.setValue(settings.name)
.onChange(value => settings.name = value)
);
const displayFrameOutlineSetting = new ea.obsidian.Setting(contentEl)
.setName(t("FRAME_SETTINGS_OUTLINE"))
.addToggle(toggle => toggle
.setValue(settings.outline)
.onChange(value => settings.outline = value)
);
const enableFrameClippingSetting = new ea.obsidian.Setting(contentEl)
.setName(t("FRAME_SETTINGS_CLIP"))
.addToggle(toggle => toggle
.setValue(settings.clip)
.onChange(value => settings.clip = value)
);
// Hide or show components based on initial state
hideComponent(displayFrameNameSetting, !settings.enabled);
hideComponent(displayFrameOutlineSetting, !settings.enabled);
hideComponent(enableFrameClippingSetting, !settings.enabled);
// Add OK button
new ea.obsidian.Setting(contentEl)
.addButton(button => button
.setButtonText("OK")
.onClick(() => {
// Update appState with new settings
ea.viewUpdateScene({
// @ts-ignore
appState: {
frameRendering: settings
},
storeAction: "update",
});
frameSettingsModal.close();
})
);
};
frameSettingsModal.onClose = () => {
ea.destroy();
}
frameSettingsModal.open();
};
// Function to hide or show a component
function hideComponent(comp:any, value:any) {
comp.settingEl.style.display = value ? "none" : "";
}
+18 -3
View File
@@ -11,6 +11,12 @@ export class ImportSVGDialog extends FuzzySuggestModal<TFile> {
public plugin: ExcalidrawPlugin;
private view: ExcalidrawView;
destroy() {
this.app = null;
this.plugin = null;
this.view = null;
}
constructor(plugin: ExcalidrawPlugin) {
super(plugin.app);
this.plugin = plugin;
@@ -38,14 +44,23 @@ export class ImportSVGDialog extends FuzzySuggestModal<TFile> {
return item.path;
}
async onChooseItem(item: TFile, event: KeyboardEvent): Promise<void> {
async onChooseItem(item: TFile, _: KeyboardEvent): Promise<void> {
if(!item) return;
const ea = getEA(this.view) as ExcalidrawAutomate;
const svg = await app.vault.read(item);
const svg = await this.app.vault.read(item);
if(!svg || svg === "") return;
ea.importSVG(svg);
ea.addToGroup(ea.getElements().map(el=>el.id));
ea.addElementsToView(true, true, true,true);
await ea.addElementsToView(true, true, true,true);
ea.destroy();
}
onClose(): void {
//deley this.view destruction until onChooseItem is called
window.setTimeout(() => {
this.view = null;
});
super.onClose();
}
public start(view: ExcalidrawView) {
+13
View File
@@ -6,6 +6,11 @@ export class InsertCommandDialog extends FuzzySuggestModal<TFile> {
public app: App;
private addText: Function;
destroy() {
this.app = null;
this.addText = null;
}
constructor(app: App) {
super(app);
this.app = app;
@@ -32,10 +37,18 @@ export class InsertCommandDialog extends FuzzySuggestModal<TFile> {
onChooseItem(item: any): void {
const cmdId = item?.id;
this.addText(`⚙️[${item.name}](cmd://${item.id})`);
this.addText = null;
}
public start(addText: Function) {
this.addText = addText;
this.open();
}
onClose(): void {
window.setTimeout(()=>{
this.addText = null;
}) //onChooseItem must run first
super.onClose();
}
}
+19 -2
View File
@@ -4,12 +4,28 @@ import { DEVICE, IMAGE_TYPES, REG_LINKINDEX_INVALIDCHARS } from "../constants/co
import ExcalidrawView from "../ExcalidrawView";
import { t } from "../lang/helpers";
import ExcalidrawPlugin from "../main";
import { getEA } from "src";
export class InsertImageDialog extends FuzzySuggestModal<TFile> {
public app: App;
public plugin: ExcalidrawPlugin;
private view: ExcalidrawView;
destroy() {
this.app = null;
this.plugin = null;
this.view = null;
this.inputEl.onkeyup = null;
}
onClose(): void {
//deley this.view destruction until onChooseItem is called
window.setTimeout(() => {
this.view = null;
});
super.onClose();
}
constructor(plugin: ExcalidrawPlugin) {
super(plugin.app);
this.plugin = plugin;
@@ -55,13 +71,14 @@ export class InsertImageDialog extends FuzzySuggestModal<TFile> {
}
onChooseItem(item: TFile, event: KeyboardEvent): void {
const ea = this.plugin.ea.getAPI(this.view);
const ea = getEA(this.view);
ea.canvas.theme = this.view.excalidrawAPI.getAppState().theme;
const scaleToFullsize = scaleToFullsizeModifier(event);
(async () => {
//this.view.currentPosition = this.position;
await ea.addImage(0, 0, item, !scaleToFullsize);
ea.addElementsToView(true, true, true);
await ea.addElementsToView(true, true, true);
ea.destroy();
})();
}
+13
View File
@@ -9,6 +9,12 @@ export class InsertLinkDialog extends FuzzySuggestModal<TFile> {
private addText: Function;
private drawingPath: string;
destroy() {
this.app = null;
this.addText = null;
this.drawingPath = null;
}
constructor(private plugin: ExcalidrawPlugin) {
super(plugin.app);
this.app = plugin.app;
@@ -51,6 +57,13 @@ export class InsertLinkDialog extends FuzzySuggestModal<TFile> {
this.addText(getLink(this.plugin,{embed: false, path: filepath, alias: item.alias}), filepath, item.alias);
}
onClose(): void {
window.setTimeout(()=>{
this.addText = null
}); //make sure this happens after onChooseItem runs
super.onClose();
}
public start(drawingPath: string, addText: Function) {
this.addText = addText;
this.drawingPath = drawingPath;
+18 -4
View File
@@ -2,12 +2,19 @@ import { App, FuzzySuggestModal, TFile } from "obsidian";
import ExcalidrawView from "../ExcalidrawView";
import { t } from "../lang/helpers";
import ExcalidrawPlugin from "../main";
import { getEA } from "src";
export class InsertMDDialog extends FuzzySuggestModal<TFile> {
public app: App;
public plugin: ExcalidrawPlugin;
private view: ExcalidrawView;
destroy() {
this.app = null;
this.plugin = null;
this.view = null;
}
constructor(plugin: ExcalidrawPlugin) {
super(plugin.app);
this.plugin = plugin;
@@ -34,12 +41,11 @@ export class InsertMDDialog extends FuzzySuggestModal<TFile> {
}
onChooseItem(item: TFile): void {
const ea = this.plugin.ea;
ea.reset();
ea.setView(this.view);
const ea = getEA(this.view);
(async () => {
await ea.addImage(0, 0, item);
ea.addElementsToView(true, false, true);
await ea.addElementsToView(true, false, true);
ea.destroy();
})();
}
@@ -47,4 +53,12 @@ export class InsertMDDialog extends FuzzySuggestModal<TFile> {
this.view = view;
this.open();
}
onClose(): void {
//deley this.view destruction until onChooseItem is called
window.setTimeout(() => {
this.view = null;
});
super.onClose();
}
}
+8 -2
View File
@@ -28,7 +28,7 @@ export class InsertPDFModal extends Modal {
private plugin: ExcalidrawPlugin,
private view: ExcalidrawView,
) {
super(app);
super(plugin.app);
}
open (file?: TFile) {
@@ -54,12 +54,17 @@ export class InsertPDFModal extends Modal {
this.plugin.settings.pdfNumRows = this.numRows;
this.plugin.settings.pdfDirection = this.direction;
this.plugin.settings.pdfLockAfterImport = this.lockAfterImport;
this.plugin.saveSettings();
await this.plugin.saveSettings();
}
if(this.pdfDoc) {
this.pdfDoc.destroy();
this.pdfDoc = null;
}
this.plugin = null;
this.view = null;
this.app = null;
this.imageSizeMessage.remove();
this.setImageSizeMessage = null;
}
private async getPageDimensions (pdfDoc: any) {
@@ -408,6 +413,7 @@ export class InsertPDFModal extends Modal {
const viewElements = ea.getViewElements().filter(el => ids.includes(el.id));
api.selectElements(viewElements);
api.zoomToFit(viewElements);
ea.destroy();
this.close();
})
importButton = button;
+78
View File
@@ -17,6 +17,84 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
`,
"2.3.0": `
I am moving to a new release approach aiming to publish one update per month to the Obsidian script store. If you want to continue to receive more frequent updates with new features and minor bug fixes, then join the beta testing team. [#1912](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1912)
<div class="excalidraw-videoWrapper"><div>
<iframe src="https://www.youtube.com/embed/2poSS-Z91lY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></div>
## New
- Elbow connectors: https://x.com/excalidraw/status/1819084086222393554
## Fixed
- Convert Markdown to Excalidraw did not work correctly when there was ${String.fromCharCode(96)}---${String.fromCharCode(96)} anywhere in the file, but no frontmatter (e.g. a table)
- Fixed Obsidian move tab to new window
- Fixed duplicating bound arrows without its bound elements throwing error [#8315](https://github.com/excalidraw/excalidraw/issues/8315)
`,
"2.2.13": `
## Fixed
- Could not undo element after pasting [#1906](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1906)
- Links broke after renaming an Excalidraw file using the F2 shortcut [#1907](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1907)
- Unable to open or convert very large ${String.fromCharCode(96)}.excalidraw${String.fromCharCode(96)} file, e.g. BoaPs you can download from [here](https://ko-fi.com/zsolt/shop)
`,
"2.2.12": `
## Fixed
- Rename moved files to root folder [#1905](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1905)
- Fonts not displaying correctly in cached image previews
`,
"2.2.11": `
<img alt="badges" src="https://github.com/user-attachments/assets/7591b523-6bc6-46ff-b552-5c3492139e4c" referrerpolicy="no-referrer" style="width: 100%;">
## New
- Font picker with additional fonts (not yet fully configurable, but that will come in due time) [#8012](https://github.com/excalidraw/excalidraw/pull/8012)
- Introducing Visual Thinking Badges. The more you use Excalidraw the higher your rank will be. Levels are: Bronze, Silver, Gold and Platinum.
## Fixed
- Embedded PDF was not visible on phones [#1904](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1904)
- F2 does not rename files in Excalidraw View [#1900](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1900)
- Wireframe to Code now honors the GPT model settings in plugin settings. [#1901](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1901)
- Updated ExcaliAI to support gpt-4o for vision. [#1859](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/1859) 🙏@Saik0s
- Minor fixes from excalidraw.com [#8287](https://github.com/excalidraw/excalidraw/pull/8287), [#8285](https://github.com/excalidraw/excalidraw/pull/8285)
`,
"2.2.10": `
<div class="excalidraw-videoWrapper"><div>
<iframe src="https://www.youtube.com/embed/sjZfdqpxqsg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></div>
## Fixed
- Drastically degraded rendering performance when zoomed in and when arrows with labels are used. [#8267](https://github.com/excalidraw/excalidraw/pull/8267), [#8266](https://github.com/excalidraw/excalidraw/pull/8266), [#1893](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1893)
- Frame title font in exports.
## New
- Area, Group, Frame, and Clipped-Frame references to images now also work when pasting images to Excalidraw.
- The new reference type ${String.fromCharCode(96)}clippedframe=${String.fromCharCode(96)} works in the same way as ${String.fromCharCode(96)}frame=${String.fromCharCode(96)} but will display the elements clipped by the frame. ${String.fromCharCode(96)}clippedframe=${String.fromCharCode(96)} will always display the image with zero padding.
- New command palette action: ${String.fromCharCode(96)}Frame Settings${String.fromCharCode(96)} gives you fine-grained control over how frames are rendered. Frame settings will also be reflected in image exports. For example, if you hide the frame name or outline, then in exports they will not be visible.
`,
"2.2.9": `
## New
- Improved the "Open the back-of-the-note of the selected Excalidraw image" action. It now works with grouped elements and keeps the popout window within the visible screen area when elements are close to the top of the canvas. Note: Due to an Obsidian bug, I do not recommend using this feature with versions 1.6.0 - 1.6.6, if you have Obsidian Sync enabled, because Obsidian may freeze when closing the popout window. It functions properly in Obsidian versions before 1.6.0 and from 1.6.7 onwards.
## Fixed
- Drag and drop from a local folder (outside Obsidian) resulted in duplicate images.
- Insert Link Action did not work [#1873](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1873)
- Insert Obsidian Command Action did not work
- Element link for text element got deleted when editing the text. [#1878](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1878)
- When back-of-the-drawing Section Headings have spaces in them, clicking the link opens the drawing side not the markdown side. [#1877](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1877)
- obsidian:// links did not work as expected. [#1872](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1872)
- copying and moving a rectangle with text, moves the text unexpectedly. The issue should now be resolved (at least much less likely to occur) [#1867](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1867)
`,
"2.2.8": `
While this release may appear modest with no new features, it represents nearly 50 hours of dedicated work. Here's what's been improved:
- **Enhanced Memory Management**: Significant improvements to optimize memory usage.
- Bug Fixes:
- Support for multi-file drag and drop from the operating system.
- Correct theming of animated GIFs as Embeddables.
- Several other minor bug fixes.
Please note that due to extensive refactoring of the codebase, there may be some unexpected issues. Thanks for your understanding and patience.
`,
"2.2.7": `
## New
- In Miscellaneous Settings: added **Load Excalidraw Properties into Obsidian Suggester**. This setting toggles the automatic loading of Excalidraw properties at startup. Enabled by default for easy use of front matter properties. Disabling it prevents auto-loading, but you'll need to manually remove unwanted properties using Obsidian properties view. A plugin restart is required after enabling auto-loading.
+7
View File
@@ -14,6 +14,13 @@ export class OpenFileDialog extends FuzzySuggestModal<TFile> {
private action: openDialogAction;
private onNewPane: boolean;
destroy() {
this.app = null;
this.plugin = null;
this.action = null;
this.inputEl.onkeyup = null;
}
constructor(app: App, plugin: ExcalidrawPlugin) {
super(app);
this.app = app;
+17 -3
View File
@@ -22,7 +22,7 @@ import { ExcalidrawAutomate } from "src/ExcalidrawAutomate";
import { MAX_IMAGE_SIZE, REG_LINKINDEX_INVALIDCHARS } from "src/constants/constants";
import { REGEX_LINK } from "src/ExcalidrawData";
import { ScriptEngine } from "src/Scripts";
import { openExternalLink, openTagSearch } from "src/utils/ExcalidrawViewUtils";
import { openExternalLink, openTagSearch, parseObsidianLink } from "src/utils/ExcalidrawViewUtils";
export type ButtonDefinition = { caption: string; tooltip?:string; action: Function };
@@ -527,6 +527,11 @@ export class NewFileActions extends Modal {
onClose() {
super.onClose();
this.resolvePromise(this.newFile);
this.app = null;
this.plugin = null;
this.view = null;
this.parentFile = null;
this.sourceElement = null;
}
createForm(): void {
@@ -588,7 +593,8 @@ export class NewFileActions extends Modal {
ea.copyViewElementsToEAforEditing([this.sourceElement]);
ea.getElement(this.sourceElement.id).isDeleted = true;
ea.addEmbeddable(this.sourceElement.x, this.sourceElement.y,MAX_IMAGE_SIZE, MAX_IMAGE_SIZE, undefined,f);
ea.addElementsToView();
await ea.addElementsToView();
ea.destroy();
}
this.close();
};
@@ -702,7 +708,12 @@ export class ConfirmationPrompt extends Modal {
}
}
export const linkPrompt = async (linkText:string, app: App, view?: ExcalidrawView, message: string = "Select link to open"):Promise<[file:TFile, linkText:string, subpath: string]> => {
export async function linkPrompt (
linkText:string,
app: App,
view?: ExcalidrawView,
message: string = "Select link to open",
):Promise<[file:TFile, linkText:string, subpath: string]> {
const partsArray = REGEX_LINK.getResList(linkText);
let subpath: string = null;
let file: TFile = null;
@@ -731,6 +742,9 @@ export const linkPrompt = async (linkText:string, app: App, view?: ExcalidrawVie
linkText = REGEX_LINK.getLink(parts);
if(openExternalLink(linkText, app)) return;
const maybeObsidianLink = parseObsidianLink(linkText, app, false);
if (typeof maybeObsidianLink === "boolean" && maybeObsidianLink) return;
if (typeof maybeObsidianLink === "string") linkText = maybeObsidianLink;
if (linkText.search("#") > -1) {
const linkParts = getLinkParts(linkText, view ? view.file : undefined);
+44
View File
@@ -0,0 +1,44 @@
import { App, MarkdownRenderer, Modal } from "obsidian";
import ExcalidrawPlugin from "../main";
import { Rank, SwordColors } from "src/menu/ActionIcons";
export class RankMessage extends Modal {
constructor(app: App, private plugin: ExcalidrawPlugin, private filecount: number, private rank: Rank, private color: string, private shield: string, private dark: string) {
super(app);
}
onOpen(): void {
//this.contentEl.classList.add("excalidraw-release");
this.containerEl.classList.add("excalidraw-release");
this.titleEl.setText("Congratulations, glorious knight!");
this.createForm();
}
async onClose() {
this.contentEl.empty();
this.plugin = null;
}
async createForm() {
const { title} = SwordColors[this.rank];
this.contentEl.createDiv({ cls: "excalidraw-rank" }, (el) => {
el.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 512 512" viewBox="0 0 511 512"><path fill="${this.color}" d="m389 495 36 7c6 1 11-4 10-10l-6-36a22 22 0 0 0-9-14l-61-46-29 28 45 62a22 22 0 0 0 14 9zm0 0" data-original="#97a7a7"/><path fill="#ffd3bc" d="m333 361-33 4-27 29 1 5 15 13c11 10 27 12 39 3 7-4 12-11 13-20 1-11-3-23-8-34zm0 0" data-original="#ffd3bc"/><path fill="#a5b0bc" d="m288 450-3-50-88-15-87 15-3 50 27 16 28-16v-8c0-6 4-11 10-11h51c6 0 10 5 10 11v8l28 16 27-16zm28-114a332 332 0 0 0-4-6c-14-17-32-30-55-29l16 93 60-33c-5-9-11-18-17-25zm0 0" data-original="#a5b0bc"/><path fill="${this.shield}" d="M281 371c-9-54-24-70-24-70H138s-15 16-24 70l-4 29h175l-4-29zm0 0" data-original="${this.shield}"/><path fill="${this.color}" d="M383 160a30 30 0 1 1-59 0 30 30 0 0 1 59 0zm-312 0a30 30 0 1 1-59 0 30 30 0 0 1 59 0zm0 0" data-original="#97a7a7"/><path fill="#a5b0bc" d="M44 160a153 153 0 1 1 306 0 153 153 0 0 1-306 0zm0 0" data-original="#a5b0bc"/><path fill="#748A8A" d="M107 450v13s-12 10-17 27c-2 7 4 14 11 14h49c7 1 12-5 12-11v-43zm181 0v13s12 10 17 27c2 7-4 14-11 14h-49c-7 1-12-5-12-11v-43zm0 0" data-original="#748A8A"/><path fill="#ffd3bc" d="M44 160s44 76 153 76c110 0 153-76 153-76l-17-30-136-27-127 24zm0 0" data-original="#ffd3bc"/><path fill="#ffbe9c" d="M197 103 70 127l-26 33s5 9 16 20c6-4 50-29 137-29s131 25 138 29c11-11 15-20 15-20l-17-30zm0 0" data-original="#ffbe9c"/><path fill="${this.color}" d="M271 59c-47-18-100-18-147 0-39 15-80 45-80 101 0 0 48-34 153-34s153 34 153 34c0-56-40-86-79-101zm0 0" data-original="#97a7a7"/><path fill="#ff889e" d="M274 201h-18a7 7 0 1 1 0-15h18a7 7 0 1 1 0 15zm-135 0h-18a7 7 0 1 1 0-15h18a7 7 0 1 1 0 15zm0 0" data-original="#ff889e"/><path fill="#748A8A" d="m185 387-75 13-2 47a39 39 0 0 0 2 0c31-10 57-30 75-60zm0 0" data-original="#748A8A"/><path fill="#00000060" d="M186 386c15-24 22-50 25-67a43 43 0 0 0 0-18h-73s-15 16-24 70l-4 29h67a160 160 0 0 0 9-14zm0 0" data-original="#00000060"/><path fill="#748A8A" d="M174 268c-29-4-46-12-54-17a43 43 0 0 0-45 0h-1a153 153 0 0 0 138 62 43 43 0 0 0-38-45zm0 0" data-original="#748A8A"/><path fill="${this.dark}" d="M171 293c-32-4-53-14-64-21a18 18 0 0 0-19 0c-11 7-32 17-64 21-10 1-18 11-16 21 6 31 25 90 84 109a18 18 0 0 0 11 0c58-19 77-78 83-109 2-10-5-20-15-21zm0 0" data-original="${this.dark}"/><path fill="${this.shield}" d="M97 387c-29-11-43-39-50-62 22-5 38-12 50-18 12 6 29 13 50 18-7 23-21 51-50 62zm0 0" data-original="${this.shield}"/><path fill="${this.dark}" d="m327 444 52-51a6 6 0 0 0 0-9c-9-9-24-9-33 0l-28 27c-9 9-9 24 0 33a6 6 0 0 0 9 0zm0 0" data-original="${this.dark}"/><path d="M100 88a8 8 0 0 0-7 8v18a8 8 0 1 0 15 0V96c0-4-3-8-8-8zm49-20a7 7 0 0 0-8 8v36a8 8 0 1 0 15 0V76a8 8 0 0 0-7-8zm145 20a7 7 0 0 0-7 8v18c0 4 3 8 7 8a8 8 0 0 0 8-8V96a8 8 0 0 0-8-8zm-48-20a8 8 0 0 0-8 8v36a8 8 0 1 0 15 0V76c0-4-3-8-7-8zm-49-6c-4 0-7 3-7 7v36a8 8 0 0 0 15 0V69c0-4-3-7-8-7zm68 120c4 0 8-3 8-8v-13a8 8 0 1 0-15 0v13a8 8 0 0 0 7 8zm-135 0c4 0 7-3 7-8v-13a8 8 0 1 0-15 0v13a8 8 0 0 0 8 8zm85 0a8 8 0 0 0-11 1l-7 2-6-2a7 7 0 0 0-11-1c-3 3-3 7 0 11 4 5 11 7 17 7 7 0 14-2 18-7a8 8 0 0 0 0-11zM95 394a8 8 0 0 0 5 0c32-13 47-44 55-67 1-4-2-9-6-10-18-3-34-9-48-17a7 7 0 0 0-7 0c-14 8-30 14-48 17-4 1-7 6-6 10 7 23 22 54 55 67zm2-78c13 6 26 10 41 14-7 18-19 39-41 49a83 83 0 0 1-40-49c15-4 28-8 40-14zm0 0" data-original="#000000"/><path d="M436 455a29 29 0 0 0-11-19l-45-34 4-4c5-5 5-14 0-19-6-6-13-9-22-9a30 30 0 0 0-16 4l-6-16c-5-9-10-17-18-27a375 375 0 0 0-4-6 86 86 0 0 0-37-27c36-22 63-58 73-101a37 37 0 0 0 0-74 161 161 0 0 0-313 0 37 37 0 0 0 0 74c6 27 19 51 38 71-12 7-30 14-56 17-14 2-25 16-22 30 4 19 12 47 29 71a8 8 0 1 0 12-9c-16-22-23-47-26-64-1-6 3-12 9-13 33-4 54-14 67-22 3-2 8-2 11 0 20 13 43 19 67 22 8 1 10 8 8 15-3 18-12 46-31 69-12 15-28 26-47 32h-6c-12-4-23-10-33-18a8 8 0 1 0-9 11c11 10 24 16 38 21l11 1a694 694 0 0 0-1 19v10c-4 4-13 14-17 28-3 12 6 24 18 24h49c11 0 19-8 19-19v-51c0-2 1-3 3-3h51a3 3 0 0 1 3 3v51c0 11 8 19 19 19h49c12 0 21-12 18-24-4-14-13-24-17-28v-10a699 699 0 0 0-1-25 41 41 0 0 0 10 3c0 8 3 15 9 21a14 14 0 0 0 9 4c4 0 7-1 10-4l4-4 33 46a29 29 0 0 0 19 11s36 7 36 7c10 2 20-8 18-18zm-272-68c16-22 24-45 28-65l1-1 21-1a159 159 0 0 0 40-9c4 6 12 22 18 52l4 29H160l4-5zm142-52 17 23-33 18a473 473 0 0 0-19-66c16 4 27 15 35 25zm32-190c-23-11-48-17-73-21a426 426 0 0 0-136 0 267 267 0 0 0-76 23c5-37 29-64 74-81a195 195 0 0 1 141 0c44 17 69 44 74 81a173 173 0 0 0-4-2zm18-6a22 22 0 0 1 0 43h1a162 162 0 0 0 0-43h-1zM197 15c49 0 91 23 118 60-12-9-26-17-41-23A210 210 0 0 0 80 75c27-37 69-60 117-60zM19 160c0-11 9-20 19-21a163 163 0 0 0 0 43c-10-1-19-10-19-22zm130 121c-14-3-27-8-38-16a25 25 0 0 0-14-3 26 26 0 0 0-4 0c-20-21-33-46-38-73a8 8 0 0 0 0-1l-1-3 21 19a196 196 0 0 0 150 38 7 7 0 1 0-1-15 217 217 0 0 1-27 2c-43 0-81-12-112-36-15-12-25-23-30-30l30-13c36-12 74-16 112-16a320 320 0 0 1 143 29c-10 13-38 45-88 59a8 8 0 0 0-5 9 7 7 0 0 0 9 5c42-12 69-34 85-51a138 Line truncated
});
await MarkdownRenderer.render(
this.app,
`You have ${this.filecount} Excalidraw drawings in your Vault earning you a new rank: **${this.rank}**! You've ascended to **${title}**!\n\nI've spent the past 3+ years building this plugin. If you appreciate my work, consider supporting me on [Ko-Fi](https://ko-fi.com/zsolt) or join the next [Visual Thinking Workshop](https://visual-thinking-workshop.com) cohort.`,
this.contentEl,
"",
this.plugin,
);
this.contentEl.createEl("p", { text: "" }, (el) => {
//files manually follow one of two options:
el.style.textAlign = "right";
const bOk = el.createEl("button", { text: "Close" });
bOk.onclick = () => this.close();
});
}
}
+1
View File
@@ -55,6 +55,7 @@ export class SelectCard extends FuzzySuggestModal<string> {
(async () => {
await ea.addElementsToView(true, false, true);
ea.selectElementsInView([id]);
ea.destroy();
})();
}
+20 -2
View File
@@ -100,7 +100,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
{
field: "style.fontFamily",
code: "[number]",
desc: "1: Virgil, 2:Helvetica, 3:Cascadia, 4:LocalFont",
desc: "1: Virgil, 2:Helvetica, 3:Cascadia, 4:Local Font, 5: Excalifont, 6: Nunito, 7: Lilita One, 8: Comic Shanns, 9: Liberation Sans",
after: "",
},
{
@@ -442,7 +442,19 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
{
field: "getExportSettings",
code: "getExportSettings(withBackground: boolean, withTheme: boolean,): ExportSettings;",
desc: "Utility function to generate ExportSettings object",
desc: "Utility function to generate ExportSettings object\n" +
"export interface ExportSettings {\n" +
" withBackground: boolean;\n" +
" withTheme: boolean;\n" +
" isMask: boolean; //if true elements will be processed as mask, clipping, etc.\n" +
" frameRendering?: { //optional, overrides relevant appState settings for rendering the frame\n" +
" enabled: boolean;\n" +
" name: boolean;\n" +
" outline: boolean;\n" +
" clip: boolean;\n" +
" };\n" +
" skipInliningFonts?: boolean;\n" +
"}",
after: "",
},
{
@@ -481,6 +493,12 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
desc: "Gets all the elements from elements[] that share one or more groupIds with element.",
after: ""
},
{
field: "getElementsInFrame",
code: " getElementsInFrame(frameElement: ExcalidrawElement,elements: ExcalidrawElement[],shouldIncludeFrame: boolean = false,): ExcalidrawElement[];",
desc: "Gets all the elements from elements[] that are inside the frameElement. If shouldIncludeFrame is true, the frameElement will also be included in the result.",
after: "",
},
{
field: "activeScript",
code: "activeScript: string;",
+5
View File
@@ -189,6 +189,7 @@ export class UniversalInsertFileModal extends Modal {
`[[${path}${sectionPicker.selectEl.value}]]`,
)]
);
ea.destroy();
this.close();
})
actionIFrame = button;
@@ -220,6 +221,7 @@ export class UniversalInsertFileModal extends Modal {
ea.isExcalidrawFile(file) ? !anchorTo100 : undefined,
)]
);
ea.destroy();
this.close();
})
actionImage = button;
@@ -271,5 +273,8 @@ export class UniversalInsertFileModal extends Modal {
onClose(): void {
this.view.ownerWindow.removeEventListener("keydown", this.onKeyDown);
this.view = null;
this.file = null;
this.plugin = null;
}
}
+26 -15
View File
@@ -50,17 +50,20 @@ export default {
NEW_IN_POPOUT_WINDOW_EMBED: "Create new drawing - IN A POPOUT WINDOW - and embed into active document",
TOGGLE_LOCK: "Toggle Text Element between edit RAW and PREVIEW",
DELETE_FILE: "Delete selected image or Markdown file from Obsidian Vault",
COPY_ELEMENT_LINK: "Copy markdown link for selected element(s)",
COPY_ELEMENT_LINK: "Copy [[link]] for selected element(s)",
COPY_DRAWING_LINK: "Copy ![[embed link]] for this drawing",
INSERT_LINK_TO_ELEMENT:
`Copy markdown link for selected element to clipboard. ${labelCTRL()}+CLICK to copy 'group=' link. ${labelSHIFT()}+CLICK to copy an 'area=' link. ${labelALT()}+CLICK to watch a help video.`,
`Copy [[link]] for selected element to clipboard. ${labelCTRL()}+CLICK to copy 'group=' link. ${labelSHIFT()}+CLICK to copy an 'area=' link. ${labelALT()}+CLICK to watch a help video.`,
INSERT_LINK_TO_ELEMENT_GROUP:
"Copy 'group=' markdown link for selected element to clipboard.",
"Copy 'group=' ![[link]] for selected element to clipboard.",
INSERT_LINK_TO_ELEMENT_AREA:
"Copy 'area=' markdown link for selected element to clipboard.",
"Copy 'area=' ![[link]] for selected element to clipboard.",
INSERT_LINK_TO_ELEMENT_FRAME:
"Copy 'frame=' markdown link for selected element to clipboard.",
"Copy 'frame=' ![[link]] for selected element to clipboard.",
INSERT_LINK_TO_ELEMENT_FRAME_CLIPPED:
"Copy 'clippedframe=' ![[link]] for selected element to clipboard.",
INSERT_LINK_TO_ELEMENT_NORMAL:
"Copy markdown link for selected element to clipboard.",
"Copy [[link]] for selected element to clipboard.",
INSERT_LINK_TO_ELEMENT_ERROR: "Select a single element in the scene",
INSERT_LINK_TO_ELEMENT_READY: "Link is READY and available on the clipboard",
INSERT_LINK: "Insert link to file",
@@ -136,6 +139,7 @@ export default {
ERROR_SAVING_IMAGE: "Unknown error occurred while fetching the image. It could be that for some reason the image is not available or rejected the fetch request from Obsidian",
WARNING_PASTING_ELEMENT_AS_TEXT: "PASTING EXCALIDRAW ELEMENTS AS A TEXT ELEMENT IS NOT ALLOWED",
USE_INSERT_FILE_MODAL: "Use 'Insert Any File' to embed a markdown note",
RECURSIVE_INSERT_ERROR: "You may not recursively insert part of an image into the same image as it would create an infinite loop",
CONVERT_TO_MARKDOWN: "Convert to file...",
SELECT_TEXTELEMENT_ONLY: "Select text element only (not container)",
REMOVE_LINK: "Remove text element link",
@@ -226,7 +230,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-4-vision-preview",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "Enter your default AI vision model here. e.g.: gpt-4o",
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",
@@ -571,7 +575,7 @@ FILENAME_HEAD: "Filename",
"If turned off, the exported image will be transparent.",
EXPORT_PADDING_NAME: "Image Padding",
EXPORT_PADDING_DESC:
"The padding (in pixels) around the exported SVG or PNG image. " +
"The padding (in pixels) around the exported SVG or PNG image. Padding is set to 0 for clippedFrame references." +
"If you have curved lines close to the edge of the image they might get cropped during image export. You can increase this value to avoid cropping. " +
"You can also override this setting at a file level by adding the <code>excalidraw-export-padding: 5<code> frontmatter key.",
EXPORT_THEME_NAME: "Export image with theme",
@@ -643,7 +647,7 @@ FILENAME_HEAD: "Filename",
LATEX_DEFAULT_DESC: "Leave empty if you don't want a default formula. You can add default formatting here such as <code>\\color{white}</code>.",
NONSTANDARD_HEAD: "Non-Excalidraw.com supported features",
NONSTANDARD_DESC: `These settings in the "Non-Excalidraw.com Supported Features" section provide customization options beyond the default Excalidraw.com features. These features are not available on excalidraw.com. When exporting the drawing to Excalidraw.com these features will appear different.
You can configure the number of custom pens displayed next to the Obsidian Menu on the canvas, allowing you to choose from a range of options. Additionally, you can enable a fourth font option, which adds a fourth font button to the properties panel for text elements. `,
You can configure the number of custom pens displayed next to the Obsidian Menu on the canvas, allowing you to choose from a range of options. Additionally, you can enable a local font option, which adds a local font to the list of fonts on the element properties panel for text elements. `,
RENDER_TWEAK_HEAD: "Rendering tweaks",
MAX_IMAGE_ZOOM_IN_NAME: "Maximum image zoom in resolution",
MAX_IMAGE_ZOOM_IN_DESC: "To save on memory and because Apple Safari (Obsidian on iOS) has some hard-coded limitations, Excalidraw.com limits the max resolution of images and large objects when zooming in. You can override this limitation using a multiplicator. " +
@@ -693,16 +697,16 @@ FILENAME_HEAD: "Filename",
"Enabling this feature simplifies the use of Excalidraw front matter properties, allowing you to leverage many powerful settings. If you prefer not to load these properties automatically, " +
"you can disable this feature, but you will need to manually remove any unwanted properties from the suggester. " +
"Note that turning on this setting requires restarting the plugin as properties are loaded at startup.",
CUSTOM_FONT_HEAD: "Fourth font",
ENABLE_FOURTH_FONT_NAME: "Enable fourth font option",
CUSTOM_FONT_HEAD: "Local font",
ENABLE_FOURTH_FONT_NAME: "Enable local font option",
ENABLE_FOURTH_FONT_DESC:
"By turning this on, you will see a fourth font button on the properties panel for text elements. " +
"Files that use this fourth font will (partly) lose their platform independence. " +
"By turning this on, you will see a local font in the font list on the properties panel for text elements. " +
"Files that use this local font will (partly) lose their platform independence. " +
"Depending on the custom font set in settings, they will look differently when loaded in another vault, or at a later time. " +
"Also the 4th font will display as system default font on excalidraw.com, or other Excalidraw versions.",
FOURTH_FONT_NAME: "Fourth font file",
FOURTH_FONT_NAME: "Local font file",
FOURTH_FONT_DESC:
"Select a .ttf, .woff or .woff2 font file from your vault to use as the fourth font. " +
"Select a .ttf, .woff or .woff2 font file from your vault to use as the local font. " +
"If no file is selected, Excalidraw will use the Virgil font by default.",
SCRIPT_SETTINGS_HEAD: "Settings for installed Scripts",
SCRIPT_SETTINGS_DESC: "Some of the Excalidraw Automate Scripts include settings. Settings are organized by script. Settings will only become visible in this list after you have executed the newly downloaded script once.",
@@ -824,4 +828,11 @@ FILENAME_HEAD: "Filename",
INTERNAL_DRAG_ACTION: "Obsidian Internal Drag Action",
PANE_TARGET: "Link click behavior",
DEFAULT_ACTION_DESC: "In case none of the combinations apply the default action for this group is: ",
//FrameSettings.ts
FRAME_SETTINGS_TITLE: "Frame Settings",
FRAME_SETTINGS_ENABLE: "Enable Frames",
FRAME_SETTIGNS_NAME: "Display Frame Name",
FRAME_SETTINGS_OUTLINE: "Display Frame Outline",
FRAME_SETTINGS_CLIP: "Enable Frame Clipping",
};
+78 -43
View File
@@ -10,7 +10,7 @@ export default {
CONVERT_URL_TO_FILE: "从 URL 下载图像到本地",
UNZIP_CURRENT_FILE: "解压当前 Excalidraw 文件",
ZIP_CURRENT_FILE: "压缩当前 Excalidraw 文件",
PUBLISH_SVG_CHECK: "Obsidian Publish: 搜索过期的 SVG 和 PNG 导出文件",
PUBLISH_SVG_CHECK: "Obsidian Publish:搜索过期的 SVG 和 PNG 导出文件",
EMBEDDABLE_PROPERTIES: "Embeddable 元素设置",
EMBEDDABLE_RELATIVE_ZOOM: "使元素的缩放等级等于当前画布的缩放等级",
OPEN_IMAGE_SOURCE: "打开 Excalidraw 绘图文件",
@@ -50,15 +50,18 @@ export default {
NEW_IN_POPOUT_WINDOW_EMBED: "新建绘图 - 于新窗口 - 并将其嵌入(形如 ![[drawing]])到当前 Markdown 文档中",
TOGGLE_LOCK: "文本元素:原文模式(RAW)⟺ 预览模式(PREVIEW)",
DELETE_FILE: "从库中删除所选图像(或以图像形式嵌入绘图中的 Markdown)的源文件",
COPY_ELEMENT_LINK: "复制所选元素的 Markdown 链接",
COPY_ELEMENT_LINK: "复制所选元素的链接(形如 [[file#^id]]])",
COPY_DRAWING_LINK: "复制绘图的嵌入链接(形如 ![[darwing]])",
INSERT_LINK_TO_ELEMENT:
`复制所选元素为内部链接(形如 [[file#^id]] )。\n按住 ${labelCTRL()} 可复制元素所在分组为内部链接(形如 [[file#^group=id]] )。\n按住 ${labelSHIFT()} 可复制所选元素所在区域为内部链接(形如 [[file#^area=id]] )。\n按住 ${labelALT()} 可观看视频演示。`,
INSERT_LINK_TO_ELEMENT_GROUP:
"复制所选元素所在分组为内部链接(形如 [[file#^group=id]] )",
"复制所选元素所在分组为嵌入链接(形如 ![[file#^group=id]] )",
INSERT_LINK_TO_ELEMENT_AREA:
"复制所选元素所在区域为内部链接(形如 [[file#^area=id]] )",
"复制所选元素所在区域为嵌入链接(形如 ![[file#^area=id]] )",
INSERT_LINK_TO_ELEMENT_FRAME:
"复制所选框架为内部链接(形如 [[file#^frame=id]] )",
"复制所选框架为嵌入链接(形如 ![[file#^frame=id]] )",
INSERT_LINK_TO_ELEMENT_FRAME_CLIPPED:
"复制所选框架(内容)为嵌入链接(形如 ![[file#^clippedframe=id]] )",
INSERT_LINK_TO_ELEMENT_NORMAL:
"复制所选元素为内部链接(形如 [[file#^id]] )",
INSERT_LINK_TO_ELEMENT_ERROR: "未选择画布里的单个元素",
@@ -79,9 +82,9 @@ export default {
`插入 LaTeX 公式到当前绘图`,
ENTER_LATEX: "输入 LaTeX 表达式",
READ_RELEASE_NOTES: "阅读本插件的更新说明",
RUN_OCR: "OCR 完整画布: 识别涂鸦和图片里的文本并复制到剪贴板和文档属性中",
RERUN_OCR: "重新运行 OCR 完整画笔: 识别涂鸦和图片里的文本并复制到剪贴板和文档属性中",
RUN_OCR_ELEMENTS: "OCR 选中的元素: 识别涂鸦和图片里的文本并复制到剪贴板",
RUN_OCR: "OCR 完整画布:识别涂鸦和图片里的文本并复制到剪贴板和文档属性中",
RERUN_OCR: "重新运行 OCR 完整画笔:识别涂鸦和图片里的文本并复制到剪贴板和文档属性中",
RUN_OCR_ELEMENTS: "OCR 选中的元素:识别涂鸦和图片里的文本并复制到剪贴板",
TRAY_MODE: "绘图工具属性页:面板模式 ⟺ 托盘模式",
SEARCH: "搜索文本",
CROP_PAGE: "对所选页面裁剪并添加蒙版",
@@ -93,11 +96,28 @@ export default {
TEMPORARY_ENABLE_AUTOSAVE: "启用自动保存功能",
//ExcalidrawView.ts
FORCE_SAVE_ABORTED: "自动保存被中止,因为文件正在保存中",
LINKLIST_SECOND_ORDER_LINK: "二级链接",
MARKDOWN_EMBED_CUSTOMIZE_LINK_PROMPT_TITLE: "自定义链接",
MARKDOWN_EMBED_CUSTOMIZE_LINK_PROMPT: "不要在文件名周围添加[[方括号(Wiki 格式链接)]]!<br>编辑链接时请遵循以下格式:<br><mark>文件名#^块引用|宽度x最大高度</mark>",
FRAME_CLIPPING_ENABLED: "渲染框架:已启用",
FRAME_CLIPPING_DISABLED: "渲染框架:已禁用",
ARROW_BINDING_INVERSE_MODE: "反转模式:默认方向按键已禁用。需要时请使用 Ctrl/CMD 临时启用。",
ARROW_BINDING_NORMAL_MODE: "正常模式:方向键已启用。需要时请使用 Ctrl/CMD 临时禁用。",
EXPORT_FILENAME_PROMPT: "请提供文件名",
EXPORT_FILENAME_PROMPT_PLACEHOLDER: "请输入文件名,留空以取消操作",
WARNING_SERIOUS_ERROR: "警告:Excalidraw 遇到了未知的问题!\n\n" +
"您最近的更改可能无法保存。\n\n" +
"为了安全起见,请按以下步骤操作:\n" +
"1) 使用 Ctrl/CMD+A 选择您的绘图,然后使用 Ctrl/CMD+C 进行复制。\n" +
"2) 然后在新窗格中,通过 Ctrl/CMD 点击 Excalidraw 功能区按钮创建一个空白绘图。\n" +
"3) 最后,使用 Ctrl/CMD+V 将您的作品粘贴到新文档中。",
ARIA_LABEL_TRAY_MODE: "托盘模式提供了一个更宽敞的画布空间",
MASK_FILE_NOTICE: "这是一个蒙版图像。长按本提示来观看视频讲解。",
INSTALL_SCRIPT_BUTTON: "安装或更新 Excalidraw 脚本",
OPEN_AS_MD: "打开为 Markdown 文档",
EXPORT_IMAGE: `导出为图像`,
OPEN_LINK: "打开所选元素里的链接 \n(按住 SHIFT 在新面板打开)",
OPEN_LINK: "打开所选元素里的链接 \n(按住 Shift 在新面板打开)",
EXPORT_EXCALIDRAW: "导出为 .excalidraw 文件(旧版绘图文件格式)",
LINK_BUTTON_CLICK_NO_TEXT:
"请选择一个含有链接的图形或文本元素。",
@@ -119,6 +139,7 @@ export default {
ERROR_SAVING_IMAGE: "获取图像时发生未知错误。可能是由于某种原因,图像不可用或拒绝了 Obsidian 的获取请求。",
WARNING_PASTING_ELEMENT_AS_TEXT: "你不能将 Excalidraw 元素粘贴为文本元素!",
USE_INSERT_FILE_MODAL: "使用“插入任意文件”功能来嵌入 Markdown 文档",
RECURSIVE_INSERT_ERROR: "你不能将图像的一部分嵌入到此图像中,因为这可能导致无限循环。",
CONVERT_TO_MARKDOWN: "转存为 Markdown 文档(并嵌入为 MD-Embeddable)",
SELECT_TEXTELEMENT_ONLY: "只选择文本元素(非容器)",
REMOVE_LINK: "移除文字元素链接",
@@ -156,7 +177,7 @@ export default {
"剪贴图像时创建新绘图的默认存储路径。如果留空,将按照 Vault 附件设置创建。",
ANNOTATE_FOLDER_NAME: "图片标注文件文件夹",
ANNOTATE_FOLDER_DESC:
"创建图片标注是的默认存储路径. 如果留空, 将按照 Vault 附件设置创建。",
"创建图片标注是的默认存储路径。如果留空,将按照 Vault 附件设置创建。",
FOLDER_EMBED_NAME:
"将 Excalidraw 文件夹用于“新建绘图”系列命令",
FOLDER_EMBED_DESC:
@@ -166,12 +187,12 @@ export default {
TEMPLATE_NAME: "Excalidraw 模板文件",
TEMPLATE_DESC:
"Excalidraw 模板文件(文件夹)的存储路径。<br>" +
"<b>模板文件:</b>比如.: 如果您的模板在默认的 Excalidraw 文件夹中且文件名是 " +
"Template.md, 则此项应设为 Excalidraw/Template.md(也可省略 .md 扩展名,即 Excalidraw/Template)。" +
"<b>模板文件:</b>比如:如果您的模板在默认的 Excalidraw 文件夹中且文件名是 " +
"Template.md,则此项应设为 Excalidraw/Template.md(也可省略 .md 扩展名,即 Excalidraw/Template)。" +
"如果您在兼容模式下使用 Excalidraw,那么您的模板文件也必须是旧的 *.excalidraw 格式," +
"例如 Excalidraw/Template.excalidraw. <br><b>模板文件夹:</b> 你还可以将文件夹设置为模板。 " +
"例如 Excalidraw/Template.excalidraw。<br><b>模板文件夹:</b> 你还可以将文件夹设置为模板。 " +
"在这种情况下,创建新绘图时将提示您选择使用哪个模板。<br>" +
"<b>专业提示:</b> 如果您正在使用 Obsidian Templater 插件,您可以 将Templater 代码添加到不同的" +
"<b>专业提示:</b> 如果您正在使用 Obsidian Templater 插件,您可以将 Templater 代码添加到不同的" +
"Excalidraw 模板中,以自动配置您的绘图",
SCRIPT_FOLDER_NAME: "Excalidraw 自动化脚本的文件夹(大小写敏感!)",
SCRIPT_FOLDER_DESC:
@@ -209,7 +230,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: "gpt-4-vision-preview",
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "输入你的默认 AI 模型名称,例如:gpt-4o",
SAVING_HEAD: "保存",
SAVING_DESC: "包括:压缩,自动保存的时间间隔,文件的命名格式和扩展名等的设置。",
COMPRESS_NAME: "压缩 Excalidraw JSON",
@@ -227,7 +248,7 @@ export default {
DECOMPRESS_FOR_MD_DESC:
"通过启用此功能,Excalidraw 将在切换到 Markdown 视图时自动解压缩绘图 JSON。" +
"这将使您能够轻松阅读和编辑 JSON 字符串。" +
"一旦您切换回Excalidraw视图并保存绘图(CTRL+S),绘图将再次被压缩。<br>" +
"一旦您切换回 Excalidraw 视图并保存绘图(Ctrl+S),绘图将再次被压缩。<br>" +
"我建议关闭此功能,因为这可以获得更小的文件尺寸,并避免在 Obsidian 搜索中出现不必要的结果。 " +
"您始终可以使用命令面板中的“Excalidraw: 解压缩当前 Excalidraw 文件”命令"+
"在需要阅读或编辑时手动解压缩绘图 JSON。",
@@ -280,7 +301,7 @@ FILENAME_HEAD: "文件名",
IFRAME_MATCH_THEME_DESC:
"<b>开启:</b>当 Obsidian 和 Excalidraw 一个使用黑暗主题、一个使用明亮主题时," +
"开启此项后,以交互形式嵌入到绘图中的元素(Embeddable) 将会匹配 Excalidraw 主题。<br>" +
"<b>关闭:</b>如果您想要 Embeddable 匹配 Obsidian 主题,请关闭此项。",
"<b>关闭:</b>如果您想要 Embeddable 匹配 Obsidian 主题,请关闭此项。",
MATCH_THEME_NAME: "使新建的绘图匹配 Obsidian 主题",
MATCH_THEME_DESC:
"如果 Obsidian 使用黑暗主题,新建的绘图文件也将使用黑暗主题。<br>" +
@@ -304,19 +325,19 @@ FILENAME_HEAD: "文件名",
SHOW_PEN_MODE_FREEDRAW_CROSSHAIR_NAME: "在触控笔模式下显示十字准星(+)",
SHOW_PEN_MODE_FREEDRAW_CROSSHAIR_DESC:
"在触控笔模式下使用涂鸦功能会显示十字准星 <b><u>打开:</u></b> 显示 <b><u>关闭:</u></b> 隐藏<br>"+
"效果取决于设备。十字准星通常在绘图板、MS Surface 上可见,但在iOS上不可见。",
"效果取决于设备。十字准星通常在绘图板、MS Surface 上可见。但在 iOS 上不可见。",
SHOW_DRAWING_OR_MD_IN_HOVER_PREVIEW_NAME: "在 Markdown 文件的悬停预览中渲染为图片",
SHOW_DRAWING_OR_MD_IN_HOVER_PREVIEW_DESC:
"这个设置影响 frontmatter 中具有 <b>excalidraw-open-md: true</b> 的文件.",
"这个设置影响 frontmatter 中具有 <b>excalidraw-open-md: true</b> 的文件。",
SHOW_DRAWING_OR_MD_IN_READING_MODE_NAME: "在 Markdown 文件阅读模式下渲染为图片",
SHOW_DRAWING_OR_MD_IN_READING_MODE_DESC:
"必须关闭活动的 Excalidraw/Markdown 文件,然后重新打开才能使此更改生效。<br>当您处于 Markdown 阅读模式(即阅读 Excalidraw 的背景笔记)时 Excalidraw 绘图是否应该呈现为图像? " +
"此设置不会影响您处于 Excalidraw 模式时的绘图显示,也不会影响将绘图嵌入到 Markdown 文档中或在渲染悬停预览时的显示。<br><ul>" +
"<li>看下面的“嵌入和导出”中的<b>PDF导出</b>的其他相关设置。</li>" +
"<li>看下面的“嵌入和导出”中的 <b>PDF 导出</b>的其他相关设置。</li>" +
"<li>请务必查看“其他功能”部分中的<b>淡化设置</b>。</li></ul>",
SHOW_DRAWING_OR_MD_IN_EXPORTPDF_NAME: "在 Markdown 模式下导出为 PDF 时渲染为图片",
SHOW_DRAWING_OR_MD_IN_EXPORTPDF_DESC:
"必须关闭活动的 Excalidraw/Markdown 文件,然后重新打开才能使此更改生效。<br>当您处于 Markdown 阅读模式(即阅读 Excalidraw 的背景笔记)时将笔记导出为 PDF, Excalidraw 绘图是否应该呈现为图像? <br><ul>" +
"必须关闭活动的 Excalidraw/Markdown 文件,然后重新打开才能使此更改生效。<br>当您处于 Markdown 阅读模式(即阅读 Excalidraw 的背景笔记)时将笔记导出为 PDF,Excalidraw 绘图是否应该呈现为图像? <br><ul>" +
"<li>查看上面“外观和行为”下的 <b>Markdown 阅读模式</b>的其他相关设置。</li>" +
"<li>请务必查看“其他功能”部分中的<b>淡化设置</b>。</li></ul>",
THEME_HEAD: "主题和样式",
@@ -324,7 +345,7 @@ FILENAME_HEAD: "文件名",
DEFAULT_PINCHZOOM_NAME: "允许在触控笔模式下进行双指缩放",
DEFAULT_PINCHZOOM_DESC:
"在触控笔模式下使用自由画笔工具时,双指缩放可能造成干扰。<br>" +
"<b>开启: </b>允许在触控笔模式下进行双指缩放<br><b>关闭: </b>禁止在触控笔模式下进行双指缩放",
"<b>开启::</b>允许在触控笔模式下进行双指缩放<br><b>关闭: </b>禁止在触控笔模式下进行双指缩放",
DEFAULT_WHEELZOOM_NAME: "鼠标滚轮缩放页面",
DEFAULT_WHEELZOOM_DESC:
@@ -350,7 +371,7 @@ FILENAME_HEAD: "文件名",
LINKS_DESC:
`按住 ${labelCTRL()} 并点击包含 <code>[[链接]]</code> 的文本元素可以打开其中的链接。` +
"如果所选文本元素包含多个 <code>[[有效的内部链接]]</code> ,只会打开第一个链接;" +
"如果所选文本元素包含有效的 URL 链接 (如 <code>https://</code> 或 <code>http://</code>)," +
"如果所选文本元素包含有效的 URL 链接(如 <code>https://</code> 或 <code>http://</code>)," +
"插件会在浏览器中打开链接。<br>" +
"链接的源文件被重命名时,绘图中相应的 <code>[[内部链接]]</code> 也会同步更新。" +
"若您不愿绘图中的链接外观因此而变化,可使用 <code>[[内部链接|别名]]</code>。",
@@ -359,7 +380,7 @@ FILENAME_HEAD: "文件名",
"Excalidraw 不会检查您的设置是否合理,因此请谨慎设置,避免冲突。" +
"以下选项在苹果和非苹果设备上区别很大,如果您在多个硬件平台上使用 Obsidian,需要分别进行设置。"+
"选项里的 4 个开关依次代表 " +
(DEVICE.isIOS || DEVICE.isMacOS ? "SHIFT, CMD, OPT, CONTROL." : "SHIFT, CTRL, ALT, META (Win 键)。"),
(DEVICE.isIOS || DEVICE.isMacOS ? "Shift, CMD, OPT, CONTROL." : "Shift, Ctrl, Alt, META (Win 键)。"),
LONG_PRESS_DESKTOP_NAME: "长按打开(电脑端)",
LONG_PRESS_DESKTOP_DESC: "长按(以毫秒为单位)打开在 Markdown 文件中嵌入的 Excalidraw 绘图。",
LONG_PRESS_MOBILE_NAME: "长按打开(移动端)",
@@ -381,7 +402,7 @@ FILENAME_HEAD: "文件名",
MAINWORKSPACE_PANE_NAME: "在主工作区中打开",
MAINWORKSPACE_PANE_DESC:
`按住 ${labelCTRL()}+${labelSHIFT()} 并点击绘图里的内部链接时,插件默认会在当前窗口的新面板中打开该链接。<br>` +
"若开启此项,Excalidraw 会在主工作区的面板中打开该链接。",
"若开启此项,Excalidraw 会在主工作区的面板中打开该链接。",
LINK_BRACKETS_NAME: "在链接的两侧显示 <code>[[中括号]]</code>",
LINK_BRACKETS_DESC: `${
"文本元素处于预览(PREVIEW)模式时,在内部链接的两侧显示中括号。<br>" +
@@ -406,7 +427,7 @@ FILENAME_HEAD: "文件名",
HOVERPREVIEW_NAME: "鼠标悬停预览内部链接",
HOVERPREVIEW_DESC:
`<b>开启:</b>在 Excalidraw <u>阅读模式(View)</u>下,鼠标悬停在 <code>[[内部链接]]</code> 上即可预览;` +
"而在<u>普通模式(Normal)</u>下, 鼠标悬停在内部链接右上角的蓝色标识上即可预览。<br> " +
"而在<u>普通模式(Normal)</u>下,鼠标悬停在内部链接右上角的蓝色标识上即可预览。<br> " +
`<b>关闭:</b>鼠标悬停在 <code>[[内部链接]]</code> 上,并且按住 ${labelCTRL()} 才能预览。`,
LINKOPACITY_NAME: "链接标识的透明度",
LINKOPACITY_DESC:
@@ -449,12 +470,12 @@ FILENAME_HEAD: "文件名",
MD_TRANSCLUDE_WIDTH_DESC:
"MD-Embed 的宽度。该选项会影响到折行,以及图像元素的宽度。<br>" +
"您可为绘图中的某个 MD-Embed 单独设置此项,方法是将绘图切换至 Markdown 模式," +
"并修改相应的 <code>[[Embed文件名#标题|宽度x最大高度]]</code>。",
"并修改相应的 <code>[[Embed 文件名#标题|宽度x最大高度]]</code>。",
MD_TRANSCLUDE_HEIGHT_NAME:
"MD-Embed 的默认最大高度",
MD_TRANSCLUDE_HEIGHT_DESC:
"MD-Embed 的高度取决于 Markdown 文档内容的多少,但最大不会超过该值。<br>" +
"您可为绘图中的某个 MD-Embed 单独设置此项,方法是将绘图切换至 Markdown 模式,并修改相应的 <code>[[Embed文件名#^块引ID|宽度x最大高度]]</code>。",
"您可为绘图中的某个 MD-Embed 单独设置此项,方法是将绘图切换至 Markdown 模式,并修改相应的 <code>[[Embed 文件名#^块引ID|宽度x最大高度]]</code>。",
MD_DEFAULT_FONT_NAME:
"MD-Embed 的默认字体",
MD_DEFAULT_FONT_DESC:
@@ -475,11 +496,11 @@ FILENAME_HEAD: "文件名",
MD_CSS_DESC:
"MD-Embed 图像所采用的 CSS 样式表文件名。需包含扩展名,例如 md-embed.css。" +
"允许使用 Markdown 文件(如 md-embed-css.md),但其内容应符合 CSS 语法。<br>" +
"如果您要查询 CSS 所作用的 HTML 节点,请在 Obsidian 开发者控制台(CTRL+SHIFT+i)中键入命令:" +
"如果您要查询 CSS 所作用的 HTML 节点,请在 Obsidian 开发者控制台(Ctrl+Shift+I)中键入命令:" +
"<code>ExcalidrawAutomate.mostRecentMarkdownSVG</code> —— 这将显示 Excalidraw 最近生成的 SVG。<br>" +
"此外,在 CSS 中不能任意地设置字体,您一般只能使用系统默认的标准字体(详见 README)," +
"但可以通过上面的设置来额外添加一个自定义字体。<br>" +
"您可为某个 MD-Embed 单独设置此项,方法是在其源文件的 frontmatter 中添加形如 <code>excalidraw-css: 库中的CSS文件或CSS片段</code> 的键值对。",
"您可为某个 MD-Embed 单独设置此项,方法是在其源文件的 frontmatter 中添加形如 <code>excalidraw-css: 库中的 CSS 文件或 CSS 片段</code> 的键值对。",
EMBED_HEAD: "嵌入到 Markdown 文档中的绘图",
EMBED_DESC: `包括:嵌入到 Markdown 文档中的绘图的预览图类型(SVG、PNG)、源文件类型(Excalidraw 绘图文件、SVG、PNG)、缓存、图像大小、图像主题,以及嵌入的语法等。
此外,还有自动导出 SVG 或 PNG 文件并保持与绘图文件状态同步的设置。`,
@@ -518,7 +539,7 @@ FILENAME_HEAD: "文件名",
EMBED_PREVIEW_IMAGETYPE_DESC:
"<b>Native SVG:</b>高品质、可交互。<br>" +
"<b>SVG:</b>高品质、不可交互。<br>" +
"<b>PNG:</b>高性能、<a href='https://www.youtube.com/watch?v=yZQoJg2RCKI&t=633s' target='_blank'>不可交互</a>。",
"<b>PNG:</b>高性能、<a href='https://www.youtube.com/watch?v=yZQoJg2RCKI&t=633s' target='_blank'>不可交互</a>。",
PREVIEW_MATCH_OBSIDIAN_NAME: "预览图匹配 Obsidian 主题",
PREVIEW_MATCH_OBSIDIAN_DESC:
"开启此项,则当 Obsidian 处于黑暗模式时,嵌入到 Markdown 文档中的绘图的预览图也会以黑暗模式渲染;当 Obsidian 处于明亮模式时,预览图也会以明亮模式渲染。<br>" +
@@ -530,7 +551,7 @@ FILENAME_HEAD: "文件名",
"方法是修改相应的内部链接格式为形如 <code>![[drawing.excalidraw|100]]</code> 或 <code>[[drawing.excalidraw|100x100]]</code>。",
EMBED_HEIGHT_NAME: "预览图的默认高度",
EMBED_HEIGHT_DESC:
"嵌入到 Markdown 文档中的绘图的预览图得默认高度。该选项也适用于实时预览编辑和阅读模式,以及悬停预览。" +
"嵌入到 Markdown 文档中的绘图的预览图得默认高度。该选项也适用于实时预览编辑和阅读模式,以及悬停预览。" +
"您可以在使用 <code>![[drawing.excalidraw|100]]</code> 或者 <code>[[drawing.excalidraw|100x100]]</code>" +
"格式在嵌入图像时指定自定义高度。",
EMBED_TYPE_NAME: "“嵌入绘图到当前 Markdown 文档中”系列命令的源文件类型",
@@ -542,7 +563,7 @@ FILENAME_HEAD: "文件名",
EMBED_MARKDOWN_COMMENT_NAME: "将链接作为注释嵌入",
EMBED_MARKDOWN_COMMENT_DESC:
"在图像下方以 Markdown 链接的形式嵌入原始 Excalidraw 文件的链接,例如:<code>%%[[drawing.excalidraw]]%%</code>。<br>" +
"除了添加 Markdown 注释之外,您还可以选择嵌入的 SVG 或 PNG,并使用命令面板: " +
"除了添加 Markdown 注释之外,您还可以选择嵌入的 SVG 或 PNG,并使用命令面板:" +
"'<code>Excalidraw: 打开 Excalidraw 绘图</code>'来打开该绘图",
EMBED_WIKILINK_NAME: "“嵌入绘图到当前 Markdown 文档中”系列命令产生的内部链接类型",
EMBED_WIKILINK_DESC:
@@ -554,7 +575,7 @@ FILENAME_HEAD: "文件名",
"如果关闭,将导出透明背景的图像。",
EXPORT_PADDING_NAME: "导出的图像的空白边距",
EXPORT_PADDING_DESC:
"导出的 SVG/PNG 图像四周的空白边距(单位:像素)。<br>" +
"导出的 SVG/PNG 图像四周的空白边距(单位:像素)。对于裁剪框架引用,间距被设置为 0。<br>" +
"增加该值,可以避免在导出图像时,靠近图像边缘的图形被裁掉。<br>" +
"您可为某个绘图单独设置此项,方法是在其 frontmatter 中添加形如 <code>excalidraw-export-padding: 5<code> 的键值对。",
EXPORT_THEME_NAME: "导出的图像匹配主题",
@@ -586,13 +607,15 @@ FILENAME_HEAD: "文件名",
"该选项可作用于“自动导出 SVG 副本”、“自动导出 PNG 副本”,以及其他的手动的导出命令。",
COMPATIBILITY_HEAD: "兼容性设置",
COMPATIBILITY_DESC: "如果没有特殊原因(例如您想同时在 VSCode / Logseq 和 Obsidian 中使用 Excalidraw),建议您使用 markdown 格式的绘图文件,而不是旧的 excalidraw.com 格式,因为本插件的很多功能在旧格式中无法使用。",
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_NAME: "插入虚拟的第一个文本元素以支持代码格式化工具(Linting)",
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_NAME: "代码格式化(Linting)兼容性",
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_DESC: "Excalidraw 对 <code># Excalidraw Data</code> 下的文件结构非常敏感。文档的自动代码格式化(linting)可能会在 Excalidraw 数据中造成错误。" +
"虽然我已经努力使数据加载对自动代码格式化(linting)变更具有一定的抗性,但这种解决方案并非万无一失。<br>"+
"<mark>最好的方法是避免使用不同的插件对 Excalidraw 文档进行自动更改。</mark><br>" +
"如果出于某些合理的原因,您决定忽略我的建议并配置了 Excalidraw 文件的自动代码格式化,那么可以使用这个设置<br> " +
"<code>## Text Elements</code> 部分对空行很敏感。一种常见的代码格式化是在章节标题后添加一个空行。但对于 Excalidraw 来说,这将破坏/改变您绘图中的第一个文本元素。" +
"为了解决这个问题,您可以启用这个设置。启用后 Excalidraw 将在 <code>## Text Elements</code> 的开头添加一个虚拟元素,供自动代码格式化工具修改。" ,
PRESERVE_TEXT_AFTER_DRAWING_NAME: "Zotero 兼容性",
PRESERVE_TEXT_AFTER_DRAWING_DESC: "保留 Markdown 文件中 <code>## Drawing</code> 部分之后的文本内容。保存非常大的绘图时,这可能会造成微小的性能影响。",
DEBUGMODE_NAME: "开启 debug 信息",
DEBUGMODE_DESC: "我建议在启用/禁用此设置后重新启动 Obsidian。这将在控制台中启用调试消息。这对于排查问题很有帮助。" +
"如果您在使用插件时遇到问题,请启用此设置,重现问题,并在 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/issues'>GitHub</a> 上提出的问题中包含控制台日志。",
@@ -623,13 +646,13 @@ FILENAME_HEAD: "文件名",
LATEX_DEFAULT_NAME: "插入 LaTeX 时的默认表达式",
LATEX_DEFAULT_DESC: "允许留空。允许使用类似 <code>\\color{white}</code> 的格式化表达式。",
NONSTANDARD_HEAD: "非 Excalidraw.com 官方支持的特性",
NONSTANDARD_DESC: `这些特性不受 Excalidraw.com 官方支持。如果以 Excalidraw.com 格式导出绘图,这些特性将会发生不可预知的变化。
NONSTANDARD_DESC: `这些特性不受 Excalidraw.com 官方支持。如果在 Excalidraw.com 导入绘图,这些特性将会发生不可预知的变化。
包括:自定义画笔工具的数量,自定义字体等。`,
RENDER_TWEAK_HEAD: "渲染优化",
MAX_IMAGE_ZOOM_IN_NAME: "最大图像放大倍数",
MAX_IMAGE_ZOOM_IN_DESC: "为了节省内存,并且因为 Apple Safari (Obsidian on iOS) 有一些硬编码的限制,Excalidraw.com 在放大时会限制图像和大型对象的最大分辨率。您可以使用乘数来覆盖这个限制。" +
"这意味着将乘以 Excalidraw 默认设置的限制,乘数越大,图像放大分辨率就越高,但也会消耗更多内存。" +
"我建议尝试多个值来设置这个参数。当您放大一个较大的 PNG 图像时,如果图像突然从视图中消失,那就说明您已经达到了极限。默认值为 1。此设置对 iOS 无效。",
"我建议尝试多个值来设置这个参数。当您放大一个较大的 PNG 图像时,如果图像突然从视图中消失,那就说明您已经达到了极限。默认值为 1。此设置对 iOS 无效。",
CUSTOM_PEN_HEAD: "自定义画笔",
CUSTOM_PEN_NAME: "自定义画笔工具的数量",
CUSTOM_PEN_DESC: "在画布上的 Obsidian 菜单按钮旁边切换自定义画笔。长按画笔按钮可以修改其样式。",
@@ -667,9 +690,14 @@ FILENAME_HEAD: "文件名",
FADE_OUT_EXCALIDRAW_MARKUP_NAME: "淡化 Excalidraw 标记",
FADE_OUT_EXCALIDRAW_MARKUP_DESC: "在 Markdown 视图模式下,在 Markdown 注释 %% " +
"之后的部分会淡化。文本仍然存在,但视觉杂乱感会减少。请注意,您可以将 %% 放在 # Text Elements 行的上一行," +
"这样,整个 Excalidraw Markdown 都会淡化,包括 # Text Elements。 副作用是您将无法在其他 Markdown 笔记中引用文本块,即 %% 注释部分之后的内容。这应该不是大问题。" +
"这样,整个 Excalidraw Markdown 都会淡化,包括 # Text Elements。 副作用是您将无法在其他 Markdown 笔记中引用文本块,即 %% 注释部分之后的内容。这应该不是大问题。" +
"如果您想编辑 Excalidraw Markdown 脚本,只需切换到 Markdown 视图模式并暂时删除 %% 注释。",
CUSTOM_FONT_HEAD: "自定义字体",
EXCALIDRAW_PROPERTIES_NAME: "将 Excalidraw 属性加载到 Obsidian 的自动提示中",
EXCALIDRAW_PROPERTIES_DESC: "切换此设置以在插件启动时将 Excalidraw 文档属性加载到 Obsidian 的属性自动提示中。"+
"启用此功能简化了 Excalidraw 前置属性的使用,使您能够利用许多强大的设置。如果您不希望自动加载这些属性," +
"您可以禁用此功能,但您将需要手动从自动提示中移除任何不需要的属性。" +
"请注意,启用此设置需要重启插件,因为属性是在启动时加载的。",
CUSTOM_FONT_HEAD: "本地字体",
ENABLE_FOURTH_FONT_NAME: "为文本元素启用本地字体",
ENABLE_FOURTH_FONT_DESC:
"开启此项后,文本元素的属性面板里会多出一个本地字体按钮。<br>" +
@@ -678,7 +706,7 @@ FILENAME_HEAD: "文件名",
"若在 excalidraw.com 或者其他版本的 Excalidraw 中打开,使用本地字体的文本会变回系统默认字体。",
FOURTH_FONT_NAME: "本地字体文件",
FOURTH_FONT_DESC:
"选择库文件夹中的一个 .ttf, .woff 或 .woff2 字体文件作为本地字体文件。" +
"选择库文件夹中的一个 .ttf,.woff 或 .woff2 字体文件作为本地字体文件。" +
"若未选择文件,则使用默认的 Virgil 字体。",
SCRIPT_SETTINGS_HEAD: "已安装脚本的设置",
SCRIPT_SETTINGS_DESC: "有些 Excalidraw 自动化脚本包含设置项,当执行这些脚本时,它们会在该列表下添加设置项。",
@@ -689,7 +717,7 @@ FILENAME_HEAD: "文件名",
"注意,识别的过程不是在本地进行的,而是通过在线 API,图像会被上传到 taskbone 的服务器(仅用于识别目的)。如果您介意,请不要使用这个功能。",
TASKBONE_ENABLE_NAME: "启用 Taskbone",
TASKBONE_ENABLE_DESC: "启用意味着您同意 Taskbone <a href='https://www.taskbone.com/legal/terms/' target='_blank'>条款及细则</a> 以及 " +
"<a href='https://www.taskbone.com/legal/privacy/' target='_blank'>隐私政策</a>.",
"<a href='https://www.taskbone.com/legal/privacy/' target='_blank'>隐私政策</a>。",
TASKBONE_APIKEY_NAME: "Taskbone API Key",
TASKBONE_APIKEY_DESC: "Taskbone 的免费 API key 提供了一定数量的每月识别次数。如果您非常频繁地使用此功能,或者想要支持 " +
"Taskbone 的开发者(您懂的,没有人能用爱发电,Taskbone 开发者也需要投入资金来维持这项 OCR 服务)您可以" +
@@ -698,7 +726,7 @@ FILENAME_HEAD: "文件名",
//openDrawings.ts
SELECT_FILE: "选择一个文件后按回车。",
SELECT_COMMAND: "选择一个命令后按回车。",
SELECT_FILE_WITH_OPTION_TO_SCALE: `选择一个文件后按回车,或者 ${labelSHIFT()}+${labelMETA()}+ENTER 以 100% 尺寸插入。`,
SELECT_FILE_WITH_OPTION_TO_SCALE: `选择一个文件后按回车,或者 ${labelSHIFT()}+${labelMETA()}+Enter 以 100% 尺寸插入。`,
NO_MATCH: "查询不到匹配的文件。",
NO_MATCHING_COMMAND: "查询不到匹配的命令。",
SELECT_FILE_TO_LINK: "选择要插入(以内部链接形式嵌入)到当前绘图中的文件。",
@@ -716,7 +744,7 @@ FILENAME_HEAD: "文件名",
//SelectCard.ts
TYPE_SECTION: "输入章节名称(标题)进行选择",
SELECT_SECTION_OR_TYPE_NEW:
"选择现有章节(标题)或输入新章节(标题)的名称,然后按 Enter。",
"选择现有章节(标题)或输入新章节(标题)的名称,然后按 Enter。",
INVALID_SECTION_NAME: "无效的章节名称(标题)",
EMPTY_SECTION_MESSAGE: "输入章节(标题)名称以创建",
@@ -800,4 +828,11 @@ FILENAME_HEAD: "文件名",
INTERNAL_DRAG_ACTION: "在 Obsidian 内部拖放时",
PANE_TARGET: "点击链接时",
DEFAULT_ACTION_DESC: "无修饰键时的行为:",
//FrameSettings.ts
FRAME_SETTINGS_TITLE: "框架设置",
FRAME_SETTINGS_ENABLE: "启用框架",
FRAME_SETTIGNS_NAME: "显示框架名称",
FRAME_SETTINGS_OUTLINE: "显示框架外边框",
FRAME_SETTINGS_CLIP: "启用框架裁剪",
};
+508 -297
View File
File diff suppressed because it is too large. Load diff
+9 -4
View File
@@ -1,12 +1,11 @@
import * as React from "react";
import ExcalidrawView from "../ExcalidrawView";
import { Notice } from "obsidian";
type ButtonProps = {
title: string;
action: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
longpress?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
icon: JSX.Element;
view: ExcalidrawView;
};
type ButtonState = {
@@ -24,6 +23,10 @@ export class ActionButton extends React.Component<ButtonProps, ButtonState> {
};
}
componentWillUnmount(): void {
this.render = () => null;
}
render() {
return (
<button
@@ -48,7 +51,8 @@ export class ActionButton extends React.Component<ButtonProps, ButtonState> {
onPointerDown={(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
this.toastMessageTimeout = window.setTimeout(
() => {
this.props.view.excalidrawAPI?.setToast({message:this.props.title, duration: 3000, closable: true});
new Notice(this.props.title, 3000);
//this.props.view.excalidrawAPI?.setToast({message:this.props.title, duration: 3000, closable: true});
this.toastMessageTimeout = 0;
},
400,
@@ -58,7 +62,8 @@ export class ActionButton extends React.Component<ButtonProps, ButtonState> {
if(this.props.longpress) {
this.props.longpress(event);
} else {
this.props.view.excalidrawAPI?.setToast({message:"Cannot pin this action", duration: 3000, closable: true});
new Notice("Cannot pin this action", 3000);
//this.props.view.excalidrawAPI?.setToast({message:"Cannot pin this action", duration: 3000, closable: true});
}
this.longpressTimeout = 0;
},
+113 -74
View File
@@ -59,6 +59,21 @@ 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>
),
Discord: (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -634,82 +649,106 @@ export const ICONS = {
<line x1="9" x2="15" y1="15" y2="15"/>
</svg>
),
ExcalidrawSword: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 537.9 1150.7"
>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m281 988 113-124-77-569H213l-37 574 106 120-4 2"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M279 989c37-42 82-84 116-122M279 990c33-33 59-66 113-123m0-1c-22-191-51-385-78-570m78 570c-31-196-58-391-78-570m-4-1c-30-1-56 1-97-1m102 3c-41 1-81 0-106-3m1 3c-11 185-20 369-30 574m30-574c-7 165-16 330-32 575m2-3c38 47 73 81 97 121m-98-116c39 41 76 86 100 114m0 1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="#af7e00" strokeLinecap="round" strokeWidth="4" d="M279 614v264m-3-259c2 43 8 211 8 254"/>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke="#646261" strokeWidth=".5" d="M209 300c2-1 6-5 9-3m-8 3 7-5m-4 7c-1-1 2-6 5-8m-6 9 5-9m-9 16c3-3 6-11 12-18m-11 14c5-2 10-7 12-10m-13 17c5-7 9-15 15-21m-13 18c4-7 8-10 13-15m-15 17c7-2 14-11 18-20m-19 20c7-3 7-8 21-15m-18 17c6-8 11-15 13-15m-12 17c6-7 11-16 14-23m-19 24 28-22m-25 25 25-25m-24 25c7-7 13-14 23-28m-21 30 18-27m-20 29c4-9 17-13 25-30m-28 30c10-4 17-12 31-30m-28 34c11-9 20-20 26-34m-26 34c10-11 15-20 30-32m-32 40c5-12 16-20 31-40m-31 36c9-10 20-20 34-38m-34 38c11-12 23-22 35-37m-33 39c10-12 24-25 33-40m-34 44c10-12 19-25 42-43m-43 46 41-44m-36 42c9-13 31-32 32-44m-35 46c12-11 22-23 38-45m-43 48c13-14 27-20 47-52m-44 52c16-14 33-35 47-50m-43 51c8-12 25-25 38-50m-40 54 43-56m-43 56c9-9 25-28 46-58m-51 61c13-15 30-30 56-57m-51 58c17-20 35-40 46-57m-47 61c14-16 25-32 48-61m-48 63c15-18 27-27 57-63m-62 64c18-20 33-37 59-63m-51 61c13-19 34-37 48-65m-53 70c16-19 31-34 58-68m-61 69c30-25 48-55 63-67m-63 66c20-17 38-40 66-65m-58 67c23-23 42-48 53-67m-55 71c18-27 42-50 59-74m-60 78c12-21 33-35 64-75m-66 74c20-26 46-53 67-77m-63 80c24-27 43-54 66-77m-70 75c30-31 55-63 68-76m-74 80c15-17 32-32 78-85m-75 86c23-25 48-49 74-83m-66 88c18-21 36-50 66-90m-69 88c21-29 43-55 70-87m-77 93c36-34 59-66 80-93m-79 89c27-25 49-54 81-88m-73 89c23-32 48-61 71-89m-76 94 79-96m-77 96c27-32 58-65 84-90m-89 92c34-38 69-78 86-94m-81 98 84-96m-86 97c32-42 66-82 83-100m-82 100c29-39 62-74 87-98m-92 98c27-24 50-52 93-100m-86 105c34-44 72-83 86-106m-87 105c34-36 63-73 88-104m-91 105c26-24 50-47 94-104m-94 106c27-31 57-67 95-107m-96 109c38-39 71-78 99-112m-97 113 96-110M200 414c35-34 57-67 102-115m-98 110c38-42 77-83 102-112m-96 116c17-27 44-59 96-117m-99 116c23-25 45-55 99-117M205 415c35-45 77-87 110-122M203 418c43-43 81-91 108-122M208 420c44-45 84-97 100-128M205 419l108-123M201 421c40-44 83-86 114-127M203 425c33-41 70-82 111-127M205 425c24-29 50-53 107-131M206 428c38-41 72-83 108-132M205 430l109-132M204 429c30-38 65-73 112-125M204 435c31-35 63-72 111-130M205 433c40-46 76-96 112-132M205 441c20-34 43-60 112-135M200 439c33-34 59-66 116-133M202 436c29-30 56-63 114-129M206 440c27-36 57-70 111-133M201 442c26-31 58-61 120-127M202 445c20-30 46-54 117-131M201 450c41-51 79-93 113-138M204 444c34-40 71-82 113-133M203 450c33-42 68-79 115-135M200 451l120-132M204 449c33-26 65-68 113-132M205 451l115-133M200 458l117-138M201 458l119-135M202 459c35-38 69-74 119-139M205 460c31-42 65-82 113-135M199 467c29-29 52-60 119-135M201 462c32-40 70-80 118-135M203 462c47-52 93-98 116-135M205 466c39-47 76-90 113-139M196 472c35-33 62-58 123-137M199 470c31-36 63-68 120-136M205 469c26-33 56-67 114-132M204 473c42-44 80-91 115-137M197 477c45-52 96-107 121-137M199 477c31-42 67-79 122-137M199 481c44-51 78-97 120-145M200 479c39-46 78-94 123-140M196 485c37-47 76-83 124-144M201 483c31-32 59-68 120-138M204 486c41-56 89-104 115-145M204 485l118-142M196 487c35-29 63-70 124-136M201 491c35-48 73-91 123-143M201 494c36-40 66-71 121-147M204 493c26-38 55-69 120-143M196 498c37-47 79-94 125-147M200 495c38-39 76-82 123-139M200 496c48-48 89-100 127-139M200 499c28-32 55-62 125-146M199 500c26-32 62-68 125-137M198 502c42-47 81-95 125-143M204 506c32-42 60-73 122-145M203 504c37-42 75-90 121-142M202 512c37-51 83-95 121-150M197 507c49-52 92-102 127-140M203 515c45-54 89-106 119-153M203 512c37-45 78-93 121-148M196 518c47-61 104-120 127-145M197 514c32-36 67-72 131-145M198 515c38-40 71-78 127-145M198 518c46-52 89-105 127-149M193 521c47-53 96-111 133-149M199 522c42-47 86-94 127-147M203 523c33-45 71-89 124-149M201 524c44-52 88-104 124-149M199 532c38-55 81-97 127-154M199 527c49-60 104-115 127-148M201 533c28-43 61-84 126-150M199 529c50-53 95-113 128-147M199 533c31-34 63-69 132-148M197 533c43-46 86-97 132-145M195 541l135-157M200 536c42-53 86-105 127-148M198 543c33-41 65-79 128-152M196 540c38-46 75-89 131-150M199 542c40-48 85-93 128-148M198 544c28-36 57-69 130-153M194 549c56-57 105-117 137-150M197 546c37-46 79-89 132-148M197 550c39-44 81-94 131-155M201 552c38-51 80-99 130-155M197 554c30-39 62-72 134-153M195 553c37-40 73-79 136-152M199 555c50-61 102-120 131-150M199 558c43-53 84-102 131-155M196 563c34-40 68-82 132-153M193 561c52-54 99-110 139-154M198 564c29-31 56-66 136-157M198 565c39-45 77-86 131-156M192 566c36-40 73-82 143-153M195 568c28-35 57-71 135-154M195 569c53-55 107-115 138-154M198 569l133-157M196 576c32-34 58-75 133-159M193 572c26-33 57-64 141-154M195 579c54-57 103-117 134-158M198 575c36-40 70-82 133-157M190 579c64-65 117-122 141-155M195 582c39-47 82-94 138-158M196 581c28-38 64-72 138-154M198 583l134-159M191 588c52-61 101-114 145-158M194 588c51-64 102-124 141-160M195 586c41-45 85-97 138-154M197 590c41-47 82-95 135-162M195 594c30-42 63-76 139-162M193 594c32-34 59-68 140-161M195 596c42-50 76-93 141-163M197 594c32-37 65-72 136-160M192 603l142-162M192 598c30-31 59-64 144-157M197 604c43-59 95-112 138-164M195 603c54-64 106-127 139-164M194 605l144-163M192 608c39-42 79-87 146-164M199 612c31-46 66-86 139-170M197 608c38-47 79-93 141-163M190 611c62-65 121-129 149-163M193 614c55-69 11Line truncated
<path stroke="#000" d="M283 989c39-52 86-95 106-127M282 989c38-44 73-85 112-126m-2 1c-27-190-56-380-78-570m79 570c-33-223-64-446-78-568m-1 2c-40 1-79 1-101-6m100 5H210m2-4c-15 208-26 416-31 578m31-576c-14 162-22 325-32 575m0 1c25 33 57 69 96 113m-96-114c29 41 62 76 98 117m2 1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#dbc9f3" d="m325 490-71-1-133 118-5 3-4 4-3 5-3 5-19 127 20 15 19 15 16 16 14 17 12 18 9 18 8 20 6 20 15-4 15-3 13-2 13-2 12-1 11-1 15 1 5 1-4-11-5-20-5-20-3-19-2-20-1-19v-19l2-19 2-18 3-19 4-18 6-18 6-19 6-18 8-18 4-9 9-18 4-8 2-8 3-10 1-10v-12l-5-39"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M325 490s0 0 0 0m0 0s0 0 0 0m0 0-71-1m71 1-71-1m0 0L121 607m133-118L121 607m0 0s0 0 0 0m0 0s0 0 0 0m0 0-5 3m5-3-5 3m0 0-4 4m4-4-4 4m0 0-3 5m3-5-3 5m0 0-3 5m3-5-3 5m0 0L87 751m19-127L87 751m0 0s0 0 0 0m0 0s0 0 0 0m0 0 20 15m-20-15 20 15m0 0 19 15m-19-15 19 15m0 0 16 16m-16-16 16 16m0 0 14 17m-14-17 14 17m0 0 12 18m-12-18 12 18m0 0 9 18m-9-18 9 18m0 0 8 20m-8-20 8 20m0 0 6 20m-6-20 6 20m0 0 15-4m-15 4 15-4m0 0 15-3m-15 3 15-3m0 0 13-2m-13 2 13-2m0 0 13-2m-13 2 13-2m0 0 12-1m-12 1 12-1m0 0 11-1m-11 1 11-1m0 0 15 1m-15-1 15 1m0 0 5 1m-5-1 5 1m0 0-4-11m4 11-4-11m0 0-5-20m5 20-5-20m0 0-5-20m5 20-5-20m0 0-3-19m3 19-3-19m0 0-2-20m2 20-2-20m0 0-1-19m1 19-1-19m0 0v-19m0 19v-19m0 0 2-19m-2 19 2-19m0 0 2-18m-2 18 2-18m0 0 3-19m-3 19 3-19m0 0 4-18m-4 18 4-18m0 0 6-18m-6 18 6-18m0 0 6-19m-6 19 6-19m0 0 6-18m-6 18 6-18m0 0 8-18m-8 18 8-18m0 0 4-9m-4 9 4-9m0 0 9-18m-9 18 9-18m0 0 4-8m-4 8 4-8m0 0 2-8m-2 8 2-8m0 0 3-10m-3 10 3-10m0 0 1-10m-1 10 1-10m0 0v-12m0 12v-12m0 0-5-39m5 39-5-39m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#a887e8" d="m439 634 10 20 4 24 2 26 3 25 5 25 8 25 9 24 12 24 13 24 8 11 9 12 7 10 2 6 2 6v5l-2 5-2 5-5 8-61 99-8-17-8-16-9-14-9-14-9-12-10-11-10-10-11-10-11-8-11-7-12-6-12-5-13-4-13-3-14-2-6-1h-7l-7-20-5-20-4-20-3-19-1-19-1-19 1-28 2-19 3-18 4-18 5-19 6-18 7-18 8-18 9-19 7-14 7-20 2-21-5-41 114 144"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M439 634s0 0 0 0m0 0s0 0 0 0m0 0 10 20m-10-20 10 20m0 0 4 24m-4-24 4 24m0 0 2 26m-2-26 2 26m0 0 3 25m-3-25 3 25m0 0 5 25m-5-25 5 25m0 0 8 25m-8-25 8 25m0 0 9 24m-9-24 9 24m0 0 12 24m-12-24 12 24m0 0 13 24m-13-24 13 24m0 0 8 11m-8-11 8 11m0 0 9 12m-9-12 9 12m0 0 7 10m-7-10 7 10m0 0 2 6m-2-6 2 6m0 0 2 6m-2-6 2 6m0 0v5m0-5v5m0 0-2 5m2-5-2 5m0 0-2 5m2-5-2 5m0 0-5 8m5-8-5 8m0 0-61 99m61-99-61 99m0 0s0 0 0 0m0 0s0 0 0 0m0 0-8-17m8 17-8-17m0 0-8-16m8 16-8-16m0 0-9-14m9 14-9-14m0 0-9-14m9 14-9-14m0 0-9-12m9 12-9-12m0 0-10-11m10 11-10-11m0 0-10-10m10 10-10-10m0 0-11-10m11 10-11-10m0 0-11-8m11 8-11-8m0 0-11-7m11 7-11-7m0 0-12-6m12 6-12-6m0 0-12-5m12 5-12-5m0 0-13-4m13 4-13-4m0 0-13-3m13 3-13-3m0 0-14-2m14 2-14-2m0 0-6-1m6 1-6-1m0 0h-7m7 0h-7m0 0-7-20m7 20-7-20m0 0-5-20m5 20-5-20m0 0-4-20m4 20-4-20m0 0-3-19m3 19-3-19m0 0-1-19m1 19-1-19m0 0-1-19m1 19-1-19m0 0 1-28m-1 28 1-28m0 0 2-19m-2 19 2-19m0 0 3-18m-3 18 3-18m0 0 4-18m-4 18 4-18m0 0 5-19m-5 19 5-19m0 0 6-18m-6 18 6-18m0 0 7-18m-7 18 7-18m0 0 8-18m-8 18 8-18m0 0 9-19m-9 19 9-19m0 0 7-14m-7 14 7-14m0 0 7-20m-7 20 7-20m0 0 2-21m-2 21 2-21m0 0-5-41m5 41-5-41m0 0 114 144M325 490l114 144m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#6342a0" d="m190 890 6 29 2 29-1 27-2 14-6 27-8 26-11 25-13 25-7 12 28 1 27 1 27 3 27 4 27 5 25 6 26 7 25 9 12 4 12 2 11-1 10-3 9-5 8-9 6-8 8-18 25-85-10-22-11-20-11-18-13-16-13-14-15-13-15-11-17-9-17-7-19-5-19-3-21-2h-21l-23 3-24 4-24 6"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M190 890s0 0 0 0m0 0s0 0 0 0m0 0 6 29m-6-29 6 29m0 0 2 29m-2-29 2 29m0 0-1 27m1-27-1 27m0 0-2 14m2-14-2 14m0 0-6 27m6-27-6 27m0 0-8 26m8-26-8 26m0 0-11 25m11-25-11 25m0 0-13 25m13-25-13 25m0 0-7 12m7-12-7 12m0 0 28 1m-28-1 28 1m0 0 27 1m-27-1 27 1m0 0 27 3m-27-3 27 3m0 0 27 4m-27-4 27 4m0 0 27 5m-27-5 27 5m0 0 25 6m-25-6 25 6m0 0 26 7m-26-7 26 7m0 0 25 9m-25-9 25 9m0 0 12 4m-12-4 12 4m0 0 12 2m-12-2 12 2m0 0 11-1m-11 1 11-1m0 0 10-3m-10 3 10-3m0 0 9-5m-9 5 9-5m0 0 8-9m-8 9 8-9m0 0 6-8m-6 8 6-8m0 0 8-18m-8 18 8-18m0 0 25-85m-25 85 25-85m0 0s0 0 0 0m0 0s0 0 0 0m0 0-10-22m10 22-10-22m0 0-11-20m11 20-11-20m0 0-11-18m11 18-11-18m0 0-13-16m13 16-13-16m0 0-13-14m13 14-13-14m0 0-15-13m15 13-15-13m0 0-15-11m15 11-15-11m0 0-17-9m17 9-17-9m0 0-17-7m17 7-17-7m0 0-19-5m19 5-19-5m0 0-19-3m19 3-19-3m0 0-21-2m21 2-21-2m0 0h-21m21 0h-21m0 0-23 3m23-3-23 3m0 0-24 4m24-4-24 4m0 0-24 6m24-6-24 6m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#390f8c" d="m87 751 25 19 22 20 20 22 16 24 12 26 9 28 6 27 2 26v27l-4 26-6 26-10 27-13 27-17 26L21 976l-8-12-7-11-1-9v-11l3-9 10-22 69-151"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M87 751s0 0 0 0m0 0s0 0 0 0m0 0 25 19m-25-19 25 19m0 0 22 20m-22-20 22 20m0 0 20 22m-20-22 20 22m0 0 16 24m-16-24 16 24m0 0 12 26m-12-26 12 26m0 0 9 28m-9-28 9 28m0 0 6 27m-6-27 6 27m0 0 2 26m-2-26 2 26m0 0v27m0-27v27m0 0-4 26m4-26-4 26m0 0-6 26m6-26-6 26m0 0-10 27m10-27-10 27m0 0-13 27m13-27-13 27m0 0-17 26m17-26-17 26m0 0L21 976m128 126L21 976m0 0s0 0 0 0m0 0s0 0 0 0m0 0-8-12m8 12-8-12m0 0-7-11m7 11-7-11m0 0-1-9m1 9-1-9m0 0v-11m0 11v-11m0 0 3-9m-3 9 3-9m0 0 10-22M8 924l10-22m0 0 69-151M18 902l69-151m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="#CECDCC" strokeLinecap="round" strokeWidth="10" d="M91 753s0 0 0 0m0 0s0 0 0 0m0 0 21 16m-21-16 21 16m0 0 18 17m-18-17 18 17m0 0 16 16m-16-16 16 16m0 0 13 17m-13-17 13 17m0 0 11 17m-11-17 11 17m0 0 8 17m-8-17 8 17m0 0 7 18m-7-18 7 18m0 0 6 18m-6-18 6 18m0 0 15-4m-15 4 15-4m0 0 14-2m-14 2 14-2m0 0 14-2m-14 2 14-2m0 0 13-2m-13 2 13-2m0 0 12-1m-12 1 12-1m0 0 11-1m-11 1 11-1m0 0h10m-10 0h10m0 0h8m-8 0h8m0 0-6-21m6 21-6-21m0 0-6-20m6 20-6-20m0 0-4-20m4 20-4-20m0 0-3-20m3 20-3-20m0 0-1-19m1 19-1-19m0 0-1-19m1 19-1-19m0 0 1-19m-1 19 1-19m0 0 2-18m-2 18 2-18m0 0 2-19m-2 19 2-19m0 0 4-18m-4 18 4-18m0 0 5-18m-5 18 5-18m0 0 6-18m-6 18 6-18m0 0 7-18m-7 18 7-18m0 0 7-18m-7 18 7-18m0 0 9-18m-9 18 9-18m0 0 9-19m-9 19 9-19m0 0 8-22m-8 22 8-22m0 0 2-10m-2 10 2-10"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m154 297-20-26 25-24 207-6 19 26-27 25-205 1-1-3"/>
<path fill="none" stroke="#000" strokeWidth="4" d="m156 295-20-23m20 24c-7-11-16-19-22-27m6 1c1-11 10-13 21-21m-25 18c6-6 10-11 25-23m0 4c64-2 125-5 200-5m-198 3c64-1 133-4 201-2m-4 0c7 5 16 16 24 23m-20-25c5 6 7 12 20 23m-1 2c-2 8-12 14-18 25m18-24c-7 6-13 13-20 24m-4 1c-82-4-161-3-203 3m207-5c-56 1-110 0-206 4m-1-1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m275 618 12-35 6-12 11-14 23-18 21-16-29-185-5-43-3-5-5-1-45 4-1 14 17 311"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M277 617c2-5 4-24 9-34 4-10 10-19 17-26 7-8 18-13 23-17l10-8c3-3 9-4 11-9 1-5 3 10-2-20l-26-163c-5-31-2-20-3-27l-3-11c-1-4 0-10-2-12s-6 0-11 0l-15 2h-14c-4 0-8-2-10 0s0 7 0 14v30l10 205c3 38 3 13 3 26l1 50m1-1c2-5 7-22 12-31 5-10 11-20 17-27 7-7 17-13 22-17l7-9c4-3 12-5 14-10s3 10-2-20l-28-162c-5-31-2-19-3-25l-1-13c-1-4-1-9-3-11s-5-1-9-1l-17 1h-15c-5 0-10-2-12 0-1 2 3 5 3 13l2 32 10 202c2 39 0 16 0 29l2 49"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke="#bcb9b8" strokeWidth=".5" d="m259 300 6-5m-6 5 7-4m-4 7 3-8m-3 8 4-8m-7 10c4-3 6-3 12-9m-12 10 13-11m-11 13c5-4 5-8 10-14m-8 14 8-14m-11 17c6-4 12-9 15-15m-16 16 17-17m-13 20c1-3 7-8 12-19m-13 17c6-5 8-10 15-17m-15 21c5-9 14-16 21-21m-23 22 22-24m-18 24 19-25m-19 26 18-24m-21 27c8-7 18-19 25-27m-27 28 29-28m-24 29c4-5 13-13 24-28m-25 30 25-32m-28 36c10-10 17-19 33-34m-34 34c8-9 15-17 35-35m-30 37 29-38m-30 38 29-37m-32 38c12-10 24-24 37-39m-36 40 38-40m-37 43c13-13 22-27 36-43m-35 43 36-42m-38 45c11-11 24-24 42-46m-42 46 44-46m-41 50c16-18 29-37 40-52m-40 51c14-19 28-35 41-49m-43 51 46-51m-46 51 45-50m-41 53 42-54m-44 55 45-54m-49 58c15-14 24-29 55-57m-54 56c13-14 26-27 51-57m-46 61c17-23 35-45 49-60m-49 58c11-16 24-32 46-59m-51 64 55-60m-54 60 52-59m-51 61c14-19 32-36 50-61m-48 60 49-60m-52 65c10-14 24-25 55-59m-55 59 54-60m-50 59c13-13 25-28 51-59m-52 62 50-62m-54 66c14-16 27-29 53-60m-53 59c18-21 35-40 54-58m-49 61 50-60m-51 59 50-61m-52 65c12-16 23-27 52-61m-53 60c15-15 29-32 54-60m-49 63 51-63m-52 64 51-63m-55 65 55-60m-54 59c15-15 29-31 53-59m-51 61 52-61m-52 62 53-61m-53 65c14-18 30-36 53-62m-55 62 56-60m-51 61 49-63m-50 64c11-15 23-29 51-62m-53 65c15-18 34-38 55-60m-56 61c15-20 34-39 55-60m-52 61c11-10 20-26 52-63m-53 64c12-15 24-31 52-62m-53 67c11-17 26-35 54-64m-55 63 54-61m-50 63c21-26 41-50 52-61m-54 61 52-63m-55 67c20-26 44-50 57-61m-56 61c21-25 44-50 56-62m-52 64 51-63m-52 64 52-65m-56 65c20-17 39-40 55-60m-54 62 56-63m-53 64 53-64m-54 65 54-64m-53 67c10-14 22-29 55-63m-58 64 57-63m-55 66c20-25 42-52 56-66m-54 65c20-24 39-50 54-64m-57 69c19-23 41-44 56-63m-56 61c18-18 33-37 56-61m-51 62 50-62m-51 63 53-64m-56 68c15-16 31-32 56-64m-57 65c19-23 39-43 58-65m-55 68 56-65m-57 64 55-67m-57 69c20-19 37-43 58-65m-59 66c21-20 38-41 60-64m-57 66c22-26 45-52 59-65m-57 65 54-66m-58 70c23-25 43-44 59-67m-58 66c15-15 27-32 57-64m-56 68c16-16 30-36 57-68m-56 67 56-66m-58 69c19-18 35-40 58-63m-59 63c16-16 28-32 60-65m-55 66 55-66m-56 68 57-68m-62 71c18-17 39-39 62-66m-60 66c16-18 32-37 61-67m-60 71 58-69m-56 68c18-19 33-41 57-69m-59 70c21-19 39-40 62-64m-63 65c25-27 48-53 62-66m-60 70c12-14 25-29 57-71m-56 70 58-70m-60 72c19-22 41-40 59-64m-59 66c19-24 40-45 60-67m-58 68 60-69m-59 71 58-71m-59 72c23-23 46-52 62-67m-65 69 63-68m-60 68c18-18 36-39 60-68m-58 71 57-71m-60 72c14-15 32-34 62-69m-63 71c22-26 45-52 63-70m-60 70c19-20 34-38 61-71m-61 72 61-71m-64 73c23-19 41-40 62-68m-62 70 62-70m-60 72 61-72m-59 72 59-71m-60 74c22-26 45-50 60-71m-63 72 64-70m-61 71c14-14 24-29 63-71m-61 72 59-73m-63 75c23-26 46-52 65-70m-65 71 64-71m-62 75c17-17 33-37 62-75m-60 73 61-73m-64 79 62-71m-63 69 64-71m-60 74c19-23 38-43 60-75m-61 74c19-21 37-43 61-73m-62 79c23-26 46-56 65-76m-67 74 66-72m-64 75c25-26 47-55 65-75m-64 75c17-18 31-36 64-76m-64 78c19-22 38-42 62-72m-64 73c15-17 30-35 66-73m-65 74 64-73m-62 75c14-16 26-34 63-75m-68 76c24-22 44-45 67-69m-65 71 67-73m-64 75 64-76m-64 77 62-77m-66 78c15-13 29-31 68-72m-66 72 67-72m-64 77c13-18 28-31 64-79m-64 78 64-76m-66 77c19-20 37-42 66-71m-67 73 67-74m-62 76c19-26 43-52 62-75m-65 74 66-75m-67 81 66-76m-68 75c27-28 55-58 68-75m-62 78c15-21 30-41 64-78m-67 78 65-78m-67 82c20-21 37-40 69-78m-68 76 67-75m-63 78 65-80m-66 81c12-16 26-32 65-78m-68 81c14-19 32-36 69-79m-70 77c26-26 50-55 69-75m-64 81c14-21 29-38 66-79m-68 77c18-20 33-38 66-80m-66 83c18-22 39-44 66-78m-68 78 69-77m-66 81c21-23 39-48 65-81m-66 81c27-31 50-60 67-81m-70 83c29-29 57-63 72-79m-70 79 70-77m-66 79c13-18 25-35 66-79m-68 78 67-79m-68 82c15-13 28-29 68-76m-68 77 69-78m-66 82 65-81m-67 79c18-18 33-39 69-79m-69 83c18-22 40-48 69-76m-72 77c19-19 36-39 71-79m-68 81c25-31 53-59 69-80m-69 81 69-83m-71 84c15-17 32-34 70-78m-69 79 70-79m-68 84 68-86m-69 84c17-19 30-37 70-82m-70 83 70-79m-72 81c16-17 32-34 72-81m-69 82 69-81m-68 82 69-81m-72 85 71-79m-70 78c21-23 43-46 71-81m-70 83c16-16 33-34 71-84m-71 85 71-82m-74 84 21-18m-19 19 20-21m-19 25c6-7 13-17 20-23m-19 22 18-24m11-13c10-13 23-28 42-45m-43 45c12-16 26-29 43-47m-42 48c11-8 18-20 41-48m-40 49 41-49m-72 87c4-6 9-9 10-13m-11 12 14-11m-10 13 8-15m-9 16 10-14m27-38c13-10 26-27 33-33m-30 34 29-32m-25 34 26-35m-29 35 30-34m-75 87c5-3 7-5 9-8m-8 9c2-4 5-6 10-9m-8 11 7-12m-6 11c1-4 4-7 7-10m42-52 24-21m-24 21 22-23m-20 24c5-3 9-13 18-24m-17 25 19-25m-75 90 8-6m-8 5 8-5m-4 7 4-7m-4 8 3-7m-6 9h3m-3 1 4-1m-1 3v-4m0 4 1-3"/>
<path stroke="transparent" d="M276 614c2-6 5-24 10-33 4-10 11-19 17-26 7-7 17-13 22-17l8-6c4-3 12-5 13-11 2-5 2 9-3-21s-22-128-26-159c-5-30-2-17-3-23l-2-15c0-4 1-8-1-9-3-1-7 1-11 1l-17-2c-4 0-9 3-13 4-3 0-8-4-9-2-2 2-1 6 0 13l2 32 10 198 1 28 1 46m0 1c2-5 5-21 10-31 4-10 11-22 18-29 6-7 17-11 22-14 6-4 7-3 10-6s8-7 10-12c1-5 2 10-2-20l-24-160-4-24-2-15c-1-4 0-6-2-7h-28l-14 2c-3 0-6-2-8 0v12l2 29c1 38 7 163 10 201 2 37 2 11 3 24l-1 50"/>
</g>
<path fill="none" stroke="#000" strokeLinecap="round" strokeWidth="4" d="M276 613c1-5 6-23 11-33 5-9 11-17 18-24l19-15 10-9c4-3 11-7 12-12 2-5 4 11-1-19l-27-160c-5-31-1-17-2-24l-2-13c-1-4 0-9-2-10-3-2-7 0-11 0h-16l-14 1c-4 0-10-3-11-1-2 2 3 6 3 13 1 8-2-7-1 32l11 198 2 27 1 48m1 0c2-5 5-21 10-31 5-9 14-17 20-24l18-18 8-6c3-3 10-5 11-11 2-5 3 9-2-22l-25-160c-5-31-2-18-3-24l1-12c-1-4-1-8-3-10h-9l-17-1-15 2c-5 0-10 0-11 2-2 2 0 4 1 11s1-7 3 31l7 198c2 37 2 14 3 27l3 50"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m275 626-20-52-11-9-23-19-13-7-11-3-1-9 15-233v-1h41l6 1v12l4 61 12 260"/>
<path fill="none" stroke="#000" strokeWidth="4" d="m276 625-12-22c-4-9-5-20-10-28s-12-14-20-20c-7-7-19-15-25-18s-9 1-11-2c-2-4 0-5 0-17l4-55 8-154c1-28-3-13 1-16s13 0 21 0c8 1 23-2 27 1 4 4-2-6-1 18l6 128 12 186m-1 1-9-26c-3-9-8-18-13-26l-19-20c-6-6-17-14-23-18-6-3-9 1-11-3-2-3-1-6-1-18l3-53 9-155c2-28-3-10 0-12 4-3 13-2 21-2s22-2 26 1-1-8 0 17l5 128 14 186"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke="#000" strokeWidth=".3" d="M211 291s0 0 0 0m0 0s0 0 0 0m0 3h1m-1 0 1-1m-1 5 3-4m-3 4 2-3m-3 6c3-1 5-5 5-6m-5 7 5-7m-3 11 6-10m-6 9c0-4 4-6 6-9m-8 12c7-3 4-8 8-13m-7 13 12-15m-14 20c5-13 11-15 18-17m-19 13c8-6 15-12 15-17m-16 25c10-8 13-16 21-26m-19 24c3-4 9-11 18-19m-16 19c8-9 15-16 20-24m-23 26c8-6 9-9 23-23m-23 23c8-5 11-9 28-26m-25 31c5-8 10-15 22-27m-23 25c5-2 17-12 29-26m-28 28 24-30m-28 33c7-4 14-17 32-28m-31 32c8-12 20-23 30-36m-25 38c6-14 12-22 25-41m-29 41c10-14 19-25 32-36m-35 42 36-47m-34 44c16-15 31-33 34-42m-37 44c9-11 19-21 42-40m-39 40c15-14 26-29 40-41m-38 47c9-14 22-32 42-49m-45 48c10-11 21-24 40-50m-41 52c19-14 35-33 42-49m-41 49c17-15 29-30 46-51m-47 51c18-11 30-32 53-48m-50 52c10-14 20-23 47-55m-47 56c14-10 20-24 52-54m-53 55c17-15 28-33 50-56m-49 59c13-16 23-28 53-58m-52 57c10-14 25-27 49-59m-54 64c21-18 33-32 56-65m-53 64c16-19 34-38 54-59m-54 64c14-19 32-44 52-64m-53 63c14-16 31-31 54-60m-57 62c17-15 22-27 53-55m-50 55c15-16 28-32 53-57m-55 59c23-18 32-35 53-56m-51 58c12-11 22-26 54-58m-55 60c21-22 41-42 53-59m-53 61c15-14 29-30 55-60m-54 65c8-15 23-30 52-62m-50 59c6-14 20-23 51-62m-52 63c15-11 28-27 50-54m-53 56c21-25 46-46 56-59m-53 64c20-19 38-38 54-62m-54 62c14-16 30-34 51-63m-53 64c22-19 31-39 53-59m-52 60 52-59m-49 65c17-26 37-50 51-63m-56 62c16-17 29-30 57-63m-57 64c16-12 28-31 56-59m-54 62c10-15 21-30 55-65m-60 65c18-17 41-43 62-60m-56 63c18-24 38-48 53-64m-59 64c16-19 36-36 55-64m-49 67c12-17 28-34 54-63m-59 64c21-19 37-38 57-65m-53 65c11-16 25-29 54-62m-54 66c10-11 21-22 51-62m-52 61 56-62m-57 67c13-18 28-35 56-64m-56 63 56-63m-53 69c23-29 39-54 56-64m-60 60c22-24 48-48 59-64m-58 72c25-24 40-57 59-67m-59 64c25-27 46-52 58-67m-61 69c22-22 47-48 55-63m-52 65c22-24 41-50 58-65m-60 68 62-68m-59 66c18-19 35-42 56-65m-58 71 61-64m-61 63 59-65m-57 67 53-64m-55 64c23-21 40-48 59-65m-58 69c22-22 42-43 57-66m-56 68c10-15 20-30 58-66m-61 66c15-14 34-36 56-63m-54 65c14-21 32-40 56-67m-56 66c17-11 31-29 55-65m-56 69c18-21 38-42 57-66m-60 65c19-17 34-33 59-61m-57 63c21-21 39-43 60-66m-59 69c20-20 41-47 59-64m-59 66 58-69m-55 69c11-18 29-35 56-68m-58 72c19-24 39-49 57-68m-56 74c10-22 31-44 54-73m-58 69c24-25 44-49 61-69m-57 76c15-20 30-38 58-70m-63 68 61-70m-57 72c25-25 45-54 58-70m-58 69 60-69m-65 77c12-21 33-33 66-71m-63 68c18-24 38-46 60-72m-58 77c18-20 34-39 60-76m-60 72 58-71m-63 73c21-21 47-45 60-71m-59 74c18-18 36-37 64-71m-61 77c22-27 43-52 59-74m-59 71 59-70m-63 76c16-21 36-42 66-75m-63 71c13-13 25-29 63-71m-66 74c16-15 36-32 67-68m-66 71c23-23 44-46 64-74m-67 77c21-17 39-38 62-74m-60 72 64-72m-65 79c23-31 45-58 64-77m-60 73c16-21 38-41 63-72m-67 80c32-28 54-58 68-75m-64 69c15-20 32-41 61-71m-62 81c15-24 38-45 60-81m-62 79c18-22 35-42 66-74m-63 78c14-23 30-41 60-78m-62 76c15-19 28-35 64-73m-63 72c22-27 44-44 63-70m-65 72 65-75m-66 78c16-15 31-35 68-77m-66 76c23-26 46-54 66-72m-65 77c14-25 37-45 63-74m-64 73c15-17 29-32 64-74m-67 80c22-26 48-59 68-76m-67 75c23-25 46-50 67-76m-62 77c7-10 25-28 59-71m-62 73 65-76m-65 78c16-19 38-41 61-78m-61 79 66-76m-70 79c32-30 56-65 72-80m-67 82c22-29 43-55 66-78m-66 78c22-28 47-62 62-75m-64 76c17-18 32-36 66-77m-65 84c18-29 39-48 63-77m-65 72 68-75m-70 84c21-25 41-54 70-80m-69 76c17-16 33-35 69-76m-68 78c26-27 46-52 69-74m-70 73c24-24 46-49 69-75m-68 84c25-31 50-58 65-78m-66 76 69-81m-69 84c25-24 41-49 73-83m-73 82 70-80m-70 80c21-27 42-49 72-79m-71 83c19-24 41-48 70-80m-69 76c11-9 25-29 71-71m-71 73c23-22 47-49 66-74m-62 75c19-17 33-40 67-74m-67 74c22-23 45-50 63-72m-61 71 62-71m-64 76c14-20 31-39 66-77m-67 74c27-27 46-46 64-71m-61 71c15-17 28-33 62-67m-59 73c22-25 44-55 61-72m-61 71c16-18 30-39 60-71m-62 73c28-28 47-55 65-69m-63 66c23-26 47-50 61-65m-59 69c14-21 30-30 61-64m-59 60c21-23 38-46 54-62m-52 61c10-15 30-32 58-59m-60 61c20-22 39-39 56-61m-52 64c18-22 29-39 50-62m-53 63 56-64m-55 64c19-24 34-42 52-57m-49 55 50-57m-45 59c15-24 37-44 46-55m-49 54c18-19 32-38 51-55m-53 53c17-8 27-18 50-50m-48 54c9-12 22-22 50-55m-49 58c21-25 34-41 51-58m-47 57c7-15 19-25 46-54m-50 57c15-13 24-29 47-57m-43 54c12-11 21-23 46-52m-48 55c22-22 36-39 45-55m-42 55c16-20 29-34 46-53m-44 50c12-13 19-22 46-48m-45 53c10-18 21-28 40-53m-36 49c4-8 14-25 37-43m-42 45 44-46m-39 47c8-16 17-24 39-49m-42 52 39-48m-36 51c13-19 25-29 37-51m-37 48c10-10 16-22 39-47m-40 47c13-6 21-17 40-39m-40 41 40-46m-37 43c15-6 20-20 33-42m-31 47c8-13 15-19 33-43m-33 42c14-12 22-28 32-37m-31 36 35-40m-31 39c7-8 17-17 26-33m-32 35c8-7 17-15 34-36m-31 35c9-8 18-20 35-36m-34 42c8-13 19-23 32-37m-30 35c8-4 13-18 27-34m-27 34c10-13 18-22 30-34m-29 33c11-5 15-16 27-31m-28 33c12-10 24-24 32-32m-27 34c3-9 11-15 24-34m-27 36c13-13 25-27 28-32m-22 28 20-25m-23 30 24-32m-23 34 26-27m-26 25 24-28m-21 31c6-6 11-13 23-30m-25 28c5-8 13-14 22-28m-19 33c3-10 15-20 19-29m-21 28 21-29m-23 31c11-9 15-9 25-30m-21 28c4-6 8-13 23-26m-23 27 23-22m-21 22c5-10 16-16 19-22m-20 27c3-12 13-12 16-28m-14 24c4-3 9-9 17-21m-17 27c2-10 8-11 17-22m-15 19 16-22m-20 20c7 0 12-4 19-13m-14 19c2-8 10-16 14Line truncated
<path stroke="transparent" strokeWidth=".5" d="m277 624-11-21c-4-9-7-22-11-30-5-8-10-13-17-19-8-6-22-15-29-18-6-3-10 1-12-1-2-3 1-5 2-17l4-55 8-153c2-29-2-15 1-17 4-2 13 2 21 2s23-3 27-1c4 3-4-8-3 16 2 24 7 76 10 128 3 53 6 155 7 186m0 5-10-31-11-23c-4-7-7-13-13-19-7-6-19-16-26-20-7-3-12 0-15-3-2-4 1-5 2-17v-53c1-35 4-127 7-156 2-28 2-14 6-16 5-1 13 7 20 7 8 0 19-7 23-4s-1-3 0 21c2 24 7 71 10 122l6 186"/>
</g>
<path fill="none" stroke="#000" strokeLinecap="round" strokeWidth="4" d="m275 627-10-24c-4-9-6-20-11-27-5-8-12-13-19-19l-25-19c-6-4-10-1-12-4-2-4 0-5 0-17l4-55 9-154c2-28-2-12 2-14 3-2 10 0 18 0s23-3 27 1c5 3-2-7-1 18l6 129 12 184m2 0-13-25c-4-9-5-17-10-25a124 124 0 0 0-45-38c-6-3-8 1-10-2s0-5 0-17l3-54 8-155c2-28 0-11 4-13 3-3 10-2 17-2 7-1 22-4 26-1 4 4-2-3 0 21l9 127 9 183"/>
<path fill="none" stroke="#E6E6E5" strokeLinecap="round" strokeWidth="10" d="M460 1010s0 0 0 0m0 0s0 0 0 0m0 0-10-21m10 21-10-21m0 0-11-19m11 19-11-19m0 0-11-17m11 17-11-17m0 0-13-15m13 15-13-15m0 0-13-14m13 14-13-14m0 0-14-11m14 11-14-11m0 0-16-10m16 10-16-10m0 0-16-9m16 9-16-9m0 0-17-6m17 6-17-6m0 0-18-5m18 5-18-5m0 0-19-3m19 3-19-3m0 0-20-2m20 2-20-2m0 0-21 1m21-1-21 1m0 0-22 2m22-2-22 2m0 0-24 4m24-4-24 4m0 0-24 5m24-5-24 5m0 0 6 29m-6-29 6 29m0 0 2 27m-2-27 2 27m0 0v26m0-26v26m0 0-4 26m4-26-4 26m0 0-7 24m7-24-7 24m0 0-9 24m9-24-9 24m0 0-11 24m11-24-11 24m0 0-13 25m13-25-13 25"/>
<path fill="none" stroke="#6d6d6d" strokeLinecap="round" strokeWidth="10" d="M190 890s0 0 0 0m0 0s0 0 0 0m0 0 6 27m-6-27 6 27m0 0 2 26m-2-26 2 26m0 0v26m0-26v26m0 0-3 25m3-25-3 25m0 0-6 25m6-25-6 25m0 0-9 26m9-26-9 26m0 0-12 25m12-25-12 25m0 0-15 26m15-26-15 26"/>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke="#ea0" strokeWidth=".3" d="M137 269s0 0 0 0m0 0s0 0 0 0m0 0c3-5 5-6 12-12m-11 15c2-4 7-9 11-13m-11 10c2 2 6-7 25-17m-25 19c7-5 16-15 20-21m-17 23c9-4 11-13 24-25m-23 25 20-23m-19 23c4-7 18-21 22-26m-25 31c5-9 13-17 27-32m-28 29c13-12 19-16 28-29m-24 30c6-7 11-14 25-26m-23 33c10-12 20-28 28-36m-29 34c8-9 13-20 28-34m-30 37c16-16 23-29 35-35m-34 32 32-31m-29 35c7-14 18-16 34-33m-32 29c11-11 19-24 27-32m-27 32c5-8 19-18 35-32m-37 34c13-12 24-21 34-34m-30 37c12-14 17-24 30-39m-32 40 35-40m-35 42c14-18 23-30 35-38m-33 36 34-38m-29 40c10-17 26-32 32-38m-35 37c13-13 23-27 37-38m-40 37c15-5 22-12 39-37m-37 41c7-9 18-17 39-43m-38 47c18-22 28-35 43-50m-39 49c5-14 15-21 38-46m-43 49c14-12 22-26 43-52m-39 49c11-10 19-20 41-47m-42 50c20-21 33-36 42-52m-40 52 44-50m-41 47c11-12 18-22 45-48m-45 53c10-17 21-27 40-53m-34 48c4-9 14-26 37-45m-43 47 46-47m-39 46c8-16 18-25 42-52m-46 55c13-14 25-28 43-51m-39 54c15-21 28-32 42-57m-41 54c10-12 18-26 43-52m-43 50c14-7 23-20 44-45m-44 47c15-19 32-37 45-52m-41 48c17-9 24-25 40-50m-38 55c10-15 18-23 40-51m-38 48c16-15 27-34 39-46m-39 45c14-14 26-29 43-49m-38 47c10-12 23-24 36-44m-41 46c10-10 21-20 43-47m-40 45c13-13 26-29 46-48m-45 54c11-17 25-30 42-50m-39 47c10-8 18-24 40-49m-40 49c14-18 27-31 43-48m-40 46c14-11 24-26 40-47m-42 48c18-16 34-36 46-47m-40 48c8-13 19-25 39-52m-42 54c20-20 37-40 43-49m-35 44c12-17 26-32 36-45m-40 49 41-51m-38 52 44-47m-44 45 42-49m-38 50c10-10 19-22 42-51m-44 49c11-13 23-25 42-49m-37 53c9-18 29-37 39-53m-41 52 42-53m-42 53c16-14 24-19 46-55m-42 53c9-12 18-25 43-51m-42 50 45-47m-43 47c13-19 32-34 40-47m-40 52c8-19 25-26 40-56m-38 51c9-9 20-21 40-48m-39 52c10-18 23-27 42-50m-39 47 40-50m-42 46c13-8 24-19 44-42m-40 48c11-16 27-34 40-50m-38 46c6-7 18-23 43-47m-42 47 40-48m-38 47c13-9 17-21 45-47m-46 50 43-49m-39 45c13-13 30-30 40-48m-41 51c12-13 21-26 41-47m-35 45 37-44m-40 47c13-17 29-32 43-47m-40 50c13-19 26-31 41-49m-40 45c9-10 20-22 41-49m-39 50c5-8 21-24 38-46m-40 44c14-11 26-27 45-48m-38 53c8-20 25-31 39-49m-41 44 41-47m-37 45c6-7 15-17 36-46m-39 49c17-19 33-36 41-49m-39 52c8-17 22-22 40-48m-40 46c15-16 30-33 44-51m-41 48c6-9 15-17 41-50m-40 52 41-47m-35 46c9-11 22-26 35-44m-39 46c14-15 26-27 41-48m-34 43c8-16 32-32 37-45m-39 48c5-8 16-22 42-47m-41 51c6-13 16-22 38-51m-41 48c17-18 34-34 45-48m-41 45c12-11 16-21 46-45m-45 47c9-8 17-20 42-49m-41 52c13-17 34-32 41-52m-39 49c13-11 23-27 41-47m-39 45c9-13 17-17 44-47m-42 51c12-18 26-30 41-50m-40 48c15-15 25-23 41-45m-43 47c12-13 26-27 45-51m-41 49c12-15 27-25 43-51m-40 53c12-20 29-37 40-51m-39 52c9-12 22-24 45-52m-45 51c15-19 28-35 43-51m-43 49c14-10 23-17 46-47m-44 50c14-16 24-32 44-52m-44 53c11-10 17-20 49-55m-45 52c13-18 31-35 41-48m-38 45c5-8 19-19 45-48m-48 49c19-16 32-34 45-48m-41 54 41-49m-41 47c16-19 32-40 45-50m-40 51c8-14 22-30 36-55m-37 53c17-18 31-37 41-49m-36 47c11-18 27-33 37-50m-38 50 41-48m-41 49c8-13 22-25 46-48m-46 48c12-11 23-23 42-50m-37 47c13-16 22-31 42-46m-46 48c12-8 19-20 46-49m-38 54c9-23 30-38 39-54m-43 50c15-20 35-37 45-49m-42 47 40-47m-38 48 40-48m-37 50c13-17 26-36 44-49m-47 47c10-10 17-20 42-49m-34 50c9-15 24-28 34-47m-36 45c10-13 23-25 41-45m-44 47c18-23 35-42 46-46m-43 45c19-18 34-34 44-49m-40 47 38-43m-38 44c14-14 26-28 41-49m-38 52c9-17 23-26 42-53m-44 51c13-16 29-29 44-46m-39 44c17-19 31-33 42-49m-42 52c16-16 29-36 40-47m-40 48c8-15 17-23 46-50m-46 47c15-15 28-31 44-45m-38 47c9-18 23-32 43-48m-45 47c11-13 27-28 43-49m-40 51c13-17 20-32 43-49m-43 49c17-17 28-35 43-48m-40 46c14-17 31-32 42-48m-44 47c14-14 28-34 42-47m-37 50c12-14 22-26 37-49m-37 47c13-17 25-33 40-47m-35 45c10-12 23-31 42-44m-45 47c13-17 22-27 44-50m-43 51c10-15 22-30 45-47m-45 44c17-16 32-37 43-46m-41 43c11-11 24-18 45-44m-43 48c15-19 33-36 39-46m-38 47c11-17 26-27 43-41m-40 38 36-41m-36 46c14-15 27-30 36-45m-34 40c7-11 19-23 37-41m-36 46c10-16 26-30 37-47m-37 46c10-10 20-20 37-41m-33 39c11-11 17-22 37-42m-37 40c8-7 17-15 35-38m-34 39c11-15 22-23 37-41m-36 41c10-10 19-19 34-38m-29 41c7-12 15-24 33-36m-33 35 30-38m-28 36c10-8 22-25 29-35m-29 37c8-11 19-22 27-36m-22 33c5-9 15-18 27-31m-31 33c10-11 23-26 29-35m-30 34c10-13 26-24 33-31m-29 31c10-7 15-18 26-30m-20 34c0-10 7-13 20-30m-22 27c6-7 12-13 23-30m-24 28c11-6 15-13 27-31m-24 33c8-7 12-15 25-28m-18 27c-1-6 13-18 17-26m-20 28c6-12 14-19 22-27m-21 24c9-7 17-16 19-20m-20 19 23-23m-228 28s0 0 0 0m0 0s0 0 0 0m3 0-7-7m7 7-8-8m11 5c-9-2-15-11-14-15m16 17c-6-4-11-9-19-13m22 17c-14-12-22-18-27-29m27 27-27-24m31 23c-14-6-19-18-30-26m29 26c-15-9-26-20-32-29m32 30c-3-5-15-17-31-33m30 30-30-28m31 27c-9-7-19-21-28-27m30 27-34-26m36 31c-9-13-22-25-30-34m32 33c-5-7-15-16-32-32m39 30c-11-10-23-12-37-31m34 32c-11-12-20-19-35-32m35 30c-8-14-27-28-31-29m35 28c-16-10-29-26-41-30m41 30c-9-11-21-19-35-31m36 31-40-32m44 31c-17-8-30-24-41-32m41 33c-13-7-25-21-42-33m43 37c-7-12-20-24-38-38m42 38c-16-15-32-27-45-40m49 42c-15-11-29-25-43-43m39 39c-10-11-24-22-45-38m52 41c-14-10-26-19-49-39m46 35c-18-12-32-29-44-37m45 35c-15-11-28-29-48-40m52 44-51-40m51 37c-9-Line truncated
<path stroke="transparent" strokeWidth=".5" d="M160 294c-10-1-8-9-26-22m23 24c-6-8-12-13-21-27m1 0c5-5 16-11 21-25m-21 25 25-22m-3-1c86-2 164-7 206-5m-202 7c70-1 138-1 202-4m0 0c3 10 11 15 17 24m-19-24 20 23m2 5c-6-1-10 10-25 24m23-29-20 25m-3 4c-61 0-123-4-204 1m205-5-205 5m0-1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="#000" strokeLinecap="round" strokeWidth="4" d="M153 298c0-10-9-23-15-29m19 23c-8-6-14-14-21-25m1 4c4-9 16-15 21-29m-23 27c8-8 14-14 27-22m1 1c50-4 103-3 198-6m-200 5c46-2 90-3 201-3m2-4c9 6 16 22 20 27m-23-25 22 23m-1 1c-7 10-12 15-19 21m21-22c-9 10-17 19-20 25m-1 0c-64 2-119 5-208 4m207-5c-48-1-97 2-207 4m1 1s0 0 0 0m0 0s0 0 0 0"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m305 241-9-42-4-18v-21l6-46 9-35 11-32 8-17-10 1-27-4-20-12-11-8-14 11-16 8-25 7-8-4-4 9 21 70 9 43 1 36-5 57 6 2 78-4"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M303 241c-1-10-11-36-11-61 0-24 7-62 11-85 5-22 12-39 16-50 3-11 7-11 7-14-1-3-2-1-8-2s-21-1-29-4c-9-2-16-7-21-10s-6-7-9-8c-2 0-2 2-6 5-5 3-14 12-22 15-9 3-24 3-30 4-7 0-7-3-8 0-1 2 1 8 2 13l5 15a771 771 0 0 1 22 106c2 16-1 27-1 37l-1 25c-1 6-3 12-1 15s6 2 14 2l34-2 36-1m-1 0c-1-11-8-38-8-63 0-24 5-60 9-82s12-39 16-50c4-12 9-15 8-18 0-2-5 4-11 3a170 170 0 0 1-49-16c-5-3-4-8-6-9-2 0-3 2-8 5s-13 10-21 14c-9 3-22 4-29 5s-11-3-13 0c-1 2 2 9 4 14 2 4 4 4 7 14s9 29 12 47a465 465 0 0 1 10 97l-1 22c-1 7-4 17-3 20 2 3 4 0 13 0h36l35-4"/>
</g>
<g fill="none" fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path stroke="#c24c0e" strokeWidth=".5" d="M191 30s0 0 0 0m0 0s0 0 0 0m-1 5c2 0 3 0 5-6m-4 7 6-5m-4 8 8-9m-7 9c2-3 5-7 7-7m-4 13c2-9 5-10 7-13m-10 11c6-5 7-8 14-13m-8 20c1-5 8-13 13-23m-16 20c7-8 11-14 17-18m-18 25c3-11 8-14 22-22m-20 23c7-11 17-24 23-27m-25 30 27-29m-24 28c8-8 12-16 25-29m-23 34c2-6 9-17 27-39m-29 39c7-7 16-15 33-35m-34 40c14-13 20-18 45-46m-41 47c16-18 30-38 41-47m-40 46c13-16 33-34 56-60m-58 65c18-18 34-37 56-65m-57 71c15-19 33-35 65-72m-59 69c14-16 26-33 54-64m-56 70c17-23 40-41 56-70m-53 69c20-25 45-53 58-65m-62 73c15-17 31-29 61-72m-58 70c21-27 46-51 60-70m-55 76c19-24 40-49 63-73m-66 71c16-19 31-38 63-71m-59 76c18-27 36-47 62-75m-64 74c14-18 33-33 63-73m-61 78c24-31 50-58 70-78m-71 79c23-33 48-59 66-80m-63 87c21-34 43-56 67-82m-71 77c24-24 45-46 71-80m-65 85c21-22 42-43 70-80m-71 83 71-86m-69 91c24-37 54-65 71-86m-73 85c16-24 36-46 75-88m-77 96c31-35 66-75 84-91m-81 85 79-90m-79 100c15-20 34-46 80-94m-79 89c32-35 65-72 82-93m-85 101c28-27 51-53 91-98m-88 97c18-23 38-45 87-99m-90 105c28-27 46-50 93-105m-88 104c28-32 56-62 88-104m-87 110c17-25 37-42 90-108m-93 108c25-27 51-55 95-107m-93 113c19-23 44-47 95-114m-93 114c30-33 59-70 97-114m-98 121c37-43 75-94 102-118M220 150c27-34 52-65 103-119m-99 121c30-36 67-77 99-122M220 155c27-31 49-58 106-122M223 162c40-45 79-92 103-117M221 161c23-27 44-55 103-117M222 166c17-25 44-48 98-113m-97 112c20-27 45-56 94-112m-96 122c35-39 73-81 96-112m-93 108c27-35 51-65 92-107m-96 114c21-27 41-46 89-95m-85 94c17-22 39-47 82-94m-79 98c14-22 39-50 74-93m-77 96c22-31 52-60 80-94m-77 99c13-20 27-34 78-90m-82 87c24-23 42-46 81-90m-81 98c25-31 59-66 76-94m-76 95c23-24 42-47 78-92m-81 94c20-13 31-32 85-87m-84 91c17-22 35-38 81-91m-76 100c22-36 50-65 77-90m-80 85c17-22 36-43 77-87m-82 100 83-90m-80 88c29-34 56-66 79-90m-78 98c16-22 35-45 74-94m-73 90c23-28 44-50 73-87m-71 95c16-25 38-44 71-83m-74 81 74-85m-76 96c30-36 54-64 76-87m-74 82c25-30 49-60 71-84m-73 96c18-23 37-46 74-88m-77 85c30-34 56-63 75-87m-72 93c34-40 60-66 77-84m-72 80c22-26 43-53 69-81m-63 79c17-17 30-33 62-77m-66 78 67-75m-56 73c18-22 47-49 56-67m-60 70 60-68m-56 71c20-32 48-56 57-64m-56 62c19-24 39-47 57-63m-48 59c8-15 27-25 47-51m-49 54c13-17 23-30 49-58m-42 55c15-13 23-31 38-51m-38 53c10-17 25-31 43-50m-42 47c10-6 13-13 38-44m-36 46 36-41m-28 43c10-17 27-27 31-41m-33 42 32-40m-28 36c6-7 14-12 32-28m-31 30c6-9 16-16 27-32m-25 33c15-10 16-18 26-32m-25 30c7-7 14-15 27-25m-16 25c-1-5 8-17 15-19m-18 20c5-4 11-10 20-25m-16 21c6 1 14-11 14-14m-12 18c3-6 7-9 15-18m-12 19c1-2 7-11 13-13m-13 13c3-6 5-8 14-14m-6 12c2-4 3-7 7-8m-7 8 5-7m0 7 2-2m-3 1 2-2m-84 4s0 0 0 0m0 0s0 0 0 0m6 0s-4-4-7-4m8 4-7-5m10 2c0 1-4-6-12-6m13 9-10-9m20 10c-8-5-11-7-16-19m11 16c-3-1-6-5-14-12m22 16c-12-8-14-12-19-20m18 18c-6-4-10-11-21-18m25 17c-1-2-12-8-25-24m26 27c-7-12-18-20-28-27m33 23c-5-6-16-21-29-30m31 31-34-29m42 31c-5-11-13-17-39-35m39 34-42-36m44 39c-8-13-23-26-44-39m48 35c-12-8-19-17-46-40m50 43c-20-18-37-32-47-46m48 42-50-43m59 43c-24-20-48-40-60-52m58 55c-24-19-46-38-59-51m61 49c-13-18-37-35-62-53m65 53-61-55m68 54c-17-21-40-32-66-58m65 60c-17-18-35-30-68-58m74 53c-24-17-53-43-74-56m73 62c-25-25-48-46-72-65m80 62c-23-18-45-39-84-67m83 69c-30-26-57-53-78-69m79 68c-20-22-41-41-80-76m83 72c-30-24-56-48-83-73m83 64-81-67m77 70c-21-14-42-33-80-69m79 66-83-72m86 69c-28-21-51-40-81-71m78 64c-23-21-44-36-76-68m74 69c-27-22-54-48-79-68m81 59c-25-17-45-36-83-65m81 67c-31-27-63-57-79-69m82 59c-31-13-54-33-81-68m75 72c-15-16-31-30-77-69m74 61c-25-20-48-43-76-63m75 60-73-64m77 62c-25-21-54-42-76-68m73 66-77-66m74 58c-11-15-33-28-77-61m81 63c-26-19-48-39-79-66m77 63c-27-31-56-51-78-68m81 68c-32-27-63-55-82-69m81 60c-20-18-47-43-85-66m83 69c-25-25-55-47-82-72m83 64c-28-23-57-48-83-74m83 76-83-74m86 68c-23-17-46-38-89-77m85 79c-18-13-32-29-85-77m88 71c-31-27-66-50-93-80m90 79c-32-27-67-54-87-74m86 73c-20-26-48-52-86-82m90 79c-27-25-54-50-91-80m90 72c-22-17-48-41-92-75m94 76c-23-13-40-30-93-79m94 76c-24-21-50-47-100-84m98 86-94-84m95 77c-22-16-42-38-94-83m95 83c-25-17-47-36-99-85m103 82c-39-30-74-60-102-85m99 85c-42-38-82-71-103-87m101 82c-35-34-79-65-104-92m106 91c-35-27-66-56-102-88m101 87c-39-33-76-68-104-95m106 90c-26-20-54-47-104-91m107 84c-30-19-52-41-107-85m102 88c-40-32-80-70-106-92m110 91c-29-20-50-43-104-91m104 88L197 31m106 82c-34-23-55-44-100-87m96 85c-34-26-67-57-97-84m98 81c-28-27-62-53-92-85m93 83c-28-21-52-47-96-79m99 76c-38-26-72-58-93-74m91 75c-23-20-43-35-90-80m93 72c-24-17-45-36-88-69m86 72c-27-19-48-39-85-73m85 66c-30-25-64-51-83-71m82 73c-27-24-57-53-81-70m84 67c-19-14-35-30-74-63m73 62c-14-13-33-25-75-67m76 66c-24-26-47-41-75-64m73 59c-14-12-33-27-71-64m70 58c-19-25-51-42-69-59m71 62c-20-19-42-37-66-62m66 60-62-59m65 56c-25-21-53-43-66-56m67 50c-28-19-51-40-69-55m71 55c-23-18-46-38-69-53m67 52c-10-9-29-22-65-56m67 55c-26-23-47-42-64-53m63 51-61-56m62 55c-21-22-48-44-62-55m63 49c-18-12-40-29-55-49m56 51c-13-13-29-25-57-53m61 50c-23-14-41-35-49-44m46 42-48-42m0 2-8-10m9 10-10-8m62 41c-12-5-18-11-35-27mLine truncated
<path stroke="transparent" d="M300 239c-2-10-8-38-8-62 1-24 6-60 11-82s13-41 17-52c3-11 7-12 6-15-1-2-5 0-12-1s-21 0-29-2-13-7-18-10c-4-2-5-7-8-7-2-1-2 2-7 5s-14 10-23 12c-8 3-21 3-28 3-6 1-8-2-9 1-1 2 1 12 2 17l3 12c3 10 10 28 14 46l7 62c2 16 2 27 2 37l-2 25c-1 6-1 11 1 14s4 3 12 3l37-4 32 1m5-6c-3-10-14-34-14-57s8-59 11-81l11-54c4-11 10-13 10-15 1-2 0 4-6 3-7-1-23-8-32-11-8-2-15-4-20-7-5-2-7-9-9-9s2 3-2 7c-5 4-14 12-23 16-10 4-26 6-32 7s-5-3-6-1v12l4 10c4 11 12 32 16 51 5 18 9 45 10 61s-5 27-6 37c-2 10-4 18-3 24 1 7 4 14 7 17 2 2 1-3 7-3 7 0 21 3 33 3s31-4 38-5"/>
</g>
<path fill="none" stroke="#000" strokeLinecap="round" strokeOpacity=".8" strokeWidth="4" d="M301 240c-2-10-9-37-9-62 0-24 4-60 9-83 4-22 13-40 18-50 4-11 8-13 7-15 0-3-3 0-9-1l-28-5-22-7c-5-3-7-8-9-9-3-1 0 1-5 4s-15 10-24 13-23 5-29 6-8-3-8 0c-1 2 2 8 3 13l3 14 13 47c4 18 7 44 9 60s1 25 1 35l-1 26c0 7-4 13-2 16s6 1 14 1h33l37-2m1-1c-2-10-12-37-12-61 0-23 7-60 12-83 5-22 13-40 16-51 4-11 7-12 6-15s-5-1-11-1l-25-3c-8-2-18-6-23-9s-4-9-7-10c-2-1-3 2-8 5s-13 11-21 14-22 5-28 5c-6 1-9-3-10-1s1 8 2 13l4 15c3 10 10 31 14 49s9 43 10 59c1 15-2 24-3 34v27c0 7-2 14 0 17 2 2 4-1 12-2l34-1 37-1"/>
<g strokeLinecap="round">
<path fill="#ff0800" d="M257 42c2 0 7 1 9 3 3 2 5 6 5 10v15c-1 4-3 6-5 8l-9 3c-3-1-6-3-8-7-2-3-3-8-3-13 0-4 1-9 4-12 2-3 8-5 10-5h2m-6-1c3-2 5-2 7 0 3 2 7 6 9 10 1 4-1 9-1 13-1 4-1 8-3 10-2 3-6 6-9 6s-8-2-10-5c-3-3-4-9-4-13s1-8 3-11l6-9c2-1 2 2 2 2"/>
<path fill="none" stroke="#000" strokeWidth="4" d="M257 42c2-1 6 1 8 2 2 2 5 6 6 10s2 9 1 13c0 4-3 9-6 11-2 3-6 4-9 4l-7-8-4-12c0-4 0-9 2-12 1-3 7-6 9-7 1-1 1 1 1 1m5 0c3 1 6 5 8 8s3 8 2 12c0 4-4 9-6 12s-4 5-6 5c-3 0-6-3-9-5-3-3-6-6-7-10s1-11 3-14c2-4 4-7 7-8h10"/>
</g></svg>
)
};
export const SwordColors = {
Bronze: { grip: "#cd7f32", decoration: "#96510d", blade: "#7A420B", bladeFillLight: "#E1B384", title: "Apprentice of Sketchnoting" },
Silver: { grip: "#CECDCC", decoration: "#b2b0b0", blade: "#979595", bladeFillLight: "#F5F5F5", title: "Champion of Spatial Thinking" },
Gold: { grip: "#F5D000", decoration: "#D6B600", blade: "#B89C00", bladeFillLight: "#FFEA70", title: "Hero of Visual Notetaking" },
Platinum: { grip: "#646261", decoration: "#323131", blade: "#000", bladeFillLight: "#8B8988", title: "Legend of Visual Thinking" },
}
export type Rank = keyof typeof SwordColors;
export const excalidrawSword = (rank: Rank) => {
const { grip, decoration, blade, bladeFillLight } = SwordColors[rank];
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 1140">
<g fillRule="evenodd" strokeLinecap="round">
<path fill={bladeFillLight} d="m272 979 118-121-80-571-104 1-36 580 104 113-1-2"/>
<path fill="none" stroke="black" strokeWidth="4" d="M271 978c31-30 67-60 117-120M273 979c42-46 89-95 115-120m-1-1c-19-163-41-323-79-569m78 570c-20-165-42-329-78-570m-2 0c-23-2-56-2-102 0m106-1c-34 0-63-1-104 1m0 1c-12 192-21 384-34 574m33-576-31 576m3 2c30 40 71 85 98 112M173 863c38 47 75 87 100 117m1 1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke={blade} strokeWidth=".5" d="M207 287s0 0 0 0m0 0s0 0 0 0m-2 6 7-5m-6 6 6-7m-6 17c0-8 3-14 10-15m-9 12c4-3 5-8 12-14m-11 20c4-7 6-8 11-20m-13 19c4-6 10-10 15-16m-14 27c4-12 7-14 21-28m-23 24c8-6 13-16 23-27m-23 35c14-11 17-26 31-37m-32 37c10-10 16-17 28-35m-29 39c12-6 18-13 31-37m-28 37c5-8 12-14 33-37m-33 47c7-12 20-27 36-44m-36 42c14-17 26-36 38-44m-36 53c8-11 22-26 37-53m-42 48c14-14 29-29 46-49m-45 60c18-29 42-49 52-62m-52 61c18-22 36-40 52-59m-56 63c15-17 34-27 57-65m-54 66 58-63m-62 71c15-18 35-38 64-74m-62 74c25-30 48-57 62-71m-62 78c22-25 42-52 72-75m-71 72c22-26 47-53 70-75m-69 84c25-30 50-67 70-88m-72 87 74-82m-72 85c30-27 58-58 75-89m-75 94c17-23 37-42 79-90m-82 97c24-21 45-47 86-95m-85 94 84-98m-84 105c22-23 40-48 92-105m-93 106c23-30 47-57 90-105m-90 106c29-25 51-56 95-105m-94 108c19-23 38-47 96-109m-93 118c36-44 72-86 93-114m-98 114c30-35 55-69 102-120M197 408c30-26 58-60 110-119M199 412l108-124M198 421c31-37 66-71 111-129M201 418c32-41 71-82 110-130M196 426c38-43 73-77 119-132M198 426l114-130M196 430c41-47 85-87 120-128M198 431c29-29 53-57 113-133M201 436c25-31 51-61 112-127M198 439c28-30 52-61 114-133M194 442c29-33 63-65 123-134M198 442c42-48 85-97 118-132M195 449c28-35 63-63 122-135M198 449c43-49 88-96 117-131M197 459c45-51 86-103 121-139M199 455c47-49 88-100 117-133M196 463c31-40 67-74 121-133M199 463c44-52 90-106 119-137M195 467c41-39 77-90 118-133M196 472c26-34 54-62 121-141M196 478c45-49 89-102 122-138M198 476c26-28 52-58 117-138M195 481c36-41 69-86 124-140M197 481c26-33 55-66 120-141M192 486c45-46 90-93 123-138M196 490c34-34 64-72 123-142M194 494c42-43 83-93 129-138M194 496c30-32 57-65 127-144M195 506c44-55 88-99 125-146M195 504l123-146M197 506c41-41 80-87 127-142M193 511c40-42 77-84 129-148M195 518c26-37 57-72 127-146M193 517c41-52 85-101 128-146M192 523c42-42 77-85 133-147M192 524c49-60 98-116 129-151M193 527c34-34 69-71 128-147M194 528c45-53 88-104 130-149M192 537c48-48 92-98 129-155M192 537c50-56 99-112 132-152M190 540c47-54 97-107 138-152M192 541c39-49 82-97 131-151M191 546c36-38 68-78 136-153M192 549c51-62 105-123 133-154M194 558c27-42 55-72 134-159M190 557c31-35 59-71 135-155M191 564c49-53 91-108 139-162M190 562l137-155M189 567l142-153M190 568c40-43 76-87 137-157M189 572c50-50 98-108 138-155M190 574l139-158M192 579c58-62 109-126 136-156M190 581c44-48 87-98 139-158M191 591c51-58 95-111 140-164M190 588c35-43 70-84 140-162M188 592c32-32 60-65 139-160M188 595l143-162M191 602c31-43 72-87 141-168M189 600c34-32 64-67 142-161M185 610c54-57 102-117 149-165M187 606c53-58 100-114 146-164M191 610c53-54 106-112 141-166M188 615c37-40 74-81 143-167M185 621c46-46 87-94 150-167M187 621c32-35 64-70 148-169M190 625c45-52 94-112 141-169M188 625c56-62 113-124 146-167M189 633l144-172M187 633c34-40 67-76 146-171M186 643c34-44 71-90 148-172M185 639c60-70 119-135 152-172M187 643c39-43 81-86 147-172M187 646c29-37 61-73 148-172M187 651c52-60 102-117 148-174M185 651l152-171M185 661c59-73 121-137 151-175M187 660c31-44 66-83 150-175M183 667c44-51 84-95 153-176M186 667c35-40 68-78 153-179M183 674c40-47 80-99 158-178M184 671c57-69 116-137 155-175M187 678c39-44 79-97 154-180M185 681c55-62 112-126 153-180M187 687c51-62 110-121 152-178M185 684c29-37 62-73 155-179M181 692c50-63 104-125 163-182M185 692l156-183M187 696c39-46 87-96 154-181M185 697c43-51 84-100 156-180M184 704c48-52 103-110 158-184M185 705c54-69 115-138 159-182M184 710c62-70 131-143 157-183M184 712c59-72 119-143 161-186M184 721c60-71 118-142 159-189M184 719c40-50 86-104 162-186M184 722c41-45 81-91 163-186M182 725c63-76 127-148 163-189M179 728c55-59 110-124 167-188M182 731c45-50 92-104 163-190M179 740c43-47 82-97 169-194M182 738l163-191M184 741c50-62 105-129 166-190M182 743c35-45 74-89 166-189M182 753c33-44 67-87 164-193M180 749c42-43 83-88 169-189M181 757c58-70 125-145 166-195M181 757l166-193M179 763c39-39 73-85 172-193M180 764l169-196M176 771c73-77 138-156 171-196M181 770c47-57 98-115 168-196M182 778c68-77 129-153 171-201M178 777c46-54 93-104 171-197M180 780c54-64 113-132 171-197M180 782c50-56 101-118 171-199M180 789c43-52 90-101 170-197M179 789c43-43 83-90 174-198M178 795c63-64 120-138 173-198M178 795c47-52 93-106 175-201M178 803c42-45 82-96 176-206M177 802c55-62 111-128 176-200M176 809c65-65 124-136 180-201M177 810l176-206M175 817c58-71 118-136 182-203M178 816c69-82 141-162 176-205M175 819c39-40 79-86 180-204M176 822c60-66 117-133 180-208M178 827c40-41 76-91 179-203M176 829c36-47 75-90 180-206M174 835c59-62 114-123 180-211M175 835c36-44 75-86 181-209M176 842c38-48 79-98 182-212M177 842c59-66 115-131 182-210M176 849c44-58 96-119 185-212M176 848c36-46 76-92 183-210M177 853c51-56 99-114 181-210M173 856c59-70 122-140 186-215M176 862c35-44 77-87 184-212M175 862c61-69 120-135 187-216M177 862c74-75 142-156 183-208M177 866c53-58 103-119 183-211M180 866c66-70 131-149 182-211M180 869c44-53 89-104 183-211M180 873c61-70 117-142 185-206M182 871c48-55 94-106 181-208M184 873c41-47 82-97 180-204M185 874c64-75 126-147 179-204M190 879c35-42 72-8Line truncated
<path stroke="black" d="M272 980c39-30 68-66 119-121M273 982c49-46 92-93 114-126m1 0c-26-177-53-358-78-568m78 570c-18-155-40-312-78-569m3-1c-31-1-59 0-106-3m101 3c-29-2-59 0-101-1m-1 1c-10 204-24 410-31 575m32-576c-10 116-16 231-32 576m-2-1c27 25 44 44 105 120M175 865l98 117m2-2s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke={blade} strokeLinecap="round" strokeWidth="4" d="M271 610c1 44 6 217 6 261m-10-263 9 258"/>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#dbc9f3" d="m320 484-4-4-5-3-4-3-4-2-5-2-4-1-5-1h-13l-4 1-5 2-4 2-5 3-4 3-5 4-133 117-5 4-2 2-2 2-2 2-2 2-1 3-1 3-19 127 10 7 10 8 10 7 9 8 8 8 8 8 7 8 7 9 6 9 6 9 5 9 4 9 5 10 3 9 4 10 2 10 15-3 8-2 7-1 7-1 6-1 7-1 6-1 6-1h6l6-1h16l4 1h5l-4-10-2-10-3-10-2-10-3-10-1-10-2-10-1-9-1-10v-10l-1-9v-19l1-10 1-9 1-9 1-10 1-9 2-9 2-9 2-9 3-10 3-9 2-9 4-9 3-9 3-9 4-9 4-9 4-9 9-19 2-3 2-4 1-4 1-5 2-4 1-5v-5l1-6v-23l-1-6-1-7-1-7-2-7"/>
<path fill="none" stroke="black" strokeWidth="4" d="M320 484s0 0 0 0m0 0s0 0 0 0m0 0-4-4m4 4-4-4m0 0-5-3m5 3-5-3m0 0-4-3m4 3-4-3m0 0-4-2m4 2-4-2m0 0-5-2m5 2-5-2m0 0-4-1m4 1-4-1m0 0-5-1m5 1-5-1m0 0h-4m4 0h-4m0 0h-5m5 0h-5m0 0h-4m4 0h-4m0 0-4 1m4-1-4 1m0 0-5 2m5-2-5 2m0 0-4 2m4-2-4 2m0 0-5 3m5-3-5 3m0 0-4 3m4-3-4 3m0 0-5 4m5-4-5 4m0 0L116 600m133-117L116 600m0 0s0 0 0 0m0 0s0 0 0 0m0 0-5 4m5-4-5 4m0 0-2 2m2-2-2 2m0 0-2 2m2-2-2 2m0 0-2 2m2-2-2 2m0 0-2 2m2-2-2 2m0 0-1 3m1-3-1 3m0 0-1 3m1-3-1 3m0 0L82 745m19-127L82 745m0 0s0 0 0 0m0 0s0 0 0 0m0 0 10 7m-10-7 10 7m0 0 10 8m-10-8 10 8m0 0 10 7m-10-7 10 7m0 0 9 8m-9-8 9 8m0 0 8 8m-8-8 8 8m0 0 8 8m-8-8 8 8m0 0 7 8m-7-8 7 8m0 0 7 9m-7-9 7 9m0 0 6 9m-6-9 6 9m0 0 6 9m-6-9 6 9m0 0 5 9m-5-9 5 9m0 0 4 9m-4-9 4 9m0 0 5 10m-5-10 5 10m0 0 3 9m-3-9 3 9m0 0 4 10m-4-10 4 10m0 0 2 10m-2-10 2 10m0 0 15-3m-15 3 15-3m0 0 8-2m-8 2 8-2m0 0 7-1m-7 1 7-1m0 0 7-1m-7 1 7-1m0 0 6-1m-6 1 6-1m0 0 7-1m-7 1 7-1m0 0 6-1m-6 1 6-1m0 0 6-1m-6 1 6-1m0 0h6m-6 0h6m0 0 6-1m-6 1 6-1m0 0h5m-5 0h5m0 0h6m-6 0h6m0 0h5m-5 0h5m0 0 4 1m-4-1 4 1m0 0h5m-5 0h5m0 0-4-10m4 10-4-10m0 0-2-10m2 10-2-10m0 0-3-10m3 10-3-10m0 0-2-10m2 10-2-10m0 0-3-10m3 10-3-10m0 0-1-10m1 10-1-10m0 0-2-10m2 10-2-10m0 0-1-9m1 9-1-9m0 0-1-10m1 10-1-10m0 0v-10m0 10v-10m0 0-1-9m1 9-1-9m0 0v-10m0 10v-10m0 0v-9m0 9v-9m0 0 1-10m-1 10 1-10m0 0 1-9m-1 9 1-9m0 0 1-9m-1 9 1-9m0 0 1-10m-1 10 1-10m0 0 1-9m-1 9 1-9m0 0 2-9m-2 9 2-9m0 0 2-9m-2 9 2-9m0 0 2-9m-2 9 2-9m0 0 3-10m-3 10 3-10m0 0 3-9m-3 9 3-9m0 0 2-9m-2 9 2-9m0 0 4-9m-4 9 4-9m0 0 3-9m-3 9 3-9m0 0 3-9m-3 9 3-9m0 0 4-9m-4 9 4-9m0 0 4-9m-4 9 4-9m0 0 4-9m-4 9 4-9m0 0 9-19m-9 19 9-19m0 0 2-3m-2 3 2-3m0 0 2-4m-2 4 2-4m0 0 1-4m-1 4 1-4m0 0 1-5m-1 5 1-5m0 0 2-4m-2 4 2-4m0 0 1-5m-1 5 1-5m0 0v-5m0 5v-5m0 0 1-6m-1 6 1-6m0 0v-5m0 5v-5m0 0v-6m0 6v-6m0 0v-6m0 6v-6m0 0v-6m0 6v-6m0 0-1-6m1 6-1-6m0 0-1-7m1 7-1-7m0 0-1-7m1 7-1-7m0 0-2-7m2 7-2-7m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#a887e8" d="m434 628 3 4 3 5 2 6 2 5 2 6 1 5 1 7v6l1 13 1 13 1 12 2 13 2 12 3 13 4 12 4 12 4 13 5 12 5 12 7 12 6 11 7 12 8 12 9 12 3 3 2 3 2 3 1 3 1 3 1 3 1 3v5l-1 3-1 2-1 3-1 3-1 2-4 5-61 100-4-9-4-8-4-8-4-8-4-7-5-7-4-7-5-7-4-6-5-6-5-6-5-6-5-5-5-5-5-4-6-5-5-4-6-4-6-4-5-3-6-3-6-3-6-3-6-2-7-2-6-2-7-2-6-1-7-2-7-1h-6l-7-1-4-10-3-10-2-10-3-9-2-10-2-10-1-10-2-9-1-10v-9l-1-10v-19l1-9v-9l1-10 1-9 2-9 1-9 2-10 2-9 3-9 2-9 3-9 3-9 4-9 3-9 4-10 4-9 5-9 4-9 5-9 2-5 2-5 2-5 2-5 1-5 1-5 1-6v-22l-1-6-1-5v-6l-3-12 114 144"/>
<path fill="none" stroke="black" strokeWidth="4" d="M434 628s0 0 0 0m0 0s0 0 0 0m0 0 3 4m-3-4 3 4m0 0 3 5m-3-5 3 5m0 0 2 6m-2-6 2 6m0 0 2 5m-2-5 2 5m0 0 2 6m-2-6 2 6m0 0 1 5m-1-5 1 5m0 0 1 7m-1-7 1 7m0 0v6m0-6v6m0 0 1 13m-1-13 1 13m0 0 1 13m-1-13 1 13m0 0 1 12m-1-12 1 12m0 0 2 13m-2-13 2 13m0 0 2 12m-2-12 2 12m0 0 3 13m-3-13 3 13m0 0 4 12m-4-12 4 12m0 0 4 12m-4-12 4 12m0 0 4 13m-4-13 4 13m0 0 5 12m-5-12 5 12m0 0 5 12m-5-12 5 12m0 0 7 12m-7-12 7 12m0 0 6 11m-6-11 6 11m0 0 7 12m-7-12 7 12m0 0 8 12m-8-12 8 12m0 0 9 12m-9-12 9 12m0 0 3 3m-3-3 3 3m0 0 2 3m-2-3 2 3m0 0 2 3m-2-3 2 3m0 0 1 3m-1-3 1 3m0 0 1 3m-1-3 1 3m0 0 1 3m-1-3 1 3m0 0 1 3m-1-3 1 3m0 0v3m0-3v3m0 0v2m0-2v2m0 0-1 3m1-3-1 3m0 0-1 2m1-2-1 2m0 0-1 3m1-3-1 3m0 0-1 3m1-3-1 3m0 0-1 2m1-2-1 2m0 0-4 5m4-5-4 5m0 0-61 100m61-100-61 100m0 0s0 0 0 0m0 0s0 0 0 0m0 0-4-9m4 9-4-9m0 0-4-8m4 8-4-8m0 0-4-8m4 8-4-8m0 0-4-8m4 8-4-8m0 0-4-7m4 7-4-7m0 0-5-7m5 7-5-7m0 0-4-7m4 7-4-7m0 0-5-7m5 7-5-7m0 0-4-6m4 6-4-6m0 0-5-6m5 6-5-6m0 0-5-6m5 6-5-6m0 0-5-6m5 6-5-6m0 0-5-5m5 5-5-5m0 0-5-5m5 5-5-5m0 0-5-4m5 4-5-4m0 0-6-5m6 5-6-5m0 0-5-4m5 4-5-4m0 0-6-4m6 4-6-4m0 0-6-4m6 4-6-4m0 0-5-3m5 3-5-3m0 0-6-3m6 3-6-3m0 0-6-3m6 3-6-3m0 0-6-3m6 3-6-3m0 0-6-2m6 2-6-2m0 0-7-2m7 2-7-2m0 0-6-2m6 2-6-2m0 0-7-2m7 2-7-2m0 0-6-1m6 1-6-1m0 0-7-2m7 2-7-2m0 0-7-1m7 1-7-1m0 0h-6m6 0h-6m0 0-7-1m7 1-7-1m0 0-4-10m4 10-4-10m0 0-3-10m3 10-3-10m0 0-2-10m2 10-2-10m0 0-3-9m3 9-3-9m0 0-2-10m2 10-2-10m0 0-2-10m2 10-2-10m0 0-1-10m1 10-1-10m0 0-2-9m2 9-2-9m0 0-1-10m1 10-1-10m0 0v-9m0 9v-9m0 0-1-10m1 10-1-10m0 0v-9m0 9v-9m0 0v-10m0 10v-10m0 0 1-9m-1 9 1-9m0 0v-9m0 9v-9m0 0 1-10m-1 10 1-10m0 0 1-9m-1 9 1-9m0 0 2-9m-2 9 2-9m0 0 1-9m-1 9 1-9m0 0 2-10m-2 10 2-10m0 0 2-9m-2 9 2-9m0 0 3-9m-3 9 3-9m0 0 2-9m-2 9 2-9m0 0 3-9m-3 9 3-9m0 0 3-9m-3 9 3-9m0 0 4-9m-4 9 4-9m0 0 3-9m-3 9 3-9m0 0 4-10m-4 10 4-10m0 0 4-9m-4 9 4-9m0 0 5-9m-5 9 5-9m0 0 4-9m-4 9 4-9m0 0 5-9m-5 9 5-9m0 0 2-5m-2 5 2-5m0 0 2-5m-2 5 2-5m0 0 2-5m-2 5 2-5m0 0 2-5m-2 5 2-5m0 0 1-5m-1 5 1-5m0 0 1-5m-1 5 1-5m0 0 1-6m-1 6 1-6m0 0v-5m0 5v-5m0 0v-6m0 6v-6m0 0v-5m0 5v-5m0 0v-6m0 6v-6m0 0-1-6m1 6-1-6m0 0-1-5m1 5-1-5m0 0v-6m0 6v-6m0 0-3-12m3 12-3-12m0 0 114 144M320 484l114 144m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#6342a0" d="m184 884 2 7 2 7 1 8 1 7 1 7 1 7v7l1 7v7l-1 7v7l-1 7v7l-1 7-3 13-3 13-4 14-5 12-5 13-6 13-6 12-6 13-8 12h14l14 1h14l14 1 13 1 14 2 13 2 14 1 13 3 13 2 13 3 13 3 13 4 12 4 13 4 12 5 7 2 6 2 6 1 6 1h5l5-1 6-1 4-2 5-3 5-3 4-4 4-4 2-3 1-2 2-3 2-3 2-4 1-3 2-4 1-4 25-85-5-11-4-11-6-10-5-10-6-9-6-9-6-8-6-8-7-8-7-7-7-6-7-6-8-6-8-5-8-5-8-4-9-4-9-3-9-3-9-2-10-2-10-2-10-1h-32l-11 1-12 2-11 1-12 3-12 3-13 3"/>
<path fill="none" stroke="black" strokeWidth="4" d="M184 884s0 0 0 0m0 0s0 0 0 0m0 0 2 7m-2-7 2 7m0 0 2 7m-2-7 2 7m0 0 1 8m-1-8 1 8m0 0 1 7m-1-7 1 7m0 0 1 7m-1-7 1 7m0 0 1 7m-1-7 1 7m0 0v7m0-7v7m0 0 1 7m-1-7 1 7m0 0v7m0-7v7m0 0-1 7m1-7-1 7m0 0v7m0-7v7m0 0-1 7m1-7-1 7m0 0v7m0-7v7m0 0-1 7m1-7-1 7m0 0-3 13m3-13-3 13m0 0-3 13m3-13-3 13m0 0-4 14m4-14-4 14m0 0-5 12m5-12-5 12m0 0-5 13m5-13-5 13m0 0-6 13m6-13-6 13m0 0-6 12m6-12-6 12m0 0-6 13m6-13-6 13m0 0-8 12m8-12-8 12m0 0h14m-14 0h14m0 0 14 1m-14-1 14 1m0 0h14m-14 0h14m0 0 14 1m-14-1 14 1m0 0 13 1m-13-1 13 1m0 0 14 2m-14-2 14 2m0 0 13 2m-13-2 13 2m0 0 14 1m-14-1 14 1m0 0 13 3m-13-3 13 3m0 0 13 2m-13-2 13 2m0 0 13 3m-13-3 13 3m0 0 13 3m-13-3 13 3m0 0 13 4m-13-4 13 4m0 0 12 4m-12-4 12 4m0 0 13 4m-13-4 13 4m0 0 12 5m-12-5 12 5m0 0 7 2m-7-2 7 2m0 0 6 2m-6-2 6 2m0 0 6 1m-6-1 6 1m0 0 6 1m-6-1 6 1m0 0h5m-5 0h5m0 0 5-1m-5 1 5-1m0 0 6-1m-6 1 6-1m0 0 4-2m-4 2 4-2m0 0 5-3m-5 3 5-3m0 0 5-3m-5 3 5-3m0 0 4-4m-4 4 4-4m0 0 4-4m-4 4 4-4m0 0 2-3m-2 3 2-3m0 0 1-2m-1 2 1-2m0 0 2-3m-2 3 2-3m0 0 2-3m-2 3 2-3m0 0 2-4m-2 4 2-4m0 0 1-3m-1 3 1-3m0 0 2-4m-2 4 2-4m0 0 1-4m-1 4 1-4m0 0 25-85m-25 85 25-85m0 0s0 0 0 0m0 0s0 0 0 0m0 0-5-11m5 11-5-11m0 0-4-11m4 11-4-11m0 0-6-10m6 10-6-10m0 0-5-10m5 10-5-10m0 0-6-9m6 9-6-9m0 0-6-9m6 9-6-9m0 0-6-8m6 8-6-8m0 0-6-8m6 8-6-8m0 0-7-8m7 8-7-8m0 0-7-7m7 7-7-7m0 0-7-6m7 6-7-6m0 0-7-6m7 6-7-6m0 0-8-6m8 6-8-6m0 0-8-5m8 5-8-5m0 0-8-5m8 5-8-5m0 0-8-4m8 4-8-4m0 0-9-4m9 4-9-4m0 0-9-3m9 3-9-3m0 0-9-3m9 3-9-3m0 0-9-2m9 2-9-2m0 0-10-2m10 2-10-2m0 0-10-2m10 2-10-2m0 0-10-1m10 1-10-1m0 0h-10m10 0h-10m0 0h-11m11 0h-11m0 0h-11m11 0h-11m0 0-11 1m11-1-11 1m0 0-12 2m12-2-12 2m0 0-11 1m11-1-11 1m0 0-12 3m12-3-12 3m0 0-12 3m12-3-12 3m0 0-13 3m13-3-13 3m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill="#390f8c" d="m82 745 13 9 6 5 6 4 6 5 5 5 6 5 5 5 5 6 5 5 5 6 5 6 4 6 4 6 4 6 4 6 3 6 4 7 3 6 2 7 3 7 2 7 2 7 2 7 1 6 2 7 1 7 2 6 1 7v7l1 6v33l-1 7-1 7-1 6-1 7-1 6-2 7-1 7-2 6-3 7-2 6-3 7-2 7-3 6-4 7-3 7-3 6-4 7-4 7-4 7-5 6L16 970l-3-4-4-3-2-4-3-4-1-4-2-5-1-4v-9l1-5v-5l2-5 2-5 2-6 3-5 3-6 69-151"/>
<path fill="none" stroke="black" strokeWidth="4" d="M82 745s0 0 0 0m0 0s0 0 0 0m0 0 13 9m-13-9 13 9m0 0 6 5m-6-5 6 5m0 0 6 4m-6-4 6 4m0 0 6 5m-6-5 6 5m0 0 5 5m-5-5 5 5m0 0 6 5m-6-5 6 5m0 0 5 5m-5-5 5 5m0 0 5 6m-5-6 5 6m0 0 5 5m-5-5 5 5m0 0 5 6m-5-6 5 6m0 0 5 6m-5-6 5 6m0 0 4 6m-4-6 4 6m0 0 4 6m-4-6 4 6m0 0 4 6m-4-6 4 6m0 0 4 6m-4-6 4 6m0 0 3 6m-3-6 3 6m0 0 4 7m-4-7 4 7m0 0 3 6m-3-6 3 6m0 0 2 7m-2-7 2 7m0 0 3 7m-3-7 3 7m0 0 2 7m-2-7 2 7m0 0 2 7m-2-7 2 7m0 0 2 7m-2-7 2 7m0 0 1 6m-1-6 1 6m0 0 2 7m-2-7 2 7m0 0 1 7m-1-7 1 7m0 0 2 6m-2-6 2 6m0 0 1 7m-1-7 1 7m0 0v7m0-7v7m0 0 1 6m-1-6 1 6m0 0v7m0-7v7m0 0v7m0-7v7m0 0v6m0-6v6m0 0v7m0-7v7m0 0v6m0-6v6m0 0-1 7m1-7-1 7m0 0-1 7m1-7-1 7m0 0-1 6m1-6-1 6m0 0-1 7m1-7-1 7m0 0-1 6m1-6-1 6m0 0-2 7m2-7-2 7m0 0-1 7m1-7-1 7m0 0-2 6m2-6-2 6m0 0-3 7m3-7-3 7m0 0-2 6m2-6-2 6m0 0-3 7m3-7-3 7m0 0-2 7m2-7-2 7m0 0-3 6m3-6-3 6m0 0-4 7m4-7-4 7m0 0-3 7m3-7-3 7m0 0-3 6m3-6-3 6m0 0-4 7m4-7-4 7m0 0-4 7m4-7-4 7m0 0-4 7m4-7-4 7m0 0-5 6m5-6-5 6m0 0L16 970m128 126L16 970m0 0s0 0 0 0m0 0s0 0 0 0m0 0-3-4m3 4-3-4m0 0-4-3m4 3-4-3m0 0-2-4m2 4-2-4m0 0-3-4m3 4-3-4m0 0-1-4m1 4-1-4m0 0-2-5m2 5-2-5m0 0-1-4m1 4-1-4m0 0v-4m0 4v-4m0 0v-5m0 5v-5m0 0 1-5m-1 5 1-5m0 0v-5m0 5v-5m0 0 2-5m-2 5 2-5m0 0 2-5m-2 5 2-5m0 0 2-6m-2 6 2-6m0 0 3-5m-3 5 3-5m0 0 3-6m-3 6 3-6m0 0 69-151M13 896l69-151m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="#CECDCC" strokeLinecap="round" strokeWidth="10" d="M86 746s0 0 0 0m0 0s0 0 0 0m0 0 11 8m-11-8 11 8m0 0 10 8m-10-8 10 8m0 0 10 9m-10-9 10 9m0 0 8 8m-8-8 8 8m0 0 8 8m-8-8 8 8m0 0 8 8m-8-8 8 8m0 0 6 9m-6-9 6 9m0 0 7 8m-7-8 7 8m0 0 5 8m-5-8 5 8m0 0 6 9m-6-9 6 9m0 0 4 8m-4-8 4 8m0 0 4 9m-4-9 4 9m0 0 4 9m-4-9 4 9m0 0 3 9m-3-9 3 9m0 0 3 9m-3-9 3 9m0 0 3 9m-3-9 3 9m0 0 7-2m-7 2 7-2m0 0 8-1m-8 1 8-1m0 0 7-2m-7 2 7-2m0 0 7-1m-7 1 7-1m0 0 7-1m-7 1 7-1m0 0 7-1m-7 1 7-1m0 0 7-1m-7 1 7-1m0 0 6-1m-6 1 6-1m0 0h6m-6 0h6m0 0 6-1m-6 1 6-1m0 0h6m-6 0h6m0 0 5-1m-5 1 5-1m0 0h5m-5 0h5m0 0h5m-5 0h5m0 0h4m-4 0h4m0 0h4m-4 0h4m0 0-3-11m3 11-3-11m0 0-3-10m3 10-3-10m0 0-3-10m3 10-3-10m0 0-3-10m3 10-3-10m0 0-2-10m2 10-2-10m0 0-2-10m2 10-2-10m0 0-1-10m1 10-1-10m0 0-2-9m2 9-2-9m0 0-1-10m1 10-1-10m0 0v-10m0 10v-10m0 0-1-9m1 9-1-9m0 0v-10m0 10v-10m0 0v-9m0 9v-9m0 0 1-9m-1 9 1-9m0 0 1-10m-1 10 1-10m0 0 1-9m-1 9 1-9m0 0 1-9m-1 9 1-9m0 0 1-10m-1 10 1-10m0 0 2-9m-2 9 2-9m0 0 2-9m-2 9 2-9m0 0 3-9m-3 9 3-9m0 0 2-9m-2 9 2-9m0 0 3-9m-3 9 3-9m0 0 3-9m-3 9 3-9m0 0 3-9m-3 9 3-9m0 0 4-9m-4 9 4-9m0 0 3-9m-3 9 3-9m0 0c2-2 3-5 4-9m-4 9 4-9m0 0 5-9m-5 9 5-9m0 0 4-8m-4 8 4-8m0 0 5-9m-5 9 5-9m0 0 4-11m-4 11 4-11m0 0 4-11m-4 11 4-11m0 0 4-10m-4 10 4-10m0 0 2-11m-2 11 2-11"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="#FFF6F0" d="m153 288-19-25 21-20 199-5 23 21-24 28-201 3-4-4"/>
<path fill="none" stroke="black" strokeWidth="4" d="M153 290c-4-9-13-13-20-29m19 25c-8-8-15-18-22-23m4-5c2-6 16-15 20-20m-23 22c10-7 18-16 27-22m-5 2 205-1m-203-2c57-1 114-4 201-2m2 3 24 23m-24-24c3 7 11 10 20 21m0 0c-8 6-9 21-24 24m25-20c-3 2-10 8-22 21m-1 4c-70-1-146 1-207 1m208-5c-64 2-131 3-205 3m-1 1s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="#E6E6E5" strokeLinecap="round" strokeWidth="10" d="M455 1003s0 0 0 0m0 0s0 0 0 0m0 0-5-10m5 10-5-10m0 0-5-10m5 10-5-10m0 0-5-10m5 10-5-10m0 0-6-9m6 9-6-9m0 0-5-9m5 9-5-9m0 0-6-8m6 8-6-8m0 0-7-8m7 8-7-8m0 0-6-8m6 8-6-8m0 0-6-7m6 7-6-7m0 0-7-6m7 6-7-6m0 0-7-6m7 6-7-6m0 0-7-6m7 6-7-6m0 0-8-5m8 5-8-5m0 0-8-5m8 5-8-5m0 0-8-5m8 5-8-5m0 0-8-4m8 4-8-4m0 0-8-3m8 3-8-3m0 0-9-3m9 3-9-3m0 0-9-3m9 3-9-3m0 0-9-2m9 2-9-2m0 0-9-2m9 2-9-2m0 0-10-1m10 1-10-1m0 0-10-1m10 1-10-1m0 0h-10m10 0h-10m0 0h-10m10 0h-10m0 0h-11m11 0h-11m0 0-11 1m11-1-11 1m0 0-11 1m11-1-11 1m0 0-12 2m12-2-12 2m0 0-12 2m12-2-12 2m0 0-12 2m12-2-12 2m0 0-12 3m12-3-12 3m0 0 2 8m-2-8 2 8m0 0 1 7m-1-7 1 7m0 0 2 7m-2-7 2 7m0 0 1 7m-1-7 1 7m0 0 1 7m-1-7 1 7m0 0 1 7m-1-7 1 7m0 0v7m0-7v7m0 0v6m0-6v6m0 0v7m0-7v7m0 0v7m0-7v7m0 0v6m0-6v6m0 0v7m0-7v7m0 0-2 12m2-12-2 12m0 0-2 13m2-13-2 13m0 0-3 12m3-12-3 12m0 0-4 12m4-12-4 12m0 0-4 12m4-12-4 12m0 0-5 12m5-12-5 12m0 0-5 12m5-12-5 12m0 0-6 13m6-13-6 13m0 0-6 12m6-12-6 12m0 0-7 12m7-12-7 12"/>
<path fill="none" stroke="#6d6d6d" strokeLinecap="round" strokeWidth="10" d="M185 883s0 0 0 0m0 0s0 0 0 0m0 0 3 14m-3-14 3 14m0 0 3 13m-3-13 3 13m0 0 1 13m-1-13 1 13m0 0 1 13m-1-13 1 13m0 0 1 13m-1-13 1 13m0 0-1 13m1-13-1 13m0 0-1 13m1-13-1 13m0 0-2 12m2-12-2 12m0 0-3 13m3-13-3 13m0 0-3 13m3-13-3 13m0 0-4 12m4-12-4 12m0 0-5 13m5-13-5 13m0 0-6 13m6-13-6 13m0 0-6 12m6-12-6 12m0 0-7 13m7-13-7 13m0 0-8 13m8-13-8 13"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill={decoration} d="m148 291-18-30 23-17 206-3 17 19-22 22-204 9v-5"/>
<path fill="none" stroke="transparent" strokeWidth=".5" d="M153 289c-5-11-10-12-24-27m21 29c-3-9-9-16-20-30m-1 1c13-6 16-13 26-21m-22 20c5-6 14-14 25-20m-1 2c67-5 137-8 198-6m-199 2c67 3 132 3 203-1m2 1c3 6 15 17 19 19m-23-22c9 12 17 19 21 24m-2 0c-3 9-8 12-15 29m18-29-20 27m-4-1-206 4m209-5c-64 0-131 3-207 2m0 2s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0m0 0s0 0 0 0"/>
</g>
<path fill="none" stroke="black" strokeLinecap="round" strokeWidth="4" d="M153 284c-6-2-17-14-22-25m21 29-21-27m4-1c2-7 8-10 21-24m-26 24c8-7 17-12 27-22m-1 1c75-6 140-6 202-3m-201 1c41 4 81 3 202-2m-3-1c10 7 11 8 25 27m-23-23c5 3 8 9 19 24m-1 0c-8 6-10 19-21 23m25-27c-5 6-9 13-24 25m1 2c-64 1-132 2-206-1m207 0c-56 0-112-2-208 2m1 1s0 0 0 0m0 0s0 0 0 0"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill={bladeFillLight} d="M298 233c-2-10-12-36-12-60 1-24 8-62 13-84s13-37 17-48 7-13 7-16c-1-3-2-2-9-2-7-1-23 1-31-1-9-2-14-9-18-12l-11-6c-3 0 0 0-5 3s-17 12-26 15-19 2-25 2c-7 0-10-4-12-1-1 3 4 13 5 18 2 5 2 2 5 12l11 47 8 62c2 16 4 23 4 32 0 10-4 18-5 25 0 7 0 13 2 17s4 4 12 4l36-3 35-4"/>
<path fill="none" stroke="black" strokeWidth="4" d="M297 236c-1-10-8-38-8-62s5-61 9-83 12-40 16-51c3-11 7-12 7-14-1-3-2-1-8-1-6-1-19-1-27-4-9-2-18-8-23-11s-6-7-8-8c-3 0-2 1-7 4s-14 12-23 15c-9 4-22 4-29 5-6 0-8-3-9-1s2 10 4 14l3 15c3 10 11 29 15 46l7 60c2 15 1 25 1 35l-1 26c0 7-3 14-1 17 2 2 6 0 14 0h34l35-2m1 0c-2-11-10-37-10-61-1-24 4-61 8-83 5-22 13-39 17-51 4-11 9-15 8-18 0-3-5 2-11 1l-24-3c-8-2-17-5-22-8-5-4-6-11-8-12-3-1-3 1-8 4-6 3-15 11-24 14-9 4-24 5-30 6s-7-4-8-1c-1 2 2 10 3 15l4 14 12 48c4 18 11 43 12 59 2 16-2 25-2 35l-1 26c0 8-1 16 1 18 2 3 4-2 12-2l36-1h34"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill={bladeFillLight} d="M293 232c-1-10-6-38-5-61 1-24 7-58 11-80 4-21 12-38 15-50 4-12 9-17 8-19-1-3-9 6-16 5-6 0-13-6-21-8s-20-2-25-4c-5-3-3-12-6-13s-6 5-11 8c-5 2-10 5-18 7s-26 3-32 5c-7 2-5 4-6 7l3 9c0 4-1 2 1 14 2 11 6 35 11 53 4 17 14 37 16 52 2 14-4 26-5 36 0 10 3 16 3 24s-5 21-3 24 9-4 17-5c9-2 20-2 31-2l35-1"/>
<path fill="none" stroke="black" d="M298 234c-1-11-11-36-12-60 0-24 5-62 9-84s11-36 15-47 11-14 11-17c1-3-2 1-9 0l-31-8c-9-3-15-3-20-6-4-3-6-12-9-12s-1 6-6 9-14 8-23 11l-29 4c-6 1-7-1-8 1-1 3-1 10 1 14 1 5 5 3 8 13s5 30 9 48c3 17 9 41 11 57 2 17 2 30 2 40l-2 23c-1 7-3 15-1 18 3 2 7-1 14-1 8 0 21 3 32 2 12 0 29-6 35-6m1 6c-1-10-12-37-12-62a493 493 0 0 1 26-139c4-10 9-8 9-10-1-2-5-2-11-3s-19-1-27-3l-22-11c-4-3-1-6-3-7-2 0-3 3-8 5-6 3-16 11-25 13-8 2-18 0-24 0-6 1-11-1-12 1-1 3 4 11 6 16 2 4 2 0 4 11l8 52 7 56c2 16 2 30 2 41l-2 21c0 6 2 11 4 13 3 3 3 0 11 1l34 3 33 1"/>
</g>
<g fillOpacity=".8" fillRule="evenodd" strokeLinecap="round" strokeOpacity=".8">
<path fill={grip} d="M298 233c-1-10-10-35-10-59 0-23 6-60 10-83 5-23 13-41 16-52l4-13c0-3 0-3-6-3-5-1-21 1-29-1-9-2-15-8-20-11l-11-8c-3-1 1-1-4 2l-25 13-27 9c-6 1-8-4-9-3-1 2 0 9 1 14s0 7 4 18c3 10 12 25 16 43 4 17 6 43 7 59 2 16 2 25 2 36l-2 28c-1 7-1 12 1 14s4-1 12-1l33 1 37-3"/>
<path fill="none" stroke="black" strokeWidth="4" d="M297 235c-2-10-10-37-10-61-1-24 5-60 9-82 5-22 14-40 18-51s8-13 7-16c0-3-4-2-11-3-6 0-18 0-26-2s-17-7-22-10-6-7-8-7c-3-1-2 1-7 3-5 3-15 10-23 13-9 4-22 5-28 6-7 1-9-2-10 0s3 9 4 13l3 15c3 10 10 28 14 46s8 45 10 61v35l-2 25c0 7-3 14-1 17s6 1 13 1l33-2 37-1m-1-1c-3-10-11-35-11-59 1-24 9-62 14-85 4-23 12-40 15-51l6-17c-1-2-3 3-9 2a123 123 0 0 1-50-15c-5-3-3-7-5-7-3-1-3 1-8 4s-15 11-24 14-23 4-30 5c-6 1-8-3-8-1-1 2 3 9 4 14l3 14c3 10 11 30 15 48l8 61c1 16 0 25-1 35l-1 24c0 7-1 16 1 19s4-1 11-2l34 1 37-3"/>
</g>
<g strokeLinecap="round">
<path fill={decoration} d="M256 36c3 0 6 2 8 5s4 9 4 13l-3 12c-2 4-5 7-8 8s-6 1-8-1c-3-2-6-6-7-10s-2-9-1-13 4-8 6-10c2-3 7-4 8-4 2-1 1 1 1 1m1-1c3 0 6 4 8 7l3 12c0 5-2 10-4 13-1 3-4 6-7 7-3 0-8-1-10-4-3-2-5-6-5-10V48c1-4 4-8 6-10 3-2 7-2 9-2v1"/>
<path fill="none" stroke="black" strokeWidth="4" d="M252 37c2-1 7-1 9 1l5 10c1 4 2 9 1 13s-4 8-6 11c-3 2-6 3-8 2-3 0-7-3-9-6s-3-8-3-12c-1-4 1-10 3-13s7-5 8-6v-1m0 0c2-1 6 0 9 2 2 2 5 6 6 10v14c-1 4-4 7-6 9-3 2-6 4-9 3-3 0-6-3-8-7-2-3-4-8-4-12s2-9 4-12l8-7v1"/>
</g>
<g fillRule="evenodd" strokeLinecap="round">
<path fill="hsla(30, 2%, 62%, 1)" d="m275 624-12-21c-4-9-7-22-12-30s-12-12-19-18l-23-19c-6-4-10-2-12-5-2-4 0-5 0-16l4-53 8-154c2-28-1-14 2-16s8 3 16 3c7 0 25-6 30-3s-3-3-2 22l7 125 9 187"/>
<path fill="none" stroke="black" strokeWidth="4" d="m273 626-9-24c-4-9-6-18-11-26l-21-23-23-14c-5-4-9-4-11-7-2-4-2-2-2-14l3-57 9-154c1-28-1-11 2-13 3-3 11 0 18 0 8-1 25-5 29-2s-3-5-2 19l7 127 12 187m0 0-11-25c-4-9-6-18-11-26-5-7-13-14-21-20-7-6-18-11-23-15-6-3-7-1-9-5s-2-5-2-17c-1-12-1-21 1-56l11-152c3-28-1-14 2-16s10 2 17 2c8-1 24-6 28-4 4 3-2-5-1 19l6 127 14 188"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke={blade} strokeWidth=".3" d="M208 292s0 0 0 0m0 0s0 0 0 0m0 3 1-1m-1 1 1-1m-1 5 2-4m-3 4 3-4m-3 5c2 0 2-3 7-6m-6 7c0-2 3-3 5-6m-8 12c4-5 5-8 13-14m-11 12c3-5 6-8 9-10m-11 11c3 3 8-2 12-11m-10 13 11-15m-14 16c5-9 13-9 16-17m-11 19c1-5 6-8 13-15m-13 17c3-2 8-15 16-22m-19 22 18-17m-17 20 20-19m-18 22c4-10 12-18 19-26m-18 30c0-12 13-21 17-33m-19 29c6-6 9-13 20-24m-18 29c7-7 10-19 19-31m-23 30c8-8 18-19 25-29m-25 34c13-16 18-21 32-31m-31 31c6-12 16-20 27-35m-28 41c11-11 11-20 33-40m-34 36 35-36m-36 37c18-13 30-31 39-40m-37 42c9-9 21-21 33-40m-36 41c20-9 29-31 42-44m-40 48c11-11 21-21 38-43m-41 45c13-11 21-22 48-44m-44 43 41-45m-42 52c12-20 34-34 46-52m-47 49c13-13 27-25 46-49m-46 54c9-18 21-31 51-52m-48 51 46-55m-46 60c15-16 25-38 44-62m-48 59c14-15 30-30 50-56m-47 63c12-15 23-27 46-63m-47 61 50-59m-48 64c19-26 40-50 50-61m-53 58 54-62m-52 69c15-21 37-46 48-61m-49 58 54-63m-54 68c15-20 30-40 51-61m-50 59c16-23 35-44 50-59m-51 64c11-14 24-27 48-59m-48 57 51-62m-55 65c16-13 24-25 57-57m-55 57c12-11 22-27 53-60m-50 61c21-18 40-42 54-60m-56 61 54-59m-55 60c20-11 35-28 51-60m-49 63c16-18 30-39 50-62m-52 63c13-16 30-27 51-62m-51 65c14-19 29-33 53-61m-55 60c18-13 30-25 59-56m-57 60c12-13 28-30 53-62m-56 63c27-18 46-44 60-62m-59 64c17-14 33-31 58-61m-52 66c20-27 41-51 54-68m-56 65c8-14 24-26 52-60m-54 62c19-16 34-31 58-60m-59 62 56-63m-55 70c15-26 32-41 51-67m-52 63c21-22 42-47 57-60m-53 65c12-15 21-26 48-67m-50 65c11-15 22-28 54-60m-54 64c12-20 33-39 51-60m-53 61c17-20 36-44 57-65m-59 66c15-11 23-23 56-65m-52 68c11-18 25-32 54-65m-54 69c20-25 39-41 51-64m-51 63c17-20 35-41 55-67m-58 68c23-21 43-45 59-66m-58 66c15-19 30-37 57-65m-55 72c18-21 37-44 54-69m-56 68 55-65m-57 68c20-24 41-45 59-63m-57 60c19-21 36-39 56-65m-55 68c14-17 28-26 58-65m-61 66 57-65m-54 69c17-16 26-33 57-68m-59 66c18-22 40-43 58-64m-55 72c12-15 19-34 57-72m-61 71 60-68m-61 67c23-20 43-41 61-61m-60 62c18-19 34-37 58-67m-59 70c14-18 35-35 64-66m-64 68c24-27 43-48 58-67m-55 67c20-23 46-52 54-63m-54 67c19-26 37-45 58-68m-57 73c11-20 33-44 56-72m-58 68c14-17 31-32 59-67m-61 71c20-16 41-36 60-69m-57 71c21-27 41-50 59-68m-57 73c18-22 30-41 59-72m-61 69 60-70m-59 73c11-20 28-36 57-71m-61 73c21-23 40-44 62-72m-58 74c12-18 32-40 56-67m-58 66c15-19 32-37 57-70m-56 72 56-67m-59 70 61-70m-63 76c26-29 50-63 60-77m-56 74 61-72m-64 77c15-20 36-36 64-77m-62 73c22-26 49-52 62-71m-62 77c15-15 27-38 59-75m-60 73 62-71m-60 75c17-20 30-33 57-74m-60 73c15-15 33-33 64-71m-65 78c14-21 30-42 67-75m-64 71c16-15 29-33 60-70m-62 78c21-28 33-46 60-79m-61 74c23-23 42-49 63-71m-65 78c24-33 47-53 70-75m-66 71c26-27 53-57 61-73m-63 76c24-21 39-47 61-69m-60 69 64-72m-65 74c13-15 30-35 64-68m-63 70c19-19 35-37 65-71m-64 73c24-21 41-48 60-71m-63 71c25-29 50-56 65-71m-62 73c19-18 35-39 60-74m-62 76c15-19 33-39 64-71m-66 78c18-27 41-43 71-73m-69 71c26-29 53-58 64-74m-62 80c17-28 37-51 66-78m-68 76c15-17 25-32 66-78m-68 80c22-17 34-37 64-75m-63 73 67-71m-69 75c23-26 49-48 66-73m-64 74c12-15 26-32 66-77m-68 79c20-16 30-33 68-75m-64 76 65-77m-70 84c19-15 29-35 73-79m-71 77c26-32 51-57 70-79m-71 82c24-20 36-44 73-77m-71 76c21-28 47-54 69-77m-68 82c17-26 38-50 66-76m-67 75c16-23 35-40 67-78m-64 79c19-22 43-49 69-76m-73 76 69-76m-70 83c27-31 53-60 69-81m-67 80c19-22 34-43 67-78m-65 83c16-24 36-46 69-83m-72 79c20-24 41-51 70-76m-68 81c25-35 55-64 64-79m-65 75c27-29 54-56 67-75m-64 79c21-31 41-51 63-81m-65 80c17-17 33-31 69-74m-70 79c19-21 29-36 66-80m-64 79 65-76m-60 79c12-22 35-42 63-79m-64 74 65-73m-61 77c19-27 35-47 59-72m-63 73c23-28 43-52 65-76m-61 75c11-22 34-43 58-72m-62 71c20-18 36-39 64-68m-63 68 62-65m-60 68c11-16 26-33 59-70m-59 69c16-14 28-29 57-67m-53 70 57-68m-53 72c11-25 23-35 51-71m-56 67c15-19 33-37 56-66m-50 70c20-30 39-55 52-64m-55 62 55-65m-50 66c12-17 25-27 46-65m-50 64c20-24 36-46 54-60m-52 59c20-16 37-33 56-60m-58 60c18-18 32-35 52-57m-49 60 52-58m-50 57c14-15 26-32 47-57m-44 61c9-19 25-29 43-56m-46 52c19-19 34-35 49-55m-47 57c10-7 16-24 44-51m-44 51c16-15 29-34 46-52m-47 54c12-17 27-30 49-55m-46 54c10-13 23-26 45-51m-47 56c19-25 39-40 44-52m-40 50c18-22 34-40 43-53m-41 52c5-11 19-22 43-44m-45 44c11-10 20-22 42-47m-41 49c14-10 21-18 44-51m-42 50 43-48m-39 50 37-47m-38 48c8-14 18-22 40-46m-39 50c4-9 15-25 35-48m-35 43c10-13 23-26 38-41m-33 45c12-23 30-32 31-47m-35 44c14-14 28-31 36-41m-36 43c9-13 24-22 39-42m-37 41c11-14 26-25 33-39m-30 46c8-13 18-24 34-40m-36 37 33-39m-33 43c18-22 24-32 35-44m-35 40c9-8 19-16 35-36m-29 35c3-3 12-19 29-30m-34 31c13-9 22-20 36-33m-33 40c11-12 24-31 31-40m-31 39c8-12 18-20 29-38m-24 40c3-10 13-19 26-39m-28 35c3-5 13-14 29-31m-27 37c11-13 18-26 27-36m-30 33 28-33m-24 30c9-8 20-15 21-28m-23 33c7-8 14-14 28-31m-25 33c7-10 8-18 24-29m-26 27 25-30m-23 30c11-9 15-19 20-30m-18 32c4-8 11-13 22-28m-24 27c13-8 21-19 24-25m-24 26c10-6 18-17 25-26m-26 25c10-7 18-8 23-18m-20 23c9-9 17-20 23-27m-20 28c10-12 14-19 20-24m-21 23c6-4 8-10 21-24m-20 23c7 0 12-9 16-17m-17 19c8-6 16-16 20-20m-14 20c3 1 2-8 12-17m-14 20c5-7 8-12 18-21m-21 26c1Line truncated
<path stroke="transparent" strokeWidth=".5" d="m275 627-11-23c-4-9-10-23-15-31s-10-11-17-17l-24-19c-6-3-8 2-10-1-2-4-3-7-3-19l3-56 10-153c2-27-4-11 0-14 3-2 15-1 22-1 8 0 19-3 23-1 5 3 1-6 2 18l8 131 11 184m-2 1-9-26c-3-8-3-18-8-25-6-7-16-10-23-16s-14-18-19-22c-6-4-10 1-12-2-3-4-3-9-4-21-1-13-4-20-2-54 1-35 7-127 9-155s0-10 4-12c5-2 16 2 24 2 8-1 22-8 25-4 4 3-2 0-1 25 0 25 2 74 6 125 3 52 12 152 13 183"/>
</g>
<path fill="none" stroke="black" strokeLinecap="round" strokeWidth="4" d="m275 627-13-26c-4-9-5-17-10-25s-12-15-19-21l-23-15c-6-3-9-3-11-7-3-4-3-4-3-16l4-55 8-154c1-28-1-12 3-14 3-3 10 0 18 0 7 0 23-5 28-2 4 4-1-3 0 21l6 127 12 186m-1 0-10-24c-3-9-8-20-13-28s-11-13-18-19l-25-18c-5-3-6-2-8-5s-3-1-3-13c-1-12 0-22 2-57l10-155c2-28-4-12-1-14 4-2 13 1 20 2 8 0 22-3 27 0s1-7 2 18l5 126c3 52 12 155 13 186"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill={bladeFillLight} d="M273 611c1-4 5-21 9-31 5-10 12-22 18-29 6-8 11-12 18-18 7-5 20-9 24-15 3-5 0 13-5-17l-24-161c-4-31-4-17-5-23-1-7 1-12 1-17-1-4-2-9-4-10s-4 4-8 4l-17-2-15 1c-5 0-11 1-12 3s5 2 6 9c0 6-4-7-2 31 1 38 10 160 12 198l1 31 3 45"/>
<path fill="none" stroke="black" strokeWidth="4" d="M270 610c2-5 6-21 11-30 5-10 11-21 17-29l22-18c7-6 18-8 21-14 2-6 2 9-3-21l-25-158-4-25v-14c-1-3-2-7-4-9s-5-1-9-1l-16 2-13 1c-5 0-9-2-11 0-1 2 2 5 2 12 0 8-2-6 0 32l9 197 2 28 2 47m1 2c1-6 4-24 8-34s10-18 17-26 17-16 24-22c6-5 15-6 18-11s5 12 0-18l-25-163c-5-31-1-18-2-23l-5-12c-1-4 0-10-2-12-1-2-5 0-9 1l-17 1h-12c-4 0-10-2-11 1-2 2 2 4 3 11 0 8-2-7 0 31l10 199c2 38-1 16-1 28l1 47"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke={blade} strokeWidth=".5" d="m254 299 7-5m-7 5 7-5m-4 8 4-8m-4 8 4-8m-7 11c4-4 6-4 12-11m-12 11 12-11m-9 13c4-2 4-6 9-13m-9 13 9-13m-11 17c2-5 8-9 17-17m-17 17 17-17m-14 19 14-19m-14 19 14-19m-17 22 23-23m-23 23 23-23m-20 26 20-26m-20 26 20-26m-23 30c10-13 21-22 28-29m-28 29c8-11 17-19 28-29m-25 31c7-9 18-20 25-31m-25 31 25-31m-28 34 33-35m-33 35 33-35m-30 38c9-11 18-20 30-38m-30 38 30-38m-32 41 38-41m-38 41 38-41m-35 43c13-14 27-30 35-43m-35 43 35-43m-38 46c9-10 21-25 44-47m-44 47 44-47m-41 50c11-16 24-32 41-50m-41 50 41-50m-43 53c16-16 32-33 46-51m-46 51c12-16 28-30 46-51m-43 54 43-54m-43 54c9-13 19-24 43-54m-46 57c21-21 37-42 51-56m-51 56 51-56m-48 58c11-12 23-26 48-58m-48 58 48-58m-51 62 53-58m-53 58c14-14 25-29 53-58m-50 61c17-23 38-42 50-61m-50 61 50-61m-53 64 53-59m-53 59c20-21 39-41 53-59m-50 61c16-15 29-35 50-61m-50 61 50-61m-53 64 54-58m-54 58c13-12 24-26 54-58m-51 61 51-61m-51 61 51-61m-53 64c18-21 39-39 54-59m-54 59c20-21 39-41 54-59m-51 62c15-20 33-42 51-62m-51 62c18-23 35-45 51-62m-54 65 54-59m-54 59c17-21 35-41 54-59m-51 61c18-20 34-39 51-61m-51 61 51-61m-53 64c14-17 30-31 54-59m-54 59 54-59m-51 62 51-62m-51 62 51-62m-55 66c22-21 40-43 56-61m-56 61 56-61m-53 63c18-19 34-38 53-63m-53 63 53-63m-55 66 55-60m-55 60c20-24 42-48 55-60m-52 63c12-18 27-32 52-63m-52 63 52-63m-55 66 55-61m-55 61c15-17 33-35 55-61m-52 64c15-18 32-36 52-64m-52 64 52-64m-54 67c16-16 30-34 56-62m-56 62 56-62m-53 64c15-16 26-31 53-64m-53 64c12-14 23-30 53-64m-56 67c17-15 33-32 57-62m-57 62 57-62m-54 65c16-23 35-44 54-65m-54 65 54-65m-57 68c23-24 47-48 58-63m-58 63c18-18 35-38 58-63m-55 66c12-16 26-31 55-66m-55 66 55-66m-58 69c16-14 31-34 58-63m-58 63c15-18 31-34 58-63m-55 66 55-66m-55 66c12-13 24-27 55-66m-58 69c21-22 44-46 59-64m-59 64 59-64m-56 67c20-27 40-49 56-67m-56 67 56-67m-58 70 59-65m-59 65c14-16 28-33 59-65m-56 67c21-26 43-55 56-67m-56 67c15-20 33-40 56-67m-59 70 59-65m-59 65c23-23 44-49 59-65m-56 68 56-68m-56 68c13-14 25-29 56-68m-58 71c22-23 44-46 60-66m-60 66 60-66m-57 69c16-18 29-38 57-69m-57 69c17-23 36-44 57-69m-60 72c12-15 26-28 61-67m-61 67c12-15 26-28 61-67m-58 69 58-69m-58 69 58-69m-61 73c13-16 30-35 61-67m-61 67 61-67m-58 70c20-22 39-48 58-70m-58 70c20-24 38-48 58-70m-61 73c17-23 37-45 62-68m-62 68c18-18 34-37 62-68m-59 70 59-70m-59 70 59-70m-61 73c22-22 44-46 62-69m-62 69c16-17 33-35 62-69m-59 72 59-72m-59 72c13-18 27-34 59-72m-62 75c21-24 42-43 62-69m-62 69c23-26 46-53 62-69m-59 72 59-72m-59 72 59-72m-62 75c21-21 40-46 64-70m-64 70c14-14 27-28 64-70m-61 72c15-15 28-30 61-72m-61 72 61-72m-63 75c15-16 30-31 64-70m-64 70 64-70m-61 73 61-73m-61 73 61-73m-65 77 66-72m-66 72 66-72m-62 74c17-20 34-43 62-74m-62 74c20-22 39-46 62-74m-65 77 65-72m-65 72 65-72m-62 75 62-75m-62 75 62-75m-65 78c19-18 33-39 66-73m-66 73 66-73m-63 76c19-20 38-42 63-76m-63 76 63-76m-65 79c22-23 45-48 66-74m-66 74 66-74m-63 76c23-26 43-51 63-76m-63 76 63-76m-66 79c20-20 36-41 67-73m-67 73 67-73m-64 76c18-22 37-42 64-76m-64 76c18-19 33-40 64-76m-67 79 68-74m-68 74 68-74m-65 76c13-16 28-31 65-76m-65 76 65-76m-68 80 69-75m-69 75 69-75m-66 78c26-33 50-64 66-78m-66 78 66-78m-68 81c19-24 37-43 68-76m-68 76 68-76m-65 78c12-16 27-35 65-78m-65 78 65-78m-68 82c15-15 28-34 69-77m-69 77 69-77m-66 79 66-79m-66 79 66-79m-69 82c23-27 49-53 70-77m-70 77 70-77m-67 80c16-19 33-42 67-80m-67 80 67-80m-69 83 70-77m-70 77c23-26 47-50 70-77m-67 79c12-17 28-32 67-79m-67 79 67-79m-70 82 71-77m-71 77c17-15 32-32 71-77m-68 80c14-16 29-32 68-80m-68 80c16-17 30-36 68-80m-71 84c17-22 34-40 72-80m-72 80c20-24 42-48 72-80m-69 82c16-22 35-42 69-82m-69 82 69-82m-72 85 73-80m-73 80c20-19 37-40 73-80m-70 83c27-28 50-60 70-83m-70 83c16-18 30-38 70-83m-72 86c19-21 39-41 72-80m-72 80c15-19 34-38 72-80m-69 83c24-28 51-58 69-83m-69 83 69-83m-72 86c19-21 38-46 73-81m-73 81 73-81m-70 83 70-83m-70 83 70-83m-73 86c9-7 13-13 32-33m-32 33c14-13 25-26 32-33m-28 36c11-11 18-24 28-36m-28 36 28-36m-1-1 43-47m-43 47c12-15 25-29 43-47m-40 49c13-13 20-25 40-49m-40 49c7-10 15-20 40-49m-73 87c2-5 9-7 13-12m-13 12 13-12m-10 15c1-4 6-10 10-15m-10 15c4-6 6-11 10-15m39-48c7-5 12-13 22-22m-22 22 22-22m-19 24c9-6 12-17 19-24m-19 24c7-7 13-16 19-24m-74 88 10-8m-10 8 10-8m-7 11c2-3 3-7 7-11m-7 11 7-11m53-65 12-10m-12 10 12-10m-9 13c4-4 6-8 9-13m-9 13 9-13m-75 89 7-5m-7 5 7-5m-4 8 4-8m-4 8 4-8m-7 11 4-1m-4 1 4-1m-1 3 1-3m-1 3 1-3"/>
<path stroke="transparent" d="M271 612c2-5 5-23 10-32 4-10 11-18 17-26l22-22c7-6 17-7 20-13 3-5 3 11-1-19l-27-159c-5-31 0-19-1-26l-4-13c-1-3 1-8-1-10-2-1-5 1-10 2l-16-1-13 2c-4 0-9-3-11-1-1 3 1 7 1 14s-2-9 0 29l10 200 2 25 1 49m-1 1c2-5 6-21 11-31 4-10 11-21 17-29 7-8 16-13 23-19 8-5 19-8 22-13 4-6 3 9-2-21l-28-160c-5-31-1-18-2-24l-2-10c0-4 1-8-1-10s-6 0-10 0l-18-2-12 1c-4 0-9-2-11 0s1 7 2 14c0 7-2-9 0 30l8 200c2 38 1 12 2 24l4 49"/>
</g>
<path fill="none" stroke="black" strokeLinecap="round" strokeWidth="4" d="m270 610 10-30a129 129 0 0 1 39-49c8-6 18-7 21-12s2 10-3-20l-24-160c-5-31-4-18-5-25l-1-13c0-4 1-7-1-8-2-2-6-1-10-1h-16l-14 1c-4 1-9-1-11 1s0 4 1 11l1 32 10 198 1 27 3 48m1 2c2-5 3-24 7-33 5-10 11-18 18-26 6-8 16-16 23-21 7-6 16-7 19-13 3-5 3 8-1-21l-24-157c-5-31-2-21-3-27-2-7-5-8-6-11 0-4 4-9 2-11-1-1-6 1-11 1l-17-1h-12c-4 1-11 0-13 3-2 2 1 5 2 13l2 31 8 196c2 37 3 14 4 27v48"/>
<g fillRule="evenodd" strokeLinecap="round">
<path fill={grip} d="m273 624-10-21c-4-8-7-18-12-26s-11-17-19-23c-7-5-21-9-27-12-5-4-5-5-7-9-2-3-5-1-5-13 0-11 3-22 5-57l6-153c2-28 1-14 5-17s10-1 17 0c8 0 25 0 29 3 5 3-1-7 0 16l4 127c3 53 8 159 11 189"/>
<path fill="none" stroke="black" strokeWidth="4" d="m272 627-11-25c-4-8-6-19-11-26-5-8-12-14-19-20s-18-13-24-16c-6-4-7-3-9-7-3-3-4-4-4-15l3-56 10-153c2-27-2-12 2-14 3-3 11 0 19 0s23-4 27-1c5 3-1-4-1 20l6 125 12 187m-2 1-10-23c-4-9-6-19-11-27s-11-14-18-20c-6-6-16-13-22-17-6-3-11-1-13-4-3-4-2-4-2-16l2-59 9-153c3-28 1-12 5-14 3-2 11 2 19 2 7 0 21-6 25-3 5 3 0-4 1 20 0 25 1 77 4 129l13 184"/>
</g>
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<path stroke={blade} strokeWidth=".3" d="M207 292s0 0 0 0m0 0s0 0 0 0m1 3v-1m0 1s0 0 0 0m0 4c0-1 0-2 2-3m-3 3 3-3m-4 5c1-1 6-2 7-6m-5 7c0-2 2-3 4-6m-4 8c1-4 5-6 7-11m-9 12c4-2 5-5 10-9m-11 16c2-6 7-13 10-14m-9 9c2-3 9-7 11-13m-9 17c2-3 9-12 17-13m-19 13c8-7 11-11 13-16m-16 19 24-17m-21 17c8-6 13-13 19-19m-16 23c1-6 7-13 15-24m-17 23c4-5 10-15 18-23m-23 32c7-13 13-22 30-31m-26 28c7-10 12-18 23-28m-25 28c14-8 20-23 30-27m-28 30c7-12 19-20 28-32m-27 31c7-9 22-24 25-33m-25 38c10-17 22-28 28-37m-29 35c10-4 17-11 31-30m-33 34c12-12 21-23 32-38m-33 40c17-9 26-28 35-37m-34 39c12-12 17-19 34-43m-30 46c10-11 23-28 37-48m-39 46 38-43m-42 44c12-10 22-16 46-42m-42 43c10-9 22-22 40-45m-44 51c14-11 31-26 48-54m-44 52c10-15 25-29 44-48m-44 54c12-15 24-27 43-55m-43 55 44-56m-47 58c21-18 42-45 49-60m-46 61c12-17 27-35 47-58m-46 59c14-17 28-37 50-55m-51 56c14-18 29-38 51-58m-53 62c15-19 29-37 52-60m-50 57c17-16 31-35 53-59m-53 63c20-19 37-40 48-58m-49 59c21-26 42-49 53-59m-53 60c8-13 19-28 54-61m-54 63 53-61m-53 66 47-64m-48 63 54-62m-54 66c23-25 38-48 52-59m-54 60c13-13 23-26 53-64m-54 66c12-16 30-30 56-62m-55 63c17-15 30-34 53-62m-52 65c16-23 27-39 51-64m-52 62c20-22 42-45 53-61m-52 63c10-16 31-35 55-63m-57 66c12-12 24-25 57-64m-55 63c21-13 36-40 53-57m-54 62c15-15 27-30 54-65m-55 67c24-18 41-38 58-60m-56 61 52-66m-54 63c20-18 45-44 59-58m-59 64c17-19 34-35 56-66m-56 67c20-19 42-46 54-61m-51 60c12-17 30-33 52-59m-55 64c19-17 31-33 60-66m-58 67c15-21 34-42 53-65m-56 69c21-31 47-52 61-65m-59 61 57-60m-56 63c24-24 40-45 53-65m-55 67c14-15 26-27 55-65m-53 68c15-21 36-42 55-62m-55 64c14-18 32-39 56-65m-54 67c14-15 24-32 49-62m-52 62 55-65m-58 66c17-22 36-38 57-61m-53 64c21-24 42-50 54-67m-54 70c13-15 25-35 56-63m-57 62 57-64m-60 70c15-22 38-41 55-70m-54 68c15-18 34-36 57-65m-59 64c13-13 29-28 59-63m-56 69c18-24 36-42 56-67m-60 64c21-18 45-42 61-65m-56 70c16-22 29-37 55-67m-54 68c14-17 30-32 54-64m-57 66c14-14 28-32 60-67m-62 68c16-18 32-34 57-66m-55 65c16-15 32-32 58-63m-58 71c13-21 34-44 60-66m-61 63c23-24 44-52 60-66m-57 69c8-19 29-31 58-68m-58 67c17-18 32-41 56-66m-61 68c15-12 33-27 60-65m-57 68c16-14 31-34 59-67m-55 71c9-19 24-31 59-69m-61 70c14-21 30-36 57-69m-58 74c17-24 34-41 56-73m-57 69c20-25 43-48 59-68m-57 73c16-20 34-37 56-71m-58 69c19-22 38-45 62-69m-63 72c18-19 36-44 60-68m-60 70c17-22 35-41 62-71m-60 74c12-17 31-39 62-67m-62 67c22-25 41-53 58-73m-57 76c21-25 42-46 58-73m-59 71c10-11 24-26 58-67m-62 69c14-9 29-26 60-70m-57 74c25-29 45-56 59-74m-60 79c16-25 34-43 61-77m-61 75c11-16 26-33 61-74m-62 74c15-8 25-25 64-71m-62 72c22-26 43-48 60-71m-63 79 65-76m-61 74c16-26 37-50 58-72m-63 73c18-19 28-35 64-68m-60 67c13-18 33-35 60-68m-63 73c16-12 25-32 60-72m-59 73c21-25 39-48 64-73m-66 77c24-30 48-52 63-76m-63 73c23-23 43-46 66-72m-66 77c14-16 31-27 68-72m-67 73c19-23 36-44 64-73m-67 73c21-24 47-50 68-72m-66 74 64-75m-66 77c23-23 43-51 70-74m-65 73c11-14 29-31 64-70m-65 73c16-14 32-33 65-72m-64 74c21-27 44-53 63-76m-62 83c22-34 45-56 59-80m-62 78 65-75m-67 77c26-28 51-53 70-75m-68 73c12-12 27-31 66-75m-66 78c24-27 45-55 63-77m-64 81 66-76m-65 74c27-27 49-51 63-77m-61 81 64-75m-64 79c19-28 52-55 61-79m-62 79c22-28 43-50 65-77m-65 75c19-19 41-46 64-73m-64 75c21-27 45-54 66-76m-65 81c20-26 52-63 64-77m-67 77c26-27 49-55 67-77m-69 76c26-19 39-41 69-71m-65 74 65-77m-64 83c16-26 34-48 68-82m-70 80c12-16 26-33 66-77m-69 77c26-28 47-50 73-71m-70 74c25-28 52-62 67-76m-69 79c24-24 52-57 71-76m-69 75c18-26 42-51 65-79m-65 82c18-17 40-37 71-81m-69 81c18-24 39-49 64-77m-63 81c17-29 43-54 67-80m-67 76c18-19 36-41 64-73m-66 76c22-24 41-44 66-74m-63 74c11-19 26-32 64-73m-60 78c21-34 46-57 56-77m-59 71c23-26 48-57 62-71m-64 74c20-20 34-31 68-74m-66 73c22-22 43-45 64-71m-58 69c19-21 37-46 55-66m-58 69c22-24 43-48 59-69m-54 75c17-24 37-47 54-72m-55 68c12-21 32-39 55-67m-54 65c14-13 29-36 54-59m-54 64c15-23 32-43 56-67m-55 67c13-18 34-35 52-66m-52 67c13-18 30-37 53-64m-51 63c12-21 25-33 56-60m-58 61c14-14 27-28 53-62m-54 64c20-24 41-46 58-65m-55 64 53-61m-52 64c14-18 24-37 52-61m-49 58c16-20 36-43 50-57m-53 61c13-17 30-29 50-63m-47 60c13-15 21-28 50-55m-49 58c13-16 20-28 50-57m-49 54 46-54m-47 55c19-16 36-39 50-48m-47 50c13-16 31-37 46-51m-44 56c11-20 32-41 41-57m-43 51c19-18 37-37 47-51m-46 53c11-10 16-24 46-51m-44 53c15-18 31-35 41-51m-42 53c15-13 25-29 40-52m-38 51 41-49m-37 50c11-20 33-34 39-50m-39 48c14-15 25-32 38-45m-40 46c17-14 32-33 43-39m-40 40c6-10 20-24 35-42m-38 45c15-12 25-31 40-44m-37 41c11-10 23-23 36-40m-37 42c13-10 31-31 39-41m-34 42 35-41m-34 39c5-6 15-17 34-33m-34 38c5-13 16-21 31-43m-31 41c12-5 23-20 35-38m-36 38c15-13 24-27 36-37m-37 43c12-10 21-20 38-37m-33 34c11-11 19-25 30-37m-27 36c4-8 18-21 26-35m-28 37c7-7 14-16 28-37m-30 36c14-4 19-16 35-27m-31 31c11-15 23-28 28-33m-27 30c12-10 20-21 27-27m-30 30c10-9 21-23 30-34m-25 37c6-7 15-17 27-35m-28 34c6-11 14-19 27-30m-26 27c9-8 16-18 21-23m-22 28 24-31m-22 32c6-9 19-20 23-26m-25 27c8-7 13-17 25-28m-26 30c13-8 16-15 24-28m-22 26 26-24m-21 25 19-22m-20 24c7-11 16Line truncated
<path stroke="transparent" strokeWidth=".5" d="m272 626-11-25c-3-8-4-17-10-24-5-8-14-15-21-21s-14-14-20-17c-5-4-12-2-15-6-2-4 0-6 0-17l4-52c3-34 7-127 9-155s-1-12 3-14c3-2 12-1 19-1 8 1 22-1 26 2s-3-10-2 15c1 24 3 78 7 130l11 182m-3 0c-3-3-8-12-11-19s-3-17-8-24c-5-8-13-15-20-21l-22-20c-5-5-9-6-10-9-2-3-1 1-1-10s-1-20 1-56c1-35 4-130 7-159 2-28 4-9 8-11 5-1 13 2 19 3 7 0 17-4 21-1 3 3 0-4 1 20s1 73 5 125l14 188"/>
</g>
<path fill="none" stroke="black" strokeLinecap="round" strokeWidth="4" d="m271 626-10-23c-4-8-7-18-12-26s-10-15-17-21l-25-16c-6-4-8-3-10-7-2-3-2-2-2-14l3-56 9-154c2-28-2-12 2-14 3-2 11 1 18 1 8 0 22-6 27-3 4 3-1-3 0 21a9897 9897 0 0 0 17 312m2 2-13-24c-3-8-4-18-8-26-5-8-13-15-20-21-7-7-18-13-24-17-5-4-8-1-10-4-2-4-2-6-2-18s-1-20 1-55l8-155c2-28-2-11 1-13 4-3 14-1 22-1s23-1 28 2c4 3-3-7-2 17a4634 4634 0 0 0 17 312"/>
<path fill="none" stroke={blade} strokeLinecap="round" strokeWidth="8" d="m255 296 12 320m-15-322 21 325"/>
</svg>
)
}
export const saveIcon = (isDirty: boolean) => {
return (
<svg
+125 -113
View File
@@ -17,6 +17,8 @@ import { getEA } from "src";
import { ExcalidrawAutomate } from "src/ExcalidrawAutomate";
export class EmbeddableMenu {
private menuFadeTimeout: number = 0;
private menuElementId: string = null;
constructor(
private view:ExcalidrawView,
@@ -24,6 +26,19 @@ export class EmbeddableMenu {
) {
}
public destroy() {
if(this.menuFadeTimeout) {
clearTimeout(this.menuFadeTimeout);
this.menuFadeTimeout = null;
}
this.view = null;
this.containerRef = null;
this.updateElement = null;
this.handleMouseEnter = null;
this.handleMouseLeave = null;
this.renderButtons = null;
}
private updateElement = (subpath: string, element: ExcalidrawEmbeddableElement, file: TFile) => {
if(!element) return;
const view = this.view;
@@ -40,23 +55,118 @@ export class EmbeddableMenu {
ea.copyViewElementsToEAforEditing([element]);
ea.getElement(element.id).link = link;
view.excalidrawData.elementLinks.set(element.id, link);
ea.addElementsToView(false, true, true);
ea.addElementsToView(false, true, true).then(() => ea.destroy());
}
private menuFadeTimeout: number = 0;
private menuElementId: string = null;
private handleMouseEnter () {
clearTimeout(this.menuFadeTimeout);
this.containerRef.current?.style.setProperty("opacity", "1");
};
private handleMouseLeave () {
const self = this;
this.menuFadeTimeout = window.setTimeout(() => {
self.containerRef.current?.style.setProperty("opacity", "0.2");
this.containerRef.current?.style.setProperty("opacity", "0.2");
}, 5000);
};
private async actionMarkdownSelection (file: TFile, isExcalidrawFile: boolean, subpath: string, element: ExcalidrawEmbeddableElement) {
this.view.updateScene({appState: {activeEmbeddable: null}, storeAction: "update"});
const sections = (await app.metadataCache.blockCache
.getForFile({ isCancelled: () => false },file))
.blocks.filter((b: any) => b.display && b.node?.type === "heading")
.filter((b: any) => !isExcalidrawFile || !MD_EX_SECTIONS.includes(b.display));
let values, display;
if(isExcalidrawFile) {
values = sections.map((b: any) => `#${cleanSectionHeading(b.display)}`);
display = sections.map((b: any) => b.display);
} else {
values = [""].concat(
sections.map((b: any) => `#${cleanSectionHeading(b.display)}`)
);
display = [t("SHOW_ENTIRE_FILE")].concat(
sections.map((b: any) => b.display)
);
}
const newSubpath = await ScriptEngine.suggester(
app, display, values, "Select section from document"
);
if(!newSubpath && newSubpath!=="") return;
if (newSubpath !== subpath) {
this.updateElement(newSubpath, element, file);
}
}
private async actionMarkdownBlock (file: TFile, subpath: string, element: ExcalidrawEmbeddableElement) {
if(!file) return;
this.view.updateScene({appState: {activeEmbeddable: null}, storeAction: "update"});
const paragraphs = (await app.metadataCache.blockCache
.getForFile({ isCancelled: () => false },file))
.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")
);
const values = ["entire-file"].concat(paragraphs);
const display = [t("SHOW_ENTIRE_FILE")].concat(
paragraphs.map((b: any) => `${b.node?.id ? `#^${b.node.id}: ` : ``}${b.display.trim()}`));
const selectedBlock = await ScriptEngine.suggester(
app, display, values, "Select section from document"
);
if(!selectedBlock) return;
if(selectedBlock==="entire-file") {
if(subpath==="") return;
this.updateElement("", element, file);
return;
}
let blockID = selectedBlock.node.id;
if(blockID && (`#^${blockID}` === subpath)) return;
if (!blockID) {
const offset = selectedBlock.node?.position?.end?.offset;
if(!offset) return;
blockID = nanoid();
const fileContents = await app.vault.cachedRead(file);
if(!fileContents) return;
await app.vault.modify(file, fileContents.slice(0, offset) + ` ^${blockID}` + fileContents.slice(offset));
await sleep(200); //wait for cache to update
}
this.updateElement(`#^${blockID}`, element, file);
}
private actionZoomToElement (element: ExcalidrawEmbeddableElement, maxLevel?: number) {
if(!element) return;
const api = this.view.excalidrawAPI as ExcalidrawImperativeAPI;
api.zoomToFit([element], maxLevel ?? this.view.plugin.settings.zoomToFitMaxLevel, 0.1);
}
private actionProperties (element: ExcalidrawEmbeddableElement, file: TFile) {
if(!element) return;
new EmbeddableSettings(this.view.plugin,this.view,file,element).open();
}
private actionCrop (element: ExcalidrawEmbeddableElement) {
if(!element) return;
//@ts-ignore
this.view.app.commands.executeCommandById("obsidian-excalidraw-plugin:crop-image");
}
private actionReload (iframe: HTMLIFrameElement, link: string) {
iframe.src = link;
}
private actionOpen (iframe: HTMLIFrameElement, element: ExcalidrawEmbeddableElement) {
openExternalLink(
!iframe.src.startsWith("https://www.youtube.com") && !iframe.src.startsWith("https://player.vimeo.com")
? iframe.src
: element.link,
this.view.app
);
}
private actionCopyCode (element: ExcalidrawEmbeddableElement, link: string) {
if(!element) return;
navigator.clipboard.writeText(atob(link.split(",")[1]));
}
renderButtons(appState: AppState) {
const view = this.view;
@@ -132,111 +242,36 @@ export class EmbeddableMenu {
<ActionButton
key={"MarkdownSection"}
title={t("NARROW_TO_HEADING")}
action={async () => {
view.updateScene({appState: {activeEmbeddable: null}});
const sections = (await app.metadataCache.blockCache
.getForFile({ isCancelled: () => false },file))
.blocks.filter((b: any) => b.display && b.node?.type === "heading")
.filter((b: any) => !isExcalidrawFile || !MD_EX_SECTIONS.includes(b.display));
let values, display;
if(isExcalidrawFile) {
values = sections.map((b: any) => `#${cleanSectionHeading(b.display)}`);
display = sections.map((b: any) => b.display);
} else {
values = [""].concat(
sections.map((b: any) => `#${cleanSectionHeading(b.display)}`)
);
display = [t("SHOW_ENTIRE_FILE")].concat(
sections.map((b: any) => b.display)
);
}
const newSubpath = await ScriptEngine.suggester(
app, display, values, "Select section from document"
);
if(!newSubpath && newSubpath!=="") return;
if (newSubpath !== subpath) {
this.updateElement(newSubpath, element, file);
}
}}
action={async () => this.actionMarkdownSelection(file, isExcalidrawFile, subpath, element)}
icon={ICONS.ZoomToSection}
view={view}
/>
)}
{isMD && !isExcalidrawFile && (
<ActionButton
key={"MarkdownBlock"}
title={t("NARROW_TO_BLOCK")}
action={async () => {
if(!file) return;
view.updateScene({appState: {activeEmbeddable: null}});
const paragraphs = (await app.metadataCache.blockCache
.getForFile({ isCancelled: () => false },file))
.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")
);
const values = ["entire-file"].concat(paragraphs);
const display = [t("SHOW_ENTIRE_FILE")].concat(
paragraphs.map((b: any) => `${b.node?.id ? `#^${b.node.id}: ` : ``}${b.display.trim()}`));
const selectedBlock = await ScriptEngine.suggester(
app, display, values, "Select section from document"
);
if(!selectedBlock) return;
if(selectedBlock==="entire-file") {
if(subpath==="") return;
this.updateElement("", element, file);
return;
}
let blockID = selectedBlock.node.id;
if(blockID && (`#^${blockID}` === subpath)) return;
if (!blockID) {
const offset = selectedBlock.node?.position?.end?.offset;
if(!offset) return;
blockID = nanoid();
const fileContents = await app.vault.cachedRead(file);
if(!fileContents) return;
await app.vault.modify(file, fileContents.slice(0, offset) + ` ^${blockID}` + fileContents.slice(offset));
await sleep(200); //wait for cache to update
}
this.updateElement(`#^${blockID}`, element, file);
}}
action={async () => this.actionMarkdownBlock(file, subpath, element)}
icon={ICONS.ZoomToBlock}
view={view}
/>
)}
<ActionButton
key={"ZoomToElement"}
title={t("ZOOM_TO_FIT")}
action={() => {
if(!element) return;
api.zoomToFit([element], 30, 0.1);
}}
action={() => this.actionZoomToElement(element,30)}
icon={ICONS.ZoomToSelectedElement}
view={view}
/>
<ActionButton
key={"Properties"}
title={t("PROPERTIES")}
action={() => {
if(!element) return;
new EmbeddableSettings(view.plugin,view,file,element).open();
}}
action={() => this.actionProperties(element, file)}
icon={ICONS.Properties}
view={view}
/>
{isPDF && (
<ActionButton
key={"Crop"}
title={t("CROP_PAGE")}
action={() => {
if(!element) return;
//@ts-ignore
view.app.commands.executeCommandById("obsidian-excalidraw-plugin:crop-image");
}}
action={() => this.actionCrop(element)}
icon={ICONS.Crop}
view={view}
/>
)}
</div>
@@ -276,57 +311,34 @@ export class EmbeddableMenu {
<ActionButton
key={"Reload"}
title={t("RELOAD")}
action={()=>{
iframe.src = link;
}}
action={()=> this.actionReload(iframe, link)}
icon={ICONS.Reload}
view={view}
/>
)}
<ActionButton
key={"Open"}
title={t("OPEN_IN_BROWSER")}
action={() => {
openExternalLink(
!iframe.src.startsWith("https://www.youtube.com") && !iframe.src.startsWith("https://player.vimeo.com")
? iframe.src
: element.link,
view.app
);
}}
action={() => this.actionOpen(iframe, element)}
icon={ICONS.Globe}
view={view}
/>
<ActionButton
key={"ZoomToElement"}
title={t("ZOOM_TO_FIT")}
action={() => {
if(!element) return;
api.zoomToFit([element], view.plugin.settings.zoomToFitMaxLevel, 0.1);
}}
action={() => this.actionZoomToElement(element)}
icon={ICONS.ZoomToSelectedElement}
view={view}
/>
<ActionButton
key={"Properties"}
title={t("PROPERTIES")}
action={() => {
if(!element) return;
new EmbeddableSettings(view.plugin,view,null,element).open();
}}
action={() => this.actionProperties(element, null)}
icon={ICONS.Properties}
view={view}
/>
{link?.startsWith("data:text/html") && (
<ActionButton
key={"CopyCode"}
title={t("COPYCODE")}
action={() => {
if(!element) return;
navigator.clipboard.writeText(atob(link.split(",")[1]));
}}
action={() => this.actionCopyCode(element, link)}
icon={ICONS.Copy}
view={view}
/>
)}
</div>
+122 -96
View File
@@ -14,7 +14,7 @@ import { t } from "src/lang/helpers";
declare const PLUGIN_VERSION:string;
export const setPen = (pen: PenStyle, api: any) => {
export function setPen (pen: PenStyle, api: any) {
const st = api.getAppState();
api.updateScene({
appState: {
@@ -34,11 +34,12 @@ export const setPen = (pen: PenStyle, api: any) => {
currentItemRoughness: st.currentItemRoughness,
}}
: null,
}
},
storeAction: "update",
})
}
export const resetStrokeOptions = (resetCustomPen:any, api: ExcalidrawImperativeAPI, clearCurrentStrokeOptions: boolean) => {
export function resetStrokeOptions (resetCustomPen:any, api: ExcalidrawImperativeAPI, clearCurrentStrokeOptions: boolean) {
api.updateScene({
appState: {
...resetCustomPen ? {
@@ -50,13 +51,16 @@ export const resetStrokeOptions = (resetCustomPen:any, api: ExcalidrawImperative
}: null,
resetCustomPen: null,
...clearCurrentStrokeOptions ? {currentStrokeOptions: null} : null,
}
},
storeAction: "update",
});
}
export class ObsidianMenu {
private clickTimestamp:number[];
private activePen: PenStyle;
private longpressTimeout : { [key: number]: number } = {};
private prevClickTimestamp: number = 0;
constructor(
private plugin: ExcalidrawPlugin,
private toolsRef: React.MutableRefObject<any>,
@@ -65,9 +69,98 @@ export class ObsidianMenu {
this.clickTimestamp = Array.from({length: Object.keys(PENS).length}, () => 0);
}
renderCustomPens = (isMobile: boolean, appState: AppState) => {
private actionCustomPenLabelClick(index: number, pen: PenStyle) {
const now = Date.now();
const dblClick = now-this.clickTimestamp[index] < 500;
//open pen settings on double click
if(dblClick) {
const penSettings = new PenSettingsModal(this.plugin,this.view,index);
(async () => {
await this.plugin.loadSettings();
penSettings.open();
})();
return;
}
this.clickTimestamp[index] = now;
const api = this.view.excalidrawAPI;
const st = api.getAppState();
//single second click to reset freedraw to default
if(st.currentStrokeOptions === pen.penOptions && st.activeTool.type === "freedraw") {
resetStrokeOptions(st.resetCustomPen, api, true);
return;
}
//apply pen settings to canvas
this.activePen = {...pen};
setPen(pen,api);
api.setActiveTool({type:"freedraw"});
}
private actionScriptButtonPonterUp(index: number, key: string) {
if(this.longpressTimeout[index]) {
this.view.ownerWindow.clearTimeout(this.longpressTimeout[index]);
this.longpressTimeout[index] = 0;
(async ()=>{
const f = this.view.app.vault.getAbstractFileByPath(key);
if (f && f instanceof TFile) {
this.plugin.scriptEngine.executeScript(
this.view,
await this.view.app.vault.read(f),
this.plugin.scriptEngine.getScriptName(f),
f
);
}
})()
}
}
private actionScriptButtonPointerDown(index: number, key: string) {
const now = Date.now();
if(this.longpressTimeout[index]>0) {
this.view.ownerWindow.clearTimeout(this.longpressTimeout[index]);
this.longpressTimeout[index] = 0;
}
if(now-this.prevClickTimestamp >= 500) {
this.longpressTimeout[index] = this.view.ownerWindow.setTimeout(
() => {
this.longpressTimeout[index] = 0;
(async () =>{
await this.plugin.loadSettings();
const index = this.plugin.settings.pinnedScripts.indexOf(key)
if(index > -1) {
this.plugin.settings.pinnedScripts.splice(index,1);
this.view.excalidrawAPI?.setToast({message:`Pin removed: ${name}`, duration: 3000, closable: true});
}
await this.plugin.saveSettings();
this.plugin.app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW).forEach(v=> {
if (v.view instanceof ExcalidrawView) v.view.updatePinnedScripts()
})
})()
},
1500
)
}
this.prevClickTimestamp = now;
}
private actionShowHideMenu (isMobile: boolean, appState: AppState) {
this.toolsRef.current.setTheme(appState.theme);
this.toolsRef.current.toggleVisibility(
appState.zenModeEnabled || isMobile,
);
}
private actionInsertAnyFile() {
this.view.setCurrentPositionToCenter();
const insertFileModal = new UniversalInsertFileModal(this.plugin, this.view);
insertFileModal.open();
}
public renderCustomPens (isMobile: boolean, appState: AppState) {
return(
appState.customPens?.map((key,index)=>{
appState.customPens?.map((_,index)=>{
const pen = this.plugin.settings.customPens[index]
//Reset stroke setting when changing to a different tool
if(
@@ -75,7 +168,7 @@ export class ObsidianMenu {
appState.activeTool.type !== "freedraw" &&
appState.currentStrokeOptions === pen.penOptions
) {
setTimeout(()=> resetStrokeOptions(appState.resetCustomPen, this.view.excalidrawAPI, false))
setTimeout(()=> resetStrokeOptions(appState.resetCustomPen, this.view.excalidrawAPI, false));
}
//if Pen settings are loaded, select custom pen when activating the freedraw element
if (
@@ -111,34 +204,7 @@ export class ObsidianMenu {
"is-mobile": isMobile,
},
)}
onClick={() => {
const now = Date.now();
const dblClick = now-this.clickTimestamp[index] < 500;
//open pen settings on double click
if(dblClick) {
const penSettings = new PenSettingsModal(this.plugin,this.view,index);
(async () => {
await this.plugin.loadSettings();
penSettings.open();
})();
return;
}
this.clickTimestamp[index] = now;
const api = this.view.excalidrawAPI;
const st = api.getAppState();
//single second click to reset freedraw to default
if(st.currentStrokeOptions === pen.penOptions && st.activeTool.type === "freedraw") {
resetStrokeOptions(st.resetCustomPen, api, true);
return;
}
//apply pen settings to canvas
this.activePen = {...pen};
setPen(pen,api);
api.setActiveTool({type:"freedraw"});
}}
onClick={ this.actionCustomPenLabelClick.bind(this,index, pen) }
>
<div
className="ToolIcon__icon"
@@ -157,10 +223,7 @@ export class ObsidianMenu {
)
}
private longpressTimeout : { [key: number]: number } = {};
renderPinnedScriptButtons = (isMobile: boolean, appState: AppState) => {
let prevClickTimestamp = 0;
public renderPinnedScriptButtons (isMobile: boolean, appState: AppState) {
return (
appState?.pinnedScripts?.map((key,index)=>{ //pinned scripts
const scriptProp = this.plugin.scriptEngine.scriptIconMap[key];
@@ -179,51 +242,8 @@ export class ObsidianMenu {
"is-mobile": isMobile,
},
)}
onPointerUp={() => {
if(this.longpressTimeout[index]) {
window.clearTimeout(this.longpressTimeout[index]);
this.longpressTimeout[index] = 0;
(async ()=>{
const f = app.vault.getAbstractFileByPath(key);
if (f && f instanceof TFile) {
this.plugin.scriptEngine.executeScript(
this.view,
await app.vault.read(f),
this.plugin.scriptEngine.getScriptName(f),
f
);
}
})()
}
}}
onPointerDown={()=>{
const now = Date.now();
if(this.longpressTimeout[index]>0) {
window.clearTimeout(this.longpressTimeout[index]);
this.longpressTimeout[index] = 0;
}
if(now-prevClickTimestamp >= 500) {
this.longpressTimeout[index] = window.setTimeout(
() => {
this.longpressTimeout[index] = 0;
(async () =>{
await this.plugin.loadSettings();
const index = this.plugin.settings.pinnedScripts.indexOf(key)
if(index > -1) {
this.plugin.settings.pinnedScripts.splice(index,1);
this.view.excalidrawAPI?.setToast({message:`Pin removed: ${name}`, duration: 3000, closable: true});
}
await this.plugin.saveSettings();
app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW).forEach(v=> {
if (v.view instanceof ExcalidrawView) v.view.updatePinnedScripts()
})
})()
},
1500
)
}
prevClickTimestamp = now;
}}
onPointerUp={this.actionScriptButtonPonterUp.bind(this,index,key)}
onPointerDown={this.actionScriptButtonPointerDown.bind(this,index,key)}
>
<div
className="ToolIcon__icon"
@@ -237,7 +257,7 @@ export class ObsidianMenu {
)
}
renderButton = (isMobile: boolean, appState: AppState) => {
public renderButton (isMobile: boolean, appState: AppState) {
return (
<>
<label
@@ -248,12 +268,7 @@ export class ObsidianMenu {
"is-mobile": isMobile,
},
)}
onClick={() => {
this.toolsRef.current.setTheme(appState.theme);
this.toolsRef.current.toggleVisibility(
appState.zenModeEnabled || isMobile,
);
}}
onClick={this.actionShowHideMenu.bind(this,isMobile,appState)}
>
<div className="ToolIcon__icon" aria-label={t("OBSIDIAN_TOOLS_PANEL")}>
{ICONS.obsidian}
@@ -267,11 +282,7 @@ export class ObsidianMenu {
"is-mobile": isMobile,
},
)}
onClick={() => {
this.view.setCurrentPositionToCenter();
const insertFileModal = new UniversalInsertFileModal(this.plugin, this.view);
insertFileModal.open();
}}
onClick={this.actionInsertAnyFile.bind(this)}
>
<div className="ToolIcon__icon" aria-label={t("UNIVERSAL_ADD_FILE")}>
{ICONS["add-file"]}
@@ -282,4 +293,19 @@ export class ObsidianMenu {
</>
);
};
destroy() {
Object.values(this.longpressTimeout).forEach(
t=>this.view.ownerWindow.clearTimeout(t)
);
this.longpressTimeout = {};
this.activePen = null;
this.plugin = null;
this.toolsRef = null;
this.view = null;
this.clickTimestamp = null;
this.renderButton = null;
this.renderCustomPens = null;
this.renderPinnedScriptButtons = null;
}
}
+273 -229
View File
@@ -24,8 +24,9 @@ const light = '<svg style="stroke:#212529;color:#212529;fill:#212529" ';
type PanelProps = {
visible: boolean;
view: ExcalidrawView;
view: WeakRef<ExcalidrawView>;
centerPointer: Function;
observer: WeakRef<ResizeObserver>;
};
export type PanelState = {
@@ -38,7 +39,7 @@ export type PanelState = {
isDirty: boolean;
isFullscreen: boolean;
isPreviewMode: boolean;
scriptIconMap: ScriptIconMap;
scriptIconMap: ScriptIconMap | null;
};
const TOOLS_PANEL_WIDTH = 228;
@@ -55,10 +56,22 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
onRightEdge: boolean = false;
onBottomEdge: boolean = false;
public containerRef: React.RefObject<HTMLDivElement>;
private view: ExcalidrawView;
componentWillUnmount(): void {
if (this.containerRef.current) {
this.props.observer.deref()?.unobserve(this.containerRef.current);
}
this.setState({ scriptIconMap: null });
this.containerRef = null;
this.view = null;
}
constructor(props: PanelProps) {
super(props);
const react = props.view.plugin.getPackage(props.view.ownerWindow).react;
this.view = props.view.deref();
const react = this.view.packages.react;
this.containerRef = react.createRef();
this.state = {
visible: props.visible,
@@ -194,6 +207,232 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
});
}
actionOpenScriptInstallDialog() {
new ScriptInstallPrompt(this.view.plugin).open();
}
actionOpenReleaseNotes() {
new ReleaseNotes(
this.view.app,
this.view.plugin,
PLUGIN_VERSION,
).open();
}
actionConvertExcalidrawToMD() {
this.view.convertExcalidrawToMD();
}
actionToggleViewMode() {
if (this.state.isPreviewMode) {
this.view.changeTextMode(TextMode.raw);
} else {
this.view.changeTextMode(TextMode.parsed);
}
}
actionToggleTrayMode() {
this.view.toggleTrayMode();
}
actionToggleFullscreen() {
if (this.state.isFullscreen) {
this.view.exitFullscreen();
} else {
this.view.gotoFullscreen();
}
}
actionSearch() {
search(this.view);
}
actionOCR(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
if(!this.view.plugin.settings.taskboneEnabled) {
new Notice("Taskbone OCR is not enabled. Please go to plugins settings to enable it.",4000);
return;
}
this.view.plugin.taskbone.getTextForView(this.view, {forceReScan: isWinCTRLorMacCMD(e)});
}
actionOpenLink(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
const event = new MouseEvent("click", {
ctrlKey: e.ctrlKey || !(DEVICE.isIOS || DEVICE.isMacOS),
metaKey: e.metaKey || (DEVICE.isIOS || DEVICE.isMacOS),
shiftKey: e.shiftKey,
altKey: e.altKey,
});
this.view.handleLinkClick(event);
}
actionOpenLinkProperties() {
const event = new MouseEvent("click", {
ctrlKey: true,
metaKey: true,
shiftKey: false,
altKey: false,
});
this.view.handleLinkClick(event);
}
actionForceSave() {
this.view.forceSave();
}
actionExportLibrary() {
this.view.plugin.exportLibrary();
}
actionExportImage() {
const view = this.view;
if(!view.exportDialog) {
view.exportDialog = new ExportDialog(view.plugin, view,view.file);
view.exportDialog.createForm();
}
view.exportDialog.open();
}
actionOpenAsMarkdown() {
this.view.openAsMarkdown();
}
actionLinkToElement(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
if(isWinALTorMacOPT(e)) {
openExternalLink("https://youtu.be/yZQoJg2RCKI", this.view.app);
return;
}
this.view.copyLinkToSelectedElementToClipboard(
isWinCTRLorMacCMD(e) ? "group=" : (isSHIFT(e) ? "area=" : "")
);
}
actionAddAnyFile() {
this.props.centerPointer();
const insertFileModal = new UniversalInsertFileModal(this.view.plugin, this.view);
insertFileModal.open();
}
actionInsertImage() {
this.props.centerPointer();
this.view.plugin.insertImageDialog.start(
this.view,
);
}
actionInsertPDF() {
this.props.centerPointer();
const insertPDFModal = new InsertPDFModal(this.view.plugin, this.view);
insertPDFModal.open();
}
actionInsertMarkdown() {
this.props.centerPointer();
this.view.plugin.insertMDDialog.start(
this.view,
);
}
actionInsertBackOfNote() {
this.props.centerPointer();
this.view.insertBackOfTheNoteCard();
}
actionInsertLaTeX(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
if(isWinALTorMacOPT(e)) {
openExternalLink("https://youtu.be/r08wk-58DPk", this.view.app);
return;
}
this.props.centerPointer();
insertLaTeXToView(this.view);
}
actionInsertLink() {
this.props.centerPointer();
this.view.plugin.insertLinkDialog.start(
this.view.file.path,
(text: string, fontFamily?: 1 | 2 | 3 | 4, save?: boolean) => this.view.addText (text, fontFamily, save),
);
}
actionImportSVG(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
this.view.plugin.importSVGDialog.start(this.view);
}
actionCropImage(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) {
// @ts-ignore
this.view.app.commands.executeCommandById("obsidian-excalidraw-plugin:crop-image");
}
async actionRunScript(key: string) {
const view = this.view;
const plugin = view.plugin;
const f = app.vault.getAbstractFileByPath(key);
if (f && f instanceof TFile) {
plugin.scriptEngine.executeScript(
view,
await app.vault.read(f),
plugin.scriptEngine.getScriptName(f),
f
);
}
}
async actionPinScript(key: string, scriptName: string) {
const view = this.view;
const api = view.excalidrawAPI as ExcalidrawImperativeAPI;
const plugin = view.plugin;
await plugin.loadSettings();
const index = plugin.settings.pinnedScripts.indexOf(key)
if(index > -1) {
plugin.settings.pinnedScripts.splice(index,1);
api?.setToast({message:`Pin removed: ${scriptName}`, duration: 3000, closable: true});
} else {
plugin.settings.pinnedScripts.push(key);
api?.setToast({message:`Pinned: ${scriptName}`, duration: 3000, closable: true})
}
await plugin.saveSettings();
plugin.app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW).forEach(v=> {
if (v.view instanceof ExcalidrawView) v.view.updatePinnedScripts()
})
}
private islandOnClick(event: React.MouseEvent<HTMLDivElement, MouseEvent>) {
event.preventDefault();
if (
Math.abs(this.penDownX - this.pos3) > 5 ||
Math.abs(this.penDownY - this.pos4) > 5
) {
return;
}
this.setState((prevState: PanelState) => {
return {
minimized: !prevState.minimized,
};
});
}
private islandOnPointerDown(event: React.PointerEvent) {
const onDrag = (e: PointerEvent) => {
e.preventDefault();
this.pos1 = this.pos3 - e.clientX;
this.pos2 = this.pos4 - e.clientY;
this.pos3 = e.clientX;
this.pos4 = e.clientY;
this.updatePosition(this.pos2, this.pos1);
};
const onPointerUp = () => {
this.view.ownerDocument?.removeEventListener("pointerup", onPointerUp);
this.view.ownerDocument?.removeEventListener("pointermove", onDrag);
};
event.preventDefault();
this.penDownX = this.pos3 = event.clientX;
this.penDownY = this.pos4 = event.clientY;
this.view.ownerDocument.addEventListener("pointerup", onPointerUp);
this.view.ownerDocument.addEventListener("pointermove", onDrag);
};
render() {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.render,"ToolsPanel.render()");
return (
@@ -230,41 +469,8 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
width: "100%",
cursor: "move",
}}
onClick={(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
event.preventDefault();
if (
Math.abs(this.penDownX - this.pos3) > 5 ||
Math.abs(this.penDownY - this.pos4) > 5
) {
return;
}
this.setState((prevState: PanelState) => {
return {
minimized: !prevState.minimized,
};
});
}}
onPointerDown={(event: React.PointerEvent) => {
const onDrag = (e: PointerEvent) => {
e.preventDefault();
this.pos1 = this.pos3 - e.clientX;
this.pos2 = this.pos4 - e.clientY;
this.pos3 = e.clientX;
this.pos4 = e.clientY;
this.updatePosition(this.pos2, this.pos1);
};
const onPointerUp = () => {
this.props.view.ownerDocument?.removeEventListener("pointerup", onPointerUp);
this.props.view.ownerDocument?.removeEventListener("pointermove", onDrag);
};
event.preventDefault();
this.penDownX = this.pos3 = event.clientX;
this.penDownY = this.pos4 = event.clientY;
this.props.view.ownerDocument.addEventListener("pointerup", onPointerUp);
this.props.view.ownerDocument.addEventListener("pointermove", onDrag);
}}
onClick={this.islandOnClick.bind(this)}
onPointerDown={this.islandOnPointerDown.bind(this)}
>
<svg
aria-hidden="true"
@@ -297,62 +503,39 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
<ActionButton
key={"scriptEngine"}
title={t("INSTALL_SCRIPT_BUTTON")}
action={() => {
new ScriptInstallPrompt(this.props.view.plugin).open();
}}
action={this.actionOpenScriptInstallDialog.bind(this)}
icon={ICONS.scriptEngine}
view={this.props.view}
/>
<ActionButton
key={"release-notes"}
title={t("READ_RELEASE_NOTES")}
action={() => {
new ReleaseNotes(
this.props.view.app,
this.props.view.plugin,
PLUGIN_VERSION,
).open();
}}
action={this.actionOpenReleaseNotes.bind(this)}
icon={ICONS.releaseNotes}
view={this.props.view}
/>
{this.state.isPreviewMode === null ? (
<ActionButton
key={"convert"}
title={t("CONVERT_FILE")}
action={() => {
this.props.view.convertExcalidrawToMD();
}}
action={(this.actionConvertExcalidrawToMD.bind(this))}
icon={ICONS.convertFile}
view={this.props.view}
/>
) : (
<ActionButton
key={"viewmode"}
title={this.state.isPreviewMode ? t("PARSED") : t("RAW")}
action={() => {
if (this.state.isPreviewMode) {
this.props.view.changeTextMode(TextMode.raw);
} else {
this.props.view.changeTextMode(TextMode.parsed);
}
}}
action={this.actionToggleViewMode.bind(this)}
icon={
this.state.isPreviewMode
? ICONS.rawMode
: ICONS.parsedMode
}
view={this.props.view}
/>
)}
<ActionButton
key={"tray-mode"}
title={t("TRAY_MODE")}
action={() => {
this.props.view.toggleTrayMode();
}}
action={this.actionToggleTrayMode.bind(this)}
icon={ICONS.trayMode}
view={this.props.view}
/>
<ActionButton
key={"fullscreen"}
@@ -361,80 +544,42 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
? t("EXIT_FULLSCREEN")
: t("GOTO_FULLSCREEN")
}
action={() => {
if (this.state.isFullscreen) {
this.props.view.exitFullscreen();
} else {
this.props.view.gotoFullscreen();
}
}}
action={this.actionToggleFullscreen.bind(this)}
icon={
this.state.isFullscreen
? ICONS.exitFullScreen
: ICONS.gotoFullScreen
}
view={this.props.view}
/>
<ActionButton
key={"search"}
title={t("SEARCH")}
action={() => {
search(this.props.view);
}}
action={this.actionSearch.bind(this)}
icon={ICONS.search}
view={this.props.view}
/>
<ActionButton
key={"ocr"}
title={t("RUN_OCR")}
action={(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
if(!this.props.view.plugin.settings.taskboneEnabled) {
new Notice("Taskbone OCR is not enabled. Please go to plugins settings to enable it.",4000);
return;
}
this.props.view.plugin.taskbone.getTextForView(this.props.view, {forceReScan: isWinCTRLorMacCMD(e)});
}}
action={this.actionOCR.bind(this)}
icon={ICONS.ocr}
view={this.props.view}
/>
<ActionButton
key={"openLink"}
title={t("OPEN_LINK_CLICK")}
action={(e) => {
const event = new MouseEvent("click", {
ctrlKey: e.ctrlKey || !(DEVICE.isIOS || DEVICE.isMacOS),
metaKey: e.metaKey || (DEVICE.isIOS || DEVICE.isMacOS),
shiftKey: e.shiftKey,
altKey: e.altKey,
});
this.props.view.handleLinkClick(event);
}}
action={this.actionOpenLink.bind(this)}
icon={ICONS.openLink}
view={this.props.view}
/>
<ActionButton
key={"openLinkProperties"}
title={t("OPEN_LINK_PROPS")}
action={() => {
const event = new MouseEvent("click", {
ctrlKey: true,
metaKey: true,
shiftKey: false,
altKey: false,
});
this.props.view.handleLinkClick(event);
}}
action={this.actionOpenLinkProperties.bind(this)}
icon={ICONS.openLinkProperties}
view={this.props.view}
/>
<ActionButton
key={"save"}
title={t("FORCE_SAVE")}
action={() => {
this.props.view.forceSave();
}}
action={this.actionForceSave.bind(this)}
icon={saveIcon(this.state.isDirty)}
view={this.props.view}
/>
</div>
</fieldset>
@@ -444,49 +589,26 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
<ActionButton
key={"lib"}
title={t("DOWNLOAD_LIBRARY")}
action={() => {
this.props.view.plugin.exportLibrary();
}}
action={this.actionExportLibrary.bind(this)}
icon={ICONS.exportLibrary}
view={this.props.view}
/>
<ActionButton
key={"exportIMG"}
title={t("EXPORT_IMAGE")}
action={() => {
const view = this.props.view;
if(!view.exportDialog) {
view.exportDialog = new ExportDialog(view.plugin, view,view.file);
view.exportDialog.createForm();
}
view.exportDialog.open();
}}
action={this.actionExportImage.bind(this)}
icon={ICONS.ExportImage}
view={this.props.view}
/>
<ActionButton
key={"md"}
title={t("OPEN_AS_MD")}
action={() => {
this.props.view.openAsMarkdown();
}}
action={this.actionOpenAsMarkdown.bind(this)}
icon={ICONS.switchToMarkdown}
view={this.props.view}
/>
<ActionButton
key={"link-to-element"}
title={t("INSERT_LINK_TO_ELEMENT")}
action={(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
if(isWinALTorMacOPT(e)) {
openExternalLink("https://youtu.be/yZQoJg2RCKI", this.props.view.app);
return;
}
this.props.view.copyLinkToSelectedElementToClipboard(
isWinCTRLorMacCMD(e) ? "group=" : (isSHIFT(e) ? "area=" : "")
);
}}
action={this.actionLinkToElement.bind(this)}
icon={ICONS.copyElementLink}
view={this.props.view}
/>
</div>
</fieldset>
@@ -496,104 +618,56 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
<ActionButton
key={"anyfile"}
title={t("UNIVERSAL_ADD_FILE")}
action={() => {
this.props.centerPointer();
const insertFileModal = new UniversalInsertFileModal(this.props.view.plugin, this.props.view);
insertFileModal.open();
}}
action={this.actionAddAnyFile.bind(this)}
icon={ICONS["add-file"]}
view={this.props.view}
/>
<ActionButton
key={"image"}
title={t("INSERT_IMAGE")}
action={() => {
this.props.centerPointer();
this.props.view.plugin.insertImageDialog.start(
this.props.view,
);
}}
action={this.actionInsertImage.bind(this)}
icon={ICONS.insertImage}
view={this.props.view}
/>
<ActionButton
key={"pdf"}
title={t("INSERT_PDF")}
action={() => {
this.props.centerPointer();
const insertPDFModal = new InsertPDFModal(this.props.view.plugin, this.props.view);
insertPDFModal.open();
}}
action={this.actionInsertPDF.bind(this)}
icon={ICONS.insertPDF}
view={this.props.view}
/>
<ActionButton
key={"insertMD"}
title={t("INSERT_MD")}
action={() => {
this.props.centerPointer();
this.props.view.plugin.insertMDDialog.start(
this.props.view,
);
}}
action={this.actionInsertMarkdown.bind(this)}
icon={ICONS.insertMD}
view={this.props.view}
/>
<ActionButton
key={"insertBackOfNote"}
title={t("INSERT_CARD")}
action={() => {
this.props.centerPointer();
this.props.view.insertBackOfTheNoteCard();
}}
action={this.actionInsertBackOfNote.bind(this)}
icon={ICONS.BackOfNote}
view={this.props.view}
/>
<ActionButton
key={"latex"}
title={t("INSERT_LATEX")}
action={(e) => {
if(isWinALTorMacOPT(e)) {
openExternalLink("https://youtu.be/r08wk-58DPk", this.props.view.app);
return;
}
this.props.centerPointer();
insertLaTeXToView(this.props.view);
}}
action={this.actionInsertLaTeX.bind(this)}
icon={ICONS.insertLaTeX}
view={this.props.view}
/>
<ActionButton
key={"link"}
title={t("INSERT_LINK")}
action={() => {
this.props.centerPointer();
this.props.view.plugin.insertLinkDialog.start(
this.props.view.file.path,
(text: string, fontFamily?: 1 | 2 | 3 | 4, save?: boolean) => this.props.view.addText (text, fontFamily, save),
);
}}
action={this.actionInsertLink.bind(this)}
icon={ICONS.insertLink}
view={this.props.view}
/>
<ActionButton
key={"import-svg"}
title={t("IMPORT_SVG")}
action={(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
this.props.view.plugin.importSVGDialog.start(this.props.view);
}}
action={this.actionImportSVG.bind(this)}
icon={ICONS.importSVG}
view={this.props.view}
/>
<ActionButton
key={"crop-image"}
title={t("CROP_IMAGE")}
action={(e:React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
// @ts-ignore
this.props.view.app.commands.executeCommandById("obsidian-excalidraw-plugin:crop-image");
}}
action={this.actionCropImage.bind(this)}
icon={ICONS.Crop}
view={this.props.view}
/>
</div>
</fieldset>
@@ -612,7 +686,7 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
return "";
}
const downloadedScriptsRoot = `${this.props.view.plugin.settings.scriptFolderPath}/${SCRIPT_INSTALL_FOLDER}/`;
const downloadedScriptsRoot = `${this.view.plugin.settings.scriptFolderPath}/${SCRIPT_INSTALL_FOLDER}/`;
const filterCondition = (key: string): boolean =>
isDownloaded
@@ -647,45 +721,15 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
<ActionButton
key={key}
title={value.name}
action={async () => {
const view = this.props.view;
const plugin = view.plugin;
const f = app.vault.getAbstractFileByPath(key);
if (f && f instanceof TFile) {
plugin.scriptEngine.executeScript(
view,
await app.vault.read(f),
plugin.scriptEngine.getScriptName(f),
f
);
}
}}
longpress={async () => {
const view = this.props.view;
const api = view.excalidrawAPI as ExcalidrawImperativeAPI;
const plugin = view.plugin;
await plugin.loadSettings();
const index = plugin.settings.pinnedScripts.indexOf(key)
if(index > -1) {
plugin.settings.pinnedScripts.splice(index,1);
api?.setToast({message:`Pin removed: ${value.name}`, duration: 3000, closable: true});
} else {
plugin.settings.pinnedScripts.push(key);
api?.setToast({message:`Pinned: ${value.name}`, duration: 3000, closable: true})
}
await plugin.saveSettings();
app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW).forEach(v=> {
if (v.view instanceof ExcalidrawView) v.view.updatePinnedScripts()
})
}}
action={this.actionRunScript.bind(this,key)}
longpress={this.actionPinScript.bind(this,key, value.name)}
icon={
value.svgString
new WeakRef(value.svgString
? stringToSVG(value.svgString)
: (
ICONS.cog
)
)).deref()
}
view={this.props.view}
/>
))}
</div>
+7
View File
@@ -22,6 +22,10 @@ export default class Taskbone {
) {
}
public destroy() {
this.plugin = null;
}
public async initialize(save:boolean = true):Promise<string> {
if(this.plugin.settings.taskboneAPIkey !== "") return;
const response = await requestUrl({
@@ -95,11 +99,13 @@ export default class Taskbone {
));
if(viewElements.length === 0) {
new Notice ("Aborting OCR because there are no image or freedraw elements on the canvas.",4000);
ea.destroy();
return;
}
const fe = new FrontmatterEditor(view.data);
if(addToFrontmatter && fe.hasKey("taskbone-ocr") && !forceReScan) {
new Notice ("The drawing has already been processed, you will find the result in the frontmatter in markdown view mode. If you ran the command from the Obsidian Panel in Excalidraw then you can CTRL(CMD)+click the command to force the rescaning.",4000)
ea.destroy();
return;
}
@@ -113,6 +119,7 @@ export default class Taskbone {
window.navigator.clipboard.writeText(text);
new Notice(`I placed the recognized text onto the system clipboard${addToFrontmatter?" and to document properties":""}.`);
}
ea.destroy();
}
private async getTextForImage(image: Blob):Promise<string> {
+52 -5
View File
@@ -2,18 +2,19 @@ import {
App,
ButtonComponent,
DropdownComponent,
getIcon,
normalizePath,
PluginSettingTab,
Setting,
TextComponent,
TFile,
} from "obsidian";
import { DEVICE, GITHUB_RELEASES, VIEW_TYPE_EXCALIDRAW } from "./constants/constants";
import { GITHUB_RELEASES, VIEW_TYPE_EXCALIDRAW } from "./constants/constants";
import ExcalidrawView from "./ExcalidrawView";
import { t } from "./lang/helpers";
import type ExcalidrawPlugin from "./main";
import { PenStyle } from "./PenTypes";
import { DynamicStyle } from "./types";
import { DynamicStyle } from "./types/types";
import { PreviewImageType } from "./utils/UtilTypes";
import { setDynamicStyle } from "./utils/DynamicStyling";
import {
@@ -36,6 +37,8 @@ import { ModifierKeySettingsComponent } from "./dialogs/ModifierKeySettings";
import { ANNOTATED_PREFIX, CROPPED_PREFIX } from "./utils/CarveOut";
import { EDITOR_FADEOUT } from "./CodeMirrorExtension/EditorHandler";
import { setDebugging } from "./utils/DebugHelper";
import { link } from "fs";
import { Rank } from "./menu/ActionIcons";
export interface ExcalidrawSettings {
folder: string;
@@ -47,6 +50,7 @@ export interface ExcalidrawSettings {
compress: boolean;
decompressForMDView: boolean;
onceOffCompressFlagReset: boolean; //used to reset compress to true in 2.2.0
onceOffGPTVersionReset: boolean; //used to reset GPT version in 2.2.11
autosave: boolean;
autosaveIntervalDesktop: number;
autosaveIntervalMobile: number;
@@ -196,6 +200,7 @@ export interface ExcalidrawSettings {
longPressDesktop: number;
longPressMobile: number;
isDebugMode: boolean;
rank: Rank;
}
declare const PLUGIN_VERSION:string;
@@ -210,6 +215,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
compress: true,
decompressForMDView: false,
onceOffCompressFlagReset: false,
onceOffGPTVersionReset: false,
autosave: true,
autosaveIntervalDesktop: 15000,
autosaveIntervalMobile: 10000,
@@ -360,7 +366,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
startupScriptPath: "",
openAIAPIToken: "",
openAIDefaultTextModel: "gpt-3.5-turbo-1106",
openAIDefaultVisionModel: "gpt-4-vision-preview",
openAIDefaultVisionModel: "gpt-4o",
openAIDefaultImageGenerationModel: "dall-e-3",
openAIURL: "https://api.openai.com/v1/chat/completions",
openAIImageGenerationURL: "https://api.openai.com/v1/images/generations",
@@ -451,6 +457,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
longPressDesktop: 500,
longPressMobile: 500,
isDebugMode: false,
rank: "Bronze",
};
export class ExcalidrawSettingTab extends PluginSettingTab {
@@ -539,6 +546,46 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
},
});
coffeeImg.height = 45;
const iconLinks = [
{
icon: `<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"><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>`,
href: "https://github.com/zsviczian/obsidian-excalidraw-plugin/issues",
aria: "Report bugs and raise feature requsts on the plugin's GitHub page",
text: "Bugs and Feature Requests",
},
{
icon: `<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"><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>`,
href: "https://www.youtube.com/@VisualPKM",
aria: "Check out my YouTube channel to learn about Visual Thinking and Excalidraw",
text: "Visual PKM on YouTube",
},
{
icon: `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="none" strokeWidth="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 640 512"><path d="M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"/></svg>`,
href: "https://discord.gg/DyfAXFwUHc",
aria: "Join the Visual Thinking Workshop Discord Server",
text: "Community on Discord",
},
{
icon: `<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"><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>`,
href: "https://twitter.com/zsviczian",
aria: "Follow me on Twitter",
text: "Follow me on Twitter",
},
{
icon: getIcon("graduation-cap").outerHTML,
href: "https://visual-thinking-workshop.com",
aria: "Learn about Visual PKM, Excalidraw, Obsidian, ExcaliBrain and more",
text: "Join the Visual Thinking Workshop",
}
];
const linksEl = containerEl.createDiv("setting-item-description excalidraw-settings-links-container");
iconLinks.forEach(({ icon, href, aria, text }) => {
linksEl.createEl("a",{href, attr: { "aria-label": aria }}, (a)=> {
a.innerHTML = icon + text;
});
});
// ------------------------------------------------
// Saving
@@ -2137,7 +2184,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
d.addOption("Assistant", "Assistant");
this.app.vault
.getFiles()
.filter((f) => ["ttf", "woff", "woff2"].contains(f.extension))
.filter((f) => ["ttf", "woff", "woff2", "otf"].contains(f.extension))
.forEach((f: TFile) => {
d.addOption(f.path, f.name);
});
@@ -2223,7 +2270,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
areaZoomText.innerText = ` ${value.toString()}`;
this.plugin.settings.areaZoomLimit = value;
this.applySettingsUpdate();
this.plugin.excalidrawConfig.updateValues();
this.plugin.excalidrawConfig.updateValues(this.plugin);
}),
)
.settingEl.createDiv("", (el) => {
+82 -81
View File
@@ -1,82 +1,83 @@
import { ExcalidrawAutomate } from "./ExcalidrawAutomate";
export type ConnectionPoint = "top" | "bottom" | "left" | "right" | null;
export type Packages = {
react: any,
reactDOM: any,
excalidrawLib: any,
}
export type ValueOf<T> = T[keyof T];
export type DynamicStyle = "none" | "gray" | "colorful";
export type DeviceType = {
isDesktop: boolean,
isPhone: boolean,
isTablet: boolean,
isMobile: boolean,
isLinux: boolean,
isMacOS: boolean,
isWindows: boolean,
isIOS: boolean,
isAndroid: boolean
};
declare global {
interface Window {
ExcalidrawAutomate: ExcalidrawAutomate;
}
}
declare module "obsidian" {
interface App {
internalPlugins: any;
isMobile(): boolean;
getObsidianUrl(file:TFile): string;
metadataTypeManager: {
setType(name:string, type:string): void;
};
}
interface Keymap {
getRootScope(): Scope;
}
interface Scope {
keys: any[];
}
interface Workspace {
on(
name: "hover-link",
callback: (e: MouseEvent) => any,
ctx?: any,
): EventRef;
}
interface DataAdapter {
url: {
pathToFileURL(path: string): URL;
},
basePath: string;
}
interface FoldPosition {
from: number;
to: number;
}
interface FoldInfo {
folds: FoldPosition[];
lines: number;
}
interface MarkdownSubView {
applyFoldInfo(foldInfo: FoldInfo): void;
getFoldInfo(): FoldInfo | null;
}
/*interface Editor {
insertText(data: string): void;
}*/
interface MetadataCache {
getBacklinksForFile(file: TFile): any;
getLinks(): { [id: string]: Array<{ link: string; displayText: string; original: string; position: any }> };
}
import { ExcalidrawAutomate } from "../ExcalidrawAutomate";
import { ExcalidrawLib } from "../ExcalidrawLib";
export type ConnectionPoint = "top" | "bottom" | "left" | "right" | null;
export type Packages = {
react: any,
reactDOM: any,
excalidrawLib: typeof ExcalidrawLib,
}
export type ValueOf<T> = T[keyof T];
export type DynamicStyle = "none" | "gray" | "colorful";
export type DeviceType = {
isDesktop: boolean,
isPhone: boolean,
isTablet: boolean,
isMobile: boolean,
isLinux: boolean,
isMacOS: boolean,
isWindows: boolean,
isIOS: boolean,
isAndroid: boolean
};
declare global {
interface Window {
ExcalidrawAutomate: ExcalidrawAutomate;
}
}
declare module "obsidian" {
interface App {
internalPlugins: any;
isMobile(): boolean;
getObsidianUrl(file:TFile): string;
metadataTypeManager: {
setType(name:string, type:string): void;
};
}
interface Keymap {
getRootScope(): Scope;
}
interface Scope {
keys: any[];
}
interface Workspace {
on(
name: "hover-link",
callback: (e: MouseEvent) => any,
ctx?: any,
): EventRef;
}
interface DataAdapter {
url: {
pathToFileURL(path: string): URL;
},
basePath: string;
}
interface FoldPosition {
from: number;
to: number;
}
interface FoldInfo {
folds: FoldPosition[];
lines: number;
}
interface MarkdownSubView {
applyFoldInfo(foldInfo: FoldInfo): void;
getFoldInfo(): FoldInfo | null;
}
/*interface Editor {
insertText(data: string): void;
}*/
interface MetadataCache {
getBacklinksForFile(file: TFile): any;
getLinks(): { [id: string]: Array<{ link: string; displayText: string; original: string; position: any }> };
}
}
+22 -3
View File
@@ -33,6 +33,7 @@ export interface ObsidianCanvasNode {
child: any;
isEditing: boolean;
file: TFile;
detach: Function;
}
export class CanvasNodeFactory {
@@ -41,6 +42,7 @@ export class CanvasNodeFactory {
nodes = new Map<string, ObsidianCanvasNode>();
initialized: boolean = false;
public isInitialized = () => this.initialized;
private observer: CustomMutationObserver | MutationObserver;
constructor(
private view: ExcalidrawView,
@@ -110,11 +112,11 @@ export class CanvasNodeFactory {
}
}
};
const observer = DEBUGGING
this.observer = DEBUGGING
? new CustomMutationObserver(nodeObserverFn, "CanvasNodeFactory")
: new MutationObserver(nodeObserverFn);
observer.observe(node.child.editor.containerEl.parentElement.parentElement, { attributes: true });
this.observer.observe(node.child.editor.containerEl.parentElement.parentElement, { attributes: true });
})();
}
@@ -127,12 +129,29 @@ export class CanvasNodeFactory {
node.child.showPreview();
}
removeNode(node: ObsidianCanvasNode) {
if(!this.initialized || !node) return;
this.nodes.delete(node.file.path);
this.canvas.removeNode(node);
node.detach();
}
public purgeNodes() {
if(!this.initialized) return;
this.nodes.forEach(node => {
this.canvas.removeNode(node);
this.canvas.removeNode(node);
node.detach();
});
this.nodes.clear();
}
destroy() {
this.purgeNodes();
this.initialized = false; //calling after purgeNodes becaues purge nodes checks for initialized
this.observer?.disconnect();
this.view = null;
this.canvas = null;
this.leaf = null;
}
}
+20 -42
View File
@@ -17,7 +17,10 @@ export const carveOutImage = async (sourceEA: ExcalidrawAutomate, viewImageEl: E
targetEA.copyViewElementsToEAforEditing([viewImageEl],true);
const {height, width} = await sourceEA.getOriginalImageSize(viewImageEl);
if(!height || !width || height === 0 || width === 0) return;
if(!height || !width || height === 0 || width === 0) {
targetEA.destroy();
return;
}
const newImage = targetEA.getElement(viewImageEl.id) as Mutable<ExcalidrawImageElement>;
newImage.x = 0;
@@ -47,7 +50,10 @@ export const carveOutImage = async (sourceEA: ExcalidrawAutomate, viewImageEl: E
const {folderpath, filename} = await getCropFileNameAndFolder(sourceEA.plugin,sourceEA.targetView.file.path,fname);
const file = await createImageCropperFile(targetEA, newImage.id, imageLink, folderpath, filename);
if(!file) return;
if(!file) {
targetEA.destroy();
return;
}
//console.log(await app.vault.read(file));
sourceEA.clear();
@@ -61,7 +67,8 @@ export const carveOutImage = async (sourceEA: ExcalidrawAutomate, viewImageEl: E
replacingImage.height = sourceImageEl.height;
replacingImage.scale = scale;
replacingImage.angle = angle;
sourceEA.addElementsToView(false, true, true);
await sourceEA.addElementsToView(false, true, true);
targetEA.destroy();
}
export const carveOutPDF = async (sourceEA: ExcalidrawAutomate, embeddableEl: ExcalidrawEmbeddableElement, pdfPathWithPage: string, pdfFile: TFile) => {
@@ -71,7 +78,10 @@ export const carveOutPDF = async (sourceEA: ExcalidrawAutomate, embeddableEl: Ex
let {height, width} = embeddableEl;
if(!height || !width || height === 0 || width === 0) return;
if(!height || !width || height === 0 || width === 0) {
targetEA.destroy();
return;
}
const imageId = await targetEA.addImage(0,0, pdfPathWithPage);
const newImage = targetEA.getElement(imageId) as Mutable<ExcalidrawImageElement>;
@@ -85,7 +95,10 @@ export const carveOutPDF = async (sourceEA: ExcalidrawAutomate, embeddableEl: Ex
const {folderpath, filename} = await getCropFileNameAndFolder(sourceEA.plugin,sourceEA.targetView.file.path,fname);
const file = await createImageCropperFile(targetEA, newImage.id, imageLink, folderpath, filename);
if(!file) return;
if(!file) {
targetEA.destroy();
return;
}
//console.log(await app.vault.read(file));
sourceEA.clear();
@@ -100,7 +113,8 @@ export const carveOutPDF = async (sourceEA: ExcalidrawAutomate, embeddableEl: Ex
replacingImage.width = replacingImage.height * imageAspectRatio;
}
replacingImage.angle = angle;
sourceEA.addElementsToView(false, true, true);
await sourceEA.addElementsToView(false, true, true);
targetEA.destroy();
}
@@ -169,41 +183,5 @@ export const createImageCropperFile = async (targetEA: ExcalidrawAutomate, image
return;
}
/*
//wait for the new ExcalidrawView to open and initialize
counter = 0;
let newView = workspace.getActiveViewOfType(ExcalidrawView) as ExcalidrawView;
while(
(workspace.getActiveFile() !== file ||
newView?.file !== file ||
!newView?.isLoaded ||
!Boolean(newView?.excalidrawAPI)) &&
counter < 100
) {
await sleep(100);
newView = workspace.getActiveViewOfType(ExcalidrawView) as ExcalidrawView;
counter++;
}
//console.log({counter});
if(newView?.file !== file || !newView?.isLoaded ||!Boolean(newView?.excalidrawAPI)) {
new Notice("View did not initialize. NewExcalidraw Drawing is taking too long to open. Please try again.");
return;
}
//wait for the image to load to the new view
const api = newView.excalidrawAPI as ExcalidrawImperativeAPI;
counter = 0;
while(Object.keys(api.getFiles()).length === 0 && counter < 100) {
await sleep(100);
counter++;
}
if(Object.keys(api.getFiles()).length === 0) {
new Notice("Image did not load to the view. NewExcalidraw Drawing is taking too long to load. Please try again.");
return;
}
*/
//console.log({counter, path: workspace.getActiveFile()?.path, newView, files: api.getFiles()});
return file;
}
+11 -3
View File
@@ -6,7 +6,6 @@ import { Notice } from "obsidian";
import { getEA } from "src";
import { ExcalidrawAutomate, cloneElement } from "src/ExcalidrawAutomate";
import { ExportSettings } from "src/ExcalidrawView";
import { embedFontsInSVG } from "./Utils";
import { nanoid } from "src/constants/constants";
export class CropImage {
@@ -45,6 +44,15 @@ export class CropImage {
})
}
public destroy() {
this.imageEA.destroy();
this.maskEA.destroy();
this.imageEA = null;
this.maskEA = null;
this.elements = null;
this.bbox = null;
}
private setBoundingEl(ea: ExcalidrawAutomate, bgColor: string) {
const {topX, topY, width, height} = this.bbox;
ea.style.backgroundColor = bgColor;
@@ -83,7 +91,7 @@ export class CropImage {
isMask: false,
}
const maskSVG = await this.maskEA.createSVG(null,false,exportSettings,null,null,0);
const maskSVG = await this.maskEA.createSVG(null,true,exportSettings,null,null,0);
const defs = maskSVG.querySelector("defs");
const styleEl = maskSVG.querySelector("style");
const style = styleEl ? styleEl.outerHTML : "";
@@ -129,7 +137,7 @@ export class CropImage {
async getCroppedPNG(): Promise<Blob> {
//@ts-ignore
const PLUGIN = app.plugins.plugins["obsidian-excalidraw-plugin"];
const svg = embedFontsInSVG(await this.buildSVG(), PLUGIN);
const svg = await this.buildSVG();
return new Promise((resolve, reject) => {
const svgData = new XMLSerializer().serializeToString(svg);
const canvas = document.createElement('canvas');
+23 -13
View File
@@ -2,7 +2,7 @@ import { ExcalidrawImperativeAPI } from "@zsviczian/excalidraw/types/excalidraw/
import { ColorMaster } from "colormaster";
import { ExcalidrawAutomate } from "src/ExcalidrawAutomate";
import ExcalidrawView from "src/ExcalidrawView";
import { DynamicStyle } from "src/types";
import { DynamicStyle } from "src/types/types";
import { cloneElement } from "src/ExcalidrawAutomate";
import { ExcalidrawFrameElement } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { addAppendUpdateCustomData } from "./Utils";
@@ -16,18 +16,16 @@ export const setDynamicStyle = (
) => {
if(dynamicStyle === "none") {
view.excalidrawContainer?.removeAttribute("style");
setTimeout(()=>view.updateScene({appState:{dynamicStyle: ""}}));
setTimeout(()=>view.updateScene({appState:{dynamicStyle: ""}, storeAction: "update"}));
const toolspanel = view.toolsPanelRef?.current?.containerRef?.current;
if(toolspanel) {
let toolsStyle = toolspanel.getAttribute("style");
toolsStyle = toolsStyle.replace(/\-\-color\-primary.*/,"");
toolspanel.setAttribute("style",toolsStyle);
}
return;
}
const doc = view.ownerDocument;
//const doc = view.ownerDocument;
const isLightTheme =
view?.excalidrawAPI?.getAppState?.()?.theme === "light" ||
view?.excalidrawData?.scene?.appState?.theme === "light";
@@ -129,9 +127,22 @@ export const setDynamicStyle = (
styleString
)*/
const toolspanel = view.toolsPanelRef?.current?.containerRef?.current;
if(toolspanel) {
let toolsStyle = toolspanel.getAttribute("style");
toolsStyle = toolsStyle.replace(/\-\-color\-primary.*/,"");
toolspanel.setAttribute("style",toolsStyle+styleString);
}
setTimeout(()=>{
const api = view.excalidrawAPI as ExcalidrawImperativeAPI;
if(!api) return;
if(!api) {
view = null;
ea = null;
color = null;
dynamicStyle = null;
return;
}
const frameColor = {
stroke: str(isDark?gray2().lighterBy(15):gray2().darkerBy(15)),
fill: str((isDark?gray2().lighterBy(30):gray2().darkerBy(30)).alphaTo(0.2)),
@@ -156,13 +167,12 @@ export const setDynamicStyle = (
appState:{
frameColor,
dynamicStyle: styleObject
}
},
storeAction: "update",
});
view = null;
ea = null;
color = null;
dynamicStyle = null;
});
const toolspanel = view.toolsPanelRef?.current?.containerRef?.current;
if(toolspanel) {
let toolsStyle = toolspanel.getAttribute("style");
toolsStyle = toolsStyle.replace(/\-\-color\-primary.*/,"");
toolspanel.setAttribute("style",toolsStyle+styleString);
}
}
+5 -5
View File
@@ -5,13 +5,13 @@ export class ExcalidrawConfig {
public areaLimit: number = 16777216;
public widthHeightLimit: number = 32767;
constructor(private plugin: ExcalidrawPlugin) {
this.updateValues();
constructor(plugin: ExcalidrawPlugin) {
this.updateValues(plugin);
}
updateValues() {
updateValues(plugin: ExcalidrawPlugin) {
if(DEVICE.isIOS) return;
this.areaLimit = 16777216*this.plugin.settings.areaZoomLimit; //this.plugin.settings.areaLimit;
this.widthHeightLimit = 32767*this.plugin.settings.areaZoomLimit; //his.plugin.settings.widthHeightLimit;
this.areaLimit = 16777216*plugin.settings.areaZoomLimit; //this.plugin.settings.areaLimit;
this.widthHeightLimit = 32767*plugin.settings.areaZoomLimit; //his.plugin.settings.widthHeightLimit;
}
}
+214 -16
View File
@@ -1,6 +1,6 @@
import { MAX_IMAGE_SIZE, IMAGE_TYPES, ANIMATED_IMAGE_TYPES, MD_EX_SECTIONS } from "src/constants/constants";
import { App, TFile } from "obsidian";
import { App, Notice, TFile, WorkspaceLeaf } from "obsidian";
import { ExcalidrawAutomate } from "src/ExcalidrawAutomate";
import { REGEX_LINK, REG_LINKINDEX_HYPERLINK, getExcalidrawMarkdownHeaderSection } from "src/ExcalidrawData";
import ExcalidrawView from "src/ExcalidrawView";
@@ -10,13 +10,15 @@ import { cleanSectionHeading } from "./ObsidianUtils";
import { getEA } from "src";
import { ExcalidrawImperativeAPI } from "@zsviczian/excalidraw/types/excalidraw/types";
import { EmbeddableMDCustomProps } from "src/dialogs/EmbeddableSettings";
import { nanoid } from "nanoid";
import { t } from "src/lang/helpers";
export const insertImageToView = async (
export async function insertImageToView(
ea: ExcalidrawAutomate,
position: { x: number, y: number },
file: TFile | string,
scale?: boolean,
):Promise<string> => {
):Promise<string> {
ea.clear();
ea.style.strokeColor = "transparent";
ea.style.backgroundColor = "transparent";
@@ -32,17 +34,17 @@ export const insertImageToView = async (
return id;
}
export const insertEmbeddableToView = async (
export async function insertEmbeddableToView (
ea: ExcalidrawAutomate,
position: { x: number, y: number },
file?: TFile,
link?: string,
):Promise<string> => {
):Promise<string> {
ea.clear();
ea.style.strokeColor = "transparent";
ea.style.backgroundColor = "transparent";
if(file && (IMAGE_TYPES.contains(file.extension) || ea.isExcalidrawFile(file)) && !ANIMATED_IMAGE_TYPES.contains(file.extension)) {
return await insertImageToView(ea, position, file);
return await insertImageToView(ea, position, link??file);
} else {
const id = ea.addEmbeddable(
position.x,
@@ -57,7 +59,7 @@ export const insertEmbeddableToView = async (
}
}
export const getLinkTextFromLink = (text: string): string => {
export function getLinkTextFromLink (text: string): string {
if (!text) return;
if (text.match(REG_LINKINDEX_HYPERLINK)) return;
@@ -70,7 +72,7 @@ export const getLinkTextFromLink = (text: string): string => {
return linktext;
}
export const openTagSearch = (link:string, app: App, view?: ExcalidrawView) => {
export function openTagSearch (link:string, app: App, view?: ExcalidrawView) {
const tags = link
.matchAll(/#([\p{Letter}\p{Emoji_Presentation}\p{Number}\/_-]+)/gu)
.next();
@@ -91,21 +93,70 @@ export const openTagSearch = (link:string, app: App, view?: ExcalidrawView) => {
return;
}
export const openExternalLink = (link:string, app: App, element?: ExcalidrawElement):boolean => {
function getLinkFromMarkdownLink(link: string): string {
const result = /^\[[^\]]*]\(([^\)]*)\)/.exec(link);
return result ? result[1] : link;
}
export function openExternalLink (link:string, app: App, element?: ExcalidrawElement):boolean {
link = getLinkFromMarkdownLink(link);
if (link.match(/^cmd:\/\/.*/)) {
const cmd = link.replace("cmd://", "");
//@ts-ignore
app.commands.executeCommandById(cmd);
return true;
}
if (link.match(REG_LINKINDEX_HYPERLINK)) {
window.open(link, "_blank");
if (!link.startsWith("obsidian://") && link.match(REG_LINKINDEX_HYPERLINK)) {
window.open(link, "_blank");
return true;
}
return false;
}
export const getExcalidrawFileForwardLinks = (app: App, excalidrawFile: TFile, secondOrderLinksSet: Set<string>):string => {
/**
*
* @param link
* @param app
* @param returnWikiLink
* @returns
* false if the link is not an obsidian link,
* true if the link is an obsidian link and it was opened (i.e. it is a link to another Vault or not a file link e.g. plugin link), or
* the link to the file path. By default as a wiki link, or as a file path if returnWikiLink is false.
*/
export function parseObsidianLink(link: string, app: App, returnWikiLink: boolean = true): boolean | string {
link = getLinkFromMarkdownLink(link);
if (!link.startsWith("obsidian://")) {
return false;
}
const url = new URL(link);
const action = url.pathname.slice(2); // Remove leading '//'
const props: {[key: string]: string} = {};
url.searchParams.forEach((value, key) => {
props[key] = decodeURIComponent(value);
});
if (action === "open" && props.vault === app.vault.getName()) {
const file = props.file;
const f = app.metadataCache.getFirstLinkpathDest(file, "");
if (f && f instanceof TFile) {
if (returnWikiLink) {
return `[[${f.path}]]`;
} else {
return f.path;
}
}
}
window.open(link, "_blank");
return true;
}
export function getExcalidrawFileForwardLinks (
app: App, excalidrawFile: TFile,
secondOrderLinksSet: Set<string>,
):string {
let secondOrderLinks = "";
const forwardLinks = app.metadataCache.getLinks()[excalidrawFile.path];
if(forwardLinks && forwardLinks.length > 0) {
@@ -124,7 +175,10 @@ export const getExcalidrawFileForwardLinks = (app: App, excalidrawFile: TFile, s
return secondOrderLinks;
}
export const getFrameBasedOnFrameNameOrId = (frameName: string, elements: ExcalidrawElement[]): ExcalidrawFrameElement | null => {
export function getFrameBasedOnFrameNameOrId(
frameName: string,
elements: ExcalidrawElement[],
): ExcalidrawFrameElement | null {
const frames = elements
.filter((el: ExcalidrawElement)=>el.type==="frame")
.map((el: ExcalidrawFrameElement, idx: number)=>{
@@ -135,7 +189,13 @@ export const getFrameBasedOnFrameNameOrId = (frameName: string, elements: Excali
return frames.length === 1 ? frames[0] : null;
}
export const addBackOfTheNoteCard = async (view: ExcalidrawView, title: string, activate: boolean = true, cardBody?: string, embeddableCustomData?: EmbeddableMDCustomProps):Promise<string> => {
export async function addBackOfTheNoteCard(
view: ExcalidrawView,
title: string,
activate: boolean = true,
cardBody?: string,
embeddableCustomData?: EmbeddableMDCustomProps,
):Promise<string> {
const data = view.data;
const header = getExcalidrawMarkdownHeaderSection(data);
const body = data.split(header)[1];
@@ -176,10 +236,148 @@ export const addBackOfTheNoteCard = async (view: ExcalidrawView, title: string,
const el = ea.getViewElements().find(el=>el.id === id);
api.selectElements([el]);
if(activate) {
setTimeout(()=>{
api.updateScene({appState: {activeEmbeddable: {element: el, state: "active"}}});
window.setTimeout(()=>{
api.updateScene({appState: {activeEmbeddable: {element: el, state: "active"}}, storeAction: "update"});
if(found) view.getEmbeddableLeafElementById(el.id)?.editNode?.();
});
}
ea.destroy();
return el.id;
}
export function renderContextMenuAction(
React: any,
label: string,
action: Function,
onClose: (callback?: () => void) => void,
) {
return React.createElement (
"li",
{
key: nanoid(),
onClick: () => {
onClose(()=>action())
},
},
React.createElement(
"button",
{
className: "context-menu-item",
},
React.createElement(
"div",
{
className: "context-menu-item__label",
},
label,
),
React.createElement(
"kbd",
{
className: "context-menu-item__shortcut",
},
"", //this is where the shortcut may go in the future
),
)
);
}
export function tmpBruteForceCleanup (view: ExcalidrawView) {
window.setTimeout(()=>{
if(!view) return;
// const cleanupHTMLElement = (el: Element) => {
// //console.log(el);
// while(el.firstElementChild) {
// cleanupHTMLElement(el.firstElementChild);
// el.removeChild(el.firstElementChild);
// }
// Object.keys(el).forEach((key) => {
// //@ts-ignore
// delete el[key];
// });
// el.empty();
// }
// const cleanupLeaf = (l:any) => {
// l.detach?.();
// l.resizeObserver?.disconnect?.();
// l.view?.unload?.();
// l.component?.unload?.();
// Object.keys(l).forEach((key) => {
// const obj = l[key];
// if (obj instanceof Element) {
// // Recursively empty the DOM element's children
// while (obj.firstChild) {
// cleanupHTMLElement(obj.firstElementChild);
// obj.removeChild(obj.firstElementChild);
// }
// obj.empty();
// delete l[key];
// return;
// }
// //@ts-ignore
// delete l[key];
// });
// }
// //@ts-ignore
// if(view.leaf && !view.leaf.parent) {
// if(view.containerEl) {
// cleanupHTMLElement(view.containerEl);
// }
// const leaves = new Set();
// leaves.add(view.leaf);
// while(leaves.has(view.leaf.getContainer())) {
// leaves.add(view.leaf.getContainer());
// }
// const roots = new Set();
// roots.add(view.leaf.getRoot());
// leaves.forEach((leaf:WorkspaceLeaf) => {
// roots.add(leaf.getRoot());
// });
// leaves.forEach((l:any) => cleanupLeaf(l));
// leaves.clear();
// roots.forEach((root:any) => cleanupLeaf(root));
// roots.clear();
// }
Object.keys(view).forEach((key) => {
//@ts-ignore
delete view[key];
});
}, 500);
}
/**
* Check if the text matches the transclusion pattern and if so,
* check if the link in the transclusion can be resolved to a file in the vault.
* if yes, call the callback function with the link and the file.
* @param text
* @param callback
* @returns true if text is a transclusion and the link can be resolved to a file in the vault, false otherwise.
*/
export function isTextImageTransclusion (
text: string,
view: ExcalidrawView,
callback: (link: string, file: TFile)=>void
): boolean {
const REG_TRANSCLUSION = /^!\[\[([^|\]]*)?.*?]]$|^!\[[^\]]*?]\((.*?)\)$/g;
const match = text.trim().matchAll(REG_TRANSCLUSION).next(); //reset the iterator
if(match?.value?.[0]) {
const link = match.value[1] ?? match.value[2];
const file = view.app.metadataCache.getFirstLinkpathDest(link?.split("#")[0], view.file.path);
if(view.file === file) {
new Notice(t("RECURSIVE_INSERT_ERROR"));
return false;
}
if(file && file instanceof TFile) {
if (file.extension !== "md" || view.plugin.isExcalidrawFile(file)) {
callback(link, file);
return true;
} else {
new Notice(t("USE_INSERT_FILE_MODAL"),5000);
}
}
}
return false;
}
+1
View File
@@ -11,6 +11,7 @@ import { getAttachmentsFolderAndFilePath } from "./ObsidianUtils";
/**
* Splits a full path including a folderpath and a filename into separate folderpath and filename components
* @param filepath
* @returns folderpath will be normalized. This means "/" for root folder and no trailing "/" for other folders
*/
type ImageExtension = keyof typeof IMAGE_MIME_TYPES;
+26 -4
View File
@@ -21,11 +21,13 @@ export type ImageKey = {
previewImageType: PreviewImageType;
scale: number;
isTransparent: boolean;
inlineFonts: boolean;
} & FILENAMEPARTS;
const getKey = (key: ImageKey): string =>
`${key.filepath}#${key.blockref??""}#${key.sectionref??""}#${key.isDark ? 1 : 0}#${
key.hasGroupref}#${key.hasArearef}#${key.hasFrameref}#${key.hasSectionref}#${
key.hasGroupref}#${key.hasArearef}#${key.hasFrameref}#${key.hasClippedFrameref}#${
key.hasSectionref}#${key.inlineFonts}#${
key.previewImageType === PreviewImageType.SVGIMG
? 1
: key.previewImageType === PreviewImageType.PNG
@@ -43,6 +45,19 @@ class ImageCache {
private app: App;
public initializationNotice: boolean = false;
private obsidanURLCache = new Map<string, string>();
private purgeInvalidCacheTimer: number = null;
private purgeInvalidBackupTimer: number = null;
public destroy(): void {
this.isInitializing = true;
if(this.purgeInvalidCacheTimer) clearTimeout(this.purgeInvalidCacheTimer);
if(this.purgeInvalidBackupTimer) clearTimeout(this.purgeInvalidBackupTimer);
this.db = null;
this.plugin = null;
this.app = null;
this.obsidanURLCache.clear();
this.obsidanURLCache = null;
}
constructor(dbName: string, cacheStoreName: string, backupStoreName: string) {
this.dbName = dbName;
@@ -129,8 +144,15 @@ class ImageCache {
});
}
setTimeout(async ()=>this.purgeInvalidCacheFiles(), 60000);
setTimeout(async ()=>this.purgeInvalidBackupFiles(), 120000);
this.purgeInvalidCacheTimer = window.setTimeout(async ()=>{
this.purgeInvalidCacheTimer = null;
this.purgeInvalidCacheFiles();
}, 60000);
this.purgeInvalidBackupTimer = window.setTimeout(async ()=>{
this.purgeInvalidBackupTimer = null;
this.purgeInvalidBackupFiles();
}, 120000);
} finally {
this.isInitializing = false;
if(this.initializationNotice) {
@@ -152,7 +174,7 @@ class ImageCache {
const cursor = (event.target as IDBRequest<IDBCursorWithValue | null>).result;
if(cursor) {
const key = cursor.key as string;
const isLegacyKey = key.replaceAll(/[^#]/g,"").length < 9; // introduced hasGroupref, etc. in 1.9.28
const isLegacyKey = key.split("#").length-1 < 12; // introduced hasGroupref, etc. in 1.9.28 // introduced hasClippedFrameref in 2.2.10 //introduced inlineFonts 2.2.11
const filepath = key.split("#")[0];
const fileExists = files.some((f: TFile) => f.path === filepath);
const file = fileExists ? files.find((f: TFile) => f.path === filepath) : null;
+9 -5
View File
@@ -1,14 +1,18 @@
import { ExcalidrawElement, ExcalidrawImageElement } from "@zsviczian/excalidraw/types/excalidraw/element/types";
import { requireApiVersion } from "obsidian";
export const getMermaidImageElements = (elements: ExcalidrawElement[]):ExcalidrawImageElement[] =>
elements
export function getMermaidImageElements (elements: ExcalidrawElement[]):ExcalidrawImageElement[] {
return elements
? elements.filter((element) =>
element.type === "image" && element.customData?.mermaidText
) as ExcalidrawImageElement[]
: [];
}
export const getMermaidText = (element: ExcalidrawElement):string =>
element.customData?.mermaidText;
export function getMermaidText (element: ExcalidrawElement):string {
return element.customData?.mermaidText;
}
export const shouldRenderMermaid = ():boolean => requireApiVersion("1.4.14");
export function shouldRenderMermaid():boolean {
return requireApiVersion("1.4.14");
}
+23 -5
View File
@@ -3,13 +3,14 @@ import {
Editor,
FrontMatterCache,
MarkdownView,
normalizePath, OpenViewState, parseFrontMatterEntry, TFile, View, Workspace, WorkspaceLeaf, WorkspaceSplit
normalizePath, OpenViewState, parseFrontMatterEntry, TFile, View, ViewState, Workspace, WorkspaceLeaf, WorkspaceSplit
} from "obsidian";
import ExcalidrawPlugin from "../main";
import { checkAndCreateFolder, splitFolderAndFilename } from "./FileUtils";
import { linkClickModifierType, ModifierKeys } from "./ModifierkeyHelper";
import { REG_BLOCK_REF_CLEAN, REG_SECTION_REF_CLEAN } from "src/constants/constants";
import { REG_BLOCK_REF_CLEAN, REG_SECTION_REF_CLEAN, VIEW_TYPE_EXCALIDRAW } from "src/constants/constants";
import yaml, { Mark } from "js-yaml";
import { debug, DEBUGGING } from "./DebugHelper";
export const getParentOfClass = (element: Element, cssClass: string):HTMLElement | null => {
let parent = element.parentElement;
@@ -300,7 +301,7 @@ export const openLeaf = ({
return {leaf, promise};
}
export const mergeMarkdownFiles = (template: string, target: string): string => {
export function mergeMarkdownFiles (template: string, target: string): string {
// Extract frontmatter from the template
const templateFrontmatterEnd = template.indexOf('---', 4); // Find end of frontmatter
const templateFrontmatter = template.substring(4, templateFrontmatterEnd).trim();
@@ -312,8 +313,8 @@ export const mergeMarkdownFiles = (template: string, target: string): string =>
// Extract frontmatter from the target if it exists
let targetFrontmatterObj: FrontMatterCache = {};
let targetContent = '';
if (target.includes('---')) {
const targetFrontmatterEnd = target.indexOf('---', 4); // Find end of frontmatter
if (target.startsWith('---\n') && target.indexOf('---\n', 4) > 0) {
const targetFrontmatterEnd = target.indexOf('---\n', 4); // Find end of frontmatter
const targetFrontmatter = target.substring(4, targetFrontmatterEnd).trim();
targetContent = target.substring(targetFrontmatterEnd + 3); // Skip frontmatter and ---
@@ -392,3 +393,20 @@ export const foldExcalidrawSection = (view: MarkdownView) => {
view.currentMode.applyFoldInfo({ folds: foldPositions, lines: lineCount });
}
};
export async function setExcalidrawView(leaf: WorkspaceLeaf) {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(setExcalidrawView,`setExcalidrawView`, leaf);
await leaf.setViewState({
type: VIEW_TYPE_EXCALIDRAW,
state: leaf.view.getState(),
popstate: true,
} as ViewState);
}
export async function closeLeafView(leaf: WorkspaceLeaf) {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(setExcalidrawView,`setExcalidrawView`, leaf);
await leaf.setViewState({
type: "empty",
state: {},
});
}
+55 -27
View File
@@ -3,7 +3,30 @@ import ExcalidrawPlugin from "src/main";
import { getAllWindowDocuments } from "./ObsidianUtils";
import { DEBUGGING, debug } from "./DebugHelper";
const STYLE_VARIABLES = ["--background-modifier-cover","--background-primary-alt","--background-secondary","--background-secondary-alt","--background-modifier-border","--text-normal","--text-muted","--text-accent","--text-accent-hover","--text-faint","--text-highlight-bg","--text-highlight-bg-active","--text-selection","--interactive-normal","--interactive-hover","--interactive-accent","--interactive-accent-hover","--scrollbar-bg","--scrollbar-thumb-bg","--scrollbar-active-thumb-bg"];
const STYLE_VARIABLES = [
"--background-modifier-cover",
"--background-primary-alt",
"--background-secondary",
"--background-secondary-alt",
"--background-modifier-border",
"--text-normal",
"--text-muted",
"--text-accent",
"--text-accent-hover",
"--text-faint",
"--text-highlight-bg",
"--text-highlight-bg-active",
"--text-selection",
"--interactive-normal",
"--interactive-hover",
"--interactive-accent",
"--interactive-accent-hover",
"--scrollbar-bg",
"--scrollbar-thumb-bg",
"--scrollbar-active-thumb-bg",
"--tab-container-background",
"--titlebar-background-focused",
];
const EXCALIDRAW_CONTAINER_CLASS = "excalidraw__embeddable__outer";
export class StylesManager {
@@ -14,47 +37,43 @@ export class StylesManager {
constructor(plugin: ExcalidrawPlugin) {
this.plugin = plugin;
const self = this;
plugin.app.workspace.onLayoutReady(async () => {
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(undefined, "StylesManager.constructor > app.workspace.onLayoutReady", self);
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(undefined, "StylesManager.constructor > app.workspace.onLayoutReady", this);
await this.harvestStyles();
getAllWindowDocuments(plugin.app).forEach(doc => {
this.copyPropertiesToTheme(doc);
})
getAllWindowDocuments(plugin.app).forEach(doc => this.copyPropertiesToTheme(doc));
//initialize
plugin.registerEvent(
plugin.app.workspace.on("css-change", async () => {
await this.harvestStyles();
getAllWindowDocuments(plugin.app).forEach(doc => {
this.copyPropertiesToTheme(doc);
})
}),
plugin.app.workspace.on("css-change", ()=>this.onCSSChange()),
)
plugin.registerEvent(
plugin.app.workspace.on("window-open", (win: WorkspaceWindow, window: Window) => {
this.stylesMap.set(win.doc, {
light: document.head.querySelector(`style[id="excalidraw-embedded-light"]`),
dark: document.head.querySelector(`style[id="excalidraw-embedded-dark"]`)
});
//this.copyPropertiesToTheme(win.doc);
}),
plugin.app.workspace.on("window-open", (win)=>this.onWindowOpen(win)),
)
plugin.registerEvent(
plugin.app.workspace.on("window-open", (win: WorkspaceWindow, window: Window) => {
this.stylesMap.delete(win.doc);
}),
plugin.app.workspace.on("window-close", (win)=>this.onWindowClose(win)),
)
});
}
public unload() {
for (const [doc, styleTags] of this.stylesMap) {
doc.head.removeChild(styleTags.light);
doc.head.removeChild(styleTags.dark);
}
private async onCSSChange () {
await this.harvestStyles();
getAllWindowDocuments(this.plugin.app).forEach(doc => {
this.copyPropertiesToTheme(doc);
})
}
private onWindowOpen (win: WorkspaceWindow) {
this.stylesMap.set(win.doc, {
light: document.head.querySelector(`style[id="excalidraw-embedded-light"]`),
dark: document.head.querySelector(`style[id="excalidraw-embedded-dark"]`)
});
//this.copyPropertiesToTheme(win.doc);
}
private onWindowClose (win: WorkspaceWindow) {
this.stylesMap.delete(win.doc);
}
private async harvestStyles() {
@@ -127,4 +146,13 @@ export class StylesManager {
this.stylesMap.set(doc, {light: lightStyleTag, dark: darkStyleTag});
}
}
public destroy() {
for (const [doc, styleTags] of this.stylesMap) {
doc.head.removeChild(styleTags.light);
doc.head.removeChild(styleTags.dark);
}
this.plugin = null;
}
}
+2 -1
View File
@@ -5,8 +5,9 @@ export type FILENAMEPARTS = {
hasTaskbone: boolean,
hasArearef: boolean,
hasFrameref: boolean,
blockref: string,
hasClippedFrameref: boolean,
hasSectionref: boolean,
blockref: string,
sectionref: string,
linkpartReference: string,
linkpartAlias: string
+164 -137
View File
@@ -1,18 +1,12 @@
import {
App,
Notice,
request,
requestUrl,
request,requestUrl,
TFile,
TFolder,
} from "obsidian";
import { Random } from "roughjs/bin/math";
import { BinaryFileData, DataURL} from "@zsviczian/excalidraw/types/excalidraw/types";
import {
ASSISTANT_FONT,
CASCADIA_FONT,
VIRGIL_FONT,
} from "src/constants/constFonts";
import {
exportToSvg,
exportToBlob,
@@ -33,7 +27,7 @@ import { Mutable } from "@zsviczian/excalidraw/types/excalidraw/utility-types";
import { cleanBlockRef, cleanSectionHeading, getFileCSSClasses } from "./ObsidianUtils";
import { updateElementLinksToObsidianLinks } from "src/ExcalidrawAutomate";
import { CropImage } from "./CropImage";
import opentype from 'opentype.js';
declare const PLUGIN_VERSION:string;
declare var LZString: any;
@@ -50,8 +44,9 @@ declare module "obsidian" {
}
}
export let versionUpdateCheckTimer: number = null;
let versionUpdateChecked = false;
export const checkExcalidrawVersion = async (app: App) => {
export async function checkExcalidrawVersion() {
if (versionUpdateChecked) {
return;
}
@@ -61,12 +56,13 @@ export const checkExcalidrawVersion = async (app: App) => {
const gitAPIrequest = async () => {
return JSON.parse(
await request({
url: `https://api.github.com/repos/zsviczian/obsidian-excalidraw-plugin/releases?per_page=5&page=1`,
url: `https://api.github.com/repos/zsviczian/obsidian-excalidraw-plugin/releases?per_page=15&page=1`,
}),
);
};
const latestVersion = (await gitAPIrequest())
.filter((el: any) => !el.draft && !el.prerelease)
.map((el: any) => {
return {
version: el.tag_name,
@@ -84,12 +80,17 @@ export const checkExcalidrawVersion = async (app: App) => {
} catch (e) {
errorlog({ where: "Utils/checkExcalidrawVersion", error: e });
}
setTimeout(() => (versionUpdateChecked = false), 28800000); //reset after 8 hours
versionUpdateCheckTimer = window.setTimeout(() => {
versionUpdateChecked = false;
versionUpdateCheckTimer = null;
}, 28800000); //reset after 8 hours
};
const random = new Random(Date.now());
export const randomInteger = () => Math.floor(random.next() * 2 ** 31);
export function randomInteger () {
return Math.floor(random.next() * 2 ** 31)
};
//https://macromates.com/blog/2006/wrapping-text-with-regular-expressions/
export function wrapTextAtCharLength(
@@ -154,44 +155,17 @@ const rotate = (
centerY,
];
export const rotatedDimensions = (
export function rotatedDimensions (
element: ExcalidrawElement,
): [number, number, number, number] => {
): [number, number, number, number] {
const bb = getCommonBoundingBox([element]);
return [bb.minX, bb.minY, bb.maxX - bb.minX, bb.maxY - bb.minY];
//removed with 2.1.5... will delete later
if (element.angle === 0) {
return [element.x, element.y, element.width, element.height];
}
const centerX = element.x + element.width / 2;
const centerY = element.y + element.height / 2;
const [left, top] = rotate(
element.x,
element.y,
centerX,
centerY,
element.angle,
);
const [right, bottom] = rotate(
element.x + element.width,
element.y + element.height,
centerX,
centerY,
element.angle,
);
return [
left < right ? left : right,
top < bottom ? top : bottom,
Math.abs(left - right),
Math.abs(top - bottom),
];
};
export const getDataURL = async (
export async function getDataURL(
file: ArrayBuffer,
mimeType: string,
): Promise<DataURL> => {
): Promise<DataURL> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
@@ -203,19 +177,47 @@ export const getDataURL = async (
});
};
export const getFontDataURL = async (
export async function getFontDataURL (
app: App,
fontFileName: string,
sourcePath: string,
name?: string,
): Promise<{ fontDef: string; fontName: string; dataURL: string }> => {
): Promise<{ fontDef: string; fontName: string; dataURL: string }> {
let fontDef: string = "";
let fontName = "";
let dataURL = "";
const f = app.metadataCache.getFirstLinkpathDest(fontFileName, sourcePath);
if (f) {
const ab = await app.vault.readBinary(f);
const mimeType = f.extension.startsWith("woff")
let mimeType = "";
let format = "";
switch (f.extension) {
case "woff":
mimeType = "application/font-woff";
format = "woff";
break;
case "woff2":
mimeType = "font/woff2";
format = "woff2";
break;
case "ttf":
mimeType = "font/ttf";
format = "truetype";
break;
case "otf":
mimeType = "font/otf";
format = "opentype";
break;
default:
mimeType = "application/octet-stream"; // Fallback if file type is unexpected
}
fontName = name ?? f.basename;
dataURL = await getDataURL(ab, mimeType);
const split = dataURL.split(";base64,", 2);
dataURL = `${split[0]};charset=utf-8;base64,${split[1]}`;
fontDef = ` @font-face {font-family: "${fontName}";src: url("${dataURL}") format("${format}")}`;
/* const mimeType = f.extension.startsWith("woff")
? "application/font-woff"
: "font/truetype";
fontName = name ?? f.basename;
@@ -223,23 +225,23 @@ export const getFontDataURL = async (
fontDef = ` @font-face {font-family: "${fontName}";src: url("${dataURL}")}`;
//format("${f.extension === "ttf" ? "truetype" : f.extension}");}`;
const split = fontDef.split(";base64,", 2);
fontDef = `${split[0]};charset=utf-8;base64,${split[1]}`;
fontDef = `${split[0]};charset=utf-8;base64,${split[1]}`;*/
}
return { fontDef, fontName, dataURL };
};
export const base64StringToBlob = (base64String: string, mimeType: string): Blob => {
export function base64StringToBlob (base64String: string, mimeType: string): Blob {
const buffer = Buffer.from(base64String, 'base64');
return new Blob([buffer], { type: mimeType });
};
export const svgToBase64 = (svg: string): string => {
export function svgToBase64 (svg: string): string {
return `data:image/svg+xml;base64,${btoa(
unescape(encodeURIComponent(svg.replaceAll("&nbsp;", " "))),
)}`;
};
export const getBinaryFileFromDataURL = async (dataURL: string): Promise<ArrayBuffer> => {
export async function getBinaryFileFromDataURL (dataURL: string): Promise<ArrayBuffer> {
if (!dataURL) {
return null;
}
@@ -262,12 +264,12 @@ export const getBinaryFileFromDataURL = async (dataURL: string): Promise<ArrayBu
return bytes.buffer;
};
export const getSVG = async (
export async function getSVG (
scene: any,
exportSettings: ExportSettings,
padding: number,
srcFile: TFile|null, //if set, will replace markdown links with obsidian links
): Promise<SVGSVGElement> => {
): Promise<SVGSVGElement> {
let elements:ExcalidrawElement[] = scene.elements;
if(elements.some(el => el.type === "embeddable")) {
elements = JSON.parse(JSON.stringify(elements));
@@ -288,20 +290,25 @@ export const getSVG = async (
if(exportSettings.isMask) {
const cropObject = new CropImage(elements, scene.files);
svg = await cropObject.getCroppedSVG();
cropObject.destroy();
} else {
svg = await exportToSvg({
elements: elements.filter((el:ExcalidrawElement)=>el.isDeleted !== true),
appState: {
...scene.appState,
exportBackground: exportSettings.withBackground,
exportWithDarkMode: exportSettings.withTheme
? scene.appState?.theme !== "light"
: false,
...scene.appState,
...exportSettings.frameRendering
? {frameRendering: exportSettings.frameRendering}
: {},
},
files: scene.files,
exportPadding: padding,
exportPadding: exportSettings.frameRendering ? 0 : padding,
exportingFrame: null,
renderEmbeddables: true,
skipInliningFonts: exportSettings.skipInliningFonts,
});
}
if(svg) {
@@ -329,29 +336,34 @@ export function filterFiles(files: Record<ExcalidrawElement["id"], BinaryFileDat
return filteredFiles;
}
export const getPNG = async (
export async function getPNG (
scene: any,
exportSettings: ExportSettings,
padding: number,
scale: number = 1,
): Promise<Blob> => {
): Promise<Blob> {
try {
if(exportSettings.isMask) {
const cropObject = new CropImage(scene.elements, scene.files);
return await cropObject.getCroppedPNG();
const blob = await cropObject.getCroppedPNG();
cropObject.destroy();
return blob;
}
return await exportToBlob({
elements: scene.elements.filter((el:ExcalidrawElement)=>el.isDeleted !== true),
appState: {
...scene.appState,
exportBackground: exportSettings.withBackground,
exportWithDarkMode: exportSettings.withTheme
? scene.appState?.theme !== "light"
: false,
...scene.appState,
...exportSettings.frameRendering
? {frameRendering: exportSettings.frameRendering}
: {},
},
files: filterFiles(scene.files),
exportPadding: padding,
exportPadding: exportSettings.frameRendering ? 0 : padding,
mimeType: "image/png",
getDimensions: (width: number, height: number) => ({
width: width * scale,
@@ -360,16 +372,17 @@ export const getPNG = async (
}),
});
} catch (error) {
new Notice("Error exporting PNG - PNG too large, try a smaller resolution");
errorlog({ where: "Utils.getPNG", error });
return null;
}
};
export const getQuickImagePreview = async (
export async function getQuickImagePreview (
plugin: ExcalidrawPlugin,
path: string,
extension: "png" | "svg",
): Promise<any> => {
): Promise<any> {
if (!plugin.settings.displayExportedImageIfAvailable) {
return null;
}
@@ -386,38 +399,10 @@ export const getQuickImagePreview = async (
}
};
export const embedFontsInSVG = (
svg: SVGSVGElement,
plugin: ExcalidrawPlugin,
localOnly: boolean = false,
): SVGSVGElement => {
//replace font references with base64 fonts)
const includesVirgil = !localOnly &&
svg.querySelector("text[font-family^='Virgil']") !== null;
const includesCascadia = !localOnly &&
svg.querySelector("text[font-family^='Cascadia']") !== null;
const includesAssistant = !localOnly &&
svg.querySelector("text[font-family^='Assistant']") !== null;
const includesLocalFont =
svg.querySelector("text[font-family^='LocalFont']") !== null;
const defs = svg.querySelector("defs");
if (defs && (includesCascadia || includesVirgil || includesLocalFont || includesAssistant)) {
let style = defs.querySelector("style");
if (!style) {
style = document.createElement("style");
defs.appendChild(style);
}
style.innerHTML = `${includesVirgil ? VIRGIL_FONT : ""}${
includesCascadia ? CASCADIA_FONT : ""}${
includesAssistant ? ASSISTANT_FONT : ""
}${includesLocalFont ? plugin.fourthFontDef : ""}`;
}
return svg;
};
export const getImageSize = async (
export async function getImageSize (
src: string,
): Promise<{ height: number; width: number }> => {
): Promise<{ height: number; width: number }> {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
@@ -429,7 +414,7 @@ export const getImageSize = async (
});
};
export const addAppendUpdateCustomData = (el: Mutable<ExcalidrawElement>, newData: any): ExcalidrawElement => {
export function addAppendUpdateCustomData (el: Mutable<ExcalidrawElement>, newData: any): ExcalidrawElement {
if(!newData) return el;
if(!el.customData) el.customData = {};
for (const key in newData) {
@@ -439,10 +424,10 @@ export const addAppendUpdateCustomData = (el: Mutable<ExcalidrawElement>, newDat
return el;
};
export const scaleLoadedImage = (
export function scaleLoadedImage (
scene: any,
files: any
): { dirty: boolean; scene: any } => {
): { dirty: boolean; scene: any } {
let dirty = false;
if (!files || !scene) {
return { dirty, scene };
@@ -491,7 +476,7 @@ export const scaleLoadedImage = (
return { dirty, scene };
};
export const setDocLeftHandedMode = (isLeftHanded: boolean, ownerDocument:Document) => {
export function setDocLeftHandedMode(isLeftHanded: boolean, ownerDocument:Document) {
const newStylesheet = ownerDocument.createElement("style");
newStylesheet.id = "excalidraw-left-handed";
newStylesheet.textContent = `.excalidraw .App-bottom-bar{justify-content:flex-end;}`;
@@ -504,7 +489,7 @@ export const setDocLeftHandedMode = (isLeftHanded: boolean, ownerDocument:Docume
}
}
export const setLeftHandedMode = (isLeftHanded: boolean) => {
export function setLeftHandedMode (isLeftHanded: boolean) {
const visitedDocs = new Set<Document>();
app.workspace.iterateAllLeaves((leaf) => {
const ownerDocument = DEVICE.isMobile?document:leaf.view.containerEl.ownerDocument;
@@ -525,7 +510,7 @@ export type LinkParts = {
page: number;
};
export const getLinkParts = (fname: string, file?: TFile): LinkParts => {
export function getLinkParts (fname: string, file?: TFile): LinkParts {
// 1 2 3 4 5
const REG = /(^[^#\|]*)#?(\^)?([^\|]*)?\|?(\d*)x?(\d*)/;
const parts = fname.match(REG);
@@ -543,18 +528,18 @@ export const getLinkParts = (fname: string, file?: TFile): LinkParts => {
};
};
export const compress = (data: string): string => {
export function compress (data: string): string {
return LZString.compressToBase64(data).replace(/(.{256})/g, "$1\n\n");
};
export const decompress = (data: string): string => {
export function decompress (data: string): string {
return LZString.decompressFromBase64(data.replaceAll("\n", "").replaceAll("\r", ""));
};
export const isMaskFile = (
export function isMaskFile (
plugin: ExcalidrawPlugin,
file: TFile,
): boolean => {
): boolean {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -568,10 +553,10 @@ export const isMaskFile = (
return false;
};
export const hasExportTheme = (
export function hasExportTheme (
plugin: ExcalidrawPlugin,
file: TFile,
): boolean => {
): boolean {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -585,11 +570,11 @@ export const hasExportTheme = (
return false;
};
export const getExportTheme = (
export function getExportTheme (
plugin: ExcalidrawPlugin,
file: TFile,
theme: string,
): string => {
): string {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -605,10 +590,10 @@ export const getExportTheme = (
return plugin.settings.exportWithTheme ? theme : "light";
};
export const shouldEmbedScene = (
export function shouldEmbedScene (
plugin: ExcalidrawPlugin,
file: TFile
): boolean => {
): boolean {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -622,10 +607,10 @@ export const shouldEmbedScene = (
return plugin.settings.exportEmbedScene;
};
export const hasExportBackground = (
export function hasExportBackground (
plugin: ExcalidrawPlugin,
file: TFile,
): boolean => {
): boolean {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -639,10 +624,10 @@ export const hasExportBackground = (
return false;
};
export const getWithBackground = (
export function getWithBackground (
plugin: ExcalidrawPlugin,
file: TFile,
): boolean => {
): boolean {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -656,10 +641,10 @@ export const getWithBackground = (
return plugin.settings.exportWithBackground;
};
export const getExportPadding = (
export function getExportPadding (
plugin: ExcalidrawPlugin,
file: TFile,
): number => {
): number {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if(!fileCache?.frontmatter) return plugin.settings.exportPaddingSVG;
@@ -693,7 +678,7 @@ export const getExportPadding = (
return plugin.settings.exportPaddingSVG;
};
export const getPNGScale = (plugin: ExcalidrawPlugin, file: TFile): number => {
export function getPNGScale (plugin: ExcalidrawPlugin, file: TFile): number {
if (file) {
const fileCache = plugin.app.metadataCache.getFileCache(file);
if (
@@ -712,7 +697,7 @@ export const getPNGScale = (plugin: ExcalidrawPlugin, file: TFile): number => {
return plugin.settings.pngExportScale;
};
export const isVersionNewerThanOther = (version: string, otherVersion: string): boolean => {
export function isVersionNewerThanOther (version: string, otherVersion: string): boolean {
const v = version.match(/(\d*)\.(\d*)\.(\d*)/);
const o = otherVersion.match(/(\d*)\.(\d*)\.(\d*)/);
@@ -727,9 +712,9 @@ export const isVersionNewerThanOther = (version: string, otherVersion: string):
)
}
export const getEmbeddedFilenameParts = (fname:string): FILENAMEPARTS => {
export function getEmbeddedFilenameParts (fname:string): FILENAMEPARTS {
// 0 1 23 4 5 6 7 8 9
const parts = fname?.match(/([^#\^]*)((#\^)(group=|area=|frame=|taskbone)?([^\|]*)|(#)(group=|area=|frame=|taskbone)?([^\^\|]*))(.*)/);
const parts = fname?.match(/([^#\^]*)((#\^)(group=|area=|frame=|clippedframe=|taskbone)?([^\|]*)|(#)(group=|area=|frame=|clippedframe=|taskbone)?([^\^\|]*))(.*)/);
if(!parts) {
return {
filepath: fname,
@@ -738,6 +723,7 @@ export const getEmbeddedFilenameParts = (fname:string): FILENAMEPARTS => {
hasTaskbone: false,
hasArearef: false,
hasFrameref: false,
hasClippedFrameref: false,
blockref: "",
hasSectionref: false,
sectionref: "",
@@ -752,6 +738,7 @@ export const getEmbeddedFilenameParts = (fname:string): FILENAMEPARTS => {
hasTaskbone: (parts[4]==="taskbone") || (parts[7]==="taskbone"),
hasArearef: (parts[4]==="area=") || (parts[7]==="area="),
hasFrameref: (parts[4]==="frame=") || (parts[7]==="frame="),
hasClippedFrameref: (parts[4]==="clippedframe=") || (parts[7]==="clippedframe="),
blockref: parts[5],
hasSectionref: Boolean(parts[6]),
sectionref: parts[8],
@@ -760,14 +747,17 @@ export const getEmbeddedFilenameParts = (fname:string): FILENAMEPARTS => {
}
}
export const fragWithHTML = (html: string) =>
createFragment((frag) => (frag.createDiv().innerHTML = html));
export function fragWithHTML (html: string) {
return createFragment((frag) => (frag.createDiv().innerHTML = html));
}
export const errorlog = (data: {}) => {
export function errorlog (data: {}) {
console.error({ plugin: "Excalidraw", ...data });
};
export const sleep = async (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
export async function sleep (ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
/**REACT 18
//see also: https://github.com/zsviczian/obsidian-excalidraw-plugin/commit/b67d70c5196f30e2968f9da919d106ee66f2a5eb
@@ -778,12 +768,12 @@ export const awaitNextAnimationFrame = async () => new Promise(requestAnimationF
//export const debug = function(){};
export const _getContainerElement = (
export function _getContainerElement (
element:
| (ExcalidrawElement & { containerId: ExcalidrawElement["id"] | null })
| null,
scene: any,
) => {
) {
if (!element || !scene?.elements || element.type !== "text") {
return null;
}
@@ -798,9 +788,9 @@ export const _getContainerElement = (
* Transforms array of objects containing `id` attribute,
* or array of ids (strings), into a Map, keyd by `id`.
*/
export const arrayToMap = <T extends { id: string } | string>(
export function arrayToMap <T extends { id: string } | string>(
items: readonly T[] | Map<string, T>,
) => {
) {
if (items instanceof Map) {
return items;
}
@@ -810,7 +800,7 @@ export const arrayToMap = <T extends { id: string } | string>(
}, new Map());
};
export const updateFrontmatterInString = (data:string, keyValuePairs?: [string,string][]):string => {
export function updateFrontmatterInString(data:string, keyValuePairs?: [string,string][]):string {
if(!data || !keyValuePairs) return data;
for(const kvp of keyValuePairs) {
const r = new RegExp(`${kvp[0]}:\\s.*\\n`,"g");
@@ -821,22 +811,27 @@ export const updateFrontmatterInString = (data:string, keyValuePairs?: [string,s
return data;
}
const isHyperLink = (link:string) => link && !link.includes("\n") && !link.includes("\r") && link.match(/^https?:(\d*)?\/\/[^\s]*$/);
function isHyperLink (link:string) {
return link && !link.includes("\n") && !link.includes("\r") && link.match(/^https?:(\d*)?\/\/[^\s]*$/);
}
export const isContainer = (el: ExcalidrawElement) => el.type!=="arrow" && el.boundElements?.map((e) => e.type).includes("text");
export function isContainer (el: ExcalidrawElement) {
return el.type!=="arrow" && el.boundElements?.map((e) => e.type).includes("text");
}
export const hyperlinkIsImage = (data: string):boolean => {
export function hyperlinkIsImage (data: string):boolean {
if(!isHyperLink(data)) false;
const corelink = data.split("?")[0];
return IMAGE_TYPES.contains(corelink.substring(corelink.lastIndexOf(".")+1));
}
export const hyperlinkIsYouTubeLink = (link:string): boolean =>
isHyperLink(link) &&
export function hyperlinkIsYouTubeLink (link:string): boolean {
return isHyperLink(link) &&
(link.startsWith("https://youtu.be") || link.startsWith("https://www.youtube.com") || link.startsWith("https://youtube.com") || link.startsWith("https//www.youtu.be")) &&
link.match(/(youtu.be\/|v=)([^?\/\&]*)/)!==null
}
export const getYouTubeThumbnailLink = async (youtubelink: string):Promise<string> => {
export async function getYouTubeThumbnailLink (youtubelink: string):Promise<string> {
//https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api
//https://youtu.be/z8UkHGpykYU?t=60
//https://www.youtube.com/watch?v=z8UkHGpykYU&ab_channel=VerbaltoVisual
@@ -860,7 +855,7 @@ export const getYouTubeThumbnailLink = async (youtubelink: string):Promise<strin
return `https://i.ytimg.com/vi/${videoId}/default.jpg`;
}
export const isCallerFromTemplaterPlugin = (stackTrace:string) => {
export function isCallerFromTemplaterPlugin (stackTrace:string) {
const lines = stackTrace.split("\n");
for (const line of lines) {
if (line.trim().startsWith("at Templater.")) {
@@ -870,7 +865,7 @@ export const isCallerFromTemplaterPlugin = (stackTrace:string) => {
return false;
}
export const convertSVGStringToElement = (svg: string): SVGSVGElement => {
export function convertSVGStringToElement (svg: string): SVGSVGElement {
const divElement = document.createElement("div");
divElement.innerHTML = svg;
const firstChild = divElement.firstChild;
@@ -880,9 +875,11 @@ export const convertSVGStringToElement = (svg: string): SVGSVGElement => {
return;
}
export const escapeRegExp = (str:string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
export function escapeRegExp (str:string) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
export const addIframe = (containerEl: HTMLElement, link:string, startAt?: number, style:string = "settings") => {
export function addIframe (containerEl: HTMLElement, link:string, startAt?: number, style:string = "settings") {
const wrapper = containerEl.createDiv({cls: `excalidraw-videoWrapper ${style}`})
wrapper.createEl("iframe", {
attr: {
@@ -894,4 +891,34 @@ export const addIframe = (containerEl: HTMLElement, link:string, startAt?: numbe
sandbox: "allow-forms allow-presentation allow-same-origin allow-scripts allow-modals",
},
});
}
}
export interface FontMetrics {
unitsPerEm: number;
ascender: number;
descender: number;
lineHeight: number;
fontName: string;
}
export async function getFontMetrics(fontUrl: string, name: string): Promise<FontMetrics | null> {
try {
const font = await opentype.load(fontUrl);
const unitsPerEm = font.unitsPerEm;
const ascender = font.ascender;
const descender = font.descender;
const lineHeight = (ascender - descender) / unitsPerEm;
const fontName = font.names.fontFamily.en ?? name;
return {
unitsPerEm,
ascender,
descender,
lineHeight,
fontName,
};
} catch (error) {
console.error('Error loading font:', error);
return null;
}
}
+29
View File
@@ -0,0 +1,29 @@
export class WeakArray<T extends object> {
private weakArray: WeakRef<T>[] = [];
constructor() {}
push(obj: T) {
this.weakArray.push(new WeakRef(obj));
}
forEach(callback: (obj: T, index: number) => void) {
this.weakArray.forEach((ref, index) => {
const obj = ref.deref();
if (obj) {
callback(obj, index);
}
});
}
removeObjects(objectsToRemove: Set<T>) {
this.weakArray = this.weakArray.filter((ref) => {
const obj = ref.deref();
return obj && !objectsToRemove.has(obj);
});
}
clear() {
this.weakArray = [];
}
}
+31
View File
@@ -594,4 +594,35 @@ root {
textarea.excalidraw-wysiwyg, .excalidraw input {
caret-color: var(--excalidraw-caret-color);
}
.excalidraw-settings-links-container {
display: flex; /* Align SVG and text horizontally */
align-items: center; /* Center SVG and text vertically */
text-decoration: none; /* Remove underline from links */
color: inherit; /* Inherit text color */
text-align: center;
}
.excalidraw-settings-links-container a {
display: flex; /* Align children horizontally */
align-items: center; /* Center items vertically */
text-align: left;
}
.excalidraw-settings-links-container svg {
margin-right: 8px;
height: 30px;
width: 30px;
}
.excalidraw-rank {
text-align: center;
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.excalidraw-rank svg {
height: 8rem;
width: 8rem;
}
+3 -3
View File
@@ -3,7 +3,7 @@
"baseUrl": ".",
"sourceMap": false,
"module": "ES2015",
"target": "es2017", //es2017 because script engine requires for async execution
"target": "es2018", //es2017 because script engine requires for async execution
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
@@ -18,11 +18,11 @@
"DOM.Iterable"
],
"jsx": "react",
"inlineSourceMap": true
"inlineSourceMap": true,
},
"include": [
"**/*.ts",
"**/*.tsx", "src/Dialogs/OpenDrawing.ts",
"src/types.d.ts"
"src/types/types.d.ts",
]
}
+4 -4
View File
@@ -3,7 +3,7 @@
"baseUrl": ".",
"sourceMap": false,
"module": "es2015",
"target": "es2017", //es2017 because script engine requires for async execution
"target": "es2018", //es2017 because script engine requires for async execution //es2018 for named capture groups
"allowJs": true,
"noImplicitAny": true,
"moduleResolution": "node",
@@ -14,14 +14,14 @@
"dom",
"scripthost",
"es2015",
"esnext",
"ESNext",
"DOM.Iterable"
],
"jsx": "react"
"jsx": "react",
},
"include": [
"**/*.ts",
"**/*.tsx", "src/Dialogs/OpenDrawing.ts",
"src/types.d.ts"
"src/types/types.d.ts",
]
}