mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
Compare commits
175
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
588dfc5dc2 | ||
|
|
cc18cf9166 | ||
|
|
5236a73a1e | ||
|
|
faa900a352 | ||
|
|
2ceebab04f | ||
|
|
497125d7cc | ||
|
|
4e8baed49f | ||
|
|
3f93be3b45 | ||
|
|
bb17694219 | ||
|
|
12bc2a1680 | ||
|
|
a1561de832 | ||
|
|
1900cfcf84 | ||
|
|
aa47d1375b | ||
|
|
61ae34968a | ||
|
|
296ac84f08 | ||
|
|
bcd63ad7fe | ||
|
|
1fec09c367 | ||
|
|
4cd5dde3d6 | ||
|
|
36ee7f6e52 | ||
|
|
32f76d4ea4 | ||
|
|
53aed86777 | ||
|
|
573587bd88 | ||
|
|
558d0105a5 | ||
|
|
76910a3352 | ||
|
|
e2c9e2b256 | ||
|
|
9630db68a4 | ||
|
|
7541fa22b4 | ||
|
|
c5cf6d630f | ||
|
|
2f296c7a46 | ||
|
|
095ff057cd | ||
|
|
b38956cb51 | ||
|
|
03392db757 | ||
|
|
2bd252fcff | ||
|
|
12b52e42f2 | ||
|
|
76675591fe | ||
|
|
966f6b53ea | ||
|
|
efbca80f74 | ||
|
|
ee8ac2f7ad | ||
|
|
0ac7ccde66 | ||
|
|
b5bd27f115 | ||
|
|
600b2d9621 | ||
|
|
c709562925 | ||
|
|
c3cfe0b0ed | ||
|
|
686ff92f4d | ||
|
|
37f3937bd6 | ||
|
|
16c61c44ce | ||
|
|
2f968a7bbc | ||
|
|
475492beda | ||
|
|
ab11258d0d | ||
|
|
1ab682e726 | ||
|
|
cb370645b7 | ||
|
|
c80420772e | ||
|
|
5fd76e07ba | ||
|
|
fda8d5ce77 | ||
|
|
2e52744743 | ||
|
|
a634d24f6b | ||
|
|
ebc0ecbfc4 | ||
|
|
9622e137ba | ||
|
|
b3bf3b5a60 | ||
|
|
cc1ae730d1 | ||
|
|
9841941431 | ||
|
|
f179b6720b | ||
|
|
b44d2a4a9a | ||
|
|
6a82011bdb | ||
|
|
c835943fc5 | ||
|
|
a4f0676686 | ||
|
|
e69487c456 | ||
|
|
e7a067d53a | ||
|
|
fe8ece275a | ||
|
|
a5f2da74ba | ||
|
|
ce602b8268 | ||
|
|
7bb718da81 | ||
|
|
cceb2cae82 | ||
|
|
f5f0134509 | ||
|
|
44588ab4b8 | ||
|
|
989e7969dc | ||
|
|
f5c7820315 | ||
|
|
c416c21985 | ||
|
|
e5f6466542 | ||
|
|
95ba981445 | ||
|
|
31cc45ff6d | ||
|
|
62f51511ed | ||
|
|
5c628e08f4 | ||
|
|
0e11150055 | ||
|
|
37b4cdd44a | ||
|
|
a2a33bc463 | ||
|
|
00531325ea | ||
|
|
a7d4d59619 | ||
|
|
b05e26d138 | ||
|
|
ce3cda7a1d | ||
|
|
ba5d1aa6d6 | ||
|
|
686f462716 | ||
|
|
21dec11170 | ||
|
|
168b1d1871 | ||
|
|
8df45aed14 | ||
|
|
2e9b5ce593 | ||
|
|
c332608bb5 | ||
|
|
ed9fe5f3d4 | ||
|
|
57afd6f134 | ||
|
|
63e0c1368f | ||
|
|
3b2f7d2c98 | ||
|
|
684d19eebd | ||
|
|
d65e967e4b | ||
|
|
59fe5abfa8 | ||
|
|
919913044d | ||
|
|
306e6db564 | ||
|
|
c32d0cb350 | ||
|
|
a43e527602 | ||
|
|
2e48ee8484 | ||
|
|
d568003915 | ||
|
|
247685b13f | ||
|
|
73c20e0d9d | ||
|
|
222ff139d8 | ||
|
|
0e0774d973 | ||
|
|
ae722623e5 | ||
|
|
65ab00a932 | ||
|
|
418063e9b6 | ||
|
|
b2f051e088 | ||
|
|
c884db0840 | ||
|
|
e4d1b509f7 | ||
|
|
97da7c680f | ||
|
|
5696a33e60 | ||
|
|
b68e8c0b20 | ||
|
|
3a43571f3e | ||
|
|
65c3a11fba | ||
|
|
010fd5c624 | ||
|
|
8ddf03cdd3 | ||
|
|
a5fd91a33c | ||
|
|
d8de0db423 | ||
|
|
b5d9fa4625 | ||
|
|
fcc0f94974 | ||
|
|
6b7d8c8b69 | ||
|
|
259e6277ed | ||
|
|
88405af417 | ||
|
|
8fecb75f97 | ||
|
|
bd1b13b58c | ||
|
|
d8cac4eacd | ||
|
|
8379f9315e | ||
|
|
123fa12122 | ||
|
|
46a41feaf3 | ||
|
|
a043ee131f | ||
|
|
7e9f1f6350 | ||
|
|
ffc209d4b0 | ||
|
|
c1ea206d9d | ||
|
|
4587d36997 | ||
|
|
4f4035b8ef | ||
|
|
de5da38474 | ||
|
|
27d30c609e | ||
|
|
9aaaf77daf | ||
|
|
ba0fac6f74 | ||
|
|
802e0f2dcd | ||
|
|
7bcb14b72f | ||
|
|
21ddc4b90f | ||
|
|
8035e489ca | ||
|
|
bf8ae6f8bb | ||
|
|
8b557a8461 | ||
|
|
35bc375356 | ||
|
|
09890d8890 | ||
|
|
5d8370234c | ||
|
|
e11664c826 | ||
|
|
fc33805fbe | ||
|
|
21f202a725 | ||
|
|
3e55719035 | ||
|
|
c5ca730946 | ||
|
|
537b01f461 | ||
|
|
428f2c50b6 | ||
|
|
b976a5d5e6 | ||
|
|
9221b8c475 | ||
|
|
6d659042ec | ||
|
|
37543c6a56 | ||
|
|
98f065c8cc | ||
|
|
a29d9cb7b1 | ||
|
|
2eef8d0151 | ||
|
|
f7676b4102 | ||
|
|
ff6da66f94 |
No files matched your search
@@ -11,7 +11,7 @@ body:
|
||||
|
||||
Before submitting a support request, please:
|
||||
1. **[Consult NotebookLM with your question](https://notebooklm.google.com/notebook/42d76a2f-c11d-4002-9286-1683c43d0ab0)**
|
||||
2. **Review the [documentation](https://github.com/zsviczian/obsidian-excalidraw-plugin/wiki)** – your question may already be answered.
|
||||
2. **Review the [documentation](https://excalidraw-obsidian.online/wiki/welcome)** – your question may already be answered.
|
||||
3. **[Search issues](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues) (including closed ones)** to see if your question has already been addressed.
|
||||
4. **[Watch the Feature Walkthrough Video](https://youtu.be/P_Q6avJGoWI)**: As it infact answers 90% of the typical questions I receive
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ data.json
|
||||
lib
|
||||
dist
|
||||
tmp
|
||||
deploy.ps1
|
||||
|
||||
#VSCode
|
||||
.vscode
|
||||
|
||||
Generated
+5
-5
@@ -9,7 +9,7 @@
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"mathjax-full": "^3.2.2",
|
||||
"nanoid": "^4.0.2"
|
||||
"nanoid": "^5.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^26.0.1",
|
||||
@@ -749,9 +749,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz",
|
||||
"integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==",
|
||||
"version": "5.0.9",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz",
|
||||
"integrity": "sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@@ -763,7 +763,7 @@
|
||||
"nanoid": "bin/nanoid.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14 || ^16 || >=18"
|
||||
"node": "^18 || >=20"
|
||||
}
|
||||
},
|
||||
"node_modules/obsidian": {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"mathjax-full": "^3.2.2",
|
||||
"nanoid": "^4.0.2"
|
||||
"nanoid": "^5.0.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^26.0.1",
|
||||
|
||||
@@ -14,7 +14,7 @@ Excalidraw for Obsidian keeps evolving; it is extremely feature‑rich and can f
|
||||
<a href="https://youtu.be/QKnQgSjJVuc" target="_blank"><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/thumbnail-getting-started.jpg" width="300"/></a>
|
||||
|
||||
### Here's my complete catalog of videos:
|
||||
<a href="https://excalidraw-obsidian.online/Hobbies/Excalidraw+Blog/Catalogue+of+Videos"><img width="380" alt="image" src="https://github.com/zsviczian/obsidian-excalidraw-plugin/assets/14358394/2577e5ad-7a21-4c62-acd5-4fe80c8a8a95"></a>
|
||||
<a href="https://excalidraw-obsidian.online/wiki/catalogue"><img width="380" alt="image" src="https://github.com/zsviczian/obsidian-excalidraw-plugin/assets/14358394/2577e5ad-7a21-4c62-acd5-4fe80c8a8a95"></a>
|
||||
<br>
|
||||
|
||||
<details><summary>10 Part (slightly outdated) Video Walkthrough</summary>
|
||||
@@ -227,7 +227,7 @@ For more details, see this [video](https://youtu.be/yZQoJg2RCKI)
|
||||
- `excalidraw-link-brackets: true|false` whether or not to display brackets around links in preview
|
||||
- `excalidraw-default-mode: view|zen` Open this document in view mode or zen mode by defult. The default view mode is excellent for presentation slides.
|
||||
- Frontmatter tags to customize image export at a file level [519](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/519). If these keys are present, they will override the default Excalidraw embed and export settings.
|
||||
- `excalidraw-export-transparent: true`: true == Transparent / false == with background.
|
||||
- `excalidraw-export-transparent: true`: true == Transparent / false == with background.
|
||||
- `excalidraw-export-dark`: true == Dark mode / false == light mode.
|
||||
- `excalidraw-export-padding`: Specify the export padding for the image.
|
||||
- `excalidraw-export-pngscale`: This only affects export to PNG. Specify the export scale for the image. The typical range is between 0.5 and 5, but you can experiment with other values as well.
|
||||
@@ -245,7 +245,7 @@ Drag the desired file from the Obsidian file explorer and hold down <kbd>SHIFT</
|
||||
- Open Obsidian Developer Console (<kbd>CTRL+Shift+i</kbd>/<kbd>CMD+OPT+i</kbd>) and
|
||||
- Execute the following command: `ExcalidrawAutomate.mostRecentMarkdownSVG`
|
||||
- You can control the appearance of the embedded markdown file on a file by file
|
||||
bases by adding the following front matter keys to your markdown document:
|
||||
bases by adding the following front matter keys to your markdown document:
|
||||
- `excalidraw-font: Virgil|Cascadia|font_file_name.extension`
|
||||
- `excalidraw-font-color: css-color-name|#HEXcolor|any-other-html-standard-format`,
|
||||
- You can find css color names [here](https://www.w3schools.com/colors/colors_names.asp).
|
||||
@@ -308,3 +308,4 @@ You can find me on Twitter [@zsviczian](https://twitter.com/zsviczian), and on m
|
||||
If you enjoy Excalidraw, consider giving [ExcaliBrain](https://github.com/zsviczian/excalibrain) a try (also available via Obsidian Community Plugins).
|
||||
|
||||
<a href="https://youtu.be/gOkniMkDPyM" target="_blank"><img src="https://user-images.githubusercontent.com/14358394/169708346-9e41289d-9536-43ec-8f70-2d2ad2d369d6.png" width="300"/></a>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,727 @@
|
||||
/*
|
||||
#exclude
|
||||
```js*/
|
||||
// -----------------------------
|
||||
// -----------------------------
|
||||
// Icon Library / Bases Search
|
||||
// -----------------------------
|
||||
// -----------------------------
|
||||
const IMAGE_LIBRARY_FOLDER = ea.obsidian.normalizePath("Assets/nosync");
|
||||
const IMAGE_LIBRARY_FILENAME = "Image Library.base"
|
||||
const ICONTYPES = [
|
||||
{name: "Icon", pattern: "icon"},
|
||||
{name: "Stickfigure", pattern: "stickfigure"},
|
||||
{name: "Logo", pattern: "logo"}
|
||||
];
|
||||
|
||||
const IMAGE_LIBRARY_PATH = ea.obsidian.normalizePath(IMAGE_LIBRARY_FOLDER + "/" + IMAGE_LIBRARY_FILENAME);
|
||||
async function initializeImageLibrary() {
|
||||
await ea.checkAndCreateFolder(IMAGE_LIBRARY_FOLDER);
|
||||
const syncPlugin = app.internalPlugins.plugins["sync"]?.instance;
|
||||
if(syncPlugin && !syncPlugin.ignoreFolders.includes(IMAGE_LIBRARY_FOLDER)) {
|
||||
syncPlugin.setIgnoreFolders(syncPlugin.ignoreFolders.concat(IMAGE_LIBRARY_FOLDER));
|
||||
}
|
||||
const imgLibFile = app.vault.getFileByPath(IMAGE_LIBRARY_PATH);
|
||||
if(!imgLibFile) {
|
||||
//The bases file is very sensitive to spaces, indents, and formatting
|
||||
//take care when modifying this
|
||||
const baseTemplate = `formulas:\n` +
|
||||
` Icon: image(file.path)\n` +
|
||||
` keywords: file.name.split(" - ")[1]\n` +
|
||||
` icon-path: link(if(file.ext == "md", "Assets/" + file.name.split(" - ")[0] + "s/" + file.name + ".svg", file.path))\n` +
|
||||
`views:\n` +
|
||||
` - type: cards\n` +
|
||||
` name: View\n` +
|
||||
` filters:\n` +
|
||||
` and:\n` +
|
||||
` - /^(icon|stickfigure|logo) \\- /i.matches(file.name.lower())\n` +
|
||||
` - '!file.path.startsWith("Assets/")'\n` +
|
||||
` - /./i.matches(formula.keywords)\n` +
|
||||
` order:\n` +
|
||||
` - formula.keywords\n` +
|
||||
` sort:\n` +
|
||||
` - property: formula.keywords\n` +
|
||||
` direction: ASC\n` +
|
||||
` cardSize: 130\n` +
|
||||
` imageFit: contain\n` +
|
||||
` image: formula.icon-path\n` +
|
||||
` imageAspectRatio: 0.8\n`;
|
||||
await app.vault.create(IMAGE_LIBRARY_PATH, baseTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
initializeImageLibrary();
|
||||
|
||||
async function revealIconLibrary() {
|
||||
const file = app.vault.getFileByPath(IMAGE_LIBRARY_PATH);
|
||||
if(!file) return;
|
||||
let leaf;
|
||||
app.workspace.iterateAllLeaves(l=>{
|
||||
if(leaf) return;
|
||||
if(l.view?.getViewType() === "bases" && l.view.getState().file === file.path) leaf = l;
|
||||
});
|
||||
if(leaf) {
|
||||
app.workspace.revealLeaf(leaf);
|
||||
return file;
|
||||
}
|
||||
|
||||
leaf = app.workspace.getRightLeaf();
|
||||
await leaf.openFile(file);
|
||||
app.workspace.revealLeaf(leaf);
|
||||
return file;
|
||||
}
|
||||
|
||||
if(ea.verifyMinimumPluginVersion("2.13.2")) {
|
||||
ea.plugin.addCommand({
|
||||
id: "base-filter-keywords",
|
||||
name: "Icon Library",
|
||||
icon: "images",
|
||||
callback: async () => {
|
||||
// Check if the active file is a .base file
|
||||
const file = await revealIconLibrary();
|
||||
if(!file) return false;
|
||||
|
||||
let baseContent = await app.vault.read(file);
|
||||
// Check if the file has the specific patterns for filtering
|
||||
if (!baseContent.includes(".matches(formula.keywords)")) return;
|
||||
|
||||
// Create a modal using Obsidian's Modal class
|
||||
const Modal = ea.FloatingModal;
|
||||
const modal = new Modal(app);
|
||||
const { contentEl } = modal;
|
||||
|
||||
contentEl.createEl("style", {
|
||||
text: `
|
||||
input[type="checkbox"]:focus-visible {
|
||||
outline: 2px solid ${app.getAccentColor()} !important;
|
||||
outline-offset: 2px !important;
|
||||
}
|
||||
`
|
||||
});
|
||||
|
||||
// Set title
|
||||
contentEl.createEl("h3", {
|
||||
text: "Icon Library"
|
||||
});
|
||||
|
||||
// ---------------------
|
||||
// Create keyword filter
|
||||
// ---------------------
|
||||
const inputContainer = contentEl.createDiv();
|
||||
inputContainer.style.margin = "20px 0";
|
||||
const input = contentEl.createEl("input", {
|
||||
type: "text",
|
||||
placeholder: "Enter filter term (leave empty for wildcard, you may use regular expression)",
|
||||
});
|
||||
input.style.width = "100%";
|
||||
input.style.padding = "8px";
|
||||
// Extract current keyword filter
|
||||
const keywordFilterRegex = /(- +)\/(.*?)\/i?\.matches\(formula\.keywords\)/;
|
||||
const keywordMatch = baseContent.match(keywordFilterRegex);
|
||||
if (keywordMatch && keywordMatch[2] && keywordMatch[2] !== ".") {
|
||||
input.value = keywordMatch[2];
|
||||
}
|
||||
// Set focus on the input
|
||||
setTimeout(() => input.focus(), 50);
|
||||
|
||||
// ------------------
|
||||
// Create toggle switches for file type filters
|
||||
// ------------------
|
||||
const toggleContainer = contentEl.createDiv();
|
||||
toggleContainer.style.margin = "20px 0";
|
||||
toggleContainer.style.display = "flex";
|
||||
toggleContainer.style.gap = "15px";
|
||||
toggleContainer.style.flexWrap = "wrap";
|
||||
// Get current filter pattern to determine initial toggle states
|
||||
const fileNameFilterRegex = /\/\^(.*?) \\- \/i?\.matches\(file\.name\.lower\(\)\)/;
|
||||
const match = baseContent.match(fileNameFilterRegex);
|
||||
let currentFilters = [];
|
||||
if (match && match[1]) {
|
||||
currentFilters = match[1].replace(/[\(\)]/g, '').split('|');
|
||||
}
|
||||
|
||||
// Create toggle function
|
||||
const createToggle = (label, value) => {
|
||||
const toggleWrapper = toggleContainer.createDiv();
|
||||
toggleWrapper.style.display = "flex";
|
||||
toggleWrapper.style.alignItems = "center";
|
||||
|
||||
const checkbox = toggleWrapper.createEl("input", {
|
||||
type: "checkbox",
|
||||
attr: { id: `toggle-${value}` }
|
||||
});
|
||||
checkbox.checked = currentFilters.includes(value);
|
||||
|
||||
const labelEl = toggleWrapper.createEl("label", {
|
||||
text: label,
|
||||
attr: { for: `toggle-${value}` }
|
||||
});
|
||||
labelEl.style.marginLeft = "5px";
|
||||
|
||||
return checkbox;
|
||||
};
|
||||
|
||||
// Create toggles dynamically based on ICONTYPES array
|
||||
const typeToggles = {};
|
||||
ICONTYPES.forEach(iconType => {
|
||||
typeToggles[iconType.pattern] = createToggle(iconType.name, iconType.pattern);
|
||||
});
|
||||
|
||||
// Function to apply the filter
|
||||
const applyFilter = async () => {
|
||||
// Get selected file types
|
||||
const selectedTypes = [];
|
||||
ICONTYPES.forEach(iconType => {
|
||||
if (typeToggles[iconType.pattern].checked) selectedTypes.push(iconType.pattern);
|
||||
});
|
||||
// Build file type filter pattern
|
||||
const fileTypePattern = selectedTypes.length > 0
|
||||
? `/^(${selectedTypes.join('|')}) \\- /i`
|
||||
: `/^() \\- /i`; // Empty pattern if none selected
|
||||
|
||||
// Get keyword filter
|
||||
const keywordTerm = input.value.trim() || ".";
|
||||
|
||||
// Update both filter patterns in the base file
|
||||
let updatedContent = baseContent;
|
||||
|
||||
// Update file name filter
|
||||
updatedContent = updatedContent.replace(
|
||||
/\/\^.*? \\\- \/i?\.matches\(file\.name\.lower\(\)\)/,
|
||||
`${fileTypePattern}.matches(file.name.lower())`
|
||||
);
|
||||
|
||||
// Update keyword filter
|
||||
updatedContent = updatedContent.replace(
|
||||
/(- +)\/.*\/i?\.matches\(formula\.keywords\)/g,
|
||||
`$1/${keywordTerm}/i.matches(formula.keywords)`
|
||||
);
|
||||
|
||||
// Save the updated file
|
||||
if (updatedContent !== baseContent) {
|
||||
await app.vault.modify(file, updatedContent);
|
||||
baseContent = updatedContent; // Update base content to prevent duplicate updates
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------
|
||||
// Add event listeners for input changes to apply filter immediately
|
||||
// -------------------
|
||||
contentEl.querySelectorAll("input").forEach(el => {
|
||||
el.addEventListener("input", applyFilter);
|
||||
});
|
||||
|
||||
// Handle Enter key in the input field
|
||||
contentEl.querySelectorAll("input").forEach(el => {
|
||||
el.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
modal.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
modal.open();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
new Notice("Icon Library not initialized. Please update to the latest Excalidraw Plugin version", 0);
|
||||
}
|
||||
|
||||
// -----------------
|
||||
// -----------------
|
||||
// Throttle Sync
|
||||
// -----------------
|
||||
// -----------------
|
||||
const sync = app.internalPlugins.plugins["sync"]?.instance
|
||||
|
||||
function throttleSync() {
|
||||
function setPause(newState) {
|
||||
if (newState && sync.getStatus() !== "synced") {
|
||||
setTimeout(() => setPause(true), 10000) //20 seconds
|
||||
return;
|
||||
}
|
||||
sync.setPause(newState);
|
||||
//console.log(`${moment().format("HH:mm:ss")} - ${sync.getStatus()}`);
|
||||
if (newState) {
|
||||
//unpause after 2 minutes
|
||||
setTimeout(() => setPause(false), 120000) //2 minutes
|
||||
} else {
|
||||
//pause after 20 seconds of sync
|
||||
setTimeout(() => setPause(true), 20000) //20 seconds
|
||||
}
|
||||
}
|
||||
|
||||
if (sync) {
|
||||
if (ea.DEVICE.isDesktop) {
|
||||
setPause(false);
|
||||
console.log("Sync throttle started");
|
||||
} else {
|
||||
sync.setPause(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sync) {
|
||||
sync.setPause(false);
|
||||
}
|
||||
//throttleSync();
|
||||
|
||||
// ----------------------
|
||||
// ----------------------
|
||||
// Move settings button
|
||||
// ----------------------
|
||||
// ----------------------
|
||||
try {
|
||||
if (ea.DEVICE.isDesktop) {
|
||||
const actions = document.querySelector(".workspace-drawer-vault-actions");
|
||||
actions.style.display = "none";
|
||||
const setting = actions.children[1];
|
||||
const header = document.querySelector(".workspace-tab-header-container");
|
||||
const toggle = document.querySelector(".sidebar-toggle-button.mod-left");
|
||||
header.appendChild(setting);
|
||||
if (header === toggle.parentElement) header.insertBefore(setting, toggle);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Excalidraw Startup Move Settings Button", e);
|
||||
}
|
||||
|
||||
// --------------
|
||||
// --------------
|
||||
// Debug logger
|
||||
// --------------
|
||||
// --------------
|
||||
window.logger = (label, values) => {
|
||||
if (!window.log) window.log = [];
|
||||
window.log.push({
|
||||
label,
|
||||
timestamp: performance.now(),
|
||||
stack: new Error().stack,
|
||||
values,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
window.printLog = () => {
|
||||
console.log(window.log.map(l => {
|
||||
return `${moment(l.timestamp).format("HH:mm:ss.SSS")} ${
|
||||
l.label}\n${l.stack.split("\n").slice(3).map(x=>x.trim()).join("\n")
|
||||
}\n------------------------`;
|
||||
}).join("\n"))
|
||||
}
|
||||
|
||||
if (window.electron) {
|
||||
const alignElectronSpellcheckWithObsidianSettings = () => {
|
||||
const session = window.electron.remote.getCurrentWebContents().session;
|
||||
session.setSpellCheckerEnabled(app.vault.config.spellcheck);
|
||||
if (app.vault.config.spellcheck) {
|
||||
session.setSpellCheckerLanguages(navigator.languages);
|
||||
}
|
||||
};
|
||||
|
||||
const body = document.body;
|
||||
const observer = new MutationObserver((mutationsList, observer) => {
|
||||
for (let mutation of mutationsList) {
|
||||
if (mutation.type === 'childList') {
|
||||
mutation.removedNodes.forEach(node => {
|
||||
if (node.classList && node.classList.contains('modal-container')) {
|
||||
alignElectronSpellcheckWithObsidianSettings();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
const config = {
|
||||
childList: true
|
||||
};
|
||||
observer.observe(body, config);
|
||||
alignElectronSpellcheckWithObsidianSettings();
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// ------------------------
|
||||
// Excalidraw Event Hooks
|
||||
// ------------------------
|
||||
// ------------------------
|
||||
/**
|
||||
* If set, this callback is triggered when the user closes an Excalidraw view.
|
||||
* onViewUnloadHook: (view: ExcalidrawView) => void = null;
|
||||
*/
|
||||
//ea.onViewUnloadHook = (view) => {};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered, when the user changes the view mode.
|
||||
* You can use this callback in case you want to do something additional when the user switches to view mode and back.
|
||||
* onViewModeChangeHook: (isViewModeEnabled:boolean, view: ExcalidrawView, ea: ExcalidrawAutomate) => void = null;
|
||||
*/
|
||||
//ea.onViewModeChangeHook = (isViewModeEnabled, view, ea) => {};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered, when the user hovers a link in the scene.
|
||||
* You can use this callback in case you want to do something additional when the onLinkHover event occurs.
|
||||
* This callback must return a boolean value.
|
||||
* In case you want to prevent the excalidraw onLinkHover action you must return false, it will stop the native excalidraw onLinkHover management flow.
|
||||
* onLinkHoverHook: (
|
||||
* element: NonDeletedExcalidrawElement,
|
||||
* linkText: string,
|
||||
* view: ExcalidrawView,
|
||||
* ea: ExcalidrawAutomate
|
||||
* ) => boolean = null;
|
||||
*/
|
||||
//ea.onLinkHoverHook = (element, linkText, view, ea) => {};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered, when the user clicks a link in the scene.
|
||||
* You can use this callback in case you want to do something additional when the onLinkClick event occurs.
|
||||
* This callback must return a boolean value.
|
||||
* In case you want to prevent the excalidraw onLinkClick action you must return false, it will stop the native excalidraw onLinkClick management flow.
|
||||
* onLinkClickHook:(
|
||||
* element: ExcalidrawElement,
|
||||
* linkText: string,
|
||||
* event: MouseEvent,
|
||||
* view: ExcalidrawView,
|
||||
* ea: ExcalidrawAutomate
|
||||
* ) => boolean = null;
|
||||
*/
|
||||
//ea.onLinkClickHook = (element,linkText,event, view, ea) => {};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered, when Excalidraw receives an onDrop event.
|
||||
* You can use this callback in case you want to do something additional when the onDrop event occurs.
|
||||
* This callback must return a boolean value.
|
||||
* In case you want to prevent the excalidraw onDrop action you must return false, it will stop the native excalidraw onDrop management flow.
|
||||
* onDropHook: (data: {
|
||||
* ea: ExcalidrawAutomate;
|
||||
* event: React.DragEvent<HTMLDivElement>;
|
||||
* draggable: any; //Obsidian draggable object
|
||||
* type: "file" | "text" | "unknown";
|
||||
* payload: {
|
||||
* files: TFile[]; //TFile[] array of dropped files
|
||||
* text: string; //string
|
||||
* };
|
||||
* excalidrawFile: TFile; //the file receiving the drop event
|
||||
* view: ExcalidrawView; //the excalidraw view receiving the drop
|
||||
* pointerPosition: { x: number; y: number }; //the pointer position on canvas at the time of drop
|
||||
* }) => boolean = null;
|
||||
*/
|
||||
ea.onDropHook = (data) => {
|
||||
const {view,draggable} = data;
|
||||
if(!draggable) return;
|
||||
|
||||
const {file, type} = draggable;
|
||||
if(!file || type !== "link") return;
|
||||
|
||||
const {extension} = file;
|
||||
if(!(
|
||||
data.ea.isExcalidrawFile(file) ||
|
||||
["jpeg", "jpg", "png", "gif", "svg", "webp", "bmp", "ico", "jtif", "tif", "jfif", "avif"].contains(extension)
|
||||
)) return;
|
||||
|
||||
const ea = data.ea.getAPI(view);
|
||||
const idBefore = new Set(ea.getViewElements().map(el=>el.id));
|
||||
|
||||
setTimeout(()=>{
|
||||
const newElements = ea.getViewElements().filter(el=>!idBefore.has(el.id));
|
||||
if(newElements.length !== 1 || newElements[0].type !== "image") return;
|
||||
|
||||
const f = ea.getViewFileForImageElement(newElements[0]);
|
||||
if(f !== file) return;
|
||||
|
||||
ea.copyViewElementsToEAforEditing(newElements);
|
||||
ea.getElements().forEach(el=>{
|
||||
const l = Math.max(el.width, el.height);
|
||||
el.width = Math.round(el.width * 180/l);
|
||||
el.height = Math.round(el.height * 180/l);
|
||||
});
|
||||
ea.addElementsToView();
|
||||
},100);
|
||||
}
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered, when Excalidraw receives an onPaste event.
|
||||
* You can use this callback in case you want to do something additional when the
|
||||
* onPaste event occurs.
|
||||
* This callback must return a boolean value.
|
||||
* In case you want to prevent the excalidraw onPaste action you must return false,
|
||||
* it will stop the native excalidraw onPaste management flow.
|
||||
* onPasteHook: (data: {
|
||||
* ea: ExcalidrawAutomate;
|
||||
* payload: ClipboardData;
|
||||
* event: ClipboardEvent;
|
||||
* excalidrawFile: TFile; //the file receiving the paste event
|
||||
* view: ExcalidrawView; //the excalidraw view receiving the paste
|
||||
* pointerPosition: { x: number; y: number }; //the pointer position on canvas
|
||||
* }) => boolean = null;
|
||||
*/
|
||||
ea.onPasteHook = (data) => {
|
||||
const {ea,payload} = data;
|
||||
if (payload?.elements) {
|
||||
payload.elements.filter(el => el.locked).forEach(el => {
|
||||
el.locked = false;
|
||||
});
|
||||
/* data.payload.elements
|
||||
.filter(el=>el.type==="text" && !el.hasOwnProperty("rawText"))
|
||||
.forEach(el=>el.rawText = el.originalText);*/
|
||||
}
|
||||
/*
|
||||
const getFileFromObsidianURL = (data) => {
|
||||
if(!data) return null;
|
||||
if(!data.startsWith("obsidian://")) return null;
|
||||
|
||||
try {
|
||||
const url = new URL(data);
|
||||
const fileParam = url.searchParams.get("file");
|
||||
if(!fileParam) return null;
|
||||
|
||||
return decodeURIComponent(fileParam);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if(payload.text) {
|
||||
link = getFileFromObsidianURL(payload.text);
|
||||
await ea.addImage(0,0,link);
|
||||
await ea.addElementsToView(true,true,true);
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* if set, this callback is triggered, when an Excalidraw file is opened
|
||||
* You can use this callback in case you want to do something additional when the file is opened.
|
||||
* This will run before the file level script defined in the `excalidraw-onload-script` frontmatter.
|
||||
* onFileOpenHook: (data: {
|
||||
* ea: ExcalidrawAutomate;
|
||||
* excalidrawFile: TFile; //the file being loaded
|
||||
* view: ExcalidrawView;
|
||||
* }) => Promise<void>;
|
||||
*/
|
||||
//ea.onFileOpenHook = (data) => {};
|
||||
|
||||
/**
|
||||
* if set, this callback is triggered, when an Excalidraw file is created
|
||||
* see also: https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1124
|
||||
* onFileCreateHook: (data: {
|
||||
* ea: ExcalidrawAutomate;
|
||||
* excalidrawFile: TFile; //the file being created
|
||||
* view: ExcalidrawView;
|
||||
* }) => Promise<void>;
|
||||
*/
|
||||
/*ea.onFileCreateHook = (data) => {
|
||||
app.fileManager.promptForFileRename(data.excalidrawFile);
|
||||
};*/
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered when a image is being saved in Excalidraw.
|
||||
* You can use this callback to customize the naming and path of pasted images to avoid
|
||||
* default names like "Pasted image 123147170.png" being saved in the attachments folder,
|
||||
* and instead use more meaningful names based on the Excalidraw file or other criteria,
|
||||
* plus save the image in a different folder.
|
||||
*
|
||||
* If the function returns null or undefined, the normal Excalidraw operation will continue
|
||||
* with the excalidraw generated name and default path.
|
||||
* If a filepath is returned, that will be used. Include the full Vault filepath and filename
|
||||
* with the file extension.
|
||||
* The currentImageName is the name of the image generated by excalidraw or provided during paste.
|
||||
*
|
||||
* @param data - An object containing the following properties:
|
||||
* @property {string} [currentImageName] - Default name for the image.
|
||||
* @property {string} drawingFilePath - The file path of the Excalidraw file where the image is being used.
|
||||
*
|
||||
* @returns {string} - The new filepath for the image including full vault path and extension.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* onImageFilePathHook: (data) => {
|
||||
* const { currentImageName, drawingFilePath } = data;
|
||||
* const ext = currentImageName.split('.').pop();
|
||||
* // Generate a new filepath based on the drawing file name and other criteria
|
||||
* return `${drawingFileName} - ${currentImageName || 'image'}.${ext}`;
|
||||
* }
|
||||
* ```
|
||||
* onImageFilePathHook: (data: {
|
||||
* currentImageName: string; // Excalidraw generated name of the image, or the name received from the file system.
|
||||
* drawingFilePath: string; // The full filepath of the Excalidraw file where the image is being used.
|
||||
* }) => string = null;
|
||||
*/
|
||||
// ea.onImageFilePathHook = (data) => { console.log(data); };
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered when the Excalidraw image is being exported to
|
||||
* .svg, .png, or .excalidraw.
|
||||
* You can use this callback to customize the naming and path of the images. This allows
|
||||
* you to place images into an assets folder.
|
||||
*
|
||||
* If the function returns null or undefined, the normal Excalidraw operation will continue
|
||||
* with the currentImageName and in the same folder as the Excalidraw file
|
||||
* If a filepath is returned, that will be used. Include the full Vault filepath and filename
|
||||
* with the file extension.
|
||||
* !!!! If an image already exists on the path, that will be overwritten. When returning
|
||||
* your own image path, you must take care of unique filenames (if that is a requirement) !!!!
|
||||
* The current image name is the name generated by Excalidraw:
|
||||
* - my-drawing.png
|
||||
* - my-drawing.svg
|
||||
* - my-drawing.excalidraw
|
||||
* - my-drawing.dark.svg
|
||||
* - my-drawing.light.svg
|
||||
* - my-drawing.dark.png
|
||||
* - my-drawing.light.png
|
||||
*
|
||||
* @param data - An object containing the following properties:
|
||||
* @property {string} exportFilepath - Default export filepath for the image.
|
||||
* @property {string} excalidrawFile - TFile: The Excalidraw file being exported.
|
||||
* @property {ExcalidrawAutomate} ea - The ExcalidrawAutomate instance associated with the hook.
|
||||
* @property {string} [oldExcalidrawPath] - If action === "move" The old path of the Excalidraw file, else undefined
|
||||
* @property {string} action - The action being performed: "export", "move", or "delete". move and delete reference the change to the Excalidraw file.
|
||||
*
|
||||
* @returns {string} - The new filepath for the image including full vault path and extension.
|
||||
*
|
||||
* action === "move" || action === "delete" is only possible if "keep in sync" is enabled
|
||||
* in plugin export settings
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* onImageFilePathHook: (data) => {
|
||||
* const { currentImageName, drawingFilePath, frontmatter } = data;
|
||||
* // Generate a new filepath based on the drawing file name and other criteria
|
||||
* const ext = currentImageName.split('.').pop();
|
||||
* if(frontmatter && frontmatter["my-custom-field"]) {
|
||||
* }
|
||||
* return `${drawingFileName} - ${currentImageName || 'image'}.${ext}`;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
ea.onImageExportPathHook = (data) => {
|
||||
//debugger; //remove comment to debug using Developer Console
|
||||
|
||||
let {
|
||||
excalidrawFile,
|
||||
exportFilepath,
|
||||
exportExtension,
|
||||
oldExcalidrawPath,
|
||||
action
|
||||
} = data;
|
||||
const frontmatter = app.metadataCache.getFileCache(excalidrawFile)?.frontmatter;
|
||||
//console.log(data, frontmatter);
|
||||
|
||||
const excalidrawFilename = action === "move" ?
|
||||
ea.splitFolderAndFilename(excalidrawFile.name).filename :
|
||||
excalidrawFile.name
|
||||
|
||||
if (excalidrawFilename.match(/^icon - /i)) {
|
||||
const {
|
||||
folderpath,
|
||||
filename,
|
||||
basename,
|
||||
extension
|
||||
} = ea.splitFolderAndFilename(exportFilepath);
|
||||
exportFilepath = "Assets/icons/" + filename;
|
||||
return exportFilepath;
|
||||
}
|
||||
|
||||
if (excalidrawFilename.match(/^stickfigure - /i)) {
|
||||
const {
|
||||
folderpath,
|
||||
filename,
|
||||
basename,
|
||||
extension
|
||||
} = ea.splitFolderAndFilename(exportFilepath);
|
||||
exportFilepath = "Assets/stickfigures/" + filename;
|
||||
return exportFilepath;
|
||||
}
|
||||
|
||||
if (excalidrawFilename.match(/^logo - /i)) {
|
||||
const {
|
||||
folderpath,
|
||||
filename,
|
||||
basename,
|
||||
extension
|
||||
} = ea.splitFolderAndFilename(exportFilepath);
|
||||
exportFilepath = "Assets/logos/" + filename;
|
||||
return exportFilepath;
|
||||
}
|
||||
|
||||
|
||||
// !!!! frontmatter will be undefined when action === "delete"
|
||||
// this means if you base your logic on frontmatter properties, then
|
||||
// plugin settings keep files in sync will break for those files when
|
||||
// deleting the Excalidraw file. The images will not be deleted, or worst
|
||||
// your logic might result in deleting other files. This hook gives you
|
||||
// powerful control, but the hook function logic requires careful testing
|
||||
// on your part.
|
||||
//if(frontmatter && frontmatter["is-asset"]) { //custom frontmatter property
|
||||
// exportFilepath = ea.obsidian.normalizePath("assets/" + exportFilepath);
|
||||
// return exportFilepath;
|
||||
//}
|
||||
|
||||
return exportFilepath;
|
||||
};
|
||||
|
||||
/**
|
||||
* Excalidraw supports auto-export of Excalidraw files to .png, .svg, and .excalidraw formats.
|
||||
*
|
||||
* Auto-export of Excalidraw files can be controlled at multiple levels.
|
||||
* 1) In plugin settings where you can set up default auto-export applicable to all your Excalidraw files.
|
||||
* 2) However, if you do not want to auto-export every file, you can also control auto-export
|
||||
* at the file level using the 'excalidraw-autoexport' frontmatter property.
|
||||
* 3) This hook gives you an additional layer of control over the auto-export process.
|
||||
*
|
||||
* This hook is triggered when an Excalidraw file is being saved.
|
||||
*
|
||||
* interface AutoexportConfig {
|
||||
* png: boolean; // Whether to auto-export to PNG
|
||||
* svg: boolean; // Whether to auto-export to SVG
|
||||
* excalidraw: boolean; // Whether to auto-export to Excalidraw format
|
||||
* theme: "light" | "dark" | "both"; // The theme to use for the export
|
||||
* }
|
||||
*
|
||||
* @param {Object} data - The data for the hook.
|
||||
* @param {AutoexportConfig} data.autoexportConfig - The current autoexport configuration.
|
||||
* @param {TFile} data.excalidrawFile - The Excalidraw file being auto-exported.
|
||||
* @returns {AutoexportConfig | null} - Return a modified AutoexportConfig to override the export behavior, or null to use the default.
|
||||
*/
|
||||
ea.onTriggerAutoexportHook = (data) => {
|
||||
let {
|
||||
autoexportConfig,
|
||||
excalidrawFile
|
||||
} = data;
|
||||
//const frontmatter = app.metadataCache.getFileCache(excalidrawFile)?.frontmatter;
|
||||
//console.log(data, frontmatter);
|
||||
//logic based on filepath and frontmatter
|
||||
|
||||
if (excalidrawFile.name.match(/^(?:icon|stickfigure|logo) - /i)) {
|
||||
autoexportConfig.theme = "light";
|
||||
autoexportConfig.svg = true;
|
||||
autoexportConfig.png = false;
|
||||
autoexportConfig.excalidraw = false;
|
||||
return autoexportConfig;
|
||||
}
|
||||
return autoexportConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered whenever the active canvas color changes
|
||||
* onCanvasColorChangeHook: (
|
||||
* ea: ExcalidrawAutomate,
|
||||
* view: ExcalidrawView, //the excalidraw view
|
||||
* color: string,
|
||||
* ) => void = null;
|
||||
*/
|
||||
//ea.onCanvasColorChangeHook = (ea, view, color) => {};
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered whenever a drawing is exported to SVG.
|
||||
* The string returned will replace the link in the exported SVG.
|
||||
* The hook is only executed if the link is to a file internal to Obsidian
|
||||
* see: https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1605
|
||||
* onUpdateElementLinkForExportHook: (data: {
|
||||
* originalLink: string,
|
||||
* obsidianLink: string,
|
||||
* linkedFile: TFile | null,
|
||||
* hostFile: TFile,
|
||||
* }) => string = null;
|
||||
*/
|
||||
//ea.onUpdateElementLinkForExportHook = (data) => {
|
||||
// const decodedObsidianURI = decodeURIComponent(data.obsidianLink);
|
||||
//};
|
||||
|
||||
@@ -3011,7 +3011,7 @@ Fix:
|
||||
- Transcluded text will now exclude ^block-references at end of lines
|
||||
- Phantom duplicates of the drawing appear when "zoom to fit" results in a zoom value below 10% and there are many objects on the canvas [#850](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/850)
|
||||
- CTRL+Wheel will increase/decrease zoom in steps of 5% matching the behavior of the "+" & "-" zoom buttons.
|
||||
- Latest updates from Excalidarw.com
|
||||
- Latest updates from Excalidraw.com
|
||||
- Freedraw flip not scaling correctly [#5752](https://github.com/excalidraw/excalidraw/pull/5752)
|
||||
- Multiple elements resizing regressions [#5586](https://github.com/excalidraw/excalidraw/pull/5586)
|
||||
|
||||
@@ -4339,7 +4339,7 @@ Fixed:
|
||||
|
||||
# 1.5.8
|
||||
|
||||
- minor fix to ExcalidarwAutomate addText to handle non-container bound text wrapping correctly.
|
||||
- minor fix to ExcalidrawAutomate addText to handle non-container bound text wrapping correctly.
|
||||
|
||||
# 1.5.7
|
||||
|
||||
|
||||
@@ -3011,7 +3011,7 @@ Fix:
|
||||
- Transcluded text will now exclude ^block-references at end of lines
|
||||
- Phantom duplicates of the drawing appear when "zoom to fit" results in a zoom value below 10% and there are many objects on the canvas [#850](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/850)
|
||||
- CTRL+Wheel will increase/decrease zoom in steps of 5% matching the behavior of the "+" & "-" zoom buttons.
|
||||
- Latest updates from Excalidarw.com
|
||||
- Latest updates from Excalidraw.com
|
||||
- Freedraw flip not scaling correctly [#5752](https://github.com/excalidraw/excalidraw/pull/5752)
|
||||
- Multiple elements resizing regressions [#5586](https://github.com/excalidraw/excalidraw/pull/5586)
|
||||
|
||||
@@ -4339,7 +4339,7 @@ Fixed:
|
||||
|
||||
# 1.5.8
|
||||
|
||||
- minor fix to ExcalidarwAutomate addText to handle non-container bound text wrapping correctly.
|
||||
- minor fix to ExcalidrawAutomate addText to handle non-container bound text wrapping correctly.
|
||||
|
||||
# 1.5.7
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ If you are enjoying the Excalidraw plugin then please support my work and enthus
|
||||
Jump ahead to the [[#List of available scripts]]
|
||||
|
||||
# Introducing Excalidraw Automate Script Engine
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/hePJcObHIso" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=hePJcObHIso" target="_blank"><img src ="https://i.ytimg.com/vi/hePJcObHIso/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
Script Engine scripts are installed in the `Downloaded` subfolder of the `Excalidraw Automate script folder` specified in plugin settings.
|
||||
|
||||
@@ -243,7 +244,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/OCR%20-%20Optical%20Character%20Recognition.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/OCR%20-%20Optical%20Character%20Recognition.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">REQUIRES EXCALIDRAW 1.5.15<br>The script will 1) send the selected image file to [taskbone.com](https://taskbone.com) to extract the text from the image, and 2) will add the text to your drawing as a text element.<br><mark>⚠ Note that you will need to manually paste your token into the script after the first run! ⚠</mark><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-ocr.jpg'><br><iframe width="560" height="315" src="https://www.youtube.com/embed/W2NMzR8s4eE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/OCR%20-%20Optical%20Character%20Recognition.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">REQUIRES EXCALIDRAW 1.5.15<br>The script will 1) send the selected image file to [taskbone.com](https://taskbone.com) to extract the text from the image, and 2) will add the text to your drawing as a text element.<br><mark>⚠ Note that you will need to manually paste your token into the script after the first run! ⚠</mark><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-ocr.jpg'><br><a href="https://www.youtube.com/watch?v=W2NMzR8s4eE" target="_blank"><img src ="https://i.ytimg.com/vi/W2NMzR8s4eE/maxresdefault.jpg" style="width:560px;"></a></td></tr></table>
|
||||
|
||||
## Organic Line
|
||||
```excalidraw-script-install
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
Select some elements in the scene. The script will take these elements and move them into a new Excalidraw file, and open that file. The selected elements will also be replaced in your original drawing with the embedded Excalidraw file (the one that was just created). You will be prompted for the file name of the new deconstructed image. The script is useful if you want to break a larger drawing into smaller reusable parts that you want to reference in multiple drawings.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/HRtaaD34Zzg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<a href="https://www.youtube.com/watch?v=HRtaaD34Zzg" target="_blank"><img src ="https://i.ytimg.com/vi/HRtaaD34Zzg/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/mvMQcz401yo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<a href="https://www.youtube.com/watch?v=mvMQcz401yo" target="_blank"><img src ="https://i.ytimg.com/vi/mvMQcz401yo/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
```javascript
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/A1vrSGBbWgo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=A1vrSGBbWgo" target="_blank"><img src ="https://i.ytimg.com/vi/A1vrSGBbWgo/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
|
||||

|
||||
```js*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/A1vrSGBbWgo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=A1vrSGBbWgo" target="_blank"><img src ="https://i.ytimg.com/vi/A1vrSGBbWgo/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||

|
||||
```js*/
|
||||
|
||||
@@ -6,8 +6,7 @@ The script performs two different functions depending on the elements selected i
|
||||

|
||||
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/2SHn_ruax-s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=2SHn_ruax-s" target="_blank"><img src ="https://i.ytimg.com/vi/2SHn_ruax-s/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
Gravitational point of spiral: $$\left[x,y\right]=\left[ x + \frac{{\text{width} \cdot \phi^2}}{{\phi^2 + 1}}\;, \; y + \frac{{\text{height} \cdot \phi^2}}{{\phi^2 + 1}} \right]$$
|
||||
Dimensions of inner rectangles in case of Double Spiral: $$[width, height] = \left[\frac{width\cdot(\phi^2+1)}{2\phi^2}\;, \;\frac{height\cdot(\phi^2+1)}{2\phi^2}\right]$$
|
||||
|
||||
+100
-44
@@ -1,65 +1,121 @@
|
||||
/*
|
||||

|
||||
|
||||
|
||||
|
||||
The script inverts the colors on the canvas including the color palette in Element Properties.
|
||||
|
||||
```javascript
|
||||
*/
|
||||
const defaultColorPalette = { // https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.8
|
||||
elementStroke:["#000000","#343a40","#495057","#c92a2a","#a61e4d","#862e9c","#5f3dc4","#364fc7","#1864ab","#0b7285","#087f5b","#2b8a3e","#5c940d","#e67700","#d9480f"],
|
||||
elementBackground:["transparent","#ced4da","#868e96","#fa5252","#e64980","#be4bdb","#7950f2","#4c6ef5","#228be6","#15aabf","#12b886","#40c057","#82c91e","#fab005","#fd7e14"],
|
||||
canvasBackground:["#ffffff","#f8f9fa","#f1f3f5","#fff5f5","#fff0f6","#f8f0fc","#f3f0ff","#edf2ff","#e7f5ff","#e3fafc","#e6fcf5","#ebfbee","#f4fce3","#fff9db","#fff4e6"]
|
||||
This script inverts all the colors in the current Excalidraw drawing. It applies the inversion to:
|
||||
1. The stroke and background colors of every element on the canvas.
|
||||
2. The main canvas background color.
|
||||
3. All colors within the user's custom color palette, handling all possible configurations (simple arrays, nested arrays, and objects).
|
||||
4. The currently selected stroke and background colors in the UI.
|
||||
|
||||
A default color palette is defined to use as a fallback if the current drawing's palette is missing or empty. // This is based on the standard Excalidraw palette from version [1.6.8.](https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.8)
|
||||
|
||||
You'll find a detailed description of the color palette data structure on the [Excalidraw-Obsidian Wiki](https://excalidraw-obsidian.online/wiki/color-palette)
|
||||
|
||||
```js*/
|
||||
const defaultColorPalette = {
|
||||
elementStroke: ["#000000", "#343a40", "#495057", "#c92a2a", "#a61e4d", "#862e9c", "#5f3dc4", "#364fc7", "#1864ab", "#0b7285", "#087f5b", "#2b8a3e", "#5c940d", "#e67700", "#d9480f"],
|
||||
elementBackground: ["transparent", "#ced4da", "#868e96", "#fa5252", "#e64980", "#be4bdb", "#7950f2", "#4c6ef5", "#228be6", "#15aabf", "#12b886", "#40c057", "#82c91e", "#fab005", "#fd7e14"],
|
||||
canvasBackground: ["#ffffff", "#f8f9fa", "#f1f3f5", "#fff5f5", "#fff0f6", "#f8f0fc", "#f3f0ff", "#edf2ff", "#e7f5ff", "#e3fafc", "#e6fcf5", "#ebfbee", "#f4fce3", "#fff9db", "#fff4e6"]
|
||||
};
|
||||
|
||||
// Get the Excalidraw API and the current application state.
|
||||
const api = ea.getExcalidrawAPI();
|
||||
const st = api.getAppState();
|
||||
|
||||
// Retrieve the current color palette, falling back to the default if necessary.
|
||||
let colorPalette = st.colorPalette ?? defaultColorPalette;
|
||||
if (Object.entries(colorPalette).length === 0) colorPalette = defaultColorPalette;
|
||||
if(!colorPalette.elementStroke || Object.entries(colorPalette.elementStroke).length === 0) colorPalette.elementStroke = defaultColorPalette.elementStroke;
|
||||
if(!colorPalette.elementBackground || Object.entries(colorPalette.elementBackground).length === 0) colorPalette.elementBackground = defaultColorPalette.elementBackground;
|
||||
if(!colorPalette.canvasBackground || Object.entries(colorPalette.canvasBackground).length === 0) colorPalette.canvasBackground = defaultColorPalette.canvasBackground;
|
||||
if (!colorPalette || Object.keys(colorPalette).length === 0) {
|
||||
colorPalette = defaultColorPalette;
|
||||
}
|
||||
// Ensure each key in the palette has a default value if it's missing.
|
||||
if (!colorPalette.elementStroke || colorPalette.elementStroke.length === 0) {
|
||||
colorPalette.elementStroke = defaultColorPalette.elementStroke;
|
||||
}
|
||||
if (!colorPalette.elementBackground || colorPalette.elementBackground.length === 0) {
|
||||
colorPalette.elementBackground = defaultColorPalette.elementBackground;
|
||||
}
|
||||
if (!colorPalette.canvasBackground || colorPalette.canvasBackground.length === 0) {
|
||||
colorPalette.canvasBackground = defaultColorPalette.canvasBackground;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inverts a single color string by reversing its lightness value.
|
||||
* This function uses the ColorMaster utility provided by Excalidraw Automate.
|
||||
* It correctly handles various color formats (HEX, RGB, HSL) and preserves transparency.
|
||||
* @param {string} color - The color to be inverted (e.g., "#FF0000").
|
||||
* @returns {string} The inverted color string.
|
||||
*/
|
||||
const invertColor = (color) => {
|
||||
if(color.toLowerCase()==="transparent") return color;
|
||||
const cm = ea.getCM(color);
|
||||
const lightness = cm.lightness;
|
||||
cm.lightnessTo(Math.abs(lightness-100));
|
||||
switch (cm.format) {
|
||||
case "hsl": return cm.stringHSL();
|
||||
case "rgb": return cm.stringRGB();
|
||||
case "hsv": return cm.stringHSV();
|
||||
default: return cm.stringHEX({alpha: false});
|
||||
}
|
||||
}
|
||||
|
||||
function invertColorsRecursively(obj) {
|
||||
if (typeof obj === 'string') {
|
||||
return invertColor(obj);
|
||||
} else if (Array.isArray(obj)) {
|
||||
return obj.map(item => invertColorsRecursively(item));
|
||||
} else if (typeof obj === 'object' && obj !== null) {
|
||||
const result = {};
|
||||
Object.keys(obj).forEach(key => result[key] = invertColorsRecursively(obj[key]));
|
||||
return result;
|
||||
} else {
|
||||
return obj;
|
||||
const cm = ea.getCM(color);
|
||||
const opts = cm.alpha !== 1 ? { alpha: true } : { alpha: false };
|
||||
const lightness = cm.lightness;
|
||||
cm.lightnessTo(Math.abs(lightness - 100)); // Invert lightness on a 0-100 scale.
|
||||
switch (cm.format) {
|
||||
case "hsl": return cm.stringHSL(opts);
|
||||
case "rgb": return cm.stringRGB(opts);
|
||||
case "hsv": return cm.stringHSV(opts);
|
||||
default: return cm.stringHEX(opts);
|
||||
}
|
||||
}
|
||||
colorPalette = invertColorsRecursively(colorPalette);
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively traverses a color palette data structure and inverts every color string found.
|
||||
* This robustly handles all valid `colorPalette` configurations, including nested arrays
|
||||
* (`string[][]`), simple arrays (`string[]`), and objects (`topPicks`).
|
||||
* @param {any} palette - A color string, an array of colors, an array of arrays, or an object palette.
|
||||
* @returns {any} A new palette structure with all colors inverted.
|
||||
*/
|
||||
const invertPaletteStructure = (palette) => {
|
||||
if (typeof palette === 'string') {
|
||||
// Base case: If the item is a color string, invert it.
|
||||
return invertColor(palette);
|
||||
}
|
||||
if (Array.isArray(palette)) {
|
||||
// If it's an array, recursively call this function for each item.
|
||||
return palette.map(item => invertPaletteStructure(item));
|
||||
}
|
||||
if (typeof palette === 'object' && palette !== null) {
|
||||
// If it's an object, create a new object and recursively process its values.
|
||||
const newPalette = {};
|
||||
for (const key in palette) {
|
||||
if (Object.prototype.hasOwnProperty.call(palette, key)) {
|
||||
newPalette[key] = invertPaletteStructure(palette[key]);
|
||||
}
|
||||
}
|
||||
return newPalette;
|
||||
}
|
||||
// Return any other data types (like numbers or null) unchanged.
|
||||
return palette;
|
||||
};
|
||||
|
||||
// Generate the new, fully inverted color palette.
|
||||
const invertedColorPalette = invertPaletteStructure(colorPalette);
|
||||
|
||||
// Load all elements from the current view into the Excalidraw Automate workbench for editing.
|
||||
ea.copyViewElementsToEAforEditing(ea.getViewElements());
|
||||
ea.getElements().forEach(el=>{
|
||||
el.strokeColor = invertColor(el.strokeColor);
|
||||
el.backgroundColor = invertColor(el.backgroundColor);
|
||||
|
||||
// Iterate over all elements and invert their stroke and background colors.
|
||||
ea.getElements().forEach(el => {
|
||||
if (el.strokeColor) {
|
||||
el.strokeColor = invertColor(el.strokeColor);
|
||||
}
|
||||
if (el.backgroundColor) {
|
||||
el.backgroundColor = invertColor(el.backgroundColor);
|
||||
}
|
||||
});
|
||||
|
||||
// Finally, update the Excalidraw scene with the inverted elements and application state.
|
||||
ea.viewUpdateScene({
|
||||
appState:{
|
||||
colorPalette,
|
||||
viewBackgroundColor: invertColor(st.viewBackgroundColor),
|
||||
currentItemStrokeColor: invertColor(st.currentItemStrokeColor),
|
||||
currentItemBackgroundColor: invertColor(st.currentItemBackgroundColor)
|
||||
appState: {
|
||||
colorPalette: invertedColorPalette,
|
||||
viewBackgroundColor: invertColor(st.viewBackgroundColor),
|
||||
currentItemStrokeColor: invertColor(st.currentItemStrokeColor),
|
||||
currentItemBackgroundColor: invertColor(st.currentItemBackgroundColor)
|
||||
},
|
||||
elements: ea.getElements()
|
||||
elements: ea.getElements(),
|
||||
storeAction: "capture" // Ensures the change is saved and added to the undo/redo history.
|
||||
});
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
|
||||
This script generates a linear (horizontal) calendar for a specified year, with days flowing left to right and months as rows.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
- Horizontal timeline layout with days of the week as columns
|
||||
- Month names displayed on both left and right sides
|
||||
- Weekend days (Saturday & Sunday) highlighted
|
||||
- Day-of-week headers at top and bottom
|
||||
|
||||
## Customizable Colors
|
||||
|
||||
You can personalize the calendar's appearance by defining your own colors:
|
||||
|
||||
1. Create two rectangles in your design.
|
||||
2. Select both rectangles before running the script:
|
||||
• The **fill and stroke colors of the first rectangle** will be applied to weekdays.
|
||||
• The **fill and stroke colors of the second rectangle** will be used for weekends.
|
||||
|
||||
If no rectangles are selected, the default color schema will be used (white and light blue-gray for weekends).
|
||||
|
||||
```javascript
|
||||
*/
|
||||
|
||||
// -------------------------------------
|
||||
// Constants initiation
|
||||
// -------------------------------------
|
||||
|
||||
const CELL_WIDTH = 176; // Width of each day cell
|
||||
const CELL_HEIGHT = 288; // Height of each day cell
|
||||
const START_X = 0; // X start position
|
||||
const START_Y = 0; // Y start position
|
||||
const ROW_SPACING = 32; // Space between month rows
|
||||
const MONTH_LABEL_WIDTH = 240; // Space for month labels on sides
|
||||
|
||||
// Colors
|
||||
let COLOR_WEEKEND = "#e8eaed";
|
||||
let COLOR_WEEKDAY = "#ffffff";
|
||||
let COLOR_TEXT = "#000000";
|
||||
let COLOR_WEEKEND_TEXT = "#000000";
|
||||
let COLOR_HEADER_TEXT = "#000000";
|
||||
const COLOR_STROKE = "#d0d4db";
|
||||
let STROKE_WIDTH = 1;
|
||||
let FILLSTYLE = "solid";
|
||||
const ROUGHNESS = 0; // 0 = Architect, 1 = Artist, 2 = Cartoonist
|
||||
const FONT_FAMILY = 3; // 1 = Virgil, 2 = Helvetica, 3 = Cascadia (code), 4 = Little One
|
||||
|
||||
// Font sizes
|
||||
const FONT_SIZE_DAY = 56;
|
||||
const FONT_SIZE_HEADER = 48;
|
||||
const FONT_SIZE_MONTH = 64;
|
||||
const FONT_SIZE_YEAR = 112;
|
||||
|
||||
// Day constants
|
||||
const SATURDAY = 6;
|
||||
const SUNDAY = 0;
|
||||
const JANUARY = 0;
|
||||
const FIRST_DAY_OF_THE_MONTH = 1;
|
||||
|
||||
// Day names (short)
|
||||
const DAY_NAMES = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
||||
|
||||
// Month names (short)
|
||||
const MONTH_NAMES = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
|
||||
// Number of day columns needed (max 37 to cover all possible month alignments: 6 days offset + 31 days)
|
||||
const NUM_COLUMNS = 37;
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
// Ask for requested Year
|
||||
let requestedYear = parseFloat(new Date().getFullYear());
|
||||
requestedYear = parseFloat(await utils.inputPrompt("Year?", requestedYear, requestedYear));
|
||||
if (isNaN(requestedYear)) {
|
||||
new Notice("Invalid number");
|
||||
return;
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Use selected elements for calendar style
|
||||
// -------------------------------------
|
||||
|
||||
let elements = ea.getViewSelectedElements();
|
||||
if (elements.length >= 1) {
|
||||
COLOR_WEEKDAY = elements[0].backgroundColor;
|
||||
FILLSTYLE = elements[0].fillStyle;
|
||||
STROKE_WIDTH = elements[0].strokeWidth;
|
||||
}
|
||||
if (elements.length >= 2) {
|
||||
COLOR_WEEKEND = elements[1].backgroundColor;
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Helper function to get days in a month
|
||||
// -------------------------------------
|
||||
|
||||
function getDaysInMonth(year, month) {
|
||||
return new Date(year, month + 1, 0).getDate();
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Helper function to get the day of week for first day of month
|
||||
// -------------------------------------
|
||||
|
||||
function getFirstDayOfMonth(year, month) {
|
||||
return new Date(year, month, 1).getDay();
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Draw day-of-week headers
|
||||
// -------------------------------------
|
||||
|
||||
function drawDayHeaders(yPosition) {
|
||||
ea.style.fontSize = FONT_SIZE_HEADER;
|
||||
ea.style.strokeColor = COLOR_TEXT;
|
||||
ea.style.fontFamily = FONT_FAMILY;
|
||||
|
||||
for (let col = 0; col < NUM_COLUMNS; col++) {
|
||||
const dayIndex = col % 7;
|
||||
const x = START_X + MONTH_LABEL_WIDTH + (col * CELL_WIDTH);
|
||||
|
||||
// Center the text in the cell (approximate width of 2 chars)
|
||||
const textX = x + (CELL_WIDTH / 2) - (FONT_SIZE_HEADER * 0.6);
|
||||
ea.addText(textX, yPosition, DAY_NAMES[dayIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Draw month row
|
||||
// -------------------------------------
|
||||
|
||||
function drawMonthRow(year, month, rowIndex) {
|
||||
const daysInMonth = getDaysInMonth(year, month);
|
||||
const firstDayOfWeek = getFirstDayOfMonth(year, month);
|
||||
const y = START_Y + 160 + (rowIndex * (CELL_HEIGHT + ROW_SPACING));
|
||||
|
||||
// Draw month label on the left
|
||||
ea.style.fontSize = FONT_SIZE_MONTH;
|
||||
ea.style.strokeColor = COLOR_TEXT;
|
||||
ea.style.fontFamily = FONT_FAMILY;
|
||||
const monthLabelY = y + (CELL_HEIGHT / 2) - (FONT_SIZE_MONTH / 2);
|
||||
ea.addText(START_X, monthLabelY, MONTH_NAMES[month]);
|
||||
|
||||
// Draw day cells
|
||||
for (let day = 1; day <= daysInMonth; day++) {
|
||||
const date = new Date(year, month, day);
|
||||
const dayOfWeek = date.getDay();
|
||||
const col = firstDayOfWeek + day - 1; // Column position based on day of week alignment
|
||||
|
||||
const x = START_X + MONTH_LABEL_WIDTH + (col * CELL_WIDTH);
|
||||
const isWeekend = dayOfWeek === SATURDAY || dayOfWeek === SUNDAY;
|
||||
|
||||
// Set cell style
|
||||
ea.style.backgroundColor = isWeekend ? COLOR_WEEKEND : COLOR_WEEKDAY;
|
||||
ea.style.strokeColor = COLOR_STROKE;
|
||||
ea.style.strokeWidth = STROKE_WIDTH;
|
||||
ea.style.fillStyle = FILLSTYLE;
|
||||
ea.style.roughness = ROUGHNESS;
|
||||
|
||||
// Draw cell rectangle
|
||||
ea.addRect(x, y, CELL_WIDTH, CELL_HEIGHT);
|
||||
|
||||
// Draw day number
|
||||
ea.style.fontSize = FONT_SIZE_DAY;
|
||||
ea.style.strokeColor = COLOR_TEXT;
|
||||
ea.style.fontFamily = FONT_FAMILY;
|
||||
|
||||
// Position the day number at top center of the cell
|
||||
const dayStr = String(day).padStart(2, "0");
|
||||
const charWidth = FONT_SIZE_DAY * 0.6; // Approximate character width
|
||||
const textWidth = dayStr.length * charWidth;
|
||||
const textX = x + (CELL_WIDTH - textWidth) / 2;
|
||||
const textY = y + 32; // 32px padding from top
|
||||
ea.addText(textX, textY, dayStr);
|
||||
}
|
||||
|
||||
// Draw month label on the right
|
||||
ea.style.fontSize = FONT_SIZE_MONTH;
|
||||
ea.style.strokeColor = COLOR_TEXT;
|
||||
const rightLabelX = START_X + MONTH_LABEL_WIDTH + (NUM_COLUMNS * CELL_WIDTH) + 60;
|
||||
ea.addText(rightLabelX, monthLabelY, MONTH_NAMES[month]);
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
// Main calendar generation
|
||||
// -------------------------------------
|
||||
|
||||
// Draw year title (centered above calendar)
|
||||
ea.style.fontSize = FONT_SIZE_YEAR;
|
||||
ea.style.strokeColor = COLOR_TEXT;
|
||||
ea.style.fontFamily = FONT_FAMILY;
|
||||
const yearX = START_X + MONTH_LABEL_WIDTH + ((NUM_COLUMNS * CELL_WIDTH) / 2) - 120;
|
||||
ea.addText(yearX, START_Y - 200, String(requestedYear));
|
||||
|
||||
// Draw top day-of-week headers
|
||||
drawDayHeaders(START_Y);
|
||||
|
||||
// Draw all 12 months
|
||||
for (let month = 0; month < 12; month++) {
|
||||
drawMonthRow(requestedYear, month, month);
|
||||
}
|
||||
|
||||
// Draw bottom day-of-week headers
|
||||
const bottomHeaderY = START_Y + 160 + (12 * (CELL_HEIGHT + ROW_SPACING)) + 40;
|
||||
drawDayHeaders(bottomHeaderY);
|
||||
|
||||
await ea.addElementsToView(false, false, true);
|
||||
@@ -0,0 +1,24 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50.097575068473816 56.100231877975375" width="50.097575068473816" height="56.100231877975375" class="excalidraw-svg">
|
||||
<!-- Linear calendar icon (same size/viewBox as original) -->
|
||||
|
||||
<g stroke="#1e1e1e" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none">
|
||||
<!-- Binding rings -->
|
||||
<path d="M16 3 L16 12" />
|
||||
<path d="M34.5 3 L34.5 12" />
|
||||
|
||||
<!-- Outer calendar body -->
|
||||
<rect x="4" y="9" width="42.097575068473816" height="44.100231877975375" rx="5" ry="5" />
|
||||
|
||||
<!-- Header separator -->
|
||||
<path d="M4 19 L46.097575068473816 19" />
|
||||
|
||||
<!-- A single highlighted date block -->
|
||||
<rect x="10" y="23" width="8" height="8" rx="1.5" ry="1.5" />
|
||||
|
||||
<!-- Linear agenda lines -->
|
||||
<path d="M22 27 L42 27" />
|
||||
<path d="M10 35 L42 35" />
|
||||
<path d="M10 43 L42 43" />
|
||||
<path d="M10 51 L30 51" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 929 B |
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="skip"><path d="m11 19-1.106-.552a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0l4.212 2.106a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619V12"/><path d="M15 5.764V12"/><path d="M18 15v6"/><path d="M21 18h-6"/><path d="M9 3.236v15"/></svg>
|
||||
|
After Width: | Height: | Size: 485 B |
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
Copies the text from the selected PDF page on the Excalidraw canvas to the clipboard.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/Kwt_8WdOUT4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
Link:: https://youtu.be/Kwt_8WdOUT4
|
||||
<a href="https://www.youtube.com/watch?v=Kwt_8WdOUT4" target="_blank"><img src ="https://i.ytimg.com/vi/Kwt_8WdOUT4/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
|
||||
```js*/
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/*
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=epYNx2FSf2w" target="_blank"><img src ="https://i.ytimg.com/vi/epYNx2FSf2w/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/epYNx2FSf2w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
Link:: https://youtu.be/epYNx2FSf2w
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/diBT5iaoAYo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
Link:: https://youtu.be/diBT5iaoAYo
|
||||
<a href="https://www.youtube.com/watch?v=diBT5iaoAYo" target="_blank"><img src ="https://i.ytimg.com/vi/diBT5iaoAYo/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
Design your palette at http://paletton.com/
|
||||
Once you are happy with your colors, click Tables/Export in the bottom right of the screen:
|
||||
|
||||
+34
-23
@@ -47,6 +47,7 @@ async function run() {
|
||||
// Initialize state
|
||||
let uiHidden = true;
|
||||
let currentIcon = "eye";
|
||||
let layerUIWrapper = ea.targetView.contentEl.querySelector(".excalidraw.excalidraw-container > .layer-ui__wrapper");
|
||||
const toolbar = ea.targetView.contentEl.querySelector(".excalidraw > .Island");
|
||||
let toolbarActive = toolbar?.style.display === "block";
|
||||
let prevHiddenState = false;
|
||||
@@ -55,30 +56,40 @@ async function run() {
|
||||
const toggleUIVisibility = (hidden) => {
|
||||
if(hidden === prevHiddenState) return hidden;
|
||||
prevHiddenState = hidden;
|
||||
try{
|
||||
const topBar = ea.targetView.containerEl.querySelector(".App-top-bar");
|
||||
const bottomBar = ea.targetView.containerEl.querySelector(".App-bottom-bar");
|
||||
const sidebarToggle = ea.targetView.containerEl.querySelector(".sidebar-toggle");
|
||||
const plugins = ea.targetView.containerEl.querySelector(".plugins-container");
|
||||
|
||||
if(hidden) {
|
||||
if (toolbarActive && (toolbar?.style.display === "none")) {
|
||||
toolbarActive = false;
|
||||
if (!!layerUIWrapper) {
|
||||
try {
|
||||
if(hidden) {
|
||||
layerUIWrapper.style.display = "none";
|
||||
} else {
|
||||
layerUIWrapper.style.display = "block";
|
||||
}
|
||||
} catch {};
|
||||
} else {
|
||||
try{
|
||||
const topBar = ea.targetView.containerEl.querySelector(".App-top-bar");
|
||||
const bottomBar = ea.targetView.containerEl.querySelector(".App-bottom-bar");
|
||||
const sidebarToggle = ea.targetView.containerEl.querySelector(".sidebar-toggle");
|
||||
const plugins = ea.targetView.containerEl.querySelector(".plugins-container");
|
||||
|
||||
if(hidden) {
|
||||
if (toolbarActive && (toolbar?.style.display === "none")) {
|
||||
toolbarActive = false;
|
||||
}
|
||||
if (toolbarActive = toolbar?.style.display === "block") {
|
||||
toolbarActive = true;
|
||||
};
|
||||
}
|
||||
if (toolbarActive = toolbar?.style.display === "block") {
|
||||
toolbarActive = true;
|
||||
};
|
||||
}
|
||||
|
||||
const display = hidden ? "none" : "";
|
||||
|
||||
if (topBar) topBar.style.display = display;
|
||||
if (bottomBar) bottomBar.style.display = display;
|
||||
if (sidebarToggle) sidebarToggle.style.display = display;
|
||||
if (plugins) plugins.style.display = display;
|
||||
if (toolbarActive) toolbar.style.display = hidden ? "none" : "block";
|
||||
modal.modalEl.style.opacity = hidden ? "0.4" : "0.8";
|
||||
} catch {};
|
||||
|
||||
const display = hidden ? "none" : "";
|
||||
|
||||
if (topBar) topBar.style.display = display;
|
||||
if (bottomBar) bottomBar.style.display = display;
|
||||
if (sidebarToggle) sidebarToggle.style.display = display;
|
||||
if (plugins) plugins.style.display = display;
|
||||
if (toolbarActive) toolbar.style.display = hidden ? "none" : "block";
|
||||
modal.modalEl.style.opacity = hidden ? "0.4" : "0.8";
|
||||
} catch {};
|
||||
};
|
||||
return hidden;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Scribble Helper can improve handwriting and add links. It lets you create and edit text elements, including wrapped text and sticky notes, by double-tapping on the canvas. When you run the script, it creates an event handler that will activate the editor when you double-tap. If you select a text element on the canvas before running the script, it will open the editor for that element. If you use a pen, you can set it up to only activate Scribble Helper when you double-tap with the pen. The event handler is removed when you run the script a second time or switch to a different tab.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/BvYkOaly-QM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<a href="https://www.youtube.com/watch?v=BvYkOaly-QM" target="_blank"><img src ="https://i.ytimg.com/vi/BvYkOaly-QM/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
```javascript
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,10 @@ const HELP_TEXT = `
|
||||
- Additionally if the same color is used as fill and stroke the color can only be mapped once
|
||||
- This is an experimental script - contributions welcome on GitHub via PRs
|
||||
|
||||

|
||||
😍 If you find this script helpful, please [buy me a coffee ☕](https://ko-fi.com/zsolt).
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=ISuORbVKyhQ" target="_blank"><img src ="https://i.ytimg.com/vi/ISuORbVKyhQ/maxresdefault.jpg" style="max-width:560px; width:100%"></a>
|
||||
|
||||
`;
|
||||
|
||||
if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.7.2")) {
|
||||
@@ -323,7 +326,7 @@ function slider(contentEl, action, min, max, step, invert) {
|
||||
|
||||
function showModal() {
|
||||
let debounceColorPicker = true;
|
||||
const modal = new ea.obsidian.Modal(app);
|
||||
const modal = new ea.FloatingModal(app);
|
||||
let dirty = false;
|
||||
|
||||
modal.onOpen = async () => {
|
||||
@@ -561,8 +564,6 @@ function showModal() {
|
||||
.setButtonText("Close")
|
||||
.setCta(true)
|
||||
.onClick(() => modal.close()));
|
||||
|
||||
makeModalDraggable(modalEl);
|
||||
|
||||
const maxHeight = Math.round(height * 0.6);
|
||||
const maxWidth = Math.round(width * 0.9);
|
||||
@@ -583,60 +584,6 @@ function showModal() {
|
||||
modal.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add draggable functionality to the modal element.
|
||||
* @param {HTMLElement} modalEl - The modal element to make draggable.
|
||||
*/
|
||||
function makeModalDraggable(modalEl) {
|
||||
let isDragging = false;
|
||||
let startX, startY, initialX, initialY;
|
||||
|
||||
const header = modalEl.querySelector('.modal-titlebar') || modalEl; // Default to modalEl if no titlebar
|
||||
header.style.cursor = 'move';
|
||||
|
||||
const onPointerDown = (e) => {
|
||||
// Ensure the event target isn't an interactive element like slider, button, or input
|
||||
if (e.target.tagName === 'INPUT' || e.target.tagName === 'BUTTON') return;
|
||||
|
||||
isDragging = true;
|
||||
startX = e.clientX;
|
||||
startY = e.clientY;
|
||||
const rect = modalEl.getBoundingClientRect();
|
||||
initialX = rect.left;
|
||||
initialY = rect.top;
|
||||
|
||||
modalEl.style.position = 'absolute';
|
||||
modalEl.style.margin = '0';
|
||||
modalEl.style.left = `${initialX}px`;
|
||||
modalEl.style.top = `${initialY}px`;
|
||||
};
|
||||
|
||||
const onPointerMove = (e) => {
|
||||
if (!isDragging) return;
|
||||
|
||||
const dx = e.clientX - startX;
|
||||
const dy = e.clientY - startY;
|
||||
|
||||
modalEl.style.left = `${initialX + dx}px`;
|
||||
modalEl.style.top = `${initialY + dy}px`;
|
||||
};
|
||||
|
||||
const onPointerUp = () => {
|
||||
isDragging = false;
|
||||
};
|
||||
|
||||
header.addEventListener('pointerdown', onPointerDown);
|
||||
document.addEventListener('pointermove', onPointerMove);
|
||||
document.addEventListener('pointerup', onPointerUp);
|
||||
|
||||
// Clean up event listeners on modal close
|
||||
modalEl.addEventListener('remove', () => {
|
||||
header.removeEventListener('pointerdown', onPointerDown);
|
||||
document.removeEventListener('pointermove', onPointerMove);
|
||||
document.removeEventListener('pointerup', onPointerUp);
|
||||
});
|
||||
}
|
||||
|
||||
function executeChange(isDecrease, step, action) {
|
||||
const modifyStroke = settings[STROKE].value;
|
||||
const modifyBackground = settings[BACKGROUND].value;
|
||||
|
||||
+39
-3
@@ -48,6 +48,7 @@ const EDIT_ZOOMOUT = 0.7; //70% of original slide zoom, set to a value between 1
|
||||
const FADE_LEVEL = 0.1; //opacity of the slideshow controls after fade delay (value between 0 and 1)
|
||||
const PRINT_SLIDE_WIDTH = 1920;
|
||||
const PRINT_SLIDE_HEIGHT = 1080;
|
||||
const MAX_ZOOM = 30; //3000%
|
||||
//using outerHTML because the SVG object returned by Obsidin is in the main workspace window
|
||||
//but excalidraw might be open in a popout window which has a different document object
|
||||
const SVG_COG = ea.obsidian.getIcon("lucide-settings").outerHTML;
|
||||
@@ -60,6 +61,7 @@ const SVG_MINIMIZE = ea.obsidian.getIcon("lucide-minimize").outerHTML;
|
||||
const SVG_LASER_ON = ea.obsidian.getIcon("lucide-hand").outerHTML;
|
||||
const SVG_LASER_OFF = ea.obsidian.getIcon("lucide-wand").outerHTML;
|
||||
const SVG_PRINTER = ea.obsidian.getIcon("lucide-printer").outerHTML;
|
||||
const SVG_REFOCUS = ea.obsidian.getIcon("lucide-scan-eye").outerHTML;
|
||||
|
||||
//-------------------------------
|
||||
//utility & convenience functions
|
||||
@@ -278,7 +280,7 @@ const getNavigationRect = ({ x1, y1, x2, y2, printDimensions }) => {
|
||||
const { width, height } = printDimensions ? printDimensions : excalidrawAPI.getAppState();
|
||||
const ratioX = width / Math.abs(x1 - x2);
|
||||
const ratioY = height / Math.abs(y1 - y2);
|
||||
let ratio = Math.min(Math.max(ratioX, ratioY), 30);
|
||||
let ratio = Math.min(Math.max(ratioX, ratioY), MAX_ZOOM);
|
||||
|
||||
const scaledWidth = Math.abs(x1 - x2) * ratio;
|
||||
const scaledHeight = Math.abs(y1 - y2) * ratio;
|
||||
@@ -499,9 +501,22 @@ const createPresentationNavigationPanel = () => {
|
||||
}
|
||||
});
|
||||
|
||||
el.createEl("button",{
|
||||
attr: {
|
||||
title: "Re-focus current slide (shortcut: HOME)"
|
||||
}
|
||||
}, button => {
|
||||
button.innerHTML = SVG_REFOCUS;
|
||||
button.onclick = () => {
|
||||
debugger;
|
||||
slide--;
|
||||
navigate("fwd");
|
||||
}
|
||||
});
|
||||
|
||||
el.createEl("button",{
|
||||
attr: {
|
||||
title: "Toggle fullscreen. If you hold ALT/OPT when starting the presentation it will not go fullscreen."
|
||||
title: "Toggle fullscreen. If you hold ALT/OPT when starting the presentation it will not go fullscreen. (shortcut: f)"
|
||||
},
|
||||
}, button => {
|
||||
toggleFullscreenButton = button;
|
||||
@@ -590,7 +605,7 @@ const keydownListener = (e) => {
|
||||
navigate("fwd");
|
||||
break;
|
||||
case "Home":
|
||||
slide = -1;
|
||||
slide--;
|
||||
navigate("fwd");
|
||||
break;
|
||||
case "e":
|
||||
@@ -600,6 +615,9 @@ const keydownListener = (e) => {
|
||||
exitPresentation(true);
|
||||
})()
|
||||
break;
|
||||
case "f":
|
||||
toggleFullscreen();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,6 +811,22 @@ const translateToZero = ({ top, left, bottom, right }, padding) => {
|
||||
};
|
||||
}
|
||||
|
||||
const getElementPlaceholdersForMarkerFrames = () => {
|
||||
const viewMarkerFrames = ea.getViewElements().filter(el=>el.type === "frame" && el.frameRole === "marker");
|
||||
if(viewMarkerFrames.length === 0) return;
|
||||
ea.clear();
|
||||
ea.style.opacity = 0;
|
||||
ea.style.roughness = 0;
|
||||
ea.style.fillStyle = "solid";
|
||||
ea.style.backgroundColor = "black"
|
||||
ea.style.strokeWidth = 0.01;
|
||||
|
||||
for (const frame of viewMarkerFrames) {
|
||||
ea.addRect(frame.x, frame.y, frame.width, frame.height);
|
||||
}
|
||||
return ea.getViewElements().concat(ea.getElements());
|
||||
}
|
||||
|
||||
const printToPDF = async (e) => {
|
||||
const slideWidth = e.shiftKey ? excalidrawAPI.getAppState().width : PRINT_SLIDE_WIDTH;
|
||||
const slideHeight = e.shiftKey ? excalidrawAPI.getAppState().height : PRINT_SLIDE_HEIGHT;
|
||||
@@ -803,6 +837,7 @@ const printToPDF = async (e) => {
|
||||
const padding = shouldClipFrames ? 0 : Math.round(Math.max(slideWidth,slideHeight)/2)+10;
|
||||
const st = ea.getExcalidrawAPI().getAppState();
|
||||
setSingleNotice("Generating image. This can take a longer time depending on the size of the image and speed of your device");
|
||||
const elementsOverride = getElementPlaceholdersForMarkerFrames();
|
||||
const svg = await ea.createViewSVG({
|
||||
withBackground: true,
|
||||
theme: st.theme,
|
||||
@@ -811,6 +846,7 @@ const printToPDF = async (e) => {
|
||||
selectedOnly: false,
|
||||
skipInliningFonts: false,
|
||||
embedScene: false,
|
||||
elementsOverride,
|
||||
});
|
||||
const pages = [];
|
||||
for(i=0;i<slides.length;i++) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1747585400113},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
|
||||
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1747585400113},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
|
||||
+29
-14
@@ -7,7 +7,7 @@ If you are enjoying the Excalidraw plugin then please support my work and enthus
|
||||
Jump ahead to the [[#List of available scripts]]
|
||||
|
||||
# Introducing Excalidraw Automate Script Engine
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/hePJcObHIso" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
<a href="https://www.youtube.com/watch?v=hePJcObHIso" target="_blank"><img src ="https://i.ytimg.com/vi/hePJcObHIso/maxresdefault.jpg" style="width:560px;"></a>
|
||||
|
||||
Script Engine scripts are installed in the `Downloaded` subfolder of the `Excalidraw Automate script folder` specified in plugin settings.
|
||||
|
||||
@@ -55,6 +55,7 @@ These are the scripts I use most often. I tried to order them by importance, but
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Excalidraw%20Writing%20Machine.svg"/></div>|[[#Excalidraw Writing Machine]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Convert%20freedraw%20to%20line.svg"/></div>|[[#Convert freedraw to line]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Crop%20Vintage%20Mask.svg"/></div>|[[#Crop Vintage Mask]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20Builder.svg"/></div>|[[#Mindmap Builder]]|
|
||||
|
||||
## Layout and Organization
|
||||
**Keywords**: Design, Placement, Arrangement, Structure, Formatting, Alignment
|
||||
@@ -76,6 +77,7 @@ These are the scripts I use most often. I tried to order them by importance, but
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Fixed%20vertical%20distance.svg"/></div>|[[#Fixed vertical distance]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Golden%20Ratio.svg"/></div>|[[#Golden Ratio]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Grid%20Selected%20Images.svg"/></div>|[[#Grid selected images]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png"/></div>|[[#Mindmap Builder]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20format.svg"/></div>|[[#Mindmap format]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Printable%20Layout%20Wizard.svg"/></div>|[[#Printable Layout Wizard]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Zoom%20to%20Fit%20Selected%20Elements.svg"/></div>|[[#Zoom to Fit Selected Elements]]|
|
||||
@@ -181,6 +183,7 @@ These are the scripts I use most often. I tried to order them by importance, but
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Convert%20freedraw%20to%20line.svg"/></div>|[[#Convert freedraw to line]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Deconstruct%20selected%20elements%20into%20new%20drawing.svg"/></div>|[[#Deconstruct selected elements into new drawing]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Full-Year%20Calendar%20Generator.svg"/></div>|[[#Full-Year Calendar Generator]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Linear%20Calendar%20Generator.svg"/></div>|[[#Linear Calendar Generator]]|
|
||||
|
||||
## Masking and cropping
|
||||
**Keywords**: Crop, Mask, Transform images
|
||||
@@ -289,7 +292,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Create%20DrawIO%20file.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Create%20DrawIO%20file.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">The script will prompt you for a filename, then create a new draw.io diagram file and open the file in the <a href='https://github.com/zapthedingbat/drawio-obsidian'>Diagram plugin</a>, in a new tab.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/DJcosmN-q2s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Create%20DrawIO%20file.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">The script will prompt you for a filename, then create a new draw.io diagram file and open the file in the <a href='https://github.com/zapthedingbat/drawio-obsidian'>Diagram plugin</a>, in a new tab.<br><a href="https://www.youtube.com/watch?v=DJcosmN-q2s" target="_blank"><img src ="https://i.ytimg.com/vi/DJcosmN-q2s/maxresdefault.jpg" style="width:400px;"></a></td></tr></table>
|
||||
|
||||
## Create new markdown file and embed into active drawing
|
||||
```excalidraw-script-install
|
||||
@@ -321,7 +324,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Deconstruct%20selected%20elements%20into%20new%20drawing.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Deconstruct%20selected%20elements%20into%20new%20drawing.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Select some elements in the scene. The script will take these elements and move them into a new Excalidraw file, and open that file. The selected elements will also be replaced in your original drawing with the embedded Excalidraw file (the one that was just created). You will be prompted for the file name of the new deconstructed image. The script is useful if you want to break a larger drawing into smaller reusable parts that you want to reference in multiple drawings.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/HRtaaD34Zzg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-deconstruct.jpg'></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Deconstruct%20selected%20elements%20into%20new%20drawing.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Select some elements in the scene. The script will take these elements and move them into a new Excalidraw file, and open that file. The selected elements will also be replaced in your original drawing with the embedded Excalidraw file (the one that was just created). You will be prompted for the file name of the new deconstructed image. The script is useful if you want to break a larger drawing into smaller reusable parts that you want to reference in multiple drawings.<br><a href="https://www.youtube.com/watch?v=HRtaaD34Zzg" target="_blank"><img src ="https://i.ytimg.com/vi/HRtaaD34Zzg/maxresdefault.jpg" style="width:400px;"></a><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-deconstruct.jpg'></td></tr></table>
|
||||
|
||||
## Elbow connectors
|
||||
```excalidraw-script-install
|
||||
@@ -339,7 +342,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Excalidraw%20Collaboration%20Frame.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/1-2-3'>@1-2-3</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Excalidraw%20Collaboration%20Frame.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Creates a new Excalidraw.com collaboration room and places the link to the room on the clipboard.<iframe width="400" height="225" src="https://www.youtube.com/embed/7isRfeAhEH4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/1-2-3'>@1-2-3</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Excalidraw%20Collaboration%20Frame.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Creates a new Excalidraw.com collaboration room and places the link to the room on the clipboard.<a href="https://www.youtube.com/watch?v=7isRfeAhEH4" target="_blank"><img src ="https://i.ytimg.com/vi/7isRfeAhEH4/maxresdefault.jpg" style="width:400px;"></a></td></tr></table>
|
||||
|
||||
## Expand rectangles horizontally keep text centered
|
||||
```excalidraw-script-install
|
||||
@@ -407,7 +410,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Golden%20Ratio.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">The script performs two different functions depending on the elements selected in the view.<br>
|
||||
1) In case you select text elements, the script will cycle through a set of font scales. First the 2 larger fonts following the Fibonacci sequence (fontsize * φ; fonsize * φ^2), then the 2 smaller fonts (fontsize / φ; fontsize / φ^2), finally the original size, followed again by the 2 larger fonts. If you wait 2 seconds, the sequence clears and starts from which ever font size you are on. So if you want the 3rd larges font, then toggle twice, wait 2 sec, then toggle again.<br>
|
||||
2) In case you select a single rectangle, the script will open the "Golden Grid", "Golden Spiral" window, where you can set up the type of grid or spiral you want to insert into the document.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/golden-ratio.jpg'><br><iframe width="400" height="225" src="https://www.youtube.com/embed/2SHn_ruax-s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
2) In case you select a single rectangle, the script will open the "Golden Grid", "Golden Spiral" window, where you can set up the type of grid or spiral you want to insert into the document.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/golden-ratio.jpg'><br><a href="https://www.youtube.com/watch?v=2SHn_ruax-s" target="_blank"><img src ="https://i.ytimg.com/vi/2SHn_ruax-s/maxresdefault.jpg" style="width:400px;"></a></td></tr></table>
|
||||
|
||||
## Grid selected images
|
||||
```excalidraw-script-install
|
||||
@@ -419,13 +422,13 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/ExcaliAI.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/ExcaliAI.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Various AI features based on GPT Vision.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/A1vrSGBbWgo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-draw-a-ui.jpg'></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/ExcaliAI.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Various AI features based on GPT Vision.<br><a href="https://www.youtube.com/watch?v=A1vrSGBbWgo" target="_blank"><img src ="https://i.ytimg.com/vi/A1vrSGBbWgo/maxresdefault.jpg" style="width:400px;"></a><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-draw-a-ui.jpg'></td></tr></table>
|
||||
|
||||
## Excalidraw Writing Machine
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Excalidraw%20Writing%20Machine.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Excalidraw%20Writing%20Machine.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Creates a hierarchical Markdown document out of a visual layout of an article that can be fed to Templater and converted into an article using AI for Templater.<br>Watch this video to understand how the script is intended to work:<br><iframe width="400" height="225" src="https://www.youtube.com/embed/zvRpCOZAUSs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br>You can download the sample Obsidian Templater file from <a href="https://gist.github.com/zsviczian/bf49d4b2d401f5749aaf8c2fa8a513d9">here</a>. You can download the demo PDF document showcased in the video from <a href="https://zsviczian.github.io/DemoArticle-AtomicHabits.pdf">here</a>.</td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Excalidraw%20Writing%20Machine.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Creates a hierarchical Markdown document out of a visual layout of an article that can be fed to Templater and converted into an article using AI for Templater.<br>Watch this video to understand how the script is intended to work:<br><a href="https://www.youtube.com/watch?v=zvRpCOZAUSs" target="_blank"><img src ="https://i.ytimg.com/vi/zvRpCOZAUSs/maxresdefault.jpg" style="width:400px;"></a><br>You can download the sample Obsidian Templater file from <a href="https://gist.github.com/zsviczian/bf49d4b2d401f5749aaf8c2fa8a513d9">here</a>. You can download the demo PDF document showcased in the video from <a href="https://zsviczian.github.io/DemoArticle-AtomicHabits.pdf">here</a>.</td></tr></table>
|
||||
|
||||
## Full-Year Calendar Generator
|
||||
```excalidraw-script-install
|
||||
@@ -437,7 +440,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/GPT-Draw-a-UI.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/GPT-Draw-a-UI.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">This script was discontinued in favor of ExcaliAI. Draw a UI and let GPT create the code for you.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/y3kHl_6Ll4w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-draw-a-ui.jpg'></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/GPT-Draw-a-UI.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">This script was discontinued in favor of ExcaliAI. Draw a UI and let GPT create the code for you.<br><a href="https://www.youtube.com/watch?v=y3kHl_6Ll4w" target="_blank"><img src ="https://i.ytimg.com/vi/y3kHl_6Ll4w/maxresdefault.jpg" style="width:400px;"></a><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-draw-a-ui.jpg'></td></tr></table>
|
||||
|
||||
## Image Occlusion
|
||||
```excalidraw-script-install
|
||||
@@ -457,6 +460,18 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/1-2-3'>@1-2-3</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Lighten%20background%20color.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">This script lightens the background color of the selected element by 2% at a time. You can use this script several times until you are satisfied. It is recommended to set a shortcut key for this script so that you can quickly try to DARKEN and LIGHTEN the color effect.In contrast to the `Modify background color opacity` script, the advantage is that the background color of the element is not affected by the canvas color, and the color value does not appear in a strange rgba() form.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/darken-lighten-background-color.png'></td></tr></table>
|
||||
|
||||
## Linear Calendar Generator
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Linear%20Calendar%20Generator.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/iwanhoogendoorn'>@iwanhoogendoorn</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Linear%20Calendar%20Generator.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Generates a complete calendar for a specified year.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-Linear-Calendar-Generator.jpg'></td></tr></table>
|
||||
|
||||
## Mindmap Builder
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20Builder.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Rapid mind mapping workflow driven by keyboard shortcuts: add sibling/child nodes, auto-layout and branch styling, quick navigation, optional recursive grouping, and Markdown copy/paste import/export for bullet-list sync.<br><a href="https://www.youtube.com/watch?v=dZguonMP2KU" target="_blank"><img src ="https://i.ytimg.com/vi/dZguonMP2KU/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/dZguonMP2KU' target='_blank'>Link to video on YouTube</a><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png'></td></tr></table>
|
||||
|
||||
## Mindmap connector
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20connector.md
|
||||
@@ -505,13 +520,13 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr>
|
||||
<tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Palm%20Guard.md'>File on GitHub</a></td></tr>
|
||||
<tr valign='top'><td class="label">Description</td><td class="data">Mobile & desktop palm‑rejection and distraction‑free drawing mode: optionally enters fullscreen, hides ALL Excalidraw UI chrome (top toolbar, side / bottom bars, plugin panels) for a clean / zen / immersive / kiosk / focus mode canvas. Provides a tiny draggable micro toolbar (toggle visibility + exit) so you gain maximum drawing area while preventing accidental palm taps. Uses the hotkey you assign in Obsidian’s Hotkey settings for this script to instantly show / hide controls (if no hotkey is set, use the on‑screen toggle). Ideal for stylus sketching, presentations, screen recording, split‑view space saving, or anyone searching for: palm rejection, hide toolbar, hide UI controls, clean mode, distraction free Excalidraw.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/A_udjVjgWN0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><a href='https://youtu.be/A_udjVjgWN0' target='_blank'>Link to video on YouTube</a></td></tr></table>
|
||||
<tr valign='top'><td class="label">Description</td><td class="data">Mobile & desktop palm‑rejection and distraction‑free drawing mode: optionally enters fullscreen, hides ALL Excalidraw UI chrome (top toolbar, side / bottom bars, plugin panels) for a clean / zen / immersive / kiosk / focus mode canvas. Provides a tiny draggable micro toolbar (toggle visibility + exit) so you gain maximum drawing area while preventing accidental palm taps. Uses the hotkey you assign in Obsidian’s Hotkey settings for this script to instantly show / hide controls (if no hotkey is set, use the on‑screen toggle). Ideal for stylus sketching, presentations, screen recording, split‑view space saving, or anyone searching for: palm rejection, hide toolbar, hide UI controls, clean mode, distraction free Excalidraw.<br><a href="https://www.youtube.com/watch?v=A_udjVjgWN0" target="_blank"><img src ="https://i.ytimg.com/vi/A_udjVjgWN0/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/A_udjVjgWN0' target='_blank'>Link to video on YouTube</a></td></tr></table>
|
||||
|
||||
## PDF Page Text to Clipboard
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/PDF%20Page%20Text%20to%20Clipboard.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/PDF%20Page%20Text%20to%20Clipboard.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Copies the text from the selected PDF page on the Excalidraw canvas to the clipboard.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/Kwt_8WdOUT4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><a href='https://youtu.be/Kwt_8WdOUT4' target='_blank'>Link to video on YouTube</a></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/PDF%20Page%20Text%20to%20Clipboard.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Copies the text from the selected PDF page on the Excalidraw canvas to the clipboard.<br><a href="https://www.youtube.com/watch?v=Kwt_8WdOUT4" target="_blank"><img src ="https://i.ytimg.com/vi/Kwt_8WdOUT4/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/Kwt_8WdOUT4' target='_blank'>Link to video on YouTube</a></td></tr></table>
|
||||
|
||||
## Relative Font Size Cycle
|
||||
```excalidraw-script-install
|
||||
@@ -547,7 +562,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Scribble%20Helper.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Scribble%20Helper.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">iOS scribble helper for better handwriting experience with text elements. If no elements are selected then the creates a text element at pointer position and you can use the edit box to modify the text with scribble. If a text element is selected then opens the input prompt where you can modify this text with scribble.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-scribble-helper.jpg'><br><iframe width="560" height="315" src="https://www.youtube.com/embed/BvYkOaly-QM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Scribble%20Helper.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">iOS scribble helper for better handwriting experience with text elements. If no elements are selected then the creates a text element at pointer position and you can use the edit box to modify the text with scribble. If a text element is selected then opens the input prompt where you can modify this text with scribble.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-scribble-helper.jpg'><br><a href="https://www.youtube.com/watch?v=BvYkOaly-QM" target="_blank"><img src ="https://i.ytimg.com/vi/BvYkOaly-QM/maxresdefault.jpg" style="width:560px;"></a></td></tr></table>
|
||||
|
||||
## Select Elements of Type
|
||||
```excalidraw-script-install
|
||||
@@ -615,14 +630,14 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Shade%20Master.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Shade%20Master.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">You can modify the colors of SVG images, embedded files, and Excalidraw elements in a drawing by changing Hue, Saturation, Lightness and Transparency; and if only a single SVG or nested Excalidraw drawing is selected, then you can remap image colors.<br><iframe width="560" height="315" src="https://www.youtube.com/embed/ISuORbVKyhQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Shade%20Master.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">You can modify the colors of SVG images, embedded files, and Excalidraw elements in a drawing by changing Hue, Saturation, Lightness and Transparency; and if only a single SVG or nested Excalidraw drawing is selected, then you can remap image colors.<br><a href="https://www.youtube.com/watch?v=ISuORbVKyhQ" target="_blank"><img src ="https://i.ytimg.com/vi/ISuORbVKyhQ/maxresdefault.jpg" style="width:560px;"></a></td></tr></table>
|
||||
|
||||
|
||||
## Slideshow
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Slideshow.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Slideshow.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">The script will convert your drawing into a slideshow presentation.<br><iframe width="560" height="315" src="https://www.youtube.com/embed/JwgtCrIVeEU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Slideshow.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">The script will convert your drawing into a slideshow presentation.<br><a href="https://www.youtube.com/watch?v=JwgtCrIVeEU" target="_blank"><img src ="https://i.ytimg.com/vi/JwgtCrIVeEU/maxresdefault.jpg" style="width:560px;"></a></td></tr></table>
|
||||
|
||||
## Split Ellipse
|
||||
```excalidraw-script-install
|
||||
@@ -676,7 +691,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Printable%20Layout%20Wizard.md
|
||||
```
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Printable%20Layout%20Wizard.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Export Excalidraw to PDF Pages: Define printable page areas using frames, then export each frame as a separate page in a multi-page PDF. Perfect for turning your Excalidraw drawings into printable notes, handouts, or booklets. Supports standard and custom page sizes, margins, and easy frame arrangement.<br><iframe width="400" height="225" src="https://www.youtube.com/embed/29EWeglRm7s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><a href='https://youtu.be/29EWeglRm7s' target='_blank'>Link to video on YouTube</a><br><iframe width="400" height="225" src="https://www.youtube.com/embed/DqDnzCOoYMc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><a href='https://youtu.be/DqDnzCOoYMc' target='_blank'>Link to video on YouTube</a><br><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-layout-wizard-01.png" style="max-width: 400px;"><br><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-layout-wizard-02.png" style="max-width: 400px;"></td></tr></table>
|
||||
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Printable%20Layout%20Wizard.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Export Excalidraw to PDF Pages: Define printable page areas using frames, then export each frame as a separate page in a multi-page PDF. Perfect for turning your Excalidraw drawings into printable notes, handouts, or booklets. Supports standard and custom page sizes, margins, and easy frame arrangement.<br><a href="https://www.youtube.com/watch?v=29EWeglRm7s" target="_blank"><img src ="https://i.ytimg.com/vi/29EWeglRm7s/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/29EWeglRm7s' target='_blank'>Link to video on YouTube</a><br><a href="https://www.youtube.com/watch?v=DqDnzCOoYMc" target="_blank"><img src ="https://i.ytimg.com/vi/DqDnzCOoYMc/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/DqDnzCOoYMc' target='_blank'>Link to video on YouTube</a><br><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-layout-wizard-01.png" style="max-width: 400px;"><br><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-layout-wizard-02.png" style="max-width: 400px;"></td></tr></table>
|
||||
|
||||
|
||||
## Zoom to Fit Selected Elements
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 344 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.15.2",
|
||||
"version": "2.19.0-beta-3",
|
||||
"minAppVersion": "1.5.7",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://excalidraw-obsidian.online",
|
||||
"isDesktopOnly": false
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.15.2",
|
||||
"version": "2.18.3",
|
||||
"minAppVersion": "1.5.7",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
"authorUrl": "https://excalidraw-obsidian.online",
|
||||
"fundingUrl": "https://ko-fi.com/zsolt",
|
||||
"helpUrl": "https://github.com/zsviczian/obsidian-excalidraw-plugin#readme",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
}
|
||||
Generated
+95
-169
@@ -11,7 +11,7 @@
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
"@zsviczian/excalidraw": "0.18.0-31",
|
||||
"@zsviczian/excalidraw": "0.18.0-63",
|
||||
"chroma-js": "^3.1.2",
|
||||
"clsx": "^2.0.0",
|
||||
"es6-promise-pool": "2.5.0",
|
||||
@@ -62,7 +62,7 @@
|
||||
"fs-extra": "^11.2.0",
|
||||
"jsesc": "^3.0.2",
|
||||
"lz-string": "^1.5.0",
|
||||
"obsidian": "^1.7.2",
|
||||
"obsidian": "^1.10.0",
|
||||
"prettier": "^3.0.1",
|
||||
"rollup": "^2.70.1",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
@@ -1685,8 +1685,7 @@
|
||||
"node_modules/@braintree/sanitize-url": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-6.0.2.tgz",
|
||||
"integrity": "sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-Tbsj02wXCbqGmzdnXNk0SOF19ChhRU70BsroIi4Pm6Ehp56in6vch94mfbdQ17DozxkL3BAVjbZ4Qc1a0HFRAg=="
|
||||
},
|
||||
"node_modules/@codemirror/commands": {
|
||||
"version": "6.8.1",
|
||||
@@ -1729,23 +1728,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/state": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.2.tgz",
|
||||
"integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==",
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.0.tgz",
|
||||
"integrity": "sha512-MwBHVK60IiIHDcoMet78lxt6iw5gJOGSbNbOIVBHWVXIH4/Nq1+GQgLLGgI1KlnN86WDXsPudVaqYHKBIx7Eyw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@marijn/find-cluster-break": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/view": {
|
||||
"version": "6.36.8",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.36.8.tgz",
|
||||
"integrity": "sha512-yoRo4f+FdnD01fFt4XpfpMCcCAo9QvZOtbrXExn4SqzH32YC6LgzqxfLZw/r6Ge65xyY03mK/UfUqrVw1gFiFg==",
|
||||
"version": "6.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.1.tgz",
|
||||
"integrity": "sha512-RmTOkE7hRU3OVREqFVITWHz6ocgBjv08GoePscAakgVQfciA3SGCEk7mb9IzwW61cKKmlTpHXG6DUE5Ubx+MGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codemirror/state": "^6.5.0",
|
||||
"crelt": "^1.0.6",
|
||||
"style-mod": "^4.1.0",
|
||||
"w3c-keyname": "^2.2.4"
|
||||
}
|
||||
@@ -2008,8 +2006,7 @@
|
||||
"node_modules/@excalidraw/markdown-to-text": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@excalidraw/markdown-to-text/-/markdown-to-text-0.1.2.tgz",
|
||||
"integrity": "sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-1nDXBNAojfi3oSFwJswKREkFm5wrSjqay81QlyRv2pkITG/XYB5v+oChENVBQLcxQwX4IUATWvXM5BcaNhPiIg=="
|
||||
},
|
||||
"node_modules/@excalidraw/prettier-config": {
|
||||
"version": "1.0.2",
|
||||
@@ -3070,7 +3067,6 @@
|
||||
"version": "4.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
|
||||
"integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/d3-time": "*"
|
||||
}
|
||||
@@ -3078,20 +3074,17 @@
|
||||
"node_modules/@types/d3-scale-chromatic": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz",
|
||||
"integrity": "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ=="
|
||||
},
|
||||
"node_modules/@types/d3-time": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
|
||||
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g=="
|
||||
},
|
||||
"node_modules/@types/debug": {
|
||||
"version": "4.1.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
|
||||
"integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/ms": "*"
|
||||
}
|
||||
@@ -3150,7 +3143,6 @@
|
||||
"version": "3.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz",
|
||||
"integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2"
|
||||
}
|
||||
@@ -3165,8 +3157,7 @@
|
||||
"node_modules/@types/ms": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
|
||||
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.17.50",
|
||||
@@ -3233,8 +3224,7 @@
|
||||
"node_modules/@types/unist": {
|
||||
"version": "2.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz",
|
||||
"integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "8.32.1",
|
||||
@@ -3494,16 +3484,17 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@zsviczian/excalidraw": {
|
||||
"version": "0.18.0-31",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-31.tgz",
|
||||
"integrity": "sha512-A1wyp8EVOhCdoxdX7middc8LoLpjPLtxiSTeBbdMtungl8VQzAcQ2tSGCkncK/8RBcBaUk44Hr6KcWjezHnQew==",
|
||||
"version": "0.18.0-63",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.0-63.tgz",
|
||||
"integrity": "sha512-5pzmT55fmYNZzs0Wi66dK5cEwNmOKsZynSLc/WijdL4epe5sOl5q2wP+mTOkXJv/rvclSSMkmycg2FlZAFWOPg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
"@excalidraw/random-username": "1.1.0",
|
||||
"@radix-ui/react-popover": "1.1.6",
|
||||
"@radix-ui/react-tabs": "1.1.3",
|
||||
"@zsviczian/laser-pointer": "1.3.1",
|
||||
"@zsviczian/mermaid-to-excalidraw": "1.1.2",
|
||||
"@zsviczian/mermaid-to-excalidraw": "1.1.3",
|
||||
"browser-fs-access": "0.29.1",
|
||||
"canvas-roundrect-polyfill": "0.0.1",
|
||||
"clsx": "1.1.1",
|
||||
@@ -3580,13 +3571,15 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@zsviczian/mermaid-to-excalidraw": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/mermaid-to-excalidraw/-/mermaid-to-excalidraw-1.1.2.tgz",
|
||||
"integrity": "sha512-r6Krur0IZEEm8fuYdb8tteRfa4aYChKaXXmg0CpE+8Ovae/PAzvWvKXBw45oOlhjtVRO3kA89blDj+oxrJLusA==",
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/mermaid-to-excalidraw/-/mermaid-to-excalidraw-1.1.3.tgz",
|
||||
"integrity": "sha512-JwE9B2L2k2mAGMA0D7ougV/EBnGMJX24MMcD10mPqdHvE0sunD6ijmfHoL00ZMXtAZfrvjIYoTXiPhSIFkWdUA==",
|
||||
"dependencies": {
|
||||
"@excalidraw/markdown-to-text": "0.1.2",
|
||||
"mermaid": "10.9.3",
|
||||
"nanoid": "4.0.2"
|
||||
"cross-env": "^7.0.3",
|
||||
"mermaid": "10.9.4",
|
||||
"nanoid": "4.0.2",
|
||||
"react-split": "^2.0.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@zsviczian/rollup-plugin-postprocess": {
|
||||
@@ -3964,7 +3957,6 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz",
|
||||
"integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
@@ -4103,7 +4095,6 @@
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz",
|
||||
"integrity": "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"layout-base": "^1.0.0"
|
||||
}
|
||||
@@ -4136,7 +4127,6 @@
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
|
||||
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.1"
|
||||
@@ -4155,7 +4145,6 @@
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
@@ -4359,10 +4348,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cytoscape": {
|
||||
"version": "3.32.0",
|
||||
"resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.32.0.tgz",
|
||||
"integrity": "sha512-5JHBC9n75kz5851jeklCPmZWcg3hUe6sjqJvyk3+hVqFaKcHwHgxsjeN1yLmggoUc6STbtm9/NQyabQehfjvWQ==",
|
||||
"license": "MIT",
|
||||
"version": "3.33.1",
|
||||
"resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.33.1.tgz",
|
||||
"integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==",
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
@@ -4371,7 +4359,6 @@
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz",
|
||||
"integrity": "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cose-base": "^1.0.0"
|
||||
},
|
||||
@@ -4383,7 +4370,6 @@
|
||||
"version": "7.9.0",
|
||||
"resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz",
|
||||
"integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "3",
|
||||
"d3-axis": "3",
|
||||
@@ -4424,7 +4410,6 @@
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
|
||||
"integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"internmap": "1 - 2"
|
||||
},
|
||||
@@ -4436,7 +4421,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz",
|
||||
"integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4445,7 +4429,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz",
|
||||
"integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-drag": "2 - 3",
|
||||
@@ -4461,7 +4444,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz",
|
||||
"integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-path": "1 - 3"
|
||||
},
|
||||
@@ -4473,7 +4455,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
||||
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4482,7 +4463,6 @@
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz",
|
||||
"integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "^3.2.0"
|
||||
},
|
||||
@@ -4494,7 +4474,6 @@
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz",
|
||||
"integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"delaunator": "5"
|
||||
},
|
||||
@@ -4506,7 +4485,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz",
|
||||
"integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4515,7 +4493,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz",
|
||||
"integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-selection": "3"
|
||||
@@ -4528,7 +4505,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz",
|
||||
"integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"commander": "7",
|
||||
"iconv-lite": "0.6",
|
||||
@@ -4553,7 +4529,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
|
||||
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4562,7 +4537,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz",
|
||||
"integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dsv": "1 - 3"
|
||||
},
|
||||
@@ -4574,7 +4548,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz",
|
||||
"integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-quadtree": "1 - 3",
|
||||
@@ -4588,7 +4561,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz",
|
||||
"integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4597,7 +4569,6 @@
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz",
|
||||
"integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2.5.0 - 3"
|
||||
},
|
||||
@@ -4609,7 +4580,6 @@
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz",
|
||||
"integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4618,7 +4588,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
||||
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3"
|
||||
},
|
||||
@@ -4630,7 +4599,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
|
||||
"integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4639,7 +4607,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz",
|
||||
"integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4648,7 +4615,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz",
|
||||
"integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4657,7 +4623,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz",
|
||||
"integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4666,7 +4631,6 @@
|
||||
"version": "0.12.3",
|
||||
"resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz",
|
||||
"integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"d3-array": "1 - 2",
|
||||
"d3-shape": "^1.2.0"
|
||||
@@ -4676,7 +4640,6 @@
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
|
||||
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"internmap": "^1.0.0"
|
||||
}
|
||||
@@ -4684,14 +4647,12 @@
|
||||
"node_modules/d3-sankey/node_modules/d3-path": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz",
|
||||
"integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==",
|
||||
"license": "BSD-3-Clause"
|
||||
"integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="
|
||||
},
|
||||
"node_modules/d3-sankey/node_modules/d3-shape": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz",
|
||||
"integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"d3-path": "1"
|
||||
}
|
||||
@@ -4699,14 +4660,12 @@
|
||||
"node_modules/d3-sankey/node_modules/internmap": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz",
|
||||
"integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==",
|
||||
"license": "ISC"
|
||||
"integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw=="
|
||||
},
|
||||
"node_modules/d3-scale": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
|
||||
"integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2.10.0 - 3",
|
||||
"d3-format": "1 - 3",
|
||||
@@ -4722,7 +4681,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz",
|
||||
"integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3",
|
||||
"d3-interpolate": "1 - 3"
|
||||
@@ -4735,7 +4693,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",
|
||||
"integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4744,7 +4701,6 @@
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
|
||||
"integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-path": "^3.1.0"
|
||||
},
|
||||
@@ -4756,7 +4712,6 @@
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
|
||||
"integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-array": "2 - 3"
|
||||
},
|
||||
@@ -4768,7 +4723,6 @@
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
|
||||
"integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-time": "1 - 3"
|
||||
},
|
||||
@@ -4780,7 +4734,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
|
||||
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -4789,7 +4742,6 @@
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz",
|
||||
"integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-color": "1 - 3",
|
||||
"d3-dispatch": "1 - 3",
|
||||
@@ -4808,7 +4760,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz",
|
||||
"integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1 - 3",
|
||||
"d3-drag": "2 - 3",
|
||||
@@ -4824,17 +4775,15 @@
|
||||
"version": "7.0.10",
|
||||
"resolved": "https://registry.npmjs.org/dagre-d3-es/-/dagre-d3-es-7.0.10.tgz",
|
||||
"integrity": "sha512-qTCQmEhcynucuaZgY5/+ti3X/rnszKZhEQH/ZdWdtP1tA/y3VoHJzcVrO9pjjJCNpigfscAtoUB5ONcd2wNn0A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"d3": "^7.8.2",
|
||||
"lodash-es": "^4.17.21"
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.13",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz",
|
||||
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==",
|
||||
"license": "MIT"
|
||||
"version": "1.11.18",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz",
|
||||
"integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.1",
|
||||
@@ -4854,10 +4803,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/decode-named-character-reference": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz",
|
||||
"integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==",
|
||||
"license": "MIT",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz",
|
||||
"integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==",
|
||||
"dependencies": {
|
||||
"character-entities": "^2.0.0"
|
||||
},
|
||||
@@ -4888,7 +4836,6 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz",
|
||||
"integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"robust-predicates": "^3.0.2"
|
||||
}
|
||||
@@ -4897,7 +4844,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
|
||||
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
@@ -4979,8 +4925,7 @@
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.1.6",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz",
|
||||
"integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)"
|
||||
"integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ=="
|
||||
},
|
||||
"node_modules/domutils": {
|
||||
"version": "3.2.2",
|
||||
@@ -5027,8 +4972,7 @@
|
||||
"node_modules/elkjs": {
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/elkjs/-/elkjs-0.9.3.tgz",
|
||||
"integrity": "sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==",
|
||||
"license": "EPL-2.0"
|
||||
"integrity": "sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ=="
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
@@ -5806,7 +5750,6 @@
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
@@ -5891,7 +5834,6 @@
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
|
||||
"integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
@@ -5995,7 +5937,6 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
@@ -6142,14 +6083,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/katex": {
|
||||
"version": "0.16.22",
|
||||
"resolved": "https://registry.npmjs.org/katex/-/katex-0.16.22.tgz",
|
||||
"integrity": "sha512-XCHRdUw4lf3SKBaJe4EvgqIuWwkPSo9XoeO8GjQW94Bp7TWv9hNhzZjZ+OH9yf1UmLygb7DIT5GSFQiyt16zYg==",
|
||||
"version": "0.16.25",
|
||||
"resolved": "https://registry.npmjs.org/katex/-/katex-0.16.25.tgz",
|
||||
"integrity": "sha512-woHRUZ/iF23GBP1dkDQMh1QBad9dmr8/PAwNA54VrSOVYgI12MAcE14TqnDdQOdzyEonGzMepYnqBMYdsoAr8Q==",
|
||||
"funding": [
|
||||
"https://opencollective.com/katex",
|
||||
"https://github.com/sponsors/katex"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^8.3.0"
|
||||
},
|
||||
@@ -6161,7 +6101,6 @@
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz",
|
||||
"integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
@@ -6186,7 +6125,6 @@
|
||||
"version": "4.1.5",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
|
||||
"integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
@@ -6194,8 +6132,7 @@
|
||||
"node_modules/layout-base": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz",
|
||||
"integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg=="
|
||||
},
|
||||
"node_modules/levn": {
|
||||
"version": "0.4.1",
|
||||
@@ -6245,8 +6182,7 @@
|
||||
"node_modules/lodash-es": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz",
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw=="
|
||||
},
|
||||
"node_modules/lodash.debounce": {
|
||||
"version": "4.0.8",
|
||||
@@ -6373,7 +6309,6 @@
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz",
|
||||
"integrity": "sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^3.0.0",
|
||||
"@types/unist": "^2.0.0",
|
||||
@@ -6397,7 +6332,6 @@
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz",
|
||||
"integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^3.0.0"
|
||||
},
|
||||
@@ -6431,10 +6365,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mermaid": {
|
||||
"version": "10.9.3",
|
||||
"resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.3.tgz",
|
||||
"integrity": "sha512-V80X1isSEvAewIL3xhmz/rVmc27CVljcsbWxkxlWJWY/1kQa4XOABqpDl2qQLGKzpKm6WbTfUEKImBlUfFYArw==",
|
||||
"license": "MIT",
|
||||
"version": "10.9.4",
|
||||
"resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.4.tgz",
|
||||
"integrity": "sha512-VIG2B0R9ydvkS+wShA8sXqkzfpYglM2Qwj7VyUeqzNVqSGPoP/tcaUr3ub4ESykv8eqQJn3p99bHNvYdg3gCHQ==",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^6.0.1",
|
||||
"@types/d3-scale": "^4.0.3",
|
||||
@@ -6478,7 +6411,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/debug": "^4.0.0",
|
||||
"debug": "^4.0.0",
|
||||
@@ -6513,7 +6445,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"decode-named-character-reference": "^1.0.0",
|
||||
"micromark-factory-destination": "^1.0.0",
|
||||
@@ -6547,7 +6478,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
@@ -6568,7 +6498,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
@@ -6590,7 +6519,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-types": "^1.0.0"
|
||||
@@ -6610,7 +6538,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-factory-space": "^1.0.0",
|
||||
"micromark-util-character": "^1.0.0",
|
||||
@@ -6632,7 +6559,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-factory-space": "^1.0.0",
|
||||
"micromark-util-character": "^1.0.0",
|
||||
@@ -6654,7 +6580,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
"micromark-util-types": "^1.0.0"
|
||||
@@ -6674,7 +6599,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-symbol": "^1.0.0"
|
||||
}
|
||||
@@ -6693,7 +6617,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
@@ -6714,7 +6637,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-chunked": "^1.0.0",
|
||||
"micromark-util-types": "^1.0.0"
|
||||
@@ -6734,7 +6656,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-symbol": "^1.0.0"
|
||||
}
|
||||
@@ -6753,7 +6674,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"decode-named-character-reference": "^1.0.0",
|
||||
"micromark-util-character": "^1.0.0",
|
||||
@@ -6774,8 +6694,7 @@
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
]
|
||||
},
|
||||
"node_modules/micromark-util-html-tag-name": {
|
||||
"version": "1.2.0",
|
||||
@@ -6790,8 +6709,7 @@
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
]
|
||||
},
|
||||
"node_modules/micromark-util-normalize-identifier": {
|
||||
"version": "1.1.0",
|
||||
@@ -6807,7 +6725,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-symbol": "^1.0.0"
|
||||
}
|
||||
@@ -6826,7 +6743,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-types": "^1.0.0"
|
||||
}
|
||||
@@ -6845,7 +6761,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-encode": "^1.0.0",
|
||||
@@ -6866,7 +6781,6 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"micromark-util-chunked": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
@@ -6887,8 +6801,7 @@
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
]
|
||||
},
|
||||
"node_modules/micromark-util-types": {
|
||||
"version": "1.1.0",
|
||||
@@ -6903,8 +6816,7 @@
|
||||
"type": "OpenCollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
]
|
||||
},
|
||||
"node_modules/micromatch": {
|
||||
"version": "4.0.8",
|
||||
@@ -6985,7 +6897,6 @@
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
||||
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
@@ -7042,8 +6953,7 @@
|
||||
"node_modules/non-layered-tidy-tree-layout": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz",
|
||||
"integrity": "sha512-gkXMxRzUH+PB0ax9dUN0yYF0S25BqeAYqhgMaLUFmpXLEk7Fcu8f4emJuOAY0V8kjDICxROIKsTAKsV/v355xw==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-gkXMxRzUH+PB0ax9dUN0yYF0S25BqeAYqhgMaLUFmpXLEk7Fcu8f4emJuOAY0V8kjDICxROIKsTAKsV/v355xw=="
|
||||
},
|
||||
"node_modules/normalize-path": {
|
||||
"version": "3.0.0",
|
||||
@@ -7077,18 +6987,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/obsidian": {
|
||||
"version": "1.8.7",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.8.7.tgz",
|
||||
"integrity": "sha512-h4bWwNFAGRXlMlMAzdEiIM2ppTGlrh7uGOJS6w4gClrsjc+ei/3YAtU2VdFUlCiPuTHpY4aBpFJJW75S1Tl/JA==",
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.10.0.tgz",
|
||||
"integrity": "sha512-F7hhnmGRQD1TanDPFT//LD3iKNUVd7N8sKL7flCCHRszfTxpDJ39j3T7LHbcGpyid906i6lD5oO+cnfLBzJMKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/codemirror": "5.60.8",
|
||||
"moment": "2.29.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@codemirror/view": "^6.0.0"
|
||||
"@codemirror/state": "6.5.0",
|
||||
"@codemirror/view": "6.38.1"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
@@ -7243,7 +7152,6 @@
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -7996,6 +7904,16 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prop-types": {
|
||||
"version": "15.8.1",
|
||||
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
|
||||
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.4.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"react-is": "^16.13.1"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
@@ -8069,6 +7987,11 @@
|
||||
"react": "^18.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"node_modules/react-remove-scroll": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.7.0.tgz",
|
||||
@@ -8116,6 +8039,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-split": {
|
||||
"version": "2.0.14",
|
||||
"resolved": "https://registry.npmjs.org/react-split/-/react-split-2.0.14.tgz",
|
||||
"integrity": "sha512-bKWydgMgaKTg/2JGQnaJPg51T6dmumTWZppFgEbbY0Fbme0F5TuatAScCLaqommbGQQf/ZT1zaejuPDriscISA==",
|
||||
"dependencies": {
|
||||
"prop-types": "^15.5.7",
|
||||
"split.js": "^1.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/react-style-singleton": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz",
|
||||
@@ -8279,8 +8214,7 @@
|
||||
"node_modules/robust-predicates": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz",
|
||||
"integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==",
|
||||
"license": "Unlicense"
|
||||
"integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg=="
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "2.79.2",
|
||||
@@ -8485,14 +8419,12 @@
|
||||
"node_modules/rw": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz",
|
||||
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==",
|
||||
"license": "BSD-3-Clause"
|
||||
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="
|
||||
},
|
||||
"node_modules/sade": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz",
|
||||
"integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mri": "^1.1.0"
|
||||
},
|
||||
@@ -8524,8 +8456,7 @@
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.51.0",
|
||||
@@ -8577,7 +8508,6 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
@@ -8590,7 +8520,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -8686,6 +8615,11 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/split.js": {
|
||||
"version": "1.6.5",
|
||||
"resolved": "https://registry.npmjs.org/split.js/-/split.js-1.6.5.tgz",
|
||||
"integrity": "sha512-mPTnGCiS/RiuTNsVhCm9De9cCAUsrNFFviRbADdKiiV+Kk8HKp/0fWu7Kr8pi3/yBmsqLFHuXGT9UUZ+CNLwFw=="
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
@@ -8837,8 +8771,7 @@
|
||||
"node_modules/stylis": {
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz",
|
||||
"integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==",
|
||||
"license": "MIT"
|
||||
"integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ=="
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
@@ -8970,7 +8903,6 @@
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz",
|
||||
"integrity": "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.10"
|
||||
}
|
||||
@@ -9149,7 +9081,6 @@
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz",
|
||||
"integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/unist": "^2.0.0"
|
||||
},
|
||||
@@ -9277,7 +9208,6 @@
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
@@ -9286,7 +9216,6 @@
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz",
|
||||
"integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dequal": "^2.0.0",
|
||||
"diff": "^5.0.0",
|
||||
@@ -9304,7 +9233,6 @@
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz",
|
||||
"integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
@@ -9327,8 +9255,7 @@
|
||||
"node_modules/web-worker": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.5.0.tgz",
|
||||
"integrity": "sha512-RiMReJrTAiA+mBjGONMnjVDP2u3p9R1vkcGz6gDIrOMT3oGuYwX2WRMYI9ipkphSuE5XKEhydbhNEJh4NY9mlw==",
|
||||
"license": "Apache-2.0"
|
||||
"integrity": "sha512-RiMReJrTAiA+mBjGONMnjVDP2u3p9R1vkcGz6gDIrOMT3oGuYwX2WRMYI9ipkphSuE5XKEhydbhNEJh4NY9mlw=="
|
||||
},
|
||||
"node_modules/webworkify": {
|
||||
"version": "1.5.0",
|
||||
@@ -9340,7 +9267,6 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
|
||||
+3
-3
@@ -17,14 +17,14 @@
|
||||
"build:all": "npm run build:mathjax && npm run build",
|
||||
"dev:mathjax": "cd MathjaxToSVG && npm run dev",
|
||||
"dev:all": "npm run dev:mathjax && npm run dev",
|
||||
"doc": "node scripts/generate-script-library.js"
|
||||
"doc": "npm run lib && node scripts/generate-script-library.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@zsviczian/excalidraw": "0.18.0-37",
|
||||
"@zsviczian/excalidraw": "0.18.0-63",
|
||||
"chroma-js": "^3.1.2",
|
||||
"clsx": "^2.0.0",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
@@ -74,7 +74,7 @@
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"lz-string": "^1.5.0",
|
||||
"obsidian": "^1.7.2",
|
||||
"obsidian": "^1.10.0",
|
||||
"prettier": "^3.0.1",
|
||||
"rollup": "^2.70.1",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
|
||||
+4
-2
@@ -188,8 +188,10 @@ const BUILD_CONFIG = {
|
||||
},
|
||||
}),
|
||||
postprocess([
|
||||
[/React=require\("react"\),state=require\("@codemirror\/state"\),view=require\("@codemirror\/view"\)/,
|
||||
`state=require("@codemirror/state"),view=require("@codemirror/view")` + packageString],
|
||||
[
|
||||
/(var[^;]*?),\s*React\s*=\s*require\(["']react["']\)([^;]*;)/,
|
||||
(_, g1, g2) => `${g1}${g2}${packageString}`
|
||||
],
|
||||
]),
|
||||
] : [
|
||||
postprocess([ [/var React = require\('react'\);/, packageString] ]),
|
||||
|
||||
@@ -1,16 +1,185 @@
|
||||
/* eslint-disable no-console */
|
||||
// to run: npm run doc
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
const EA_SCRIPTS_DIR = path.join(ROOT, 'ea-scripts');
|
||||
const INDEX_NEW = path.join(EA_SCRIPTS_DIR, 'index-new.md');
|
||||
const DIST_DIR = path.join(ROOT, 'dist');
|
||||
const OUTPUT_FILE = path.join(DIST_DIR, 'Excalidraw Script Library.md');
|
||||
const OUT_DIR = path.join(path.join(ROOT, 'docs'), 'AITrainingData');
|
||||
const SCRIPT_LIBRARY_OUT = path.join(OUT_DIR, 'Excalidraw Script Library.md');
|
||||
const TYPE_DEF_OUT = path.join(OUT_DIR, 'Excalidraw Automate library and related type definitions.md');
|
||||
const AI_TRAINING_OUT = path.join(OUT_DIR, 'ExcalidrawAutomate full library for LLM training.md');
|
||||
|
||||
const INTRO = `# Excalidraw Script Library
|
||||
const AI_TRAINING_INTRO = `**ExcalidrawAutomate full library for LLM training**
|
||||
|
||||
This file is an automatically generated knowledge base intended for Retrieval Augmented Generation (RAG) and other AI-assisted workflows (e.g. NotebookLM or local embeddings tools).
|
||||
Excalidraw-Obsidian is an Obsidian.md plugins that is built on the open source Excalidraw component. Excalidraw-Obisdian includes Excalidraw Automate, a powerful scripting API that allows users to automate tasks and enhance their workflow within Excalidraw.
|
||||
|
||||
Read the information below and respond with I'm ready. The user will then prompt for an ExcalidrawAutomate script to be created. Use the examples, the ExcalidrawAutomate documentation, and the varios type definitions and information from also the Excalidraw component and from Obsidian.md to generate the script based on the user's requirements.
|
||||
|
||||
In addition to ExcalidrawAutomate, you can also use two other sources of functions:
|
||||
- The Excalidraw API available via ea.getExcalidrawAPI(). Note: the API is only available if ea.targetView is set. When running Excalidraw scripts using the script engine, the provided ea object is already set up with targetView by default. Otherwise you need to first run ea.setView().
|
||||
- window.ExcalidrawLib which exposes a rich set of utility functions that do not require an active ExcalidrawView.
|
||||
|
||||
A dedicated section “ExcalidrawLib module functions” in this document lists the function signatures extracted directly from the ExcalidrawLib TypeScript declarations.
|
||||
|
||||
- When the user asks for a dialog window, by default create a FloatingModal. Do not extend the FloatingModal class. Instead, define the modal's behavior by creating a new instance (e.g., const modal = new ea.FloatingModal(...)) and then assigning functions directly to the onOpen and onClose properties of that instance.
|
||||
For a reference, follow the implementation pattern used in the "Printable Layout Wizard.md" script.
|
||||
- Elements have a customData property that can be used to store arbitrary data. To ensure the data the script adds to elements use the ea.addAppendUpdateCustomData function. This function ensures that existing customData is preserved when adding new data.
|
||||
- Elements can be hidden by setting their opacity to 0. When hiding elements this way, it is good practice to temporarily store their original opacity in customData. This allows for easy restoration of the original opacity later.
|
||||
- Elements can be deleted from the scene by setting their isDeleted property to true.
|
||||
- The Obsidian.md module is available on ea.obsidian.
|
||||
|
||||
#### **1. The Core Workflow: Handling Element Immutability**
|
||||
|
||||
* **Central Rule:** Elements in the Excalidraw scene are immutable and should never be modified directly. Always use the ExcalidrawAutomate (EA) "workbench" pattern for modifications.
|
||||
* **The Workflow:**
|
||||
1. Get elements from the current view using \`ea.getViewElements()\` or \`ea.getViewSelectedElements()\`.
|
||||
2. Copy these elements into the EA workbench for editing using \`ea.copyViewElementsToEAforEditing(elements)\`.
|
||||
3. Modify the properties of the element copies that are now in the EA workbench (e.g., \`ea.getElement(id).locked = true;\`).
|
||||
4. Commit the changes back to the scene using \`await ea.addElementsToView()\`.
|
||||
* **Deletion:** To delete an element, set its \`isDeleted\` property to \`true\` on the workbench copy (\`ea.getElement(id).isDeleted = true;\`) and then commit with \`await ea.addElementsToView()\`.
|
||||
* **Cleanup:** Use \`ea.clear()\` at the beginning of a script if you are creating a completely new set of elements, to ensure the EA workbench is empty and doesn't contain artifacts from a previous run.
|
||||
|
||||
#### **2. User Interaction: Prompts and Dialogs**
|
||||
|
||||
* **Simple Input:** For straightforward user input, use the \`utils\` object provided to the script.
|
||||
* \`await utils.inputPrompt()\`: To get a string or number from the user.
|
||||
* \`await utils.suggester()\`: To let the user select from a predefined list of options.
|
||||
* **Complex Dialogs:** When a more complex UI with multiple controls is needed, create a floating dialog window.
|
||||
* **Use \`FloatingModal\`:** Always create a new instance: \`const modal = new ea.FloatingModal(ea.plugin.app);\`.
|
||||
* **Do Not Extend:** Do not use \`class MyModal extends ea.FloatingModal\`.
|
||||
* **Define Behavior:** Assign functions directly to the \`onOpen\` and \`onClose\` properties of the instance. Inside \`onOpen\`, use the \`modal.contentEl\` property to build your UI.
|
||||
* **Reference Implementation:** The script "Printable Layout Wizard.md" is the canonical example for this pattern. Use \`ea.obsidian.Setting\` to add controls like toggles and dropdowns within the modal.
|
||||
|
||||
#### **3. Element Manipulation and Querying**
|
||||
|
||||
* **Finding Elements:** The most common starting point is to get the user's selection with \`ea.getViewSelectedElements()\`. Use standard JavaScript array methods like \`.filter()\` to narrow down the selection (e.g., \`elements.filter(el => el.type === "text")\`).
|
||||
* **Geometric Calculations:**
|
||||
* Before performing layout or positioning tasks, use \`ea.getBoundingBox(elements)\` to get the collective dimensions and position of a group of elements.
|
||||
* Use \`ea.measureText(text)\` to determine the width and height of a string based on the current \`ea.style\` settings before creating a text element or a container for it.
|
||||
* **Grouping:**
|
||||
* To create a group, use \`ea.addToGroup([elementId1, elementId2, ...])\`.
|
||||
* To operate on existing groups within a selection, use \`ea.getMaximumGroups(selectedElements)\` which correctly identifies the top-level groups. Use \`ea.getLargestElement(group)\` to find the primary container within a group (e.g., the box around a text element).
|
||||
|
||||
#### **4. Styling: Creation vs. Modification**
|
||||
|
||||
* **For New Elements:** Set the properties on the global \`ea.style\` object *before* you call a creation function like \`ea.addText()\` or \`ea.addRect()\`. This acts like setting the active color/style on a paintbrush.
|
||||
* **For Existing Elements:** To change the style of an existing element, modify the properties directly on the element's copy in the EA workbench (after \`copyViewElementsToEAforEditing\`). For example: \`const myElement = ea.getElement(id); myElement.strokeColor = '#FF0000';\`.
|
||||
|
||||
#### **5. Data Persistence and Customization**
|
||||
|
||||
* **Storing Custom Data:** Elements have a \`customData\` property for arbitrary data.
|
||||
* **Always Use \`ea.addAppendUpdateCustomData(id, newData)\`:** This is crucial. It safely adds or updates your key-value pairs without overwriting data that might have been stored by other scripts or the Excalidraw plugin itself.
|
||||
* **Creating Configurable Scripts:** To make your script's behavior customizable by the user:
|
||||
* Use \`ea.getScriptSettings()\` to retrieve saved settings.
|
||||
* Check if settings exist, and if not, define the default structure.
|
||||
* Use \`await ea.setScriptSettings(settings)\` to save any changes. This allows users to configure your script in the Excalidraw plugin settings pane.
|
||||
|
||||
#### **6. Best Practices and Advanced Techniques**
|
||||
|
||||
* **Embrace \`await\`:** Many EA functions are asynchronous and return a \`Promise\` (e.g., \`ea.addElementsToView()\`, \`ea.createSVG()\`, \`utils.inputPrompt()\`). **Always** use \`await\` when calling these functions to ensure your script executes in the correct order.
|
||||
* **Version Checking:** At the beginning of your script, include a check like \`if(!ea.verifyMinimumPluginVersion("1.X.X")) { new Notice(...); return; }\` to ensure the user has a compatible version of the Excalidraw plugin, preventing errors from missing API functions.
|
||||
* **Accessing Obsidian API:** The full Obsidian API is available via \`ea.obsidian\`. For example, use \`new ea.obsidian.Notice("message")\` or \`ea.obsidian.normalizePath(filepath)\`.
|
||||
* **Visibility vs. Deletion:**
|
||||
* To temporarily hide an element, set \`element.opacity = 0\`. It's good practice to store the original opacity in \`customData\` so it can be restored. It is also recommended to lock hidden elements so they do not get accidentally selected or moved around.
|
||||
* To permanently remove an element from the scene, set \`element.isDeleted = true\`.
|
||||
* **Image Handling:** When dealing with image elements, use \`ea.getViewFileForImageElement(imageElement)\` to get the corresponding \`TFile\` from the Obsidian vault. This is necessary for any logic that needs to read or manipulate the source image file.
|
||||
|
||||
#### **7. Custom Pens and Perfect Freehand**
|
||||
|
||||
Excalidraw's freehand tool is powered by the open-source Perfect Freehand library. The plugin exposes “custom pens” that bundle:
|
||||
- Canvas style for the next strokes (colors, width, fillStyle, roughness).
|
||||
- Perfect Freehand stroke geometry and behavior (pressure simulation, outline, tapering, easing, etc.).
|
||||
|
||||
Key concepts:
|
||||
- AppState-driven drawing: When \`appState.currentStrokeOptions\` is set, the freedraw tool renders new strokes using those Perfect Freehand options.
|
||||
- Element-level persistence: If a freedraw element has \`element.customData.strokeOptions\`, it is rendered with those options regardless of the current tool state.
|
||||
- Types reference: See \`src/types/penTypes.ts\`. The \`PenOptions\` shape is:
|
||||
\`\`\`ts
|
||||
interface PenOptions {
|
||||
highlighter: boolean; // if true the pen is drawn at the lowest layer, behind all other elements
|
||||
constantPressure: boolean;
|
||||
hasOutline: boolean;
|
||||
outlineWidth: number;
|
||||
options: {
|
||||
thinning: number;
|
||||
smoothing: number;
|
||||
streamline: number;
|
||||
easing: string; // see supported names below
|
||||
start: { cap: boolean; taper: number | boolean; easing: string; };
|
||||
end: { cap: boolean; taper: number | boolean; easing: string; };
|
||||
};
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
Using custom pens from scripts:
|
||||
- Activate a custom pen for drawing:
|
||||
\`\`\`ts
|
||||
// obtain the Excalidraw API
|
||||
const api = ea.getExcalidrawAPI();
|
||||
|
||||
// define Perfect Freehand options (example similar to "finetip")
|
||||
const penOptions = {
|
||||
highlighter: false,
|
||||
constantPressure: true,
|
||||
hasOutline: false,
|
||||
outlineWidth: 1,
|
||||
options: {
|
||||
thinning: -0.5,
|
||||
smoothing: 0.4,
|
||||
streamline: 0.4,
|
||||
easing: "linear",
|
||||
start: { taper: 5, cap: false, easing: "linear" },
|
||||
end: { taper: 5, cap: false, easing: "linear" },
|
||||
},
|
||||
};
|
||||
|
||||
// apply stroke options + canvas style, then switch to freedraw (strokeWidth, color, background, fillStyle are optional)
|
||||
ea.viewUpdateScene({
|
||||
appState: {
|
||||
currentStrokeOptions: penOptions,
|
||||
currentItemStrokeWidth: 0.5,
|
||||
currentItemStrokeColor: "#3E6F8D",
|
||||
currentItemBackgroundColor: "transparent",
|
||||
currentItemFillStyle: "hachure",
|
||||
},
|
||||
});
|
||||
api.setActiveTool({ type: "freedraw" });
|
||||
\`\`\`
|
||||
|
||||
- Clear custom pen (revert to default freedraw behavior):
|
||||
\`\`\`ts
|
||||
ea.viewUpdateScene({ appState: { currentStrokeOptions: null } });
|
||||
\`\`\`
|
||||
|
||||
- Persist custom strokeOptions onto existing freedraw elements:
|
||||
\`\`\`ts
|
||||
const selected = ea.getViewSelectedElements().filter(el => el.type === "freedraw");
|
||||
ea.copyViewElementsToEAforEditing(selected);
|
||||
for (const el of selected) {
|
||||
ea.addAppendUpdateCustomData(el.id, { strokeOptions: penOptions });
|
||||
}
|
||||
await ea.addElementsToView();
|
||||
\`\`\`
|
||||
|
||||
Notes:
|
||||
- New strokes respect \`appState.currentStrokeOptions\` at draw time. Existing elements only change if you update their \`customData.strokeOptions\`.
|
||||
- For pens that should behave like real markers/highlighters, set \`highlighter: true\` and often \`constantPressure: true\` with an \`outlineWidth\` for the edge.
|
||||
|
||||
Supported easing names (string values for \`options.easing\`, \`options.start.easing\`, \`options.end.easing\`):
|
||||
linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, easeInBack, easeOutBack, easeInOutBack, easeInElastic, easeOutElastic, easeInOutElastic, easeInBounce, easeOutBounce, easeInOutBounce.
|
||||
|
||||
Example freedraw element carrying \`customData.strokeOptions\`:
|
||||
\`\`\`json
|
||||
{"type":"excalidraw/clipboard","elements":[{"id":"...","type":"freedraw","strokeColor":"#3E6F8D","backgroundColor":"transparent","fillStyle":"hachure","strokeWidth":0.5,"roughness":0,"customData":{"strokeOptions":{"highlighter":false,"hasOutline":false,"outlineWidth":0,"constantPressure":true,"options":{"smoothing":0.4,"thinning":-0.5,"streamline":0.4,"easing":"linear","start":{"taper":5,"cap":false,"easing":"linear"},"end":{"taper":5,"cap":false,"easing":"linear"}}}}}],"files":{}}
|
||||
\`\`\`
|
||||
|
||||
`;
|
||||
|
||||
const SCRIPT_INTRO = `# Excalidraw Script Library Examples
|
||||
|
||||
This is an automatically generated knowledge base intended for Retrieval Augmented Generation (RAG) and other AI-assisted workflows (e.g. NotebookLM or local embeddings tools).
|
||||
Its purpose:
|
||||
- Provide a single, query-friendly corpus of all Excalidraw Automate scripts.
|
||||
- Serve as a practical pattern and snippet library for developers learning Excalidraw Automate.
|
||||
@@ -18,9 +187,9 @@ Its purpose:
|
||||
- Enable AI tools to answer questions about how to manipulate the Excalidraw canvas, elements, styling, or integration features by referencing real, working examples.
|
||||
|
||||
Content structure:
|
||||
1. Intro (this section)
|
||||
1. SCRIPT_INTRO (this section)
|
||||
2. The curated script overview (index-new.md)
|
||||
3. Raw source of every *.md script in /ea-scripts (each fenced code block is auto-closed to ensure well‑formed aggregation)
|
||||
3. Raw source of every *.md script in /ea-scripts (each fenced code block is auto-closed to ensure well-formed aggregation)
|
||||
|
||||
Generated on: ${new Date().toISOString()}
|
||||
|
||||
@@ -28,6 +197,35 @@ Generated on: ${new Date().toISOString()}
|
||||
|
||||
`;
|
||||
|
||||
const TYPE_DEF_INTRO = `# ExcalidrawAutomate library and related type definitions
|
||||
|
||||
`;
|
||||
|
||||
const EXCALIDRAW_STARTUP_MESSAGE = `# Excalidraw Startup Script
|
||||
|
||||
ExcalidrawStartup Script can be configured in Plugin Settings under 'Excalidraw Automate'. When defined this script runs automatically when the Excalidraw plugin is loaded to Obsidian. The user can add automation tasks here that they want to run on every startup of Excalidraw in Obsidian such as defining Excalidraw event handlers (also known as hooks).
|
||||
|
||||
Two files follow. First the template startup script with documenation comments, then an actual startup script example with implemented functionality.
|
||||
`;
|
||||
const EXCALIDRAW_STARTUP_TEMPLATE = "src/constants/assets/startupScript.md";
|
||||
const EXCALIDRAW_STARTUP_EXAMPLE = "docs/AITrainingData/ExcalidrawStartupExample.md";
|
||||
|
||||
const ADDITIONAL_TYPE_DEFS_FOR_AI_TRAINING = [
|
||||
"node_modules/obsidian/obsidian.d.ts",
|
||||
];
|
||||
|
||||
const TYPE_DEF_WHITELIST = [
|
||||
"lib/shared/ExcalidrawAutomate.d.ts",
|
||||
"lib/types/excalidrawAutomateTypes.d.ts",
|
||||
"lib/types/penTypes.d.ts",
|
||||
"lib/types/utilTypes.d.ts",
|
||||
"lib/types/exportUtilTypes.d.ts",
|
||||
"lib/types/embeddedFileLoaderTypes.d.ts",
|
||||
"lib/types/AIUtilTypes.d.ts",
|
||||
"node_modules/@zsviczian/excalidraw/types/element/src/types.d.ts",
|
||||
"node_modules/@zsviczian/excalidraw/types/excalidraw/types.d.ts",
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns true if content contains at least one line starting with ```
|
||||
* and has an odd number of fences (unbalanced).
|
||||
@@ -37,6 +235,259 @@ function needsClosingFence(content) {
|
||||
return fenceCount > 0 && fenceCount % 2 === 1;
|
||||
}
|
||||
|
||||
// Add: helpers for type-def aggregation
|
||||
function normalizeEOL(str) {
|
||||
return str.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
function stripBOM(str) {
|
||||
return str.replace(/^\uFEFF/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove top-of-file imports/references while preserving initial comments/blank lines.
|
||||
* Also removes bare "export {}" lines (module markers).
|
||||
*/
|
||||
function stripTopImports(content) {
|
||||
const lines = normalizeEOL(stripBOM(content)).split('\n');
|
||||
const out = [];
|
||||
let inTopRegion = true;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
|
||||
const isImport =
|
||||
/^\s*import\s+type\s+/.test(line) ||
|
||||
/^\s*import\s+/.test(line) ||
|
||||
/^\s*import\(/.test(line);
|
||||
|
||||
const isTripleRef = /^\s*\/\/\/\s*<reference/.test(line);
|
||||
const isBareExportModule = /^\s*export\s*\{\s*\};?\s*$/.test(line);
|
||||
|
||||
if (inTopRegion) {
|
||||
if (isImport || isTripleRef) {
|
||||
// drop
|
||||
continue;
|
||||
}
|
||||
// comments and blanks are kept, top-region continues until first code (non-comment/non-blank/non-import)
|
||||
const isBlank = /^\s*$/.test(line);
|
||||
const isLineComment = /^\s*\/\//.test(line);
|
||||
const isBlockCommentStart = /^\s*\/\*/.test(line);
|
||||
|
||||
if (!isBlank && !isLineComment && !isBlockCommentStart) {
|
||||
inTopRegion = false;
|
||||
}
|
||||
if (!isBareExportModule) out.push(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isBareExportModule) out.push(line);
|
||||
}
|
||||
|
||||
return out.join('\n').trim() + '\n';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a nice section header for the concatenated file.
|
||||
*/
|
||||
function makeSectionHeader(relPath) {
|
||||
const stars = '*'.repeat(Math.max(6, Math.min(38, relPath.length + 6)));
|
||||
return [
|
||||
`/* ${stars} */`,
|
||||
`/* ${relPath} */`,
|
||||
`/* ${stars} */`,
|
||||
].join('\n') + '\n';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the concatenated types markdown body from the whitelist only.
|
||||
* - Removes top-of-file imports
|
||||
* - Adds section headers with relative paths
|
||||
* - Wraps all in one ```js code fence
|
||||
*/
|
||||
function buildTypeDefMarkdown() {
|
||||
const entries = TYPE_DEF_WHITELIST.map((rel) => ({
|
||||
rel,
|
||||
abs: path.join(ROOT, ...rel.split('/')),
|
||||
}));
|
||||
|
||||
let body = '```js\n';
|
||||
for (const { rel, abs } of entries) {
|
||||
if (!fs.existsSync(abs)) {
|
||||
console.warn('[script-library] Whitelist file missing:', rel);
|
||||
continue;
|
||||
}
|
||||
let content = fs.readFileSync(abs, 'utf8');
|
||||
content = stripTopImports(content);
|
||||
|
||||
body += makeSectionHeader(rel);
|
||||
body += content.trimEnd() + '\n\n';
|
||||
}
|
||||
body += '```\n';
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build additional type defs used only in AI_TRAINING_OUT (e.g. obsidian.d.ts).
|
||||
*/
|
||||
function buildAdditionalTypeDefsMarkdown() {
|
||||
const entries = ADDITIONAL_TYPE_DEFS_FOR_AI_TRAINING.map((rel) => ({
|
||||
rel,
|
||||
abs: path.join(ROOT, ...rel.split('/')),
|
||||
}));
|
||||
|
||||
let body = '```js\n';
|
||||
for (const { rel, abs } of entries) {
|
||||
if (!fs.existsSync(abs)) {
|
||||
console.warn('[script-library] Additional type def missing:', rel);
|
||||
continue;
|
||||
}
|
||||
let content = fs.readFileSync(abs, 'utf8');
|
||||
content = stripTopImports(content);
|
||||
body += makeSectionHeader(rel);
|
||||
body += content.trimEnd() + '\n\n';
|
||||
}
|
||||
body += '```\n';
|
||||
return body;
|
||||
}
|
||||
|
||||
// NEW: Resolve module specifiers from types/excalidraw/index.d.ts to absolute .d.ts paths
|
||||
function resolveExcalModulePath(spec, excalIndexAbs) {
|
||||
const baseTypesRoot = path.join(ROOT, 'node_modules', '@zsviczian', 'excalidraw', 'types');
|
||||
if (spec.startsWith('@excalidraw/')) {
|
||||
const sub = spec.slice('@excalidraw/'.length); // e.g. 'element', 'element/bounds'
|
||||
const parts = sub.split('/');
|
||||
const pkg = parts.shift(); // 'element' | 'common' | 'utils'
|
||||
const rest = parts;
|
||||
if (!pkg) return null;
|
||||
const base = path.join(baseTypesRoot, pkg);
|
||||
if (rest.length === 0) {
|
||||
return path.join(base, 'src', 'index.d.ts');
|
||||
}
|
||||
return path.join(base, 'src', ...rest) + '.d.ts';
|
||||
}
|
||||
// relative to the excalidraw index.d.ts
|
||||
if (spec.startsWith('.')) {
|
||||
const dir = path.dirname(excalIndexAbs);
|
||||
return path.resolve(dir, spec) + '.d.ts';
|
||||
}
|
||||
// anything else is not expected
|
||||
return null;
|
||||
}
|
||||
|
||||
// NEW: Extract function signatures for a set of names from a .d.ts file
|
||||
function extractFunctionSignaturesFromModule(absPath, names) {
|
||||
const out = {};
|
||||
if (!absPath || !fs.existsSync(absPath)) {
|
||||
return out;
|
||||
}
|
||||
const content = fs.readFileSync(absPath, 'utf8');
|
||||
|
||||
for (const rawName of names) {
|
||||
const name = rawName.trim();
|
||||
if (!name) continue;
|
||||
|
||||
// Try "export declare function NAME ..."
|
||||
let m = content.match(new RegExp(`export\\s+declare\\s+function\\s+${name}[\\s\\S]*?;`, 'm'));
|
||||
if (m) {
|
||||
out[name] = m[0].trim();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try "declare function NAME ..." (re-exported later)
|
||||
m = content.match(new RegExp(`(^|\\n)declare\\s+function\\s+${name}[\\s\\S]*?;`, 'm'));
|
||||
if (m) {
|
||||
// Ensure it starts with export for readability
|
||||
out[name] = m[0].replace(/^\s*declare\s+/, 'export declare ').trim();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try "export declare const NAME: (...args) => ...;"
|
||||
m = content.match(new RegExp(`export\\s+declare\\s+const\\s+${name}\\s*:\\s*[\\s\\S]*?=>[\\s\\S]*?;`, 'm'));
|
||||
if (m) {
|
||||
out[name] = m[0].trim();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try "export declare function-type via type alias" (rare) - fallback to any const function shape
|
||||
m = content.match(new RegExp(`export\\s+declare\\s+(?:var|let|const)\\s+${name}\\s*:\\s*[\\s\\S]*?;`, 'm'));
|
||||
if (m && /=>/.test(m[0])) {
|
||||
out[name] = m[0].trim();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// NEW: Build "ExcalidrawLib module functions" section from index.d.ts
|
||||
function buildExcalidrawLibFunctionsSection() {
|
||||
const excalIndexRel = 'node_modules/@zsviczian/excalidraw/types/excalidraw/index.d.ts';
|
||||
const excalIndexAbs = path.join(ROOT, ...excalIndexRel.split('/'));
|
||||
if (!fs.existsSync(excalIndexAbs)) {
|
||||
console.warn('[script-library] Missing Excalidraw index.d.ts:', excalIndexRel);
|
||||
return '';
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(excalIndexAbs, 'utf8');
|
||||
const reExport = /export\s*\{\s*([\s\S]*?)\s*\}\s*from\s*["']([^"']+)["'];/g;
|
||||
|
||||
// Collect names by source module
|
||||
const moduleToNames = new Map();
|
||||
for (const match of content.matchAll(reExport)) {
|
||||
const namesChunk = match[1];
|
||||
const spec = match[2];
|
||||
// skip if the export list contains only types we know we shouldn't include? We'll filter later by signature detection.
|
||||
const names = namesChunk
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
if (!names.length) continue;
|
||||
const abs = resolveExcalModulePath(spec, excalIndexAbs);
|
||||
if (!abs) continue;
|
||||
const key = spec;
|
||||
const curr = moduleToNames.get(key) || { abs, names: new Set() };
|
||||
for (const n of names) curr.names.add(n);
|
||||
moduleToNames.set(key, curr);
|
||||
}
|
||||
|
||||
// Extract signatures
|
||||
const seen = new Set();
|
||||
const sections = [];
|
||||
let functionsFound = 0;
|
||||
|
||||
for (const [spec, { abs, names }] of moduleToNames) {
|
||||
const sigs = extractFunctionSignaturesFromModule(abs, Array.from(names));
|
||||
const sigEntries = Object.entries(sigs)
|
||||
.filter(([name]) => {
|
||||
if (seen.has(name)) return false;
|
||||
seen.add(name);
|
||||
return true;
|
||||
})
|
||||
.sort(([a], [b]) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
|
||||
|
||||
if (!sigEntries.length) continue;
|
||||
|
||||
const rel = path.relative(ROOT, abs).replace(/\\/g, '/');
|
||||
const header = makeSectionHeader(`${spec} -> ${rel}`).replace(/\*\/\n\/\*/g, '*\/\n/*'); // keep style
|
||||
sections.push(header + sigEntries.map(([, s]) => s).join('\n') + '\n');
|
||||
functionsFound += sigEntries.length;
|
||||
}
|
||||
|
||||
if (!sections.length) {
|
||||
console.warn('[script-library] No function signatures found in ExcalidrawLib exports.');
|
||||
}
|
||||
|
||||
const body =
|
||||
'# ExcalidrawLib module functions\n\n' +
|
||||
'The following functions are exposed via window.ExcalidrawLib. Signatures are extracted from TypeScript declarations.\n\n' +
|
||||
'```ts\n' +
|
||||
sections.join('\n') +
|
||||
'```\n';
|
||||
|
||||
console.log(`[script-library] Collected ${functionsFound} ExcalidrawLib function signatures`);
|
||||
return body;
|
||||
}
|
||||
|
||||
function main() {
|
||||
console.log('[script-library] Generating Excalidraw Script Library...');
|
||||
if (!fs.existsSync(EA_SCRIPTS_DIR)) {
|
||||
@@ -47,11 +498,11 @@ function main() {
|
||||
console.error('index-new.md not found:', INDEX_NEW);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!fs.existsSync(DIST_DIR)) {
|
||||
fs.mkdirSync(DIST_DIR, { recursive: true });
|
||||
if (!fs.existsSync(OUT_DIR)) {
|
||||
fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||
}
|
||||
|
||||
let output = INTRO;
|
||||
let output = SCRIPT_INTRO;
|
||||
|
||||
console.log('[script-library] Adding index-new.md');
|
||||
const indexNewContent = fs.readFileSync(INDEX_NEW, 'utf8');
|
||||
@@ -90,8 +541,76 @@ function main() {
|
||||
}
|
||||
}
|
||||
|
||||
fs.writeFileSync(OUTPUT_FILE, output, 'utf8');
|
||||
console.log('[script-library] Wrote:', OUTPUT_FILE);
|
||||
fs.writeFileSync(SCRIPT_LIBRARY_OUT, output, 'utf8');
|
||||
console.log('[script-library] Wrote:', SCRIPT_LIBRARY_OUT);
|
||||
|
||||
// Generate TYPE_DEF_OUT from whitelist
|
||||
try {
|
||||
console.log('[script-library] Generating Type Definition Library...');
|
||||
const typeDefs = TYPE_DEF_INTRO + '\n' + buildTypeDefMarkdown();
|
||||
fs.writeFileSync(TYPE_DEF_OUT, typeDefs, 'utf8');
|
||||
console.log('[script-library] Wrote:', TYPE_DEF_OUT);
|
||||
} catch (e) {
|
||||
console.error('[script-library] Failed to generate TYPE_DEF_OUT:', e);
|
||||
}
|
||||
|
||||
// NEW: Generate AI_TRAINING_OUT
|
||||
try {
|
||||
console.log('[script-library] Generating AI Training bundle...');
|
||||
const typeDefContent = fs.existsSync(TYPE_DEF_OUT)
|
||||
? fs.readFileSync(TYPE_DEF_OUT, 'utf8')
|
||||
: (TYPE_DEF_INTRO + '\n' + buildTypeDefMarkdown());
|
||||
const additionalTypeDefs = buildAdditionalTypeDefsMarkdown();
|
||||
const scriptLibContent = fs.existsSync(SCRIPT_LIBRARY_OUT)
|
||||
? fs.readFileSync(SCRIPT_LIBRARY_OUT, 'utf8')
|
||||
: '';
|
||||
|
||||
// NEW: load startup template and example
|
||||
const startupTemplatePath = path.join(ROOT, ...EXCALIDRAW_STARTUP_TEMPLATE.split('/'));
|
||||
const startupExamplePath = path.join(ROOT, ...EXCALIDRAW_STARTUP_EXAMPLE.split('/'));
|
||||
const startupTemplate = fs.existsSync(startupTemplatePath)
|
||||
? fs.readFileSync(startupTemplatePath, 'utf8').replace(/\r\n/g, '\n').trim()
|
||||
: (console.warn('[script-library] Missing startup template:', EXCALIDRAW_STARTUP_TEMPLATE), '');
|
||||
const startupExample = fs.existsSync(startupExamplePath)
|
||||
? fs.readFileSync(startupExamplePath, 'utf8').replace(/\r\n/g, '\n').trim()
|
||||
: (console.warn('[script-library] Missing startup example:', EXCALIDRAW_STARTUP_EXAMPLE), '');
|
||||
|
||||
const startupSection =
|
||||
'\n---\n\n' +
|
||||
EXCALIDRAW_STARTUP_MESSAGE +
|
||||
'\n' +
|
||||
(startupTemplate
|
||||
? `<!-- ${EXCALIDRAW_STARTUP_TEMPLATE} -->\n${startupTemplate}\n\n`
|
||||
: '') +
|
||||
(startupExample
|
||||
? `<!-- ${EXCALIDRAW_STARTUP_EXAMPLE} -->\n${startupExample}\n`
|
||||
: '');
|
||||
|
||||
// NEW: Build ExcalidrawLib functions section
|
||||
const excalidrawLibFunctionsSection = buildExcalidrawLibFunctionsSection();
|
||||
|
||||
const combined =
|
||||
(AI_TRAINING_INTRO +
|
||||
'\n---\n\n' +
|
||||
typeDefContent.trim() +
|
||||
'\n\n---\n\n' +
|
||||
additionalTypeDefs +
|
||||
'\n\n---\n\n' +
|
||||
excalidrawLibFunctionsSection +
|
||||
'\n---\n\n' +
|
||||
scriptLibContent.trim() +
|
||||
startupSection +
|
||||
'\n')
|
||||
.replaceAll("https://youtu.be/", "YouTube: ")
|
||||
.replaceAll("https://www.youtube.com/watch?v=", "YouTube: ")
|
||||
.replaceAll("https://www.youtube.com/", "YouTube: "); // prevent accidental link triggering
|
||||
|
||||
fs.writeFileSync(AI_TRAINING_OUT, combined, 'utf8');
|
||||
console.log('[script-library] Wrote:', AI_TRAINING_OUT);
|
||||
} catch (e) {
|
||||
console.error('[script-library] Failed to generate AI_TRAINING_OUT:', e);
|
||||
}
|
||||
|
||||
console.log('[script-library] Done.');
|
||||
}
|
||||
|
||||
|
||||
@@ -879,7 +879,7 @@ export const penIcon = (pen: PenStyle) => {
|
||||
}
|
||||
|
||||
export const stringToSVG = (svg: string) => {
|
||||
if(svg.match('class="skip"')) {
|
||||
if(svg.match(/class=("|')[^"']*(lucide|skip)[^"']*("|')/)) {
|
||||
return <div dangerouslySetInnerHTML={{__html: svg}}></div>
|
||||
}
|
||||
svg = svg
|
||||
|
||||
@@ -246,6 +246,7 @@ export const FRONTMATTER_KEYS:{[key:string]: {name: string, type: string, depric
|
||||
"export-padding": {name: "excalidraw-export-padding", type: "number"},
|
||||
"export-pngscale": {name: "excalidraw-export-pngscale", type: "number"},
|
||||
"export-embed-scene": {name: "excalidraw-export-embed-scene", type: "checkbox"},
|
||||
"export-internal-links": {name: "excalidraw-export-internal-links", type: "checkbox"},
|
||||
"link-prefix": {name: "excalidraw-link-prefix", type: "text"},
|
||||
"url-prefix": {name: "excalidraw-url-prefix", type: "text"},
|
||||
"link-brackets": {name: "excalidraw-link-brackets", type: "checkbox"},
|
||||
|
||||
+22
-7
@@ -66,7 +66,7 @@ import { ScriptEngine } from "../shared/Scripts";
|
||||
import { hoverEvent, initializeMarkdownPostProcessor, markdownPostProcessor, legacyExcalidrawPopoverObserver } from "./managers/MarkdownPostProcessor";
|
||||
import { FieldSuggester } from "../shared/Suggesters/FieldSuggester";
|
||||
import { ReleaseNotes } from "../shared/Dialogs/ReleaseNotes";
|
||||
import { Packages } from "../types/types";
|
||||
import { DeviceType, Packages } from "../types/types";
|
||||
import { PreviewImageType } from "../types/utilTypes";
|
||||
import { emulateCTRLClickForLinks, linkClickModifierType, PaneTarget } from "../utils/modifierkeyHelper";
|
||||
import { imageCache } from "../shared/ImageCache";
|
||||
@@ -90,6 +90,8 @@ import { CommandManager } from "./managers/CommandManager";
|
||||
import { EventManager } from "./managers/EventManager";
|
||||
import { UniversalInsertFileModal } from "src/shared/Dialogs/UniversalInsertFileModal";
|
||||
import en from "src/lang/locale/en";
|
||||
import { get } from "http";
|
||||
import { getHighlightColor } from "src/utils/dynamicStyling";
|
||||
|
||||
declare const PLUGIN_VERSION:string;
|
||||
declare const INITIAL_TIMESTAMP: number;
|
||||
@@ -116,6 +118,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
public settings: ExcalidrawSettings;
|
||||
public activeExcalidrawView: ExcalidrawView = null;
|
||||
public lastActiveExcalidrawFilePath: string = null;
|
||||
public lastActiveExcalidrawLeafID: string = null;
|
||||
public hover: { linkText: string; sourcePath: string } = {
|
||||
linkText: null,
|
||||
sourcePath: null,
|
||||
@@ -415,7 +418,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
try {
|
||||
this.isReady = true;
|
||||
await switchToExcalidraw(this.app);
|
||||
this.switchToExcalidarwAfterLoad();
|
||||
this.switchToExcalidrawAfterLoad();
|
||||
} catch (e) {
|
||||
new Notice("Error switching views to Excalidraw", 6000);
|
||||
console.error("Error switching views to Excalidraw", e);
|
||||
@@ -558,7 +561,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
let fontMetrics = f.extension.startsWith("woff") ? undefined : await getFontMetrics(fourthFontDataURL, "Local Font");
|
||||
|
||||
if (!fontMetrics) {
|
||||
console.log("Font Metrics not found, using default");
|
||||
//console.log("Font Metrics not found, using default");
|
||||
fontMetrics = {
|
||||
unitsPerEm: 1000,
|
||||
ascender: 750,
|
||||
@@ -620,8 +623,8 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
/**
|
||||
* Must be called after the workspace is ready
|
||||
*/
|
||||
private switchToExcalidarwAfterLoad() {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.switchToExcalidarwAfterLoad, `ExcalidrawPlugin.switchToExcalidarwAfterLoad`);
|
||||
private switchToExcalidrawAfterLoad() {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.switchToExcalidrawAfterLoad, `ExcalidrawPlugin.switchToExcalidrawAfterLoad`);
|
||||
let leaf: WorkspaceLeaf;
|
||||
for (leaf of this.app.workspace.getLeavesOfType("markdown")) {
|
||||
if ( leaf.view instanceof MarkdownView && this.isExcalidrawFile(leaf.view.file)) {
|
||||
@@ -1265,10 +1268,14 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
return JSON_parse(this.settings.library);
|
||||
}
|
||||
|
||||
public setStencilLibrary(library: {}) {
|
||||
public async setStencilLibrary(library: {}) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.setStencilLibrary,`ExcalidrawPlugin.setStencilLibrary`, library);
|
||||
this.settings.library = "deprecated";
|
||||
if(JSON.stringify(this.settings.library2) === JSON.stringify(library)) {
|
||||
return;
|
||||
}
|
||||
this.settings.library2 = library;
|
||||
await this.saveSettings();
|
||||
}
|
||||
|
||||
public triggerEmbedUpdates(filepath?: string) {
|
||||
@@ -1482,4 +1489,12 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
public getLabel(key: keyof typeof en): string {
|
||||
return t(key);
|
||||
}
|
||||
}
|
||||
|
||||
public getObsidianDevice(): DeviceType {
|
||||
return DEVICE;
|
||||
}
|
||||
|
||||
public getHighlightColor(sceneBgColor: string, opacity: number = 1): string {
|
||||
return getHighlightColor(this.ea, sceneBgColor, opacity);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ import { carveOutImage, carveOutPDF, createImageCropperFile } from "../../utils/
|
||||
import { showFrameSettings } from "../../shared/Dialogs/FrameSettings";
|
||||
import { insertImageToView } from "../../utils/excalidrawViewUtils";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { UIModeSettings } from "src/shared/Dialogs/UIModeSettings";
|
||||
|
||||
declare const PLUGIN_VERSION:string;
|
||||
|
||||
@@ -987,12 +988,11 @@ export class CommandManager {
|
||||
name: t("TOGGLE_LEFTHANDED_MODE"),
|
||||
checkCallback: (checking: boolean) => {
|
||||
if (checking) {
|
||||
if(DEVICE.isMobile) return false;
|
||||
if(this.app.workspace.getActiveViewOfType(ExcalidrawView)) {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
const api = view?.excalidrawAPI;
|
||||
if(!api) return false;
|
||||
const st = api.getAppState();
|
||||
if(!st.trayModeEnabled) return false;
|
||||
const api = view?.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
if(!api.isTrayModeEnabled()) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1012,6 +1012,24 @@ export class CommandManager {
|
||||
},
|
||||
});
|
||||
|
||||
this.addCommand({
|
||||
id: "toggle-enable-context-menu",
|
||||
name: t("TOGGLE_ENABLE_CONTEXT_MENU"),
|
||||
checkCallback: (checking: boolean) => {
|
||||
if (checking) {
|
||||
if(this.app.workspace.getActiveViewOfType(ExcalidrawView)) {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
const api = view?.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
view.toggleEnableContextMenu();
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
this.addCommand({
|
||||
id: "flip-image",
|
||||
name: t("FLIP_IMAGE"),
|
||||
@@ -1642,7 +1660,7 @@ export class CommandManager {
|
||||
|
||||
this.addCommand({
|
||||
id: "tray-mode",
|
||||
name: t("TRAY_MODE"),
|
||||
name: t("UI_MODE"),
|
||||
checkCallback: (checking: boolean) => {
|
||||
if (checking) {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
@@ -1657,7 +1675,8 @@ export class CommandManager {
|
||||
}
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (view && view.excalidrawAPI) {
|
||||
view.toggleTrayMode();
|
||||
const uiModeSettings = new UIModeSettings(this.plugin);
|
||||
uiModeSettings.open();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -53,6 +53,10 @@ export class EventManager {
|
||||
window.clearTimeout(this.leafChangeTimeout);
|
||||
this.leafChangeTimeout = null;
|
||||
}
|
||||
if(this.debunceActiveLeafChangeHandlerTimer) {
|
||||
window.clearTimeout(this.debunceActiveLeafChangeHandlerTimer);
|
||||
this.debunceActiveLeafChangeHandlerTimer = null;
|
||||
}
|
||||
this.removeEventLisnters.forEach((removeEventListener) =>
|
||||
removeEventListener(),
|
||||
);
|
||||
@@ -189,6 +193,15 @@ export class EventManager {
|
||||
this.plugin.lastPDFLeafID = leaf.id;
|
||||
}
|
||||
|
||||
if (leaf.view && leaf.view.getViewType() === VIEW_TYPE_EXCALIDRAW) {
|
||||
this.plugin.lastActiveExcalidrawLeafID = leaf.id;
|
||||
} else {
|
||||
const lastLeaf = this.app.workspace.getLeafById(this.plugin.lastActiveExcalidrawLeafID);
|
||||
if(!lastLeaf || !(lastLeaf.view instanceof ExcalidrawView)) {
|
||||
this.plugin.lastActiveExcalidrawLeafID = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.leafChangeTimeout) {
|
||||
window.clearTimeout(this.leafChangeTimeout);
|
||||
}
|
||||
@@ -242,7 +255,7 @@ export class EventManager {
|
||||
|
||||
if (previouslyActiveEV && previouslyActiveEV !== newActiveviewEV) {
|
||||
if (previouslyActiveEV.leaf !== leaf) {
|
||||
//if loading new view to same leaf then don't save. Excalidarw view will take care of saving anyway.
|
||||
//if loading new view to same leaf then don't save. Excalidraw view will take care of saving anyway.
|
||||
//avoid double saving
|
||||
if(previouslyActiveEV?.isDirty() && !previouslyActiveEV.semaphores?.viewunload) {
|
||||
await previouslyActiveEV.save(true); //this will update transclusions in the drawing
|
||||
@@ -364,4 +377,4 @@ export class EventManager {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -562,9 +562,9 @@ export class PluginFileManager {
|
||||
return;
|
||||
}
|
||||
|
||||
const isExcalidarwFile = this.getExcalidrawFiles().has(file);
|
||||
const isExcalidrawFile = this.getExcalidrawFiles().has(file);
|
||||
this.updateFileCache(file, undefined, true);
|
||||
if (!isExcalidarwFile) {
|
||||
if (!isExcalidrawFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -614,4 +614,4 @@ export class PluginFileManager {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
import { DEVICE, RERENDER_EVENT } from "../../constants/constants";
|
||||
import { EmbeddedFilesLoader } from "../../shared/EmbeddedFileLoader";
|
||||
import { createPNG, createSVG } from "../../utils/excalidrawAutomateUtils";
|
||||
import { ExportSettings } from "../../view/ExcalidrawView";
|
||||
import ExcalidrawPlugin from "../main";
|
||||
import {getIMGFilename,} from "../../utils/fileUtils";
|
||||
import {
|
||||
@@ -30,6 +29,7 @@ import { CustomMutationObserver, debug, DEBUGGING } from "../../utils/debugHelpe
|
||||
import { getExcalidrawFileForwardLinks } from "../../utils/excalidrawViewUtils";
|
||||
import { linkPrompt } from "../../shared/Dialogs/Prompt";
|
||||
import { isHTMLElement } from "../../utils/typechecks";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
|
||||
interface imgElementAttributes {
|
||||
file?: TFile;
|
||||
@@ -136,8 +136,17 @@ const _getPNG = async ({imgAttributes,filenameParts,theme,cacheReady,img,file,ex
|
||||
if (!png) {
|
||||
return null;
|
||||
}
|
||||
img.src = URL.createObjectURL(png);
|
||||
cacheReady && imageCache.addImageToCache(cacheKey, img.src, png);
|
||||
const blobUrl = URL.createObjectURL(png);
|
||||
img.src = blobUrl;
|
||||
|
||||
// Revoke the ObjectURL after the image loads or fails to prevent memory leaks
|
||||
if (!cacheReady) {
|
||||
const cleanup = () => URL.revokeObjectURL(blobUrl);
|
||||
img.addEventListener('load', cleanup, { once: true });
|
||||
img.addEventListener('error', cleanup, { once: true });
|
||||
}
|
||||
|
||||
cacheReady && imageCache.addImageToCache(cacheKey, blobUrl, png);
|
||||
return img;
|
||||
}
|
||||
|
||||
@@ -382,6 +391,14 @@ const addSVGToImgSrc = (img: HTMLImageElement, svg: SVGSVGElement, cacheReady: b
|
||||
const blob = new Blob([svgString], { type: 'image/svg+xml' });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
img.setAttribute("src", blobUrl);
|
||||
|
||||
// Revoke the ObjectURL after the image loads or fails to prevent memory leaks
|
||||
if (!cacheReady) {
|
||||
const cleanup = () => URL.revokeObjectURL(blobUrl);
|
||||
img.addEventListener('load', cleanup, { once: true });
|
||||
img.addEventListener('error', cleanup, { once: true });
|
||||
}
|
||||
|
||||
cacheReady && imageCache.addImageToCache(cacheKey, blobUrl, blob);
|
||||
return img;
|
||||
}
|
||||
@@ -812,7 +829,10 @@ const tmpObsidianWYSIWYG = async (
|
||||
}
|
||||
if(warningEl) {
|
||||
const dataHeading = warningEl.getAttr("data-heading");
|
||||
const ref = dataHeading.match(/.+(\^(?:group=|area=|frame=|clippedframe=)[A-Za-z0-9_-]{8,21})/)?.[1];
|
||||
const ref = dataHeading.match(/.+(\^(?:group=|area=|frame=|clippedframe=)[A-Za-z0-9_-]{8,21})/)?.[1]
|
||||
// I am unsure if this works with all Obsidian translations,
|
||||
// thus I kept the first with the fix ID length and have the frame name as fallback
|
||||
?? dataHeading.match(/.+(\^(?:group=|area=|frame=|clippedframe=)[\p{L}\p{N}_ -]+)/u)?.[1];
|
||||
if(ref) {
|
||||
attr.fname = file.path + "#" +ref;
|
||||
areaPreview = true;
|
||||
@@ -836,6 +856,13 @@ const tmpObsidianWYSIWYG = async (
|
||||
imgDiv.firstChild.style.maxHeight = "100%";
|
||||
imgDiv.firstChild.style.maxWidth = null;
|
||||
}
|
||||
// Resolve the cyclic size dependency by applying a CSS width and/or height
|
||||
if(!onCanvas && isHoverPopover && imgDiv.firstChild instanceof HTMLImageElement) {
|
||||
internalEmbedDiv.style.setProperty("--popover-width", attr.fwidth + "px");
|
||||
internalEmbedDiv.style.setProperty("--popover-height", attr.fheight + "px");
|
||||
internalEmbedDiv.style.width = "var(--popover-width)";
|
||||
internalEmbedDiv.style.height = "var(--popover-height)";
|
||||
}
|
||||
internalEmbedDiv.appendChild(imgDiv.firstChild);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,19 +41,20 @@ export class ObserverManager {
|
||||
this.removeModalContainerObserver();
|
||||
if (this.workspaceDrawerLeftObserver) {
|
||||
this.workspaceDrawerLeftObserver.disconnect();
|
||||
this.workspaceDrawerLeftObserver = null;
|
||||
}
|
||||
if (this.workspaceDrawerRightObserver) {
|
||||
this.workspaceDrawerRightObserver.disconnect();
|
||||
this.workspaceDrawerRightObserver = null;
|
||||
}
|
||||
if (this.fileExplorerObserver) {
|
||||
this.fileExplorerObserver.disconnect();
|
||||
this.fileExplorerObserver = null;
|
||||
}
|
||||
if (this.workspaceDrawerRightObserver) {
|
||||
this.workspaceDrawerRightObserver.disconnect();
|
||||
}
|
||||
if (this.workspaceDrawerLeftObserver) {
|
||||
this.workspaceDrawerLeftObserver.disconnect();
|
||||
}
|
||||
|
||||
this.plugin = null;
|
||||
this.app = null;
|
||||
this.activeViewDoc = null;
|
||||
}
|
||||
|
||||
public addThemeObserver() {
|
||||
|
||||
+115
-44
@@ -3,10 +3,8 @@ import {
|
||||
ButtonComponent,
|
||||
DropdownComponent,
|
||||
getIcon,
|
||||
htmlToMarkdown,
|
||||
Modifier,
|
||||
normalizePath,
|
||||
Notice,
|
||||
PluginSettingTab,
|
||||
Setting,
|
||||
TextComponent,
|
||||
@@ -26,9 +24,8 @@ import {
|
||||
} from "src/utils/fileUtils";
|
||||
import { PENS } from "src/utils/pens";
|
||||
import {
|
||||
addIframe,
|
||||
addYouTubeThumbnail,
|
||||
fragWithHTML,
|
||||
setLeftHandedMode,
|
||||
} from "src/utils/utils";
|
||||
import { imageCache } from "src/shared/ImageCache";
|
||||
import { MultiOptionConfirmationPrompt } from "src/shared/Dialogs/Prompt";
|
||||
@@ -47,8 +44,12 @@ import { getExcalidrawViews } from "src/utils/obsidianUtils";
|
||||
import { createSliderWithText } from "src/utils/sliderUtils";
|
||||
import { PDFExportSettingsComponent, PDFExportSettings } from "src/shared/Dialogs/PDFExportSettingsComponent";
|
||||
import { ContentSearcher } from "src/shared/components/ContentSearcher";
|
||||
import { UIMode, UIModeSettingsComponent } from "src/shared/Dialogs/UIModeSettingComponent";
|
||||
import { ScriptSettingValue } from "src/types/excalidrawAutomateTypes";
|
||||
|
||||
export interface ExcalidrawSettings {
|
||||
copyLinkToElemenetAnchorTo100: boolean;
|
||||
copyFrameLinkByName: boolean;
|
||||
disableDoubleClickTextEditing: boolean;
|
||||
folder: string;
|
||||
cropFolder: string;
|
||||
@@ -89,6 +90,8 @@ export interface ExcalidrawSettings {
|
||||
overrideObsidianFontSize: boolean;
|
||||
dynamicStyling: DynamicStyle;
|
||||
isLeftHanded: boolean;
|
||||
desktopUIMode: UIMode;
|
||||
tabletUIMode: UIMode;
|
||||
iframeMatchExcalidrawTheme: boolean;
|
||||
matchTheme: boolean;
|
||||
matchThemeAlways: boolean;
|
||||
@@ -115,6 +118,7 @@ export interface ExcalidrawSettings {
|
||||
focusOnFileTab: boolean;
|
||||
openInMainWorkspace: boolean;
|
||||
showLinkBrackets: boolean;
|
||||
//allowLinkSync: boolean;
|
||||
linkPrefix: string;
|
||||
urlPrefix: string;
|
||||
parseTODO: boolean;
|
||||
@@ -169,18 +173,12 @@ export interface ExcalidrawSettings {
|
||||
mdCSS: string;
|
||||
scriptEngineSettings: {
|
||||
[key:string]: {
|
||||
[key:string]: {
|
||||
value?:string,
|
||||
hidden?: boolean,
|
||||
description?: string,
|
||||
valueset?: string[],
|
||||
height?: number,
|
||||
}
|
||||
[key:string]: ScriptSettingValue;
|
||||
}
|
||||
};
|
||||
defaultTrayMode: boolean;
|
||||
previousRelease: string;
|
||||
showReleaseNotes: boolean;
|
||||
compareManifestToPluginVersion: boolean;
|
||||
showNewVersionNotification: boolean;
|
||||
//mathjaxSourceURL: string;
|
||||
latexBoilerplate: string;
|
||||
@@ -213,6 +211,7 @@ export interface ExcalidrawSettings {
|
||||
aiEnabled: boolean,
|
||||
openAIAPIToken: string,
|
||||
openAIDefaultTextModel: string,
|
||||
openAIDefaultTextModelMaxTokens: number,
|
||||
openAIDefaultVisionModel: string,
|
||||
openAIDefaultImageGenerationModel: string,
|
||||
openAIURL: string,
|
||||
@@ -233,11 +232,14 @@ export interface ExcalidrawSettings {
|
||||
modifierKeyOverrides: {modifiers: Modifier[], key: string}[];
|
||||
showSplashscreen: boolean;
|
||||
pdfSettings: PDFExportSettings;
|
||||
disableContextMenu: boolean;
|
||||
}
|
||||
|
||||
declare const PLUGIN_VERSION:string;
|
||||
|
||||
export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
copyLinkToElemenetAnchorTo100: false,
|
||||
copyFrameLinkByName: false,
|
||||
disableDoubleClickTextEditing: false,
|
||||
folder: "Excalidraw",
|
||||
cropFolder: "",
|
||||
@@ -278,6 +280,8 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
overrideObsidianFontSize: false,
|
||||
dynamicStyling: "colorful",
|
||||
isLeftHanded: false,
|
||||
desktopUIMode: "tray",
|
||||
tabletUIMode: "compact",
|
||||
iframeMatchExcalidrawTheme: true,
|
||||
matchTheme: false,
|
||||
matchThemeAlways: false,
|
||||
@@ -294,7 +298,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
allowPinchZoom: false,
|
||||
allowWheelZoom: false,
|
||||
zoomToFitOnOpen: true,
|
||||
zoomToFitOnResize: true,
|
||||
zoomToFitOnResize: false,
|
||||
zoomToFitMaxLevel: 2,
|
||||
zoomStep: 0.05,
|
||||
zoomMin: 0.1,
|
||||
@@ -311,6 +315,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
focusOnFileTab: true,
|
||||
openInMainWorkspace: true,
|
||||
showLinkBrackets: true,
|
||||
//allowLinkSync: true,
|
||||
allowCtrlClick: true,
|
||||
forceWrap: false,
|
||||
pageTransclusionCharLimit: 200,
|
||||
@@ -362,9 +367,9 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
mdBorderColor: "Black",
|
||||
mdCSS: "",
|
||||
scriptEngineSettings: {},
|
||||
defaultTrayMode: true,
|
||||
previousRelease: "0.0.0",
|
||||
showReleaseNotes: true,
|
||||
compareManifestToPluginVersion: true,
|
||||
showNewVersionNotification: true,
|
||||
//mathjaxSourceURL: "https://cdn.jsdelivr.net/npm/mathjax@3.2.1/es5/tex-svg.js",
|
||||
latexBoilerplate: "\\color{blue}",
|
||||
@@ -423,6 +428,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
aiEnabled: true,
|
||||
openAIAPIToken: "",
|
||||
openAIDefaultTextModel: "gpt-3.5-turbo-1106",
|
||||
openAIDefaultTextModelMaxTokens: 4096,
|
||||
openAIDefaultVisionModel: "gpt-4o",
|
||||
openAIDefaultImageGenerationModel: "dall-e-3",
|
||||
openAIURL: "https://api.openai.com/v1/chat/completions",
|
||||
@@ -531,6 +537,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
alignment: "center",
|
||||
margin: "normal",
|
||||
},
|
||||
disableContextMenu: false,
|
||||
};
|
||||
|
||||
export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
@@ -726,6 +733,18 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("WARN_ON_MANIFEST_MISMATCH_NAME"))
|
||||
.setDesc(fragWithHTML(t("WARN_ON_MANIFEST_MISMATCH_DESC")))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.compareManifestToPluginVersion)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.compareManifestToPluginVersion = value;
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("NEWVERSION_NOTIFICATION_NAME"))
|
||||
.setDesc(fragWithHTML(t("NEWVERSION_NOTIFICATION_DESC")))
|
||||
@@ -812,7 +831,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
addIframe(detailsEl, "jgUpYznHP9A",216);
|
||||
addYouTubeThumbnail(detailsEl, "jgUpYznHP9A",216);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("SCRIPT_FOLDER_NAME"))
|
||||
@@ -1142,6 +1161,35 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("AI_OPENAI_DEFAULT_MAX_TOKENS_NAME"))
|
||||
.setDesc(fragWithHTML(t("AI_OPENAI_DEFAULT_MAX_TOKENS_DESC")))
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("e.g.: 4096")
|
||||
.setValue(this.plugin.settings.openAIDefaultTextModelMaxTokens.toString())
|
||||
.onChange(async (value) => {
|
||||
const intVal = parseInt(value);
|
||||
if (isNaN(intVal) && value !== "") {
|
||||
text.setValue(this.plugin.settings.openAIDefaultTextModelMaxTokens.toString());
|
||||
return;
|
||||
}
|
||||
if (value === "") {
|
||||
this.plugin.settings.openAIDefaultTextModelMaxTokens = 4096;
|
||||
text.setValue("4096");
|
||||
this.applySettingsUpdate();
|
||||
return;
|
||||
}
|
||||
if (intVal < 0) {
|
||||
text.setValue(this.plugin.settings.openAIDefaultTextModelMaxTokens.toString());
|
||||
return;
|
||||
}
|
||||
this.plugin.settings.openAIDefaultTextModelMaxTokens = intVal;
|
||||
text.setValue(intVal.toString());
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("AI_OPENAI_DEFAULT_VISION_MODEL_NAME"))
|
||||
.setDesc(fragWithHTML(t("AI_OPENAI_DEFAULT_VISION_MODEL_DESC")))
|
||||
@@ -1203,6 +1251,18 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("DISABLE_CONTEXT_MENU_NAME"))
|
||||
.setDesc(t("DISABLE_CONTEXT_MENU_DESC"))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(!this.plugin.settings.disableContextMenu)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.disableContextMenu = !value;
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
|
||||
const readingModeEl = new Setting(detailsEl)
|
||||
.setName(t("SHOW_DRAWING_OR_MD_IN_READING_MODE_NAME"))
|
||||
@@ -1229,22 +1289,19 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("LEFTHANDED_MODE_NAME"))
|
||||
.setDesc(fragWithHTML(t("LEFTHANDED_MODE_DESC")))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.isLeftHanded)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.isLeftHanded = value;
|
||||
//not clear why I need to do this. If I don't double apply the stylesheet changes
|
||||
//then the style won't be applied in the popout windows
|
||||
setLeftHandedMode(value);
|
||||
setTimeout(()=>setLeftHandedMode(value));
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
addIframe(detailsEl, "H8Njp7ZXYag",999);
|
||||
detailsEl = displayDetailsEl.createEl("details");
|
||||
detailsEl.createEl("summary", {
|
||||
text: t("MODES_HEAD"),
|
||||
cls: "excalidraw-setting-h3",
|
||||
});
|
||||
|
||||
new UIModeSettingsComponent(
|
||||
detailsEl,
|
||||
this.plugin.settings,
|
||||
this.app,
|
||||
()=>this.applySettingsUpdate(),
|
||||
).render();
|
||||
addYouTubeThumbnail(detailsEl, "H8Njp7ZXYag",999);
|
||||
|
||||
detailsEl = displayDetailsEl.createEl("details");
|
||||
detailsEl.createEl("summary", {
|
||||
@@ -1291,7 +1348,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
addIframe(detailsEl, "fypDth_-8q0");
|
||||
addYouTubeThumbnail(detailsEl, "fypDth_-8q0");
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("IFRAME_MATCH_THEME_NAME"))
|
||||
@@ -1304,7 +1361,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate(true);
|
||||
}),
|
||||
);
|
||||
addIframe(detailsEl, "ICpoyMv6KSs");
|
||||
addYouTubeThumbnail(detailsEl, "ICpoyMv6KSs");
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("MATCH_THEME_NAME"))
|
||||
@@ -1395,7 +1452,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate();
|
||||
}),
|
||||
);
|
||||
addIframe(detailsEl, "rBarRfcSxNo",107);
|
||||
addYouTubeThumbnail(detailsEl, "rBarRfcSxNo",107);
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("DEFAULT_WHEELZOOM_NAME"))
|
||||
@@ -1818,6 +1875,20 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
}),
|
||||
);
|
||||
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2571
|
||||
//Solution is not completely straightforward, there is a link update in Excalidraw Data that also needs to be handled
|
||||
/*new Setting(detailsEl)
|
||||
.setName(t("LINK_DETECTION_NAME"))
|
||||
.setDesc(fragWithHTML(t("LINK_DETECTION_DESC")))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(!this.plugin.settings.allowLinkSync)
|
||||
.onChange(value => {
|
||||
this.plugin.settings.allowLinkSync = !value;
|
||||
this.applySettingsUpdate(true);
|
||||
}),
|
||||
);*/
|
||||
|
||||
new Setting(detailsEl)
|
||||
.setName(t("LINK_PREFIX_NAME"))
|
||||
.setDesc(fragWithHTML(t("LINK_PREFIX_DESC")))
|
||||
@@ -2055,8 +2126,8 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
this.applySettingsUpdate();
|
||||
})
|
||||
);
|
||||
addIframe(detailsEl, "yZQoJg2RCKI");
|
||||
addIframe(detailsEl, "opLd1SqaH_I",8);
|
||||
addYouTubeThumbnail(detailsEl, "yZQoJg2RCKI");
|
||||
addYouTubeThumbnail(detailsEl, "opLd1SqaH_I",8);
|
||||
|
||||
let dropdown: DropdownComponent;
|
||||
let embedComment: Setting;
|
||||
@@ -2215,7 +2286,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
text: t("EXPORT_SUBHEAD"),
|
||||
cls: "excalidraw-setting-h3",
|
||||
});
|
||||
addIframe(detailsEl, "wTtaXmRJ7wg",171);
|
||||
addYouTubeThumbnail(detailsEl, "wTtaXmRJ7wg",171);
|
||||
|
||||
const pdfExportEl = new Setting(detailsEl)
|
||||
.setName(t("SHOW_DRAWING_OR_MD_IN_EXPORTPDF_NAME"))
|
||||
@@ -2460,7 +2531,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
cls: "excalidraw-setting-h3",
|
||||
});
|
||||
|
||||
addIframe(detailsEl, "nB4cOfn0xAs");
|
||||
addYouTubeThumbnail(detailsEl, "nB4cOfn0xAs");
|
||||
new Setting(detailsEl)
|
||||
.setName(t("PDF_TO_IMAGE_SCALE_NAME"))
|
||||
.setDesc(fragWithHTML(t("PDF_TO_IMAGE_SCALE_DESC")))
|
||||
@@ -2506,7 +2577,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
new EmbeddalbeMDFileCustomDataSettingsComponent(
|
||||
detailsEl,
|
||||
this.plugin.settings.embeddableMarkdownDefaults,
|
||||
this.applySettingsUpdate,
|
||||
(val?:boolean) => this.applySettingsUpdate(val),
|
||||
).render();
|
||||
|
||||
detailsEl = embedFilesDetailsEl.createEl("details");
|
||||
@@ -2671,7 +2742,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
text: t("CUSTOM_PEN_HEAD"),
|
||||
cls: "excalidraw-setting-h3",
|
||||
});
|
||||
addIframe(detailsEl, "OjNhjaH2KjI",69);
|
||||
addYouTubeThumbnail(detailsEl, "OjNhjaH2KjI",69);
|
||||
new Setting(detailsEl)
|
||||
.setName(t("CUSTOM_PEN_NAME"))
|
||||
.setDesc(t("CUSTOM_PEN_DESC"))
|
||||
@@ -2713,7 +2784,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
text: t("CUSTOM_FONT_HEAD"),
|
||||
cls: "excalidraw-setting-h3",
|
||||
});
|
||||
addIframe(detailsEl, "eKFmrSQhFA4");
|
||||
addYouTubeThumbnail(detailsEl, "eKFmrSQhFA4");
|
||||
new Setting(detailsEl)
|
||||
.setName(t("ENABLE_FOURTH_FONT_NAME"))
|
||||
.setDesc(fragWithHTML(t("ENABLE_FOURTH_FONT_DESC")))
|
||||
@@ -2819,7 +2890,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
cls: "excalidraw-setting-h1",
|
||||
});
|
||||
|
||||
addIframe(detailsEl, "r08wk-58DPk");
|
||||
addYouTubeThumbnail(detailsEl, "r08wk-58DPk");
|
||||
new Setting(detailsEl)
|
||||
.setName(t("LATEX_DEFAULT_NAME"))
|
||||
.setDesc(fragWithHTML(t("LATEX_DEFAULT_DESC")))
|
||||
@@ -2917,7 +2988,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
detailsEl.createDiv( { text: t("TASKBONE_DESC"), cls: "setting-item-description" });
|
||||
let taskboneAPIKeyText: TextComponent;
|
||||
|
||||
addIframe(detailsEl, "7gu4ETx7zro");
|
||||
addYouTubeThumbnail(detailsEl, "7gu4ETx7zro");
|
||||
new Setting(detailsEl)
|
||||
.setName(t("TASKBONE_ENABLE_NAME"))
|
||||
.setDesc(fragWithHTML(t("TASKBONE_ENABLE_DESC")))
|
||||
@@ -3296,7 +3367,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
cls: "excalidraw-setting-h1",
|
||||
});
|
||||
|
||||
addIframe(detailsEl, "H8Njp7ZXYag",52);
|
||||
addYouTubeThumbnail(detailsEl, "H8Njp7ZXYag",52);
|
||||
Object.keys(this.plugin.settings.scriptEngineSettings)
|
||||
.filter((s) => scripts.contains(s))
|
||||
.forEach((scriptName: string) => {
|
||||
|
||||
+49
-6
@@ -44,7 +44,7 @@ export default {
|
||||
TRANSCLUDE_MOST_RECENT: "Embed the most recently edited drawing",
|
||||
TOGGLE_LEFTHANDED_MODE: "Toggle left-handed mode",
|
||||
TOGGLE_SPLASHSCREEN: "Show splash screen in new drawings",
|
||||
FLIP_IMAGE: "Open the back-of-the-note for the selected image in a popout window",
|
||||
FLIP_IMAGE: "Open the back-of-the-note for the selected image in a popout window (flip the card)",
|
||||
NEW_IN_NEW_PANE: "Create new drawing - IN AN ADJACENT WINDOW",
|
||||
NEW_IN_NEW_TAB: "Create new drawing - IN A NEW TAB",
|
||||
NEW_IN_ACTIVE_PANE: "Create new drawing - IN THE CURRENT ACTIVE WINDOW",
|
||||
@@ -63,6 +63,7 @@ export default {
|
||||
MARKER_FRAME_TITLE_SHOW: "Show Marker Frame Titles",
|
||||
MARKER_FRAME_TITLE_HIDE: "Hide Marker Frame Titles",
|
||||
COPY_ELEMENT_LINK: "Copy [[link]] for selected element(s)",
|
||||
FRAME_WITH_NAME: "Copy frame link by name",
|
||||
COPY_DRAWING_LINK: "Copy ![[embed link]] for this drawing",
|
||||
INSERT_LINK_TO_ELEMENT:
|
||||
`Copy [[link]] for selected element to clipboard. ${labelCTRL()}+CLICK to copy 'group=' link. ${labelSHIFT()}+CLICK to copy an 'area=' link.`,
|
||||
@@ -98,7 +99,7 @@ export default {
|
||||
RUN_OCR: "OCR full drawing: Grab text from freedraw + images to clipboard and doc.props",
|
||||
RERUN_OCR: "OCR full drawing re-run: Grab text from freedraw + images to clipboard and doc.props",
|
||||
RUN_OCR_ELEMENTS: "OCR selected elements: Grab text from freedraw + images to clipboard",
|
||||
TRAY_MODE: "Toggle property-panel tray-mode",
|
||||
UI_MODE: "Toggle UI-mode",
|
||||
SEARCH: "Search for text in drawing",
|
||||
CROP_PAGE: "Crop and mask selected page",
|
||||
CROP_IMAGE: "Crop and mask image",
|
||||
@@ -110,11 +111,13 @@ export default {
|
||||
TEMPORARY_ENABLE_AUTOSAVE: "Enable autosave",
|
||||
FONTS_LOADED: "Excalidraw: CJK Fonts loaded",
|
||||
FONTS_LOAD_ERROR: "Excalidraw: Could not find CJK Fonts in the assets folder\n",
|
||||
TOGGLE_ENABLE_CONTEXT_MENU: "Toggle enable context menu (helpful on Mobile devices)",
|
||||
|
||||
//Prompt.ts
|
||||
SELECT_LINK_TO_OPEN: "Select a link to open",
|
||||
|
||||
//ExcalidrawView.ts
|
||||
ABOUT_LIBRARIES: "How to load libraries",
|
||||
ERROR_CANT_READ_FILEPATH: "Error, can't read file path. Importing file instead",
|
||||
NO_SEARCH_RESULT: "Didn't find a matching element in the drawing",
|
||||
FORCE_SAVE_ABORTED: "Force Save aborted because saving is in progress",
|
||||
@@ -137,8 +140,8 @@ export default {
|
||||
"1) Please select your drawing using CTRL/CMD+A and make a copy with CTRL/CMD+C.\n" +
|
||||
"2) Then create an empty drawing in a new pane by CTRL/CMD+clicking the Excalidraw ribbon button,\n" +
|
||||
"3) and paste your work to the new document with CTRL/CMD+V.",
|
||||
ARIA_LABEL_TRAY_MODE: "Tray-mode offers an alternative, more spacious canvas",
|
||||
TRAY_TRAY_MODE: "Toggle tray-mode",
|
||||
ARIA_LABEL_TRAY_MODE: "You can choose from 3 different desktop and tablet UI modes: Full, Compact, and Tray. On Phones only the Phone mode is available.",
|
||||
TRAY_TRAY_MODE: "Toggle UI-mode",
|
||||
TRAY_SCRIPT_LIBRARY: "Script Library",
|
||||
TRAY_SCRIPT_LIBRARY_ARIA: "Explore the Excalidraw Script Library",
|
||||
TRAY_EXPORT: "Export Image...",
|
||||
@@ -214,6 +217,8 @@ export default {
|
||||
|
||||
|
||||
//settings.ts
|
||||
DISABLE_CONTEXT_MENU_NAME: "Disable Excalidraw context menu",
|
||||
DISABLE_CONTEXT_MENU_DESC: "Disables the Excalidraw context menu. This can be useful on Mobile devices where the context menu pops up in unwanted moments.",
|
||||
NOTEBOOKLM_LINK_ARIA: "Ask NotebookLM for help about the plugin. This model is pre-loaded with all my video transcripts, release notes and other helpful content. Chat with NotebookLM to explore my 250+ videos and the Excalidraw documentation.",
|
||||
NOTEBOOKLM_LINK_TEXT: "Learn the Plugin. Access the NotebookLM knowledgebase.",
|
||||
LINKS_BUGS_ARIA: "Report bugs and raise feature requsts on the plugin's GitHub page",
|
||||
@@ -234,6 +239,8 @@ export default {
|
||||
RELEASE_NOTES_DESC:
|
||||
"<b><u>Toggle ON:</u></b> Display release notes each time you update Excalidraw to a newer version.<br>" +
|
||||
"<b><u>Toggle OFF:</u></b> Silent mode. You can still read release notes on <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases'>GitHub</a>.",
|
||||
WARN_ON_MANIFEST_MISMATCH_NAME: "Warn about incomplete plugin updates",
|
||||
WARN_ON_MANIFEST_MISMATCH_DESC: "Checks that the installed Excalidraw executable matches the version shown in Obsidian's plugin list. If they don't match (often after partial sync), you'll see a warning and can update. Disable to stop checking.",
|
||||
NEWVERSION_NOTIFICATION_NAME: "Plugin update notification",
|
||||
NEWVERSION_NOTIFICATION_DESC:
|
||||
"<b><u>Toggle ON:</u></b> Show a notification when a new version of the plugin is available.<br>" +
|
||||
@@ -307,6 +314,9 @@ export default {
|
||||
"The default AI model to use when generating text. This is a freetext field, so you can enter any valid OpenAI model name. " +
|
||||
"Find out more about the available models on the <a href='https://platform.openai.com/docs/models'>OpenAI website</a>.",
|
||||
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "Enter your default AI model here. e.g.: gpt-3.5-turbo-1106",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "Max tokens",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
|
||||
"Maximum number of tokens to generate in the API response. Set to 0 to omit the max_tokens field (useful for models that don't support this parameter, such as GPT-5).",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "Default Image Generation AI model",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
|
||||
"The default AI model to use when generating images. Image editing and variations are only supported by dall-e-2 at this time by OpenAI, " +
|
||||
@@ -447,6 +457,20 @@ export default {
|
||||
"Note: This setting does not affect the PDF export feature within Excalidraw itself.<br>" +
|
||||
"See the other related setting for <a href='#"+TAG_MDREADINGMODE+"'>Markdown Reading Mode</a> under 'Appearance and Behavior' further above.<br>" +
|
||||
"⚠️ You must close and reopen the Excalidraw/markdown file for changes to take effect. ⚠️",
|
||||
MODES_HEAD: "UI Modes",
|
||||
DESKTOP_UI_MODE_NAME: "Preferred Desktop Mode",
|
||||
DESKTOP_UI_MODE_DESC: "Select the default UI mode for desktop devices.",
|
||||
TABLET_UI_MODE_NAME: "Preferred Tablet Mode",
|
||||
TABLET_UI_MODE_DESC: "Select the default UI mode for tablet devices.",
|
||||
MODE_FULL: "Desktop-mode",
|
||||
MODE_COMPACT: "Compact-mode",
|
||||
MODE_TRAY: "Tray-mode",
|
||||
TRAY_MODE_NAME: "Enable tray-mode",
|
||||
PREFER_COMPACT_MODE_DESKTOP_NAME: "Prefer compact-mode on Desktop",
|
||||
PREFER_COMPACT_MODE_DESKTOP_DESC: "When toggling tray-mode on a desktop, if this option is enabled, Excalidraw will toggle between compact-mode and tray-mode. " +
|
||||
"If this setting is off, it will toggle betweeen full-mode and tray-mode.",
|
||||
COMPACT_MODE_NAME: "Prefer compact-mode on Tablets",
|
||||
COMPACT_MODE_DESC: "This setting allows you to have a different default mode on tablets, then on desktops. You can default to compact mode on tablets, and to tray-mode on desktops with the help of this setting.",
|
||||
HOTKEY_OVERRIDE_HEAD: "Hotkey overrides",
|
||||
HOTKEY_OVERRIDE_DESC: `Some of the Excalidraw hotkeys such as <code>${labelCTRL()}+Enter</code> to edit text or <code>${labelCTRL()}+K</code> to create an element link ` +
|
||||
"conflict with Obsidian hotkey settings. The hotkey combinations you add below will override Obsidian's hotkey settings while using Excalidraw, thus " +
|
||||
@@ -486,8 +510,7 @@ export default {
|
||||
"<b><u>Toggle ON:</u></b>Change grid color to match the canvas color<br><b><u>Toggle OFF:</u></b>Use the color below as the grid color",
|
||||
GRID_COLOR_NAME: "Grid color",
|
||||
GRID_OPACITY_NAME: "Grid opacity",
|
||||
GRID_OPACITY_DESC: "Grid opacity will also control the opacity of the binding box when binding an arrow to an element.<br>" +
|
||||
"Set the opacity of the grid. 0 is transparent, 100 is opaque.",
|
||||
GRID_OPACITY_DESC: "Sets the opacity of the grid. 0 is transparent, 100 is opaque.",
|
||||
GRID_DIRECTION_NAME: "Grid direction",
|
||||
GRID_DIRECTION_DESC: "The first toggle shows/hides the horizontal grid, the second toggle shows/hides the vertical grid.",
|
||||
GRID_HORIZONTAL: "Render horizontal grid",
|
||||
@@ -541,6 +564,12 @@ export default {
|
||||
"In PREVIEW mode, when parsing Text Elements, place brackets around links. " +
|
||||
"You can override this setting for a specific drawing by adding <code>"
|
||||
}${FRONTMATTER_KEYS["link-brackets"].name}: true/false</code> to the file's frontmatter.`,
|
||||
/*LINK_DETECTION_NAME: "Do not auto-create element link from text",
|
||||
LINK_DETECTION_DESC: "By default, Excalidraw will automatically create an element link when you type or paste a valid " +
|
||||
"[[Obsidian link]] or a (web link) into a Text Element. This link overrides whatever element link you may have set previously. " +
|
||||
"Even if you delete the element link, if the text element contains a valid link, Excalidraw will recreate the element link. " +
|
||||
"If you turn this setting on, Excalidraw will not auto-create element links from text. You can still manually set element links " +
|
||||
`Links in the text will still be navigable when you ${labelCTRL()} + CLICK the element.`,*/
|
||||
LINK_PREFIX_NAME: "Link prefix",
|
||||
LINK_PREFIX_DESC: `${
|
||||
"In PREVIEW mode, if the Text Element contains a link, precede the text with these characters. " +
|
||||
@@ -1111,6 +1140,7 @@ export default {
|
||||
EXPORTDIALOG_BACKGROUND: "Background",
|
||||
EXPORTDIALOG_BACKGROUND_TRANSPARENT: "Transparent",
|
||||
EXPORTDIALOG_BACKGROUND_USE_COLOR: "Use scene color",
|
||||
EXPORTDIALOG_INCLUDE_INTERNAL_LINKS: "Export internal links to SVG/PDF?",
|
||||
// Selection
|
||||
EXPORTDIALOG_SELECTED_ELEMENTS: "Export",
|
||||
EXPORTDIALOG_SELECTED_ALL: "Entire scene",
|
||||
@@ -1210,4 +1240,17 @@ export default {
|
||||
//EmbeddableActionsMenu.tsx
|
||||
BOOKMARK_PAGE: "Save current position in document",
|
||||
CAPTURE_PAGE: "Capture current page as image",
|
||||
|
||||
//VersionMismatch.ts
|
||||
//WARNING: Do not change the {VAL_RECORDED} and {VAL_ACTUAL} strings, they are replaced by the actual version values at runtime!
|
||||
VERSION_MISMATCH_NOTICE: `The version recorded by Obsidian is <b>{VAL_RECORDED}</b>, but the installed Excalidraw code is <b>{VAL_ACTUAL}</b>.`,
|
||||
|
||||
VERSION_MISMATCH_HEADING: "Excalidraw version mismatch",
|
||||
VERSION_MISMATCH_CAUSE: "This usually happens after a partial sync (e.g. Obsidian Sync Standard) where large files (main.js > 5MB) did not sync, so only <code>manifest.json</code> updated.",
|
||||
VERSION_MISMATCH_OPTIONS: "Options:<br><b>1.</b> Re-download the plugin (recommended).<br><b>2.</b> Ignore for now.",
|
||||
VERSION_MISMATCH_NOTE: "Note: Updating version info manually may affect tools that read manifest.json directly (e.g. Plugin Update Tracker, BRAT) until a full reinstall.",
|
||||
VERSION_MISMATCH_DISABLE_NAME: "Disable future mismatch warnings",
|
||||
VERSION_MISMATCH_DISABLE_DESC: "You can re-enable this under: Settings → Excalidraw → Basic → Warn about incomplete plugin updates.",
|
||||
VERSION_MISMATCH_REDOWNLOAD: "Re-download plugin",
|
||||
VERSION_MISMATCH_IGNORE: "Ignore",
|
||||
};
|
||||
@@ -139,6 +139,7 @@ export default {
|
||||
"3) y pega tu trabajo en el nuevo documento con CTRL/CMD+V.",
|
||||
ARIA_LABEL_TRAY_MODE: "El modo bandeja ofrece un lienzo alternativo y más espacioso",
|
||||
TRAY_TRAY_MODE: "Activar/desactivar modo bandeja",
|
||||
TOGGLE_COMPACT_MODE: "Alternar modo compacto",
|
||||
TRAY_SCRIPT_LIBRARY: "Biblioteca de scripts",
|
||||
TRAY_SCRIPT_LIBRARY_ARIA: "Explorar la biblioteca de scripts de Excalidraw",
|
||||
TRAY_EXPORT: "Exportar imagen...",
|
||||
@@ -234,6 +235,8 @@ export default {
|
||||
RELEASE_NOTES_DESC:
|
||||
"<b><u>Activado:</u></b> Muestra las notas de la versión cada vez que actualices Excalidraw a una versión más reciente.<br>" +
|
||||
"<b><u>Desactivado:</u></b> Modo silencioso. Aún puedes leer las notas de la versión en <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases'>GitHub</a>.",
|
||||
WARN_ON_MANIFEST_MISMATCH_NAME: "Advertir sobre actualizaciones de complementos incompletos",
|
||||
WARN_ON_MANIFEST_MISMATCH_DESC: "Comprueba que el ejecutable de Excalidraw instalado coincida con la versión mostrada en la lista de complementos de Obsidian. Si no coinciden (a menudo después de una sincronización parcial), verás una advertencia y podrás actualizar. Desactívalo para dejar de comprobar.",
|
||||
NEWVERSION_NOTIFICATION_NAME: "Notificación de Actualización del Complemento",
|
||||
NEWVERSION_NOTIFICATION_DESC:
|
||||
"<b><u>Activado:</u></b> Muestra una notificación cuando hay una nueva versión del complemento disponible.<br>" +
|
||||
@@ -307,6 +310,9 @@ export default {
|
||||
"El modelo de IA predeterminado para usar al generar texto. Este es un campo de texto libre, así que puedes ingresar cualquier nombre de modelo de OpenAI válido. " +
|
||||
"Encuentra más información sobre los modelos disponibles en el sitio web de OpenAI: <a href='https://platform.openai.com/docs/models'></a>.",
|
||||
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "Ingresa aquí tu modelo de IA predeterminado. Ej.: gpt-3.5-turbo-1106",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "Tokens máximos",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
|
||||
"Número máximo de tokens a generar en la respuesta de la API. Establece en 0 para omitir el campo max_tokens (útil para modelos que no admiten este parámetro, como GPT-5).",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "Modelo de IA predeterminado para generación de imágenes",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
|
||||
"El modelo de IA predeterminado para usar al generar imágenes. La edición y variaciones de imágenes solo son compatibles con Dall-E 2 en este momento por parte de OpenAI, " +
|
||||
@@ -447,6 +453,10 @@ FILENAME_HEAD: "Nombre de archivo",
|
||||
"Nota: Esta configuración no afecta la función de exportación a PDF dentro del propio Excalidraw.<br>" +
|
||||
"Consulta la otra configuración relacionada para el <a href='#"+TAG_MDREADINGMODE+"'>Modo de Lectura de Markdown</a> en 'Apariencia y Comportamiento' más arriba.<br>" +
|
||||
"⚠️ Debes cerrar y volver a abrir el archivo de Excalidraw/Markdown para que los cambios surtan efecto. ⚠️",
|
||||
MODES_HEAD: "Modos",
|
||||
TRAY_MODE_NAME: "Habilitar modo de bandeja (tray-mode)",
|
||||
COMPACT_MODE_NAME: "Modo compacto en tablets",
|
||||
COMPACT_MODE_DESC: "Anula el modo de bandeja en tablets, permitiendo que se use en su lugar el modo compacto nativo de Excalidraw.",
|
||||
HOTKEY_OVERRIDE_HEAD: "Anulaciones de atajos de teclado",
|
||||
HOTKEY_OVERRIDE_DESC: `Algunos de los atajos de teclado de Excalidraw, como <code>${labelCTRL()}+Enter</code> para editar texto o <code>${labelCTRL()}+K</code> para crear un enlace de elemento ` +
|
||||
"entran en conflicto con la configuración de atajos de teclado de Obsidian. Las combinaciones de atajos de teclado que agregues a continuación anularán la configuración de atajos de teclado de Obsidian mientras usas Excalidraw. Por lo tanto, " +
|
||||
@@ -1210,4 +1220,17 @@ FILENAME_HEAD: "Nombre de archivo",
|
||||
//EmbeddableActionsMenu.tsx
|
||||
BOOKMARK_PAGE: "Guardar posición actual en el documento",
|
||||
CAPTURE_PAGE: "Capturar la página actual como imagen",
|
||||
|
||||
//VersionMismatch.ts
|
||||
//ADVERTENCIA: No cambie las cadenas {VAL_RECORDED} y {VAL_ACTUAL}, ¡son reemplazadas por los valores de versión reales en tiempo de ejecución!
|
||||
VERSION_MISMATCH_NOTICE: `La versión registrada por Obsidian es <b>{VAL_RECORDED}</b>, pero el código de Excalidraw instalado es <b>{VAL_ACTUAL}</b>.`,
|
||||
|
||||
VERSION_MISMATCH_HEADING: "Desajuste de versión de Excalidraw",
|
||||
VERSION_MISMATCH_CAUSE: "Esto suele ocurrir después de una sincronización parcial (ej. Obsidian Sync Standard) donde archivos grandes (main.js > 5MB) no se sincronizaron, por lo que solo se actualizó <code>manifest.json</code> .",
|
||||
VERSION_MISMATCH_OPTIONS: "Opciones:<br><b>1.</b> Vuelva a descargar el complemento (recomendado).<br><b>2.</b> Ignorar por ahora.",
|
||||
VERSION_MISMATCH_NOTE: "Nota: Actualizar la información de la versión manualmente puede afectar a las herramientas que leen manifest.json directamente (ej. Plugin Update Tracker, BRAT) hasta una reinstalación completa.",
|
||||
VERSION_MISMATCH_DISABLE_NAME: "Desactivar futuras advertencias de desajuste",
|
||||
VERSION_MISMATCH_DISABLE_DESC: "Puede volver a habilitar esto en: Opciones → Excalidraw → Básico → Advertir sobre actualizaciones de complementos incompletos.",
|
||||
VERSION_MISMATCH_REDOWNLOAD: "Volver a descargar complemento",
|
||||
VERSION_MISMATCH_IGNORE: "Ignorar",
|
||||
};
|
||||
@@ -215,6 +215,9 @@ export default {
|
||||
"Модель ИИ по умолчанию, используемая при генерации текста. Это поле свободного текста, поэтому вы можете ввести любое действительное имя модели OpenAI. " +
|
||||
"Узнайте больше о доступных моделях на <a href='https://platform.openai.com/docs/models'>OpenAI сайте</a>.",
|
||||
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "Введите здесь модель искусственного интеллекта по умолчанию, например: gpt-3.5-turbo-1106.",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "Максимальное количество токенов",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
|
||||
"Максимальное количество токенов для генерации в ответе API. Установите значение 0, чтобы пропустить поле max_tokens (полезно для моделей, которые не поддерживают этот параметр, таких как GPT-5).",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "Модель ИИ для генерации изображений по умолчанию",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
|
||||
"Модель ИИ по умолчанию, используемая при генерации изображений. Редактирование и изменение изображений поддерживается OpenAI только в dall-e-2, " +
|
||||
|
||||
+78
-37
@@ -42,7 +42,7 @@ export default {
|
||||
"打开已有的绘图 - 于当前面板",
|
||||
TRANSCLUDE: "嵌入绘图 ![[drawing]] 到当前 Markdown 文档中",
|
||||
TRANSCLUDE_MOST_RECENT: "嵌入最近编辑过的绘图 ![[drawing]] 到当前 Markdown 文档中",
|
||||
TOGGLE_LEFTHANDED_MODE: "切换为左手模式",
|
||||
TOGGLE_LEFTHANDED_MODE: "切换左手模式",
|
||||
TOGGLE_SPLASHSCREEN: "在新绘图中显示启动画面",
|
||||
FLIP_IMAGE: "在弹出窗口中打开所选绘图的背景笔记",
|
||||
NEW_IN_NEW_PANE: "新建绘图 - 于新面板",
|
||||
@@ -63,6 +63,7 @@ export default {
|
||||
MARKER_FRAME_TITLE_SHOW: "显示标记画框名称",
|
||||
MARKER_FRAME_TITLE_HIDE: "隐藏标记画框名称",
|
||||
COPY_ELEMENT_LINK: "复制所选元素的 [[file#^id]] 链接",
|
||||
FRAME_WITH_NAME: "按名称复制画框链接",
|
||||
COPY_DRAWING_LINK: "复制绘图的 ![[drawing]] 链接",
|
||||
INSERT_LINK_TO_ELEMENT:
|
||||
`单击=复制所选元素的 [[file#^id]] 链接\n${labelCTRL()}=复制元素所在分组为 [[file#^group=id]] 链接\n${labelSHIFT()}=复制所选元素所在区域为 [[file#^area=id]] 链接`,
|
||||
@@ -86,19 +87,19 @@ export default {
|
||||
INSERT_MD: "以图像形式嵌入 Markdown 文档到当前绘图中",
|
||||
INSERT_PDF: "以图像形式嵌入 PDF 到当前绘图中",
|
||||
INSERT_LAST_ACTIVE_PDF_PAGE_AS_IMAGE: "以图像形式嵌入最后激活的 PDF 页面",
|
||||
UNIVERSAL_ADD_FILE: "以交互或图像形式嵌入文件",
|
||||
UNIVERSAL_ADD_FILE: "嵌入文件 (Insert ANY file)",
|
||||
INSERT_CARD: "插入“背景笔记”卡片",
|
||||
CONVERT_CARD_TO_FILE: "将“背景笔记”卡片保存到文件",
|
||||
ERROR_TRY_AGAIN: "请重试。",
|
||||
PASTE_CODEBLOCK: "粘贴代码块",
|
||||
INSERT_LATEX:
|
||||
`插入 LaTeX 公式(如:\\binom{n}{k} = \\frac{n!}{k!(n-k)!})`,
|
||||
`插入 LaTeX 公式到当前绘图中`,
|
||||
ENTER_LATEX: "输入 LaTeX 公式",
|
||||
READ_RELEASE_NOTES: "阅读本插件的更新说明",
|
||||
RUN_OCR: "OCR 整个绘图:识别涂鸦和图片里的文本并复制到剪贴板和笔记属性中",
|
||||
RERUN_OCR: "重新 OCR 整个绘图:识别涂鸦和图片里的文本并复制到剪贴板和笔记属性中",
|
||||
RUN_OCR_ELEMENTS: "OCR 选中的元素:识别涂鸦和图片里的文本并复制到剪贴板",
|
||||
TRAY_MODE: "绘图工具属性页:面板模式 ⟺ 托盘模式",
|
||||
UI_MODE: "切换 UI 模式",
|
||||
SEARCH: "搜索文本",
|
||||
CROP_PAGE: "裁剪所选页面并添加蒙版",
|
||||
CROP_IMAGE: "裁剪图片并添加蒙版",
|
||||
@@ -110,11 +111,13 @@ export default {
|
||||
TEMPORARY_ENABLE_AUTOSAVE: "启用自动保存功能",
|
||||
FONTS_LOADED: "Excalidraw: CJK 字体已加载",
|
||||
FONTS_LOAD_ERROR: "Excalidraw: 在资源文件夹下找不到 CJK 字体\n",
|
||||
TOGGLE_ENABLE_CONTEXT_MENU: "切换是否启用上下文菜单(在移动设备上很有用)",
|
||||
|
||||
//Prompt.ts
|
||||
SELECT_LINK_TO_OPEN: "选择要打开的链接",
|
||||
|
||||
//ExcalidrawView.ts
|
||||
ABOUT_LIBRARIES: "如何加载素材库",
|
||||
ERROR_CANT_READ_FILEPATH: "错误,无法读取文件路径。正在改为导入文件",
|
||||
NO_SEARCH_RESULT: "在绘图中未找到匹配的元素",
|
||||
FORCE_SAVE_ABORTED: "自动保存被中止,因为文件正在保存中",
|
||||
@@ -137,8 +140,8 @@ export default {
|
||||
"1) 使用 Ctrl/CMD+A 选择您的绘图,然后使用 Ctrl/CMD+C 进行复制。\n" +
|
||||
"2) 然后在新窗格中,通过 Ctrl/CMD 点击 Excalidraw 功能区按钮创建一个空白绘图。\n" +
|
||||
"3) 最后,使用 Ctrl/CMD+V 将您的作品粘贴到新文件中。",
|
||||
ARIA_LABEL_TRAY_MODE: "托盘模式提供更宽敞的绘图空间",
|
||||
TRAY_TRAY_MODE: "切换托盘模式",
|
||||
ARIA_LABEL_TRAY_MODE: "切换 3 种 UI 模式:完整模式(桌面端)、紧凑模式、托盘模式。手机端只有手机端模式。",
|
||||
TRAY_TRAY_MODE: "切换 UI 模式",
|
||||
TRAY_SCRIPT_LIBRARY: "脚本库",
|
||||
TRAY_SCRIPT_LIBRARY_ARIA: "浏览 Excalidraw 脚本库",
|
||||
TRAY_EXPORT: "导出绘图…",
|
||||
@@ -155,7 +158,7 @@ export default {
|
||||
LINK_BUTTON_CLICK_NO_TEXT:
|
||||
"请选择一个包含内部或外部链接的元素。\n",
|
||||
LINEAR_ELEMENT_LINK_CLICK_ERROR:
|
||||
"箭头和线元素的链接无法通过 " + labelCTRL() + " + 点击元素来导航,因为这也会激活线编辑器。\n" +
|
||||
"箭头和线条元素的链接无法通过 " + labelCTRL() + " + 点击元素来跳转,因为这也会激活线条编辑器。\n" +
|
||||
"请使用右键上下文菜单打开链接,或点击元素右上角的链接指示器。\n",
|
||||
FILENAME_INVALID_CHARS:
|
||||
'文件名不能包含以下符号: * " \\ < > : | ? #',
|
||||
@@ -168,7 +171,7 @@ export default {
|
||||
COMPATIBILITY_MODE:
|
||||
"*.excalidraw 是兼容旧版的绘图文件格式。需要转换为新格式才能解锁本插件的全部功能。",
|
||||
CONVERT_FILE: "转换为新格式",
|
||||
BACKUP_AVAILABLE: "加载绘图文件时出错,可能是由于 Obsidian 在上次保存时意外退出了(手机上更容易发生这种意外)。<br><br><b>好消息:</b>这台设备上存在备份。您是否想要恢复本设备上的备份?<br><br>(我建议您先尝试在最近使用过的其他设备上打开该绘图,以检查是否有更新的备份。)",
|
||||
BACKUP_AVAILABLE: "加载绘图文件时出错,可能是由于 Obsidian 在上次保存时意外退出了(移动设备上更容易发生这种意外)。<br><br><b>好消息:</b>这台设备上存在备份。您是否想要恢复本设备上的备份?<br><br>(我建议您先尝试在最近使用过的其他设备上打开该绘图,以检查是否有更新的备份。)",
|
||||
BACKUP_RESTORED: "已恢复备份",
|
||||
BACKUP_SAVE_AS_FILE: "此绘图为空。但有一个非空的备份可用。您想将其恢复为新文件并在新标签页中打开吗?",
|
||||
BACKUP_SAVE: "恢复",
|
||||
@@ -214,6 +217,8 @@ export default {
|
||||
|
||||
|
||||
//settings.ts
|
||||
DISABLE_CONTEXT_MENU_NAME: "禁用 Excalidraw 上下文菜单",
|
||||
DISABLE_CONTEXT_MENU_DESC: "禁用 Excalidraw 的上下文菜单。这在移动设备上很有用,因为上下文菜单有时会在不需要的时候弹出。",
|
||||
NOTEBOOKLM_LINK_ARIA: "向 NotebookLM 咨询有关插件的帮助。此模型已预加载了我所有的视频转录稿、发布说明和其他帮助内容。与 NotebookLM 聊天,浏览我的 250+ 视频和 Excalidraw 文件。",
|
||||
NOTEBOOKLM_LINK_TEXT: "学习插件。访问 NotebookLM 知识库。",
|
||||
LINKS_BUGS_ARIA: "在插件的 GitHub 页面报告错误和提交功能请求",
|
||||
@@ -227,13 +232,15 @@ export default {
|
||||
LINKS_VTW: "加入研讨会",
|
||||
LINKS_BOOK_ARIA: "阅读我的视觉思维著作《Sketch Your Mind》",
|
||||
LINKS_BOOK: "阅读书籍",
|
||||
LINKS_WIKI: "插件 Wiki",
|
||||
LINKS_WIKI_ARIA: "浏览 Excalidraw 插件 Wiki",
|
||||
LINKS_WIKI: "插件维基",
|
||||
LINKS_WIKI_ARIA: "浏览 Excalidraw 插件维基",
|
||||
|
||||
RELEASE_NOTES_NAME: "显示更新说明",
|
||||
RELEASE_NOTES_DESC:
|
||||
"<b>开启:</b>每次更新本插件后,显示最新发行版本的说明。<br>" +
|
||||
"<b>关闭:</b>您仍可以在 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases'>GitHub</a> 上阅读更新说明。",
|
||||
WARN_ON_MANIFEST_MISMATCH_NAME: "警告插件更新不完整",
|
||||
WARN_ON_MANIFEST_MISMATCH_DESC: "检查已安装的 Excalidraw 可执行文件是否与 Obsidian 插件列表中显示的版本一致。如果不一致(通常源于同步不完整),你会看到警告并可以选择更新。关闭该项可禁用检查。",
|
||||
NEWVERSION_NOTIFICATION_NAME: "插件更新通知",
|
||||
NEWVERSION_NOTIFICATION_DESC:
|
||||
"<b>开启:</b>当本插件存在可用更新时,显示通知。<br>" +
|
||||
@@ -278,10 +285,10 @@ export default {
|
||||
TEMPLATE_NAME: "Excalidraw 模板文件(區分大小寫!)",
|
||||
TEMPLATE_DESC:
|
||||
"Excalidraw 模板文件(文件夹)的存储路径。<br>" +
|
||||
"<b>模板文件:</b>比如:您的模板在默认的 Excalidraw 文件夹中且文件名是 Template.md," +
|
||||
"<b>模板文件:</b>例如:您的模板在默认的 Excalidraw 文件夹中且文件名是 Template.md," +
|
||||
"则该项应设为 Excalidraw/Template.md 或 Excalidraw/Template(省略 .md 扩展名)。<br>" +
|
||||
"如果您在兼容模式下使用 Excalidraw,那么您的模板文件也必须是旧的 *.excalidraw 格式," +
|
||||
"例如 Excalidraw/Template.excalidraw。<br><b>模板文件夹:</b> 您还可以将文件夹设置为模板。" +
|
||||
"如 Excalidraw/Template.excalidraw。<br><b>模板文件夹:</b> 您还可以将文件夹设置为模板。" +
|
||||
"这时,创建新绘图时将提示您选择使用哪个模板。<br>" +
|
||||
"<b>专业提示:</b> 如果您正在使用 Obsidian Templater 插件,您可以将 Templater 代码添加到不同的" +
|
||||
"Excalidraw 模板中,以自动配置您的绘图。",
|
||||
@@ -307,6 +314,9 @@ export default {
|
||||
"使用哪个 AI 模型来生成文本。请填写有效的 OpenAI 模型名称。" +
|
||||
"您可访问 <a href='https://platform.openai.com/docs/models'>OpenAI 网站</a> 了解更多模型信息。",
|
||||
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-3.5-turbo-1106",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "最大 token 数",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
|
||||
"API 响应中生成的最大 token 数。设置为 0 以忽略 max_tokens 字段(适用于不支持该参数的模型,如 GPT-5)。",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "默认的图片 AI 模型",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
|
||||
"使用哪个 AI 模型来生成图片。图生图会强制使用 dall-e-2 模型," +
|
||||
@@ -323,7 +333,7 @@ export default {
|
||||
"默认的 OpenAI API URL。请填写有效的 OpenAI API URL。" +
|
||||
"Excalidraw 会通过该 URL 发送 API 请求给 OpenAI。我没有对该项做任何错误处理,请谨慎修改。",
|
||||
AI_OPENAI_DEFAULT_IMAGE_API_URL_NAME: "OpenAI 图片生成 API URL",
|
||||
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "输入默认 AI 模型名称,例如:gpt-4o",
|
||||
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "输入默认 AI 模型名称,如 gpt-4o",
|
||||
SAVING_HEAD: "保存",
|
||||
SAVING_DESC: "包括:压缩,自动保存的时间间隔,文件的命名格式和扩展名等。",
|
||||
COMPRESS_NAME: "压缩 Excalidraw JSON",
|
||||
@@ -332,7 +342,7 @@ export default {
|
||||
"(使用 <a href='https://pieroxy.net/blog/pages/lz-string/index.html'>LZ-String</a> 算法)。" +
|
||||
"这样一方面可以避免原来的明文 JSON 数据干扰 Obsidian 的文本搜索结果," +
|
||||
"另一方面减小了绘图文件的体积。<br>" +
|
||||
"当您通过功能区按钮或命令将绘图切换至 Markdown 视图模式时," +
|
||||
"当您通过菜单按钮或命令将绘图切换至 Markdown 视图模式时," +
|
||||
"数据将被解码回 JSON 格式以便阅读和编辑;" +
|
||||
"而当您切换回 Excalidraw 模式时,数据就会被再次编码。<br>" +
|
||||
"开启该项后,对于之前已存在但未压缩的绘图文件," +
|
||||
@@ -347,8 +357,8 @@ export default {
|
||||
"在需要阅读或编辑时手动解压缩绘图 JSON。",
|
||||
AUTOSAVE_INTERVAL_DESKTOP_NAME: "桌面端自动保存时间间隔",
|
||||
AUTOSAVE_INTERVAL_DESKTOP_DESC:
|
||||
"每隔多长时间自动保存一次(如果绘图文件没有发生改变,将不会保存)。" +
|
||||
"当 Obsidian 应用内的焦点离开活动文件,如关闭工作空间、点击菜单栏、切换到其他页面或面板等时,也会触发自动保存;" +
|
||||
"每隔多长时间自动保存一次。如果绘图文件没有发生改变,将不会保存。" +
|
||||
"当 Obsidian 应用内的焦点离开活动文件,如关闭某个标签页、点击功能区、切换到其他标签页等时,也会触发自动保存;" +
|
||||
"直接退出 Obsidian 应用(不管是终结进程还是点关闭按钮)不会触发自动保存。",
|
||||
AUTOSAVE_INTERVAL_MOBILE_NAME: "移动端自动保存时间间隔",
|
||||
AUTOSAVE_INTERVAL_MOBILE_DESC:
|
||||
@@ -447,10 +457,24 @@ export default {
|
||||
"注意:该项不会影响 Excalidraw 本身的 PDF 导出功能。<br>" +
|
||||
"请参阅下方 <a href='#"+TAG_PDFEXPORT+"'>PDF 导出设置</a>。<br>" +
|
||||
"⚠️ 关闭并重新打开 Excalidraw/Markdown 文件后生效。",
|
||||
MODES_HEAD: "UI 模式",
|
||||
DESKTOP_UI_MODE_NAME: "桌面端偏好模式",
|
||||
DESKTOP_UI_MODE_DESC: "桌面端设备默认 UI 模式。",
|
||||
TABLET_UI_MODE_NAME: "平板端偏好模式",
|
||||
TABLET_UI_MODE_DESC: "平板端设备默认 UI 模式。",
|
||||
MODE_FULL: "Desktop-mode",
|
||||
MODE_COMPACT: "Compact-mode",
|
||||
MODE_TRAY: "Tray-mode",
|
||||
TRAY_MODE_NAME: "启用托盘模式",
|
||||
PREFER_COMPACT_MODE_DESKTOP_NAME: "在桌面端偏好紧凑模式",
|
||||
PREFER_COMPACT_MODE_DESKTOP_DESC: "切换托盘模式时,开启该项,Excalidraw 将在紧凑模式与托盘模式之间切换。" +
|
||||
"关闭该项,则在完整模式与托盘模式之间切换。",
|
||||
COMPACT_MODE_NAME: "在平板端偏好紧凑模式",
|
||||
COMPACT_MODE_DESC: "该项允许平板端和桌面端设置不同的默认模式。你可以在平板端默认使用紧凑模式,而在桌面端默认使用托盘模式。",
|
||||
HOTKEY_OVERRIDE_HEAD: "热键覆盖",
|
||||
HOTKEY_OVERRIDE_DESC: `一些 Excalidraw 的热键,例如 ${labelCTRL()}+Enter 用于编辑文本,或 ${labelCTRL()}+K 用于创建元素链接。` +
|
||||
"与 Obsidian 的热键设置发生冲突。您在下面添加的热键组合将在使用 Excalidraw 时覆盖 Obsidian 的热键设置," +
|
||||
`因此如果您希望在 Excalidraw 中默认选择“组合对象”,而不是“查看关系图谱”(核心插件 - 关系图谱),您可以添加 ${labelCTRL()}+G。`,
|
||||
HOTKEY_OVERRIDE_DESC: `一些 Excalidraw 的热键,如 ${labelCTRL()}+Enter 用于编辑文本,或 ${labelCTRL()}+K 用于创建元素链接,` +
|
||||
"与 Obsidian 的热键设置冲突。您在下面添加的热键组合将在使用 Excalidraw 时覆盖 Obsidian 的热键设置," +
|
||||
`因此如果您希望在 Excalidraw 中默认“编组”,而不是“查看关系图谱”(核心插件 - 关系图谱),您可以添加 ${labelCTRL()}+G。`,
|
||||
THEME_HEAD: "主题和样式",
|
||||
ZOOM_AND_PAN_HEAD: "缩放和平移",
|
||||
PAN_WITH_RIGHT_MOUSE_BUTTON_NAME: "右键拖动平移",
|
||||
@@ -485,9 +509,8 @@ export default {
|
||||
GRID_DYNAMIC_COLOR_DESC:
|
||||
"<b>开启:</b>更改网格颜色以匹配绘图颜色。<br><b>关闭:</b>将以下颜色用作网格颜色。",
|
||||
GRID_COLOR_NAME: "网格颜色",
|
||||
GRID_OPACITY_NAME: "网格透明度",
|
||||
GRID_OPACITY_DESC: "设置网格的透明度。还将控制将箭头绑定到元素时绑定框的透明度。" +
|
||||
"0 全透明 ⟺ 100 不透明。",
|
||||
GRID_OPACITY_NAME: "网格不透明度",
|
||||
GRID_OPACITY_DESC: "设置网格的不透明度。0 全透明 ⟺ 100 不透明。",
|
||||
GRID_DIRECTION_NAME: "网格方向",
|
||||
GRID_DIRECTION_DESC: "第一个开关显示/隐藏水平网格,第二个开关显示/隐藏垂直网格。",
|
||||
GRID_HORIZONTAL: "渲染水平网格",
|
||||
@@ -562,9 +585,9 @@ export default {
|
||||
`<b>开启:</b>在 Excalidraw <u>查看模式(View)</u>下,鼠标悬停在 <code>[[内部链接]]</code> 上即可预览;` +
|
||||
"而在<u>普通模式(Normal)</u>下,鼠标悬停在内部链接右上角的蓝色标识上即可预览。<br>" +
|
||||
`<b>关闭:</b>鼠标悬停在 <code>[[内部链接]]</code> 上,并且按住 ${labelCTRL()} 才能预览。`,
|
||||
LINKOPACITY_NAME: "链接标识的透明度",
|
||||
LINKOPACITY_NAME: "链接标识的不透明度",
|
||||
LINKOPACITY_DESC:
|
||||
"含有链接的元素,其右上角的链接标识的透明度。0 全透明 ⟺ 100 不透明。",
|
||||
"含有链接的元素,其右上角的链接标识的不透明度。0 全透明 ⟺ 100 不透明。",
|
||||
LINK_CTRL_CLICK_NAME:
|
||||
`按住 ${labelCTRL()} 并点击含有 [[链接]] 或 [别名](链接) 的文本来打开链接`,
|
||||
LINK_CTRL_CLICK_DESC:
|
||||
@@ -621,17 +644,17 @@ export default {
|
||||
MD_DEFAULT_COLOR_NAME:
|
||||
"MD-Embed 的默认文本颜色",
|
||||
MD_DEFAULT_COLOR_DESC:
|
||||
"可以填写 HTML 颜色名,如 steelblue(参考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 进制颜色值,例如 #e67700,或者任何其他有效的 CSS 颜色。<br>" +
|
||||
"可以填写 HTML 颜色名,如 steelblue(参考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 进制颜色值,如 #e67700,或者任何其他有效的 CSS 颜色。<br>" +
|
||||
"可为某个 MD-Embed 单独设置,方法是在其 frontmatter 中添加如 <code>excalidraw-font-color: steelblue</code> 的键值对。",
|
||||
MD_DEFAULT_BORDER_COLOR_NAME:
|
||||
"MD-Embed 的默认边框颜色",
|
||||
MD_DEFAULT_BORDER_COLOR_DESC:
|
||||
"可以填写 HTML 颜色名,如 steelblue(参考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 进制颜色值,例如 #e67700,或者任何其他有效的 CSS 颜色。<br>" +
|
||||
"可以填写 HTML 颜色名,如 steelblue(参考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 进制颜色值,如 #e67700,或者任何其他有效的 CSS 颜色。<br>" +
|
||||
"可为某个 MD-Embed 单独设置,方法是在其 frontmatter 中添加如 <code>excalidraw-border-color: gray</code> 的键值对。<br>" +
|
||||
"如果您不想要边框,请留空。",
|
||||
MD_CSS_NAME: "MD-Embed 的默认 CSS 样式表",
|
||||
MD_CSS_DESC:
|
||||
"MD-Embed 图像所采用的 CSS 样式表文件名。需包含扩展名,例如 md-embed.css。" +
|
||||
"MD-Embed 图像所采用的 CSS 样式表文件名。需包含扩展名,如 md-embed.css。" +
|
||||
"允许使用 Markdown 文档(如 md-embed-css.md),但其内容应符合 CSS 语法。<br>" +
|
||||
"如果您要查询 CSS 所作用的 HTML 节点,请在 Obsidian 开发者控制台(Ctrl+Shift+I)中键入命令:" +
|
||||
"<code>ExcalidrawAutomate.mostRecentMarkdownSVG</code> —— 这将显示 Excalidraw 最近生成的 SVG。<br>" +
|
||||
@@ -703,7 +726,7 @@ export default {
|
||||
"也就是说,该项不会自动帮您生成 SVG/PNG 副本,而只会引用已有的 SVG/PNG 副本。",
|
||||
EMBED_MARKDOWN_COMMENT_NAME: "将链接作为注释插入",
|
||||
EMBED_MARKDOWN_COMMENT_DESC:
|
||||
"在图像下方以 Markdown 链接形式插入原始 Excalidraw 文件的链接,例如:<code>%%[[drawing.excalidraw]]%%</code>。<br>" +
|
||||
"在图像下方以 Markdown 链接形式插入原始 Excalidraw 文件的链接,如 <code>%%[[drawing.excalidraw]]%%</code>。<br>" +
|
||||
"除了添加 Markdown 注释之外,您还可以选择嵌入的 SVG 或 PNG,并使用命令面板:" +
|
||||
"'<code>Excalidraw: 打开 Excalidraw 绘图</code>'来打开该绘图",
|
||||
EMBED_WIKILINK_NAME: "“嵌入绘图到当前 Markdown 文档中”系列命令产生的内部链接类型",
|
||||
@@ -748,7 +771,7 @@ export default {
|
||||
EXPORT_BOTH_DARK_AND_LIGHT_DESC: "若开启,Excalidraw 将导出两个文件:filename.dark.png(或 .svg)和 filename.light.png(或 .svg)。<br>" +
|
||||
"该项可作用于“自动导出 SVG 副本”、“自动导出 PNG 副本”,以及其他的手动的导出命令。",
|
||||
COMPATIBILITY_HEAD: "兼容性设置",
|
||||
COMPATIBILITY_DESC: "如果没有特殊原因(例如您想同时在 VSCode/Logseq 和 Obsidian 中使用 Excalidraw),建议您使用 Markdown 格式的绘图文件,而不是旧的 Excalidraw.com 格式,因为本插件的很多功能在旧格式中无法使用。",
|
||||
COMPATIBILITY_DESC: "如果没有特殊原因(例如:您想同时在 VSCode/Logseq 和 Obsidian 中使用 Excalidraw),建议您使用 Markdown 格式的绘图文件,而不是旧的 Excalidraw.com 格式,因为本插件的很多功能在旧格式中无法使用。",
|
||||
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_NAME: "兼容代码格式化(Linting)",
|
||||
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_DESC: "Excalidraw 对 <code># Excalidraw Data</code> 下的文件结构非常敏感。文档的自动格式化可能会在 Excalidraw 数据中造成错误。" +
|
||||
"虽然我已经努力使数据加载对自动格式化变更具有一定的抗性,但这种解决方案并非万无一失。<br>" +
|
||||
@@ -759,7 +782,7 @@ export default {
|
||||
PRESERVE_TEXT_AFTER_DRAWING_NAME: "兼容 Zotero 和脚注(footnotes)",
|
||||
PRESERVE_TEXT_AFTER_DRAWING_DESC: "保留 Excalidraw Markdown 中 <code>## Drawing</code> 部分之后的文本内容。保存非常大的绘图时,这可能会造成微小的性能影响。",
|
||||
DEBUGMODE_NAME: "开启 debug 信息",
|
||||
DEBUGMODE_DESC: "我建议在启用/禁用该项后重新启动 Obsidian。这将在控制台中启用调试消息。这对于排查问题很有帮助。" +
|
||||
DEBUGMODE_DESC: "我建议在启用/禁用该项后重新启动 Obsidian。这将在控制台中启用调试消息,有助于排查问题。" +
|
||||
"如果您在使用插件时遇到问题,请启用该项,重现问题,并在 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/issues'>GitHub</a> 上提出的问题中包含控制台日志。",
|
||||
SLIDING_PANES_NAME: "支持 Sliding Panes 插件",
|
||||
SLIDING_PANES_DESC:
|
||||
@@ -864,7 +887,7 @@ export default {
|
||||
下载后,将内容解压到您的仓库中的一个文件夹内。<br>
|
||||
预加载字体会影响启动性能。因此,您可以选择加载哪些字体。`,
|
||||
CJK_ASSETS_FOLDER_NAME: "CJK 字体文件夹(區分大小寫!)",
|
||||
CJK_ASSETS_FOLDER_DESC: `您可以在此设置 CJK 字体文件夹的位置。例如,您可以选择将其放置在 <code>Excalidraw/CJK Fonts</code> 下。<br>
|
||||
CJK_ASSETS_FOLDER_DESC: `您可以在此设置 CJK 字体文件夹的位置。例如:<code>Excalidraw/CJK Fonts</code>。<br>
|
||||
<strong>重要:</strong> 请勿将此文件夹设置为仓库根目录!请勿在此文件夹中放置其他字体。<br>
|
||||
<strong>注意:</strong> 如果您使用 Obsidian Sync 并希望在设备之间同步这些字体文件,请确保 Obsidian Sync 设置为同步“所有其他文件类型”。`,
|
||||
LOAD_CHINESE_FONTS_NAME: "启动时从文件加载中文字体",
|
||||
@@ -994,15 +1017,15 @@ export default {
|
||||
ES_FILENAME_VISIBLE: "显示页内标题",
|
||||
ES_BACKGROUND_HEAD: "背景色",
|
||||
ES_BACKGROUND_DESC_INFO: "点击此处查看更多颜色信息",
|
||||
ES_BACKGROUND_DESC_DETAIL: "背景色仅影响预览模式的 MD-Embeddable。在编辑模式,它会根据场景(通过笔记属性设置)或插件设置,遵循 Obsidian 的深色/浅色主题。背景色有两层:元素背景色(下层颜色)和上层颜色。选择“匹配元素”表示两层都遵循元素背景色。选择“匹配绘图”或特定背景色不会改变元素背景色。设置透明度(例如 50%)会将绘图或选定的颜色与元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素属性编辑器中将元素背景色设置为透明,这样只有上层颜色生效。",
|
||||
ES_BACKGROUND_DESC_DETAIL: "背景色仅影响预览模式的 MD-Embeddable。在编辑模式,它会根据场景(通过笔记属性设置)或插件设置,遵循 Obsidian 的深色/浅色主题。背景色有两层:元素背景色(下层颜色)和上层颜色。选择“匹配元素”表示两层都遵循元素背景色。选择“匹配绘图”或特定背景色不会改变元素背景色。设置不透明度(如 50%)会将绘图或选定的颜色与元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素属性编辑器中将元素背景色设置为透明,这样只有上层颜色生效。",
|
||||
ES_BACKGROUND_MATCH_ELEMENT: "匹配元素背景色",
|
||||
ES_BACKGROUND_MATCH_CANVAS: "匹配绘图背景色",
|
||||
ES_BACKGROUND_COLOR: "背景色",
|
||||
ES_BORDER_HEAD: "边框颜色",
|
||||
ES_BORDER_COLOR: "边框颜色",
|
||||
ES_BORDER_MATCH_ELEMENT: "匹配元素边框颜色",
|
||||
ES_BACKGROUND_OPACITY: "背景透明度",
|
||||
ES_BORDER_OPACITY: "边框透明度",
|
||||
ES_BACKGROUND_OPACITY: "背景不透明度",
|
||||
ES_BORDER_OPACITY: "边框不透明度",
|
||||
ES_EMBEDDABLE_SETTINGS: "MD-Embeddable 设置",
|
||||
ES_USE_OBSIDIAN_DEFAULTS: "使用 Obsidian 默认设置",
|
||||
ES_ZOOM_100_RELATIVE_DESC: "使元素的缩放等级等于当前绘图的缩放等级",
|
||||
@@ -1111,6 +1134,7 @@ export default {
|
||||
EXPORTDIALOG_BACKGROUND: "背景",
|
||||
EXPORTDIALOG_BACKGROUND_TRANSPARENT: "透明",
|
||||
EXPORTDIALOG_BACKGROUND_USE_COLOR: "使用场景颜色",
|
||||
EXPORTDIALOG_INCLUDE_INTERNAL_LINKS: "导出内部链接为 SVG/PDF?",
|
||||
// Selection
|
||||
EXPORTDIALOG_SELECTED_ELEMENTS: "导出",
|
||||
EXPORTDIALOG_SELECTED_ALL: "整个场景",
|
||||
@@ -1171,7 +1195,7 @@ export default {
|
||||
// Screenshot tab
|
||||
EXPORTDIALOG_NOT_AVAILALBE: "抱歉,此功能仅在绘图在主 Obsidian 工作区打开时可用。",
|
||||
EXPORTDIALOG_TAB_SCREENSHOT: "截图",
|
||||
EXPORTDIALOG_SCREENSHOT_DESC: "截图将包含可嵌入的内容,例如 Markdown 页面、YouTube、网站等。它们仅在桌面端可用,无法自动导出,并且仅支持 PNG 格式。",
|
||||
EXPORTDIALOG_SCREENSHOT_DESC: "截图将包含可嵌入的内容,如 Markdown 页面、YouTube、网站等。它们仅在桌面端可用,无法自动导出,并且仅支持 PNG 格式。",
|
||||
SCREENSHOT_DESKTOP_ONLY: "截图功能仅在桌面端可用",
|
||||
SCREENSHOT_FILE_SUCCESS: "截图已保存到仓库",
|
||||
SCREENSHOT_CLIPBOARD_SUCCESS: "截图已复制到剪贴板",
|
||||
@@ -1185,7 +1209,7 @@ export default {
|
||||
UIFM_TITLE: "从仓库中嵌入文件",
|
||||
UIFM_SECTION_HEAD: "选择章节标题",
|
||||
UIFM_ANCHOR: "锚定为原始大小的 100%",
|
||||
UIFM_ANCHOR_DESC: "这是一个专业功能,请在了解其作用的情况下再使用。启用后,即使你在 Excalidraw 中调整了导入图像的大小,下次打开绘图时,该图像仍会恢复为原始大小的 100%。这在将一个独立的 Excalidraw 点子嵌入到另一份笔记中,并希望保持文字和图标的相对尺寸时非常有用。",
|
||||
UIFM_ANCHOR_DESC: "这是一个专业功能,请在了解其作用的情况下再使用。启用后,即使你在 Excalidraw 中调整了导入图像的大小,下次打开绘图时,该图像仍会恢复为原始大小的 100%。当你将一个独立的 Excalidraw 点子嵌入到另一份笔记中,并希望保持文字和图标的相对尺寸时,这会很有用。",
|
||||
UIFM_BTN_EMBEDDABLE: "以交互形式",
|
||||
UIFM_BTN_PDF: "PDF 页面",
|
||||
UIFM_BTN_IMAGE: "以图像形式",
|
||||
@@ -1200,10 +1224,27 @@ export default {
|
||||
COMP_IMG_LaTeX: "LaTeX 公式",
|
||||
COMP_FRAME: "画框操作",
|
||||
COMP_FRAME_HINT: "切换标记画框。标记画框仅用于引导,用于定义幻灯片/打印区域/[[file#^frame=id]]," +
|
||||
"导出时会隐藏;也不会包含元素。通过上下文菜单显示/隐藏标记画框。",
|
||||
"导出时会隐藏;也不会包含元素。通过上下文菜单显示/隐藏标记画框。",
|
||||
|
||||
//CustomEmbeddable.tsx
|
||||
NOTICE_PDF_THEME: "已覆盖 PDF 主题。\n" +
|
||||
"通过文件的 'excalidraw-embeddable-theme' 笔记属性设置(将覆盖插件设置)。\n\n" +
|
||||
"值:dark/light/auto/default,表示深色、浅色、跟随 Excalidraw 或 Obsidian 主题。",
|
||||
|
||||
//EmbeddableActionsMenu.tsx
|
||||
BOOKMARK_PAGE: "保存当前进度",
|
||||
CAPTURE_PAGE: "以图像形式截取当前页面",
|
||||
|
||||
//VersionMismatch.ts
|
||||
//WARNING: Do not change the {VAL_RECORDED} and {VAL_ACTUAL} strings, they are replaced by the actual version values at runtime!
|
||||
VERSION_MISMATCH_NOTICE: `Obsidian 显示的版本是 <b>{VAL_RECORDED}</b>,但已安装的 Excalidraw 代码显示的版本是 <b>{VAL_ACTUAL}</b>。`,
|
||||
|
||||
VERSION_MISMATCH_HEADING: "Excalidraw 版本不匹配",
|
||||
VERSION_MISMATCH_CAUSE: "通常源于同步不完整,大文件未能同步(如使用 Obsidian Sync Standard,main.js > 5MB),只更新了 <code>manifest.json</code>。",
|
||||
VERSION_MISMATCH_OPTIONS: "选项:<br><b>1.</b> 重新下载插件(推荐)。<br><b>2.</b> 暂时忽略。",
|
||||
VERSION_MISMATCH_NOTE: "注意:手动更新版本信息可能会影响依赖 manifest.json 的工具(如 Plugin Update Tracker、BRAT),直到你完全重装插件。",
|
||||
VERSION_MISMATCH_DISABLE_NAME: "禁用版本不匹配警告",
|
||||
VERSION_MISMATCH_DISABLE_DESC: "可在以下位置重新启用:设置 → Excalidraw → 基本 → 警告插件更新不完整",
|
||||
VERSION_MISMATCH_REDOWNLOAD: "重新下载插件",
|
||||
VERSION_MISMATCH_IGNORE: "忽略",
|
||||
};
|
||||
+70
-33
@@ -42,7 +42,7 @@ export default {
|
||||
"開啟已有的繪圖 - 於當前面板",
|
||||
TRANSCLUDE: "嵌入繪圖 ![[drawing]] 到當前 Markdown 文件中",
|
||||
TRANSCLUDE_MOST_RECENT: "嵌入最近編輯過的繪圖 ![[drawing]] 到當前 Markdown 文件中",
|
||||
TOGGLE_LEFTHANDED_MODE: "切換為左手模式",
|
||||
TOGGLE_LEFTHANDED_MODE: "切換左手模式",
|
||||
TOGGLE_SPLASHSCREEN: "在新繪圖中顯示啟動畫面",
|
||||
FLIP_IMAGE: "在彈出視窗中開啟所選繪圖的背景筆記",
|
||||
NEW_IN_NEW_PANE: "新建繪圖 - 於新面板",
|
||||
@@ -86,19 +86,19 @@ export default {
|
||||
INSERT_MD: "以影像形式嵌入 Markdown 文件到當前繪圖中",
|
||||
INSERT_PDF: "以影像形式嵌入 PDF 到當前繪圖中",
|
||||
INSERT_LAST_ACTIVE_PDF_PAGE_AS_IMAGE: "以影像形式嵌入最後啟用的 PDF 頁面",
|
||||
UNIVERSAL_ADD_FILE: "以互動或影像形式嵌入檔案",
|
||||
UNIVERSAL_ADD_FILE: "嵌入檔案 (Insert ANY file)",
|
||||
INSERT_CARD: "插入“背景筆記”卡片",
|
||||
CONVERT_CARD_TO_FILE: "將“背景筆記”卡片儲存到檔案",
|
||||
ERROR_TRY_AGAIN: "請重試。",
|
||||
PASTE_CODEBLOCK: "貼上程式碼塊",
|
||||
INSERT_LATEX:
|
||||
`插入 LaTeX 公式(如:\\binom{n}{k} = \\frac{n!}{k!(n-k)!})`,
|
||||
`插入 LaTeX 公式到當前繪圖中`,
|
||||
ENTER_LATEX: "輸入 LaTeX 公式",
|
||||
READ_RELEASE_NOTES: "閱讀本外掛的更新說明",
|
||||
RUN_OCR: "OCR 整個繪圖:識別塗鴉和圖片裡的文字並複製到剪貼簿和筆記屬性中",
|
||||
RERUN_OCR: "重新 OCR 整個繪圖:識別塗鴉和圖片裡的文字並複製到剪貼簿和筆記屬性中",
|
||||
RUN_OCR_ELEMENTS: "OCR 選中的元素:識別塗鴉和圖片裡的文字並複製到剪貼簿",
|
||||
TRAY_MODE: "繪圖工具屬性頁:面板模式 ⟺ 托盤模式",
|
||||
UI_MODE: "切換 UI 模式",
|
||||
SEARCH: "搜尋文字",
|
||||
CROP_PAGE: "裁剪所選頁面並新增蒙版",
|
||||
CROP_IMAGE: "裁剪圖片並新增蒙版",
|
||||
@@ -110,11 +110,13 @@ export default {
|
||||
TEMPORARY_ENABLE_AUTOSAVE: "啟用自動儲存功能",
|
||||
FONTS_LOADED: "Excalidraw: CJK 字型已載入",
|
||||
FONTS_LOAD_ERROR: "Excalidraw: 在資原始檔夾下找不到 CJK 字型\n",
|
||||
TOGGLE_ENABLE_CONTEXT_MENU: "切換是否啟用上下文選單(在移動裝置上很有用)",
|
||||
|
||||
//Prompt.ts
|
||||
SELECT_LINK_TO_OPEN: "選擇要開啟的連結",
|
||||
|
||||
//ExcalidrawView.ts
|
||||
ABOUT_LIBRARIES: "如何載入素材庫",
|
||||
ERROR_CANT_READ_FILEPATH: "錯誤,無法讀取檔案路徑。正在改為匯入檔案",
|
||||
NO_SEARCH_RESULT: "在繪圖中未找到匹配的元素",
|
||||
FORCE_SAVE_ABORTED: "自動儲存被中止,因為檔案正在儲存中",
|
||||
@@ -137,8 +139,8 @@ export default {
|
||||
"1) 使用 Ctrl/CMD+A 選擇您的繪圖,然後使用 Ctrl/CMD+C 進行復制。\n" +
|
||||
"2) 然後在新窗格中,透過 Ctrl/CMD 點選 Excalidraw 功能區按鈕建立一個空白繪圖。\n" +
|
||||
"3) 最後,使用 Ctrl/CMD+V 將您的作品貼上到新檔案中。",
|
||||
ARIA_LABEL_TRAY_MODE: "托盤模式提供更寬敞的繪圖空間",
|
||||
TRAY_TRAY_MODE: "切換托盤模式",
|
||||
ARIA_LABEL_TRAY_MODE: "切換 3 種 UI 模式:完整模式(桌面端)、緊湊模式、托盤模式。手機端只有手機端模式。",
|
||||
TRAY_TRAY_MODE: "切換 UI 模式",
|
||||
TRAY_SCRIPT_LIBRARY: "指令碼庫",
|
||||
TRAY_SCRIPT_LIBRARY_ARIA: "瀏覽 Excalidraw 指令碼庫",
|
||||
TRAY_EXPORT: "匯出繪圖…",
|
||||
@@ -155,7 +157,7 @@ export default {
|
||||
LINK_BUTTON_CLICK_NO_TEXT:
|
||||
"請選擇一個包含內部或外部連結的元素。\n",
|
||||
LINEAR_ELEMENT_LINK_CLICK_ERROR:
|
||||
"箭頭和線元素的連結無法透過 " + labelCTRL() + " + 點選元素來導航,因為這也會啟用線編輯器。\n" +
|
||||
"箭頭和線條元素的連結無法透過 " + labelCTRL() + " + 點選元素來跳轉,因為這也會啟用線條編輯器。\n" +
|
||||
"請使用右鍵上下文選單開啟連結,或點選元素右上角的連結指示器。\n",
|
||||
FILENAME_INVALID_CHARS:
|
||||
'檔名不能包含以下符號: * " \\ < > : | ? #',
|
||||
@@ -168,7 +170,7 @@ export default {
|
||||
COMPATIBILITY_MODE:
|
||||
"*.excalidraw 是相容舊版的繪圖檔案格式。需要轉換為新格式才能解鎖本外掛的全部功能。",
|
||||
CONVERT_FILE: "轉換為新格式",
|
||||
BACKUP_AVAILABLE: "載入繪圖檔案時出錯,可能是由於 Obsidian 在上次儲存時意外退出了(手機上更容易發生這種意外)。<br><br><b>好訊息:</b>這臺裝置上存在備份。您是否想要恢復本裝置上的備份?<br><br>(我建議您先嚐試在最近使用過的其他裝置上開啟該繪圖,以檢查是否有更新的備份。)",
|
||||
BACKUP_AVAILABLE: "載入繪圖檔案時出錯,可能是由於 Obsidian 在上次儲存時意外退出了(移動裝置上更容易發生這種意外)。<br><br><b>好訊息:</b>這臺裝置上存在備份。您是否想要恢復本裝置上的備份?<br><br>(我建議您先嚐試在最近使用過的其他裝置上開啟該繪圖,以檢查是否有更新的備份。)",
|
||||
BACKUP_RESTORED: "已恢復備份",
|
||||
BACKUP_SAVE_AS_FILE: "此繪圖為空。但有一個非空的備份可用。您想將其恢復為新檔案並在新標籤頁中開啟嗎?",
|
||||
BACKUP_SAVE: "恢復",
|
||||
@@ -214,6 +216,8 @@ export default {
|
||||
|
||||
|
||||
//settings.ts
|
||||
DISABLE_CONTEXT_MENU_NAME: "停用 Excalidraw 上下文選單",
|
||||
DISABLE_CONTEXT_MENU_DESC: "停用 Excalidraw 的上下文選單。這在移動裝置上很有用,因為上下文選單有時會在不需要的時候彈出。",
|
||||
NOTEBOOKLM_LINK_ARIA: "向 NotebookLM 諮詢有關外掛的幫助。此模型已預載入了我所有的影片轉錄稿、釋出說明和其他幫助內容。與 NotebookLM 聊天,瀏覽我的 250+ 影片和 Excalidraw 檔案。",
|
||||
NOTEBOOKLM_LINK_TEXT: "學習外掛。訪問 NotebookLM 知識庫。",
|
||||
LINKS_BUGS_ARIA: "在外掛的 GitHub 頁面報告錯誤和提交功能請求",
|
||||
@@ -227,13 +231,15 @@ export default {
|
||||
LINKS_VTW: "加入研討會",
|
||||
LINKS_BOOK_ARIA: "閱讀我的視覺思維著作《Sketch Your Mind》",
|
||||
LINKS_BOOK: "閱讀書籍",
|
||||
LINKS_WIKI: "外掛 Wiki",
|
||||
LINKS_WIKI_ARIA: "瀏覽 Excalidraw 外掛 Wiki",
|
||||
LINKS_WIKI: "外掛維基",
|
||||
LINKS_WIKI_ARIA: "瀏覽 Excalidraw 外掛維基",
|
||||
|
||||
RELEASE_NOTES_NAME: "顯示更新說明",
|
||||
RELEASE_NOTES_DESC:
|
||||
"<b>開啟:</b>每次更新本外掛後,顯示最新發行版本的說明。<br>" +
|
||||
"<b>關閉:</b>您仍可以在 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases'>GitHub</a> 上閱讀更新說明。",
|
||||
WARN_ON_MANIFEST_MISMATCH_NAME: "警告外掛更新不完整",
|
||||
WARN_ON_MANIFEST_MISMATCH_DESC: "檢查已安裝的 Excalidraw 可執行檔案是否與 Obsidian 外掛列表中顯示的版本一致。如果不一致(通常源於同步不完整),你會看到警告並可以選擇更新。關閉該項可停用檢查。",
|
||||
NEWVERSION_NOTIFICATION_NAME: "外掛更新通知",
|
||||
NEWVERSION_NOTIFICATION_DESC:
|
||||
"<b>開啟:</b>當本外掛存在可用更新時,顯示通知。<br>" +
|
||||
@@ -278,10 +284,10 @@ export default {
|
||||
TEMPLATE_NAME: "Excalidraw 模板檔案(區分大小寫!)",
|
||||
TEMPLATE_DESC:
|
||||
"Excalidraw 模板檔案(資料夾)的儲存路徑。<br>" +
|
||||
"<b>模板檔案:</b>比如:您的模板在預設的 Excalidraw 資料夾中且檔名是 Template.md," +
|
||||
"<b>模板檔案:</b>例如:您的模板在預設的 Excalidraw 資料夾中且檔名是 Template.md," +
|
||||
"則該項應設為 Excalidraw/Template.md 或 Excalidraw/Template(省略 .md 副檔名)。<br>" +
|
||||
"如果您在相容模式下使用 Excalidraw,那麼您的模板檔案也必須是舊的 *.excalidraw 格式," +
|
||||
"例如 Excalidraw/Template.excalidraw。<br><b>模板資料夾:</b> 您還可以將資料夾設定為模板。" +
|
||||
"如 Excalidraw/Template.excalidraw。<br><b>模板資料夾:</b> 您還可以將資料夾設定為模板。" +
|
||||
"這時,建立新繪圖時將提示您選擇使用哪個模板。<br>" +
|
||||
"<b>專業提示:</b> 如果您正在使用 Obsidian Templater 外掛,您可以將 Templater 程式碼新增到不同的" +
|
||||
"Excalidraw 模板中,以自動配置您的繪圖。",
|
||||
@@ -307,6 +313,9 @@ export default {
|
||||
"使用哪個 AI 模型來生成文字。請填寫有效的 OpenAI 模型名稱。" +
|
||||
"您可訪問 <a href='https://platform.openai.com/docs/models'>OpenAI 網站</a> 瞭解更多模型資訊。",
|
||||
AI_OPENAI_DEFAULT_MODEL_PLACEHOLDER: "gpt-3.5-turbo-1106",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_NAME: "最大 token 數",
|
||||
AI_OPENAI_DEFAULT_MAX_TOKENS_DESC:
|
||||
"API 生成的最大 token 數。設定為 0 以忽略 max_tokens 欄位(適用於不支援該引數的模型,如 GPT-5)。",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_NAME: "預設的圖片 AI 模型",
|
||||
AI_OPENAI_DEFAULT_IMAGE_MODEL_DESC:
|
||||
"使用哪個 AI 模型來生成圖片。圖生圖會強制使用 dall-e-2 模型," +
|
||||
@@ -323,7 +332,7 @@ export default {
|
||||
"預設的 OpenAI API URL。請填寫有效的 OpenAI API URL。" +
|
||||
"Excalidraw 會透過該 URL 傳送 API 請求給 OpenAI。我沒有對該項做任何錯誤處理,請謹慎修改。",
|
||||
AI_OPENAI_DEFAULT_IMAGE_API_URL_NAME: "OpenAI 圖片生成 API URL",
|
||||
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "輸入預設 AI 模型名稱,例如:gpt-4o",
|
||||
AI_OPENAI_DEFAULT_VISION_MODEL_PLACEHOLDER: "輸入預設 AI 模型名稱,如 gpt-4o",
|
||||
SAVING_HEAD: "儲存",
|
||||
SAVING_DESC: "包括:壓縮,自動儲存的時間間隔,檔案的命名格式和副檔名等。",
|
||||
COMPRESS_NAME: "壓縮 Excalidraw JSON",
|
||||
@@ -332,7 +341,7 @@ export default {
|
||||
"(使用 <a href='https://pieroxy.net/blog/pages/lz-string/index.html'>LZ-String</a> 演算法)。" +
|
||||
"這樣一方面可以避免原來的明文 JSON 資料干擾 Obsidian 的文字搜尋結果," +
|
||||
"另一方面減小了繪圖檔案的體積。<br>" +
|
||||
"當您透過功能區按鈕或命令將繪圖切換至 Markdown 檢視模式時," +
|
||||
"當您透過選單按鈕或命令將繪圖切換至 Markdown 檢視模式時," +
|
||||
"資料將被解碼回 JSON 格式以便閱讀和編輯;" +
|
||||
"而當您切換回 Excalidraw 模式時,資料就會被再次編碼。<br>" +
|
||||
"開啟該項後,對於之前已存在但未壓縮的繪圖檔案," +
|
||||
@@ -347,8 +356,8 @@ export default {
|
||||
"在需要閱讀或編輯時手動解壓縮繪圖 JSON。",
|
||||
AUTOSAVE_INTERVAL_DESKTOP_NAME: "桌面端自動儲存時間間隔",
|
||||
AUTOSAVE_INTERVAL_DESKTOP_DESC:
|
||||
"每隔多長時間自動儲存一次(如果繪圖檔案沒有發生改變,將不會儲存)。" +
|
||||
"當 Obsidian 應用內的焦點離開活動檔案,如關閉工作空間、點選選單欄、切換到其他頁面或面板等時,也會觸發自動儲存;" +
|
||||
"每隔多長時間自動儲存一次。如果繪圖檔案沒有發生改變,將不會儲存。" +
|
||||
"當 Obsidian 應用內的焦點離開活動檔案,如關閉某個標籤頁、點選功能區、切換到其他標籤頁等時,也會觸發自動儲存;" +
|
||||
"直接退出 Obsidian 應用(不管是終結程序還是點關閉按鈕)不會觸發自動儲存。",
|
||||
AUTOSAVE_INTERVAL_MOBILE_NAME: "移動端自動儲存時間間隔",
|
||||
AUTOSAVE_INTERVAL_MOBILE_DESC:
|
||||
@@ -447,10 +456,24 @@ export default {
|
||||
"注意:該項不會影響 Excalidraw 本身的 PDF 匯出功能。<br>" +
|
||||
"請參閱下方 <a href='#"+TAG_PDFEXPORT+"'>PDF 匯出設定</a>。<br>" +
|
||||
"⚠️ 關閉並重新開啟 Excalidraw/Markdown 檔案後生效。",
|
||||
MODES_HEAD: "UI 模式",
|
||||
DESKTOP_UI_MODE_NAME: "桌面端偏好模式",
|
||||
DESKTOP_UI_MODE_DESC: "桌面端裝置預設 UI 模式。",
|
||||
TABLET_UI_MODE_NAME: "平板端偏好模式",
|
||||
TABLET_UI_MODE_DESC: "平板端裝置預設 UI 模式。",
|
||||
MODE_FULL: "Desktop-mode",
|
||||
MODE_COMPACT: "Compact-mode",
|
||||
MODE_TRAY: "Tray-mode",
|
||||
TRAY_MODE_NAME: "啟用托盤模式",
|
||||
PREFER_COMPACT_MODE_DESKTOP_NAME: "在桌面端偏好緊湊模式",
|
||||
PREFER_COMPACT_MODE_DESKTOP_DESC: "切換托盤模式時,開啟該項,Excalidraw 將在緊湊模式與托盤模式之間切換。" +
|
||||
"關閉該項,則在完整模式與托盤模式之間切換。",
|
||||
COMPACT_MODE_NAME: "在平板端偏好緊湊模式",
|
||||
COMPACT_MODE_DESC: "該項允許平板端和桌面端設定不同的預設模式。你可以在平板端預設使用緊湊模式,而在桌面端預設使用托盤模式。",
|
||||
HOTKEY_OVERRIDE_HEAD: "熱鍵覆蓋",
|
||||
HOTKEY_OVERRIDE_DESC: `一些 Excalidraw 的熱鍵,例如 ${labelCTRL()}+Enter 用於編輯文字,或 ${labelCTRL()}+K 用於建立元素連結。` +
|
||||
"與 Obsidian 的熱鍵設定發生衝突。您在下面新增的熱鍵組合將在使用 Excalidraw 時覆蓋 Obsidian 的熱鍵設定," +
|
||||
`因此如果您希望在 Excalidraw 中預設選擇“組合物件”,而不是“檢視關係圖譜”(核心外掛 - 關係圖譜),您可以新增 ${labelCTRL()}+G。`,
|
||||
HOTKEY_OVERRIDE_DESC: `一些 Excalidraw 的熱鍵,如 ${labelCTRL()}+Enter 用於編輯文字,或 ${labelCTRL()}+K 用於建立元素連結,` +
|
||||
"與 Obsidian 的熱鍵設定衝突。您在下面新增的熱鍵組合將在使用 Excalidraw 時覆蓋 Obsidian 的熱鍵設定," +
|
||||
`因此如果您希望在 Excalidraw 中預設“編組”,而不是“檢視關係圖譜”(核心外掛 - 關係圖譜),您可以新增 ${labelCTRL()}+G。`,
|
||||
THEME_HEAD: "主題和樣式",
|
||||
ZOOM_AND_PAN_HEAD: "縮放和平移",
|
||||
PAN_WITH_RIGHT_MOUSE_BUTTON_NAME: "右鍵拖動平移",
|
||||
@@ -621,17 +644,17 @@ export default {
|
||||
MD_DEFAULT_COLOR_NAME:
|
||||
"MD-Embed 的預設文字顏色",
|
||||
MD_DEFAULT_COLOR_DESC:
|
||||
"可以填寫 HTML 顏色名,如 steelblue(參考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 進位制顏色值,例如 #e67700,或者任何其他有效的 CSS 顏色。<br>" +
|
||||
"可以填寫 HTML 顏色名,如 steelblue(參考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 進位制顏色值,如 #e67700,或者任何其他有效的 CSS 顏色。<br>" +
|
||||
"可為某個 MD-Embed 單獨設定,方法是在其 frontmatter 中新增如 <code>excalidraw-font-color: steelblue</code> 的鍵值對。",
|
||||
MD_DEFAULT_BORDER_COLOR_NAME:
|
||||
"MD-Embed 的預設邊框顏色",
|
||||
MD_DEFAULT_BORDER_COLOR_DESC:
|
||||
"可以填寫 HTML 顏色名,如 steelblue(參考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 進位制顏色值,例如 #e67700,或者任何其他有效的 CSS 顏色。<br>" +
|
||||
"可以填寫 HTML 顏色名,如 steelblue(參考 <a href='https://www.w3schools.com/colors/colors_names.asp'>HTML Color Names</a>),或者有效的 16 進位制顏色值,如 #e67700,或者任何其他有效的 CSS 顏色。<br>" +
|
||||
"可為某個 MD-Embed 單獨設定,方法是在其 frontmatter 中新增如 <code>excalidraw-border-color: gray</code> 的鍵值對。<br>" +
|
||||
"如果您不想要邊框,請留空。",
|
||||
MD_CSS_NAME: "MD-Embed 的預設 CSS 樣式表",
|
||||
MD_CSS_DESC:
|
||||
"MD-Embed 影像所採用的 CSS 樣式表文件名。需包含副檔名,例如 md-embed.css。" +
|
||||
"MD-Embed 影像所採用的 CSS 樣式表文件名。需包含副檔名,如 md-embed.css。" +
|
||||
"允許使用 Markdown 文件(如 md-embed-css.md),但其內容應符合 CSS 語法。<br>" +
|
||||
"如果您要查詢 CSS 所作用的 HTML 節點,請在 Obsidian 開發者控制檯(Ctrl+Shift+I)中鍵入命令:" +
|
||||
"<code>ExcalidrawAutomate.mostRecentMarkdownSVG</code> —— 這將顯示 Excalidraw 最近生成的 SVG。<br>" +
|
||||
@@ -669,7 +692,7 @@ export default {
|
||||
EMBED_REUSE_EXPORTED_IMAGE_DESC:
|
||||
"該項與下方“匯出”部分“匯出設定”中的 <a href='#"+TAG_AUTOEXPORT+"'>自動匯出 SVG/PNG 副本</a> 選項配合使用。如果嵌入到 Markdown 文件中的繪圖檔案存在同名的 SVG/PNG 副本,則將其作為預覽圖,而不再重新生成。<br>" +
|
||||
"該項能夠提高 Markdown 文件的開啟速度,尤其是當嵌入到 Markdown 文件中的繪圖檔案中含有大量圖片或 MD-Embed 時。" +
|
||||
"但是,該項也可能導致預覽圖無法立即響應繪圖檔案或者 Obsidian 主題的修改。<br>" +
|
||||
"但是,該項也可能導致預覽圖無法即時反應繪圖檔案或者 Obsidian 主題的修改。<br>" +
|
||||
"該項僅作用於嵌入到 Markdown 文件中的繪圖。" +
|
||||
"該項無法提升繪圖檔案的開啟速度。詳見 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.6.23' target='_blank'>此說明</a>。",
|
||||
/*EMBED_PREVIEW_SVG_NAME: "生成 SVG 格式的預覽圖",
|
||||
@@ -703,7 +726,7 @@ export default {
|
||||
"也就是說,該項不會自動幫您生成 SVG/PNG 副本,而只會引用已有的 SVG/PNG 副本。",
|
||||
EMBED_MARKDOWN_COMMENT_NAME: "將連結作為註釋插入",
|
||||
EMBED_MARKDOWN_COMMENT_DESC:
|
||||
"在影像下方以 Markdown 連結形式插入原始 Excalidraw 檔案的連結,例如:<code>%%[[drawing.excalidraw]]%%</code>。<br>" +
|
||||
"在影像下方以 Markdown 連結形式插入原始 Excalidraw 檔案的連結,如 <code>%%[[drawing.excalidraw]]%%</code>。<br>" +
|
||||
"除了新增 Markdown 註釋之外,您還可以選擇嵌入的 SVG 或 PNG,並使用命令面板:" +
|
||||
"'<code>Excalidraw: 開啟 Excalidraw 繪圖</code>'來開啟該繪圖",
|
||||
EMBED_WIKILINK_NAME: "“嵌入繪圖到當前 Markdown 文件中”系列命令產生的內部連結型別",
|
||||
@@ -748,7 +771,7 @@ export default {
|
||||
EXPORT_BOTH_DARK_AND_LIGHT_DESC: "若開啟,Excalidraw 將匯出兩個檔案:filename.dark.png(或 .svg)和 filename.light.png(或 .svg)。<br>" +
|
||||
"該項可作用於“自動匯出 SVG 副本”、“自動匯出 PNG 副本”,以及其他的手動的匯出命令。",
|
||||
COMPATIBILITY_HEAD: "相容性設定",
|
||||
COMPATIBILITY_DESC: "如果沒有特殊原因(例如您想同時在 VSCode/Logseq 和 Obsidian 中使用 Excalidraw),建議您使用 Markdown 格式的繪圖檔案,而不是舊的 Excalidraw.com 格式,因為本外掛的很多功能在舊格式中無法使用。",
|
||||
COMPATIBILITY_DESC: "如果沒有特殊原因(例如:您想同時在 VSCode/Logseq 和 Obsidian 中使用 Excalidraw),建議您使用 Markdown 格式的繪圖檔案,而不是舊的 Excalidraw.com 格式,因為本外掛的很多功能在舊格式中無法使用。",
|
||||
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_NAME: "相容程式碼格式化(Linting)",
|
||||
DUMMY_TEXT_ELEMENT_LINT_SUPPORT_DESC: "Excalidraw 對 <code># Excalidraw Data</code> 下的檔案結構非常敏感。文件的自動格式化可能會在 Excalidraw 資料中造成錯誤。" +
|
||||
"雖然我已經努力使資料載入對自動格式化變更具有一定的抗性,但這種解決方案並非萬無一失。<br>" +
|
||||
@@ -759,7 +782,7 @@ export default {
|
||||
PRESERVE_TEXT_AFTER_DRAWING_NAME: "相容 Zotero 和腳註(footnotes)",
|
||||
PRESERVE_TEXT_AFTER_DRAWING_DESC: "保留 Excalidraw Markdown 中 <code>## Drawing</code> 部分之後的文字內容。儲存非常大的繪圖時,這可能會造成微小的效能影響。",
|
||||
DEBUGMODE_NAME: "開啟 debug 資訊",
|
||||
DEBUGMODE_DESC: "我建議在啟用/停用該項後重新啟動 Obsidian。這將在控制檯中啟用除錯訊息。這對於排查問題很有幫助。" +
|
||||
DEBUGMODE_DESC: "我建議在啟用/停用該項後重新啟動 Obsidian。這將在控制檯中啟用除錯訊息,有助於排查問題。" +
|
||||
"如果您在使用外掛時遇到問題,請啟用該項,重現問題,並在 <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/issues'>GitHub</a> 上提出的問題中包含控制檯日誌。",
|
||||
SLIDING_PANES_NAME: "支援 Sliding Panes 外掛",
|
||||
SLIDING_PANES_DESC:
|
||||
@@ -864,7 +887,7 @@ export default {
|
||||
下載後,將內容解壓到您的倉庫中的一個資料夾內。<br>
|
||||
預載入字型會影響啟動效能。因此,您可以選擇載入哪些字型。`,
|
||||
CJK_ASSETS_FOLDER_NAME: "CJK 字型資料夾(區分大小寫!)",
|
||||
CJK_ASSETS_FOLDER_DESC: `您可以在此設定 CJK 字型資料夾的位置。例如,您可以選擇將其放置在 <code>Excalidraw/CJK Fonts</code> 下。<br>
|
||||
CJK_ASSETS_FOLDER_DESC: `您可以在此設定 CJK 字型資料夾的位置。例如:<code>Excalidraw/CJK Fonts</code>。<br>
|
||||
<strong>重要:</strong> 請勿將此資料夾設定為倉庫根目錄!請勿在此資料夾中放置其他字型。<br>
|
||||
<strong>注意:</strong> 如果您使用 Obsidian Sync 並希望在裝置之間同步這些字型檔案,請確保 Obsidian Sync 設定為同步“所有其他檔案型別”。`,
|
||||
LOAD_CHINESE_FONTS_NAME: "啟動時從檔案載入中文字型",
|
||||
@@ -994,7 +1017,7 @@ export default {
|
||||
ES_FILENAME_VISIBLE: "顯示頁內標題",
|
||||
ES_BACKGROUND_HEAD: "背景色",
|
||||
ES_BACKGROUND_DESC_INFO: "點選此處檢視更多顏色資訊",
|
||||
ES_BACKGROUND_DESC_DETAIL: "背景色僅影響預覽模式的 MD-Embeddable。在編輯模式,它會根據場景(透過筆記屬性設定)或外掛設定,遵循 Obsidian 的深色/淺色主題。背景色有兩層:元素背景色(下層顏色)和上層顏色。選擇“匹配元素”表示兩層都遵循元素背景色。選擇“匹配繪圖”或特定背景色不會改變元素背景色。設定透明度(例如 50%)會將繪圖或選定的顏色與元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素屬性編輯器中將元素背景色設定為透明,這樣只有上層顏色生效。",
|
||||
ES_BACKGROUND_DESC_DETAIL: "背景色僅影響預覽模式的 MD-Embeddable。在編輯模式,它會根據場景(透過筆記屬性設定)或外掛設定,遵循 Obsidian 的深色/淺色主題。背景色有兩層:元素背景色(下層顏色)和上層顏色。選擇“匹配元素”表示兩層都遵循元素背景色。選擇“匹配繪圖”或特定背景色不會改變元素背景色。設定透明度(如 50%)會將繪圖或選定的顏色與元素背景色混合。要移除元素背景色,可以在 Excalidraw 的元素屬性編輯器中將元素背景色設定為透明,這樣只有上層顏色生效。",
|
||||
ES_BACKGROUND_MATCH_ELEMENT: "匹配元素背景色",
|
||||
ES_BACKGROUND_MATCH_CANVAS: "匹配繪圖背景色",
|
||||
ES_BACKGROUND_COLOR: "背景色",
|
||||
@@ -1111,6 +1134,7 @@ export default {
|
||||
EXPORTDIALOG_BACKGROUND: "背景",
|
||||
EXPORTDIALOG_BACKGROUND_TRANSPARENT: "透明",
|
||||
EXPORTDIALOG_BACKGROUND_USE_COLOR: "使用場景顏色",
|
||||
EXPORTDIALOG_INCLUDE_INTERNAL_LINKS: "匯出內部連結為 SVG/PDF?",
|
||||
// Selection
|
||||
EXPORTDIALOG_SELECTED_ELEMENTS: "匯出",
|
||||
EXPORTDIALOG_SELECTED_ALL: "整個場景",
|
||||
@@ -1171,7 +1195,7 @@ export default {
|
||||
// Screenshot tab
|
||||
EXPORTDIALOG_NOT_AVAILALBE: "抱歉,此功能僅在繪圖在主 Obsidian 工作區開啟時可用。",
|
||||
EXPORTDIALOG_TAB_SCREENSHOT: "截圖",
|
||||
EXPORTDIALOG_SCREENSHOT_DESC: "截圖將包含可嵌入的內容,例如 Markdown 頁面、YouTube、網站等。它們僅在桌面端可用,無法自動匯出,並且僅支援 PNG 格式。",
|
||||
EXPORTDIALOG_SCREENSHOT_DESC: "截圖將包含可嵌入的內容,如 Markdown 頁面、YouTube、網站等。它們僅在桌面端可用,無法自動匯出,並且僅支援 PNG 格式。",
|
||||
SCREENSHOT_DESKTOP_ONLY: "截圖功能僅在桌面端可用",
|
||||
SCREENSHOT_FILE_SUCCESS: "截圖已儲存到倉庫",
|
||||
SCREENSHOT_CLIPBOARD_SUCCESS: "截圖已複製到剪貼簿",
|
||||
@@ -1185,7 +1209,7 @@ export default {
|
||||
UIFM_TITLE: "從倉庫中嵌入檔案",
|
||||
UIFM_SECTION_HEAD: "選擇章節標題",
|
||||
UIFM_ANCHOR: "錨定為原始大小的 100%",
|
||||
UIFM_ANCHOR_DESC: "這是一個專業功能,請在瞭解其作用的情況下再使用。啟用後,即使你在 Excalidraw 中調整了匯入影像的大小,下次開啟繪圖時,該影像仍會恢復為原始大小的 100%。這在將一個獨立的 Excalidraw 點子嵌入到另一份筆記中,並希望保持文字和圖示的相對尺寸時非常有用。",
|
||||
UIFM_ANCHOR_DESC: "這是一個專業功能,請在瞭解其作用的情況下再使用。啟用後,即使你在 Excalidraw 中調整了匯入影像的大小,下次開啟繪圖時,該影像仍會恢復為原始大小的 100%。當你將一個獨立的 Excalidraw 點子嵌入到另一份筆記中,並希望保持文字和圖示的相對尺寸時,這會很有用。",
|
||||
UIFM_BTN_EMBEDDABLE: "以互動形式",
|
||||
UIFM_BTN_PDF: "PDF 頁面",
|
||||
UIFM_BTN_IMAGE: "以影像形式",
|
||||
@@ -1200,7 +1224,7 @@ export default {
|
||||
COMP_IMG_LaTeX: "LaTeX 公式",
|
||||
COMP_FRAME: "畫框操作",
|
||||
COMP_FRAME_HINT: "切換標記畫框。標記畫框僅用於引導,用於定義幻燈片/列印區域/[[file#^frame=id]]," +
|
||||
"匯出時會隱藏;也不會包含元素。透過上下文選單顯示/隱藏標記畫框。",
|
||||
"匯出時會隱藏;也不會包含元素。透過上下文選單顯示/隱藏標記畫框。",
|
||||
|
||||
//CustomEmbeddable.tsx
|
||||
NOTICE_PDF_THEME: "已覆蓋 PDF 主題。\n" +
|
||||
@@ -1208,6 +1232,19 @@ export default {
|
||||
"值:dark/light/auto/default,表示深色、淺色、跟隨 Excalidraw 或 Obsidian 主題。",
|
||||
|
||||
//EmbeddableActionsMenu.tsx
|
||||
BOOKMARK_PAGE: "Save current position in document",
|
||||
CAPTURE_PAGE: "Capture current page as image",
|
||||
BOOKMARK_PAGE: "儲存當前進度",
|
||||
CAPTURE_PAGE: "以影像形式擷取當前頁面",
|
||||
|
||||
//VersionMismatch.ts
|
||||
//WARNING: Do not change the {VAL_RECORDED} and {VAL_ACTUAL} strings, they are replaced by the actual version values at runtime!
|
||||
VERSION_MISMATCH_NOTICE: `Obsidian 顯示的版本是 <b>{VAL_RECORDED}</b>,但已安裝的 Excalidraw 程式碼顯示的版本是 <b>{VAL_ACTUAL}</b>。`,
|
||||
|
||||
VERSION_MISMATCH_HEADING: "Excalidraw 版本不匹配",
|
||||
VERSION_MISMATCH_CAUSE: "通常源於同步不完整,大檔案未能同步(如使用 Obsidian Sync Standard,main.js > 5MB),只更新了 <code>manifest.json</code>。",
|
||||
VERSION_MISMATCH_OPTIONS: "選項:<br><b>1.</b> 重新下載外掛(推薦)。<br><b>2.</b> 暫時忽略。",
|
||||
VERSION_MISMATCH_NOTE: "注意:手動更新版本資訊可能會影響依賴 manifest.json 的工具(如 Plugin Update Tracker、BRAT),直到你完全重灌外掛。",
|
||||
VERSION_MISMATCH_DISABLE_NAME: "停用版本不匹配警告",
|
||||
VERSION_MISMATCH_DISABLE_DESC: "可在以下位置重新啟用:設定 → Excalidraw → 基本 → 警告外掛更新不完整",
|
||||
VERSION_MISMATCH_REDOWNLOAD: "重新下載外掛",
|
||||
VERSION_MISMATCH_IGNORE: "忽略",
|
||||
};
|
||||
@@ -6,9 +6,9 @@ import { Notice } from "obsidian";
|
||||
import { getEA } from "src/core";
|
||||
import { ExcalidrawAutomate } from "src/shared/ExcalidrawAutomate";
|
||||
import { cloneElement } from "src/utils/excalidrawAutomateUtils";
|
||||
import { ExportSettings } from "src/view/ExcalidrawView";
|
||||
import { nanoid } from "src/constants/constants";
|
||||
import { svgToBase64 } from "../utils/utils";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
|
||||
/**
|
||||
* Creates a masked image from an Excalidraw scene.
|
||||
|
||||
@@ -37,6 +37,7 @@ export class EmbeddableSettings extends Modal {
|
||||
private isLocalURI: boolean;
|
||||
private mdCustomData: EmbeddableMDCustomProps;
|
||||
private onKeyDown: (ev: KeyboardEvent) => void;
|
||||
private listenerHost: Document | null = null;
|
||||
|
||||
constructor(
|
||||
private plugin: ExcalidrawPlugin,
|
||||
@@ -72,7 +73,10 @@ export class EmbeddableSettings extends Modal {
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.containerEl.removeEventListener("keydown",this.onKeyDown);
|
||||
if(this.listenerHost && this.onKeyDown) {
|
||||
this.listenerHost.removeEventListener("keydown",this.onKeyDown);
|
||||
this.listenerHost = null;
|
||||
}
|
||||
this.plugin = null;
|
||||
this.view = null;
|
||||
this.file = null;
|
||||
@@ -166,7 +170,11 @@ export class EmbeddableSettings extends Modal {
|
||||
}
|
||||
|
||||
this.onKeyDown = onKeyDown;
|
||||
this.containerEl.ownerDocument.addEventListener("keydown",onKeyDown);
|
||||
const ownerDoc = this.containerEl.ownerDocument;
|
||||
if(ownerDoc) {
|
||||
this.listenerHost = ownerDoc;
|
||||
ownerDoc.addEventListener("keydown",onKeyDown);
|
||||
}
|
||||
}
|
||||
|
||||
private async applySettings() {
|
||||
|
||||
@@ -5,8 +5,9 @@ import { DEVICE } from "src/constants/constants";
|
||||
import { ExcalidrawAutomate } from "src/shared/ExcalidrawAutomate";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { fragWithHTML, getExportPadding, getExportTheme, getPNGScale, getWithBackground, shouldEmbedScene } from "src/utils/utils";
|
||||
import { PageOrientation, PageSize, PDFPageAlignment, PDFPageMarginString, exportSVGToClipboard, exportPNG, exportPNGToClipboard } from "src/utils/exportUtils";
|
||||
import { fragWithHTML, getExportInternalLinks, getExportPadding, getExportTheme, getPNGScale, getWithBackground, shouldEmbedScene } from "src/utils/utils";
|
||||
import { exportSVGToClipboard, exportPNG, exportPNGToClipboard } from "src/utils/exportUtils";
|
||||
import { PageOrientation, PageSize, PDFPageAlignment, PDFPageMarginString } from "src/types/exportUtilTypes";
|
||||
import { t } from "src/lang/helpers";
|
||||
import { PDFExportSettings, PDFExportSettingsComponent } from "./PDFExportSettingsComponent";
|
||||
import { captureScreenshot } from "src/utils/screenshot";
|
||||
@@ -21,6 +22,7 @@ export class ExportDialog extends Modal {
|
||||
public scale: number;
|
||||
public theme: string;
|
||||
public transparent: boolean;
|
||||
public exportInternalLinks: boolean = true;
|
||||
public saveSettings: boolean;
|
||||
public dirty: boolean = false;
|
||||
private selectedOnlySetting: Setting;
|
||||
@@ -63,6 +65,7 @@ export class ExportDialog extends Modal {
|
||||
this.exportSelectedOnly = false;
|
||||
this.saveToVault = true;
|
||||
this.transparent = !getWithBackground(this.plugin, this.file);
|
||||
this.exportInternalLinks = getExportInternalLinks(this.plugin, this.file);
|
||||
|
||||
this.pageSize = plugin.settings.pdfSettings.pageSize;
|
||||
this.pageOrientation = plugin.settings.pdfSettings.pageOrientation;
|
||||
@@ -301,7 +304,17 @@ export class ExportDialog extends Modal {
|
||||
.onChange(value => {
|
||||
this.transparent = value === "transparent";
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
new Setting(this.contentContainer)
|
||||
.setName(t("EXPORTDIALOG_INCLUDE_INTERNAL_LINKS"))
|
||||
.addToggle(toggle =>
|
||||
toggle
|
||||
.setValue(this.exportInternalLinks)
|
||||
.onChange(value => {
|
||||
this.exportInternalLinks = value;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
this.selectedOnlySetting = new Setting(this.contentContainer)
|
||||
|
||||
@@ -1,5 +1,68 @@
|
||||
import { App, Modal } from "obsidian";
|
||||
|
||||
function getClientPoint(e: PointerEvent | TouchEvent) {
|
||||
if (e.type.startsWith("touch")) {
|
||||
const t = (e as TouchEvent).touches[0] ?? (e as TouchEvent).changedTouches[0];
|
||||
return t ? { x: t.clientX, y: t.clientY } : null;
|
||||
}
|
||||
const p = e as PointerEvent;
|
||||
return { x: p.clientX, y: p.clientY };
|
||||
}
|
||||
|
||||
function pointInRect(pt: { x: number; y: number }, r: DOMRect, padding = 1): boolean {
|
||||
return (
|
||||
pt.x >= r.left - padding &&
|
||||
pt.x <= r.right + padding &&
|
||||
pt.y >= r.top - padding &&
|
||||
pt.y <= r.bottom + padding
|
||||
);
|
||||
}
|
||||
|
||||
function isPointOnText(e: PointerEvent | TouchEvent): boolean {
|
||||
const pt = getClientPoint(e);
|
||||
if (!pt) return false;
|
||||
|
||||
let offsetNode: Node | null = null;
|
||||
let offset: number | null = null;
|
||||
|
||||
// Chromium/Firefox-ish
|
||||
const caretPos = (document as any).caretPositionFromPoint?.(pt.x, pt.y);
|
||||
if (caretPos?.offsetNode) {
|
||||
offsetNode = caretPos.offsetNode;
|
||||
offset = typeof caretPos.offset === "number" ? caretPos.offset : null;
|
||||
} else {
|
||||
// Safari/WebKit
|
||||
const caretRange = (document as any).caretRangeFromPoint?.(pt.x, pt.y);
|
||||
if (caretRange?.startContainer) {
|
||||
offsetNode = caretRange.startContainer;
|
||||
offset = typeof caretRange.startOffset === "number" ? caretRange.startOffset : null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!offsetNode || offsetNode.nodeType !== Node.TEXT_NODE || offset == null) return false;
|
||||
if (!offsetNode.textContent?.trim()) return false;
|
||||
|
||||
const textNode = offsetNode as Text;
|
||||
const len = textNode.data.length;
|
||||
const at = Math.max(0, Math.min(offset, len));
|
||||
|
||||
const range = document.createRange();
|
||||
if (at < len) {
|
||||
range.setStart(textNode, at);
|
||||
range.setEnd(textNode, at + 1);
|
||||
} else if (at > 0) {
|
||||
range.setStart(textNode, at - 1);
|
||||
range.setEnd(textNode, at);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
const rects = Array.from(range.getClientRects());
|
||||
if (rects.length === 0) return false;
|
||||
|
||||
return rects.some((r) => pointInRect(pt, r, 1));
|
||||
}
|
||||
|
||||
export class FloatingModal extends Modal {
|
||||
private dragging = false;
|
||||
private offsetX = 0;
|
||||
@@ -34,7 +97,9 @@ export class FloatingModal extends Modal {
|
||||
target instanceof HTMLTextAreaElement ||
|
||||
target instanceof HTMLSelectElement ||
|
||||
target instanceof HTMLButtonElement ||
|
||||
target.closest(".clickable-icon")
|
||||
isPointOnText(e) ||
|
||||
target.closest(".clickable-icon") ||
|
||||
target.closest(".modal-close-button") // ensure close button never starts drag
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -51,6 +116,7 @@ export class FloatingModal extends Modal {
|
||||
const { modalEl } = this;
|
||||
this.offsetX = touch.clientX - modalEl.getBoundingClientRect().left;
|
||||
this.offsetY = touch.clientY - modalEl.getBoundingClientRect().top;
|
||||
modalEl.style.height = "fit-content";
|
||||
|
||||
// Add touch-specific event listeners
|
||||
document.addEventListener("touchmove", this.pointerMoveHandler as (e: TouchEvent) => void, {
|
||||
@@ -178,6 +244,12 @@ export class FloatingModal extends Modal {
|
||||
}
|
||||
// Add ESC listener (capture to run before underlying workspace)
|
||||
document.addEventListener("keydown", this.escListener, { capture: true });
|
||||
|
||||
// NEW: re-enable pointer events on the close button so it is tappable on mobile
|
||||
const closeBtn = containerEl.querySelector(".modal-close-button");
|
||||
if (closeBtn) {
|
||||
(closeBtn as HTMLElement).style.pointerEvents = "auto";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -439,7 +439,10 @@ export class InsertPDFModal extends Modal {
|
||||
|
||||
if(this.frame) {
|
||||
const frameID = ea.addFrame(topX, topY,imgWidth,imgHeight,`${page}`);
|
||||
ea.addElementsToFrame(frameID, [boxID,imageID]);
|
||||
const frameEl = ea.getElement(frameID) as any;
|
||||
frameEl.frameRole = "marker";
|
||||
ea.addToGroup([frameID,boxID,imageID]);
|
||||
//ea.addElementsToFrame(frameID, [boxID,imageID]);
|
||||
ea.getElement(frameID).link = this.pdfFile.path + `#page=${page}`;
|
||||
}
|
||||
|
||||
|
||||
+193
-356
@@ -5,18 +5,204 @@ If you'd like to learn more, please subscribe to my YouTube channel: [Visual PKM
|
||||
|
||||
Thank you & Enjoy!
|
||||
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/P_Q6avJGoWI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
<div class="excalidraw-videoWrapper">
|
||||
<a href="https://www.youtube.com/watch?v=P_Q6avJGoWI" target="_blank"><img src ="https://i.ytimg.com/vi/P_Q6avJGoWI/maxresdefault.jpg" style="width:100%;"></a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
export const RELEASE_NOTES: { [k: string]: string } = {
|
||||
Intro: `After each update, you’ll see these release notes (you can turn this off in the plugin settings).
|
||||
Intro: `After each update, you'll see these release notes (you can turn this off in the plugin settings).
|
||||
|
||||
I build this plugin in my free time, as a labor of love. Curious about the philosophy behind it? Check out [📕 Sketch Your Mind](https://sketch-your-mind.com). If you find it valuable, say THANK YOU or…
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
|
||||
`,
|
||||
"2.19.0":`
|
||||
## New in ExcalidrawAutomate
|
||||
- **setView() improvements**
|
||||
- Calling \`setView()\` now picks a sensible target automatically:
|
||||
- It prefers the **currently active Excalidraw view**.
|
||||
- If no active Excalidraw view is found (e.g., the user is focused on a different tab like the File Explorer/sidebar), it will fall back to the **last active Excalidraw view (as long as it is still available)** — typically the drawing the user came from.
|
||||
- **New selector**: \`"auto"\` (equivalent to calling \`setView()\`).
|
||||
- Useful when you also want to reveal/focus the view: \`setView("auto", true)\`.
|
||||
- **Deprecated selectors**: \`"active"\` and \`"first"\` are deprecated and kept only for backward compatibility.
|
||||
- Recommended usage is either \`setView()\`, \`setView("auto")\`, or \`setView(excalidrawView)\` (explicitly target a specific view).
|
||||
|
||||
\`\`\`ts
|
||||
setView(view?: ExcalidrawView | "auto" | "first" | "active" | null, show: boolean = false)
|
||||
\`\`\`
|
||||
`,
|
||||
"2.18.3":`
|
||||
<div class="excalidraw-videoWrapper">
|
||||
<a href="https://www.youtube.com/watch?v=dZguonMP2KU" target="_blank"><img src ="https://i.ytimg.com/vi/dZguonMP2KU/maxresdefault.jpg" style="width:100%;"></a>
|
||||
</div>
|
||||
|
||||
## New
|
||||
- Added Mindmap Builder script to the store.
|
||||
- LaTeX Suit Integration by [@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
|
||||
- Added Linear Calendar Generator script to the store. 🙏 [@iwanhoogendoorn](https://github.com/iwanhoogendoorn)
|
||||
|
||||
## Fixed
|
||||
- YouTube video embeds working on iOS [#2569](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2569)
|
||||
- Stroke color setting for Embeddedables (markdown notes, websites) is missing after 2.17.0 update [#2580](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2580)
|
||||
- Context menu paste pastes in image twice [#10542](https://github.com/excalidraw/excalidraw/issues/10542)
|
||||
|
||||
## New in ExcalidrawAutomate
|
||||
- Added 3 new helper functions for working with Script Engine settings (safe during initialization when \`scriptEngineSettings[activeScript]\` is \`undefined\` / \`null\`):
|
||||
- \`setScriptSettingValue(key: string, value: ScriptSettingValue): void\`
|
||||
- \`getScriptSettingValue(key: string, defaultValue: ScriptSettingValue): ScriptSettingValue\`
|
||||
- \`saveScriptSettings(): Promise<void>\`
|
||||
|
||||
- Updated \`addArrow()\` to support the new Excalidraw binding options:
|
||||
- \`startBindMode?: "inside" | "orbit"\`
|
||||
- \`endBindMode?: "inside" | "orbit"\`
|
||||
- \`startFixedPoint?: [number, number]\`
|
||||
- \`endFixedPoint?: [number, number]\`
|
||||
- \`elbowed?: boolean\`
|
||||
|
||||
\`\`\`ts
|
||||
/**
|
||||
* Returns an object describing the bound text element.
|
||||
* If a text element is provided:
|
||||
* - returns { eaElement } if the element is in ea.elementsDict
|
||||
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
|
||||
* If a container element is provided, searches for the bound text element:
|
||||
* - returns { eaElement } if found in ea.elementsDict
|
||||
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
|
||||
* If not found, returns {}.
|
||||
* Does not add the text element to elementsDict.
|
||||
* @param element
|
||||
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
|
||||
* @returns Object containing either eaElement or sceneElement or empty if not found.
|
||||
*/
|
||||
getBoundTextElement(element: ExcalidrawElement, searchInView: boolean = false): {
|
||||
eaElement?: Mutable<ExcalidrawTextElement>,
|
||||
sceneElement?: ExcalidrawTextElement
|
||||
};
|
||||
\`\`\`
|
||||
`,
|
||||
"2.18.2":`
|
||||
## Fixed
|
||||
- Stroke palette menu for embedded notes is gone after 2.17 update [#2580](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2580)
|
||||
- Cannot link to group [#2579](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2579)
|
||||
|
||||
`,
|
||||
"2.18.1":`
|
||||
## New
|
||||
- Improved the **Copy [[link]] for selected elements** context-menu action:
|
||||
- Added an optional checkbox to append the \`|100%\` anchor to the copied link.
|
||||
- Added an option to copy by **frame name** (instead of frame ID) when the frame is named.
|
||||
|
||||
## Fixed
|
||||
- Prevented unnecessary \`data.json\` saves each time a drawing is opened. [#2562](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2562)
|
||||
- Fixed angle snapping when a line passes over an object.
|
||||
- Fixed hover preview when referencing a frame by name in an image reference.
|
||||
- Fixed “Back of note” card insertion breaking LaTeX equations in existing cards. [#2296](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2296) 🙏[@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
|
||||
- Adjusted hover-preview sizing to more closely match embeds. [#2525](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2575) 🙏[parkero](https://github.com/parkero)
|
||||
`,
|
||||
"2.18.0":`
|
||||
## New from Excalidraw.com
|
||||
- 🔥🔥🔥 New arrow behavior allows binding arrows to the inside of shapes and image! 🙏[mtolmacs](https://github.com/mtolmacs), [dwelle](https://github.com/dwelle) [#9670](https://github.com/excalidraw/excalidraw/pull/9670)
|
||||
|
||||
## New
|
||||
- New option in the Export Dialog to **include/exclude internal links** when exporting to SVG or PDF.
|
||||
- Useful when sharing an SVG or PDF with others.
|
||||
- Internal links are links that point to files in your Obsidian vault.
|
||||
- By default, internal links are included in exports.
|
||||
- Use the new document property: \`export-internal-links: false\` to disable exporting internal links on a per-drawing basis.
|
||||
|
||||
## Fixed
|
||||
- Memory leak issues
|
||||
- Potential fix to Backspace and CTRL+V stopping working in text elements after extended use of Excalidraw.
|
||||
- Improved detection of on-screen keyboard on mobile devices. (issue reported on [Discord](https://discord.com/channels/1026825302900494357/1444652800360316959))
|
||||
- Insert any file, insert LaTeX and some other dialogs got hidden behind the on-screen keyboard on mobile devices. Dialogs appear at the top of the screen now on mobile devices.
|
||||
|
||||
## New in ExcalidrawAutomate
|
||||
- **createSVG()** now exposes convertMarkdownLinksToObsidianURLs and includeInternalLinks parameters.
|
||||
\`\`\`ts
|
||||
async createSVG(
|
||||
templatePath?: string,
|
||||
embedFont: boolean = false,
|
||||
exportSettings?: ExportSettings,
|
||||
loader?: EmbeddedFilesLoader,
|
||||
theme?: string,
|
||||
padding?: number,
|
||||
convertMarkdownLinksToObsidianURLs: boolean = false,
|
||||
includeInternalLinks: boolean = true,
|
||||
): Promise<SVGSVGElement>
|
||||
\`\`\`
|
||||
`,
|
||||
"2.17.2":`
|
||||
## Fixed
|
||||
- Lasso selection tool is back in the more tools menu in tray-mode and desktop mode.
|
||||
- "Toggle enable context menu" command palette action is available on mobile devices.
|
||||
- FloatingModal window top-right close button did not work on mobile devices.
|
||||
- Hover preview flashed for larger PDF hover previews, in some cases would not even show.
|
||||
- Fixed: opanAI API URL in settings will be honored when creating code from diagram [#2540](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2540) 🙏[@threeq](https://github.com/threeq)
|
||||
- Fixed export to PDF. Rounded images cropped from the left and the top were transformed incorrectly. [#2544](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2544)
|
||||
|
||||
## New
|
||||
- Added configurable max tokens setting for OpenAI API [#2543](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2543) 🙏[@dddrop](https://github.com/dddrop)
|
||||
`,
|
||||
"2.17.1":`
|
||||
## Fixed
|
||||
- Excalibrain stopped working after the 2.17.0 update. Fixed. [#2532](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2532)
|
||||
- Pinned scripts are not hidden in view mode when in phone UI mode.
|
||||
`,
|
||||
"2.17.0":`
|
||||
## New
|
||||
- Phone UI from Excalidraw.com [#9996](https://github.com/excalidraw/excalidraw/pull/9996)
|
||||
- Custom pen settings now allow pen width to be set at 0.1 increments from 0.1 to 8.0
|
||||
- Updated the "Palm Guard" script to support the change UI configurations.
|
||||
- Restructured UI-Mode settings in plugin settings. You can now set the preference for UI mode for desktop and tablets.
|
||||
The old "prefer tray-mode" toggle has been removed. "Toggle Tray-Mode" changes to "Toggle UI-Mode".
|
||||
- New command palette action: "Toggle enable context menu". This setting is helpful on Mobile devices, where the context menu may interfere with touch interactions. The setting is saved with the drawing, thus you can add it to your templates (then press CTRL+S to force save) if you want the context menu to be disabled by default.
|
||||
|
||||
## Fixed
|
||||
- side panel does not attach correctly when library is pinned [#2510](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2510)
|
||||
- Fixed print area when using marker frames and printing Slideshow to PDF
|
||||
- The "Invert Colors" script and ExcalidrawAutomate bugs that resulted in broken colors and Excalidraw crashes in some cases after color inversion.
|
||||
- Fixed duplicated PDF elements after copy-pasting from scene to scene.
|
||||
- Resolved the large gap at the top on iOS devices. As it turns out, Apple adds additional padding automatically to avoid collision with the notch.
|
||||
- Fixed the positioning of the "Canvas and Shape Properties" window.
|
||||
- Attempt to fix the mobile keyboard pop-up, distorting the view.
|
||||
- Added finalize multipoint-line button to compact layout
|
||||
`,
|
||||
"2.16.1":`
|
||||
## Fixed
|
||||
- Based on a request from [Kevin](https://github.com/Kovah) referencing GDPR, I removed YouTube iframes from settings, scripts, etc., and replaced them with thumbnail images + links to YouTube. [#2234](https://github.com/zsviczian/obsidian-excalidraw-plugin/discussions/2234)`,
|
||||
"2.16.0":`
|
||||
<div class="excalidraw-videoWrapper">
|
||||
<a href="https://www.youtube.com/watch?v=51EgDgtiZgQ" target="_blank"><img src ="https://i.ytimg.com/vi/51EgDgtiZgQ/maxresdefault.jpg" style="width:100%;"></a>
|
||||
</div>
|
||||
|
||||
## New from Excalidraw.com
|
||||
- New library search feature [#9903](https://github.com/excalidraw/excalidraw/pull/9903)
|
||||
- You can rename library items by selecting them, then choosing "Rename or publish" from the ... menu.
|
||||
- New compact mode for tablets [#9910](https://github.com/excalidraw/excalidraw/pull/9910)
|
||||
- New setting in plugin setting \`Compact-mode on Tablets\` to override tray-mode on tablets in favor of the new compact mode.
|
||||
|
||||
## New
|
||||
- Embedding PDF as images, frames are now marker frames instead of regular frames. You can reference pages, including their markup in markdown notes, using this syntax: \`![[drawing#^frame=12]]\` (page 12)
|
||||
- Pinned scripts toolbar is now on the right side in all modes: tray-, normal-, and compact. The toolbar moves into view when the side panel is opened for the stencil library or for search.
|
||||
- Better RTL support, pinned scripts are rendered on the left side in RTL mode.
|
||||
|
||||
## Fixed
|
||||
- Critical fix: When clicking to follow a link in a markdown embeddable in preview mode to open an Excalidraw drawing in the same tab, the back of the newly opened drawing was overwritten with the content of the source drawing.
|
||||
- PDF++ Links from document to Excalidraw select everything in the scene instead of the linked element. [#2503](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2503)
|
||||
|
||||
`,
|
||||
"2.15.3":`
|
||||
## Fixed
|
||||
- New back of the note cards are not visible until the drawing is saved. When adding a back-of-the-note card using the context menu, the card got placed at the absolute 0,0 position in the scene instead of the current pointer position. [#9949](https://github.com/excalidraw/excalidraw/issues/9949)
|
||||
- Drawings created 4 years ago don't open [#2479](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2479)
|
||||
- On Obsidian Mobile, when an element has multiple links, clicking the link icon, the link selector pops up and immediately closes
|
||||
- Improved handling of importing external images and drag and drop of images from inside Obsidian. Features like (Convert SVG to Strokes) and (Flip the card) now work immediately, you don't need to force save, or wait for autosave to kick in.
|
||||
|
||||
## New
|
||||
- Added startup check that detects when Obsidian's recorded plugin version differs from the installed Excalidraw code (e.g. after partial sync of large files) and offers to update or ignore, with a setting to disable the check.
|
||||
- When Excalidraw is open in two or more tabs—either as Markdown or Excalidraw—auto-zoom is disabled. This allows you to work in multiple tabs on the same drawing at once: focusing on different areas of the same drawing, or editing the Markdown and Excalidraw views in parallel.
|
||||
`,
|
||||
"2.15.2":`
|
||||
## Fixed:
|
||||
- Pressing enter on a text element erroneously activated all markdown embeddables in the scene. [discord](https://discord.com/channels/1026825302900494357/1412683408424833045)
|
||||
@@ -64,9 +250,9 @@ public getViewCenterPosition(): {x:number, y:number};
|
||||
\`\`\`
|
||||
`,
|
||||
"2.15.0":`
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/DqDnzCOoYMc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
<div class="excalidraw-videoWrapper">
|
||||
<a href="https://www.youtube.com/watch?v=DqDnzCOoYMc" target="_blank"><img src ="https://i.ytimg.com/vi/DqDnzCOoYMc/maxresdefault.jpg" style="width:100%;"></a>
|
||||
</div>
|
||||
|
||||
## New
|
||||
- Introducing **Marker Frames**. These are special frames that can be used to mark slides, pages areas for PDF printouts, image references, etc.
|
||||
@@ -101,353 +287,4 @@ public getViewCenterPosition(): {x:number, y:number};
|
||||
):ExcalidrawElement[]
|
||||
\`\`\`
|
||||
`,
|
||||
"2.14.3":`
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/29EWeglRm7s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
Updated the Printable Layout Wizard script with the option to exclude empty pages.
|
||||
|
||||
## Fixed
|
||||
- If a frame is locked, elements created over the frame or dragged over the frame should not be auto-added to the frame. [#9850](https://github.com/excalidraw/excalidraw/issues/9850)
|
||||
|
||||
## Fixed in ExcalidrawAutomate
|
||||
- Not all AppState properties were being correctly copied to the template when creating a new drawing with ea.create() [#2440](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2440)
|
||||
`,
|
||||
"2.14.2":`
|
||||
## Fixed
|
||||
- Converting Markdown to Excalidraw ("Back of note"/"Convert markdown to ExcaliDrawing") no longer appends T00:00:00.000Z to an existing date frontmatter field and handles merging of lists such as tags intelligently [#2414](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2414)
|
||||
- Multi‑point line creation on touchscreens (tap–tap–tap) produced a horizontal line after using a pen. Fixed. [#9840](https://github.com/excalidraw/excalidraw/pull/9840#issuecomment-3165319266)
|
||||
|
||||
## New
|
||||
- Zoom settings (Settings → Excalidraw → Appearance and Behavior → Zoom) [#2434](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2434):
|
||||
- Zoom increment (default 5%) to fine‑tune mouse wheel / gesture precision.
|
||||
- Minimum zoom (default 10%) controls how far you can zoom out (below 10% may be unstable—use with caution).
|
||||
- Maximum zoom (default 3000%) defines the upper zoom limit.
|
||||
- Palm Guard script (in script store): Mobile-friendly drawing mode for stylus users. Enters fullscreen, hides UI, shows a draggable minimal toolbar (toggle + exit) to prevent accidental palm taps; single tap to exit. Inspired by [#2409](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2409)
|
||||
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/A_udjVjgWN0" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
## ExcalidrawAutomate
|
||||
- Improved \`FloatingModal\` behavior. Floating Modal now does not trap keyboard events, the header element does not block "X" button in the top right corner, all four corners are rounded on Mobile Devices.
|
||||
|
||||
`,
|
||||
"2.14.1":`
|
||||
## Fixed
|
||||
- Excalidraw broke Obsidian's UI in Arabic, Persian, and Hebrew due to LTR, RTL conflict. [#2423](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2423)
|
||||
- Styling issues impacting native Obsidian search/replace dialogs. [#2420](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2420)
|
||||
- Now using native Obsidian attachment location function. 🙏 [mnaoumov](https://github.com/mnaoumov) [#2421](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2421), potentially fixes [#179](https://github.com/RainCat1998/obsidian-custom-attachment-location/issues/179) of the Obsidian Custom Attachment Location plugin issue.
|
||||
|
||||
## New
|
||||
- New frontmatter option \`excalidraw-embed-md\`. When set to \`true\`, embedding the drawing into a markdown note will render the "back of the note" (its markdown content) instead of rendering it as an image.
|
||||
- If you want to always display the drawing as an image, even when \`excalidraw-embed-md\` is enabled, use the special embed syntax: \`![[drawing#^as-image]]\`. Here, \`as-image\` is a phantom block reference that forces image rendering.
|
||||
- Added Spanish translation by [@Joakim31](https://github.com/Joakim31) [#2425](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2425)
|
||||
- Incremental minor updates from the main [Excalidraw project](https://github.com/excalidraw/excalidraw).
|
||||
`,
|
||||
"2.14.0":`
|
||||
## A Big "Small" Update
|
||||
- Added search to Excalidraw Settings, plus added a link to access the public NotebookLM workbook pre-loaded with everything about the plugin
|
||||
- New Taiwan-idiomatic Traditional Chinese translation by [@rlan](https://github.com/rlan) [#2413](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2413)
|
||||
`,
|
||||
"2.13.2":`
|
||||
## New
|
||||
- Excalidraw now properly supports drag and drop of obsidian links from Bases.
|
||||
- ExcalidrawAutomate exposes a new class: \`FloatingModal\`. This is a modified version of the Obsidian.Modal class that allows the modal to be dragged around the screen and that does not dim the background. You can use it to create custom dialogs that behave like Obsidian modals but with more flexibility.
|
||||
`,
|
||||
"2.13.1":`
|
||||
## New
|
||||
- Support for Obsidian bases as embeddables in Excalidraw.
|
||||
- **Note:** The feature is only available to Insiders who have Obsidian 1.9.4 or later installed.
|
||||
- If your base includes multiple views you can pin the desired view similar to filtering to a section (click top left # button; \`[[my.base|my view]]\`).
|
||||
|
||||
## Fixed
|
||||
- Cannot type in embedded web forms. In certain cases, typing within these embeds would trigger Excalidraw hotkeys instead of interacting with the embedded content. [#2403](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2403)
|
||||
`,
|
||||
"2.13.0":`
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/QzhyQb4JF3Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
## New
|
||||
- **Flexible Auto-Export Location:** Take control of where your auto-exported .png, .svg, and .excalidraw files are saved. Addressing a long-standing request, you can now define custom output paths using the new **Excalidraw Hooks**.
|
||||
- Implement the \`onImageExportPathHook\` callback in your ExcalidrawAutomate startup script to control the *destination path*.
|
||||
- Get the skeleton script via plugin settings or download it [here](https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/refs/heads/master/src/constants/assets/startupScript.md).
|
||||
|
||||
- **Control Auto-Export Trigger:** Use the \`onTriggerAutoexportHook\` in your startup script to decide *if* and *how* auto-export runs for a file, based on its properties or frontmatter, *before* the export path is determined.
|
||||
|
||||
- **Improved "Open Excalidraw drawing":** The Command Palette command now searches the *entire Vault* for the matching Excalidraw file when used on an embedded .svg or .png, useful when exports are in different folders.
|
||||
|
||||
- **Placeholder Files for New Embeds:** When embedding a new drawing as PNG/SVG via the Command Palette, empty placeholder files are now created immediately based on your auto-export setting. This ensures Obsidian correctly updates links if you rename the file soon after creation (when "Keep filenames in sync" is on).
|
||||
|
||||
- **Paste Obsidian URLs into Excalidraw:** Pasting an Obsidian URL for an image or file into Excalidraw now inserts the associated image directly into the drawing.
|
||||
|
||||
- **\`onImageFilePathHook\` Drag & Drop Support:** The \`onImageFilePathHook\` (for controlling location/filename of *embedded* files) is now triggered when dragging and dropping files into Excalidraw from outside Obsidian, matching the existing behavior for pasting.
|
||||
|
||||
## New in ExcalidrawAutomate
|
||||
\`\`\`ts
|
||||
splitFolderAndFilename(filepath: string) : {
|
||||
folderpath: string;
|
||||
filename: string;
|
||||
basename: string;
|
||||
extension: string;
|
||||
}
|
||||
\`\`\`
|
||||
`,
|
||||
"2.12.4":`
|
||||
## Fixed
|
||||
- ExaliBrain did not render after the 2.12.3 update. [#2384](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2384)
|
||||
`,
|
||||
"2.12.3":`
|
||||
## Minor fixes
|
||||
- Includes all recent updates and fixes from excalidraw.com
|
||||
- Fixed issue with line editor snapping out of edit mode
|
||||
- Fixed long-standing issue with wireframe to code calling a deprecated OpenAI endpoint
|
||||
- "Load Excalidraw Properties into Obsidian Suggester" setting now defaults to false for new installations. [#2380](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2380)
|
||||
- Taskbone OCR result does not get saved to frontmatter in some cases [#1123](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1123)
|
||||
|
||||
## New
|
||||
- If the cropped file or annotated file prefix is set to empty, there will now be no prefix added to the file name. Additionally, now you can also set a suffix to the file name. [#2370](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2370)
|
||||
`,
|
||||
"2.12.2": `
|
||||
## Fixed
|
||||
- BUG: Excalidraw theme changes to Light from Dark when clicking line element node [#2360](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2360)
|
||||
`,
|
||||
"2.12.1": `
|
||||
## New
|
||||
- "Text to Path" text input window is now draggable.
|
||||
|
||||
## Fixed
|
||||
- Minor fixes to the Polygon line feature introduced in 2.12.0. [#9580](https://github.com/excalidraw/excalidraw/pull/9580)
|
||||
- Fix new Improved Unlock UI, where if a lock element was over an unlocked element, the unlocked element was not selectable. [#9582](https://github.com/excalidraw/excalidraw/pull/9582)
|
||||
- Fixed ghost point issue when moving a shape after dragging a point in the line editor [#9530](https://github.com/excalidraw/excalidraw/pull/9530)
|
||||
|
||||
## New in ExcalidrawAutomate
|
||||
${String.fromCharCode(96,96,96)}js
|
||||
untils.inputPrompt({
|
||||
header: string,
|
||||
placeholder?: string,
|
||||
value?: string,
|
||||
buttons?: { caption: string; tooltip?:string; action: Function }[],
|
||||
lines?: number,
|
||||
displayEditorButtons?: boolean,
|
||||
customComponents?: (container: HTMLElement) => void,
|
||||
blockPointerInputOutsideModal?: boolean,
|
||||
controlsOnTop?: boolean,
|
||||
draggable?: boolean,
|
||||
});
|
||||
${String.fromCharCode(96,96,96)}
|
||||
`,
|
||||
"2.12.0": `
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/-fldh3cE2gs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
## Fixed
|
||||
|
||||
- Dynamic styling was not working when frames were present in the scene.
|
||||
- Minor fix to the screenshot feature. This also resolves the long-standing issue where window control buttons (close, minimize, maximize) appeared in full-screen mode.
|
||||
- Fixed an issue where ALT/OPT + dragging an embeddable object sometimes failed, resulting in an empty object instead of dragging the element.
|
||||
|
||||
## New
|
||||
|
||||
- **Line Polygons**: Draw a closed line shape, and it will automatically snap into a polygon. [#9477](https://github.com/excalidraw/excalidraw/pull/9477)
|
||||
- Updated the Split Ellipse and Boolean Operations scripts to support this feature.
|
||||
- When entering line editor mode (CTRL/CMD + click), the lock point is now marked for easier editing. You can break the polygon using the polygon action in the elements panel.
|
||||
- **Popout Override**: The "Open the back-of-the-note for the selected image in a popout window" action now overrides the "Focus on Existing Tab" setting and always opens a new popout.
|
||||
- **Text Arch Enhancements**: The Text Arch script now supports fitting text to a wider range of paths and shapes. Text can also be edited and refitted to different paths.
|
||||
- **Improved Unlock UI**: Single-clicking a locked element now shows an unlock button. [#9546](https://github.com/excalidraw/excalidraw/pull/9546)
|
||||
- **Script Update Alerts**: On startup, Excalidraw will notify you if any installed scripts have available updates.
|
||||
`,
|
||||
"2.11.1": `
|
||||
## Fixed:
|
||||
- The new "Screenshot" option in the Export Image dialog was not working properly. [#2339](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2339)
|
||||
|
||||
## New from Excalidraw.com
|
||||
- Quarter snap points for diamonds [#9387](https://github.com/excalidraw/excalidraw/pull/9387)
|
||||
- Precise highlights for bindings [#9472](https://github.com/excalidraw/excalidraw/pull/9472)
|
||||
|
||||
`,
|
||||
"2.11.0": `
|
||||
## New
|
||||
- New "Screenshot" option in the Export Image dialog. This allows you to take a screenshot of the current view, including embedded web pages, youtube videos, and markdown documents. Screenshot is only possible in PNG.
|
||||
- Expose parameter in plugin settings to disable AI functionality [#2325](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2325)
|
||||
- Enable (disable) double-click text editing option in Excalidraw appearance and behavior (based on request on Discord)
|
||||
- Added two new PDF export sizes: "Match image", "HD Screen".
|
||||
- Switch between basic shapes. Quickly change the shape of the selected element by pressing TAB [#9270](https://github.com/excalidraw/excalidraw/pull/9270)
|
||||
- Updated the Scribble Helper Script. Now controls are at the top so your palm does accidently trigger them. I added a new button to insert special characters. Scribble helper now makes use of the new text element wrapping in Excalidraw.
|
||||
|
||||
## Fixed in the plugin
|
||||
- Scaling multiple embeddables at once did not work. [#2276](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2276)
|
||||
- When creating multiple back-of-the-note the second card is not created correctly if autosave has not yet happened.
|
||||
- Drawing reloads while editing the back-of-the-note card in certain cases causes editing to be interrupted.
|
||||
- Moved Excalidraw filetype indicator ✏️ to after filename where other filetype tags are displayed. You can turn the filetype indicator on/off in plugin settings under Miscellaneous.
|
||||
|
||||
## Fixed by Excalidraw.com
|
||||
- Alt-duplicate now preserves the original element. Previously, using Alt to duplicate would swap the original with the new element, leading to unexpected behavior and several downstream issues. [#9403](https://github.com/excalidraw/excalidraw/pull/9403)
|
||||
- When dragging the arrow endpoint, update the binding only on the dragged side [#9367](https://github.com/excalidraw/excalidraw/pull/9367)
|
||||
- Laser pointer trail disappearing on pointerup [#9413](https://github.com/excalidraw/excalidraw/pull/9413) [#9427](https://github.com/excalidraw/excalidraw/pull/9427)
|
||||
`,
|
||||
"2.10.1": `
|
||||
|
||||
## Fixed by Excalidraw.com
|
||||
- Eraser performance improvement regression. Erasing locked elements. [#9400](https://github.com/excalidraw/excalidraw/pull/9400)
|
||||
|
||||
## New
|
||||
- Grid Customization Options in plugin settings (appearance and behavior/grid): You can now selectively show or hide vertical and horizontal grid lines independently. This allows you to create alternative grid styles, such as horizontal-only lined grids instead of the traditional checkered pattern.
|
||||
|
||||
## Fixed in ExcalidrawAutomate
|
||||
- ${String.fromCharCode(96)}ea.createSVG${String.fromCharCode(96)} throws error [#2321](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2321)
|
||||
|
||||
---
|
||||
|
||||
## ❤️ Enjoying the plugin?
|
||||
|
||||
Support my work by checking out my new book, now available for pre-order:
|
||||
[Sketch Your Mind: Nurture a Playful and Creative Brain](https://sketch-your-mind.com) is about visual Personal Knowledge Management. It explores the thinking behind Excalidraw and how it helps you structure and evolve ideas visually. It’s the book I wish I had when I began my own PKM journey.
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://sketch-your-mind.com"><img src="https://raw.githubusercontent.com/zsviczian/sketch-your-mind/refs/heads/main/images/cover-mini.jpg" border="0" alt="Pre-order Sketch Your Mind" height="100%"></a></div>
|
||||
`,
|
||||
"2.10.0": `
|
||||
## New from Excalidraw.com
|
||||
- Lasso select [#9169](https://github.com/excalidraw/excalidraw/pull/9169)
|
||||
- Add container to multiple text elements [#9348](https://github.com/excalidraw/excalidraw/pull/9348)
|
||||
|
||||
## Fixed from Excalidraw.com
|
||||
- Rounded diamond edge elbow arrow U route [#9349](https://github.com/excalidraw/excalidraw/pull/9349)
|
||||
- Improved eraser performance [#9352](https://github.com/excalidraw/excalidraw/pull/9352)
|
||||
- Keep arrow label horizontal [#9364](https://github.com/excalidraw/excalidraw/pull/9364)
|
||||
|
||||
## Fixed in ExcalidrawAutomate
|
||||
- ${String.fromCharCode(96)}ea.addText${String.fromCharCode(96)} did not honor the width parameter.
|
||||
`,
|
||||
"2.9.2":`
|
||||
- More minor fix. Toolbars are not responsive when dynamic styling is turned off. [#2287](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2287)
|
||||
`,
|
||||
"2.9.1":`
|
||||
- Minor emergency fix. Reverting: [#9203](https://github.com/excalidraw/excalidraw/pull/9203)
|
||||
`,
|
||||
"2.9.0":`
|
||||
## New
|
||||
- QoL improvement: The context menu requires a longer press and hold for it to be displayed on mobile devices. When you want to precision adjust an element it happens that you linger on the point for just a little longer and the context menu appears unwantedly.
|
||||
- Elbow arrow improvements [#9236](https://github.com/excalidraw/excalidraw/pull/9236), [#8593](https://github.com/excalidraw/excalidraw/pull/8593), [#9197](https://github.com/excalidraw/excalidraw/pull/9197), [#9191](https://github.com/excalidraw/excalidraw/pull/9191), [#9236](https://github.com/excalidraw/excalidraw/pull/9236)
|
||||
|
||||
## Fixed Obsidian 1.8.9 regressions
|
||||
- Custom references (like #^group) broken in Live Preview in Obsidian 1.8.9 due to translation update [#2279](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2279)
|
||||
- Excalidraw tabs only show on a second click on Obsidian Mobile
|
||||
|
||||
## Refactoring
|
||||
- The Excalidraw component moved to React 19. Obsidian for now remains on React 18. This refactoring ensures that Excalidraw continues to work in Obsidian and Obsidian will receive future Excalidraw updates. [#9182](https://github.com/excalidraw/excalidraw/pull/9182)
|
||||
`,
|
||||
"2.8.3":`
|
||||
## Fixed
|
||||
- Chinese translation not available since 2.8.0. [#2247](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2247)
|
||||
- Since the most recent Samsung Android update, adding images from the gallery returns an Unsupported Image Type error. [#2245](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2245)
|
||||
- Duplicating/removing frame while children selected [#9079](https://github.com/excalidraw/excalidraw/pull/9079)
|
||||
`,
|
||||
"2.8.2":`
|
||||
## New
|
||||
- Moved "Create new drawing" option up in the context menu [#2243](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2243)
|
||||
|
||||
## Fixed
|
||||
- In rare cases drawing content gets overwritten with another drawing [#2152](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2152)
|
||||
- "Wrap selection in frame" sets dark mode to light mode [#2240](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2240)
|
||||
- Multiple bug fixes from Excalidraw.com
|
||||
- Elbow arrows within boxes [#9077](https://github.com/excalidraw/excalidraw/issues/9077)
|
||||
- Elbow arrow orthogonality [#9073](https://github.com/excalidraw/excalidraw/pull/9073)
|
||||
- Improve library sidebar performance [#9060](https://github.com/excalidraw/excalidraw/pull/9060)
|
||||
- Opacity slider now displays numerical value [#9009](https://github.com/excalidraw/excalidraw/pull/9009)
|
||||
- Resize a frame and its children together when box selecting the frame and its children together [#9031](https://github.com/excalidraw/excalidraw/pull/9031)
|
||||
- Excalidraw screen flickering in dark mode [#9057](https://github.com/excalidraw/excalidraw/pull/9057)
|
||||
`,
|
||||
"2.8.1":`
|
||||
## Fixed
|
||||
- Unable to open Excalidraw files after the 2.8.0 update. [#2235](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2235)
|
||||
`,
|
||||
"2.8.0":`
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/tWi5xTUTz7E" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
## New
|
||||
- Updated "Export Image" dialog
|
||||
- 🚀 PDF Export option including tiling of images over multiple pages. Only available on desktop :(
|
||||
- SVG to clipboard
|
||||
- More granular setting for padding and scale
|
||||
- Slideshow script can now print slides to PDF (update script from script store)
|
||||
- Set local graph to show the links in the embeddable when it is activated/deactivated [#2200](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2200)
|
||||
|
||||
## Fixed
|
||||
- Fixed several LaTeX issues. 🙏 @Sintuz [#1631](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1631), [#2195](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2195), [#1842](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1842)
|
||||
- Fixed support for *.jfif and *.avif images [#2212](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2212)
|
||||
- PDF++ selection is not correctly showing after embedded into a drawing (for some specific files) [#2213](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2213)
|
||||
- iOS 18 can't upload image and library [#2182](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2182)
|
||||
- Image block references are broken in hover previews [#2218](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2218)
|
||||
- ⚠️ Note there is a known issue in Obsidian 1.8.2 ⚠️ affecting preview windows in Excalidraw. I received confirmation that this will be fixed in 1.8.3. For now, if hover previews are important to you, you can downgrade to Obsidian 1.8.1 [#2228](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2225)
|
||||
- Mobile elements panel and context menu are not scrollable [#2216](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2216)
|
||||
- "Local Font" menu disappears when opening a drawing in an Obsidian popout-window [#2205](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2205)
|
||||
|
||||
## Updates from Excalidraw.com
|
||||
- Pressing delete on a frame will only delete the children [#9011](https://github.com/excalidraw/excalidraw/pull/9011)
|
||||
- New crowfoot arrowheads and a new arrowhead picker [#8942](https://github.com/excalidraw/excalidraw/pull/8942)
|
||||
- Fixed some of the arrow binding issues [#9010](https://github.com/excalidraw/excalidraw/pull/9010), [#2209](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2209)
|
||||
- New context menu action: "Wrap selection in frame" [#9005](https://github.com/excalidraw/excalidraw/pull/9005)
|
||||
- Elbow arrow segment fixing and positioning [#8952](https://github.com/excalidraw/excalidraw/pull/8952)
|
||||
- When drag creating a new frame, do not add a partial group to it. When wrapping a selected partial group in a frame however, do add it to the wrapping frame. But such that it should be separated from the previous containing group. [#9014](https://github.com/excalidraw/excalidraw/pull/9014)
|
||||
|
||||
## New in ExcalidrawAutomate
|
||||
- New hook: ${String.fromCharCode(96)}onImageFileNameHook${String.fromCharCode(96)}. When set, this callback is triggered when a image is being saved in Excalidraw.
|
||||
- PDF export functions, paving the way for slideshow to export slides to PDF
|
||||
${String.fromCharCode(96,96,96)}ts
|
||||
/**
|
||||
* Returns the dimensions of a standard page size in pixels.
|
||||
*/
|
||||
function getPagePDFDimensions(
|
||||
pageSize: PageSize,
|
||||
orientation: PageOrientation
|
||||
): PageDimensions;
|
||||
|
||||
/**
|
||||
* Creates a PDF from the provided SVG elements with specified scaling and page properties.
|
||||
*/
|
||||
function createPDF(props: {
|
||||
SVG: SVGSVGElement[];
|
||||
scale?: PDFExportScale;
|
||||
pageProps?: PDFPageProperties;
|
||||
filename: string;
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates an SVG representation of the current view.
|
||||
*/
|
||||
function createViewSVG(props : {
|
||||
withBackground?: boolean;
|
||||
theme?: "light" | "dark";
|
||||
frameRendering?: FrameRenderingOptions;
|
||||
padding?: number;
|
||||
selectedOnly?: boolean;
|
||||
skipInliningFonts?: boolean;
|
||||
embedScene?: boolean;
|
||||
}): Promise<SVGSVGElement>;
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered when a image is being saved in Excalidraw.
|
||||
* You can use this callback to customize the naming and path of pasted images to avoid
|
||||
* default names like "Pasted image 123147170.png" being saved in the attachments folder,
|
||||
* and instead use more meaningful names based on the Excalidraw file or other criteria,
|
||||
* plus save the image in a different folder.
|
||||
*
|
||||
* If the function returns null or undefined, the normal Excalidraw operation will continue
|
||||
* with the excalidraw generated name and default path.
|
||||
* If a filepath is returned, that will be used. Include the full Vault filepath and filename
|
||||
* with the file extension.
|
||||
* The currentImageName is the name of the image generated by excalidraw or provided during paste.
|
||||
*/
|
||||
function onImageFilePathHook: (data: {
|
||||
currentImageName: string;
|
||||
drawingFilePath: string;
|
||||
}) => string = null;
|
||||
${String.fromCharCode(96,96,96)}
|
||||
`,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Setting } from "obsidian";
|
||||
import { PageOrientation, PageSize, PDFPageAlignment, PDFPageMarginString, STANDARD_PAGE_SIZES } from "src/utils/exportUtils";
|
||||
import { PageOrientation, PageSize, PDFPageAlignment, PDFPageMarginString, STANDARD_PAGE_SIZES } from "src/types/exportUtilTypes";
|
||||
import { t } from "src/lang/helpers";
|
||||
|
||||
export interface PDFExportSettings {
|
||||
|
||||
@@ -66,8 +66,8 @@ export class PenSettingsModal extends Modal {
|
||||
|
||||
async onClose() {
|
||||
if(this.dirty) {
|
||||
await this.plugin.saveSettings();
|
||||
getExcalidrawViews(this.app).forEach(excalidrawView=>excalidrawView.updatePinnedCustomPens());
|
||||
this.plugin.saveSettings();
|
||||
const pen = this.plugin.settings.customPens[this.pen]
|
||||
const api = this.view.excalidrawAPI;
|
||||
setPen(pen,api);
|
||||
@@ -369,7 +369,7 @@ export class PenSettingsModal extends Modal {
|
||||
.setName(fragWithHTML(`Stroke Width <b>${ps.strokeWidth === 0 ? "Not Set" : ps.strokeWidth}</b>`))
|
||||
.addSlider(slider =>
|
||||
slider
|
||||
.setLimits(0,5,0.5)
|
||||
.setLimits(0.1,8,0.1)
|
||||
.setValue(ps.strokeWidth)
|
||||
.onChange(value => {
|
||||
this.dirty = true;
|
||||
@@ -421,7 +421,7 @@ export class PenSettingsModal extends Modal {
|
||||
.setDesc("If the stroke has an outline, this will mean the stroke color is the outline color, and the background color is the pen stroke's fill color. If the pen does not have an outline then the pen color is the stroke color. The Fill Style setting applies to the fill style of the enclosed shape, not of the line itself. The line can only have solid fill.")
|
||||
.addSlider(slider =>
|
||||
slider
|
||||
.setLimits(0,8,0.5)
|
||||
.setLimits(0,8,0.1)
|
||||
.setValue(ps.penOptions.outlineWidth)
|
||||
.onChange(value => {
|
||||
this.dirty = true;
|
||||
|
||||
+234
-51
@@ -8,6 +8,7 @@ import {
|
||||
TFile,
|
||||
Notice,
|
||||
TextAreaComponent,
|
||||
getIcon,
|
||||
} from "obsidian";
|
||||
import ExcalidrawView from "../../view/ExcalidrawView";
|
||||
import ExcalidrawPlugin from "../../core/main";
|
||||
@@ -23,6 +24,11 @@ import { REGEX_LINK, REGEX_TAGS } from "../ExcalidrawData";
|
||||
import { ScriptEngine } from "../Scripts";
|
||||
import { openExternalLink, openTagSearch, parseObsidianLink } from "src/utils/excalidrawViewUtils";
|
||||
import { ButtonDefinition } from "src/types/promptTypes";
|
||||
import { EditorView, keymap } from "@codemirror/view";
|
||||
import { history } from "@codemirror/commands";
|
||||
import { parser } from "./math-only";
|
||||
import { LRLanguage } from "@codemirror/language";
|
||||
import { editorLivePreviewField } from "obsidian";
|
||||
|
||||
export class Prompt extends Modal {
|
||||
private promptEl: HTMLInputElement;
|
||||
@@ -79,6 +85,149 @@ export class Prompt extends Modal {
|
||||
}
|
||||
}
|
||||
|
||||
export class LaTexPrompt extends Modal {
|
||||
public waitForClose : Promise<string>;
|
||||
private promptEl: HTMLInputElement;
|
||||
private resolvePromise: (input: string) => void;
|
||||
private rejectPromise: (reason?: any) => void;
|
||||
private editorView : EditorView;
|
||||
private latexsSuitePlugin : any;
|
||||
|
||||
protected constructor(
|
||||
app: App,
|
||||
private prompt_text: string,
|
||||
private default_value?: string,
|
||||
) {
|
||||
super(app);
|
||||
this.titleEl.setText(this.prompt_text);
|
||||
this.contentEl.addClass("excalidraw-LatexPrompt");
|
||||
this.latexsSuitePlugin = app.plugins.plugins["obsidian-latex-suite"];
|
||||
const mainContentContainer: HTMLDivElement = this.contentEl.createDiv();
|
||||
this.display(default_value, mainContentContainer);
|
||||
this.waitForClose = new Promise<string>((resolve, reject) => {
|
||||
this.resolvePromise = resolve;
|
||||
this.rejectPromise = reject;
|
||||
});
|
||||
this.editorView.focus();
|
||||
}
|
||||
|
||||
public static Prompt(app: App,
|
||||
prompt_text?: string,
|
||||
default_value?: string,
|
||||
): Promise<string>{
|
||||
const latexprompt = new LaTexPrompt(app, prompt_text, default_value);
|
||||
|
||||
return latexprompt.waitForClose;
|
||||
}
|
||||
|
||||
private display(value : string, container : HTMLDivElement) {
|
||||
if (this.latexsSuitePlugin) {
|
||||
// the language put eveything in a "math" node
|
||||
// surrounded by "math-begin" and "math-end"
|
||||
// so that latex-suite always thinks we are in mathmode
|
||||
const language = LRLanguage.define({parser:parser});
|
||||
const extensions = [
|
||||
language,
|
||||
keymap.of([{
|
||||
key:"Mod-Enter",
|
||||
run : () => {this.submitCallback(); return true;}
|
||||
}]),
|
||||
history(),
|
||||
editorLivePreviewField.init(() => false),
|
||||
... this.latexsSuitePlugin.editorExtensions
|
||||
];
|
||||
|
||||
this.editorView = new EditorView({
|
||||
doc: value,
|
||||
parent : container,
|
||||
extensions : extensions,
|
||||
});
|
||||
} else {
|
||||
const extensions = [
|
||||
keymap.of([{
|
||||
key:"Mod-Enter",
|
||||
run : () => {this.submitCallback(); return true;}
|
||||
}]),
|
||||
history(),
|
||||
];
|
||||
this.editorView = new EditorView({
|
||||
doc: value,
|
||||
extensions : extensions,
|
||||
parent : container,
|
||||
});
|
||||
}
|
||||
|
||||
const buttonBarContainer: HTMLDivElement = container.createDiv();
|
||||
buttonBarContainer.addClass(`excalidraw-prompt-buttonbar-bottom`);
|
||||
const actionButtonContainer: HTMLDivElement = buttonBarContainer.createDiv();
|
||||
|
||||
this.createButton(
|
||||
actionButtonContainer,
|
||||
"",
|
||||
this.submitCallback.bind(this),
|
||||
t("PROMPT_BUTTON_OK") ?? "",
|
||||
undefined,
|
||||
"check"
|
||||
).setCta().buttonEl.style.marginRight = "0";
|
||||
this.createButton(
|
||||
actionButtonContainer,
|
||||
"",
|
||||
this.cancelCallback.bind(this),
|
||||
t("PROMPT_BUTTON_CANCEL"),
|
||||
undefined,
|
||||
"x"
|
||||
);
|
||||
this.open();
|
||||
}
|
||||
|
||||
private createButton(container: HTMLElement,
|
||||
text: string,
|
||||
callback: (evt: MouseEvent) => any,
|
||||
tooltip: string = "",
|
||||
margin: string = "5px",
|
||||
iconId?:string,
|
||||
){
|
||||
const btn = new ButtonComponent(container);
|
||||
btn.buttonEl.style.padding = "0.5em";
|
||||
btn.buttonEl.style.marginLeft = margin;
|
||||
btn.setTooltip(tooltip);
|
||||
|
||||
if (iconId) {
|
||||
btn.setIcon(iconId);
|
||||
} else {
|
||||
btn.setButtonText(text);
|
||||
}
|
||||
|
||||
btn.onClick(callback);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private submitCallback(){
|
||||
const res = this.editorView.state.doc.toString();
|
||||
if (res.trim().length == 0) {
|
||||
this.rejectPromise("empty latex");
|
||||
} else {
|
||||
this.resolvePromise(res);
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
|
||||
private cancelCallback(){
|
||||
this.rejectPromise("Canceled input");
|
||||
this.close();
|
||||
}
|
||||
|
||||
onOpen(): void {
|
||||
super.onOpen();
|
||||
this.editorView.focus();
|
||||
}
|
||||
|
||||
onClose(): void {
|
||||
this.contentEl.empty();
|
||||
this.editorView.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
export class GenericInputPrompt extends Modal {
|
||||
public waitForClose: Promise<string>;
|
||||
private view: ExcalidrawView;
|
||||
@@ -101,6 +250,26 @@ export class GenericInputPrompt extends Modal {
|
||||
private draggable: boolean = false;
|
||||
private cleanupDragListeners: (() => void) | null = null;
|
||||
|
||||
// Add event handler instance properties
|
||||
private handleKeyDown = (evt: KeyboardEvent) => {
|
||||
if ((evt.key === "Enter" && this.lines === 1) || (isWinCTRLorMacCMD(evt) && evt.key === "Enter")) {
|
||||
evt.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
if (this.displayEditorButtons && evt.key === "k" && isWinCTRLorMacCMD(evt)) {
|
||||
evt.preventDefault();
|
||||
this.linkBtnClickCallback();
|
||||
}
|
||||
};
|
||||
|
||||
private handleCheckCaret = () => {
|
||||
//timer is implemented because on iPad with pencil the button click generates an event on the textarea
|
||||
this.selectionUpdateTimer = this.view.ownerWindow.setTimeout(() => {
|
||||
this.selectionStart = this.inputComponent.inputEl.selectionStart;
|
||||
this.selectionEnd = this.inputComponent.inputEl.selectionEnd;
|
||||
}, 30);
|
||||
};
|
||||
|
||||
public static Prompt(
|
||||
view: ExcalidrawView,
|
||||
plugin: ExcalidrawPlugin,
|
||||
@@ -141,7 +310,7 @@ export class GenericInputPrompt extends Modal {
|
||||
private header: string,
|
||||
placeholder?: string,
|
||||
value?: string,
|
||||
buttons?: { caption: string; action: Function }[],
|
||||
buttons?: ButtonDefinition[],
|
||||
lines?: number,
|
||||
displayEditorButtons?: boolean,
|
||||
customComponents?: (container: HTMLElement) => void,
|
||||
@@ -226,25 +395,15 @@ export class GenericInputPrompt extends Modal {
|
||||
.setValue(value ?? "")
|
||||
.onChange((value) => (this.input = value));
|
||||
|
||||
let i = 0;
|
||||
|
||||
const checkcaret = () => {
|
||||
//timer is implemented because on iPad with pencil the button click generates an event on the textarea
|
||||
this.selectionUpdateTimer = this.view.ownerWindow.setTimeout(() => {
|
||||
this.selectionStart = this.inputComponent.inputEl.selectionStart;
|
||||
this.selectionEnd = this.inputComponent.inputEl.selectionEnd;
|
||||
}, 30);
|
||||
}
|
||||
|
||||
textComponent.inputEl.addEventListener("keydown", this.keyDownCallback.bind(this));
|
||||
textComponent.inputEl.addEventListener('keyup', checkcaret.bind(this)); // Every character written
|
||||
textComponent.inputEl.addEventListener('pointerup', checkcaret.bind(this)); // Click down
|
||||
textComponent.inputEl.addEventListener('touchend', checkcaret.bind(this)); // Click down
|
||||
textComponent.inputEl.addEventListener('input', checkcaret.bind(this)); // Other input events
|
||||
textComponent.inputEl.addEventListener('paste', checkcaret.bind(this)); // Clipboard actions
|
||||
textComponent.inputEl.addEventListener('cut', checkcaret.bind(this));
|
||||
textComponent.inputEl.addEventListener('select', checkcaret.bind(this)); // Some browsers support this event
|
||||
textComponent.inputEl.addEventListener('selectionchange', checkcaret.bind(this));// Some browsers support this event
|
||||
textComponent.inputEl.addEventListener("keydown", this.handleKeyDown);
|
||||
textComponent.inputEl.addEventListener('keyup', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('pointerup', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('touchend', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('input', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('paste', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('cut', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('select', this.handleCheckCaret);
|
||||
textComponent.inputEl.addEventListener('selectionchange', this.handleCheckCaret);
|
||||
|
||||
return textComponent;
|
||||
}
|
||||
@@ -255,12 +414,20 @@ export class GenericInputPrompt extends Modal {
|
||||
callback: (evt: MouseEvent) => any,
|
||||
tooltip: string = "",
|
||||
margin: string = "5px",
|
||||
iconId?:string,
|
||||
) {
|
||||
const btn = new ButtonComponent(container);
|
||||
btn.buttonEl.style.padding = "0.5em";
|
||||
btn.buttonEl.style.marginLeft = margin;
|
||||
btn.setTooltip(tooltip);
|
||||
btn.setButtonText(text).onClick(callback);
|
||||
|
||||
if (iconId) {
|
||||
btn.setIcon(iconId);
|
||||
} else {
|
||||
btn.setButtonText(text);
|
||||
}
|
||||
|
||||
btn.onClick(callback);
|
||||
return btn;
|
||||
}
|
||||
|
||||
@@ -276,13 +443,17 @@ export class GenericInputPrompt extends Modal {
|
||||
const btn = new ButtonComponent(actionButtonContainer);
|
||||
btn.buttonEl.style.marginLeft="5px";
|
||||
if(button.tooltip) btn.setTooltip(button.tooltip);
|
||||
btn.setButtonText(button.caption).onClick((evt: MouseEvent) => {
|
||||
const res = button.action(this.input);
|
||||
if (res) {
|
||||
this.input = res;
|
||||
}
|
||||
this.submit();
|
||||
});
|
||||
button.iconId
|
||||
? btn.setIcon(button.iconId)
|
||||
: btn.setButtonText(button.caption);
|
||||
button.tooltip && btn.setTooltip(button.tooltip);
|
||||
btn.onClick((evt: MouseEvent) => {
|
||||
const res = button.action(this.input);
|
||||
if (res) {
|
||||
this.input = res;
|
||||
}
|
||||
this.submit();
|
||||
});
|
||||
b = b ?? btn;
|
||||
}
|
||||
if (b) {
|
||||
@@ -292,20 +463,32 @@ export class GenericInputPrompt extends Modal {
|
||||
} else {
|
||||
this.createButton(
|
||||
actionButtonContainer,
|
||||
"✅",
|
||||
"",
|
||||
this.submitClickCallback.bind(this),
|
||||
t("PROMPT_BUTTON_OK") ?? "",
|
||||
"5px",
|
||||
"check",
|
||||
).setCta().buttonEl.style.marginRight = "0";
|
||||
}
|
||||
this.createButton(actionButtonContainer, "❌", this.cancelClickCallback.bind(this), t("PROMPT_BUTTON_CANCEL"));
|
||||
|
||||
this.createButton(
|
||||
actionButtonContainer,
|
||||
"",
|
||||
this.cancelClickCallback.bind(this),
|
||||
t("PROMPT_BUTTON_CANCEL"),
|
||||
"5px",
|
||||
"x",
|
||||
);
|
||||
|
||||
if(this.displayEditorButtons) {
|
||||
this.createButton(editorButtonContainer, "⏎", ()=>this.insertStringBtnClickCallback("\n"), t("PROMPT_BUTTON_INSERT_LINE"), "0");
|
||||
this.createButton(editorButtonContainer, "⌫", this.delBtnClickCallback.bind(this), "Delete");
|
||||
this.createButton(editorButtonContainer, "⎵", ()=>this.insertStringBtnClickCallback(" "), t("PROMPT_BUTTON_INSERT_SPACE"));
|
||||
this.createButton(editorButtonContainer, "§", this.specialCharsBtnClickCallback.bind(this), t("PROMPT_BUTTON_SPECIAL_CHARS"));
|
||||
this.createButton(editorButtonContainer, "", ()=>this.insertStringBtnClickCallback("\n"), t("PROMPT_BUTTON_INSERT_LINE"), "0", "corner-down-left");
|
||||
this.createButton(editorButtonContainer, "", this.delBtnClickCallback.bind(this), "Delete", "5px", "delete");
|
||||
this.createButton(editorButtonContainer, "", ()=>this.insertStringBtnClickCallback(" "), t("PROMPT_BUTTON_INSERT_SPACE"), "5px", "space");
|
||||
this.createButton(editorButtonContainer, "", this.specialCharsBtnClickCallback.bind(this), t("PROMPT_BUTTON_SPECIAL_CHARS"), "5px", "at-sign");
|
||||
if(this.view) {
|
||||
this.createButton(editorButtonContainer, "🔗", this.linkBtnClickCallback.bind(this), t("PROMPT_BUTTON_INSERT_LINK"));
|
||||
this.createButton(editorButtonContainer, "", this.linkBtnClickCallback.bind(this), t("PROMPT_BUTTON_INSERT_LINK"), "5px", "link");
|
||||
}
|
||||
this.createButton(editorButtonContainer, "🔠", this.uppercaseBtnClickCallback.bind(this), t("PROMPT_BUTTON_UPPERCASE"));
|
||||
this.createButton(editorButtonContainer, "", this.uppercaseBtnClickCallback.bind(this), t("PROMPT_BUTTON_UPPERCASE"), "5px", "arrow-big-up");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,17 +555,6 @@ export class GenericInputPrompt extends Modal {
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
private keyDownCallback = (evt: KeyboardEvent) => {
|
||||
if ((evt.key === "Enter" && this.lines === 1) || (isWinCTRLorMacCMD(evt) && evt.key === "Enter")) {
|
||||
evt.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
if (this.displayEditorButtons && evt.key === "k" && isWinCTRLorMacCMD(evt)) {
|
||||
evt.preventDefault();
|
||||
this.linkBtnClickCallback();
|
||||
}
|
||||
};
|
||||
|
||||
private submit() {
|
||||
this.didSubmit = true;
|
||||
this.close();
|
||||
@@ -401,10 +573,18 @@ export class GenericInputPrompt extends Modal {
|
||||
}
|
||||
|
||||
private removeInputListener() {
|
||||
this.inputComponent?.inputEl?.removeEventListener(
|
||||
"keydown",
|
||||
this.keyDownCallback,
|
||||
);
|
||||
if (!this.inputComponent?.inputEl) return;
|
||||
|
||||
const inputEl = this.inputComponent.inputEl;
|
||||
inputEl.removeEventListener("keydown", this.handleKeyDown);
|
||||
inputEl.removeEventListener('keyup', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('pointerup', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('touchend', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('input', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('paste', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('cut', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('select', this.handleCheckCaret);
|
||||
inputEl.removeEventListener('selectionchange', this.handleCheckCaret);
|
||||
}
|
||||
|
||||
private specialCharsBtnClickCallback = (evt: MouseEvent) => {
|
||||
@@ -477,6 +657,8 @@ export class GenericInputPrompt extends Modal {
|
||||
|
||||
onOpen() {
|
||||
super.onOpen();
|
||||
this.modalEl.classList.add("excalidraw-modal");
|
||||
this.containerEl.classList.add("excalidraw-modal");
|
||||
this.inputComponent.inputEl.focus();
|
||||
this.inputComponent.inputEl.select();
|
||||
|
||||
@@ -1011,6 +1193,7 @@ export async function linkPrompt(
|
||||
...tagsArray,
|
||||
];
|
||||
|
||||
await sleep(10); //obsidian modal link click immediately refocuses the editor, so we need to wait a bit
|
||||
if (items.length>1) {
|
||||
parts = await ScriptEngine.suggester(
|
||||
app,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Modal, Setting, TFile } from "obsidian";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { getIMGFilename } from "src/utils/fileUtils";
|
||||
import { addIframe } from "src/utils/utils";
|
||||
import { addYouTubeThumbnail } from "src/utils/utils";
|
||||
|
||||
const haveLinkedFilesChanged = (depth: number, mtime: number, path: string, sourceList: Set<string>, plugin: ExcalidrawPlugin):boolean => {
|
||||
if(depth++ > 5) return false;
|
||||
@@ -67,7 +67,7 @@ export class PublishOutOfDateFilesDialog extends Modal {
|
||||
text: "Video about Obsidian Publish support",
|
||||
});
|
||||
detailsEl.createEl("br");
|
||||
addIframe(detailsEl, "JC1E-jeiWhI");
|
||||
addYouTubeThumbnail(detailsEl, "JC1E-jeiWhI");
|
||||
const p = this.contentEl.createEl("p",{text: "Collecting data..."});
|
||||
const statusEl = this.contentEl.createEl("p", {text: "Status: "});
|
||||
const files = await listOfOutOfSyncImgExports(this.plugin, recursive, statusEl);
|
||||
|
||||
@@ -8,6 +8,8 @@ import { addBackOfTheNoteCard } from "src/utils/excalidrawViewUtils";
|
||||
|
||||
export class SelectCard extends FuzzySuggestModal<string> {
|
||||
private center: boolean = false;
|
||||
private x: number = 0;
|
||||
private y: number = 0;
|
||||
|
||||
constructor(
|
||||
public app: App,
|
||||
@@ -32,7 +34,7 @@ export class SelectCard extends FuzzySuggestModal<string> {
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
addBackOfTheNoteCard(this.view, item, true, undefined, undefined, this.center);
|
||||
addBackOfTheNoteCard(this.view, item, true, undefined, undefined, this.center, {x: this.x, y: this.y});
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
@@ -49,17 +51,16 @@ export class SelectCard extends FuzzySuggestModal<string> {
|
||||
|
||||
onChooseItem(item: string): void {
|
||||
const ea = getEA(this.view) as ExcalidrawAutomate;
|
||||
let x,y = 0;
|
||||
if(this.center) {
|
||||
const centerPos = ea.getViewCenterPosition();
|
||||
if(centerPos) {
|
||||
x = centerPos.x - (CARD_WIDTH / 2);
|
||||
y = centerPos.y - (CARD_HEIGHT / 2);
|
||||
this.x = centerPos.x - (CARD_WIDTH / 2);
|
||||
this.y = centerPos.y - (CARD_HEIGHT / 2);
|
||||
}
|
||||
}
|
||||
|
||||
const id = ea.addEmbeddable(
|
||||
x,y,CARD_WIDTH,CARD_HEIGHT,
|
||||
this.x,this.y,CARD_WIDTH,CARD_HEIGHT,
|
||||
`[[${this.view.file.path}#${item}]]`
|
||||
);
|
||||
(async () => {
|
||||
@@ -70,7 +71,9 @@ export class SelectCard extends FuzzySuggestModal<string> {
|
||||
}
|
||||
|
||||
public start(center: boolean = false): void {
|
||||
this.center = center;
|
||||
this.x = this.view.currentPosition.x;
|
||||
this.y = this.view.currentPosition.y;
|
||||
this.center = !!center;
|
||||
this.emptyStateText = t("EMPTY_SECTION_MESSAGE");
|
||||
this.setPlaceholder(t("SELECT_SECTION_OR_TYPE_NEW"));
|
||||
this.open();
|
||||
|
||||
@@ -202,6 +202,22 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
desc: "Get single element from ExcalidrawAutomate elementsDict",
|
||||
after: "",
|
||||
},
|
||||
{
|
||||
field: "getBoundTextElement",
|
||||
code:
|
||||
"getBoundTextElement(element: ExcalidrawElement, searchInView?: boolean): { eaElement?: Mutable<ExcalidrawTextElement>; sceneElement?: ExcalidrawTextElement; };",
|
||||
desc:
|
||||
"Returns an object describing the bound text element.\n" +
|
||||
"If a text element is provided:\n" +
|
||||
" - returns { eaElement } if the element is in ea.elementsDict\n" +
|
||||
" - else (if searchInView is true) returns { sceneElement } if found in the targetView scene\n" +
|
||||
"If a container element is provided, searches for the bound text element:\n" +
|
||||
" - returns { eaElement } if found in ea.elementsDict\n" +
|
||||
" - else (if searchInView is true) returns { sceneElement } if found in the targetView scene\n" +
|
||||
"If not found, returns {}.\n" +
|
||||
"Does not add the text element to elementsDict.",
|
||||
after: "",
|
||||
},
|
||||
{
|
||||
field: "create",
|
||||
code: 'async create(params?: {filename?: string, foldername?: string, templatePath?: string, onNewPane?: boolean, silent?: boolean, frontmatterKeys?: {},}): Promise<string>;',
|
||||
@@ -221,12 +237,13 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
' "excalidraw-linkbutton-opacity"?: number;\n' +
|
||||
' "excalidraw-autoexport"?: boolean;\n' +
|
||||
' "excalidraw-mask"?: boolean;\n' +
|
||||
' "excalidraw-export-internal-links"?: boolean;\n' +
|
||||
' "cssclasses"?: string;\n}',
|
||||
after: "",
|
||||
},
|
||||
{
|
||||
field: "createSVG",
|
||||
code: "async createSVG(templatePath?: string, embedFont?: boolean, exportSettings?: ExportSettings, loader?: EmbeddedFilesLoader, theme?: string,): Promise<SVGSVGElement>;",
|
||||
code: "async createSVG(templatePath?: string, embedFont?: boolean, exportSettings?: ExportSettings, loader?: EmbeddedFilesLoader, theme?: string, padding?: number, convertMarkdownLinksToObsidianURLs: boolean = false, includeInternalLinks: boolean = true,): Promise<SVGSVGElement>;",
|
||||
desc: "Use ExcalidrawAutomate.getExportSettings(boolean,boolean) to create an ExportSettings object.\nUse ExcalidrawAutomate.getEmbeddedFilesLoader(boolean?) to create an EmbeddedFilesLoader object.",
|
||||
after: "",
|
||||
},
|
||||
@@ -387,8 +404,14 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
},
|
||||
{
|
||||
field: "addArrow",
|
||||
code: "addArrow(points: [[x: number, y: number]], formatting?: { startArrowHead?: string; endArrowHead?: string; startObjectId?: string; endObjectId?: string;}, id?:string): string;",
|
||||
desc: `valid values for startArrowHead and endArrowHead are: "arrow"|"bar"|"circle"|"circle_outline"|"triangle"|"triangle_outline"|"diamond"|"diamond_outline"|null`,
|
||||
code:
|
||||
'addArrow(points: [x: number, y: number][], formatting?: { startArrowHead?: string; endArrowHead?: string; startObjectId?: string; endObjectId?: string; startBindMode?: string; endBindMode?: string; startFixedPoint?: [number, number]; endFixedPoint?: [number, number]; elbowed?: boolean}, id?: string): string;',
|
||||
desc:
|
||||
"Adds an arrow element.\n" +
|
||||
'Arrowheads: "arrow"|"bar"|"circle"|"circle_outline"|"triangle"|"triangle_outline"|"diamond"|"diamond_outline"|null.\n' +
|
||||
'Bindings: "inside" | "outside" Sets startObjectId/endObjectId to bind the arrow ends to shapes. Bind mode: "orbit" (default) or "inside".\n' +
|
||||
"Fixed point: [xRatio,yRatio] in 0..1 (percentage of bound element width/height) to bind to a specific point on the element. In case of orbit mode, the orbit will happen around this immaginary point.\n" +
|
||||
"Elbowed: true will create an elbowed arrow.",
|
||||
after: "",
|
||||
},
|
||||
{
|
||||
@@ -468,9 +491,18 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
},
|
||||
{
|
||||
field: "setView",
|
||||
code: 'setView(view: ExcalidrawView | "first" | "active"): ExcalidrawView;',
|
||||
desc: null,
|
||||
after: "",
|
||||
code: 'setView(view?: ExcalidrawView | "auto" | "first" | "active" | null, show: boolean = false): ExcalidrawView;',
|
||||
desc: "Sets the target view for EA. All the view operations and the access to Excalidraw API will be performed on this view. " +
|
||||
"Typically you will use setView() (to pick a sensible default) or setView(excalidrawView) (to explicitly target a specific view).\n" +
|
||||
'"auto" is equivalent to calling setView() and can read nicer when you want to show the view (e.g. setView("auto", true)).\n' +
|
||||
'"active" and "first" are deprecated and are kept for backward compatibility.\n' +
|
||||
'If view is null or undefined (or "auto"), EA will pick a sensible default: first the currently active Excalidraw view (if any), otherwise the last active Excalidraw view (if it is still available), otherwise the "first" Excalidraw view in the workspace.\n' +
|
||||
"If show is true, the view will be brought to front and focused.\n" +
|
||||
'If "first" is provided, the target will be the first Excalidraw view returned by Obsidian\'s workspace leaf collection (i.e., the first item in getExcalidrawViews()). ' +
|
||||
"This ordering is managed by Obsidian and does not necessarily match what a user would consider the “first” view; from a user's perspective it may appear random.\n" +
|
||||
'If "active" is provided, the currently active Excalidraw view in the workspace will be used. If that is not available, then the last active Excalidraw view will be used.\n' +
|
||||
"The function returns the ExcalidrawView that was set as targetView.",
|
||||
after: '("auto",true);',
|
||||
},
|
||||
{
|
||||
field: "getExcalidrawAPI",
|
||||
@@ -678,6 +710,37 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
desc: `Sets script settings.\nSee for more details: ${hyperlink("https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html","Script Engine Help")}`,
|
||||
after: "",
|
||||
},
|
||||
{
|
||||
field: "setScriptSettingValue",
|
||||
code: "setScriptSettingValue(key: string, value: ScriptSettingValue): void;",
|
||||
desc:
|
||||
`Sets a single Script Engine setting value for the active script (in-memory).\n` +
|
||||
`Use saveScriptSettings() to persist changes.\n` +
|
||||
`Handles initialization when scriptEngineSettings[activeScript] is undefined/null.\n` +
|
||||
`See for more details: ${hyperlink("https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html","Script Engine Help")}\n\n` +
|
||||
`type ScriptSettingValue = { value?: string; hidden?: boolean; description?: string; valueset?: string[]; height?: number; };`,
|
||||
after: `("myKey", { value: "" });`,
|
||||
},
|
||||
{
|
||||
field: "getScriptSettingValue",
|
||||
code: "getScriptSettingValue(key: string, defaultValue: ScriptSettingValue): ScriptSettingValue;",
|
||||
desc:
|
||||
`Gets a single Script Engine setting value for the active script.\n` +
|
||||
`Returns defaultValue if the key does not exist (or if activeScript is not set).\n` +
|
||||
`Handles initialization when scriptEngineSettings[activeScript] is undefined/null.\n` +
|
||||
`See for more details: ${hyperlink("https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html","Script Engine Help")}\n\n` +
|
||||
`type ScriptSettingValue = { value?: string; hidden?: boolean; description?: string; valueset?: string[]; height?: number; };`,
|
||||
after: `("myKey", { value: "" });`,
|
||||
},
|
||||
{
|
||||
field: "saveScriptSettings",
|
||||
code: "async saveScriptSettings(): Promise<void>;",
|
||||
desc:
|
||||
`Persists Script Engine settings to disk (plugin settings).\n` +
|
||||
`Useful after calling setScriptSettingValue().\n` +
|
||||
`See for more details: ${hyperlink("https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html","Script Engine Help")}`,
|
||||
after: "()",
|
||||
},
|
||||
{
|
||||
field: "openFileInNewOrAdjacentLeaf",
|
||||
code: "openFileInNewOrAdjacentLeaf(file: TFile): WorkspaceLeaf;",
|
||||
@@ -950,7 +1013,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
|
||||
export const EXCALIDRAW_SCRIPTENGINE_INFO: SuggesterInfo[] = [
|
||||
{
|
||||
field: "inputPrompt",
|
||||
code: "inputPrompt: (opts: {header: string, placeholder?: string, value?: string, buttons?: {caption:string, tooltip?:string, action:Function}[], lines?: number, displayEditorButtons?: boolean, customComponents?: (container: HTMLElement) => void, blockPointerInputOutsideModal?: boolean, controlsOnTop?: boolean});",
|
||||
code: "inputPrompt: (opts: {header: string, placeholder?: string, value?: string, buttons?: {caption:string, tooltip?:string, iconId?: string, action:Function}[], lines?: number, displayEditorButtons?: boolean, customComponents?: (container: HTMLElement) => void, blockPointerInputOutsideModal?: boolean, controlsOnTop?: boolean});",
|
||||
desc:
|
||||
"Opens a prompt that asks for an input.\nReturns a string with the input.\nYou need to await the result of inputPrompt.\n" +
|
||||
"Editor buttons are text editing buttons like delete, enter, allcaps - these are only displayed if lines is greater than 1 \n" +
|
||||
@@ -958,6 +1021,7 @@ export const EXCALIDRAW_SCRIPTENGINE_INFO: SuggesterInfo[] = [
|
||||
"blockPointerInputOutsideModal will block pointer input outside the modal. This is useful if you want to prevent the user accidently closing the modal or interacting with the excalidraw canvas while the prompt is open.\n" +
|
||||
"controlsOnTop when set to true will move all the buttons to the top of the modal, leaving the text area at the bottom. This feature was developed for Scribble Helper script to avoid your palm pressing buttons while scribbling.\n"+
|
||||
"buttons.action(input: string) => string\nThe button action function will receive the actual input string. If action returns null, input will be unchanged. If action returns a string, input will receive that value when the promise is resolved. " +
|
||||
"iconId is the lucide.dev icon name. If iconId is provided caption will be ignored, simply submit \"\" as caption in that case. \n" +
|
||||
"example:\n<code>let fileType = '';\nconst filename = await utils.inputPrompt (\n 'Filename',\n '',\n '',\n, [\n {\n caption: 'Markdown',\n action: ()=>{fileType='md';return;}\n },\n {\n caption: 'Excalidraw',\n action: ()=>{fileType='ex';return;}\n }\n ]\n);</code>",
|
||||
after: `({\n header: "",\n placeholder: undefined, //string\n value: undefined, //string\n buttons: [{ //optional, may leave undefined\n caption: "", //string\n tooltip: undefined, //string\n action: (input)=>{} //Function\n }],\n lines: undefined, //number\n displayEditorButtons: undefined, //boolean\n customComponents: undefined, //(container: HTMLElement) => void\n blockPointerInputOutsideModal: undefined, //boolean\n controlsOnTop: undefined, //boolean\n draggable: undefined, //boolean\n});`,
|
||||
},
|
||||
@@ -979,7 +1043,7 @@ export const FRONTMATTER_KEYS_INFO: SuggesterInfo[] = [
|
||||
{
|
||||
field: "plugin",
|
||||
code: null,
|
||||
desc: "Denotes an excalidraw file. If key is not present, the file will not be recognized as an Excalidarw file. Valid values are 'parsed' and 'raw'",
|
||||
desc: "Denotes an excalidraw file. If key is not present, the file will not be recognized as an Excalidraw file. Valid values are 'parsed' and 'raw'",
|
||||
after: ": parsed",
|
||||
},
|
||||
{
|
||||
@@ -1073,6 +1137,12 @@ export const FRONTMATTER_KEYS_INFO: SuggesterInfo[] = [
|
||||
desc: "If this key is present it will override the default excalidraw embed and export setting.",
|
||||
after: ": false",
|
||||
},
|
||||
{
|
||||
field: "export-internal-links",
|
||||
code: null,
|
||||
desc: "Default value (if not set) is true, if set to false internal links will not be exported to SVG images and PDFs.",
|
||||
after: ": false",
|
||||
},
|
||||
{
|
||||
field: "open-md",
|
||||
code: null,
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
import { Setting, DropdownComponent, App } from "obsidian";
|
||||
import { t } from "src/lang/helpers";
|
||||
import { ExcalidrawSettings } from "src/core/settings";
|
||||
import { fragWithHTML, setLeftHandedMode, setUIMode } from "src/utils/utils";
|
||||
import { DEVICE } from "src/constants/constants";
|
||||
|
||||
export type UIMode = "full" | "compact" | "tray" | "phone";
|
||||
|
||||
//setTrayMode(this.app, this.plugin.settings);
|
||||
//setDesktopUIMode(this.app, this.plugin.settings);
|
||||
|
||||
|
||||
export class UIModeSettingsComponent {
|
||||
private containerEl: HTMLElement;
|
||||
private settings: ExcalidrawSettings;
|
||||
private app: App;
|
||||
private onChange: () => void;
|
||||
|
||||
constructor(
|
||||
containerEl: HTMLElement,
|
||||
settings: ExcalidrawSettings,
|
||||
app: App,
|
||||
onChange: () => void,
|
||||
) {
|
||||
this.containerEl = containerEl;
|
||||
this.settings = settings;
|
||||
this.app = app;
|
||||
this.onChange = onChange;
|
||||
}
|
||||
|
||||
render(): void {
|
||||
const { containerEl } = this;
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("DESKTOP_UI_MODE_NAME"))
|
||||
.setDesc(t("DESKTOP_UI_MODE_DESC"))
|
||||
.addDropdown((dropdown: DropdownComponent) =>
|
||||
dropdown
|
||||
.addOption("full", t("MODE_FULL"))
|
||||
.addOption("compact", t("MODE_COMPACT"))
|
||||
.addOption("tray", t("MODE_TRAY"))
|
||||
.setValue(this.settings.desktopUIMode)
|
||||
.onChange((value: UIMode) => {
|
||||
this.settings.desktopUIMode = value;
|
||||
if (DEVICE.isDesktop) {
|
||||
setUIMode(this.app, this.settings);
|
||||
}
|
||||
this.onChange();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("TABLET_UI_MODE_NAME"))
|
||||
.setDesc(t("TABLET_UI_MODE_DESC"))
|
||||
.addDropdown((dropdown: DropdownComponent) =>
|
||||
dropdown
|
||||
.addOption("compact", t("MODE_COMPACT"))
|
||||
.addOption("tray", t("MODE_TRAY"))
|
||||
.setValue(this.settings.tabletUIMode)
|
||||
.onChange((value: UIMode) => {
|
||||
this.settings.tabletUIMode = value;
|
||||
if (DEVICE.isTablet) {
|
||||
setUIMode(this.app, this.settings);
|
||||
}
|
||||
this.onChange();
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("LEFTHANDED_MODE_NAME"))
|
||||
.setDesc(fragWithHTML(t("LEFTHANDED_MODE_DESC")))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.settings.isLeftHanded)
|
||||
.onChange(async (value) => {
|
||||
this.settings.isLeftHanded = value;
|
||||
//not clear why I need to do this. If I don't double apply the stylesheet changes
|
||||
//then the style won't be applied in the popout windows
|
||||
setLeftHandedMode(value);
|
||||
setTimeout(()=>setLeftHandedMode(value));
|
||||
this.onChange();
|
||||
}),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { t } from "src/lang/helpers";
|
||||
import { UIModeSettingsComponent } from "./UIModeSettingComponent";
|
||||
import { FloatingModal } from "./FloatingModal";
|
||||
import { Modal } from "obsidian";
|
||||
|
||||
export class UIModeSettings extends Modal {
|
||||
private isDirty = false;
|
||||
constructor(
|
||||
private plugin: ExcalidrawPlugin,
|
||||
) {
|
||||
super(plugin.app);
|
||||
}
|
||||
|
||||
onOpen(): void {
|
||||
this.containerEl.classList.add("excalidraw-release");
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
async onClose() {
|
||||
if (this.isDirty) {
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
this.plugin = null;
|
||||
}
|
||||
|
||||
async createForm() {
|
||||
this.contentEl.createEl("h1",{text: t("MODES_HEAD")});
|
||||
new UIModeSettingsComponent(
|
||||
this.contentEl,
|
||||
this.plugin.settings,
|
||||
this.app,
|
||||
()=>this.applySettingsUpdate(),
|
||||
).render();
|
||||
}
|
||||
|
||||
private async applySettingsUpdate() {
|
||||
this.isDirty = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,10 @@ export class UniversalInsertFileModal extends Modal {
|
||||
}
|
||||
|
||||
onOpen(): void {
|
||||
const modalEl = this.modalEl;
|
||||
modalEl.classList.add("excalidraw-modal");
|
||||
this.containerEl.classList.add("excalidraw-release");
|
||||
this.containerEl.classList.add("excalidraw-modal");
|
||||
this.titleEl.setText(t("UIFM_TITLE"));
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import { Modal, Setting } from "obsidian";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { t } from "src/lang/helpers";
|
||||
|
||||
declare const PLUGIN_VERSION: string;
|
||||
|
||||
/**
|
||||
* A modal dialog that informs the user about a version mismatch between the version recorded by Obsidian and the actual version of the plugin executable.
|
||||
* Explain that this can be the result of a partial sync, such as an Obsidian Sync Standard plan, which does not syncronize files larger than 5MB, and the plugin executable is larger.
|
||||
* Explain that changing the plugin version information in Obsidian can lead to unexpected behavior in plugins suchs as the Plugin Update Tracker plugin or the BRAT plugin.
|
||||
* The user has a toggle button to disable this check in the future. There is additional information that this can be reenabled in plugin settings.
|
||||
* The user can click update obsidian version info to match the plugin version, and open Obsidian settings to redownload the plugin.
|
||||
* The user can click ignore to dismiss the dialog.
|
||||
*/
|
||||
export class VersionMismatchPrompt extends Modal {
|
||||
private resolvePromise: (value: any) => void;
|
||||
public promise: Promise<any>;
|
||||
private resolved: boolean;
|
||||
private isDirty: boolean = false;
|
||||
|
||||
public constructor(
|
||||
private plugin: ExcalidrawPlugin,
|
||||
) {
|
||||
super(plugin.app);
|
||||
}
|
||||
|
||||
async start(): Promise<any> {
|
||||
this.promise = new Promise((resolve) => {
|
||||
this.resolvePromise = resolve;
|
||||
});
|
||||
await this.plugin.loadSettings();
|
||||
this.buildUI();
|
||||
this.open();
|
||||
return this.promise;
|
||||
}
|
||||
|
||||
private buildUI() {
|
||||
const { contentEl } = this;
|
||||
contentEl.empty();
|
||||
const recorded = this.plugin.manifest.version;
|
||||
const actual = PLUGIN_VERSION;
|
||||
|
||||
contentEl.createEl("h2", { text: t("VERSION_MISMATCH_HEADING") });
|
||||
const p1 = contentEl.createEl("p");
|
||||
p1.innerHTML = t("VERSION_MISMATCH_NOTICE")
|
||||
.replace("{VAL_RECORDED}", recorded)
|
||||
.replace("{VAL_ACTUAL}", actual);
|
||||
|
||||
const p2 = contentEl.createEl("p");
|
||||
p2.innerHTML = t("VERSION_MISMATCH_CAUSE");
|
||||
|
||||
const p3 = contentEl.createEl("p");
|
||||
p3.innerHTML = t("VERSION_MISMATCH_OPTIONS");
|
||||
|
||||
const p4 = contentEl.createEl("p");
|
||||
p4.innerHTML = t("VERSION_MISMATCH_NOTE");
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName(t("VERSION_MISMATCH_DISABLE_NAME"))
|
||||
.setDesc(t("VERSION_MISMATCH_DISABLE_DESC"))
|
||||
.addToggle(tg =>
|
||||
tg.setValue(!this.plugin.settings.compareManifestToPluginVersion ? true : false)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.compareManifestToPluginVersion = !value; // invert because label is Disable ...
|
||||
this.isDirty = true;
|
||||
}),
|
||||
);
|
||||
|
||||
// Buttons row
|
||||
const buttonBar = contentEl.createDiv({ cls: "ex-version-mismatch-buttons" });
|
||||
|
||||
const redownloadBtn = buttonBar.createEl("button", { text: t("VERSION_MISMATCH_REDOWNLOAD") });
|
||||
redownloadBtn.addEventListener("click", () => {
|
||||
this.resolved = true; // triggers opening settings in caller
|
||||
this.close();
|
||||
});
|
||||
|
||||
const ignoreBtn = buttonBar.createEl("button", { text: t("VERSION_MISMATCH_IGNORE") });
|
||||
ignoreBtn.addEventListener("click", () => {
|
||||
this.resolved = false;
|
||||
this.close();
|
||||
});
|
||||
|
||||
buttonBar.style.display = "flex";
|
||||
buttonBar.style.gap = "0.5rem";
|
||||
buttonBar.style.marginTop = "1rem";
|
||||
redownloadBtn.style.backgroundColor = "var(--interactive-accent)";
|
||||
redownloadBtn.style.color = "var(--text-on-accent)";
|
||||
}
|
||||
|
||||
async onClose() {
|
||||
super.onClose();
|
||||
if(this.isDirty) {
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
if (!this.resolved) {
|
||||
this.resolvePromise && this.resolvePromise(false);
|
||||
} else {
|
||||
this.resolvePromise && this.resolvePromise(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
import { ExcalidrawTextElement } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { Notice } from "obsidian";
|
||||
import { t } from "src/lang/helpers";
|
||||
import { ScriptEngine } from "../Scripts";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param view - ExcalidrawView instance
|
||||
* @param prefix - defines the default button.
|
||||
* @returns
|
||||
*/
|
||||
export async function copyLinkToSelectedElementToClipboard(view: ExcalidrawView, prefix: string) {
|
||||
const elements = view.getViewSelectedElements();
|
||||
if (elements.length < 1) {
|
||||
new Notice(t("INSERT_LINK_TO_ELEMENT_ERROR"));
|
||||
return;
|
||||
}
|
||||
|
||||
let elementId: string = undefined;
|
||||
|
||||
if (elements.length === 2) {
|
||||
const textEl = elements.filter((el) => el.type === "text");
|
||||
if (textEl.length === 1 && (textEl[0] as ExcalidrawTextElement).containerId) {
|
||||
const container = elements.filter(
|
||||
(el) => el.boundElements && el.boundElements.some((be) => be.type === "text"),
|
||||
);
|
||||
if (container.length === 1) {
|
||||
elementId = textEl[0].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!elementId) {
|
||||
elementId =
|
||||
elements.length === 1
|
||||
? elements[0].id
|
||||
: view.plugin.ea.getLargestElement(elements).id;
|
||||
}
|
||||
|
||||
const frames = elements.filter((el) => el.type === "frame");
|
||||
const hasFrame = frames.length === 1;
|
||||
const hasMarkerFrame = hasFrame && (frames[0] as any).frameRole === "marker";
|
||||
const hasGroup = elements.some((el) => el.groupIds && el.groupIds.length > 0);
|
||||
|
||||
// Feature 1: UIFM_ANCHOR checkbox (persisted)
|
||||
let anchorTo100 = Boolean(view.plugin.settings.copyLinkToElemenetAnchorTo100);
|
||||
|
||||
// Feature 2: frame link by name (persisted)
|
||||
let copyFrameLinkByName = Boolean(view.plugin.settings.copyFrameLinkByName);
|
||||
|
||||
const frameNameRaw = hasFrame ? (frames[0] as any)?.name : undefined;
|
||||
const frameName = typeof frameNameRaw === "string" ? frameNameRaw.trim() : "";
|
||||
const frameNameIsValid =
|
||||
hasFrame && frameName.length > 0 && /[\p{L}\p{N}_ -]+/u.test(frameName);
|
||||
|
||||
const getFrameTarget = () =>
|
||||
frameNameIsValid && copyFrameLinkByName ? frameName : frames[0].id;
|
||||
|
||||
let cancelled = true;
|
||||
|
||||
const button = {
|
||||
area: {
|
||||
caption: "Area",
|
||||
action: () => {
|
||||
cancelled = false;
|
||||
prefix = "area=";
|
||||
return;
|
||||
}
|
||||
},
|
||||
link: {
|
||||
caption: "Link",
|
||||
action: () => {
|
||||
cancelled = false;
|
||||
prefix = "";
|
||||
return;
|
||||
} },
|
||||
group: {
|
||||
caption: "Group",
|
||||
action: () => {
|
||||
cancelled = false;
|
||||
prefix = "group=";
|
||||
return;
|
||||
}
|
||||
},
|
||||
frame: {
|
||||
caption: "Frame",
|
||||
action: () => {
|
||||
cancelled = false;
|
||||
prefix = "frame=";
|
||||
elementId = getFrameTarget();
|
||||
return;
|
||||
},
|
||||
},
|
||||
clippedframe: {
|
||||
caption: "Clipped Frame",
|
||||
action: () => {
|
||||
cancelled = false;
|
||||
prefix = "clippedframe=";
|
||||
elementId = getFrameTarget();
|
||||
return;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let buttons = [];
|
||||
switch (prefix) {
|
||||
case "area=":
|
||||
buttons = [
|
||||
button.area,
|
||||
button.link,
|
||||
...(hasGroup ? [button.group] : []),
|
||||
...(hasFrame && !hasMarkerFrame ? [button.clippedframe] : []),
|
||||
...(hasFrame ? [button.frame] : []),
|
||||
];
|
||||
break;
|
||||
case "group=":
|
||||
buttons = [
|
||||
...(hasGroup ? [button.group] : []),
|
||||
button.link,
|
||||
button.area,
|
||||
...(hasFrame && !hasMarkerFrame ? [button.clippedframe] : []),
|
||||
...(hasFrame ? [button.frame] : []),
|
||||
];
|
||||
break;
|
||||
case "frame=":
|
||||
buttons = [
|
||||
...(hasFrame && !hasMarkerFrame ? [button.clippedframe] : []),
|
||||
...(hasFrame ? [button.frame] : []),
|
||||
...(hasGroup ? [button.group] : []),
|
||||
button.link,
|
||||
button.area,
|
||||
];
|
||||
break;
|
||||
case "clippedframe=":
|
||||
buttons = [
|
||||
...(hasFrame && !hasMarkerFrame ? [button.clippedframe] : []),
|
||||
...(hasFrame ? [button.frame] : []),
|
||||
...(hasGroup ? [button.group] : []),
|
||||
button.link,
|
||||
button.area,
|
||||
];
|
||||
break;
|
||||
default:
|
||||
buttons = [
|
||||
button.link,
|
||||
button.area,
|
||||
button.group,
|
||||
...(hasFrame && !hasMarkerFrame ? [button.clippedframe] : []),
|
||||
...(hasFrame ? [button.frame] : []),
|
||||
];
|
||||
}
|
||||
|
||||
let alias: string;
|
||||
try {
|
||||
alias = await ScriptEngine.inputPrompt(
|
||||
view,
|
||||
view.plugin,
|
||||
view.app,
|
||||
"Set link alias",
|
||||
"Leave empty if you do not want to set an alias",
|
||||
"",
|
||||
buttons,
|
||||
undefined,
|
||||
undefined,
|
||||
(container: HTMLElement) => {
|
||||
const wrapper = container.createDiv?.("excalidraw-prompt-checkboxes") ?? container;
|
||||
const ownerDoc = wrapper.ownerDocument ?? document;
|
||||
|
||||
const anchorRow = ownerDoc.createElement("label");
|
||||
anchorRow.style.display = "flex";
|
||||
anchorRow.style.alignItems = "center";
|
||||
anchorRow.style.gap = "8px";
|
||||
anchorRow.style.marginTop = "8px";
|
||||
|
||||
const anchorCb = ownerDoc.createElement("input");
|
||||
anchorCb.type = "checkbox";
|
||||
anchorCb.checked = anchorTo100;
|
||||
anchorCb.setAttribute("aria-label", t("UIFM_ANCHOR_DESC"));
|
||||
anchorCb.addEventListener("change", () => {
|
||||
anchorTo100 = anchorCb.checked;
|
||||
});
|
||||
|
||||
const anchorText = ownerDoc.createElement("span");
|
||||
anchorText.textContent = t("UIFM_ANCHOR");
|
||||
|
||||
anchorRow.appendChild(anchorCb);
|
||||
anchorRow.appendChild(anchorText);
|
||||
wrapper.appendChild(anchorRow);
|
||||
|
||||
if (frameNameIsValid) {
|
||||
const frameRow = ownerDoc.createElement("label");
|
||||
frameRow.style.display = "flex";
|
||||
frameRow.style.alignItems = "center";
|
||||
frameRow.style.gap = "8px";
|
||||
frameRow.style.marginTop = "8px";
|
||||
|
||||
const frameCb = ownerDoc.createElement("input");
|
||||
frameCb.type = "checkbox";
|
||||
frameCb.checked = copyFrameLinkByName;
|
||||
frameCb.setAttribute("aria-label", t("FRAME_WITH_NAME"));
|
||||
frameCb.addEventListener("change", () => {
|
||||
copyFrameLinkByName = frameCb.checked;
|
||||
});
|
||||
|
||||
const frameText = ownerDoc.createElement("span");
|
||||
frameText.textContent = t("FRAME_WITH_NAME");
|
||||
|
||||
frameRow.appendChild(frameCb);
|
||||
frameRow.appendChild(frameText);
|
||||
wrapper.appendChild(frameRow);
|
||||
}
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
const changed =
|
||||
view.plugin.settings.copyLinkToElemenetAnchorTo100 !== anchorTo100 ||
|
||||
view.plugin.settings.copyFrameLinkByName !== copyFrameLinkByName;
|
||||
|
||||
if (changed) {
|
||||
await view.plugin.loadSettings();
|
||||
view.plugin.settings.copyLinkToElemenetAnchorTo100 = anchorTo100;
|
||||
view.plugin.settings.copyFrameLinkByName = copyFrameLinkByName;
|
||||
await view.plugin.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((alias === "" || alias == null) && anchorTo100) {
|
||||
alias = "100%";
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(
|
||||
`${prefix.length > 0 ? "!" : ""}[[${view.file.path}#^${prefix}${elementId}${alias ? `|${alias}` : ``}]]`,
|
||||
);
|
||||
new Notice(t("INSERT_LINK_TO_ELEMENT_READY"));
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||
/*
|
||||
Obsidian uses a slightly modified version of the hypermd parser for math blocks
|
||||
found at https://github.com/laobubu/HyperMD/blob/071ce236605bb7693efa6d4b829c39413a3d37fb/src/mode/hypermd.ts#L329-L336
|
||||
where spaces are replaced with `_` and the mathlevel of 1|2 is replaced with `math-block` for display math and nothing for inline math
|
||||
create from the following grammar (where we remove the upper-cases):
|
||||
@top Document { Formatting_formatting-math_formatting-math-begin_keyword_math_math-block Math Formatting_formatting-math_formatting-math-end_keyword_math_math- }
|
||||
|
||||
Formatting_formatting-math_formatting-math-begin_keyword_math_math-block { "" }
|
||||
Math { any* }
|
||||
Formatting_formatting-math_formatting-math-end_keyword_math_math- { "" }
|
||||
|
||||
@tokens {
|
||||
any { _ }
|
||||
}
|
||||
*/
|
||||
import {LRParser} from "@lezer/lr"
|
||||
export const parser = LRParser.deserialize({
|
||||
version: 14,
|
||||
states: "zOOOO?MrOOQOPOOOOOO'#Ca'#CaOYOPO'#C_OOOO?MtOOOOO-E6_-E6_QOOOOO",
|
||||
stateData: "b~OVQOURP~OVQOURX~O",
|
||||
goto: "fUPPVY]`RPORSPRUSQRPRTR",
|
||||
nodeNames: "⚠ Document formatting_formatting-math_formatting-math-begin_keyword_math_math-block math formatting_formatting-math_formatting-math-end_keyword_math_math-",
|
||||
maxTerm: 7,
|
||||
skippedNodes: [0],
|
||||
repeatNodeCount: 1,
|
||||
tokenData: "i~RRO;'S[;'S;=`a;=`O[~aOV~~fPV~;=`<%l[",
|
||||
tokenizers: [0],
|
||||
topRules: {"Document":[0,1]},
|
||||
tokenPrec: 0
|
||||
})
|
||||
@@ -2,7 +2,7 @@
|
||||
//https://img.youtube.com/vi/uZz5MgzWXiM/maxresdefault.jpg
|
||||
|
||||
import { ExcalidrawElement, FileId } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { BinaryFileData, DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { App, MarkdownRenderer, Notice, TFile } from "obsidian";
|
||||
import {
|
||||
DEFAULT_MD_EMBED_CSS,
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
} from "../constants/constants";
|
||||
import { createSVG } from "src/utils/excalidrawAutomateUtils";
|
||||
import { ExcalidrawData, getTransclusion } from "./ExcalidrawData";
|
||||
import { ExportSettings } from "../view/ExcalidrawView";
|
||||
import { t } from "../lang/helpers";
|
||||
import { tex2dataURL } from "./LaTeX";
|
||||
import ExcalidrawPlugin from "../core/main";
|
||||
@@ -39,11 +38,12 @@ import {
|
||||
promiseTry,
|
||||
PromisePool,
|
||||
} from "../utils/utils";
|
||||
import { ValueOf } from "../types/types";
|
||||
import { getMermaidImageElements, getMermaidText, shouldRenderMermaid } from "../utils/mermaidUtils";
|
||||
import { mermaidToExcalidraw } from "src/constants/constants";
|
||||
import { ImageKey, imageCache } from "./ImageCache";
|
||||
import { FILENAMEPARTS, PreviewImageType } from "../types/utilTypes";
|
||||
import { ColorMap, ImgData, PDFPageViewProps, Size, MimeType, FileData } from "src/types/embeddedFileLoaderTypes";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
|
||||
//An ugly workaround for the following situation.
|
||||
//File A is a markdown file that has an embedded Excalidraw file B
|
||||
@@ -54,54 +54,7 @@ import { FILENAMEPARTS, PreviewImageType } from "../types/utilTypes";
|
||||
//and getObsidianImage is aborted if the file is already in the Watchdog stack
|
||||
const markdownRendererRecursionWatcthdog = new Set<TFile>();
|
||||
|
||||
export const IMAGE_MIME_TYPES = {
|
||||
svg: "image/svg+xml",
|
||||
png: "image/png",
|
||||
jpg: "image/jpeg",
|
||||
jpeg: "image/jpeg",
|
||||
gif: "image/gif",
|
||||
webp: "image/webp",
|
||||
bmp: "image/bmp",
|
||||
ico: "image/x-icon",
|
||||
avif: "image/avif",
|
||||
jfif: "image/jfif",
|
||||
} as const;
|
||||
|
||||
type ImgData = {
|
||||
mimeType: MimeType;
|
||||
fileId: FileId;
|
||||
dataURL: DataURL;
|
||||
created: number;
|
||||
hasSVGwithBitmap: boolean;
|
||||
size: Size;
|
||||
pdfPageViewProps?: PDFPageViewProps;
|
||||
};
|
||||
|
||||
export declare type MimeType = ValueOf<typeof IMAGE_MIME_TYPES> | "application/octet-stream";
|
||||
|
||||
export type FileData = BinaryFileData & {
|
||||
size: Size;
|
||||
hasSVGwithBitmap: boolean;
|
||||
shouldScale: boolean; //true if image should maintain its area, false if image should display at 100% its size
|
||||
pdfPageViewProps?: PDFPageViewProps;
|
||||
};
|
||||
|
||||
export type PDFPageViewProps = {
|
||||
left: number;
|
||||
bottom: number;
|
||||
right: number;
|
||||
top: number;
|
||||
rotate?: number; //may be undefined in legacy files
|
||||
}
|
||||
|
||||
export type Size = {
|
||||
height: number;
|
||||
width: number;
|
||||
};
|
||||
|
||||
export interface ColorMap {
|
||||
[color: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function takes an SVG and replaces all fill and stroke colors with the ones in the colorMap
|
||||
@@ -789,6 +742,10 @@ export class EmbeddedFilesLoader {
|
||||
}
|
||||
|
||||
const addFilesTimer = setInterval(() => {
|
||||
if (this.terminate) {
|
||||
clearInterval(addFilesTimer);
|
||||
return;
|
||||
}
|
||||
if(files[batch].length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ import {
|
||||
ExcalidrawFrameElement,
|
||||
ExcalidrawTextContainer,
|
||||
} from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { ColorMap, MimeType } from "./EmbeddedFileLoader";
|
||||
import { ColorMap, MimeType } from "../types/embeddedFileLoaderTypes";
|
||||
import { Editor, Notice, OpenViewState, RequestUrlResponse, TFile, TFolder, WorkspaceLeaf } from "obsidian";
|
||||
import * as obsidian_module from "obsidian";
|
||||
import ExcalidrawView, { ExportSettings, TextMode } from "src/view/ExcalidrawView";
|
||||
import ExcalidrawView, { TextMode } from "src/view/ExcalidrawView";
|
||||
import { ExcalidrawData, getMarkdownDrawingSection } from "./ExcalidrawData";
|
||||
import {
|
||||
FRONTMATTER,
|
||||
@@ -72,24 +72,27 @@ import { Mutable } from "@zsviczian/excalidraw/types/common/src/utility-types";
|
||||
import PolyBool from "polybooljs";
|
||||
import { EmbeddableMDCustomProps } from "./Dialogs/EmbeddableSettings";
|
||||
import {
|
||||
AIRequest,
|
||||
postOpenAI as _postOpenAI,
|
||||
extractCodeBlocks as _extractCodeBlocks,
|
||||
} from "../utils/AIUtils";
|
||||
import { EXCALIDRAW_AUTOMATE_INFO, EXCALIDRAW_SCRIPTENGINE_INFO } from "./Dialogs/SuggesterInfo";
|
||||
import { addBackOfTheNoteCard } from "../utils/excalidrawViewUtils";
|
||||
import { addBackOfTheNoteCard, sceneRemoveInternalLinks } from "../utils/excalidrawViewUtils";
|
||||
import { log } from "../utils/debugHelper";
|
||||
import { ExcalidrawLib } from "../types/excalidrawLib";
|
||||
import { GlobalPoint } from "@zsviczian/excalidraw/types/math/src/types";
|
||||
import { AddImageOptions, ImageInfo, SVGColorInfo } from "src/types/excalidrawAutomateTypes";
|
||||
import { _measureText, cloneElement, createPNG, createSVG, errorMessage, filterColorMap, getEmbeddedFileForImageElment, getFontFamily, getLineBox, getTemplate, isColorStringTransparent, isSVGColorInfo, mergeColorMapIntoSVGColorInfo, normalizeLinePoints, repositionElementsToCursor, svgColorInfoToColorMap, updateOrAddSVGColorInfo, verifyMinimumPluginVersion } from "src/utils/excalidrawAutomateUtils";
|
||||
import { exportToPDF, getMarginValue, getPageDimensions, PageDimensions, PageOrientation, PageSize, PDFExportScale, PDFPageProperties } from "src/utils/exportUtils";
|
||||
import { AddImageOptions, ImageInfo, ScriptSettingValue, SVGColorInfo } from "src/types/excalidrawAutomateTypes";
|
||||
import { _measureText, cloneElement, createPNG, createSVG, ensureActiveScriptSettingsObject, errorMessage, filterColorMap, getEmbeddedFileForImageElment, getFontFamily, getLastActiveExcalidrawView, getLineBox, getTemplate, isColorStringTransparent, isSVGColorInfo, mergeColorMapIntoSVGColorInfo, normalizeBindMode, normalizeFixedPoint, normalizeLinePoints, repositionElementsToCursor, svgColorInfoToColorMap, updateOrAddSVGColorInfo, verifyMinimumPluginVersion } from "src/utils/excalidrawAutomateUtils";
|
||||
import { exportToPDF, getMarginValue, getPageDimensions } from "src/utils/exportUtils";
|
||||
import { PageDimensions, PageOrientation, PageSize, PDFExportScale, PDFPageProperties, ExportSettings} from "src/types/exportUtilTypes";
|
||||
import { FrameRenderingOptions } from "src/types/utilTypes";
|
||||
import { CaptureUpdateAction } from "src/constants/constants";
|
||||
import { AutoexportConfig } from "src/types/excalidrawViewTypes";
|
||||
import { FloatingModal } from "./Dialogs/FloatingModal";
|
||||
import { patchMobileView } from "src/utils/customEmbeddableUtils";
|
||||
import { ObsidianCanvasNode } from "src/view/managers/CanvasNodeFactory";
|
||||
import { AIRequest } from "src/types/AIUtilTypes";
|
||||
import { arrow, end } from "@popperjs/core";
|
||||
import { start } from "repl";
|
||||
|
||||
extendPlugins([
|
||||
HarmonyPlugin,
|
||||
@@ -146,7 +149,8 @@ const GAP = 4;
|
||||
* you may access this object via the variable `ea`. e.g. ea.addImage(); This ea object is already set to the targetView.
|
||||
* Through ea.obsidian all of the Obsidian API is available to the script. Thus you can create modal views, open files, etc.
|
||||
* You can access Obsidian type definitions here: https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts
|
||||
* In addition to the ea object, the script also receives the `utils` object. utils includes to utility functions: suggester and inputPrompt
|
||||
* In addition to the ea instance, the script also receives the `utils` object. utils includes to utility functions: suggester and inputPrompt.
|
||||
* You may access these via the variable `utils`. e.g. utils.suggester(...);
|
||||
* - inputPrompt(inputPrompt: (
|
||||
* header: string,
|
||||
* placeholder?: string,
|
||||
@@ -763,6 +767,56 @@ export class ExcalidrawAutomate {
|
||||
return this.elementsDict[id];
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an object describing the bound text element.
|
||||
* If a text element is provided:
|
||||
* - returns { eaElement } if the element is in ea.elementsDict
|
||||
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
|
||||
* If a container element is provided, searches for the bound text element:
|
||||
* - returns { eaElement } if found in ea.elementsDict
|
||||
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
|
||||
* If not found, returns {}.
|
||||
* Does not add the text element to elementsDict.
|
||||
* @param element
|
||||
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
|
||||
* @returns Object containing either eaElement or sceneElement or empty if not found.
|
||||
*/
|
||||
getBoundTextElement(element: ExcalidrawElement, searchInView: boolean = false): {
|
||||
eaElement?: Mutable<ExcalidrawTextElement>,
|
||||
sceneElement?: ExcalidrawTextElement
|
||||
} {
|
||||
if(element.type === "text") {
|
||||
if(element.id in this.elementsDict) {
|
||||
return {eaElement: element as Mutable<ExcalidrawTextElement>};
|
||||
}
|
||||
|
||||
if (searchInView && this.targetView && this.targetView._loaded) {
|
||||
const viewElements = this.getViewElements();
|
||||
const ve = viewElements.find((e) => e.id === element.id);
|
||||
if(ve) {
|
||||
return {
|
||||
sceneElement: ve as ExcalidrawTextElement
|
||||
};
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
const boundElement = element.boundElements?.find((be) => be.type === "text");
|
||||
if (!boundElement) {
|
||||
return {};
|
||||
}
|
||||
let textElement = this.elementsDict[boundElement.id] as Mutable<ExcalidrawTextElement>;
|
||||
if (textElement) {
|
||||
return {eaElement: textElement};
|
||||
}
|
||||
if (!textElement && searchInView && this.targetView && this.targetView._loaded) {
|
||||
const viewElements = this.getViewElements();
|
||||
const ve = viewElements.find((e) => e.id === boundElement.id);
|
||||
return {sceneElement: ve as ExcalidrawTextElement};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a drawing and saves it to the specified filename.
|
||||
* @param {Object} [params] - Parameters for creating the drawing.
|
||||
@@ -797,6 +851,7 @@ export class ExcalidrawAutomate {
|
||||
"excalidraw-autoexport"?: boolean;
|
||||
"excalidraw-mask"?: boolean;
|
||||
"excalidraw-open-md"?: boolean;
|
||||
"excalidraw-export-internal-links"?: boolean;
|
||||
"cssclasses"?: string;
|
||||
};
|
||||
plaintext?: string; //text to insert above the `# Text Elements` section
|
||||
@@ -1097,6 +1152,11 @@ export class ExcalidrawAutomate {
|
||||
if(elementsOverride) {
|
||||
scene.elements = elementsOverride;
|
||||
}
|
||||
|
||||
if(!view.getViewExportIncludeInternalLinks()) {
|
||||
scene.elements = sceneRemoveInternalLinks(scene);
|
||||
}
|
||||
|
||||
const exportSettings: ExportSettings = {
|
||||
withBackground: view.getViewExportWithBackground(withBackground),
|
||||
withTheme: true,
|
||||
@@ -1139,6 +1199,8 @@ export class ExcalidrawAutomate {
|
||||
loader?: EmbeddedFilesLoader,
|
||||
theme?: string,
|
||||
padding?: number,
|
||||
convertMarkdownLinksToObsidianURLs: boolean = false,
|
||||
includeInternalLinks: boolean = true,
|
||||
): Promise<SVGSVGElement> {
|
||||
if (!theme) {
|
||||
theme = this.plugin.settings.previewMatchObsidianTheme
|
||||
@@ -1176,7 +1238,9 @@ export class ExcalidrawAutomate {
|
||||
this.plugin,
|
||||
0,
|
||||
padding,
|
||||
this.imagesDict
|
||||
this.imagesDict,
|
||||
convertMarkdownLinksToObsidianURLs,
|
||||
includeInternalLinks,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1270,6 +1334,36 @@ export class ExcalidrawAutomate {
|
||||
return wrapTextAtCharLength(text, lineLen, this.plugin.settings.forceWrap);
|
||||
};
|
||||
|
||||
/** ROUNDNESS as defined in the Excalidraw packages/common/src/constants.ts
|
||||
* Radius represented as 25% of element's largest side (width/height).
|
||||
* Used for LEGACY and PROPORTIONAL_RADIUS algorithms, or when the element is
|
||||
* below the cutoff size.
|
||||
* export const DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
||||
*
|
||||
* Fixed radius for the ADAPTIVE_RADIUS algorithm. In pixels.
|
||||
* export const DEFAULT_ADAPTIVE_RADIUS = 32;
|
||||
*
|
||||
* roundness type (algorithm)
|
||||
* export const ROUNDNESS = {
|
||||
* Used for legacy rounding (rectangles), which currently works the same
|
||||
* as PROPORTIONAL_RADIUS, but we need to differentiate for UI purposes and
|
||||
* forwards-compat.
|
||||
* LEGACY: 1,
|
||||
*
|
||||
* Used for linear elements & diamonds
|
||||
* PROPORTIONAL_RADIUS: 2,
|
||||
*
|
||||
* Current default algorithm for rectangles, using fixed pixel radius.
|
||||
* It's working similarly to a regular border-radius, but attemps to make
|
||||
* radius visually similar across differnt element sizes, especially
|
||||
* very large and very small elements.
|
||||
*
|
||||
* NOTE right now we don't allow configuration and use a constant radius
|
||||
* (see DEFAULT_ADAPTIVE_RADIUS constant)
|
||||
* ADAPTIVE_RADIUS: 3,
|
||||
* } as const;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility function. Returns an element object using style settings and provided parameters.
|
||||
* @param {string} id - The element ID.
|
||||
@@ -1754,6 +1848,17 @@ export class ExcalidrawAutomate {
|
||||
* @param {"arrow"|"bar"|"circle"|"circle_outline"|"triangle"|"triangle_outline"|"diamond"|"diamond_outline"|null} [formatting.endArrowHead] - The end arrowhead type.
|
||||
* @param {string} [formatting.startObjectId] - The ID of the start object.
|
||||
* @param {string} [formatting.endObjectId] - The ID of the end object.
|
||||
* BindMode Determines whether the arrow remains outside the shape or is allowed to
|
||||
* go all the way inside the shape up to the exact fixed point.
|
||||
* @param {"inside" | "orbit"} [formatting.startBindMode] - The binding mode for the start object.
|
||||
* @param {"inside" | "orbit"} [formatting.endBindMode] - The binding mode for the end object.
|
||||
* FixedPoint represents the fixed point binding information in form of a vertical and
|
||||
* horizontal ratio (i.e. a percentage value in the 0.0-1.0 range). This ratio
|
||||
* gives the user selected fixed point by multiplying the bound element width
|
||||
* with fixedPoint[0] and the bound element height with fixedPoint[1] to get the
|
||||
* bound element-local point coordinate.
|
||||
* @param {[number, number]} [formatting.startFixedPoint] - The fixed point for the start object.
|
||||
* @param {[number, number]} [formatting.endFixedPoint] - The fixed point for the end object.
|
||||
* @param {string} [id] - The ID of the arrow element.
|
||||
* @returns {string} The ID of the added arrow element.
|
||||
*/
|
||||
@@ -1764,32 +1869,40 @@ export class ExcalidrawAutomate {
|
||||
endArrowHead?: "arrow"|"bar"|"circle"|"circle_outline"|"triangle"|"triangle_outline"|"diamond"|"diamond_outline"|null;
|
||||
startObjectId?: string;
|
||||
endObjectId?: string;
|
||||
startBindMode?: "inside" | "orbit";
|
||||
endBindMode?: "inside" | "orbit";
|
||||
startFixedPoint?: [number, number];
|
||||
endFixedPoint?: [number, number];
|
||||
elbowed?: boolean;
|
||||
},
|
||||
id?: string,
|
||||
): string {
|
||||
const startFixedPoint = normalizeFixedPoint(formatting?.startFixedPoint);
|
||||
const endFixedPoint = normalizeFixedPoint(formatting?.endFixedPoint);
|
||||
const startMode = normalizeBindMode(formatting?.startBindMode);
|
||||
const endMode = normalizeBindMode(formatting?.endBindMode);
|
||||
const box = getLineBox(points);
|
||||
const elbowed = formatting?.elbowed ?? false;
|
||||
const startElement = formatting?.startObjectId
|
||||
? this.getElement(formatting.startObjectId) as Mutable<ExcalidrawBindableElement>
|
||||
: null;
|
||||
const endElement = formatting?.endObjectId
|
||||
? this.getElement(formatting.endObjectId) as Mutable<ExcalidrawBindableElement>
|
||||
: null;
|
||||
id = id ?? nanoid();
|
||||
const startPoint = points[0] as GlobalPoint;
|
||||
const endPoint = points[points.length - 1] as GlobalPoint;
|
||||
const elementsMap = arrayToMap(this.getElements());
|
||||
this.elementsDict[id] = {
|
||||
points: normalizeLinePoints(points),
|
||||
elbowed,
|
||||
lastCommittedPoint: null,
|
||||
startBinding: {
|
||||
elementId: formatting?.startObjectId,
|
||||
mode: "orbit",
|
||||
fixedPoint: [
|
||||
1,
|
||||
1
|
||||
]
|
||||
mode: startMode,
|
||||
fixedPoint: startFixedPoint,
|
||||
},
|
||||
endBinding: {
|
||||
elementId: formatting?.endObjectId,
|
||||
mode: "orbit",
|
||||
fixedPoint: [
|
||||
0,
|
||||
0
|
||||
]
|
||||
mode: endMode,
|
||||
fixedPoint: endFixedPoint,
|
||||
},
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/388
|
||||
startArrowhead:
|
||||
@@ -1802,20 +1915,20 @@ export class ExcalidrawAutomate {
|
||||
: this.style.endArrowHead,
|
||||
...this.boxedElement(id, "arrow", points[0][0], points[0][1], box.w, box.h),
|
||||
};
|
||||
if (formatting?.startObjectId) {
|
||||
if (!this.elementsDict[formatting.startObjectId].boundElements) {
|
||||
this.elementsDict[formatting.startObjectId].boundElements = [];
|
||||
if (startElement) {
|
||||
if (!startElement.boundElements) {
|
||||
startElement.boundElements = [];
|
||||
}
|
||||
this.elementsDict[formatting.startObjectId].boundElements.push({
|
||||
(startElement.boundElements as Mutable<ExcalidrawElement["boundElements"]>).push({
|
||||
type: "arrow",
|
||||
id,
|
||||
});
|
||||
}
|
||||
if (formatting?.endObjectId) {
|
||||
if (!this.elementsDict[formatting.endObjectId].boundElements) {
|
||||
this.elementsDict[formatting.endObjectId].boundElements = [];
|
||||
if (endElement) {
|
||||
if (!endElement.boundElements) {
|
||||
endElement.boundElements = [];
|
||||
}
|
||||
this.elementsDict[formatting.endObjectId].boundElements.push({
|
||||
(endElement.boundElements as Mutable<ExcalidrawElement["boundElements"]>).push({
|
||||
type: "arrow",
|
||||
id,
|
||||
});
|
||||
@@ -1968,6 +2081,9 @@ export class ExcalidrawAutomate {
|
||||
* @returns {Promise<string>} Promise resolving to the ID of the added LaTeX image element.
|
||||
*/
|
||||
async addLaTex(topX: number, topY: number, tex: string): Promise<string> {
|
||||
if (!tex){
|
||||
return null;
|
||||
}
|
||||
const id = nanoid();
|
||||
const image = await tex2dataURL(tex, 4, this.plugin);
|
||||
if (!image) {
|
||||
@@ -2215,35 +2331,72 @@ export class ExcalidrawAutomate {
|
||||
isExcalidrawFile(f: TFile): boolean {
|
||||
return this.plugin.isExcalidrawFile(f);
|
||||
};
|
||||
|
||||
targetView: ExcalidrawView = null; //the view currently edited
|
||||
/**
|
||||
* Sets the target view for EA. All the view operations and the access to Excalidraw API will be performed on this view.
|
||||
* If view is null or undefined, the function will first try setView("active"), then setView("first").
|
||||
* @param {ExcalidrawView | "first" | "active"} [view] - The view to set as target.
|
||||
* @returns {ExcalidrawView} The target view.
|
||||
* Sets the target view for EA. All view operations and all access to the Excalidraw API
|
||||
* will be performed on this view.
|
||||
*
|
||||
* Typical usage:
|
||||
* - `setView()` to pick a sensible default automatically
|
||||
* - `setView(excalidrawView)` to explicitly target a specific view
|
||||
*
|
||||
* Selectors:
|
||||
* - If `view` is `null` or `undefined` (or `"auto"`), EA will pick a sensible default:
|
||||
* 1) the currently active Excalidraw view (if any),
|
||||
* 2) otherwise the last active Excalidraw view (if it is still available),
|
||||
* 3) otherwise the `"first"` Excalidraw view in the workspace.
|
||||
* - If `show` is `true`, the view will be revealed (brought to front) and focused.
|
||||
*
|
||||
* Deprecated selectors (kept for backward compatibility):
|
||||
* - If `"active"` is provided, the currently active Excalidraw view will be used. If no
|
||||
* active Excalidraw view is available, the last active Excalidraw view will be used.
|
||||
* - If `"first"` is provided, the target will be the first Excalidraw view returned by
|
||||
* Obsidian's workspace leaf collection (i.e., the first item in the current
|
||||
* `getExcalidrawViews()` result). **This ordering is managed by Obsidian and does not
|
||||
* necessarily match what a user would consider the “first”/“leftmost”/“topmost” view;
|
||||
* from a user's perspective it may appear effectively random.**
|
||||
*
|
||||
* @param {ExcalidrawView | "auto" | "first" | "active" | null | undefined} [view] - The view (or selector) to set as target.
|
||||
* @param {boolean} [show=false] - Whether to reveal/focus the target view.
|
||||
* @returns {ExcalidrawView} The ExcalidrawView that was set as `targetView` (or `null` if none found).
|
||||
*/
|
||||
setView(view?: ExcalidrawView | "first" | "active"): ExcalidrawView {
|
||||
if(!view) {
|
||||
const v = this.plugin.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (v instanceof ExcalidrawView) {
|
||||
this.targetView = v;
|
||||
}
|
||||
else {
|
||||
this.targetView = getExcalidrawViews(this.plugin.app)[0];
|
||||
}
|
||||
}
|
||||
if (view == "active") {
|
||||
const v = this.plugin.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (!(v instanceof ExcalidrawView)) {
|
||||
setView(view?: ExcalidrawView | "auto" | "first" | "active" | null, show: boolean = false): ExcalidrawView {
|
||||
const app = this.plugin.app;
|
||||
const workspace = app.workspace;
|
||||
const setView = () => {
|
||||
if(!view || view === "auto") {
|
||||
view = workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (view instanceof ExcalidrawView) {
|
||||
this.targetView = view;
|
||||
return;
|
||||
}
|
||||
view = getLastActiveExcalidrawView(this.plugin);
|
||||
this.targetView = view ?? getExcalidrawViews(this.plugin.app)[0];
|
||||
return;
|
||||
}
|
||||
this.targetView = v;
|
||||
if (view == "active") {
|
||||
view = workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (view instanceof ExcalidrawView) {
|
||||
this.targetView = view;
|
||||
return;
|
||||
}
|
||||
this.targetView = getLastActiveExcalidrawView(this.plugin);
|
||||
return;
|
||||
}
|
||||
if (view == "first") {
|
||||
this.targetView = getExcalidrawViews(this.plugin.app)[0];
|
||||
return;
|
||||
}
|
||||
if (view instanceof ExcalidrawView) {
|
||||
this.targetView = view;
|
||||
}
|
||||
}
|
||||
if (view == "first") {
|
||||
this.targetView = getExcalidrawViews(this.plugin.app)[0];
|
||||
}
|
||||
if (view instanceof ExcalidrawView) {
|
||||
this.targetView = view;
|
||||
setView();
|
||||
if(show && this.targetView) {
|
||||
this.plugin.app.workspace.revealLeaf(
|
||||
this.targetView.leaf,
|
||||
);
|
||||
}
|
||||
return this.targetView;
|
||||
};
|
||||
@@ -3267,6 +3420,23 @@ export class ExcalidrawAutomate {
|
||||
await this.plugin.saveSettings();
|
||||
};
|
||||
|
||||
public setScriptSettingValue(key: string, value: ScriptSettingValue): void {
|
||||
const settings = ensureActiveScriptSettingsObject(this);
|
||||
if (!settings) return;
|
||||
settings[key] = value;
|
||||
}
|
||||
|
||||
public getScriptSettingValue(key: string, defaultValue: ScriptSettingValue): ScriptSettingValue {
|
||||
const settings = ensureActiveScriptSettingsObject(this);
|
||||
if (!settings) return defaultValue;
|
||||
return settings[key] ?? defaultValue;
|
||||
}
|
||||
|
||||
public async saveScriptSettings(): Promise<void> {
|
||||
ensureActiveScriptSettingsObject(this);
|
||||
await this.plugin.saveSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a file in a new workspace leaf or reuses an existing adjacent leaf depending on Excalidraw Plugin Settings.
|
||||
* @param {TFile} file - The file to open.
|
||||
|
||||
@@ -46,7 +46,8 @@ import {
|
||||
FileId,
|
||||
} from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { BinaryFiles, DataURL, SceneData } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { EmbeddedFile, MimeType } from "./EmbeddedFileLoader";
|
||||
import { EmbeddedFile } from "./EmbeddedFileLoader";
|
||||
import { MimeType } from "src/types/embeddedFileLoaderTypes";
|
||||
import { MultiOptionConfirmationPrompt } from "./Dialogs/Prompt";
|
||||
import { getMermaidImageElements, getMermaidText, shouldRenderMermaid } from "../utils/mermaidUtils";
|
||||
import { DEBUGGING, debug } from "../utils/debugHelper";
|
||||
@@ -581,6 +582,10 @@ export class ExcalidrawData {
|
||||
el.containerId = null;
|
||||
}
|
||||
|
||||
if (el.type === "text" && !el.originalText) {
|
||||
el.originalText = el.rawText ?? el.text ?? "";
|
||||
}
|
||||
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/494
|
||||
if (el.x === null) {
|
||||
el.x = 0;
|
||||
@@ -760,6 +765,27 @@ export class ExcalidrawData {
|
||||
|
||||
this.deletedElements = this.scene.elements.filter((el:ExcalidrawElement)=>el.isDeleted);
|
||||
this.scene.elements = this.scene.elements.filter((el:ExcalidrawElement)=>!el.isDeleted);
|
||||
|
||||
//once off migration of legacy scenes
|
||||
if(this.scene?.elements?.some((el:any)=>el.type==="iframe" && !el.customData)) {
|
||||
const prompt = new MultiOptionConfirmationPrompt(
|
||||
this.plugin,
|
||||
"This file contains embedded frames " +
|
||||
"which will be migrated to a newer version for compatibility with " +
|
||||
"<a href='https://excalidraw.com'>excalidraw.com</a>.<br>🔄 If you're using Obsidian on " +
|
||||
"multiple devices, you may proceed now, but please, before opening this " +
|
||||
"file on your other devices, update Excalidraw on those as well.<br>🔍 More info is available "+
|
||||
"<a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.9'>here</a>.<br>🌐 " +
|
||||
"<a href='https://translate.google.com/?sl=en&tl=zh-CN&text=This%20file%20contains%20embedded%20frames%20which%20will%20be%20migrated%20to%20a%20newer%20version%20for%20compatibility%20with%20excalidraw.com.%0A%0AIf%20you%27re%20using%20Obsidian%20on%20multiple%20devices%2C%20you%20may%20proceed%20now%2C%20but%20please%2C%20before%20opening%20this%20file%20on%20your%20other%20devices%2C%20update%20Excalidraw%20on%20those%20as%20well.%0A%0AMore%20info%20is%20available%20here%3A%20https%3A%2F%2Fgithub.com%2Fzsviczian%2Fobsidian-excalidraw-plugin%2Freleases%2Ftag%2F1.9.9%27%3Ehere%3C%2Fa%3E.&op=translate'>" +
|
||||
"Translate</a>.",
|
||||
);
|
||||
prompt.contentEl.focus();
|
||||
const confirmation = await prompt.waitForClose
|
||||
if(!confirmation) {
|
||||
throw new Error(ERROR_IFRAME_CONVERSION_CANCELED);
|
||||
}
|
||||
}
|
||||
this.initializeNonInitializedFields();
|
||||
|
||||
const timer = window.setTimeout(()=>{
|
||||
const notice = new Notice(t("FONT_LOAD_SLOW"),15000);
|
||||
@@ -802,27 +828,6 @@ export class ExcalidrawData {
|
||||
delete this.scene.appState.gridColor.MajorGridFrequency;
|
||||
}
|
||||
|
||||
//once off migration of legacy scenes
|
||||
if(this.scene?.elements?.some((el:any)=>el.type==="iframe" && !el.customData)) {
|
||||
const prompt = new MultiOptionConfirmationPrompt(
|
||||
this.plugin,
|
||||
"This file contains embedded frames " +
|
||||
"which will be migrated to a newer version for compatibility with " +
|
||||
"<a href='https://excalidraw.com'>excalidraw.com</a>.<br>🔄 If you're using Obsidian on " +
|
||||
"multiple devices, you may proceed now, but please, before opening this " +
|
||||
"file on your other devices, update Excalidraw on those as well.<br>🔍 More info is available "+
|
||||
"<a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.9'>here</a>.<br>🌐 " +
|
||||
"<a href='https://translate.google.com/?sl=en&tl=zh-CN&text=This%20file%20contains%20embedded%20frames%20which%20will%20be%20migrated%20to%20a%20newer%20version%20for%20compatibility%20with%20excalidraw.com.%0A%0AIf%20you%27re%20using%20Obsidian%20on%20multiple%20devices%2C%20you%20may%20proceed%20now%2C%20but%20please%2C%20before%20opening%20this%20file%20on%20your%20other%20devices%2C%20update%20Excalidraw%20on%20those%20as%20well.%0A%0AMore%20info%20is%20available%20here%3A%20https%3A%2F%2Fgithub.com%2Fzsviczian%2Fobsidian-excalidraw-plugin%2Freleases%2Ftag%2F1.9.9%27%3Ehere%3C%2Fa%3E.&op=translate'>" +
|
||||
"Translate</a>.",
|
||||
);
|
||||
prompt.contentEl.focus();
|
||||
const confirmation = await prompt.waitForClose
|
||||
if(!confirmation) {
|
||||
throw new Error(ERROR_IFRAME_CONVERSION_CANCELED);
|
||||
}
|
||||
}
|
||||
this.initializeNonInitializedFields();
|
||||
|
||||
data = data.substring(0, sceneJSONandPOS.pos);
|
||||
|
||||
//The Markdown # Text Elements take priority over the JSON text elements. Assuming the scenario in which the
|
||||
|
||||
@@ -55,6 +55,7 @@ class ImageCache {
|
||||
this.db = null;
|
||||
this.plugin = null;
|
||||
this.app = null;
|
||||
this.obsidanURLCache.forEach((url) => URL.revokeObjectURL(url));
|
||||
this.obsidanURLCache.clear();
|
||||
this.obsidanURLCache = null;
|
||||
}
|
||||
@@ -179,6 +180,10 @@ class ImageCache {
|
||||
const fileExists = files.some((f: TFile) => f.path === filepath);
|
||||
const file = fileExists ? files.find((f: TFile) => f.path === filepath) : null;
|
||||
if (isLegacyKey || !file || (file && (file.stat.mtime > cursor.value.mtime)) || (!cursor.value.blob && !cursor.value.svg)) {
|
||||
if(this.obsidanURLCache.has(key)) {
|
||||
URL.revokeObjectURL(this.obsidanURLCache.get(key));
|
||||
this.obsidanURLCache.delete(key);
|
||||
}
|
||||
deletePromises.push(
|
||||
new Promise<void>((innerResolve, innerReject) => {
|
||||
const deleteRequest = store.delete(cursor.primaryKey);
|
||||
@@ -368,6 +373,9 @@ class ImageCache {
|
||||
const key = getKey(key_);
|
||||
store.put(data, key);
|
||||
if(!Boolean(svg)) {
|
||||
if(this.obsidanURLCache.has(key) && this.obsidanURLCache.get(key) !== obsidianURL) {
|
||||
URL.revokeObjectURL(this.obsidanURLCache.get(key));
|
||||
}
|
||||
this.obsidanURLCache.set(key, obsidianURL);
|
||||
}
|
||||
}
|
||||
@@ -406,6 +414,9 @@ class ImageCache {
|
||||
return; // Database not initialized yet
|
||||
}
|
||||
|
||||
this.obsidanURLCache.forEach((url) => URL.revokeObjectURL(url));
|
||||
this.obsidanURLCache.clear();
|
||||
|
||||
return this.clear(this.cacheStoreName, "Image cache was cleared");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// LaTeX.ts
|
||||
import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import ExcalidrawView from "../view/ExcalidrawView";
|
||||
import { FileData, MimeType } from "./EmbeddedFileLoader";
|
||||
import { FileData, MimeType } from "src/types/embeddedFileLoaderTypes";
|
||||
import { FileId } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { ExcalidrawAutomate } from "../ExcalidrawAutomate";
|
||||
import {Notice, requestUrl} from "obsidian"
|
||||
import ExcalidrawPlugin from "../../core/main"
|
||||
import ExcalidrawView, { ExportSettings } from "../../view/ExcalidrawView"
|
||||
import FrontmatterEditor from "src/shared/Frontmatter";
|
||||
import { ExcalidrawElement } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { EmbeddedFilesLoader } from "../EmbeddedFileLoader";
|
||||
import { blobToBase64 } from "src/utils/fileUtils";
|
||||
import { getEA } from "src/core";
|
||||
import { log } from "src/utils/debugHelper";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
|
||||
const TASKBONE_URL = "https://api.taskbone.com/"; //"https://excalidraw-preview.onrender.com/";
|
||||
const TASKBONE_OCR_FN = "execute?id=60f394af-85f6-40bc-9613-5d26dc283cbb";
|
||||
|
||||
@@ -14,7 +14,7 @@ import { splitFolderAndFilename } from "../utils/fileUtils";
|
||||
import { getEA } from "src/core";
|
||||
import { ExcalidrawAutomate } from "../shared/ExcalidrawAutomate";
|
||||
import { WeakArray } from "./WeakArray";
|
||||
import { getExcalidrawViews } from "../utils/obsidianUtils";
|
||||
import { getExcalidrawViews, stripYamlFrontmatter } from "../utils/obsidianUtils";
|
||||
import { ButtonDefinition, InputPromptOptions } from "src/types/promptTypes";
|
||||
|
||||
export type ScriptIconMap = {
|
||||
@@ -211,9 +211,8 @@ export class ScriptEngine {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if (view) {
|
||||
(async()=>{
|
||||
const script = await this.app.vault.read(f);
|
||||
const script = stripYamlFrontmatter(await this.app.vault.read(f));
|
||||
if(script) {
|
||||
//remove YAML frontmatter if present
|
||||
this.executeScript(view, script, scriptName,f);
|
||||
}
|
||||
})()
|
||||
@@ -260,7 +259,7 @@ export class ScriptEngine {
|
||||
await view.save(false, true);
|
||||
}
|
||||
|
||||
script = script.replace(/^---.*?---\n/gs, "");
|
||||
script = stripYamlFrontmatter(script);
|
||||
const ea = getEA(view);
|
||||
this.eaInstances.push(ea);
|
||||
ea.activeScript = title;
|
||||
|
||||
@@ -17,6 +17,8 @@ export class FileSuggestionModal extends SuggestionModal<LinkSuggestion> {
|
||||
cache: CachedMetadata;
|
||||
filesAndAliases: LinkSuggestion[];
|
||||
file: TFile;
|
||||
private handleGetFile: () => void;
|
||||
|
||||
constructor(app: App, input: TextComponent, items: TFile[], private plugin: ExcalidrawPlugin) {
|
||||
const filesAndAliases = [];
|
||||
for (const file of items) {
|
||||
@@ -36,7 +38,11 @@ export class FileSuggestionModal extends SuggestionModal<LinkSuggestion> {
|
||||
this.text = input;
|
||||
this.suggestEl.style.maxWidth = "100%";
|
||||
this.suggestEl.style.width = `${input.inputEl.clientWidth}px`;
|
||||
this.inputEl.addEventListener("input", () => this.getFile());
|
||||
|
||||
// Pre-bind the handler
|
||||
this.handleGetFile = this.getFile.bind(this);
|
||||
this.inputEl.addEventListener("input", this.handleGetFile);
|
||||
|
||||
this.setPlaceholder(t("SELECT_FILE_TO_INSERT"));
|
||||
this.emptyStateText = t("NO_MATCH");
|
||||
}
|
||||
@@ -139,4 +145,9 @@ export class FileSuggestionModal extends SuggestionModal<LinkSuggestion> {
|
||||
getItems() {
|
||||
return this.filesAndAliases;
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.inputEl.removeEventListener("input", this.handleGetFile);
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,16 @@ export class FolderSuggestionModal extends SuggestionModal<TFolder> {
|
||||
cache: CachedMetadata;
|
||||
folders: TFolder[];
|
||||
folder: TFolder;
|
||||
private handleGetFolder: () => void;
|
||||
|
||||
constructor(app: App, input: TextComponent, items: TFolder[]) {
|
||||
super(app, input.inputEl, items);
|
||||
this.folders = [...items];
|
||||
this.text = input;
|
||||
|
||||
this.inputEl.addEventListener("input", () => this.getFolder());
|
||||
// Pre-bind the handler
|
||||
this.handleGetFolder = this.getFolder.bind(this);
|
||||
this.inputEl.addEventListener("input", this.handleGetFolder);
|
||||
}
|
||||
getFolder() {
|
||||
const v = this.inputEl.value;
|
||||
@@ -32,6 +36,10 @@ export class FolderSuggestionModal extends SuggestionModal<TFolder> {
|
||||
|
||||
this.onInputChanged();
|
||||
}
|
||||
close(): void {
|
||||
this.inputEl.removeEventListener("input", this.handleGetFolder);
|
||||
super.close();
|
||||
}
|
||||
getItemText(item: TFolder) {
|
||||
return item.path;
|
||||
}
|
||||
|
||||
@@ -16,13 +16,16 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
files: TFile[];
|
||||
text: TextComponent;
|
||||
cache: CachedMetadata;
|
||||
private handleGetFile: () => void;
|
||||
|
||||
constructor(app: App, input: TextComponent, items: TFile[]) {
|
||||
super(app, input.inputEl, items);
|
||||
this.files = [...items];
|
||||
this.text = input;
|
||||
//this.getFile();
|
||||
|
||||
this.inputEl.addEventListener("input", this.getFile.bind(this));
|
||||
// Pre-bind the handler
|
||||
this.handleGetFile = this.getFile.bind(this);
|
||||
this.inputEl.addEventListener("input", this.handleGetFile);
|
||||
}
|
||||
|
||||
getFile() {
|
||||
@@ -40,6 +43,12 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
}
|
||||
this.onInputChanged();
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.inputEl.removeEventListener("input", this.handleGetFile);
|
||||
super.close();
|
||||
}
|
||||
|
||||
getItemText(item: TFile | HeadingCache | BlockCache) {
|
||||
if (item instanceof TFile) {
|
||||
return item.path;
|
||||
@@ -51,6 +60,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
return (<BlockCache>item).id;
|
||||
}
|
||||
}
|
||||
|
||||
onChooseItem(item: TFile | HeadingCache | BlockCache) {
|
||||
if (item instanceof TFile) {
|
||||
this.text.setValue(item.basename);
|
||||
@@ -64,6 +74,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
this.text.setValue(`${this.file.basename}^${(<BlockCache>item).id}`);
|
||||
}
|
||||
}
|
||||
|
||||
selectSuggestion({ item }: FuzzyMatch<TFile | BlockCache | HeadingCache>) {
|
||||
let link: string;
|
||||
if (item instanceof TFile) {
|
||||
@@ -79,6 +90,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
|
||||
this.close();
|
||||
}
|
||||
|
||||
renderSuggestion(
|
||||
result: FuzzyMatch<TFile | BlockCache | HeadingCache>,
|
||||
el: HTMLElement,
|
||||
@@ -131,6 +143,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
content.setText((<BlockCache>item).id);
|
||||
}
|
||||
}
|
||||
|
||||
get headings() {
|
||||
if (!this.file) {
|
||||
return [];
|
||||
@@ -140,6 +153,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
}
|
||||
return this.cache.headings || [];
|
||||
}
|
||||
|
||||
get blocks() {
|
||||
if (!this.file) {
|
||||
return [];
|
||||
@@ -149,6 +163,7 @@ export class PathSuggestionModal extends SuggestionModal<
|
||||
}
|
||||
return Object.values(this.cache.blocks || {}) || [];
|
||||
}
|
||||
|
||||
getItems() {
|
||||
const v = this.inputEl.value;
|
||||
if (/#/.test(v)) {
|
||||
|
||||
@@ -19,24 +19,34 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
|
||||
emptyStateText: string = "No match found";
|
||||
limit: number = 100;
|
||||
shouldNotOpen: boolean;
|
||||
|
||||
// Pre-bound event handlers
|
||||
private handleInput: () => void;
|
||||
private handleFocus: () => void;
|
||||
private handleBlur: () => void;
|
||||
private handleMouseDown: (event: MouseEvent) => void;
|
||||
|
||||
constructor(app: App, inputEl: HTMLInputElement, items: T[]) {
|
||||
super(app);
|
||||
this.inputEl = inputEl;
|
||||
this.items = items;
|
||||
|
||||
// Pre-bind event handlers
|
||||
this.handleInput = this.onInputChanged.bind(this);
|
||||
this.handleFocus = this.onFocus.bind(this);
|
||||
this.handleBlur = this.close.bind(this);
|
||||
this.handleMouseDown = (event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
this.suggestEl = createDiv("suggestion-container");
|
||||
this.contentEl = this.suggestEl.createDiv("suggestion");
|
||||
this.suggester = new Suggester(this, this.contentEl, this.scope);
|
||||
this.scope.register([], "Escape", this.onEscape.bind(this));
|
||||
this.inputEl.addEventListener("input", this.onInputChanged.bind(this));
|
||||
this.inputEl.addEventListener("focus", this.onFocus.bind(this));
|
||||
this.inputEl.addEventListener("blur", this.close.bind(this));
|
||||
this.suggestEl.on(
|
||||
"mousedown",
|
||||
".suggestion-container",
|
||||
(event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
},
|
||||
);
|
||||
this.inputEl.addEventListener("input", this.handleInput);
|
||||
this.inputEl.addEventListener("focus", this.handleFocus);
|
||||
this.inputEl.addEventListener("blur", this.handleBlur);
|
||||
this.suggestEl.on("mousedown", ".suggestion-container", this.handleMouseDown);
|
||||
}
|
||||
|
||||
empty() {
|
||||
@@ -74,24 +84,27 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
|
||||
open(): void {
|
||||
// TODO: Figure out a better way to do this. Idea from Periodic Notes plugin
|
||||
this.app.keymap.pushScope(this.scope);
|
||||
this.inputEl.ownerDocument.body.appendChild(this.suggestEl);
|
||||
this.popper = new WeakRef(createPopper(this.inputEl, this.suggestEl, {
|
||||
placement: "bottom-start",
|
||||
modifiers: [
|
||||
{
|
||||
name: "offset",
|
||||
options: {
|
||||
offset: [0, 10],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "flip",
|
||||
options: {
|
||||
fallbackPlacements: ["top"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
//setTimeout(() => {
|
||||
const modal = this.inputEl.closest(".modal");
|
||||
const modalContainer =
|
||||
(this.inputEl.closest(".modal-container") as HTMLElement) ??
|
||||
(modal?.parentElement?.matches(".modal-container")
|
||||
? (modal.parentElement as HTMLElement)
|
||||
: null);
|
||||
|
||||
const host = modalContainer ?? this.inputEl.ownerDocument.body;
|
||||
|
||||
host.appendChild(this.suggestEl);
|
||||
|
||||
this.popper = new WeakRef(createPopper(this.inputEl, this.suggestEl, {
|
||||
placement: "bottom-start",
|
||||
strategy: host.matches(".modal-container") ? "absolute" : "fixed",
|
||||
modifiers: [
|
||||
{ name: "offset", options: { offset: [0, 10] } },
|
||||
{ name: "flip", options: { fallbackPlacements: ["top"] } },
|
||||
],
|
||||
}));
|
||||
//},50);
|
||||
}
|
||||
|
||||
onEscape(): void {
|
||||
@@ -106,9 +119,9 @@ export abstract class SuggestionModal<T> extends FuzzySuggestModal<T> {
|
||||
if (this.popper?.deref()) {
|
||||
this.popper.deref().destroy();
|
||||
}
|
||||
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.inputEl.removeEventListener("input", this.handleInput);
|
||||
this.inputEl.removeEventListener("focus", this.handleFocus);
|
||||
this.inputEl.removeEventListener("blur", this.handleBlur);
|
||||
this.suggestEl.detach();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
type MessageContent =
|
||||
| string
|
||||
| (string | { type: "image_url"; image_url: string })[];
|
||||
|
||||
export type GPTCompletionRequest = {
|
||||
model: string;
|
||||
messages?: {
|
||||
role?: "system" | "user" | "assistant" | "function";
|
||||
content?: MessageContent;
|
||||
name?: string | undefined;
|
||||
}[];
|
||||
functions?: any[] | undefined;
|
||||
function_call?: any | undefined;
|
||||
stream?: boolean | undefined;
|
||||
temperature?: number | undefined;
|
||||
top_p?: number | undefined;
|
||||
max_tokens?: number | undefined;
|
||||
n?: number | undefined;
|
||||
best_of?: number | undefined;
|
||||
frequency_penalty?: number | undefined;
|
||||
presence_penalty?: number | undefined;
|
||||
logit_bias?:
|
||||
| {
|
||||
[x: string]: number;
|
||||
}
|
||||
| undefined;
|
||||
stop?: (string[] | string) | undefined;
|
||||
size?: string;
|
||||
quality?: "standard" | "hd";
|
||||
prompt?: string;
|
||||
image?: string;
|
||||
mask?: string;
|
||||
};
|
||||
|
||||
export type AIRequest = {
|
||||
image?: string;
|
||||
text?: string;
|
||||
instruction?: string;
|
||||
systemPrompt?: string;
|
||||
imageGenerationProperties?: {
|
||||
size?: string; //depends on model
|
||||
quality?: "standard" | "hd"; //depends on model
|
||||
n?: number; //dall-e-3 only accepts 1
|
||||
mask?: string; //dall-e-2 only (image editing)
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
import { FileId } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { BinaryFileData, DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { ValueOf } from "../types/types";
|
||||
|
||||
export const IMAGE_MIME_TYPES = {
|
||||
svg: "image/svg+xml",
|
||||
png: "image/png",
|
||||
jpg: "image/jpeg",
|
||||
jpeg: "image/jpeg",
|
||||
gif: "image/gif",
|
||||
webp: "image/webp",
|
||||
bmp: "image/bmp",
|
||||
ico: "image/x-icon",
|
||||
avif: "image/avif",
|
||||
jfif: "image/jfif",
|
||||
} as const;
|
||||
|
||||
export type ImgData = {
|
||||
mimeType: MimeType;
|
||||
fileId: FileId;
|
||||
dataURL: DataURL;
|
||||
created: number;
|
||||
hasSVGwithBitmap: boolean;
|
||||
size: Size;
|
||||
pdfPageViewProps?: PDFPageViewProps;
|
||||
};
|
||||
|
||||
export declare type MimeType = ValueOf<typeof IMAGE_MIME_TYPES> | "application/octet-stream";
|
||||
|
||||
export type FileData = BinaryFileData & {
|
||||
size: Size;
|
||||
hasSVGwithBitmap: boolean;
|
||||
shouldScale: boolean; //true if image should maintain its area, false if image should display at 100% its size
|
||||
pdfPageViewProps?: PDFPageViewProps;
|
||||
};
|
||||
|
||||
export type PDFPageViewProps = {
|
||||
left: number;
|
||||
bottom: number;
|
||||
right: number;
|
||||
top: number;
|
||||
rotate?: number; //may be undefined in legacy files
|
||||
}
|
||||
|
||||
export type Size = {
|
||||
height: number;
|
||||
width: number;
|
||||
};
|
||||
|
||||
export interface ColorMap {
|
||||
[color: string]: string;
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { TFile } from "obsidian";
|
||||
import { FileId } from "src/core";
|
||||
import { ColorMap, MimeType, PDFPageViewProps, Size } from "src/shared/EmbeddedFileLoader";
|
||||
import { ColorMap, PDFPageViewProps, Size, MimeType } from "./embeddedFileLoaderTypes";
|
||||
|
||||
export type SVGColorInfo = Map<string, {
|
||||
mappedTo: string;
|
||||
@@ -9,6 +9,14 @@ export type SVGColorInfo = Map<string, {
|
||||
stroke: boolean;
|
||||
}>;
|
||||
|
||||
export type ScriptSettingValue = {
|
||||
value?:string | number | boolean,
|
||||
hidden?: boolean,
|
||||
description?: string,
|
||||
valueset?: string[],
|
||||
height?: number,
|
||||
};
|
||||
|
||||
export type ImageInfo = {
|
||||
mimeType: MimeType,
|
||||
id: FileId,
|
||||
|
||||
Vendored
-7
@@ -106,13 +106,6 @@ declare namespace ExcalidrawLib {
|
||||
},
|
||||
): { x: number; y: number };
|
||||
|
||||
/*function determineFocusDistance(
|
||||
element: ExcalidrawBindableElement,
|
||||
elementsMap: ElementsMap,
|
||||
a: GlobalPoint,
|
||||
b: GlobalPoint,
|
||||
): number;*/
|
||||
|
||||
function intersectElementWithLine(
|
||||
element: ExcalidrawBindableElement,
|
||||
a: GlobalPoint,
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { FrameRenderingOptions } from "./utilTypes";
|
||||
|
||||
export type PDFPageAlignment =
|
||||
| "center"
|
||||
| "top-left"
|
||||
| "top-center"
|
||||
| "top-right"
|
||||
| "bottom-left"
|
||||
| "bottom-center"
|
||||
| "bottom-right"
|
||||
| "center-left"
|
||||
| "center-right";
|
||||
export type PDFPageMarginString = "none" | "tiny" | "normal";
|
||||
|
||||
export interface PDFExportScale {
|
||||
fitToPage: number; // 0 means use zoom, >1 means fit to that many pages exactly
|
||||
zoom?: number;
|
||||
}
|
||||
|
||||
export interface PDFMargin {
|
||||
left: number;
|
||||
right: number;
|
||||
top: number;
|
||||
bottom: number;
|
||||
}
|
||||
|
||||
export interface PDFPageProperties {
|
||||
dimensions?: {width: number; height: number};
|
||||
backgroundColor?: string;
|
||||
margin: PDFMargin;
|
||||
alignment: PDFPageAlignment;
|
||||
}
|
||||
|
||||
export interface PageDimensions {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export type PageOrientation = "portrait" | "landscape";
|
||||
|
||||
// All dimensions in pixels (pt)
|
||||
export const STANDARD_PAGE_SIZES = {
|
||||
A0: { width: 3179.52, height: 4494.96 }, // 33.11 × 46.81 inches
|
||||
A1: { width: 2245.76, height: 3179.52 }, // 23.39 × 33.11 inches
|
||||
A2: { width: 1587.76, height: 2245.76 }, // 16.54 × 23.39 inches
|
||||
A3: { width: 1122.56, height: 1587.76 }, // 11.69 × 16.54 inches
|
||||
A4: { width: 794.56, height: 1122.56 }, // 8.27 × 11.69 inches
|
||||
A5: { width: 559.37, height: 794.56 }, // 5.83 × 8.27 inches
|
||||
A6: { width: 397.28, height: 559.37 }, // 4.13 × 5.83 inches
|
||||
Legal: { width: 816, height: 1344 }, // 8.5 × 14 inches
|
||||
Letter: { width: 816, height: 1056 }, // 8.5 × 11 inches
|
||||
Tabloid: { width: 1056, height: 1632 }, // 11 × 17 inches
|
||||
Ledger: { width: 1632, height: 1056 }, // 17 × 11 inches
|
||||
"HD Screen": { width: 1920, height: 1080 },// 16:9 aspect ratio
|
||||
"MATCH IMAGE": { width: 0, height: 0 }, // 0 means use the current screen size
|
||||
} as const;
|
||||
|
||||
export type PageSize = keyof typeof STANDARD_PAGE_SIZES;
|
||||
|
||||
export interface ExportSettings {
|
||||
withBackground: boolean;
|
||||
withTheme: boolean;
|
||||
isMask: boolean;
|
||||
frameRendering?: FrameRenderingOptions; //optional, overrides relevant appState settings for rendering the frame
|
||||
skipInliningFonts?: boolean;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export type ButtonDefinition = { caption: string; tooltip?:string; action: Function };
|
||||
export type ButtonDefinition = { caption: string; tooltip?:string; action: Function, iconId?: string };
|
||||
|
||||
export interface InputPromptOptions {
|
||||
header: string,
|
||||
|
||||
Vendored
+1
@@ -58,6 +58,7 @@ declare global {
|
||||
declare module "obsidian" {
|
||||
interface App {
|
||||
internalPlugins: any;
|
||||
setting: any;
|
||||
isMobile(): boolean;
|
||||
getObsidianUrl(file:TFile): string;
|
||||
metadataTypeManager: {
|
||||
|
||||
+4
-49
@@ -1,52 +1,6 @@
|
||||
import { Notice, RequestUrlResponse } from "obsidian";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
|
||||
type MessageContent =
|
||||
| string
|
||||
| (string | { type: "image_url"; image_url: string })[];
|
||||
|
||||
export type GPTCompletionRequest = {
|
||||
model: string;
|
||||
messages?: {
|
||||
role?: "system" | "user" | "assistant" | "function";
|
||||
content?: MessageContent;
|
||||
name?: string | undefined;
|
||||
}[];
|
||||
functions?: any[] | undefined;
|
||||
function_call?: any | undefined;
|
||||
stream?: boolean | undefined;
|
||||
temperature?: number | undefined;
|
||||
top_p?: number | undefined;
|
||||
max_tokens?: number | undefined;
|
||||
n?: number | undefined;
|
||||
best_of?: number | undefined;
|
||||
frequency_penalty?: number | undefined;
|
||||
presence_penalty?: number | undefined;
|
||||
logit_bias?:
|
||||
| {
|
||||
[x: string]: number;
|
||||
}
|
||||
| undefined;
|
||||
stop?: (string[] | string) | undefined;
|
||||
size?: string;
|
||||
quality?: "standard" | "hd";
|
||||
prompt?: string;
|
||||
image?: string;
|
||||
mask?: string;
|
||||
};
|
||||
|
||||
export type AIRequest = {
|
||||
image?: string;
|
||||
text?: string;
|
||||
instruction?: string;
|
||||
systemPrompt?: string;
|
||||
imageGenerationProperties?: {
|
||||
size?: string; //depends on model
|
||||
quality?: "standard" | "hd"; //depends on model
|
||||
n?: number; //dall-e-3 only accepts 1
|
||||
mask?: string; //dall-e-2 only (image editing)
|
||||
};
|
||||
};
|
||||
import { GPTCompletionRequest, AIRequest } from "src/types/AIUtilTypes";
|
||||
|
||||
const handleImageEditPrompt = async (request: AIRequest) : Promise<RequestUrlResponse> => {
|
||||
const plugin: ExcalidrawPlugin = window.ExcalidrawAutomate.plugin;
|
||||
@@ -104,6 +58,7 @@ const handleGenericPrompt = async (request: AIRequest) : Promise<RequestUrlRespo
|
||||
const {
|
||||
openAIAPIToken,
|
||||
openAIDefaultTextModel,
|
||||
openAIDefaultTextModelMaxTokens,
|
||||
openAIDefaultVisionModel,
|
||||
openAIURL,
|
||||
openAIImageGenerationURL,
|
||||
@@ -118,7 +73,7 @@ const handleGenericPrompt = async (request: AIRequest) : Promise<RequestUrlRespo
|
||||
case "text":
|
||||
body = {
|
||||
model: openAIDefaultTextModel,
|
||||
max_tokens: 4096,
|
||||
...(openAIDefaultTextModelMaxTokens > 0 && { max_tokens: openAIDefaultTextModelMaxTokens }),
|
||||
messages: [
|
||||
...(systemPrompt && systemPrompt.trim() !=="" ? [{role: "system" as const,content: systemPrompt}] : []),
|
||||
{
|
||||
@@ -132,7 +87,7 @@ const handleGenericPrompt = async (request: AIRequest) : Promise<RequestUrlRespo
|
||||
case "image":
|
||||
body = {
|
||||
model: openAIDefaultVisionModel,
|
||||
max_tokens: 4096,
|
||||
...(openAIDefaultTextModelMaxTokens > 0 && { max_tokens: openAIDefaultTextModelMaxTokens }),
|
||||
messages: [
|
||||
...(systemPrompt && systemPrompt.trim() !=="" ? [{role: "system" as const,content: systemPrompt}] : []),
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//for future use, not used currently
|
||||
|
||||
import { ImageCrop } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { PDFPageViewProps } from "src/shared/EmbeddedFileLoader";
|
||||
import { PDFPageViewProps } from "src/types/embeddedFileLoaderTypes";
|
||||
|
||||
export function getPDFCropRect (props: {
|
||||
scale: number,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ExcalidrawImperativeAPI } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { ColorMaster } from "@zsviczian/colormaster";
|
||||
import CM, { ColorMaster } from "@zsviczian/colormaster";
|
||||
import { ExcalidrawAutomate } from "src/shared/ExcalidrawAutomate";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
import { DynamicStyle } from "src/types/types";
|
||||
@@ -190,4 +190,43 @@ export const setDynamicStyle = (
|
||||
color = null;
|
||||
dynamicStyle = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const colorsCache: Map<string,string> = new Map();
|
||||
|
||||
export function getHighlightColor(
|
||||
ea: ExcalidrawAutomate,
|
||||
bgColor: string,
|
||||
opacity:number = 1
|
||||
): string {
|
||||
bgColor = bgColor==="transparent" ? "#ffffff": bgColor;
|
||||
|
||||
let contrastedRGBA = colorsCache.get(bgColor);
|
||||
if(!contrastedRGBA) {
|
||||
const bg = ea.getCM(bgColor);
|
||||
const bgMix = ea.getCM(bgColor);
|
||||
const isDark = bg.isDark();
|
||||
|
||||
const step = 15;
|
||||
const candidates = [
|
||||
CM((isDark ? bg.lighterBy(step) : bg.darkerBy(step)).stringHEX()),
|
||||
CM((isDark ? bg.lighterBy(step) : bg.darkerBy(step)).stringHEX()),
|
||||
isDark ? bg.lighterBy(step) : bg.darkerBy(step),
|
||||
// Vibrancy boost by mixing toward the opposite theme color
|
||||
bgMix.mix({color: ea.getCM(isDark ? "#ffffff" : "#000000"), ratio:0.35}),
|
||||
ea.getCM(isDark ? "#ffffff" : "#000000"),
|
||||
ea.getCM(isDark ? "#000000" : "#ffffff"),
|
||||
];
|
||||
|
||||
const desiredContrast = 2.5;
|
||||
const contrasted = candidates.find(color =>
|
||||
color.contrast({bgColor, ratio:false}) as number >= desiredContrast) ??
|
||||
candidates.reduce((best, color) =>
|
||||
(color.contrast({bgColor, ratio: false}) > best.contrast({bgColor, ratio:false}) ? color : best)
|
||||
);
|
||||
contrastedRGBA = `rgba(${Math.round(contrasted.red)
|
||||
},${Math.round(contrasted.green)},${Math.round(contrasted.blue)}`;
|
||||
colorsCache.set(bgColor,contrastedRGBA);
|
||||
}
|
||||
return `${contrastedRGBA},${opacity})`;
|
||||
}
|
||||
@@ -5,10 +5,11 @@ import {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
FileId,
|
||||
FixedPoint,
|
||||
} from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { normalizePath, TFile } from "obsidian";
|
||||
|
||||
import ExcalidrawView, { ExportSettings, getTextMode } from "src/view/ExcalidrawView";
|
||||
import ExcalidrawView, { getTextMode } from "src/view/ExcalidrawView";
|
||||
import {
|
||||
GITHUB_RELEASES,
|
||||
getCommonBoundingBox,
|
||||
@@ -30,19 +31,21 @@ import {
|
||||
isVersionNewerThanOther,
|
||||
scaleLoadedImage,
|
||||
} from "src/utils/utils";
|
||||
import { GenericInputPrompt, NewFileActions } from "src/shared/Dialogs/Prompt";
|
||||
import { GenericInputPrompt, LaTexPrompt, NewFileActions } from "src/shared/Dialogs/Prompt";
|
||||
import { t } from "src/lang/helpers";
|
||||
import { Mutable } from "@zsviczian/excalidraw/types/common/src/utility-types";
|
||||
import {
|
||||
postOpenAI as _postOpenAI,
|
||||
extractCodeBlocks as _extractCodeBlocks,
|
||||
} from "../utils/AIUtils";
|
||||
import { ColorMap, EmbeddedFilesLoader, FileData } from "src/shared/EmbeddedFileLoader";
|
||||
import { SVGColorInfo } from "src/types/excalidrawAutomateTypes";
|
||||
import { ExcalidrawData, getExcalidrawMarkdownHeaderSection, REGEX_LINK } from "src/shared/ExcalidrawData";
|
||||
import { getFrameBasedOnFrameNameOrId } from "./excalidrawViewUtils";
|
||||
import { EmbeddedFilesLoader } from "src/shared/EmbeddedFileLoader";
|
||||
import { ScriptSettingValue, SVGColorInfo } from "src/types/excalidrawAutomateTypes";
|
||||
import { ExcalidrawData, getExcalidrawMarkdownHeaderSection, REG_LINKINDEX_HYPERLINK, REGEX_LINK } from "src/shared/ExcalidrawData";
|
||||
import { getFrameBasedOnFrameNameOrId, sceneRemoveInternalLinks } from "./excalidrawViewUtils";
|
||||
import { ScriptEngine } from "src/shared/Scripts";
|
||||
import { getEA } from "src/core";
|
||||
import { ColorMap, FileData } from "src/types/embeddedFileLoaderTypes";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
|
||||
declare const PLUGIN_VERSION:string;
|
||||
|
||||
@@ -150,7 +153,7 @@ export function errorMessage(message: string, source: string):void {
|
||||
|
||||
export function isColorStringTransparent(color: string): boolean {
|
||||
const rgbaHslaTransparentRegex = /^(rgba|hsla)\(.*?,.*?,.*?,\s*0(\.0+)?\)$/i;
|
||||
const hexTransparentRegex = /^#[a-fA-F0-9]{8}00$/i;
|
||||
const hexTransparentRegex = /^#[a-fA-F0-9]{6}00$/i;
|
||||
|
||||
return rgbaHslaTransparentRegex.test(color) || hexTransparentRegex.test(color);
|
||||
}
|
||||
@@ -448,6 +451,12 @@ export const updateElementLinksToObsidianLinks = ({elements, hostFile}:{
|
||||
const partsArray = REGEX_LINK.getResList(el.link)[0];
|
||||
if(!partsArray?.value) return el;
|
||||
let linkText = REGEX_LINK.getLink(partsArray);
|
||||
if (linkText.match(REG_LINKINDEX_HYPERLINK)) {
|
||||
if(linkText.startsWith("obsidian://") || linkText.startsWith("cmd://")) return el;
|
||||
const newElement: Mutable<ExcalidrawElement> = cloneElement(el);
|
||||
newElement.link = linkText;
|
||||
return newElement;
|
||||
}
|
||||
if (linkText.search("#") > -1) {
|
||||
const linkParts = getLinkParts(linkText, hostFile);
|
||||
linkText = linkParts.path;
|
||||
@@ -504,6 +513,7 @@ export async function createSVG(
|
||||
padding?: number,
|
||||
imagesDict?: any,
|
||||
convertMarkdownLinksToObsidianURLs: boolean = false,
|
||||
includeInternalLinks: boolean = true,
|
||||
): Promise<SVGSVGElement> {
|
||||
if (!loader) {
|
||||
loader = new EmbeddedFilesLoader(plugin);
|
||||
@@ -534,7 +544,7 @@ export async function createSVG(
|
||||
type: "excalidraw",
|
||||
version: 2,
|
||||
source: GITHUB_RELEASES+PLUGIN_VERSION,
|
||||
elements,
|
||||
elements: includeInternalLinks ? elements : sceneRemoveInternalLinks({elements}),
|
||||
appState: {
|
||||
theme,
|
||||
viewBackgroundColor:
|
||||
@@ -647,15 +657,19 @@ export function repositionElementsToCursor(
|
||||
export const insertLaTeXToView = (view: ExcalidrawView, center: boolean = false) => {
|
||||
const app = view.plugin.app;
|
||||
const ea = getEA(view) as ExcalidrawAutomate;
|
||||
GenericInputPrompt.Prompt(
|
||||
view,
|
||||
view.plugin,
|
||||
app,
|
||||
t("ENTER_LATEX"),
|
||||
"\\color{red}\\oint_S {E_n dA = \\frac{1}{{\\varepsilon _0 }}} Q_{inside}",
|
||||
view.plugin.settings.latexBoilerplate,
|
||||
undefined,
|
||||
3
|
||||
const isLatexSuitAvailable = !!app.plugins.plugins["obsidian-latex-suite"];
|
||||
(isLatexSuitAvailable
|
||||
? LaTexPrompt.Prompt(app, t("ENTER_LATEX"), view.plugin.settings.latexBoilerplate)
|
||||
: GenericInputPrompt.Prompt(
|
||||
view,
|
||||
view.plugin,
|
||||
app,
|
||||
t("ENTER_LATEX"),
|
||||
"\\color{red}\\oint_S {E_n dA = \\frac{1}{{\\varepsilon _0 }}} Q_{inside}",
|
||||
view.plugin.settings.latexBoilerplate,
|
||||
undefined,
|
||||
3
|
||||
)
|
||||
).then(async (formula: string) => {
|
||||
if (formula) {
|
||||
const id = await ea.addLaTex(0, 0, formula);
|
||||
@@ -670,7 +684,7 @@ export const insertLaTeXToView = (view: ExcalidrawView, center: boolean = false)
|
||||
ea.selectElementsInView([id]);
|
||||
}
|
||||
ea.destroy();
|
||||
});
|
||||
}, () => {});
|
||||
};
|
||||
|
||||
export const search = async (view: ExcalidrawView) => {
|
||||
@@ -843,4 +857,83 @@ export const getBoundTextElementId = (container: ExcalidrawElement | null) => {
|
||||
return container?.boundElements?.length
|
||||
? container?.boundElements?.find((ele) => ele.type === "text")?.id || null
|
||||
: null;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* FixedPoint represents the fixed point binding information in form of a vertical and
|
||||
* horizontal ratio (i.e. a percentage value in the 0.0-1.0 range). This ratio
|
||||
* gives the user selected fixed point by multiplying the bound element width
|
||||
* with fixedPoint[0] and the bound element height with fixedPoint[1] to get the
|
||||
* bound element-local point coordinate.
|
||||
*/
|
||||
export const normalizeFixedPoint = <T extends FixedPoint | null | undefined>(
|
||||
fixedPoint: T,
|
||||
): T extends null ? null : FixedPoint => {
|
||||
if (!fixedPoint) {
|
||||
return [0.50001, 0.5001] as any as T extends null ? null : FixedPoint;
|
||||
}
|
||||
if (fixedPoint[0] < 0 || fixedPoint[0] > 1) {
|
||||
fixedPoint[0] = 0.5001;
|
||||
}
|
||||
if (fixedPoint[1] < 0 || fixedPoint[1] > 1) {
|
||||
fixedPoint[1] = 0.5001;
|
||||
}
|
||||
// Do not allow a precise 0.5 for fixed point ratio
|
||||
// to avoid jumping arrow heading due to floating point imprecision
|
||||
if (
|
||||
fixedPoint &&
|
||||
(Math.abs(fixedPoint[0] - 0.5) < 0.0001 ||
|
||||
Math.abs(fixedPoint[1] - 0.5) < 0.0001)
|
||||
) {
|
||||
return fixedPoint.map((ratio) =>
|
||||
Math.abs(ratio - 0.5) < 0.0001 ? 0.5001 : ratio,
|
||||
) as T extends null ? null : FixedPoint;
|
||||
}
|
||||
return fixedPoint as any as T extends null ? null : FixedPoint;
|
||||
};
|
||||
|
||||
export const normalizeBindMode = (bindMode?: string): "orbit" | "inside" => {
|
||||
if (!bindMode || (bindMode !== "orbit" && bindMode !== "inside")) {
|
||||
return "orbit";
|
||||
}
|
||||
return bindMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensures that plugin.settings.scriptEngineSettings and the active script's settings object exist.
|
||||
* Handles undefined/null during initialization.
|
||||
*
|
||||
* Note: kept in utils (not as an EA private method) so it won't be exposed on window.ExcalidrawAutomate.
|
||||
*/
|
||||
export function ensureActiveScriptSettingsObject(
|
||||
ea: ExcalidrawAutomate
|
||||
): Record<string, ScriptSettingValue> | null {
|
||||
const activeScript = ea?.activeScript;
|
||||
const plugin = ea?.plugin;
|
||||
|
||||
if (!activeScript || !plugin?.settings) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Ensure the top-level container exists
|
||||
if (!plugin.settings.scriptEngineSettings || typeof plugin.settings.scriptEngineSettings !== "object") {
|
||||
plugin.settings.scriptEngineSettings = {};
|
||||
}
|
||||
|
||||
// Ensure the per-script settings object exists (handle null/undefined)
|
||||
const current = plugin.settings.scriptEngineSettings[activeScript];
|
||||
if (!current || typeof current !== "object") {
|
||||
plugin.settings.scriptEngineSettings[activeScript] = {};
|
||||
}
|
||||
|
||||
return plugin.settings.scriptEngineSettings[activeScript] as Record<string, ScriptSettingValue>;
|
||||
}
|
||||
|
||||
export function getLastActiveExcalidrawView(plugin: ExcalidrawPlugin): ExcalidrawView | null {
|
||||
const leaf = plugin.app.workspace.getLeafById(plugin.lastActiveExcalidrawLeafID);
|
||||
if(leaf && leaf.view instanceof ExcalidrawView) {
|
||||
return leaf.view as ExcalidrawView;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -40,6 +40,16 @@ export async function insertImageToView(
|
||||
return id;
|
||||
}
|
||||
|
||||
export function deleteAppStateKeys(
|
||||
st: AppState,
|
||||
[...keys]: (keyof AppState)[],
|
||||
): Partial<AppState> {
|
||||
keys.forEach((key) => {
|
||||
delete (st as Mutable<AppState>)[key];
|
||||
});
|
||||
return st;
|
||||
};
|
||||
|
||||
export async function insertEmbeddableToView (
|
||||
ea: ExcalidrawAutomate,
|
||||
position: { x: number, y: number },
|
||||
@@ -127,6 +137,23 @@ function getLinkFromMarkdownLink(link: string): string {
|
||||
return result ? result[1] : link;
|
||||
}
|
||||
|
||||
function isInternalLink(link:string):boolean {
|
||||
link = getLinkFromMarkdownLink(link);
|
||||
if (link.startsWith("cmd://")) return true;
|
||||
if (link.startsWith("obsidian://")) return true;
|
||||
if (link.match(REG_LINKINDEX_HYPERLINK)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function sceneRemoveInternalLinks(scene: {elements: ExcalidrawElement[]}): ExcalidrawElement[] {
|
||||
const elements: ExcalidrawElement[] = JSON.parse(JSON.stringify(scene.elements));
|
||||
elements.forEach(el => {
|
||||
if(!el.link) return;
|
||||
if(isInternalLink(el.link)) (el as Mutable<ExcalidrawElement>).link = null;
|
||||
});
|
||||
return elements;
|
||||
}
|
||||
|
||||
export function openExternalLink (link:string, app: App, element?: ExcalidrawElement):boolean {
|
||||
link = getLinkFromMarkdownLink(link);
|
||||
if (link.match(/^cmd:\/\/.*/)) {
|
||||
@@ -234,6 +261,7 @@ export async function addBackOfTheNoteCard(
|
||||
cardBody?: string,
|
||||
embeddableCustomData?: EmbeddableMDCustomProps,
|
||||
center: boolean = false,
|
||||
position?: {x: number, y: number},
|
||||
):Promise<string> {
|
||||
const data = view.data;
|
||||
const header = getExcalidrawMarkdownHeaderSection(data);
|
||||
@@ -243,12 +271,11 @@ export async function addBackOfTheNoteCard(
|
||||
const shouldRemoveTrailingHashtag = Boolean(hastag);
|
||||
view.data = data.replace(
|
||||
header,
|
||||
(shouldRemoveTrailingHashtag
|
||||
() => (shouldRemoveTrailingHashtag
|
||||
? header.substring(0,header.length-hastag[0].length)
|
||||
: header) +
|
||||
`\n# ${title}\n\n${cardBody ? cardBody+"\n\n" : ""}${
|
||||
shouldAddHashtag || shouldRemoveTrailingHashtag ? "#\n" : ""}`);
|
||||
|
||||
await view.forceSave(true);
|
||||
let watchdog = 0;
|
||||
await sleep(200);
|
||||
@@ -263,7 +290,7 @@ export async function addBackOfTheNoteCard(
|
||||
}
|
||||
|
||||
const ea = getEA(view) as ExcalidrawAutomate;
|
||||
let x,y = 0;
|
||||
let {x,y} = position ?? ea.targetView.currentPosition;
|
||||
if(center) {
|
||||
const centerPos = ea.getViewCenterPosition();
|
||||
if(centerPos) {
|
||||
@@ -287,7 +314,7 @@ export async function addBackOfTheNoteCard(
|
||||
window.setTimeout(()=>{
|
||||
api.updateScene({appState: {activeEmbeddable: {element: el, state: "active"}}, captureUpdate: CaptureUpdateAction.NEVER,});
|
||||
if(found) view.getEmbeddableLeafElementById(el.id)?.editNode?.();
|
||||
});
|
||||
},200);
|
||||
}
|
||||
ea.destroy();
|
||||
return el.id;
|
||||
|
||||
@@ -3,66 +3,10 @@ import { DEVICE } from 'src/constants/constants';
|
||||
import { t } from 'src/lang/helpers';
|
||||
import { download } from './fileUtils';
|
||||
import { svgToBase64 } from './utils';
|
||||
import { PageDimensions, PageOrientation, PageSize, PDFExportScale, PDFMargin, PDFPageAlignment, PDFPageMarginString, PDFPageProperties, STANDARD_PAGE_SIZES } from 'src/types/exportUtilTypes';
|
||||
|
||||
const DPI = 96;
|
||||
|
||||
export type PDFPageAlignment =
|
||||
| "center"
|
||||
| "top-left"
|
||||
| "top-center"
|
||||
| "top-right"
|
||||
| "bottom-left"
|
||||
| "bottom-center"
|
||||
| "bottom-right"
|
||||
| "center-left"
|
||||
| "center-right";
|
||||
export type PDFPageMarginString = "none" | "tiny" | "normal";
|
||||
|
||||
export interface PDFExportScale {
|
||||
fitToPage: number; // 0 means use zoom, >1 means fit to that many pages exactly
|
||||
zoom?: number;
|
||||
}
|
||||
|
||||
export interface PDFMargin {
|
||||
left: number;
|
||||
right: number;
|
||||
top: number;
|
||||
bottom: number;
|
||||
}
|
||||
|
||||
export interface PDFPageProperties {
|
||||
dimensions?: {width: number; height: number};
|
||||
backgroundColor?: string;
|
||||
margin: PDFMargin;
|
||||
alignment: PDFPageAlignment;
|
||||
}
|
||||
|
||||
export interface PageDimensions {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export type PageOrientation = "portrait" | "landscape";
|
||||
|
||||
// All dimensions in pixels (pt)
|
||||
export const STANDARD_PAGE_SIZES = {
|
||||
A0: { width: 3179.52, height: 4494.96 }, // 33.11 × 46.81 inches
|
||||
A1: { width: 2245.76, height: 3179.52 }, // 23.39 × 33.11 inches
|
||||
A2: { width: 1587.76, height: 2245.76 }, // 16.54 × 23.39 inches
|
||||
A3: { width: 1122.56, height: 1587.76 }, // 11.69 × 16.54 inches
|
||||
A4: { width: 794.56, height: 1122.56 }, // 8.27 × 11.69 inches
|
||||
A5: { width: 559.37, height: 794.56 }, // 5.83 × 8.27 inches
|
||||
A6: { width: 397.28, height: 559.37 }, // 4.13 × 5.83 inches
|
||||
Legal: { width: 816, height: 1344 }, // 8.5 × 14 inches
|
||||
Letter: { width: 816, height: 1056 }, // 8.5 × 11 inches
|
||||
Tabloid: { width: 1056, height: 1632 }, // 11 × 17 inches
|
||||
Ledger: { width: 1632, height: 1056 }, // 17 × 11 inches
|
||||
"HD Screen": { width: 1920, height: 1080 },// 16:9 aspect ratio
|
||||
"MATCH IMAGE": { width: 0, height: 0 }, // 0 means use the current screen size
|
||||
} as const;
|
||||
|
||||
export type PageSize = keyof typeof STANDARD_PAGE_SIZES;
|
||||
|
||||
//margins are in pixels
|
||||
export function getMarginValue(margin:PDFPageMarginString): PDFMargin {
|
||||
switch(margin) {
|
||||
@@ -232,7 +176,9 @@ async function printPdf(
|
||||
printDiv.style.top = "0";
|
||||
printDiv.style.left = "0";
|
||||
printDiv.style.display = "flex";
|
||||
printDiv.appendChild(elementToPrint);
|
||||
//printDiv.appendChild(elementToPrint); // if I append directly, rounded images and clip paths get messed up
|
||||
// see https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2544
|
||||
printDiv.innerHTML = elementToPrint.outerHTML;
|
||||
|
||||
const options: PrintToPDFOptions = {
|
||||
includeName: false,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { DataURL } from "@zsviczian/excalidraw/types/excalidraw/types";
|
||||
import { App, loadPdfJs, MetadataCache, normalizePath, Notice, requestUrl, RequestUrlResponse, TAbstractFile, TFile, TFolder, Vault } from "obsidian";
|
||||
import { DEVICE, EXCALIDRAW_PLUGIN, FRONTMATTER_KEYS, URLFETCHTIMEOUT } from "src/constants/constants";
|
||||
import { IMAGE_MIME_TYPES, MimeType } from "../shared/EmbeddedFileLoader";
|
||||
import { ExcalidrawSettings } from "src/core/settings";
|
||||
import { errorlog, getDataURL } from "./utils";
|
||||
import ExcalidrawPlugin from "src/core/main";
|
||||
import { getAttachmentsFolderAndFilePath } from "./obsidianUtils";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
import { IMAGE_MIME_TYPES, MimeType } from "src/types/embeddedFileLoaderTypes";
|
||||
|
||||
/**
|
||||
* Splits a full path including a folderpath and a filename into separate folderpath and filename components
|
||||
|
||||
+3
-1
@@ -36,11 +36,13 @@ export async function diagramToHTML({
|
||||
apiKey,
|
||||
text,
|
||||
theme = THEME.LIGHT,
|
||||
openAIURL = "https://api.openai.com/v1/chat/completions",
|
||||
}: {
|
||||
image: DataURL;
|
||||
apiKey: string;
|
||||
text: string;
|
||||
theme?: Theme;
|
||||
openAIURL?: string;
|
||||
}) {
|
||||
const body: OpenAIInput.ChatCompletionCreateParamsBase = {
|
||||
model: EXCALIDRAW_PLUGIN.settings.openAIDefaultVisionModel,
|
||||
@@ -79,7 +81,7 @@ export async function diagramToHTML({
|
||||
| ({ ok: true } & OpenAIOutput.ChatCompletion)
|
||||
| ({ ok: false } & OpenAIOutput.APIError);
|
||||
|
||||
return await fetch("https://api.openai.com/v1/chat/completions", {
|
||||
return await fetch(openAIURL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
Editor,
|
||||
FrontMatterCache,
|
||||
MarkdownView,
|
||||
OpenViewState, parseFrontMatterEntry, TFile, View, ViewState, Workspace, WorkspaceLeaf, WorkspaceSplit
|
||||
OpenViewState, parseFrontMatterEntry, TextFileView, TFile, View, ViewState, Workspace, WorkspaceLeaf, WorkspaceSplit
|
||||
} from "obsidian";
|
||||
import ExcalidrawPlugin from "../core/main";
|
||||
import { splitFolderAndFilename } from "./fileUtils";
|
||||
@@ -30,6 +30,14 @@ export function getExcalidrawViews(app: App): ExcalidrawView[] {
|
||||
return leaves.map(l=>l.view as ExcalidrawView);
|
||||
}
|
||||
|
||||
export function getExcalidraAndMarkdowViewsForFile(app: App, file: TFile): TextFileView[] {
|
||||
const leaves = [
|
||||
...app.workspace.getLeavesOfType(VIEW_TYPE_EXCALIDRAW).filter(l=>l.view instanceof ExcalidrawView),
|
||||
...app.workspace.getLeavesOfType("markdown").filter(l=>l.view instanceof MarkdownView)
|
||||
];
|
||||
return leaves.map(l=>l.view as TextFileView).filter(v=>v.file === file);
|
||||
}
|
||||
|
||||
export const getLeaf = (
|
||||
plugin: ExcalidrawPlugin,
|
||||
origo: WorkspaceLeaf,
|
||||
@@ -504,4 +512,9 @@ export function getAudioElementHeight(): number {
|
||||
}
|
||||
|
||||
return Math.round(height);
|
||||
}
|
||||
|
||||
export function stripYamlFrontmatter(text: string): string {
|
||||
if (!text) return text;
|
||||
return text.replace(/^---\s*\r?\n[\s\S]*?\r?\n---\s*\r?\n?/, "");
|
||||
}
|
||||
+77
-14
@@ -20,21 +20,23 @@ import {
|
||||
} from "../constants/constants";
|
||||
import ExcalidrawPlugin from "../core/main";
|
||||
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ImageCrop } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import { ExportSettings } from "../view/ExcalidrawView";
|
||||
import { getDataURLFromURL, getIMGFilename, getMimeType, getURLImageExtension } from "./fileUtils";
|
||||
import { generateEmbeddableLink } from "./customEmbeddableUtils";
|
||||
import { FILENAMEPARTS } from "../types/utilTypes";
|
||||
import { Mutable } from "@zsviczian/excalidraw/types/common/src/utility-types";
|
||||
import { cleanBlockRef, cleanSectionHeading, getFileCSSClasses } from "./obsidianUtils";
|
||||
import { cleanBlockRef, cleanSectionHeading, getExcalidrawViews, getFileCSSClasses } from "./obsidianUtils";
|
||||
import { updateElementLinksToObsidianLinks } from "./excalidrawAutomateUtils";
|
||||
import { CropImage } from "../shared/CropImage";
|
||||
import opentype from 'opentype.js';
|
||||
import { runCompressionWorker } from "src/shared/Workers/compression-worker";
|
||||
import Pool from "es6-promise-pool";
|
||||
import { FileData } from "../shared/EmbeddedFileLoader";
|
||||
import { t } from "src/lang/helpers";
|
||||
import ExcalidrawScene from "src/shared/svgToExcalidraw/elements/ExcalidrawScene";
|
||||
import { log } from "./debugHelper";
|
||||
import { VersionMismatchPrompt } from "src/shared/Dialogs/VersionMismatch";
|
||||
import { ExcalidrawSettings } from "src/core/settings";
|
||||
import { FileData } from "src/types/embeddedFileLoaderTypes";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
import { UIMode } from "src/shared/Dialogs/UIModeSettingComponent";
|
||||
|
||||
declare const PLUGIN_VERSION:string;
|
||||
declare var LZString: any;
|
||||
@@ -51,6 +53,21 @@ declare module "obsidian" {
|
||||
}
|
||||
}
|
||||
|
||||
let versionMismatchChecked = false;
|
||||
export async function checkVersionMismatch(plugin: ExcalidrawPlugin) {
|
||||
if (!versionMismatchChecked && plugin.manifest.version !== PLUGIN_VERSION) {
|
||||
versionMismatchChecked = true;
|
||||
const versionMismatchPrompt = new VersionMismatchPrompt(plugin);
|
||||
const result = await versionMismatchPrompt.start();
|
||||
if(result) {
|
||||
plugin.manifest.version = PLUGIN_VERSION;
|
||||
await plugin.app.setting.open();
|
||||
plugin.app.setting.openTabById("community-plugins");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export let versionUpdateCheckTimer: number = null;
|
||||
let versionUpdateChecked = false;
|
||||
export async function checkExcalidrawVersion() {
|
||||
@@ -589,7 +606,12 @@ export function scaleLoadedImage (
|
||||
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;}`;
|
||||
newStylesheet.textContent = `.excalidraw .App-bottom-bar {
|
||||
justify-content:flex-end !important;
|
||||
left: auto !important;
|
||||
right: 0 !important;
|
||||
transform: none !important;
|
||||
}`;
|
||||
const oldStylesheet = ownerDocument.getElementById(newStylesheet.id);
|
||||
if (oldStylesheet) {
|
||||
ownerDocument.head.removeChild(oldStylesheet);
|
||||
@@ -600,6 +622,7 @@ export function setDocLeftHandedMode(isLeftHanded: boolean, ownerDocument:Docume
|
||||
}
|
||||
|
||||
export function setLeftHandedMode (isLeftHanded: boolean) {
|
||||
if(DEVICE.isPhone) return; //no lefthanded mode on phones
|
||||
const visitedDocs = new Set<Document>();
|
||||
EXCALIDRAW_PLUGIN.app.workspace.iterateAllLeaves((leaf) => {
|
||||
const ownerDocument = DEVICE.isMobile?document:leaf.view.containerEl.ownerDocument;
|
||||
@@ -610,6 +633,21 @@ export function setLeftHandedMode (isLeftHanded: boolean) {
|
||||
})
|
||||
};
|
||||
|
||||
export function calculateUIModeValue(settings: ExcalidrawSettings): UIMode {
|
||||
return DEVICE.isPhone
|
||||
? "phone"
|
||||
: DEVICE.isTablet
|
||||
? settings.tabletUIMode
|
||||
: DEVICE.isDesktop
|
||||
? settings.desktopUIMode
|
||||
: "tray";
|
||||
}
|
||||
|
||||
export function setUIMode(app: App, settings: ExcalidrawSettings) {
|
||||
const uiMode = calculateUIModeValue(settings);
|
||||
getExcalidrawViews(app).forEach((view) => view.setUIMode(uiMode));
|
||||
};
|
||||
|
||||
export type LinkParts = {
|
||||
original: string;
|
||||
path: string;
|
||||
@@ -778,6 +816,23 @@ export function getWithBackground (
|
||||
return plugin.settings.exportWithBackground;
|
||||
};
|
||||
|
||||
export function getExportInternalLinks(
|
||||
plugin: ExcalidrawPlugin,
|
||||
file: TFile,
|
||||
): boolean {
|
||||
if (file) {
|
||||
const fileCache = plugin.app.metadataCache.getFileCache(file);
|
||||
if (
|
||||
fileCache?.frontmatter &&
|
||||
fileCache.frontmatter[FRONTMATTER_KEYS["export-internal-links"].name] !== null &&
|
||||
(typeof fileCache.frontmatter[FRONTMATTER_KEYS["export-internal-links"].name] !== "undefined")
|
||||
) {
|
||||
return fileCache.frontmatter[FRONTMATTER_KEYS["export-internal-links"].name];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
export function getExportPadding (
|
||||
plugin: ExcalidrawPlugin,
|
||||
file: TFile,
|
||||
@@ -1057,16 +1112,24 @@ export function escapeRegExp (str:string) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||
}
|
||||
|
||||
export function addIframe (containerEl: HTMLElement, link:string, startAt?: number, style:string = "settings") {
|
||||
const wrapper = containerEl.createDiv({cls: `excalidraw-videoWrapper ${style}`})
|
||||
wrapper.createEl("iframe", {
|
||||
export function addYouTubeThumbnail (containerEl: HTMLElement, link:string, startAt?: number, style:string = "settings") {
|
||||
const wrapper = containerEl.createDiv({cls: `excalidraw-videoWrapper ${style}`});
|
||||
|
||||
const thumbnailUrl = `https://i.ytimg.com/vi/${link}/maxresdefault.jpg`;
|
||||
|
||||
const anchor = wrapper.createEl("a", {
|
||||
attr: {
|
||||
allowfullscreen: true,
|
||||
allow: "encrypted-media;picture-in-picture",
|
||||
frameborder: "0",
|
||||
title: "YouTube video player",
|
||||
src: "https://www.youtube.com/embed/" + link + (startAt ? "?start=" + startAt : ""),
|
||||
sandbox: "allow-forms allow-presentation allow-same-origin allow-scripts allow-modals",
|
||||
href: "https://www.youtube.com/watch?v=" + link + (startAt ? "&t=" + startAt : ""),
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer",
|
||||
},
|
||||
});
|
||||
|
||||
anchor.createEl("img", {
|
||||
attr: {
|
||||
src: thumbnailUrl || `https://i.ytimg.com/vi/${link}/default.jpg`,
|
||||
alt: "YouTube video thumbnail",
|
||||
style: "width: 100%; height: auto; cursor: pointer;",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
+337
-221
@@ -38,7 +38,6 @@ import {
|
||||
DISK_ICON_NAME,
|
||||
SCRIPTENGINE_ICON_NAME,
|
||||
TEXT_DISPLAY_RAW_ICON_NAME,
|
||||
TEXT_DISPLAY_PARSED_ICON_NAME,
|
||||
IMAGE_TYPES,
|
||||
KEYCODE,
|
||||
FRONTMATTER_KEYS,
|
||||
@@ -110,16 +109,18 @@ import {
|
||||
addAppendUpdateCustomData,
|
||||
getFilePathFromObsidianURL,
|
||||
getLinkParts,
|
||||
checkVersionMismatch,
|
||||
calculateUIModeValue,
|
||||
getExportInternalLinks,
|
||||
} from "../utils/utils";
|
||||
import { cleanBlockRef, cleanSectionHeading, closeLeafView, getActivePDFPageNumberFromPDFView, getAttachmentsFolderAndFilePath, getLeaf, getParentOfClass, obsidianPDFQuoteWithRef, openLeaf, setExcalidrawView } from "../utils/obsidianUtils";
|
||||
import { cleanBlockRef, cleanSectionHeading, closeLeafView, getAttachmentsFolderAndFilePath, getExcalidraAndMarkdowViewsForFile, getLeaf, getParentOfClass, obsidianPDFQuoteWithRef, openLeaf, setExcalidrawView } from "../utils/obsidianUtils";
|
||||
import { splitFolderAndFilename } from "../utils/fileUtils";
|
||||
import { GenericInputPrompt, MultiOptionConfirmationPrompt, NewFileActions, Prompt, linkPrompt } from "../shared/Dialogs/Prompt";
|
||||
import { GenericInputPrompt, LaTexPrompt, MultiOptionConfirmationPrompt, NewFileActions, Prompt, linkPrompt } from "../shared/Dialogs/Prompt";
|
||||
import { ClipboardData } from "@zsviczian/excalidraw/types/excalidraw/clipboard";
|
||||
import { updateEquation } from "../shared/LaTeX";
|
||||
import {
|
||||
EmbeddedFile,
|
||||
EmbeddedFilesLoader,
|
||||
FileData,
|
||||
generateIdFromFile,
|
||||
} from "../shared/EmbeddedFileLoader";
|
||||
import { ScriptInstallPrompt } from "../shared/Dialogs/ScriptInstallPrompt";
|
||||
@@ -130,10 +131,10 @@ import { getTextElementAtPointer, getImageElementAtPointer, getElementWithLinkAt
|
||||
import { excalidrawSword, ICONS, LogoWrapper, Rank, saveIcon, SwordColors } from "../constants/actionIcons";
|
||||
import { ExportDialog } from "../shared/Dialogs/ExportDialog";
|
||||
import { getEA } from "src/core"
|
||||
import { anyModifierKeysPressed, emulateKeysForLinkClick, isWinALTorMacOPT, isWinCTRLorMacCMD, isWinMETAorMacCTRL, isSHIFT, linkClickModifierType, localFileDragModifierType, ModifierKeys, modifierKeyTooltipMessages } from "../utils/modifierkeyHelper";
|
||||
import { anyModifierKeysPressed, emulateKeysForLinkClick, isWinALTorMacOPT, isWinCTRLorMacCMD, isWinMETAorMacCTRL, isSHIFT, linkClickModifierType, ModifierKeys } from "../utils/modifierkeyHelper";
|
||||
import { setDynamicStyle } from "../utils/dynamicStyling";
|
||||
import { CustomEmbeddable, renderWebView } from "./components/CustomEmbeddable";
|
||||
import { addBackOfTheNoteCard, getExcalidrawFileForwardLinks, getFrameBasedOnFrameNameOrId, getLinkTextFromLink, insertEmbeddableToView, insertImageToView, isTextImageTransclusion, onLoadMessages, openExternalLink, parseObsidianLink, renderContextMenuAction, tmpBruteForceCleanup, toggleImageAnchoring } from "../utils/excalidrawViewUtils";
|
||||
import { addBackOfTheNoteCard, deleteAppStateKeys, getExcalidrawFileForwardLinks, getFrameBasedOnFrameNameOrId, getLinkTextFromLink, insertEmbeddableToView, insertImageToView, isTextImageTransclusion, onLoadMessages, openExternalLink, parseObsidianLink, renderContextMenuAction, sceneRemoveInternalLinks, tmpBruteForceCleanup, toggleImageAnchoring } from "../utils/excalidrawViewUtils";
|
||||
import { imageCache } from "../shared/ImageCache";
|
||||
import { CanvasNodeFactory, ObsidianCanvasNode } from "./managers/CanvasNodeFactory";
|
||||
import { EmbeddableMenu } from "./components/menu/EmbeddableActionsMenu";
|
||||
@@ -153,9 +154,14 @@ import { getPDFCropRect } from "../utils/PDFUtils";
|
||||
import { AutoexportConfig, Position, ViewSemaphores } from "../types/excalidrawViewTypes";
|
||||
import { DropManager } from "./managers/DropManager";
|
||||
import { ImageInfo } from "src/types/excalidrawAutomateTypes";
|
||||
import { exportPNG, exportPNGToClipboard, exportSVG, exportToPDF, getMarginValue, getPageDimensions, PageOrientation, PageSize } from "src/utils/exportUtils";
|
||||
import { FrameRenderingOptions } from "src/types/utilTypes";
|
||||
import { exportPNG, exportPNGToClipboard, exportSVG, exportToPDF, getMarginValue, getPageDimensions } from "src/utils/exportUtils";
|
||||
import { PageOrientation, PageSize, ExportSettings } from "src/types/exportUtilTypes";
|
||||
import { CaptureUpdateAction } from "src/constants/constants";
|
||||
import { updateElementIdsInScene } from "src/utils/excalidrawSceneUtils";
|
||||
import { FileData } from "src/types/embeddedFileLoaderTypes";
|
||||
import { UIMode } from "src/shared/Dialogs/UIModeSettingComponent";
|
||||
import { UIModeSettings } from "src/shared/Dialogs/UIModeSettings";
|
||||
import { copyLinkToSelectedElementToClipboard } from "src/shared/Dialogs/copyLinkToSelectedElement";
|
||||
|
||||
const EMBEDDABLE_SEMAPHORE_TIMEOUT = 2000;
|
||||
const PREVENT_RELOAD_TIMEOUT = 2000;
|
||||
@@ -185,14 +191,6 @@ interface WorkspaceItemExt extends WorkspaceItem {
|
||||
containerEl: HTMLElement;
|
||||
}
|
||||
|
||||
export interface ExportSettings {
|
||||
withBackground: boolean;
|
||||
withTheme: boolean;
|
||||
isMask: boolean;
|
||||
frameRendering?: FrameRenderingOptions; //optional, overrides relevant appState settings for rendering the frame
|
||||
skipInliningFonts?: boolean;
|
||||
}
|
||||
|
||||
const HIDE = "excalidraw-hidden";
|
||||
const SHOW = "excalidraw-visible";
|
||||
|
||||
@@ -283,7 +281,7 @@ const warningUnknowSeriousError = () => {
|
||||
new Notice(t("WARNING_SERIOUS_ERROR"),60000);
|
||||
};
|
||||
|
||||
type ActionButtons = "save" | "isParsed" | "isRaw" | "link" | "scriptInstall";
|
||||
type ActionButtons = "save" | "isRaw" | "link" | "scriptInstall";
|
||||
|
||||
let windowMigratedDisableZoomOnce = false;
|
||||
|
||||
@@ -340,6 +338,11 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
private obsidianMenu: ObsidianMenu;
|
||||
private embeddableMenu: EmbeddableMenu;
|
||||
private destroyers: Function[] = [];
|
||||
private previousContentElHeight: number = 0;
|
||||
private resizeBatchTimer: number = null;
|
||||
private resizeBatchWindowStart: number = 0;
|
||||
private lastAggregatedDh = 0;
|
||||
private oldKeyboardScroll:{scrollY:number, scrollX:number}|null = null;
|
||||
|
||||
//https://stackoverflow.com/questions/27132796/is-there-any-javascript-event-fired-when-the-on-screen-keyboard-on-mobile-safari
|
||||
private isEditingTextResetTimer: number = null;
|
||||
@@ -520,6 +523,15 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
const ed = this.exportDialog;
|
||||
return ed ? !ed.transparent : getWithBackground(this.plugin, this.file)
|
||||
}
|
||||
|
||||
public getViewExportIncludeInternalLinks(includeInternalLinks?:boolean) {
|
||||
if(typeof includeInternalLinks !== "undefined") return includeInternalLinks;
|
||||
if(!this.exportDialog) {
|
||||
this.exportDialog = new ExportDialog(this.plugin, this,this.file);
|
||||
}
|
||||
const ed = this.exportDialog;
|
||||
return ed ? ed.exportInternalLinks : getExportInternalLinks(this.plugin, this.file)
|
||||
}
|
||||
|
||||
public async svg(scene: any, theme?:string, embedScene?: boolean, embedFont: boolean = false): Promise<SVGSVGElement> {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.svg, "ExcalidrawView.svg", scene, theme, embedScene);
|
||||
@@ -586,7 +598,11 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
return;
|
||||
}
|
||||
|
||||
const svg = await this.svg(this.getScene(selectedOnly),undefined,embedScene, true);
|
||||
const scene = this.getScene(selectedOnly);
|
||||
if(!this.getViewExportIncludeInternalLinks()) {
|
||||
scene.elements = sceneRemoveInternalLinks(scene);
|
||||
}
|
||||
const svg = await this.svg(scene, undefined, embedScene, true);
|
||||
if (!svg) {
|
||||
return;
|
||||
}
|
||||
@@ -616,6 +632,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
|
||||
const scene = this.getScene(selectedOnly);
|
||||
if(!this.getViewExportIncludeInternalLinks()) {
|
||||
scene.elements = sceneRemoveInternalLinks(scene);
|
||||
}
|
||||
|
||||
const svg = await this.svg(
|
||||
scene,
|
||||
@@ -968,7 +987,8 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
[FRONTMATTER_KEYS["export-dark"].name, this.exportDialog.theme === "dark" ? "true" : "false"],
|
||||
[FRONTMATTER_KEYS["export-transparent"].name, this.exportDialog.transparent ? "true" : "false"],
|
||||
[FRONTMATTER_KEYS["plugin"].name, this.textMode === TextMode.raw ? "raw" : "parsed"],
|
||||
[FRONTMATTER_KEYS["export-embed-scene"].name, this.exportDialog.embedScene ? "true" : "false"],
|
||||
[FRONTMATTER_KEYS["export-embed-scene"].name, this.exportDialog.embedScene ? "true" : "false"],
|
||||
[FRONTMATTER_KEYS["export-internal-links"].name, this.exportDialog.exportInternalLinks ? "true" : "false"],
|
||||
]
|
||||
: [
|
||||
[FRONTMATTER_KEYS["plugin"].name, this.textMode === TextMode.raw ? "raw" : "parsed"]
|
||||
@@ -1041,7 +1061,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if(!equation) return;
|
||||
}
|
||||
|
||||
GenericInputPrompt.Prompt(this,this.plugin,this.app,t("ENTER_LATEX"),undefined,equation, undefined, 3).then(async (formula: string) => {
|
||||
//GenericInputPrompt.Prompt(this,this.plugin,this.app,t("ENTER_LATEX"),undefined,equation, undefined, 3)
|
||||
LaTexPrompt.Prompt(this.app, t("ENTER_LATEX"), equation)
|
||||
.then(async (formula: string) => {
|
||||
if (!formula || formula === equation) {
|
||||
return;
|
||||
}
|
||||
@@ -1057,7 +1079,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
addFiles,
|
||||
);
|
||||
this.setDirty(1);
|
||||
});
|
||||
}, () => {} );
|
||||
}
|
||||
|
||||
async openEmbeddedLinkEditor(imgId:string) {
|
||||
@@ -1105,7 +1127,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
t("MARKDOWN_EMBED_CUSTOMIZE_LINK_PROMPT_TITLE"),
|
||||
undefined,
|
||||
ef.linkParts.original,
|
||||
[{caption: "✅", action: (x:string)=>{x.replaceAll("\n","").trim()}}],
|
||||
[{iconId: "check", caption: "", action: (x:string)=>{x.replaceAll("\n","").trim()}}],
|
||||
3,
|
||||
false,
|
||||
(container) => container.createEl("p",{text: fragWithHTML(t("MARKDOWN_EMBED_CUSTOMIZE_LINK_PROMPT"))}),
|
||||
@@ -1635,32 +1657,45 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
|
||||
this.registerDomEvent(this.containerEl,"wheel",wheelEvent, {passive: false});
|
||||
|
||||
this.actionButtons['scriptInstall'] = this.addAction(SCRIPTENGINE_ICON_NAME, t("INSTALL_SCRIPT_BUTTON"), () => {
|
||||
new ScriptInstallPrompt(this.plugin).open();
|
||||
});
|
||||
|
||||
this.actionButtons['save'] = this.addAction(
|
||||
DISK_ICON_NAME,
|
||||
t("FORCE_SAVE"),
|
||||
async () => this.forceSave(),
|
||||
);
|
||||
|
||||
this.actionButtons['isRaw'] = this.addAction(
|
||||
TEXT_DISPLAY_RAW_ICON_NAME,
|
||||
t("RAW"),
|
||||
() => this.changeTextMode(TextMode.parsed),
|
||||
);
|
||||
this.actionButtons = {
|
||||
scriptInstall: this.addAction(
|
||||
SCRIPTENGINE_ICON_NAME,
|
||||
!DEVICE.isMobile ? t("INSTALL_SCRIPT_BUTTON") : "",
|
||||
() => {
|
||||
new ScriptInstallPrompt(this.plugin).open();
|
||||
}),
|
||||
save: this.addAction(
|
||||
DISK_ICON_NAME,
|
||||
!DEVICE.isMobile ? t("FORCE_SAVE") : "",
|
||||
async () => this.forceSave(),
|
||||
),
|
||||
isRaw: this.addAction(
|
||||
TEXT_DISPLAY_RAW_ICON_NAME,
|
||||
!DEVICE.isMobile ? t("RAW") : "",
|
||||
() => this.changeTextMode(TextMode.parsed),
|
||||
),
|
||||
link: this.addAction(
|
||||
"link",
|
||||
!DEVICE.isMobile ? t("OPEN_LINK") : "",
|
||||
(ev) => this.handleLinkClick(ev),
|
||||
),
|
||||
}
|
||||
/*this.actionButtons['isParsed'] = this.addAction(
|
||||
TEXT_DISPLAY_PARSED_ICON_NAME,
|
||||
t("PARSED"),
|
||||
() => this.changeTextMode(TextMode.raw),
|
||||
);*/
|
||||
|
||||
this.actionButtons['link'] = this.addAction("link", t("OPEN_LINK"), (ev) =>
|
||||
this.handleLinkClick(ev),
|
||||
);
|
||||
|
||||
this.registerDomEvent(this.ownerWindow, "resize", this.onExcalidrawResize.bind(this));
|
||||
const ro = new ResizeObserver(() => {
|
||||
const height = this.contentEl.clientHeight;
|
||||
const prevHeight = this.previousContentElHeight;
|
||||
const dh = prevHeight ? height - prevHeight : 0;
|
||||
this.previousContentElHeight = height;
|
||||
this.scheduleBatchedResize(dh);
|
||||
});
|
||||
this.previousContentElHeight = this.contentEl.clientHeight;
|
||||
ro.observe(this.contentEl);
|
||||
this.destroyers.push(() => ro.disconnect());
|
||||
|
||||
this.app.workspace.onLayoutReady(async () => {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.onload,`ExcalidrawView.onload > app.workspace.onLayoutReady, file:${this.file?.name}, isActiveLeaf:${this?.app?.workspace?.activeLeaf === this.leaf}, is activeExcalidrawView set:${Boolean(this?.plugin?.activeExcalidrawView)}`);
|
||||
@@ -2005,7 +2040,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
//I noticed Obsidian calls this function twice when disabling the plugin
|
||||
//once from "unregisterView"
|
||||
//the from "detachLeavesOfType"
|
||||
if(!this.dropManager) return; //the view is already closed
|
||||
if(!this.dropManager && !this.excalidrawRoot) return; //the view is already closed
|
||||
|
||||
// This happens when the user right clicks a tab and selects delete
|
||||
// in this case the onDelete event handler tirggers, but then Obsidian's delete event handler reaches onclose first, and
|
||||
@@ -2013,6 +2048,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if(!this.file) return;
|
||||
|
||||
this.exitFullscreen();
|
||||
|
||||
await this.forceSaveIfRequired();
|
||||
if (this.excalidrawRoot) {
|
||||
this.excalidrawRoot.unmount();
|
||||
@@ -2021,38 +2057,69 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
|
||||
this.clearPreventReloadTimer();
|
||||
this.clearEmbeddableNodeIsEditingTimer();
|
||||
this.plugin.scriptEngine?.removeViewEAs(this);
|
||||
if (this.activeLoader) {
|
||||
this.activeLoader.terminate = true;
|
||||
this.activeLoader = null;
|
||||
}
|
||||
if (this.nextLoader) {
|
||||
this.nextLoader.terminate = true;
|
||||
this.nextLoader = null;
|
||||
}
|
||||
if (this.plugin) {
|
||||
this.plugin.scriptEngine?.removeViewEAs(this);
|
||||
if(this.plugin.ea?.targetView === this) {
|
||||
this.plugin.ea.targetView = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.excalidrawAPI = null;
|
||||
|
||||
this.dropManager.destroy();
|
||||
this.dropManager = null;
|
||||
if (this.dropManager) {
|
||||
this.dropManager.destroy();
|
||||
this.dropManager = null;
|
||||
}
|
||||
|
||||
if(this.canvasNodeFactory) {
|
||||
this.canvasNodeFactory.destroy();
|
||||
this.canvasNodeFactory = null;
|
||||
}
|
||||
this.canvasNodeFactory = null;
|
||||
this.embeddableLeafRefs.clear();
|
||||
this.embeddableRefs.clear();
|
||||
Object.values(this.actionButtons).forEach((el) => el.remove());
|
||||
this.actionButtons = {} as Record<ActionButtons, HTMLElement>;
|
||||
|
||||
if(this.embeddableLeafRefs) {
|
||||
this.embeddableLeafRefs.clear();
|
||||
this.embeddableLeafRefs = null;
|
||||
}
|
||||
|
||||
if(this.embeddableRefs) {
|
||||
this.embeddableRefs.clear();
|
||||
this.embeddableRefs = null;
|
||||
}
|
||||
|
||||
if(this.actionButtons) {
|
||||
Object.values(this.actionButtons).forEach((el) => el.remove());
|
||||
this.actionButtons = null; //{} as Record<ActionButtons, HTMLElement>;
|
||||
}
|
||||
|
||||
if (this.excalidrawData) {
|
||||
this.excalidrawData.destroy();
|
||||
this.excalidrawData = null;
|
||||
};
|
||||
|
||||
if(this.exportDialog) {
|
||||
this.exportDialog.destroy();
|
||||
this.exportDialog = null;
|
||||
}
|
||||
|
||||
this.hoverPreviewTarget = null;
|
||||
if(this.plugin.ea?.targetView === this) {
|
||||
this.plugin.ea.targetView = null;
|
||||
}
|
||||
|
||||
if(this._hookServer?.targetView === this) {
|
||||
this._hookServer.targetView = null;
|
||||
}
|
||||
this._hookServer = null;
|
||||
this.containerEl.onWindowMigrated = null;
|
||||
this.packages = {react:null, reactDOM:null, excalidrawLib:null};
|
||||
if(this.containerEl) {
|
||||
this.containerEl.onWindowMigrated = null;
|
||||
}
|
||||
|
||||
this.packages = null; //{react:null, reactDOM:null, excalidrawLib:null};
|
||||
|
||||
let leafcount = 0;
|
||||
this.app.workspace.iterateAllLeaves(l=>{
|
||||
@@ -2062,7 +2129,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
leafcount++;
|
||||
}
|
||||
})
|
||||
if(leafcount === 0) {
|
||||
if(leafcount === 0 && this.plugin) {
|
||||
this.plugin.deletePackage(this.ownerWindow);
|
||||
}
|
||||
|
||||
@@ -2072,6 +2139,11 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
|
||||
//super.onClose will unmount Excalidraw, need to save before that
|
||||
await super.onClose();
|
||||
this._plugin = null;
|
||||
this._hookServer = null;
|
||||
this.excalidrawData = null;
|
||||
this.canvasNodeFactory = null;
|
||||
|
||||
tmpBruteForceCleanup(this);
|
||||
}
|
||||
|
||||
@@ -2099,11 +2171,42 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
this.removeParentMoveObserver();
|
||||
this.removeSlidingPanesListner();
|
||||
if (this.autosaveTimer) {
|
||||
window.clearInterval(this.autosaveTimer);
|
||||
window.clearTimeout(this.autosaveTimer);
|
||||
this.autosaveTimer = null;
|
||||
}
|
||||
this.autosaveFunction = null;
|
||||
|
||||
if (this.dropManager) {
|
||||
this.dropManager.destroy();
|
||||
this.dropManager = null;
|
||||
}
|
||||
|
||||
// Clear all other timers
|
||||
if (this.isEditingTextResetTimer) {
|
||||
window.clearTimeout(this.isEditingTextResetTimer);
|
||||
this.isEditingTextResetTimer = null;
|
||||
}
|
||||
if (this.preventReloadResetTimer) {
|
||||
window.clearTimeout(this.preventReloadResetTimer);
|
||||
this.preventReloadResetTimer = null;
|
||||
}
|
||||
if (this.editingSelfResetTimer) {
|
||||
window.clearTimeout(this.editingSelfResetTimer);
|
||||
this.editingSelfResetTimer = null;
|
||||
}
|
||||
if (this.resizeBatchTimer) {
|
||||
window.clearTimeout(this.resizeBatchTimer);
|
||||
this.resizeBatchTimer = null;
|
||||
}
|
||||
if (this.colorChangeTimer) {
|
||||
window.clearTimeout(this.colorChangeTimer);
|
||||
this.colorChangeTimer = null;
|
||||
}
|
||||
if (this.semaphores?.wheelTimeout) {
|
||||
window.clearTimeout(this.semaphores.wheelTimeout);
|
||||
this.semaphores.wheelTimeout = null;
|
||||
}
|
||||
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.onunload,`ExcalidrawView.onunload, completed`);
|
||||
}
|
||||
|
||||
@@ -2165,7 +2268,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
await this.excalidrawData.setTextMode(this.textMode);
|
||||
}
|
||||
this.excalidrawData.scene.appState.theme = api.getAppState().theme;
|
||||
await this.loadDrawing(loadOnModifyTrigger);
|
||||
await this.loadDrawing(loadOnModifyTrigger, undefined, true);
|
||||
this.clearDirty();
|
||||
}
|
||||
|
||||
@@ -2265,10 +2368,10 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if(filenameParts.hasSectionref) {
|
||||
query = [`# ${filenameParts.sectionref}`]
|
||||
} else if (state.line && state.line > 0) {
|
||||
query = [this.data.split("\n")[state.line - 1]];
|
||||
query = [this.data.split("\n")[state.line]]; //was -1 https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2503
|
||||
}
|
||||
|
||||
if (query) {
|
||||
if (query && query.length > 0 && !(query.length === 1 && query[0].length === 0)) {
|
||||
window.setTimeout(async () => {
|
||||
await waitForExcalidraw();
|
||||
|
||||
@@ -2277,6 +2380,15 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if (api.getAppState().isLoading) return;
|
||||
|
||||
const elements = api.getSceneElements() as ExcalidrawElement[];
|
||||
if(query.length === 1) {
|
||||
const elementId = query[0].match(/ \^([^ ]+)$/)?.[1] ?? query[0].match(/^([^ :]+): \[\[[^\]]+]]$/)?.[1];
|
||||
if(elementId && elements.find((el)=>el.id === elementId)) {
|
||||
this.preventAutozoom();
|
||||
window.setTimeout(()=>this.zoomToElements(!api.getAppState().viewModeEnabled, [elements.find((el)=>el.id === elementId)]));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(query.length === 1 && query[0].startsWith("[")) {
|
||||
const partsArray = REGEX_LINK.getResList(query[0]);
|
||||
@@ -2356,6 +2468,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if(this.lastLoadedFile === this.file) return;
|
||||
this.isLoaded = false;
|
||||
if(!this.file) return;
|
||||
if(this.plugin.settings.compareManifestToPluginVersion) checkVersionMismatch(this.plugin);
|
||||
if(this.plugin.settings.showNewVersionNotification) checkExcalidrawVersion();
|
||||
if(isMaskFile(this.plugin,this.file)) {
|
||||
const notice = new Notice(t("MASK_FILE_NOTICE"), 5000);
|
||||
@@ -2392,7 +2505,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if (this.compatibilityMode) {
|
||||
this.plugin.enableLegacyFilePopoverObserver();
|
||||
this.actionButtons['isRaw'].hide();
|
||||
this.actionButtons['isParsed'].hide();
|
||||
// this.actionButtons['isParsed'].hide();
|
||||
this.actionButtons['link'].hide();
|
||||
this.textMode = TextMode.raw;
|
||||
await this.excalidrawData.loadLegacyData(data, this.file);
|
||||
@@ -2545,7 +2658,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
const opacity = this.plugin.settings.gridSettings.OPACITY/100;
|
||||
|
||||
if (this.plugin.settings.gridSettings.DYNAMIC_COLOR) {
|
||||
// Dynamic color: concatenate opacity to the HEX string
|
||||
// Dynamic color: concatenate opacity to the RGB string !!! Excalidraw expects an RGBA string !!!
|
||||
Regular = (isDark ? cm.lighterBy(10) : cm.darkerBy(10)).alphaTo(opacity).stringRGB({ alpha: true });
|
||||
Bold = (isDark ? cm.lighterBy(5) : cm.darkerBy(5)).alphaTo(opacity).stringRGB({ alpha: true });
|
||||
} else {
|
||||
@@ -2556,7 +2669,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
// Regular uses the custom color directly
|
||||
Regular = customCM.alphaTo(opacity).stringRGB({ alpha: true });
|
||||
|
||||
// Bold is 7 shades lighter or darker based on the custom color's darkness
|
||||
// Bold is 10 shades lighter or darker based on the custom color's darkness
|
||||
Bold = (customIsDark ? customCM.lighterBy(10) : customCM.darkerBy(10)).alphaTo(opacity).stringRGB({ alpha: true });
|
||||
}
|
||||
|
||||
@@ -2778,9 +2891,10 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
*
|
||||
* @param justloaded - a flag to trigger zoom to fit after the drawing has been loaded
|
||||
*/
|
||||
public async loadDrawing(justloaded: boolean, deletedElements?: ExcalidrawElement[]) {
|
||||
public async loadDrawing(justloaded: boolean, deletedElements?: ExcalidrawElement[], isReloading: boolean = false) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.loadDrawing, "ExcalidrawView.loadDrawing", justloaded, deletedElements);
|
||||
const excalidrawData = this.excalidrawData.scene;
|
||||
const isOpenInMultipleLeaves = getExcalidraAndMarkdowViewsForFile(this.app,this.file).length > 1;
|
||||
this.semaphores.justLoaded = justloaded;
|
||||
this.clearDirty();
|
||||
const om = this.excalidrawData.getOpenMode();
|
||||
@@ -2798,7 +2912,6 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
//debug({where:"ExcalidrawView.loadDrawing",file:this.file.name,dataTheme:excalidrawData.appState.theme,before:"updateScene"})
|
||||
//api.setLocalFont(this.plugin.settings.experimentalEnableFourthFont);
|
||||
|
||||
|
||||
this.updateScene(
|
||||
{
|
||||
elements: excalidrawData.elements.concat(deletedElements??[]), //need to preserve deleted elements during autosave if images, links, etc. are updated
|
||||
@@ -2811,7 +2924,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
{
|
||||
//elements: excalidrawData.elements.concat(deletedElements??[]), //need to preserve deleted elements during autosave if images, links, etc. are updated
|
||||
appState: {
|
||||
...excalidrawData.appState,
|
||||
...isReloading && isOpenInMultipleLeaves
|
||||
? deleteAppStateKeys(excalidrawData.appState, ["scrollX","scrollY","zoom"])
|
||||
: excalidrawData.appState,
|
||||
...this.excalidrawData.selectedElementIds //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/609
|
||||
? this.excalidrawData.selectedElementIds
|
||||
: {},
|
||||
@@ -2821,7 +2936,6 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
zenModeEnabled,
|
||||
viewModeEnabled,
|
||||
linkOpacity: this.excalidrawData.getLinkOpacity(),
|
||||
trayModeEnabled: this.plugin.settings.defaultTrayMode,
|
||||
penMode: penEnabled,
|
||||
penDetected: penEnabled,
|
||||
allowPinchZoom: this.plugin.settings.allowPinchZoom,
|
||||
@@ -2846,14 +2960,15 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
this.instantiateExcalidraw({
|
||||
elements: excalidrawData.elements,
|
||||
appState: {
|
||||
...excalidrawData.appState,
|
||||
...isReloading && isOpenInMultipleLeaves
|
||||
? deleteAppStateKeys(excalidrawData.appState, ["scrollX","scrollY","zoom"])
|
||||
: excalidrawData.appState,
|
||||
...excalidrawData.appState.frameRendering && excalidrawData.appState.frameRendering.markerName === undefined
|
||||
? { frameRendering: {...excalidrawData.appState.frameRendering, markerName: true, markerEnabled: true } }
|
||||
: {},
|
||||
zenModeEnabled: om.zenModeEnabled,
|
||||
viewModeEnabled: excalidrawData.elements.length > 0 ? om.viewModeEnabled : false,
|
||||
linkOpacity: this.excalidrawData.getLinkOpacity(),
|
||||
trayModeEnabled: this.plugin.settings.defaultTrayMode,
|
||||
penMode: penEnabled,
|
||||
penDetected: penEnabled,
|
||||
allowPinchZoom: this.plugin.settings.allowPinchZoom,
|
||||
@@ -2893,6 +3008,8 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
this.loadSceneFiles();
|
||||
this.updateContainerSize(null, true, justloaded);
|
||||
this.initializeToolsIconPanelAfterLoading();
|
||||
const uiMode = calculateUIModeValue(this.plugin.settings);
|
||||
this.setUIMode(uiMode);
|
||||
}
|
||||
|
||||
public setDirty(location?:number) {
|
||||
@@ -3607,6 +3724,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
|
||||
api.updateContainerSize(api.getSceneElements().filter(el => newIds.includes(el.id)).filter(isContainer));
|
||||
api.refreshAllArrows();
|
||||
if (save) {
|
||||
await this.save(false); //preventReload=false will ensure that markdown links are paresed and displayed correctly
|
||||
} else {
|
||||
@@ -3681,6 +3799,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
frameRendering: st.frameRendering,
|
||||
objectsSnapModeEnabled: st.objectsSnapModeEnabled,
|
||||
activeTool,
|
||||
disableContextMenu: st.disableContextMenu,
|
||||
},
|
||||
prevTextMode: this.prevTextMode,
|
||||
files,
|
||||
@@ -3775,6 +3894,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
};
|
||||
|
||||
private showHoverPreview(linktext?: string, element?: ExcalidrawElement) {
|
||||
if(this.hoverPreviewTarget) return; //hover preview is already shown
|
||||
//(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.showHoverPreview, "ExcalidrawView.showHoverPreview", linktext, element);
|
||||
if(!this.lastMouseEvent) return;
|
||||
const st = this.excalidrawAPI?.getAppState();
|
||||
@@ -4002,7 +4122,12 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
st = (this.excalidrawAPI as ExcalidrawImperativeAPI).getAppState();
|
||||
canvasColor = canvasColor ?? st.viewBackgroundColor === "transparent" ? "white" : st.viewBackgroundColor;
|
||||
}
|
||||
window.setTimeout(()=>this.updateScene({appState:{gridColor: this.getGridColor(canvasColor, st)}, captureUpdate: CaptureUpdateAction.NEVER}));
|
||||
window.setTimeout(()=>this.updateScene(
|
||||
{
|
||||
appState:{
|
||||
gridColor: this.getGridColor(canvasColor, st),
|
||||
},
|
||||
captureUpdate: CaptureUpdateAction.NEVER}));
|
||||
}
|
||||
|
||||
public updateGridDirection(gridDirection: {horizontal: boolean, vertical: boolean}) {
|
||||
@@ -4047,7 +4172,23 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
}
|
||||
|
||||
private shouldSaveImportedImage: boolean = false;
|
||||
private onChange (et: ExcalidrawElement[], st: AppState) {
|
||||
if(st.activeTool?.type) {
|
||||
if(st.activeTool.type === "image") {
|
||||
if(st.selectedElementIds && Object.keys(st.selectedElementIds).length === 1) {
|
||||
const selectedElement = et.filter(el=>el.id === Object.keys(st.selectedElementIds)[0])[0];
|
||||
if(selectedElement && selectedElement.type === "image") {
|
||||
this.shouldSaveImportedImage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(st.activeTool.type === "selection" && this.shouldSaveImportedImage) {
|
||||
this.shouldSaveImportedImage = false;
|
||||
setTimeout(()=>this.save(true, true),100); //image is being added to the scene
|
||||
}
|
||||
}
|
||||
|
||||
if(st.newElement?.type === "freedraw") {
|
||||
this.freedrawLastActiveTimestamp = Date.now();
|
||||
}
|
||||
@@ -4064,7 +4205,9 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
if( elcount>0 && et.length===0 ) return;
|
||||
this.semaphores.justLoaded = false;
|
||||
if (!this.semaphores.preventAutozoom && this.plugin.settings.zoomToFitOnOpen) {
|
||||
this.zoomToFit(false,true);
|
||||
if(getExcalidraAndMarkdowViewsForFile(this.app, this.file).length === 1) {
|
||||
this.zoomToFit(false,true);
|
||||
}
|
||||
}
|
||||
this.previousSceneVersion = this.getSceneVersion(et);
|
||||
this.previousBackgroundColor = st.viewBackgroundColor;
|
||||
@@ -4112,8 +4255,8 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
source: GITHUB_RELEASES+PLUGIN_VERSION,
|
||||
libraryItems: items,
|
||||
};
|
||||
this.plugin.setStencilLibrary(lib);
|
||||
await this.plugin.saveSettings();
|
||||
|
||||
await this.plugin.setStencilLibrary(lib)
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -4237,7 +4380,12 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
}
|
||||
if (data.elements) {
|
||||
window.setTimeout(() => this.save(), 30); //removed prevent reload = false, as reload was triggered when pasted containers were processed and there was a conflict with the new elements
|
||||
//const onlyImages = data.elements.length > 0 && data.elements.every((el) => el.type === "image");
|
||||
//const preventReload = !onlyImages;
|
||||
data.elements.filter(el=>el.type==="text" || el.link).forEach(el=>
|
||||
updateElementIdsInScene({elements: data.elements as Mutable<ExcalidrawElement>[]},el, nanoid())
|
||||
);
|
||||
window.setTimeout(() => this.save(false), 30); //removed prevent reload = false, as reload was triggered when pasted containers were processed and there was a conflict with the new elements
|
||||
}
|
||||
|
||||
//process pasted text after it was processed into elements by Excalidraw
|
||||
@@ -4503,6 +4651,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
// - depending on the textMode, return the text with markdown markup or the parsed text
|
||||
// if quick parse was not successful return [null, null, null] to indicate that the no changes were made to the text element
|
||||
if (parseResultOriginal) {
|
||||
//const allowLinkSync = this.plugin.settings.allowLinkSync;
|
||||
//there were no transclusions in the raw text, quick parse was successful
|
||||
if (containerId) {
|
||||
this.updateContainerSize(containerId, true);
|
||||
@@ -5154,6 +5303,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
apiKey: this.plugin.settings.openAIAPIToken,
|
||||
text: textFromFrameChildren,
|
||||
theme: appState.theme,
|
||||
openAIURL: this.plugin.settings.openAIURL,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -5314,7 +5464,10 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
{
|
||||
icon: ICONS.trayMode,
|
||||
"aria-label": t("ARIA_LABEL_TRAY_MODE"),
|
||||
onSelect: ()=> this.toggleTrayMode(),
|
||||
onSelect: ()=> {
|
||||
const uiModes = new UIModeSettings(this.plugin);
|
||||
uiModes.open();
|
||||
},
|
||||
},
|
||||
t("TRAY_TRAY_MODE")
|
||||
) : null,
|
||||
@@ -5421,7 +5574,39 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
return this.obsidianMenu?.renderButton (isMobile, appState);
|
||||
}
|
||||
|
||||
private onExcalidrawResize () {
|
||||
private scheduleBatchedResize(currentDeltaHeight: number) {
|
||||
const api = this.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
if (!api || !api.isTouchScreen) return;
|
||||
|
||||
if (!this.resizeBatchTimer) {
|
||||
this.lastAggregatedDh = 0;
|
||||
this.resizeBatchWindowStart = Date.now();
|
||||
}
|
||||
|
||||
this.lastAggregatedDh += currentDeltaHeight;
|
||||
|
||||
if (this.resizeBatchTimer) window.clearTimeout(this.resizeBatchTimer);
|
||||
|
||||
const elapsed = Date.now() - this.resizeBatchWindowStart;
|
||||
const absoluteDelta = Math.abs(this.lastAggregatedDh);
|
||||
const deltaExceeded = absoluteDelta >= 80; // lower threshold to catch multi-step keyboards
|
||||
const windowExceeded = elapsed > 2000; // hard stop if the keyboard resizes in many tiny steps
|
||||
const debounceDelay = deltaExceeded ? 60 : 200; // short delay once we see large movement
|
||||
const finalDelay = windowExceeded ? 0 : debounceDelay;
|
||||
|
||||
this.resizeBatchTimer = window.setTimeout(() => {
|
||||
const dh = this.lastAggregatedDh;
|
||||
this.resizeBatchTimer = null;
|
||||
this.lastAggregatedDh = 0;
|
||||
this.resizeBatchWindowStart = 0;
|
||||
|
||||
if (Math.abs(dh) > 60) { // slightly lower than previous 120 to react earlier
|
||||
this.onExcalidrawResize();
|
||||
}
|
||||
}, finalDelay);
|
||||
}
|
||||
|
||||
private onExcalidrawResize() {
|
||||
try {
|
||||
const api = this.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
if(!api) return;
|
||||
@@ -5446,30 +5631,38 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
const isKeyboardOutEvent:Boolean = st.editingTextElement && !isEventOnSameElement;
|
||||
const isKeyboardBackEvent:Boolean = (this.semaphores.isEditingText || isEventOnSameElement) && !isKeyboardOutEvent;
|
||||
this.editingTextElementId = isKeyboardOutEvent ? st.editingTextElement.id : null;
|
||||
|
||||
if(isKeyboardOutEvent) {
|
||||
const appToolHeight = (this.contentEl.querySelector(".Island.App-toolbar") as HTMLElement)?.clientHeight ?? 0;
|
||||
const editingElViewY = sceneCoordsToViewportCoords({sceneX:0, sceneY:st.editingTextElement.y}, st).y;
|
||||
const scrollViewY = sceneCoordsToViewportCoords({sceneX:0, sceneY:-st.scrollY}, st).y;
|
||||
const delta = editingElViewY - scrollViewY;
|
||||
const isElementAboveKeyboard = height > (delta + appToolHeight*2)
|
||||
const excalidrawWrapper = this.excalidrawWrapperRef.current;
|
||||
//console.log({isElementAboveKeyboard});
|
||||
if(excalidrawWrapper && !isElementAboveKeyboard) {
|
||||
excalidrawWrapper.style.top = `${-(st.height - height)}px`;
|
||||
excalidrawWrapper.style.height = `${st.height}px`;
|
||||
this.excalidrawContainer?.querySelector(".App-bottom-bar")?.scrollIntoView();
|
||||
this.headerEl?.scrollIntoView();
|
||||
}
|
||||
const elTop = st.editingTextElement.y;
|
||||
const elHeight = (st.editingTextElement as any).height ?? 0;
|
||||
const elCenterY = elTop + elHeight / 2;
|
||||
|
||||
const visibleHeight = st.height / st.zoom.value;
|
||||
// visibleTop is -scrollY in scene coords
|
||||
const visibleTop = -st.scrollY;
|
||||
const topThreeQuarterThreshold = visibleTop + visibleHeight * 0.75;
|
||||
|
||||
// If the editing text element is in the top 3/4 of the visible screen, do not change scroll
|
||||
if (!(elCenterY >= visibleTop && elCenterY <= topThreeQuarterThreshold)) {
|
||||
// Otherwise, vertically center the editing text element in the visible area
|
||||
const desiredVisibleTop = elCenterY - visibleHeight / 2;
|
||||
const newScrollY = -desiredVisibleTop;
|
||||
|
||||
this.oldKeyboardScroll = {scrollY: st.scrollY, scrollX: st.scrollX};
|
||||
this.updateScene({appState: {scrollY: newScrollY}, captureUpdate: CaptureUpdateAction.NEVER});
|
||||
}
|
||||
|
||||
this.containerEl.scrollIntoView();
|
||||
}
|
||||
if(isKeyboardBackEvent) {
|
||||
const excalidrawWrapper = this.excalidrawWrapperRef.current;
|
||||
const appButtonBar = this.excalidrawContainer?.querySelector(".App-bottom-bar");
|
||||
const headerEl = this.headerEl;
|
||||
if(excalidrawWrapper) {
|
||||
excalidrawWrapper.style.top = "";
|
||||
excalidrawWrapper.style.height = "";
|
||||
appButtonBar?.scrollIntoView();
|
||||
headerEl?.scrollIntoView();
|
||||
if (isKeyboardBackEvent) {
|
||||
if(this.oldKeyboardScroll != null) {
|
||||
// Restore only vertical scroll; remove horizontal scroll completely
|
||||
this.updateScene({
|
||||
appState: {scrollY: this.oldKeyboardScroll.scrollY},
|
||||
captureUpdate: CaptureUpdateAction.NEVER
|
||||
});
|
||||
this.oldKeyboardScroll = null;
|
||||
this.containerEl.scrollIntoView();
|
||||
}
|
||||
}
|
||||
//end of aweful hack
|
||||
@@ -5605,6 +5798,8 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
saveAsImage: false,
|
||||
saveToActiveFile: false,
|
||||
},
|
||||
desktopUIMode: calculateUIModeValue(this.plugin.settings),
|
||||
//formFactor: DEVICE.isMobile ? "phone" : DEVICE.isTablet ? "tablet" : "desktop",
|
||||
},
|
||||
initState: initdata?.appState,
|
||||
initialData: initdata,
|
||||
@@ -5780,22 +5975,24 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
});
|
||||
}
|
||||
|
||||
public async toggleTrayMode() {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.toggleTrayMode, "ExcalidrawView.toggleTrayMode");
|
||||
public toggleEnableContextMenu() {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.toggleEnableContextMenu, "ExcalidrawView.toggleEnableContextMenu");
|
||||
const api = this.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
if (!api) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
const st = api.getAppState();
|
||||
api.updateScene({
|
||||
appState: { trayModeEnabled: !st.trayModeEnabled },
|
||||
captureUpdate: CaptureUpdateAction.NEVER,
|
||||
});
|
||||
const disableContextMenu = api.getAppState().disableContextMenu;
|
||||
this.updateScene({appState: {disableContextMenu: !disableContextMenu}, captureUpdate: CaptureUpdateAction.NEVER});
|
||||
}
|
||||
|
||||
//just in case settings were updated via Obsidian sync
|
||||
await this.plugin.loadSettings();
|
||||
this.plugin.settings.defaultTrayMode = !st.trayModeEnabled;
|
||||
this.plugin.saveSettings();
|
||||
public setUIMode(mode: UIMode) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.setUIMode, "ExcalidrawView.setDesktopUIMode");
|
||||
const api = this.excalidrawAPI as ExcalidrawImperativeAPI;
|
||||
if (mode === "phone") {
|
||||
return;
|
||||
}
|
||||
api.setDesktopUIMode(mode);
|
||||
api.setTrayModeEnabled(mode === "tray");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5931,110 +6128,19 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param prefix - defines the default button.
|
||||
* @returns
|
||||
*
|
||||
* @param prefix - defines the default button.
|
||||
* @returns
|
||||
*/
|
||||
public async copyLinkToSelectedElementToClipboard(prefix:string) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.copyLinkToSelectedElementToClipboard, "ExcalidrawView.copyLinkToSelectedElementToClipboard", prefix);
|
||||
const elements = this.getViewSelectedElements();
|
||||
if (elements.length < 1) {
|
||||
new Notice(t("INSERT_LINK_TO_ELEMENT_ERROR"));
|
||||
return;
|
||||
}
|
||||
|
||||
let elementId:string = undefined;
|
||||
|
||||
if(elements.length === 2) {
|
||||
const textEl = elements.filter(el=>el.type==="text");
|
||||
if(textEl.length===1 && (textEl[0] as ExcalidrawTextElement).containerId) {
|
||||
const container = elements.filter(el=>el.boundElements && el.boundElements.some(be=>be.type==="text"))
|
||||
if(container.length===1) {
|
||||
elementId = textEl[0].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!elementId) {
|
||||
elementId = elements.length === 1
|
||||
? elements[0].id
|
||||
: this.plugin.ea.getLargestElement(elements).id;
|
||||
}
|
||||
|
||||
const frames = elements.filter(el=>el.type==="frame");
|
||||
const hasFrame = frames.length === 1;
|
||||
const hasMarkerFrame = hasFrame && frames[0].frameRole === "marker";
|
||||
const hasGroup = elements.some(el=>el.groupIds && el.groupIds.length>0);
|
||||
|
||||
let button = {
|
||||
area: {caption: "Area", action:()=>{prefix="area="; return;}},
|
||||
link: {caption: "Link", action:()=>{prefix="";return}},
|
||||
group: {caption: "Group", action:()=>{prefix="group="; return;}},
|
||||
frame: {caption: "Frame", action:()=>{prefix="frame="; elementId = frames[0].id; return;}},
|
||||
clippedframe: {caption: "Clipped Frame", action:()=>{prefix="clippedframe="; ; elementId = frames[0].id; return;}},
|
||||
}
|
||||
|
||||
let buttons = [];
|
||||
switch(prefix) {
|
||||
case "area=":
|
||||
buttons = [
|
||||
button.area,
|
||||
button.link,
|
||||
...hasGroup ? [button.group] : [],
|
||||
...hasFrame && !hasMarkerFrame ? [button.clippedframe] : [],
|
||||
...hasFrame ? [button.frame] : [],
|
||||
];
|
||||
break;
|
||||
case "group=":
|
||||
buttons = [
|
||||
...hasGroup ? [button.group] : [],
|
||||
button.link,
|
||||
button.area,
|
||||
...hasFrame && !hasMarkerFrame ? [button.clippedframe] : [],
|
||||
...hasFrame ? [button.frame] : [],
|
||||
];
|
||||
break;
|
||||
case "frame=":
|
||||
buttons = [
|
||||
...hasFrame && !hasMarkerFrame ? [button.clippedframe] : [],
|
||||
...hasFrame ? [button.frame] : [],
|
||||
...hasGroup ? [button.group] : [],
|
||||
button.link,
|
||||
button.area,
|
||||
];
|
||||
break;
|
||||
case "clippedframe=":
|
||||
buttons = [
|
||||
...hasFrame && !hasMarkerFrame ? [button.clippedframe] : [],
|
||||
...hasFrame ? [button.frame] : [],
|
||||
...hasGroup ? [button.group] : [],
|
||||
button.link,
|
||||
button.area,
|
||||
];
|
||||
break;
|
||||
default:
|
||||
buttons = [
|
||||
{caption: "Link", action:()=>{prefix="";return}},
|
||||
{caption: "Area", action:()=>{prefix="area="; return;}},
|
||||
{caption: "Group", action:()=>{prefix="group="; return;}},
|
||||
...hasFrame && !hasMarkerFrame ? [button.clippedframe] : [],
|
||||
...hasFrame ? [button.frame] : [],
|
||||
]
|
||||
}
|
||||
|
||||
const alias = await ScriptEngine.inputPrompt(
|
||||
this,
|
||||
this.plugin,
|
||||
this.app,
|
||||
"Set link alias",
|
||||
"Leave empty if you do not want to set an alias",
|
||||
"",
|
||||
buttons,
|
||||
);
|
||||
navigator.clipboard.writeText(
|
||||
`${prefix.length>0?"!":""}[[${this.file.path}#^${prefix}${elementId}${alias ? `|${alias}` : ``}]]`,
|
||||
);
|
||||
new Notice(t("INSERT_LINK_TO_ELEMENT_READY"));
|
||||
public copyLinkToSelectedElementToClipboard(prefix: string) {
|
||||
(process.env.NODE_ENV === "development") &&
|
||||
DEBUGGING &&
|
||||
debug(
|
||||
this.copyLinkToSelectedElementToClipboard,
|
||||
"ExcalidrawView.copyLinkToSelectedElementToClipboard",
|
||||
prefix,
|
||||
);
|
||||
copyLinkToSelectedElementToClipboard(this, prefix);
|
||||
}
|
||||
|
||||
public updateScene(
|
||||
@@ -6107,10 +6213,15 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
}
|
||||
}
|
||||
|
||||
public updateEmbeddableRef(id: string, ref: HTMLIFrameElement | HTMLWebViewElement | null) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.updateEmbeddableRef, "ExcalidrawView.updateEmbeddableRef", id, ref);
|
||||
public updateEmbeddableRef(
|
||||
elementId: string,
|
||||
ref: HTMLIFrameElement | HTMLWebViewElement | null,
|
||||
) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.updateEmbeddableRef, "ExcalidrawView.updateEmbeddableRef", elementId, ref);
|
||||
if (ref) {
|
||||
this.embeddableRefs.set(id, ref);
|
||||
this.embeddableRefs.set(elementId, ref);
|
||||
} else {
|
||||
this.embeddableRefs.delete(elementId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6119,10 +6230,15 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
return this.embeddableRefs.get(id);
|
||||
}
|
||||
|
||||
public updateEmbeddableLeafRef(id: string, ref: any) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.updateEmbeddableLeafRef, "ExcalidrawView.updateEmbeddableLeafRef", id, ref);
|
||||
public updateEmbeddableLeafRef(
|
||||
elementId: string,
|
||||
ref?: any
|
||||
) {
|
||||
(process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.updateEmbeddableLeafRef, "ExcalidrawView.updateEmbeddableLeafRef", elementId, ref);
|
||||
if(ref) {
|
||||
this.embeddableLeafRefs.set(id, ref);
|
||||
this.embeddableLeafRefs.set(elementId, ref);
|
||||
} else {
|
||||
this.embeddableLeafRefs.delete(elementId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6165,4 +6281,4 @@ export function getTextMode(data: string): TextMode {
|
||||
data.search("excalidraw-plugin: parsed\n") > -1 ||
|
||||
data.search("excalidraw-plugin: locked\n") > -1; //locked for backward compatibility
|
||||
return parsed ? TextMode.parsed : TextMode.raw;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExcalidrawEmbeddableElement, } from "@zsviczian/excalidraw/types/element/src/types";
|
||||
import ExcalidrawView from "src/view/ExcalidrawView";
|
||||
import { Notice, WorkspaceLeaf, } from "obsidian";
|
||||
import { Notice, requireApiVersion, WorkspaceLeaf, } from "obsidian";
|
||||
import * as React from "react";
|
||||
import { isObsidianThemeDark } from "src/utils/obsidianUtils";
|
||||
import { DEVICE, EXTENDED_EVENT_TYPES, KEYBOARD_EVENT_TYPES, } from "src/constants/constants";
|
||||
@@ -367,8 +367,8 @@ function RenderObsidianView(
|
||||
const elementRef = React.useRef(element);
|
||||
const pdfObserverRef = React.useRef(null);
|
||||
const pdfObserverDisabledRef = React.useRef(false);
|
||||
// Keep-alive mobile patch cleanup holder
|
||||
const mobilePatchCleanupRef = React.useRef(null);
|
||||
const initialViewFileRef = React.useRef(view.file);
|
||||
|
||||
// Update themeRef when theme changes
|
||||
React.useEffect(() => {
|
||||
@@ -473,7 +473,9 @@ function RenderObsidianView(
|
||||
};
|
||||
|
||||
const createNode = (viewType: string) => {
|
||||
setKeepOnTop();
|
||||
if(!requireApiVersion("1.9.10")) {
|
||||
setKeepOnTop();
|
||||
}
|
||||
leafRef.current.node = view.canvasNodeFactory.createFileNote(file, subpath, containerRef.current, element.id);
|
||||
setColors(containerRef.current, element, mdProps, canvasColor, viewType);
|
||||
view.updateEmbeddableLeafRef(element.id, leafRef.current);
|
||||
@@ -540,6 +542,8 @@ function RenderObsidianView(
|
||||
try { mobilePatchCleanupRef.current?.(); } catch {}
|
||||
mobilePatchCleanupRef.current = null;
|
||||
|
||||
view.updateEmbeddableLeafRef(element.id);
|
||||
|
||||
if(!leafRef.current) {
|
||||
return;
|
||||
}
|
||||
@@ -547,7 +551,7 @@ function RenderObsidianView(
|
||||
leafRef.current.leaf?.detach();
|
||||
leafRef.current = null;
|
||||
}; //cleanup on unmount
|
||||
}, [linkText, subpath, containerRef]);
|
||||
}, [linkText, subpath, containerRef, element.id, file.path]);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
//Set colors of the canvas node
|
||||
@@ -679,6 +683,10 @@ function RenderObsidianView(
|
||||
//Switch to edit mode when markdown view is clicked
|
||||
//--------------------------------------------------------------------------------
|
||||
const handleClick = React.useCallback((event?: React.PointerEvent<HTMLElement>) => {
|
||||
if (view.file !== initialViewFileRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(isActiveRef.current) {
|
||||
event?.stopPropagation();
|
||||
}
|
||||
@@ -719,12 +727,15 @@ function RenderObsidianView(
|
||||
}, [leafRef.current?.leaf, element.id, view, themeRef.current, isActiveRef.current, isEditingRef.current, viewTypeRef.current]);
|
||||
|
||||
const startEditing = React.useCallback(() => {
|
||||
if (view.file !== initialViewFileRef.current) {
|
||||
return;
|
||||
}
|
||||
if(isActiveRef.current && isEditingRef.current) {
|
||||
return;
|
||||
}
|
||||
isActiveRef.current = true;
|
||||
handleClick();
|
||||
}, [isActiveRef.current, isEditingRef.current, handleClick]);
|
||||
}, [isActiveRef.current, isEditingRef.current, handleClick, view]);
|
||||
|
||||
if(leafRef.current) leafRef.current.editNode = startEditing;
|
||||
// Event listener for key press
|
||||
@@ -759,6 +770,10 @@ function RenderObsidianView(
|
||||
// Set isActiveRef and switch to preview mode when the embeddable is not active
|
||||
//--------------------------------------------------------------------------------
|
||||
React.useEffect(() => {
|
||||
if (view.file !== initialViewFileRef.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!containerRef?.current || !leafRef?.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -257,7 +257,12 @@ export class ObsidianMenu {
|
||||
|
||||
public renderButton (isMobile: boolean, appState: AppState) {
|
||||
return (
|
||||
<>
|
||||
<div className={clsx(
|
||||
{
|
||||
"ExcalidrawObsidianMenu--mobile": isMobile,
|
||||
"ExcalidrawObsidianMenu": !isMobile,
|
||||
},
|
||||
)}>
|
||||
<label
|
||||
className={clsx(
|
||||
"ToolIcon",
|
||||
@@ -288,7 +293,7 @@ export class ObsidianMenu {
|
||||
</label>
|
||||
{this.renderCustomPens(isMobile,appState)}
|
||||
{this.renderPinnedScriptButtons(isMobile,appState)}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user