mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0320307324 | ||
|
|
90928f9905 | ||
|
|
f4668f2b35 | ||
|
|
1d8b5d9942 | ||
|
|
4f880120b7 | ||
|
|
4269c78fc3 | ||
|
|
d82c558daf | ||
|
|
a6009a5c49 | ||
|
|
0b1fb8a443 | ||
|
|
fde2f117d3 | ||
|
|
106340efc5 | ||
|
|
ab9463c0a5 | ||
|
|
288cfe6013 | ||
|
|
33acdb5d29 | ||
|
|
620e397947 | ||
|
|
9fa9394592 | ||
|
|
e989e64fd6 | ||
|
|
779e413ed8 | ||
|
|
73a90fda05 | ||
|
|
8d9efe1e38 | ||
|
|
1136ebc88a | ||
|
|
40a0694a0f | ||
|
|
123cac8e00 | ||
|
|
c140f24473 | ||
|
|
f2a911c47c | ||
|
|
30eb992484 | ||
|
|
bb3eb684c0 |
No files matched your search
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "Node.js 20",
|
||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:20",
|
||||
"name": "Node.js 22",
|
||||
"image": "mcr.microsoft.com/devcontainers/javascript-node:22",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"version": "20"
|
||||
"version": "22"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "npm install",
|
||||
@@ -14,4 +14,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,11 @@ jobs:
|
||||
steps:
|
||||
# 1. Pull down your repository code
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# 2. Tell the server to install Node 22
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
|
||||
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 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square-heart-icon lucide-message-square-heart"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/><path d="M7.5 9.5c0 .687.265 1.383.697 1.844l3.009 3.264a1.14 1.14 0 0 0 .407.314 1 1 0 0 0 .783-.004 1.14 1.14 0 0 0 .398-.31l3.008-3.264A2.77 2.77 0 0 0 16.5 9.5 2.5 2.5 0 0 0 12 8a2.5 2.5 0 0 0-4.5 1.5"/></svg>
|
||||
|
After Width: | Height: | Size: 597 B |
@@ -678,5 +678,13 @@
|
||||
{
|
||||
"fname": "Color Scheme Manager.svg",
|
||||
"mtime": 1780595297314
|
||||
},
|
||||
{
|
||||
"fname": "Comicbook Callout Editor.md",
|
||||
"mtime": 1782492853631
|
||||
},
|
||||
{
|
||||
"fname": "Comicbook Callout Editor.svg",
|
||||
"mtime": 1781961241320
|
||||
}
|
||||
]
|
||||
@@ -74,6 +74,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/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]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Capture%20Note.svg"/></div>|[[#Capture Note]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Comicbook%20Callout%20Editor.svg"/></div>|[[#Comicbook Callout Editor]]|
|
||||
|
||||
## Layout and Organization
|
||||
**Keywords**: Design, Placement, Arrangement, Structure, Formatting, Alignment
|
||||
@@ -118,6 +119,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/Comicbook%20Callout%20Editor.svg"/></div>|[[#Comicbook Callout Editor]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Convert%20selected%20text%20elements%20to%20sticky%20notes.svg"/></div>|[[#Convert selected text elements to sticky notes]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Relative%20Font%20Size%20Cycle.svg"/></div>|[[#Relative Font Size Cycle]]|
|
||||
|<div><img src="https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Scribble%20Helper.svg"/></div>|[[#Scribble Helper]]|
|
||||
@@ -284,6 +286,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/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/Color%20Scheme%20Manager.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Swap the entire Stroke and Background/Fill colour palettes between named, categorized themes (Cloud Providers, Code Editors, Tech Brands, Design Systems, Nature, and more) from a docked side panel. Applying a theme recolours your selection (or sets the active colour) and repaints the native picker — both the quick-pick rows and the extended 3×5 grid with shades. Create your own schemes, import from a flat hex list, a labelled STROKE/FILL text format, or a raw appState colorPalette JSON (paste or .txt/.json file), hand-pick a custom picker, and export the current palette. When the MindMap Builder script is installed, an optional toggle recolours mind maps branch-by-branch. The canvas background is always left white.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/color-scheme-manager.gif' style="width:560px;"></td></tr></table>
|
||||
|
||||
## Comicbook Callout Editor
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Comicbook%20Callout%20Editor.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/Comicbook%20Callout%20Editor.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data"><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-comicbook-callout-editor.jpg'></td></tr></table>
|
||||
|
||||
|
||||
## Concatenate lines
|
||||
```excalidraw-script-install
|
||||
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Concatenate%20lines.md
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 564 KiB |
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.24.1",
|
||||
"version": "2.25.0-beta.0",
|
||||
"minAppVersion": "1.8.7",
|
||||
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.24.1",
|
||||
"version": "2.24.2",
|
||||
"minAppVersion": "1.8.7",
|
||||
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
Generated
+4
-4
@@ -13,7 +13,7 @@
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@radix-ui/number": "^1.1.2",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
"@zsviczian/excalidraw": "0.18.105",
|
||||
"@zsviczian/excalidraw": "0.18.108",
|
||||
"chroma-js": "^3.1.2",
|
||||
"clsx": "^2.0.0",
|
||||
"es6-promise-pool": "2.5.0",
|
||||
@@ -5232,9 +5232,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@zsviczian/excalidraw": {
|
||||
"version": "0.18.105",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.105.tgz",
|
||||
"integrity": "sha512-SOwKicgUPuz2rgOGGmAK3uuespob7knGoriHo82dfVrPT4eM1WhFNiDbGpnWql+PdkhwHrLG4ZcGpiXxAv/kRw==",
|
||||
"version": "0.18.108",
|
||||
"resolved": "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.18.108.tgz",
|
||||
"integrity": "sha512-vSBbcC4m3PcEb9sfgCdqRDYHU8gkR4S34VEAsfQi4M6aMvoMHw95IJMP8DtSIvETakesQ24XEQXnnRDUjx+44g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
|
||||
+3
-3
@@ -16,8 +16,8 @@
|
||||
"code:unused": "eslint --max-warnings=0 --ext .ts,.tsx ./src --quiet --format json | node -e \"let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{const r=JSON.parse(d);for(const f of r){for(const m of f.messages||[]){if(m.ruleId==='@typescript-eslint/no-unused-vars'||m.ruleId==='no-unused-vars'){console.log(f.filePath+':'+m.line+':'+m.column+' '+m.ruleId+' '+m.message);}}}})\"",
|
||||
"code:escape": "eslint --max-warnings=0 --ext .ts,.tsx ./src --quiet --format json | node -e \"let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{const r=JSON.parse(d);for(const f of r){for(const m of f.messages||[]){if(m.ruleId==='no-useless-escape'){console.log(f.filePath+':'+m.line+':'+m.column+' '+m.ruleId+' '+m.message);}}}})\"",
|
||||
"madge": "madge --circular .",
|
||||
"doc": "npm run lib && node scripts/generate-script-library.js",
|
||||
"mindmap": "node scripts/deploy-mindmap-builder.js",
|
||||
"doc": "npm run lib && node scripts/generate-script-library.mjs",
|
||||
"mindmap": "node scripts/deploy-mindmap-builder.mjs",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "npx prettier --write \"src/**/*.{ts,tsx}\" && eslint --max-warnings=0 --ext .ts,.tsx ./src --fix"
|
||||
},
|
||||
@@ -29,7 +29,7 @@
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@radix-ui/number": "^1.1.2",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
"@zsviczian/excalidraw": "0.18.105",
|
||||
"@zsviczian/excalidraw": "0.18.108",
|
||||
"chroma-js": "^3.1.2",
|
||||
"clsx": "^2.0.0",
|
||||
"es6-promise-pool": "2.5.0",
|
||||
|
||||
@@ -151,6 +151,7 @@ const packageString = isLib
|
||||
' for (let i = 0; i < len; i++) bytes[i] = binStr.charCodeAt(i);\n' +
|
||||
' return new TextDecoder().decode(pako.inflate(bytes));\n' +
|
||||
'};\n' +
|
||||
'window.unpackBase64Deflate = unpackBase64Deflate;\n' +
|
||||
'const unpackExcalidraw = () => unpackBase64Deflate("' + compressDeflateBase64(excalidraw_pkg) + '");\n' +
|
||||
'let {react, reactDOM } = new Function(`${REACT_PACKAGES}; return {react: React, reactDOM: ReactDOM};`)();\n' +
|
||||
'let excalidrawLib = {};\n' +
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs/promises");
|
||||
const { minify } = require("terser");
|
||||
const LZString = require("lz-string");
|
||||
import path from "path";
|
||||
import fs from "fs/promises";
|
||||
import { minify } from "terser";
|
||||
import LZString from "lz-string";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
// Construct __dirname for ES Modules
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const CHUNK_SIZE = 256;
|
||||
const NEEDLE = "const removeKeydownHandlers";
|
||||
@@ -1,5 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const { execSync } = require('child_process');
|
||||
import fs from 'fs';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const content = fs.readFileSync('src/lang/locale/en.ts', 'utf8');
|
||||
const lines = content.split('\n');
|
||||
@@ -29,4 +29,4 @@ for (const key of keys) {
|
||||
}
|
||||
|
||||
unusedKeys.sort().forEach(k => console.log(k));
|
||||
console.log('Total: ' + unusedKeys.length);
|
||||
console.log('Total: ' + unusedKeys.length);
|
||||
@@ -1,7 +1,12 @@
|
||||
/* eslint-disable no-console */
|
||||
// to run: npm run doc
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
// to run: node generate-script-library.mjs
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
// Reconstruct __dirname for ES Modules
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
const EA_SCRIPTS_DIR = path.join(ROOT, 'ea-scripts');
|
||||
@@ -617,17 +622,17 @@ function main() {
|
||||
|
||||
const combined =
|
||||
(AI_TRAINING_INTRO +
|
||||
'\n---\n\n' +
|
||||
typeDefContent.trim() +
|
||||
'\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
|
||||
'\n---\n\n' +
|
||||
typeDefContent.trim() +
|
||||
'\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);
|
||||
@@ -638,11 +643,12 @@ function main() {
|
||||
console.log('[script-library] Done.');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
// ESM equivalent of `if (require.main === module)`
|
||||
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
||||
try {
|
||||
main();
|
||||
} catch (e) {
|
||||
console.error('[script-library] Failed:', e);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,8 @@ export const ICONS = {
|
||||
</text>
|
||||
</svg>
|
||||
),
|
||||
Edit: getIconAsJSX("pen-line"),
|
||||
Read: getIconAsJSX("book-open"),
|
||||
Learn: getIconAsJSX("graduation-cap"),
|
||||
Github: getIconAsJSX("github"),
|
||||
YouTube: getIconAsJSX("youtube"),
|
||||
|
||||
+1
-2
@@ -1029,9 +1029,8 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
|
||||
public async awaitInit() {
|
||||
let counter = 0;
|
||||
while ((!this.isReady || !this.fontsReady) && counter < 200) {
|
||||
while ((!this.isReady || !this.fontsReady) && counter++ < 200) {
|
||||
await sleep(50);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import { linkPrompt } from "../../shared/Dialogs/Prompt";
|
||||
import {
|
||||
isInstanceOfHTMLElement,
|
||||
isInstanceOfHTMLImageElement,
|
||||
isInstanceOfSVGElement,
|
||||
} from "../../utils/typechecks";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
import { setElementDisplay } from "src/utils/htmlUtils";
|
||||
@@ -580,7 +581,7 @@ const createImgElement = async (
|
||||
|
||||
let timer: number;
|
||||
const clickEvent = (ev: PointerEvent) => {
|
||||
if (!isInstanceOfHTMLElement(ev.target)) {
|
||||
if (!(isInstanceOfHTMLElement(ev.target) || isInstanceOfSVGElement(ev.target))) {
|
||||
return;
|
||||
}
|
||||
const targetElement = ev.target;
|
||||
@@ -1088,7 +1089,7 @@ const tmpObsidianWYSIWYG = async (
|
||||
internalEmbedDiv.removeClass("inline-embed");
|
||||
internalEmbedDiv.addClass("media-embed");
|
||||
internalEmbedDiv.addClass("image-embed");
|
||||
if (!onCanvas && isInstanceOfHTMLElement(imgDiv.firstChild)) {
|
||||
if (!onCanvas && (isInstanceOfHTMLElement(imgDiv.firstChild) || isInstanceOfSVGElement(imgDiv.firstChild))) {
|
||||
setStyle(imgDiv.firstChild, {
|
||||
maxHeight: "100%",
|
||||
maxWidth: null,
|
||||
|
||||
@@ -748,6 +748,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
borderColor: "#fff",
|
||||
borderOpacity: 0,
|
||||
filenameVisible: false,
|
||||
lockedReadingMode: false,
|
||||
},
|
||||
markdownNodeOneClickEditing: false,
|
||||
canvasImmersiveEmbed: true,
|
||||
|
||||
@@ -1290,6 +1290,11 @@ export default {
|
||||
ES_YOUTUBE_START_INVALID:
|
||||
"The YouTube Start Time is invalid. Please check the format and try again",
|
||||
ES_FILENAME_VISIBLE: "Filename Visible",
|
||||
ES_LOCKED_READING_MODE_HEAD: "Locked Reading Mode",
|
||||
ES_LOCKED_READING_MODE_DESC:
|
||||
"When enabled, interacting with the markdown embeddable will not switch it to edit mode. This is useful for checklists and habit trackers.",
|
||||
LOCK_READING_MODE: "Lock Reading Mode",
|
||||
UNLOCK_READING_MODE: "Unlock Reading Mode",
|
||||
ES_BACKGROUND_HEAD: "Embedded note background color",
|
||||
ES_BACKGROUND_DESC_INFO: "Click here for more info on colors",
|
||||
ES_BACKGROUND_DESC_DETAIL:
|
||||
|
||||
@@ -53,7 +53,19 @@ export class EmbeddalbeMDFileCustomDataSettingsComponent {
|
||||
this.mdCustomData.filenameVisible = value;
|
||||
}),
|
||||
);
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName(t("ES_LOCKED_READING_MODE_HEAD"))
|
||||
.setDesc(t("ES_LOCKED_READING_MODE_DESC"))
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(!!this.mdCustomData.lockedReadingMode)
|
||||
.onChange((value) => {
|
||||
this.mdCustomData.lockedReadingMode = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
contentEl.createEl("h4", { text: t("ES_BACKGROUND_HEAD") });
|
||||
const descDiv = contentEl.createDiv({ cls: "excalidraw-setting-desc" });
|
||||
descDiv.textContent = t("ES_BACKGROUND_DESC_INFO");
|
||||
|
||||
@@ -32,6 +32,7 @@ export type EmbeddableMDCustomProps = {
|
||||
borderColor: string;
|
||||
borderOpacity: number;
|
||||
filenameVisible: boolean;
|
||||
lockedReadingMode?: boolean;
|
||||
};
|
||||
|
||||
export class EmbeddableSettings extends Modal {
|
||||
@@ -66,9 +67,9 @@ export class EmbeddableSettings extends Modal {
|
||||
this.youtubeStart = getYouTubeStartAt(this.element.link);
|
||||
}
|
||||
|
||||
this.mdCustomData =
|
||||
element.customData?.mdProps ??
|
||||
view.plugin.settings.embeddableMarkdownDefaults;
|
||||
this.mdCustomData = (element.customData?.mdProps ??
|
||||
view.plugin.settings
|
||||
.embeddableMarkdownDefaults) as EmbeddableMDCustomProps;
|
||||
if (!element.customData?.mdProps) {
|
||||
const bgCM = this.plugin.ea.getCM(element.backgroundColor);
|
||||
this.mdCustomData.backgroundColor = bgCM.stringHEX({ alpha: false });
|
||||
|
||||
@@ -16,6 +16,23 @@ export const RELEASE_NOTES: { [k: string]: string } = {
|
||||
I build this plugin as a labor of love. Curious about the philosophy behind it? Check out [📕 Sketch Your Mind](${URLs.COMMUNITY_SKETCH_YOUR_MIND_COM_SYM}). Want to master Excalidraw? Join [Excalidraw Mastery](${URLs.COMMUNITY_SKETCH_YOUR_MIND_COM_EM}). If you find it valuable, say "Thank you", and
|
||||
|
||||
<div class="ex-coffee-div"><a href="${URLs.KO_FI_COM_ZSOLT}"><img src="${URLs.CDN_KO_FI_COM_CDN_KOFI3_PNG}" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
|
||||
`,
|
||||
"2.25.0": `
|
||||
## New
|
||||
- Imporved ink flow for freedraw pen
|
||||
- You can now toggle between pressure sensitive and constant mode for the default excalidraw.com freedraw pen. [#11507](${URLs.GITHUB_COM_EXCALIDRAW_EXCALIDRAW_PULL}/11507), [#11551](${URLs.GITHUB_COM_EXCALIDRAW_EXCALIDRAW_PULL}/11551)
|
||||
- Comicbook Callout Editor script available in the Script Libarary
|
||||
- Added new ExtraBold line width option, and XS font option
|
||||
|
||||
## Fixed
|
||||
- BUG: Double Click to edit from Obsidian in Live preview doesn't work anymore [#2813](${URLs.GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_ISSUES}/2813)
|
||||
`,
|
||||
"2.24.2": `
|
||||
## Fixed
|
||||
- High impact regression in 2.24.0: Translations were not loading correctly. 🙏[@Lumintian](${URLs.GITHUB_COM}/Lumintian) [#2809](${URLs.GITHUB_COM_ZSVICZIAN_OBSIDIAN_EXCALIDRAW_PLUGIN_PULL}/2809)
|
||||
|
||||
## New
|
||||
- Added lock reading mode to markdown embeddables. If reading mode is locked, clicking the embeddable will not switch to the editor. This is useful for interacting with todo lists, links, and other interactive elements in the embeddables. Based on feedback from the Sketch Your Mind Community. 🙏[@robb3r](${URLs.COMMUNITY_SKETCH_YOUR_MIND_COM}/u/robb3r)
|
||||
`,
|
||||
"2.24.1": `
|
||||
To keep Excalidraw lightweight, improve startup performance, reduce plugin size, and address Obsidian's high-risk code scanner findings, several advanced features have been moved to the new **Excalidraw Extras** companion plugin in 2.24.0.
|
||||
|
||||
@@ -160,6 +160,7 @@ import {
|
||||
ensureActiveScriptSettingsObject,
|
||||
errorMessage,
|
||||
filterColorMap,
|
||||
getAppStateStrokeWidthEntry,
|
||||
getEmbeddedFileForImageElment,
|
||||
getLineBox,
|
||||
getTemplate,
|
||||
@@ -205,6 +206,7 @@ import { getAspectRatio } from "src/utils/YoutTubeUtils";
|
||||
import { getPDFCropRect } from "src/utils/PDFUtils";
|
||||
import { CaptureUpdateActionType } from "@zsviczian/excalidraw/types/element/src";
|
||||
import { URL_REGISTRY } from "src/constants/safeUrls";
|
||||
import { FREEDRAW_STROKE_WIDTH, StrokeWidthKey } from "@zsviczian/excalidraw/types/common/src";
|
||||
|
||||
type ExcalidrawAutomateHelpTarget = ((...args: unknown[]) => unknown) | string;
|
||||
|
||||
@@ -1446,8 +1448,10 @@ export class ExcalidrawAutomate {
|
||||
this.style.backgroundColor,
|
||||
currentItemFillStyle:
|
||||
templateAppstate.currentItemFillStyle ?? this.style.fillStyle,
|
||||
currentItemStrokeWidth:
|
||||
...getAppStateStrokeWidthEntry (
|
||||
templateAppstate.currentItemStrokeWidthKey,
|
||||
templateAppstate.currentItemStrokeWidth ?? this.style.strokeWidth,
|
||||
),
|
||||
currentItemStrokeStyle:
|
||||
templateAppstate.currentItemStrokeStyle ?? this.style.strokeStyle,
|
||||
currentItemRoughness:
|
||||
@@ -4838,6 +4842,10 @@ export class ExcalidrawAutomate {
|
||||
getPolyBool(): typeof PolyBool {
|
||||
const defaultEpsilon = 0.0000000001;
|
||||
PolyBool.epsilon(defaultEpsilon);
|
||||
|
||||
if ("buildLog" in PolyBool) {
|
||||
PolyBool.buildLog(false);
|
||||
}
|
||||
return PolyBool;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
declare module "polybooljs" {
|
||||
interface PolyBoolStatic {
|
||||
epsilon(value: number): void;
|
||||
buildLog(value: boolean): void;
|
||||
}
|
||||
|
||||
const PolyBool: PolyBoolStatic;
|
||||
|
||||
@@ -13,7 +13,7 @@ const REQUIRED_EXTRAS_VERSIONS: Record<
|
||||
string,
|
||||
{ min?: string; exact?: string }
|
||||
> = {
|
||||
plugin: { min: "0.0.13" },
|
||||
plugin: { min: "0.0.14" },
|
||||
mathjax: { min: "1.0.0" },
|
||||
mermaid: { exact: "2.2.2" },
|
||||
pdf: { min: "1.0.0" },
|
||||
|
||||
@@ -14,6 +14,7 @@ export const setDynamicStyle = (
|
||||
dynamicStyle: DynamicStyle,
|
||||
textBackgroundColor?: string,
|
||||
) => {
|
||||
color = color ?? "white";
|
||||
if (dynamicStyle === "none") {
|
||||
//view.excalidrawContainer?.removeAttribute("style");
|
||||
window.setTimeout(() =>
|
||||
@@ -24,7 +25,8 @@ export const setDynamicStyle = (
|
||||
);
|
||||
const toolspanel = view.toolsPanelRef?.current?.containerRef?.current;
|
||||
if (toolspanel) {
|
||||
let toolsStyle = toolspanel.getAttribute("style");
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2810
|
||||
let toolsStyle = toolspanel.getAttribute("style") ?? "";
|
||||
toolsStyle = toolsStyle.replace(/--color-primary.*/, "");
|
||||
toolspanel.setAttribute("style", toolsStyle);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ import {
|
||||
import { ScriptEngine } from "src/shared/Scripts";
|
||||
import { ColorMap, FileData } from "src/types/embeddedFileLoaderTypes";
|
||||
import { ExportSettings } from "src/types/exportUtilTypes";
|
||||
import type { StrokeWidthKey } from "@zsviczian/excalidraw/types/common/src/constants";
|
||||
|
||||
declare const PLUGIN_VERSION: string;
|
||||
|
||||
@@ -1108,3 +1109,57 @@ export function ensureActiveScriptSettingsObject(
|
||||
ScriptSettingValue
|
||||
>;
|
||||
}
|
||||
|
||||
export const getStrokeKeyFormLegacyWidth = (strokeWidth: number): StrokeWidthKey => {
|
||||
switch(strokeWidth) {
|
||||
case 0.5:
|
||||
return "thin";
|
||||
case 1:
|
||||
return "medium";
|
||||
case 2:
|
||||
return "bold";
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns an appState key for the stroke width
|
||||
// excalidraw.com deprected and removed currentItemStrokeWidth from appState
|
||||
// but the plugin still supports it to allow custom line width settings for scripts and custom pens
|
||||
// if the legacy stroke width is provided, it will be converted to the corresponding stroke width key
|
||||
// if there is a matching key, the key will be preferred over the legacy stroke width value
|
||||
// if there is no matching key, the legacy stroke width value will be used
|
||||
export const getAppStateStrokeWidthEntry = (strokeWidthKey:StrokeWidthKey, legacyStrokeWidth: number) => {
|
||||
if (legacyStrokeWidth !== undefined) {
|
||||
strokeWidthKey = getStrokeKeyFormLegacyWidth(legacyStrokeWidth);
|
||||
}
|
||||
if (!!legacyStrokeWidth && !strokeWidthKey) {
|
||||
return { currentItemStrokeWidth: legacyStrokeWidth };
|
||||
}
|
||||
if (!strokeWidthKey) {
|
||||
return {};
|
||||
}
|
||||
return {currentItemStrokeWidthKey: strokeWidthKey};
|
||||
}
|
||||
|
||||
//replicated from excalidraw constants.ts
|
||||
const FREEDRAW_STROKE_WIDTH: Readonly<
|
||||
Record<StrokeWidthKey | "extraBold", ExcalidrawElement["strokeWidth"]>
|
||||
> = {
|
||||
extraThin: 0.25,
|
||||
thin: 0.5,
|
||||
medium: 1,
|
||||
bold: 2,
|
||||
extraBold: 4, // legacy (may be used again in the future)
|
||||
};
|
||||
|
||||
//based on excalidraw constants.ts getStrokeWidthByKey
|
||||
export const getFreedrawStrokeWidthByKey = (
|
||||
strokeWidthKey: StrokeWidthKey,
|
||||
strokeWidth?: number,
|
||||
): ExcalidrawElement["strokeWidth"] => {
|
||||
if (strokeWidth) {
|
||||
return strokeWidth;
|
||||
}
|
||||
return FREEDRAW_STROKE_WIDTH[strokeWidthKey];
|
||||
};
|
||||
@@ -32,7 +32,7 @@ type StyleObject = Partial<CSSStyleDeclaration> & {
|
||||
};
|
||||
|
||||
export const setStyle = (
|
||||
element: HTMLElement | SVGSVGElement | null | undefined,
|
||||
element: HTMLElement | SVGElement | null | undefined,
|
||||
styles: StyleObject,
|
||||
): void => {
|
||||
if (!element) {
|
||||
|
||||
@@ -267,6 +267,7 @@ import {
|
||||
getFrameElementsMatchingQuery,
|
||||
getElementsWithLinkMatchingQuery,
|
||||
getImagesMatchingQuery,
|
||||
getAppStateStrokeWidthEntry,
|
||||
} from "src/utils/excalidrawAutomateUtils";
|
||||
import { getYouTubeUrl, URLs } from "src/constants/safeUrls";
|
||||
import { setStyle } from "src/utils/styleUtils";
|
||||
@@ -479,6 +480,7 @@ export default class ExcalidrawView
|
||||
private previousSceneVersion = 0;
|
||||
public previousBackgroundColor = "";
|
||||
public previousTheme = "";
|
||||
private pendingUIMode: UIMode | null = null;
|
||||
|
||||
//variables used to handle click events in view mode
|
||||
private selectedTextElement: SelectedElementWithLink | null = null;
|
||||
@@ -1674,6 +1676,9 @@ export default class ExcalidrawView
|
||||
}
|
||||
|
||||
exitFullscreen() {
|
||||
if (!this.isFullscreen()) {
|
||||
return;
|
||||
}
|
||||
if (this.toolsPanelRef && this.toolsPanelRef.current) {
|
||||
this.toolsPanelRef.current.setFullscreen(false);
|
||||
}
|
||||
@@ -2731,6 +2736,8 @@ export default class ExcalidrawView
|
||||
//I noticed Obsidian calls this function twice when disabling the plugin
|
||||
//once from "unregisterView"
|
||||
//the from "detachLeavesOfType"
|
||||
this.clearPreventReloadTimer();
|
||||
this.clearEmbeddableNodeIsEditingTimer();
|
||||
if (!this.dropManager && !this.excalidrawRoot) {
|
||||
return;
|
||||
} //the view is already closed
|
||||
@@ -2750,8 +2757,6 @@ export default class ExcalidrawView
|
||||
this.excalidrawRoot = null;
|
||||
}
|
||||
|
||||
this.clearPreventReloadTimer();
|
||||
this.clearEmbeddableNodeIsEditingTimer();
|
||||
this.cancelDeferredSceneFileValidation();
|
||||
if (this.activeLoader) {
|
||||
this.activeLoader.terminate = true;
|
||||
@@ -5016,7 +5021,8 @@ export default class ExcalidrawView
|
||||
currentItemStrokeColor: st.currentItemStrokeColor,
|
||||
currentItemBackgroundColor: st.currentItemBackgroundColor,
|
||||
currentItemFillStyle: st.currentItemFillStyle,
|
||||
currentItemStrokeWidth: st.currentItemStrokeWidth,
|
||||
...getAppStateStrokeWidthEntry(st.currentItemStrokeWidthKey, st.currentItemStrokeWidth),
|
||||
currentItemStrokeVariability: st.currentItemStrokeVariability,
|
||||
currentItemStrokeStyle: st.currentItemStrokeStyle,
|
||||
currentItemRoughness: st.currentItemRoughness,
|
||||
currentItemOpacity: st.currentItemOpacity,
|
||||
@@ -7139,8 +7145,14 @@ export default class ExcalidrawView
|
||||
this.exportDialog.open();
|
||||
}
|
||||
|
||||
private setExcalidrawAPI(api: ExcalidrawImperativeAPI) {
|
||||
private setExcalidrawAPI(api: ExcalidrawImperativeAPI | null) {
|
||||
this.excalidrawAPI = api;
|
||||
// Chasing ghosts: https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2810
|
||||
if (!api || this.pendingUIMode === null) {
|
||||
return;
|
||||
}
|
||||
api.setDesktopUIMode(this.pendingUIMode);
|
||||
this.pendingUIMode = null;
|
||||
//api.setLocalFont(this.plugin.settings.experimentalEnableFourthFont);
|
||||
}
|
||||
|
||||
@@ -8046,7 +8058,12 @@ export default class ExcalidrawView
|
||||
|
||||
public setUIMode(mode: UIMode) {
|
||||
const api = this.excalidrawAPI;
|
||||
if (!api) {
|
||||
this.pendingUIMode = mode;
|
||||
return;
|
||||
}
|
||||
api.setDesktopUIMode(mode);
|
||||
this.pendingUIMode = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -552,7 +552,7 @@ function RenderObsidianView({
|
||||
canvasColor: string;
|
||||
selectedElementId: string;
|
||||
sceneZoom: number;
|
||||
}): JSX.Element {
|
||||
}): React.JSX.Element {
|
||||
const { subpath, file } = processLinkText(linkText, view);
|
||||
|
||||
if (!file) {
|
||||
@@ -572,12 +572,20 @@ function RenderObsidianView({
|
||||
const pdfObserverDisabledRef = React.useRef(false);
|
||||
const mobilePatchCleanupRef = React.useRef(null);
|
||||
const initialViewFileRef = React.useRef(view.file);
|
||||
const mdPropsRef = React.useRef(mdProps);
|
||||
const fileRef = React.useRef(file);
|
||||
const prevLockRef = React.useRef(mdProps?.lockedReadingMode);
|
||||
|
||||
// Update themeRef when theme changes
|
||||
React.useEffect(() => {
|
||||
themeRef.current = theme;
|
||||
}, [theme]);
|
||||
|
||||
React.useEffect(() => {
|
||||
mdPropsRef.current = mdProps;
|
||||
fileRef.current = file;
|
||||
}, [mdProps, file]);
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
//block propagation of events to the parent if the embeddable element is active
|
||||
//--------------------------------------------------------------------------------
|
||||
@@ -695,6 +703,22 @@ function RenderObsidianView({
|
||||
containerRef.current,
|
||||
element.id,
|
||||
);
|
||||
|
||||
// --- PATCH NATIVE OBSIDIAN CANVAS NODE ---
|
||||
// Obsidian's native canvas event listeners will force the node into edit mode
|
||||
// on certain clicks/double-clicks. This intercepts Obsidian's core method.
|
||||
const node = leafRef.current.node;
|
||||
if (node && typeof node.startEditing === "function") {
|
||||
const originalStartEditing = node.startEditing;
|
||||
node.startEditing = function (...args: unknown[]) {
|
||||
// Read directly from the ref to ensure dynamic lock toggling works
|
||||
if (mdPropsRef.current?.lockedReadingMode) {
|
||||
return;
|
||||
}
|
||||
return originalStartEditing.apply(this, args) as unknown;
|
||||
};
|
||||
}
|
||||
|
||||
setColors(containerRef.current, element, mdProps, canvasColor, viewType);
|
||||
view.updateEmbeddableLeafRef(element.id, leafRef.current);
|
||||
viewTypeRef.current = "markdown";
|
||||
@@ -1061,6 +1085,19 @@ function RenderObsidianView({
|
||||
return;
|
||||
}
|
||||
|
||||
const currentMdProps = mdPropsRef.current;
|
||||
const currentFile = fileRef.current;
|
||||
|
||||
if (currentMdProps?.lockedReadingMode) {
|
||||
// Special case: if the card is a back-of-the-note card, ticking a checkbox in
|
||||
// reading mode triggers a change to the open file which would result in a view update.
|
||||
if (currentFile?.path === view.file.path) {
|
||||
view.setPreventReload();
|
||||
void view.setEmbeddableNodeIsEditing();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*if(isActiveRef.current && leafRef.current?.leaf) {
|
||||
setKeepOnTop();
|
||||
view.app.workspace.setActiveLeaf(leafRef.current.leaf, { focus: true });
|
||||
@@ -1174,7 +1211,10 @@ function RenderObsidianView({
|
||||
activeEmbeddable?.element.id === element.id &&
|
||||
activeEmbeddable?.state === "active";
|
||||
|
||||
if (previousIsActive === isActiveRef.current) {
|
||||
const lockChanged = prevLockRef.current !== mdProps?.lockedReadingMode;
|
||||
prevLockRef.current = !!mdProps?.lockedReadingMode;
|
||||
|
||||
if (previousIsActive === isActiveRef.current && !lockChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1190,13 +1230,21 @@ function RenderObsidianView({
|
||||
view.plugin.settings.markdownNodeOneClickEditing &&
|
||||
!containerRef.current?.hasClass("is-editing")
|
||||
) {
|
||||
//!node.isEditing
|
||||
const newTheme = getTheme(view, themeRef.current);
|
||||
containerRef.current?.addClasses(["is-editing", "is-focused"]);
|
||||
void view.canvasNodeFactory.startEditing(node, newTheme);
|
||||
if (mdPropsRef.current?.lockedReadingMode) {
|
||||
if (fileRef.current?.path === view.file.path) {
|
||||
view.setPreventReload();
|
||||
void view.setEmbeddableNodeIsEditing();
|
||||
}
|
||||
} else {
|
||||
//!node.isEditing
|
||||
const newTheme = getTheme(view, themeRef.current);
|
||||
containerRef.current?.addClasses(["is-editing", "is-focused"]);
|
||||
void view.canvasNodeFactory.startEditing(node, newTheme);
|
||||
}
|
||||
} else {
|
||||
containerRef.current?.removeClasses(["is-editing", "is-focused"]);
|
||||
view.canvasNodeFactory.stopEditing(node);
|
||||
view.clearEmbeddableNodeIsEditing();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1245,12 +1293,13 @@ function RenderObsidianView({
|
||||
activeEmbeddable?.state,
|
||||
isActiveRef,
|
||||
activeEmbeddable?.element,
|
||||
activeEmbeddable?.state,
|
||||
element,
|
||||
view,
|
||||
isEditingRef,
|
||||
view.canvasNodeFactory,
|
||||
themeRef.current,
|
||||
mdProps?.lockedReadingMode,
|
||||
file.path,
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -26,7 +26,10 @@ import {
|
||||
} from "src/utils/customEmbeddableUtils";
|
||||
import { getActivePDFPageNumberFromPDFView } from "src/utils/obsidianUtils";
|
||||
import { cleanSectionHeading } from "src/utils/pathUtils";
|
||||
import { EmbeddableSettings } from "src/shared/Dialogs/EmbeddableSettings";
|
||||
import {
|
||||
EmbeddableSettings,
|
||||
EmbeddableMDCustomProps,
|
||||
} from "src/shared/Dialogs/EmbeddableSettings";
|
||||
import {
|
||||
insertImageToView,
|
||||
openExternalLink,
|
||||
@@ -35,6 +38,7 @@ import { getEA } from "src/core";
|
||||
import { CaptureUpdateAction } from "src/constants/constants";
|
||||
import { URLs } from "src/constants/safeUrls";
|
||||
import { setStyle } from "src/utils/styleUtils";
|
||||
import { addAppendUpdateCustomData } from "src/utils/elementCustomDataUtils";
|
||||
|
||||
type BlockCacheEntry = Awaited<
|
||||
ReturnType<ExcalidrawView["app"]["metadataCache"]["blockCache"]["getForFile"]>
|
||||
@@ -109,7 +113,9 @@ export class EmbeddableMenu {
|
||||
const app = view.app;
|
||||
element = view.excalidrawAPI
|
||||
.getSceneElements()
|
||||
.find((e: ExcalidrawElement) => e.id === element.id);
|
||||
.find(
|
||||
(e: ExcalidrawElement) => e.id === element.id,
|
||||
) as ExcalidrawEmbeddableElement;
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
@@ -364,6 +370,46 @@ export class EmbeddableMenu {
|
||||
);
|
||||
}
|
||||
|
||||
private async actionToggleLockReadingMode(
|
||||
element: ExcalidrawEmbeddableElement,
|
||||
) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
const mdProps =
|
||||
(element.customData?.mdProps as EmbeddableMDCustomProps) ??
|
||||
this.view.plugin.settings.embeddableMarkdownDefaults;
|
||||
const isLocked = !!mdProps.lockedReadingMode;
|
||||
mdProps.lockedReadingMode = !isLocked;
|
||||
|
||||
const ea = getEA(this.view);
|
||||
ea.copyViewElementsToEAforEditing([element]);
|
||||
const eaEl = ea.getElement(element.id);
|
||||
addAppendUpdateCustomData(eaEl, mdProps);
|
||||
await ea.addElementsToView();
|
||||
ea.destroy();
|
||||
|
||||
// Fetch the updated element reference from the scene
|
||||
const api = this.view.excalidrawAPI;
|
||||
const updatedElement = api
|
||||
.getSceneElements()
|
||||
.find(
|
||||
(e: ExcalidrawElement) => e.id === element.id,
|
||||
) as ExcalidrawEmbeddableElement;
|
||||
|
||||
// Force an appState update so the React menu component re-renders
|
||||
if (updatedElement) {
|
||||
this.view.updateScene({
|
||||
appState: {
|
||||
activeEmbeddable: {
|
||||
element: updatedElement,
|
||||
state: "active",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private actionProperties(element: ExcalidrawEmbeddableElement, file: TFile) {
|
||||
if (!element) {
|
||||
return;
|
||||
@@ -472,6 +518,10 @@ export class EmbeddableMenu {
|
||||
);
|
||||
const top = `${y - 2.5 * ROOTELEMENTSIZE - appState.offsetTop}px`;
|
||||
const left = `${x - appState.offsetLeft}px`;
|
||||
const mdProps =
|
||||
(element.customData?.mdProps as EmbeddableMDCustomProps) ??
|
||||
view.plugin.settings.embeddableMarkdownDefaults;
|
||||
const isLockedReadingMode = !!mdProps.lockedReadingMode;
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -528,6 +578,18 @@ export class EmbeddableMenu {
|
||||
icon={ICONS.ZoomToBlock}
|
||||
/>
|
||||
)}
|
||||
{isMD && (
|
||||
<ActionButton
|
||||
key="LockReadingMode"
|
||||
title={
|
||||
isLockedReadingMode
|
||||
? t("UNLOCK_READING_MODE")
|
||||
: t("LOCK_READING_MODE")
|
||||
}
|
||||
action={() => void this.actionToggleLockReadingMode(element)}
|
||||
icon={isLockedReadingMode ? ICONS.Edit : ICONS.Read}
|
||||
/>
|
||||
)}
|
||||
<ActionButton
|
||||
key={"ZoomToElement"}
|
||||
title={t("ZOOM_TO_FIT")}
|
||||
@@ -570,9 +632,11 @@ export class EmbeddableMenu {
|
||||
}
|
||||
}
|
||||
if (isObsidianiFrame || isExcalidrawiFrame) {
|
||||
const iframe = isExcalidrawiFrame
|
||||
? api.getHTMLIFrameElement(element.id)
|
||||
: view.getEmbeddableElementById(element.id);
|
||||
const iframe = (
|
||||
isExcalidrawiFrame
|
||||
? api.getHTMLIFrameElement(element.id)
|
||||
: view.getEmbeddableElementById(element.id)
|
||||
) as HTMLIFrameElement;
|
||||
if (!iframe || !iframe.contentWindow) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,28 @@ import { UniversalInsertFileModal } from "src/shared/Dialogs/UniversalInsertFile
|
||||
import { t } from "src/lang/helpers";
|
||||
import { getExcalidrawViews } from "src/utils/obsidianUtils";
|
||||
import { CaptureUpdateAction } from "src/constants/constants";
|
||||
import { getAppStateStrokeWidthEntry, getFreedrawStrokeWidthByKey } from "src/utils/excalidrawAutomateUtils";
|
||||
|
||||
export function setPen(pen: PenStyle, api: ExcalidrawImperativeAPI) {
|
||||
const st = api.getAppState();
|
||||
const strokeWidthEntry =
|
||||
!pen.strokeWidth || pen.strokeWidth === 0
|
||||
? {}
|
||||
: getAppStateStrokeWidthEntry(undefined, pen.strokeWidth);
|
||||
const currentItemStrokeWidthKey =
|
||||
"currentItemStrokeWidthKey" in strokeWidthEntry
|
||||
? strokeWidthEntry.currentItemStrokeWidthKey
|
||||
: null;
|
||||
const currentItemStrokeWidth =
|
||||
"currentItemStrokeWidth" in strokeWidthEntry
|
||||
? strokeWidthEntry.currentItemStrokeWidth
|
||||
: null;
|
||||
api.updateScene({
|
||||
appState: {
|
||||
currentStrokeOptions: pen.penOptions,
|
||||
...(!pen.strokeWidth || pen.strokeWidth === 0
|
||||
? null
|
||||
: { currentItemStrokeWidth: pen.strokeWidth }),
|
||||
currentItemStrokeWidthKey,
|
||||
currentItemStrokeWidth,
|
||||
currentItemStrokeVariability: pen.penOptions.constantPressure ? "constant" : "variable",
|
||||
...(pen.backgroundColor
|
||||
? { currentItemBackgroundColor: pen.backgroundColor }
|
||||
: null),
|
||||
@@ -38,7 +51,9 @@ export function setPen(pen: PenStyle, api: ExcalidrawImperativeAPI) {
|
||||
...(pen.freedrawOnly && !st.resetCustomPen //switching from custom pen to next custom pen
|
||||
? {
|
||||
resetCustomPen: {
|
||||
currentItemStrokeWidthKey: st.currentItemStrokeWidthKey,
|
||||
currentItemStrokeWidth: st.currentItemStrokeWidth,
|
||||
currentItemStrokeVariability: st.currentItemStrokeVariability,
|
||||
currentItemBackgroundColor: st.currentItemBackgroundColor,
|
||||
currentItemStrokeColor: st.currentItemStrokeColor,
|
||||
currentItemFillStyle: st.currentItemFillStyle,
|
||||
@@ -56,16 +71,21 @@ export function resetStrokeOptions(
|
||||
api: ExcalidrawImperativeAPI,
|
||||
clearCurrentStrokeOptions: boolean,
|
||||
) {
|
||||
const appState = api.getAppState();
|
||||
api.updateScene({
|
||||
appState: {
|
||||
...(resetCustomPen
|
||||
? {
|
||||
currentItemStrokeWidth: resetCustomPen.currentItemStrokeWidth,
|
||||
currentItemStrokeWidthKey:
|
||||
resetCustomPen.currentItemStrokeWidthKey,
|
||||
currentItemStrokeWidth:
|
||||
resetCustomPen.currentItemStrokeWidth,
|
||||
currentItemBackgroundColor:
|
||||
resetCustomPen.currentItemBackgroundColor,
|
||||
currentItemStrokeColor: resetCustomPen.currentItemStrokeColor,
|
||||
currentItemFillStyle: resetCustomPen.currentItemFillStyle,
|
||||
currentItemRoughness: resetCustomPen.currentItemRoughness,
|
||||
currentItemStrokeVariability: resetCustomPen.currentItemStrokeVariability,
|
||||
}
|
||||
: null),
|
||||
resetCustomPen: null,
|
||||
@@ -234,7 +254,7 @@ export class ObsidianMenu {
|
||||
pen.freedrawOnly
|
||||
) {
|
||||
const activePen = this.activePens[index] ?? { ...pen };
|
||||
activePen.strokeWidth = appState.currentItemStrokeWidth;
|
||||
activePen.strokeWidth = getFreedrawStrokeWidthByKey(appState.currentItemStrokeWidthKey, appState.currentItemStrokeWidth);
|
||||
activePen.backgroundColor = appState.currentItemBackgroundColor;
|
||||
activePen.strokeColor = appState.currentItemStrokeColor;
|
||||
activePen.fillStyle = appState.currentItemFillStyle;
|
||||
|
||||
+69
-128
@@ -2,15 +2,15 @@
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
background-color: var(--background-primary);
|
||||
position:relative;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.block-language-excalidraw {
|
||||
text-align:center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
svg.excalidraw-svg {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.excalidraw-embedded-img {
|
||||
@@ -50,7 +50,7 @@ div.excalidraw-svg-left {
|
||||
}
|
||||
|
||||
button.ToolIcon_type_button[title="Export"] {
|
||||
display:none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.excalidraw-prompt-div {
|
||||
@@ -104,8 +104,8 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
}
|
||||
|
||||
.ex-coffee-div {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.excalidraw-mastery-promo {
|
||||
@@ -196,7 +196,7 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
|
||||
.excalidraw-scriptengine-install td>img {
|
||||
width: 100%;
|
||||
max-width:800px;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.excalidraw-scriptengine-install img.coffee {
|
||||
@@ -227,7 +227,7 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
}
|
||||
|
||||
.excalidraw-scriptengine-install .modal {
|
||||
max-height:90%;
|
||||
max-height: 90%;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
@@ -250,18 +250,20 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
}
|
||||
|
||||
.workspace-leaf-content .excalidraw-view {
|
||||
padding: 0px 1px; /*1px so on ipad swipe in from left and right still works*/
|
||||
padding: 0px 1px;
|
||||
/*1px so on ipad swipe in from left and right still works*/
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.excalidraw-videoWrapper {
|
||||
max-width:600px;
|
||||
}
|
||||
.excalidraw-videoWrapper.settings {
|
||||
max-width:340px;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.excalidraw-videoWrapper div{
|
||||
.excalidraw-videoWrapper.settings {
|
||||
max-width: 340px;
|
||||
}
|
||||
|
||||
.excalidraw-videoWrapper div {
|
||||
position: relative;
|
||||
padding-bottom: 56.25%;
|
||||
height: 0;
|
||||
@@ -281,7 +283,7 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.excalidraw-release .modal-content{
|
||||
.excalidraw-release .modal-content {
|
||||
padding-right: 5px;
|
||||
margin-right: -5px;
|
||||
user-select: text;
|
||||
@@ -293,7 +295,7 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
}
|
||||
|
||||
.excalidraw-scriptengine-install tbody>tr>td>div>img {
|
||||
height:20px;
|
||||
height: 20px;
|
||||
background-color: silver;
|
||||
padding: 2px;
|
||||
}
|
||||
@@ -318,7 +320,7 @@ button.ToolIcon_type_button[title="Export"] {
|
||||
position: absolute;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,0.25);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
|
||||
background-color: var(--background-primary);
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
z-index: 9999;
|
||||
@@ -347,7 +349,7 @@ textarea.excalidraw-wysiwyg {
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.is-tablet .excalidraw button,
|
||||
@@ -356,11 +358,6 @@ textarea.excalidraw-wysiwyg {
|
||||
height: 1.8rem;
|
||||
}
|
||||
|
||||
.excalidraw-hidden,
|
||||
.excalidraw-display-none {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.excalidraw-display-flex {
|
||||
display: flex;
|
||||
}
|
||||
@@ -378,7 +375,7 @@ textarea.excalidraw-wysiwyg {
|
||||
background: var(--background-primary-alt);
|
||||
}
|
||||
|
||||
.excalidraw-ai-provider-table > .setting-item {
|
||||
.excalidraw-ai-provider-table>.setting-item {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0.5rem;
|
||||
@@ -396,7 +393,7 @@ textarea.excalidraw-wysiwyg {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.excalidraw-ai-provider-table__row + .excalidraw-ai-provider-table__row {
|
||||
.excalidraw-ai-provider-table__row+.excalidraw-ai-provider-table__row {
|
||||
border-top: 1px solid var(--background-modifier-border);
|
||||
}
|
||||
|
||||
@@ -506,7 +503,8 @@ div.excalidraw-draginfo {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.excalidraw-sidepanel-tab__button { /* probably unused */
|
||||
.excalidraw-sidepanel-tab__button {
|
||||
/* probably unused */
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
@@ -680,7 +678,7 @@ img.excalidraw-cropped-pdfpage,
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.popover .excalidraw-svg {
|
||||
.popover .excalidraw-svg {
|
||||
width: 100%;
|
||||
max-width: inherit;
|
||||
height: 100%;
|
||||
@@ -688,24 +686,26 @@ img.excalidraw-cropped-pdfpage,
|
||||
}
|
||||
|
||||
root {
|
||||
--excalidraw-caret-color: initial;
|
||||
--excalidraw-caret-color: initial;
|
||||
}
|
||||
|
||||
.excalidraw-settings-links-container {
|
||||
align-items: center;
|
||||
color: inherit;
|
||||
display: flex;
|
||||
gap: .3em;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
color: inherit;
|
||||
display: flex;
|
||||
gap: .3em;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.excalidraw-settings-links-container a {
|
||||
display: flex; /* Align children horizontally */
|
||||
align-items: center; /* Center items vertically */
|
||||
display: flex;
|
||||
/* Align children horizontally */
|
||||
align-items: center;
|
||||
/* Center items vertically */
|
||||
text-align: left;
|
||||
margin-right: 4px;
|
||||
margin-left: 4px;
|
||||
@@ -761,19 +761,14 @@ root {
|
||||
margin-bottom: -2px;
|
||||
}
|
||||
|
||||
.is-mobile .modal-container.excalidraw-modal .modal.excalidraw-modal {
|
||||
align-self: flex-start;
|
||||
transform: none !important;
|
||||
margin-top: calc(var(--safe-area-inset-top) + var(--header-height) + var(--size-4-2));
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.excalidraw-prompt-buttonbar-top,
|
||||
.excalidraw-prompt-buttonbar-bottom {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start; /* keep both rows top‐aligned */
|
||||
row-gap: 0.5em; /* vertical space when wrapped */
|
||||
align-items: flex-start;
|
||||
/* keep both rows top‐aligned */
|
||||
row-gap: 0.5em;
|
||||
/* vertical space when wrapped */
|
||||
}
|
||||
|
||||
/* top bar specifics */
|
||||
@@ -788,20 +783,20 @@ root {
|
||||
}
|
||||
|
||||
/* make each child a flex row */
|
||||
.excalidraw-prompt-buttonbar-top > div,
|
||||
.excalidraw-prompt-buttonbar-bottom > div {
|
||||
.excalidraw-prompt-buttonbar-top>div,
|
||||
.excalidraw-prompt-buttonbar-bottom>div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* push the first group to the left */
|
||||
.excalidraw-prompt-buttonbar-top > div:first-child,
|
||||
.excalidraw-prompt-buttonbar-bottom > div:first-child {
|
||||
.excalidraw-prompt-buttonbar-top>div:first-child,
|
||||
.excalidraw-prompt-buttonbar-bottom>div:first-child {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
/* push the second group to the right */
|
||||
.excalidraw-prompt-buttonbar-top > div:last-child,
|
||||
.excalidraw-prompt-buttonbar-bottom > div:last-child {
|
||||
.excalidraw-prompt-buttonbar-top>div:last-child,
|
||||
.excalidraw-prompt-buttonbar-bottom>div:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
@@ -810,7 +805,7 @@ root {
|
||||
flex-direction: column;
|
||||
background: var(--background-secondary);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 4px 0 rgba(0,0,0,0.10);
|
||||
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.10);
|
||||
padding: 0.5em 0.8em;
|
||||
margin-bottom: 0.5em;
|
||||
max-width: calc(100% - 1.6em);
|
||||
@@ -885,7 +880,8 @@ root {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.excalidraw-search .document-search-button:hover, .excalidraw-search .document-search-button:focus {
|
||||
.excalidraw-search .document-search-button:hover,
|
||||
.excalidraw-search .document-search-button:focus {
|
||||
background: var(--background-modifier-hover);
|
||||
color: var(--text-accent);
|
||||
}
|
||||
@@ -898,69 +894,8 @@ root {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.excalidraw-LatexPrompt {
|
||||
.cm-editor {
|
||||
margin-top: var(--size-4-2);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
/* this is safe, if unsupported, will be ignored */
|
||||
anchor-name: --latex-editor;
|
||||
|
||||
& > .cm-scroller, & > .cm-announcment {
|
||||
align-self: start;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
/* taken from Obsidian, doesn't apply automatically,
|
||||
because the rule does not have :focus-within */
|
||||
&.cm-focused {
|
||||
border-color: var(--background-modifier-border-focus);
|
||||
transition: box-shadow 0.15s ease-in-out, border 0.15s ease-in-out;
|
||||
box-shadow: 0 0 0 var(--input-border-width-focus) var(--background-modifier-border-focus);
|
||||
}
|
||||
|
||||
/* centering the popup */
|
||||
& .cm-tooltip-cursor.cm-tooltip {
|
||||
left: unset !important;
|
||||
|
||||
& .cm-tooltip-arrow {
|
||||
left: 50% !important;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
[jax="CHTML"][display="true"] {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.cm-content {
|
||||
caret-color: var(--caret-color);
|
||||
}
|
||||
}
|
||||
|
||||
@supports (anchor-name: --test) {
|
||||
.excalidraw-LatexPrompt .cm-editor .cm-tooltip-cursor.cm-tooltip {
|
||||
position: fixed !important;
|
||||
position-anchor: --latex-editor;
|
||||
top: unset !important;
|
||||
max-width: calc(100vw - var(--size-4-4));
|
||||
margin: var(--size-4-2) 0;
|
||||
overflow-x: clip;
|
||||
|
||||
&.cm-tooltip-above {
|
||||
bottom: anchor(top);
|
||||
}
|
||||
|
||||
&.cm-tooltip-below {
|
||||
top: anchor(bottom) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.excalidraw-filetype-tag {
|
||||
order: 99;
|
||||
order: 99;
|
||||
}
|
||||
|
||||
.excalidraw-mobile-navbar-docked {
|
||||
@@ -975,16 +910,16 @@ root {
|
||||
Obsidian Sheets Plus support
|
||||
*/
|
||||
.excalidraw__embeddable__outer .lj-content-view {
|
||||
width: var(--embeddable-width);
|
||||
height: var(--embeddable-height);
|
||||
width: var(--embeddable-width);
|
||||
height: var(--embeddable-height);
|
||||
}
|
||||
|
||||
.excalidraw__embeddable__outer #sheet-box {
|
||||
height: calc(var(--embeddable-height) - var(--lj-toolbar-height) + 40px);
|
||||
height: calc(var(--embeddable-height) - var(--lj-toolbar-height) + 40px);
|
||||
}
|
||||
|
||||
.excalidraw__embeddable__outer .lj-univer .univer-relative.univer-grid {
|
||||
width: var(--embeddable-width);
|
||||
width: var(--embeddable-width);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -997,16 +932,18 @@ End Obsidian Sheets Plus support
|
||||
}
|
||||
|
||||
.excalidraw-button-bgcolor {
|
||||
&-normal {
|
||||
background-color: var(--interactive-normal);
|
||||
&-normal {
|
||||
background-color: var(--interactive-normal);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
&-accent {
|
||||
background-color: var(--interactive-accent);
|
||||
|
||||
&-accent {
|
||||
background-color: var(--interactive-accent);
|
||||
color: var(--text-on-accent);
|
||||
}
|
||||
&-success {
|
||||
background-color: var(--interactive-success);
|
||||
|
||||
&-success {
|
||||
background-color: var(--interactive-success);
|
||||
color: var(--text-on-success);
|
||||
}
|
||||
}
|
||||
@@ -1106,3 +1043,7 @@ End Obsidian Sheets Plus support
|
||||
width: 100%;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.excalidraw .App-bottom-bar .App-toolbar {
|
||||
min-width: 12.8em;
|
||||
}
|
||||
Reference in new issue
Block a user