Skip to content

Commit

Permalink
solved #46, #45, #44, #41, #40, #38, #37
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed May 6, 2021
1 parent 660f6e0 commit c962168
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/ExcalidrawView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
WorkspaceLeaf,
normalizePath,
TFile,
Menu,
WorkspaceItem
} from "obsidian";
import * as React from "react";
import * as ReactDOM from "react-dom";
Expand All @@ -26,6 +26,10 @@ import {
} from './constants';
import ExcalidrawPlugin from './main';

interface WorkspaceItemExt extends WorkspaceItem {
containerEl: HTMLElement;
}

export interface ExportSettings {
withBackground: boolean,
withTheme: boolean
Expand Down Expand Up @@ -107,6 +111,11 @@ export default class ExcalidrawView extends TextFileView {
});
this.addAction(PNG_ICON_NAME,"Export as PNG",async (ev)=>this.savePNG());
this.addAction(SVG_ICON_NAME,"Export as SVG",async (ev)=>this.saveSVG());
if (this.app.workspace.layoutReady) {
(this.app.workspace.rootSplit as WorkspaceItem as WorkspaceItemExt).containerEl.addEventListener('scroll',(e)=>{if(this.refresh) this.refresh();});
} else {
this.registerEvent(this.app.workspace.on('layout-ready', async () => (this.app.workspace.rootSplit as WorkspaceItem as WorkspaceItemExt).containerEl.addEventListener('scroll',(e)=>{if(this.refresh) this.refresh();})));
}
}

//save current drawing when user closes workspace leaf
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default class ExcalidrawPlugin extends Plugin {
item.setTitle("Create Excalidraw drawing")
.setIcon(ICON_NAME)
.onClick(evt => {
this.createDrawing(file.path+this.getNextDefaultFilename(),false,file.path);
this.createDrawing(this.getNextDefaultFilename(),false,file.path);
})
});
}
Expand Down
4 changes: 4 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ div.excalidraw-svg-right {

div.excalidraw-svg-left {
text-align: left;
}

button.ToolIcon_type_button[title="Export"] {
display:none;
}

0 comments on commit c962168

Please sign in to comment.