Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed Jul 11, 2021
1 parent d772490 commit 803fb9e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "1.2.2",
"version": "1.2.3",
"minAppVersion": "0.11.13",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
Expand Down
1 change: 0 additions & 1 deletion src/ExcalidrawAutomate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,5 +516,4 @@ async function getTemplate(fileWithPath: string):Promise<{elements: any,appState
+ String.fromCharCode(96)+String.fromCharCode(96)+String.fromCharCode(96)+'json\n'
+ data + '\n'
+ String.fromCharCode(96)+String.fromCharCode(96)+String.fromCharCode(96);
//+data.replaceAll("[","&#91;");
}
15 changes: 7 additions & 8 deletions src/ExcalidrawView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
WorkspaceItem,
Notice,
Menu,
parseLinktext,
MarkdownSourceView,
} from "obsidian";
import * as React from "react";
import * as ReactDOM from "react-dom";
Expand Down Expand Up @@ -328,15 +326,18 @@ export default class ExcalidrawView extends TextFileView {
});
}

private loadDrawing (justloaded:boolean) {
private loadDrawing(justloaded:boolean) {
//console.log("ExcalidrawView.loadDrawing, justloaded", justloaded);
this.justLoaded = justloaded; //a flag to trigger zoom to fit after the drawing has been loaded
const excalidrawData = this.excalidrawData.scene;
if(this.excalidrawRef) {
if(justloaded) this.excalidrawRef.current.resetScene();
this.excalidrawRef.current.updateScene({
elements: excalidrawData.elements,
appState: excalidrawData.appState,
commitToHistory: false,
});
if(justloaded) this.excalidrawRef.current.scrollToContent();
} else {
(async() => {
this.instantiateExcalidraw({
Expand Down Expand Up @@ -719,14 +720,13 @@ export default class ExcalidrawView extends TextFileView {
onChange: (et:ExcalidrawElement[],st:AppState) => {
if(this.justLoaded) {
this.justLoaded = false;
previousSceneVersion = Excalidraw.getSceneVersion(et);
const e = new KeyboardEvent("keydown", {bubbles : true, cancelable : true, shiftKey : true, code:"Digit1"});
this.contentEl.querySelector("canvas")?.dispatchEvent(e);
excalidrawRef.current.scrollToContent();
previousSceneVersion = getSceneVersion(et);
}
if (st.editingElement == null && st.resizingElement == null &&
st.draggingElement == null && st.editingGroupId == null &&
st.editingLinearElement == null ) {
const sceneVersion = Excalidraw.getSceneVersion(et);
const sceneVersion = getSceneVersion(et);
if(sceneVersion != previousSceneVersion) {
previousSceneVersion = sceneVersion;
this.dirty=true;
Expand Down Expand Up @@ -755,7 +755,6 @@ export default class ExcalidrawView extends TextFileView {
exportWithDarkMode: exportSettings.withTheme ? (scene.appState?.theme=="light" ? false : true) : false,
... scene.appState,},
exportPadding:10,
//metadata: "Generated by Excalidraw-Obsidian plugin",
});
} catch (error) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/lang/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
SAVE_AS_SVG: "Save as SVG into Vault (CTRL/META+CLICK to export)",
OPEN_LINK: "Open selected text as link\n(SHIFT+CLICK to open in a new pane)",
EXPORT_EXCALIDRAW: "Export to an .Excalidraw file",
UNLOCK_TO_EDIT: "Automatically UNLOCKED Text Elements to allow edit",
UNLOCK_TO_EDIT: "UNLOCKED Text Elements automatically to allow edit",
LINK_BUTTON_CLICK_NO_TEXT: 'Select a Text Element containing an internal or external link.\n'+
'SHIFT CLICK this button to open the link in a new pane.\n'+
'CTRL/META CLICK the Text Element on the canvas has the same effect!',
Expand Down

0 comments on commit 803fb9e

Please sign in to comment.