mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
Compare commits
1 Commits
1.7.26
...
load-image
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d8f0fb3d |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,5 +15,4 @@ data.json
|
||||
lib
|
||||
|
||||
#VSCode
|
||||
.vscode
|
||||
yarn.lock
|
||||
.vscode
|
||||
@@ -17,10 +17,7 @@ Please upgrade to Obsidian v0.12.19 or higher to get the latest release.
|
||||
|[](https://youtu.be/eKFmrSQhFA4)|[](https://youtu.be/qbPIAZguJeo)|[](https://youtu.be/2Y8OhkGiTHg)|
|
||||
|[](https://youtu.be/2v9TZmQNO8c)|[](https://youtu.be/xHPGWR3m0c8)|[](https://youtu.be/gMIKXyhS-dM)|
|
||||
|[](https://youtu.be/Etskjw7a5zo)|[](https://youtu.be/4N6efq1DtH0)|[](https://youtu.be/U2LkBRBk4LY)|
|
||||
| [](https://youtu.be/qiKuqMcNWgU)|[](https://youtu.be/yZQoJg2RCKI)|[](https://youtu.be/6PLGHBH9VZ4) |
|
||||
|[](https://youtu.be/epYNx2FSf2w) | [](https://youtu.be/Amhlv6r9WvM) | [](https://youtu.be/r9oB1SlK1GU) |
|
||||
|[](https://youtu.be/7gJDwNgQ6NU) | | |
|
||||
|
||||
| [](https://youtu.be/qiKuqMcNWgU)|[](https://youtu.be/yZQoJg2RCKI)| |
|
||||
|
||||
|
||||
# Key features
|
||||
@@ -53,8 +50,8 @@ Please upgrade to Obsidian v0.12.19 or higher to get the latest release.
|
||||
- Insert LaTeX formulas using the Command Palette action "Insert LaTeX formula". You can edit formulas either in Markdown view, or by <kbd>CTRL/CMD + Click</kbd> on the formula.
|
||||
- Drag & Drop support
|
||||
- You can drag files from the Obsidian file explorer and they will become links to those files in Excalidraw.
|
||||
- Dragging image files (PNG, SVG, JPG, ICO, GIF, WEBP, Excalidraw) from Obsidian's file explorer while pressing the <kbd>CTRL</kbd> (<kbd>SHIFT</kbd> on Mac) button will embed the image into your drawing.
|
||||
- If in addition to <kbd>CTRL</kbd> or <kbd>SHIFT</kbd> you also hold down <kbd>ALT<kbd>, the image will be inserted at 100% of its size. ⚠ Note: this is a very niche feature with a very particular behavior that I built primarily for myself (even more so than other features in Excalidraw Obsidian - also built primarily for myself 😉)... This will reset your embedded image to 100% size every time you open the Excalidraw drawing, or in case you have embedded an Excalidraw drawing on your canvas inserted using this function, every time you update the embedded drawing, it will be scaled back to 100% size. This means that even if you resize the image on the drawing, it will reset to 100% the next time you open the file or you modify the original embedded object. This feature is useful when you decompose a drawing into separate Excalidraw files, but when combined onto a single canvas you want the individual pieces to maintain their actual sizes. I use this feature to construct Book-on-a-Page summaries from atomic drawings.
|
||||
- Dragging image files (PNG, SVG, JPG, Excalidraw) from Obsidian's file explorer while pressing the <kbd>CTRL/CMD</kbd> button will embed the image into your drawing.
|
||||
- You can drag and drop images from outside Obsidian onto Excalidraw. These images will be embedded into your drawing and saved to Obsidian.
|
||||
- You can drag and drop text from Markdown views onto Excalidraw.
|
||||
- You can drag and drop web addresses from your browser and they will become links.
|
||||
- Image support
|
||||
|
||||
@@ -362,7 +362,7 @@ export declare class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
* 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 true, it will stop the native excalidraw onLinkHover management flow.
|
||||
* 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;
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "1.7.26",
|
||||
"version": "1.7.22",
|
||||
"minAppVersion": "0.15.6",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsidian-excalidraw-plugin",
|
||||
"version": "1.7.26",
|
||||
"version": "1.7.11",
|
||||
"description": "This is an Obsidian.md plugin that lets you view and edit Excalidraw drawings",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
@@ -18,7 +18,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/lz-string": "^1.3.34",
|
||||
"@zsviczian/excalidraw": "0.13.0-obsidian",
|
||||
"@zsviczian/excalidraw": "0.12.0-obsidian-11",
|
||||
"clsx": "^1.1.1",
|
||||
"lz-string": "^1.4.4",
|
||||
"monkey-around": "^2.3.0",
|
||||
@@ -49,7 +49,7 @@
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"html2canvas": "^1.4.0",
|
||||
"nanoid": "^4.0.0",
|
||||
"obsidian": "^0.16.3",
|
||||
"obsidian": "^0.15.4",
|
||||
"prettier": "^2.5.1",
|
||||
"rollup": "^2.70.1",
|
||||
"rollup-plugin-copy": "^3.4.0",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,6 @@ import {
|
||||
ExcalidrawBindableElement,
|
||||
FileId,
|
||||
NonDeletedExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
} from "@zsviczian/excalidraw/types/element/types";
|
||||
import { normalizePath, TFile, WorkspaceLeaf } from "obsidian";
|
||||
import ExcalidrawView, { ExportSettings, TextMode } from "./ExcalidrawView";
|
||||
@@ -26,7 +25,6 @@ import {
|
||||
embedFontsInSVG,
|
||||
errorlog,
|
||||
getEmbeddedFilenameParts,
|
||||
getImageSize,
|
||||
getPNG,
|
||||
getSVG,
|
||||
isVersionNewerThanOther,
|
||||
@@ -893,7 +891,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
topX: number,
|
||||
topY: number,
|
||||
imageFile: TFile,
|
||||
scale: boolean = true, //true will scale the image to MAX_IMAGE_SIZE, false will insert image at 100% of its size
|
||||
): Promise<string> {
|
||||
const id = nanoid();
|
||||
const loader = new EmbeddedFilesLoader(
|
||||
@@ -910,11 +907,11 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
id: fileId,
|
||||
dataURL: image.dataURL,
|
||||
created: image.created,
|
||||
file: imageFile.path + (scale ? "":"|100%"),
|
||||
file: imageFile.path,
|
||||
hasSVGwithBitmap: image.hasSVGwithBitmap,
|
||||
latex: null,
|
||||
};
|
||||
if (scale && (Math.max(image.size.width, image.size.height) > MAX_IMAGE_SIZE)) {
|
||||
if (Math.max(image.size.width, image.size.height) > MAX_IMAGE_SIZE) {
|
||||
const scale =
|
||||
MAX_IMAGE_SIZE / Math.max(image.size.width, image.size.height);
|
||||
image.size.width = scale * image.size.width;
|
||||
@@ -1217,7 +1214,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
getViewElements(): ExcalidrawElement[] {
|
||||
//@ts-ignore
|
||||
if (!this.targetView || !this.targetView?._loaded) {
|
||||
errorMessage("targetView not set", "getViewElements()");
|
||||
errorMessage("targetView not set", "getViewSelectedElements()");
|
||||
return [];
|
||||
}
|
||||
const current = this.targetView?.excalidrawRef?.current;
|
||||
@@ -1235,7 +1232,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
deleteViewElements(elToDelete: ExcalidrawElement[]): boolean {
|
||||
//@ts-ignore
|
||||
if (!this.targetView || !this.targetView?._loaded) {
|
||||
errorMessage("targetView not set", "deleteViewElements()");
|
||||
errorMessage("targetView not set", "getViewSelectedElements()");
|
||||
return false;
|
||||
}
|
||||
const current = this.targetView?.excalidrawRef?.current;
|
||||
@@ -1283,7 +1280,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
getViewFileForImageElement(el: ExcalidrawElement): TFile | null {
|
||||
//@ts-ignore
|
||||
if (!this.targetView || !this.targetView?._loaded) {
|
||||
errorMessage("targetView not set", "getViewFileForImageElement()");
|
||||
errorMessage("targetView not set", "getViewSelectedElements()");
|
||||
return null;
|
||||
}
|
||||
if (!el || el.type !== "image") {
|
||||
@@ -1491,15 +1488,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
pointerPosition: { x: number; y: number }; //the pointer position on canvas at the time of drop
|
||||
}) => boolean = null;
|
||||
|
||||
/**
|
||||
* If set, this callback is triggered whenever the active canvas color changes
|
||||
*/
|
||||
onCanvasColorChangeHook: (
|
||||
ea: ExcalidrawAutomate,
|
||||
view: ExcalidrawView, //the excalidraw view
|
||||
color: string,
|
||||
) => void = null;
|
||||
|
||||
/**
|
||||
* utility function to generate EmbeddedFilesLoader object
|
||||
* @param isDark
|
||||
@@ -1690,30 +1678,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
return { width: size.w ?? 0, height: size.h ?? 0 };
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the size of the image element at 100% (i.e. the original size)
|
||||
* @param imageElement an image element from the active scene on targetView
|
||||
*/
|
||||
async getOriginalImageSize(imageElement: ExcalidrawImageElement): Promise<{width: number; height: number}> {
|
||||
//@ts-ignore
|
||||
if (!this.targetView || !this.targetView?._loaded) {
|
||||
errorMessage("targetView not set", "getOriginalImageSize()");
|
||||
return null;
|
||||
}
|
||||
if(!imageElement || imageElement.type !== "image") {
|
||||
errorMessage("Please provide a single image element as input", "getOriginalImageSize()");
|
||||
return null;
|
||||
}
|
||||
const ef = this.targetView.excalidrawData.getFile(imageElement.fileId);
|
||||
if(!ef) {
|
||||
errorMessage("Please provide a single image element as input", "getOriginalImageSize()");
|
||||
return null;
|
||||
}
|
||||
const isDark = this.getExcalidrawAPI().getAppState().theme === "dark";
|
||||
const dataURL = ef.getImage(isDark);
|
||||
return await getImageSize(dataURL);
|
||||
}
|
||||
|
||||
/**
|
||||
* verifyMinimumPluginVersion returns true if plugin version is >= than required
|
||||
* recommended use:
|
||||
@@ -1867,10 +1831,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface {
|
||||
log("Creates a CM object. Visit https://github.com/lbragile/ColorMaster for documentation.");
|
||||
return;
|
||||
}
|
||||
if(typeof color === "string") {
|
||||
color = this.colorNameToHex(color);
|
||||
}
|
||||
|
||||
return CM(color);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1579,15 +1579,15 @@ export const getTransclusion = async (
|
||||
if (!para) {
|
||||
return { contents: linkParts.original.trim(), lineNum: 0 };
|
||||
}
|
||||
if (["blockquote"].includes(para.type)) {
|
||||
if (["blockquote", "listItem"].includes(para.type)) {
|
||||
para = para.children[0];
|
||||
} //blockquotes are special, they have one child, which has the paragraph
|
||||
const startPos = para.position.start.offset;
|
||||
const lineNum = para.position.start.line;
|
||||
const endPos = para.position.end.offset; //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/853
|
||||
//para.children[para.children.length - 1]?.position.start.offset - 1; //!not clear what the side effect of the #853 change is
|
||||
const endPos =
|
||||
para.children[para.children.length - 1]?.position.start.offset - 1; //alternative: filter((c:any)=>c.type=="blockid")[0]
|
||||
return {
|
||||
contents: contents.substring(startPos, endPos).replaceAll(/ \^\S*$|^\^\S*$/gm,"").trim(), //remove the block reference from the end of the line, or from the beginning of a new line
|
||||
contents: contents.substring(startPos, endPos).trim(),
|
||||
lineNum,
|
||||
};
|
||||
}
|
||||
@@ -1638,7 +1638,7 @@ export const getTransclusion = async (
|
||||
return {
|
||||
leadingHashes: "#".repeat(depth) + " ",
|
||||
contents: contents.substring(startPos).trim(),
|
||||
lineNum
|
||||
lineNum
|
||||
};
|
||||
}
|
||||
return { contents: linkParts.original.trim(), lineNum: 0 };
|
||||
|
||||
@@ -1256,8 +1256,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.autosaveTimer = setTimeout(
|
||||
timer,
|
||||
this.plugin.activeExcalidrawView === this &&
|
||||
this.semaphores.dirty &&
|
||||
this.plugin.settings.autosave
|
||||
this.semaphores.dirty
|
||||
? 1000 //try again in 1 second
|
||||
: this.plugin.settings.autosaveInterval,
|
||||
);
|
||||
@@ -1267,10 +1266,12 @@ export default class ExcalidrawView extends TextFileView {
|
||||
clearTimeout(this.autosaveTimer);
|
||||
this.autosaveTimer = null;
|
||||
} // clear previous timer if one exists
|
||||
this.autosaveTimer = setTimeout(
|
||||
timer,
|
||||
this.plugin.settings.autosaveInterval,
|
||||
);
|
||||
if (this.plugin.settings.autosave) {
|
||||
this.autosaveTimer = setTimeout(
|
||||
timer,
|
||||
this.plugin.settings.autosaveInterval,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//save current drawing when user closes workspace leaf
|
||||
@@ -1440,7 +1441,7 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.previousSceneVersion = 0;
|
||||
}
|
||||
|
||||
public isLoaded: boolean = false;
|
||||
private isLoaded: boolean = false;
|
||||
async setViewData(data: string, clear: boolean = false) {
|
||||
if(this.plugin.settings.showNewVersionNotification) checkExcalidrawVersion(app);
|
||||
this.isLoaded = false;
|
||||
@@ -2783,15 +2784,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
libraryReturnUrl: "app://obsidian.md",
|
||||
autoFocus: true,
|
||||
onChange: (et: ExcalidrawElement[], st: AppState) => {
|
||||
const canvasColorChangeHook = () => {
|
||||
if(this.plugin.ea.onCanvasColorChangeHook) {
|
||||
this.plugin.ea.onCanvasColorChangeHook(
|
||||
this.plugin.ea,
|
||||
this,
|
||||
st.viewBackgroundColor
|
||||
)
|
||||
}
|
||||
}
|
||||
viewModeEnabled = st.viewModeEnabled;
|
||||
if (this.semaphores.justLoaded) {
|
||||
this.semaphores.justLoaded = false;
|
||||
@@ -2800,7 +2792,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
}
|
||||
this.previousSceneVersion = this.getSceneVersion(et);
|
||||
this.previousBackgroundColor = st.viewBackgroundColor;
|
||||
canvasColorChangeHook();
|
||||
return;
|
||||
}
|
||||
if (this.semaphores.dirty) {
|
||||
@@ -2825,7 +2816,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
this.previousSceneVersion = sceneVersion;
|
||||
this.previousBackgroundColor = st.viewBackgroundColor;
|
||||
this.setDirty(6);
|
||||
canvasColorChangeHook();
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2925,7 +2915,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
currentPosition.x,
|
||||
currentPosition.y,
|
||||
draggable.file,
|
||||
!event.altKey,
|
||||
);
|
||||
ea.addElementsToView(false, false, true);
|
||||
})();
|
||||
@@ -2955,7 +2944,6 @@ export default class ExcalidrawView extends TextFileView {
|
||||
currentPosition.x + counter*50,
|
||||
currentPosition.y + counter*50,
|
||||
f,
|
||||
!event.altKey,
|
||||
);
|
||||
counter++;
|
||||
await ea.addElementsToView(false, false, true);
|
||||
|
||||
@@ -27,7 +27,6 @@ export const updateEquation = async (
|
||||
created: data.created,
|
||||
size: data.size,
|
||||
hasSVGwithBitmap: false,
|
||||
shouldScale: true,
|
||||
});
|
||||
addFiles(files, view);
|
||||
}
|
||||
|
||||
@@ -17,23 +17,12 @@ export class InsertImageDialog extends FuzzySuggestModal<TFile> {
|
||||
this.limit = 20;
|
||||
this.setInstructions([
|
||||
{
|
||||
command: t("SELECT_FILE_WITH_OPTION_TO_SCALE"),
|
||||
command: t("SELECT_FILE"),
|
||||
purpose: "",
|
||||
},
|
||||
]);
|
||||
this.setPlaceholder(t("SELECT_DRAWING"));
|
||||
this.emptyStateText = t("NO_MATCH");
|
||||
this.inputEl.onkeyup = (e) => {
|
||||
//@ts-ignore
|
||||
if (e.key === "Enter" && e.altKey && this.chooser.values) {
|
||||
this.onChooseItem(
|
||||
//@ts-ignore
|
||||
this.chooser.values[this.chooser.selectedItem].item,
|
||||
new KeyboardEvent("keypress",{altKey: true})
|
||||
);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getItems(): TFile[] {
|
||||
@@ -50,13 +39,13 @@ export class InsertImageDialog extends FuzzySuggestModal<TFile> {
|
||||
return item.path;
|
||||
}
|
||||
|
||||
onChooseItem(item: TFile, event: KeyboardEvent): void {
|
||||
onChooseItem(item: TFile): void {
|
||||
const ea = this.plugin.ea;
|
||||
ea.reset();
|
||||
ea.setView(this.view);
|
||||
ea.canvas.theme = this.view.excalidrawAPI.getAppState().theme;
|
||||
(async () => {
|
||||
await ea.addImage(0, 0, item, !event.altKey);
|
||||
await ea.addImage(0, 0, item);
|
||||
ea.addElementsToView(true, false, true);
|
||||
})();
|
||||
}
|
||||
|
||||
@@ -17,60 +17,6 @@ I develop this plugin as a hobby, spending most of my free time doing this. If y
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
|
||||
`,
|
||||
"1.7.26":`## Fixed
|
||||
- Transcluded block with a parent bullet does not embed sub-bullet [#853](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/853)
|
||||
- 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
|
||||
- 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)
|
||||
|
||||
## New - power user features
|
||||
- Force the embedded image to always scale to 100%. Note: this is a very niche feature with a very particular behavior that I built primarily for myself (even more so than other features in Excalidraw Obsidian - also built primarily for myself 😉)... This will reset your embedded image to 100% size every time you open the Excalidraw drawing, or in case you have embedded an Excalidraw drawing on your canvas inserted using this function, every time you update the embedded drawing, it will be scaled back to 100% size. This means that even if you resize the image on the drawing, it will reset to 100% the next time you open the file or you modify the original embedded object. This feature is useful when you decompose a drawing into separate Excalidraw files, but when combined onto a single canvas you want the individual pieces to maintain their actual sizes. I use this feature to construct Book-on-a-Page summaries from atomic drawings.
|
||||
- I added an action to the command palette to temporarily disable/enable Excalidraw autosave. When autosave is disabled, Excalidraw will still save your drawing when changing to another Obsidian window, but it will not save every 10 seconds. On a mobile device (but also on a desktop) this can lead to data loss if you terminate Obsidian abruptly (i.e. swipe the application away, or close Obsidian without first closing the drawing). Use this feature if you find Excalidraw laggy.`,
|
||||
"1.7.25":`## Fixed
|
||||
- Tool buttons did not "stick" the first time you clicked them.
|
||||
- Tray (in tray mode) was higher when the help button was visible. The tray in tablet mode was too large and the help button was missing.
|
||||
- ExcalidrawAutomate ${String.fromCharCode(96)}getCM(color:TInput): ColorMaster;${String.fromCharCode(96)} function will now properly convert valid [css color names](https://www.w3schools.com/colors/colors_names.asp) to ColorMaster objects.
|
||||
- The downloaded script icons in the Excalidraw-Obsidian menu were not always correct
|
||||
- The obsidian mobile navigation bar at the bottom overlapped with Excalidraw
|
||||
|
||||
## New
|
||||
- Created ExcalidrawAutomate hook for styling script when the canvas color changes. See sample [onCanvasColorChangeHook](https://gist.github.com/zsviczian/c7223c5b4af30d5c88a0cae05300305c) implementation following the link.
|
||||
|
||||
<div class="excalidraw-videoWrapper"><div>
|
||||
<iframe src="https://www.youtube.com/embed/LtR04fNTKTM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
</div></div>
|
||||
|
||||
${String.fromCharCode(96, 96, 96)}typescript
|
||||
/**
|
||||
* If set, this callback is triggered whenever the active canvas color changes
|
||||
*/
|
||||
onCanvasColorChangeHook: (
|
||||
ea: ExcalidrawAutomate,
|
||||
view: ExcalidrawView, //the Excalidraw view
|
||||
color: string,
|
||||
) => void = null;
|
||||
${String.fromCharCode(96, 96, 96)}
|
||||
`,
|
||||
"1.7.24":`
|
||||
# New and improved
|
||||
- **Updated Chinese translation**. Thanks, @tswwe!
|
||||
- **Improved update for TextElement links**: Until now, when you attached a link to a file to a TextElement using the "Create Link" command, this link did not get updated when the file was renamed or moved. Only links created as markdown links in the TextElement text were updated. Now both approaches work. Keep in mind however, that if you have a link in the TextElemenet text, it will override the link attached to the text element using the create link command. [#566](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/566)
|
||||
- **Transclusion filters markdown comments**: Text transclusion in a TextElement using the ${String.fromCharCode(96)}![[file]]${String.fromCharCode(96)} or ${String.fromCharCode(96)}![[file#section]]${String.fromCharCode(96)} format did not filter out markdown comments in the file placed ${String.fromCharCode(96)}%% inside a comment block %%${String.fromCharCode(96)}. Now they do.
|
||||
- **Remove leading '>' from trancluded quotes**: Added a new option in settings under **Links and Transclusion** to remove the leading ${String.fromCharCode(96)}> ${String.fromCharCode(96)} characters from quotes you transclude as a text element in your drawing.
|
||||

|
||||
- **Added support for ${String.fromCharCode(96)}webp${String.fromCharCode(96)}, ${String.fromCharCode(96)}bmp${String.fromCharCode(96)}, and ${String.fromCharCode(96)}ico${String.fromCharCode(96)} images**. This extends the already supported formats (${String.fromCharCode(96)}jpg${String.fromCharCode(96)}, ${String.fromCharCode(96)}gif${String.fromCharCode(96)}, ${String.fromCharCode(96)}png${String.fromCharCode(96)}, ${String.fromCharCode(96)}svg${String.fromCharCode(96)}).
|
||||
- **Added command palette action to reset images to original size**. Select a single image or embedded Excalidraw drawing on your canvas and choose ${String.fromCharCode(96)}Set selected image element size to 100% of original${String.fromCharCode(96)} from the command palette. This function is especially helpful when you combine atomic drawings on a single canvas, keeping each atomic piece in its original excalidraw file (i.e. the way I create [book on a page summaries](https://www.youtube.com/playlist?list=PL6mqgtMZ4NP1-mbCYc3T7mr-unmsIXpEG))
|
||||
- The ${String.fromCharCode(96)}async getOriginalImageSize(imageElement: ExcalidrawImageElement): Promise<{width: number; height: number}>${String.fromCharCode(96)} function is also avaiable via ExcalidrawAutomate. You may use this function to resize images to custom scales (e.g. 50% size, or to fit a certain bounding rectangle).
|
||||
|
||||
# Fixed
|
||||
- **Upgraded perfect freehand package to resolve unwanted dots on end of lines** [#5727](https://github.com/excalidraw/excalidraw/pull/5727)
|
||||
- **Pinch zoom in View mode opens images** resulting in a very annoying behavior [#837](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/837)
|
||||
- **Embedded files** such as transcluded markdown documents and images **did not honor the Obsidian "New Link Format" setting** (shortest path, relative path, absolute path). [#829](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/829)
|
||||
- **Fixed error with dataview queries involving Excalidraw files**: In case you created a task on an Excalidraw canvas (${String.fromCharCode(96)}docA.md${String.fromCharCode(96)}) by typing ${String.fromCharCode(96)}- [ ] Task [[owner]] #tag${String.fromCharCode(96)}, and then you created a Dataview tasklist in another document (${String.fromCharCode(96)}docB.md${String.fromCharCode(96)}) such that the query criteria matched the task in ${String.fromCharCode(96)}docA.md${String.fromCharCode(96)}, then the task from ${String.fromCharCode(96)}docA.md${String.fromCharCode(96)} only appeared as an empty line when viewing ${String.fromCharCode(96)}docB.md${String.fromCharCode(96)}. If you now embedded ${String.fromCharCode(96)}docB.md${String.fromCharCode(96)} into a third markdown document (${String.fromCharCode(96)}docC.md${String.fromCharCode(96)}), then instead of the contents of ${String.fromCharCode(96)}docB.md${String.fromCharCode(96)} Obsidian rendered ${String.fromCharCode(96)}docA.md${String.fromCharCode(96)}. [#835](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/835)
|
||||
`,
|
||||
"1.7.22":`
|
||||
# Fixed
|
||||
- Text size in sticky notes increased when opening the drawing and when editing a sticky note [#824](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/824)
|
||||
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
INSERT_LINK_TO_ELEMENT_ERROR: "Select a single element in the scene",
|
||||
INSERT_LINK_TO_ELEMENT_READY: "Link is READY and available on the clipboard",
|
||||
INSERT_LINK: "Insert link to file",
|
||||
INSERT_IMAGE: "Insert image or Excalidraw drawing from your vault",
|
||||
INSERT_IMAGE: "Insert image from vault",
|
||||
INSERT_MD: "Insert markdown file from vault",
|
||||
INSERT_LATEX:
|
||||
"Insert LaTeX formula (e.g. \\binom{n}{k} = \\frac{n!}{k!(n-k)!})",
|
||||
@@ -60,9 +60,6 @@ export default {
|
||||
READ_RELEASE_NOTES: "Read latest release notes",
|
||||
TRAY_MODE: "Toggle property-panel tray-mode",
|
||||
SEARCH: "Search for text in drawing",
|
||||
RESET_IMG_TO_100: "Set selected image element size to 100% of original",
|
||||
TEMPORARY_DISABLE_AUTOSAVE: "Disable autosave until next time Obsidian starts (only set this if you know what you are doing)",
|
||||
TEMPORARY_ENABLE_AUTOSAVE: "Enable autosave",
|
||||
|
||||
//ExcalidrawView.ts
|
||||
INSTALL_SCRIPT_BUTTON: "Install or update Excalidraw Scripts",
|
||||
@@ -115,7 +112,7 @@ export default {
|
||||
"Template.md, the setting would be: Excalidraw/Template.md (or just Excalidraw/Template - you may omit the .md file extension). " +
|
||||
"If you are using Excalidraw in compatibility mode, then your template must be a legacy Excalidraw file as well " +
|
||||
"such as Excalidraw/Template.excalidraw.",
|
||||
SCRIPT_FOLDER_NAME: "Excalidraw Automate script folder (CASE SeNSitiVE!)",
|
||||
SCRIPT_FOLDER_NAME: "Excalidraw Automate script folder",
|
||||
SCRIPT_FOLDER_DESC:
|
||||
"The files you place in this folder will be treated as Excalidraw Automate scripts. " +
|
||||
"You can access your scripts from Excalidraw via the Obsidian Command Palette. Assign " +
|
||||
@@ -420,10 +417,9 @@ export default {
|
||||
|
||||
//openDrawings.ts
|
||||
SELECT_FILE: "Select a file then press enter.",
|
||||
SELECT_FILE_WITH_OPTION_TO_SCALE: "Select a file then press ENTER, or ALT+ENTER to insert at 100% scale.",
|
||||
NO_MATCH: "No file matches your query.",
|
||||
SELECT_FILE_TO_LINK: "Select the file you want to insert the link for.",
|
||||
SELECT_DRAWING: "Select the image or drawing you want to insert",
|
||||
SELECT_DRAWING: "Select the drawing you want to insert",
|
||||
TYPE_FILENAME: "Type name of drawing to select.",
|
||||
SELECT_FILE_OR_TYPE_NEW:
|
||||
"Select existing drawing or type name of a new drawing then press Enter.",
|
||||
|
||||
121
src/main.ts
121
src/main.ts
@@ -89,7 +89,7 @@ import {
|
||||
} from "./utils/Utils";
|
||||
import { getAttachmentsFolderAndFilePath, getNewOrAdjacentLeaf, getParentOfClass, isObsidianThemeDark } from "./utils/ObsidianUtils";
|
||||
//import { OneOffs } from "./OneOffs";
|
||||
import { ExcalidrawImageElement, FileId } from "@zsviczian/excalidraw/types/element/types";
|
||||
import { FileId } from "@zsviczian/excalidraw/types/element/types";
|
||||
import { ScriptEngine } from "./Scripts";
|
||||
import {
|
||||
hoverEvent,
|
||||
@@ -103,7 +103,6 @@ import { decompressFromBase64 } from "lz-string";
|
||||
import { Packages } from "./types";
|
||||
import * as React from "react";
|
||||
import { ScriptInstallPrompt } from "./dialogs/ScriptInstallPrompt";
|
||||
import { check } from "prettier";
|
||||
|
||||
|
||||
declare module "obsidian" {
|
||||
@@ -203,8 +202,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
addIcon(PNG_ICON_NAME, PNG_ICON);
|
||||
addIcon(SVG_ICON_NAME, SVG_ICON);
|
||||
|
||||
await this.loadSettings({reEnableAutosave:true});
|
||||
|
||||
await this.loadSettings();
|
||||
this.addSettingTab(new ExcalidrawSettingTab(this.app, this));
|
||||
this.ea = await initExcalidrawAutomate(this);
|
||||
|
||||
@@ -759,28 +757,6 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
),
|
||||
);
|
||||
|
||||
this.addCommand({
|
||||
id: "excalidraw-disable-autosave",
|
||||
name: t("TEMPORARY_DISABLE_AUTOSAVE"),
|
||||
checkCallback: (checking) => {
|
||||
if(!this.settings.autosave) return false; //already disabled
|
||||
if(checking) return true;
|
||||
this.settings.autosave = false;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
|
||||
this.addCommand({
|
||||
id: "excalidraw-enable-autosave",
|
||||
name: t("TEMPORARY_ENABLE_AUTOSAVE"),
|
||||
checkCallback: (checking) => {
|
||||
if(this.settings.autosave) return false; //already enabled
|
||||
if(checking) return true;
|
||||
this.settings.autosave = true;
|
||||
return true;
|
||||
}
|
||||
})
|
||||
|
||||
this.addCommand({
|
||||
id: "excalidraw-download-lib",
|
||||
name: t("DOWNLOAD_LIBRARY"),
|
||||
@@ -1165,7 +1141,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
(async()=>{
|
||||
const isLeftHanded = this.settings.isLeftHanded;
|
||||
await this.loadSettings({applyLefthandedMode: false});
|
||||
await this.loadSettings(false);
|
||||
this.settings.isLeftHanded = !isLeftHanded;
|
||||
this.saveSettings();
|
||||
//not clear why I need to do this. If I don't double apply the stylesheet changes
|
||||
@@ -1177,42 +1153,6 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
},
|
||||
});
|
||||
|
||||
this.addCommand({
|
||||
id: "reset-image-to-100",
|
||||
name: t("RESET_IMG_TO_100"),
|
||||
checkCallback: (checking:boolean) => {
|
||||
const view = this.app.workspace.getActiveViewOfType(ExcalidrawView);
|
||||
if(!view) return false;
|
||||
if(!view.excalidrawAPI) return false;
|
||||
const els = view.getViewSelectedElements().filter(el=>el.type==="image");
|
||||
if(els.length !== 1) {
|
||||
if(checking) return false;
|
||||
new Notice("Select a single image element and try again");
|
||||
return false;
|
||||
}
|
||||
const el = els[0] as ExcalidrawImageElement;
|
||||
const ef = view.excalidrawData.getFile(el.fileId);
|
||||
if(!ef) {
|
||||
if(checking) return false;
|
||||
new Notice("Select a single image element and try again");
|
||||
return false;
|
||||
}
|
||||
if(checking) return true;
|
||||
|
||||
(async () => {
|
||||
const ea = new ExcalidrawAutomate(this,view);
|
||||
const size = await ea.getOriginalImageSize(el);
|
||||
if(size) {
|
||||
ea.copyViewElementsToEAforEditing(els);
|
||||
const eaEl = ea.getElement(el.id);
|
||||
//@ts-ignore
|
||||
eaEl.width = size.width; eaEl.height = size.height;
|
||||
ea.addElementsToView(false,false,false);
|
||||
}
|
||||
})()
|
||||
}
|
||||
})
|
||||
|
||||
this.addCommand({
|
||||
id: "insert-image",
|
||||
name: t("INSERT_IMAGE"),
|
||||
@@ -1658,7 +1598,7 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
const activeLeafChangeEventHandler = async (leaf: WorkspaceLeaf) => {
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/723
|
||||
if(self.leafChangeTimeout) {
|
||||
clearTimeout(self.leafChangeTimeout);
|
||||
clearTimeout(this.leafChangeTimeout);
|
||||
}
|
||||
self.leafChangeTimeout = setTimeout(()=>{self.leafChangeTimeout = null;},1000);
|
||||
|
||||
@@ -1671,25 +1611,6 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
self.lastActiveExcalidrawFilePath = newActiveviewEV.file?.path;
|
||||
}
|
||||
|
||||
//!Temporary hack
|
||||
//https://discord.com/channels/686053708261228577/817515900349448202/1031101635784613968
|
||||
if (app.isMobile && newActiveviewEV && !previouslyActiveEV) {
|
||||
const navbar = document.querySelector("body>.app-container>.mobile-navbar");
|
||||
if(navbar && navbar instanceof HTMLDivElement) {
|
||||
navbar.style.position="relative";
|
||||
}
|
||||
}
|
||||
|
||||
if (app.isMobile && !newActiveviewEV && previouslyActiveEV) {
|
||||
const navbar = document.querySelector("body>.app-container>.mobile-navbar");
|
||||
if(navbar && navbar instanceof HTMLDivElement) {
|
||||
navbar.style.position="";
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------
|
||||
//----------------------
|
||||
|
||||
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.
|
||||
@@ -1727,32 +1648,20 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
} //refresh embedded files
|
||||
}
|
||||
|
||||
|
||||
if ( //@ts-ignore
|
||||
newActiveviewEV && newActiveviewEV._loaded &&
|
||||
newActiveviewEV.isLoaded && newActiveviewEV.excalidrawAPI &&
|
||||
self.ea.onCanvasColorChangeHook
|
||||
) {
|
||||
self.ea.onCanvasColorChangeHook(
|
||||
self.ea,
|
||||
newActiveviewEV,
|
||||
newActiveviewEV.excalidrawAPI.getAppState().viewBackgroundColor
|
||||
);
|
||||
}
|
||||
|
||||
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/300
|
||||
if (self.popScope) {
|
||||
self.popScope();
|
||||
self.popScope = null;
|
||||
}
|
||||
if (newActiveviewEV) {
|
||||
const scope = self.app.keymap.getRootScope();
|
||||
const scope = this.app.keymap.getRootScope();
|
||||
const handler = scope.register(["Mod"], "Enter", () => true);
|
||||
const overridSaveShortcut = (
|
||||
self.forceSaveCommand &&
|
||||
self.forceSaveCommand.hotkeys[0].key === "s" &&
|
||||
self.forceSaveCommand.hotkeys[0].modifiers.includes("Ctrl")
|
||||
this.forceSaveCommand &&
|
||||
this.forceSaveCommand.hotkeys[0].key === "s" &&
|
||||
this.forceSaveCommand.hotkeys[0].modifiers.includes("Ctrl")
|
||||
)
|
||||
const self = this;
|
||||
const saveHandler = overridSaveShortcut
|
||||
? scope.register(["Ctrl"], "s", () => self.forceSaveActiveView(false))
|
||||
: undefined;
|
||||
@@ -2003,16 +1912,10 @@ export default class ExcalidrawPlugin extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
public async loadSettings(opts: {
|
||||
applyLefthandedMode?: boolean,
|
||||
reEnableAutosave?: boolean
|
||||
} = {applyLefthandedMode: true, reEnableAutosave: false}
|
||||
) {
|
||||
if(typeof opts.applyLefthandedMode === "undefined") opts.applyLefthandedMode = true;
|
||||
if(typeof opts.reEnableAutosave === "undefined") opts.reEnableAutosave = false;
|
||||
public async loadSettings(applyLefthandedMode:boolean = true) {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
if(opts.applyLefthandedMode) setLeftHandedMode(this.settings.isLeftHanded);
|
||||
if(opts.reEnableAutosave) this.settings.autosave = true;
|
||||
if(applyLefthandedMode) setLeftHandedMode(this.settings.isLeftHanded);
|
||||
this.settings.autosave = true;
|
||||
this.settings.autosaveInterval = app.isMobile?10000:15000; //more frequent on mobile because Obsidian may be killed on context switching
|
||||
}
|
||||
|
||||
|
||||
@@ -287,15 +287,3 @@ export const ICONS = {
|
||||
</svg>
|
||||
),
|
||||
};
|
||||
|
||||
export const stringToSVG = (svg: string) => {
|
||||
svg = svg
|
||||
.replace(/stroke\s*=\s*['"][^"']*['"]/g,"")
|
||||
.replace(/width\s*=\s*['"][^"']*['"]/g,"")
|
||||
.replace(/height\s*=\s*['"][^"']*['"]/g,"")
|
||||
.replace("<svg ",`<svg style="stroke:var(--icon-fill-color);color:var(--icon-fill-color);fill:var(--icon-fill-color)" `)
|
||||
|
||||
return (
|
||||
<div dangerouslySetInnerHTML={{__html: svg}}></div>
|
||||
)
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import clsx from "clsx";
|
||||
import { Notice, TFile } from "obsidian";
|
||||
import * as React from "react";
|
||||
import { ActionButton } from "./ActionButton";
|
||||
import { ICONS, stringToSVG } from "./ActionIcons";
|
||||
import { ICONS } from "./ActionIcons";
|
||||
import { SCRIPT_INSTALL_FOLDER, CTRL_OR_CMD } from "../Constants";
|
||||
import { insertLaTeXToView, search } from "../ExcalidrawAutomate";
|
||||
import ExcalidrawView, { TextMode } from "../ExcalidrawView";
|
||||
@@ -257,7 +257,6 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
|
||||
className="Island App-menu__left scrollbar"
|
||||
style={{
|
||||
maxHeight: "350px",
|
||||
backgroundColor: "transparent",
|
||||
//@ts-ignore
|
||||
"--padding": 2,
|
||||
display: this.state.minimized ? "none" : "block",
|
||||
@@ -533,9 +532,21 @@ export class ToolsPanel extends React.Component<PanelProps, PanelState> {
|
||||
}
|
||||
}}
|
||||
icon={
|
||||
this.state.scriptIconMap[key].svgString
|
||||
? stringToSVG(this.state.scriptIconMap[key].svgString)
|
||||
: (
|
||||
this.state.scriptIconMap[key].svgString ? (
|
||||
<img
|
||||
src={`data:image/svg+xml,${encodeURIComponent(
|
||||
this.state.theme === "dark"
|
||||
? this.state.scriptIconMap[key].svgString.replace(
|
||||
"<svg ",
|
||||
dark,
|
||||
)
|
||||
: this.state.scriptIconMap[key].svgString.replace(
|
||||
"<svg ",
|
||||
light,
|
||||
),
|
||||
)}`}
|
||||
/>
|
||||
) : (
|
||||
ICONS.cog
|
||||
)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
getEmbedFilename,
|
||||
} from "./utils/FileUtils";
|
||||
import {
|
||||
fragWithHTML,
|
||||
setLeftHandedMode,
|
||||
} from "./utils/Utils";
|
||||
|
||||
@@ -199,6 +198,9 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
mathjaxSourceURL: "https://cdn.jsdelivr.net/npm/mathjax@3.2.1/es5/tex-svg.js"
|
||||
};
|
||||
|
||||
const fragWithHTML = (html: string) =>
|
||||
createFragment((frag) => (frag.createDiv().innerHTML = html));
|
||||
|
||||
export class ExcalidrawSettingTab extends PluginSettingTab {
|
||||
plugin: ExcalidrawPlugin;
|
||||
private requestEmbedUpdate: boolean = false;
|
||||
|
||||
3
src/types.d.ts
vendored
3
src/types.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawImageElement, FileId, FillStyle, NonDeletedExcalidrawElement, StrokeSharpness, StrokeStyle } from "@zsviczian/excalidraw/types/element/types";
|
||||
import { ExcalidrawBindableElement, ExcalidrawElement, FileId, FillStyle, NonDeletedExcalidrawElement, StrokeSharpness, StrokeStyle } from "@zsviczian/excalidraw/types/element/types";
|
||||
import { Point } from "@zsviczian/excalidraw/types/types";
|
||||
import { TFile, WorkspaceLeaf } from "obsidian";
|
||||
import { EmbeddedFilesLoader } from "./EmbeddedFileLoader";
|
||||
@@ -223,7 +223,6 @@ export interface ExcalidrawAutomateInterface {
|
||||
//verifyMinimumPluginVersion returns true if plugin version is >= than required
|
||||
//recommended use:
|
||||
//if(!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("1.5.20")) {new Notice("message");return;}
|
||||
getOriginalImageSize(imageElement: ExcalidrawImageElement): Promise<{width: number; height: number}>;
|
||||
verifyMinimumPluginVersion(requiredVersion: string): boolean;
|
||||
isExcalidrawView(view: any): boolean;
|
||||
selectElementsInView(elements: ExcalidrawElement[]): void; //sets selection in view
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
CASCADIA_FONT,
|
||||
REG_BLOCK_REF_CLEAN,
|
||||
VIRGIL_FONT,
|
||||
PLUGIN_ID,
|
||||
FRONTMATTER_KEY_EXPORT_DARK,
|
||||
FRONTMATTER_KEY_EXPORT_TRANSPARENT,
|
||||
FRONTMATTER_KEY_EXPORT_SVGPADDING,
|
||||
@@ -382,29 +383,19 @@ export const scaleLoadedImage = (
|
||||
.filter((e: any) => e.type === "image" && e.fileId === f.id)
|
||||
.forEach((el: any) => {
|
||||
const [w_old, h_old] = [el.width, el.height];
|
||||
if(f.shouldScale) {
|
||||
const elementAspectRatio = w_old / h_old;
|
||||
if (imageAspectRatio != elementAspectRatio) {
|
||||
dirty = true;
|
||||
const h_new = Math.sqrt((w_old * h_old * h_image) / w_image);
|
||||
const w_new = Math.sqrt((w_old * h_old * w_image) / h_image);
|
||||
el.height = h_new;
|
||||
el.width = w_new;
|
||||
el.y += (h_old - h_new) / 2;
|
||||
el.x += (w_old - w_new) / 2;
|
||||
}
|
||||
} else {
|
||||
if(w_old !== w_image || h_old !== h_image) {
|
||||
dirty = true;
|
||||
el.height = h_image;
|
||||
el.width = w_image;
|
||||
el.y += (h_old - h_image) / 2;
|
||||
el.x += (w_old - w_image) / 2;
|
||||
}
|
||||
const elementAspectRatio = w_old / h_old;
|
||||
if (imageAspectRatio != elementAspectRatio) {
|
||||
dirty = true;
|
||||
const h_new = Math.sqrt((w_old * h_old * h_image) / w_image);
|
||||
const w_new = Math.sqrt((w_old * h_old * w_image) / h_image);
|
||||
el.height = h_new;
|
||||
el.width = w_new;
|
||||
el.y += (h_old - h_new) / 2;
|
||||
el.x += (w_old - w_new) / 2;
|
||||
}
|
||||
});
|
||||
return { dirty, scene };
|
||||
}
|
||||
return { dirty, scene };
|
||||
};
|
||||
|
||||
export const setDocLeftHandedMode = (isLeftHanded: boolean, ownerDocument:Document) => {
|
||||
@@ -631,9 +622,6 @@ export const getEmbeddedFilenameParts = (fname:string):{
|
||||
}
|
||||
}
|
||||
|
||||
export const fragWithHTML = (html: string) =>
|
||||
createFragment((frag) => (frag.createDiv().innerHTML = html));
|
||||
|
||||
export const errorlog = (data: {}) => {
|
||||
console.error({ plugin: "Excalidraw", ...data });
|
||||
};
|
||||
|
||||
@@ -223,8 +223,4 @@ textarea.excalidraw-wysiwyg {
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.is-tablet .excalidraw button {
|
||||
padding: initial;
|
||||
}
|
||||
26
yarn.lock
26
yarn.lock
@@ -2216,10 +2216,10 @@
|
||||
dependencies:
|
||||
"@zerollup/ts-helpers" "^1.7.18"
|
||||
|
||||
"@zsviczian/excalidraw@0.13.0-obsidian":
|
||||
"integrity" "sha512-c4SnBEGKtenLB/1gSjXe3BVA+yZfo8b1p2E7sVcaPG8MTz6cpQsCB2+cv7Zta5ihIxuGfK3ZSepVhMbN7RFY2w=="
|
||||
"resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.13.0-obsidian.tgz"
|
||||
"version" "0.13.0-obsidian"
|
||||
"@zsviczian/excalidraw@0.12.0-obsidian-11":
|
||||
"integrity" "sha512-DoCXKyjFFkpBQ5GTK5Ud3RocqAxwbHzy9fWZIgWqznMqy2sdR9QDg0y/QILMKG4cOuiRlXXvHnpMxfOPkT4eeA=="
|
||||
"resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.12.0-obsidian-11.tgz"
|
||||
"version" "0.12.0-obsidian-11"
|
||||
|
||||
"abab@^2.0.3", "abab@^2.0.5":
|
||||
"integrity" "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="
|
||||
@@ -6206,10 +6206,10 @@
|
||||
dependencies:
|
||||
"minimist" "^1.2.5"
|
||||
|
||||
"moment@2.29.4":
|
||||
"integrity" "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||
"resolved" "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz"
|
||||
"version" "2.29.4"
|
||||
"moment@2.29.3":
|
||||
"integrity" "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw=="
|
||||
"resolved" "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz"
|
||||
"version" "2.29.3"
|
||||
|
||||
"monkey-around@^2.3.0":
|
||||
"integrity" "sha512-QWcCUWjqE/MCk9cXlSKZ1Qc486LD439xw/Ak8Nt6l2PuL9+yrc9TJakt7OHDuOqPRYY4nTWBAEFKn32PE/SfXA=="
|
||||
@@ -6420,13 +6420,13 @@
|
||||
"define-properties" "^1.1.3"
|
||||
"es-abstract" "^1.19.1"
|
||||
|
||||
"obsidian@^0.16.3":
|
||||
"integrity" "sha512-hal9qk1A0GMhHSeLr2/+o3OpLmImiP+Y+sx2ewP13ds76KXsziG96n+IPFT0mSkup1zSwhEu+DeRhmbcyCCXWw=="
|
||||
"resolved" "https://registry.npmjs.org/obsidian/-/obsidian-0.16.3.tgz"
|
||||
"version" "0.16.3"
|
||||
"obsidian@^0.15.4":
|
||||
"integrity" "sha512-FE11CxxpVD6t/DBvjLvlT7q7YYW91ubTqPKIIp286LdnyLipS8Xi3Tif8i8ALPv87Vg9obKM43aWcPsYLxLllQ=="
|
||||
"resolved" "https://registry.npmjs.org/obsidian/-/obsidian-0.15.4.tgz"
|
||||
"version" "0.15.4"
|
||||
dependencies:
|
||||
"@types/codemirror" "0.0.108"
|
||||
"moment" "2.29.4"
|
||||
"moment" "2.29.3"
|
||||
|
||||
"obuf@^1.0.0", "obuf@^1.1.2":
|
||||
"integrity" "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg=="
|
||||
|
||||
Reference in New Issue
Block a user