1
- import { debounce , Debouncer , MarkdownPostProcessorContext , Menu , Notice , TFile } from "obsidian"
2
- import { v4 as uuidv4 } from "uuid"
3
- import PlantumlPlugin from "./main"
4
- import { Processor } from "./processor"
1
+ import { debounce , Debouncer , MarkdownPostProcessorContext , Menu , Notice , TFile } from "obsidian" ;
2
+ import { v4 as uuidv4 } from "uuid" ;
3
+ import PlantumlPlugin from "./main" ;
4
+ import { Processor } from "./processor" ;
5
5
6
6
export class DebouncedProcessors implements Processor {
7
7
@@ -140,14 +140,14 @@ export class DebouncedProcessors implements Processor {
140
140
}
141
141
142
142
const getFolder = async ( ) => {
143
- let exportPath = this . plugin . settings . exportPath
143
+ let exportPath = this . plugin . settings . exportPath ;
144
144
if ( ! exportPath . startsWith ( '/' ) ) {
145
145
// relative to the document
146
146
const documentPath = this . plugin . app . vault . getAbstractFileByPath ( ctx . sourcePath ) . parent ;
147
- exportPath = `${ documentPath . path } /${ exportPath } `
147
+ exportPath = `${ documentPath . path } /${ exportPath } ` ;
148
148
}
149
149
150
- const exists = await this . plugin . app . vault . adapter . exists ( exportPath )
150
+ const exists = await this . plugin . app . vault . adapter . exists ( exportPath ) ;
151
151
if ( ! exists ) {
152
152
this . plugin . app . vault . createFolder ( exportPath ) ;
153
153
}
@@ -167,10 +167,10 @@ export class DebouncedProcessors implements Processor {
167
167
168
168
let fName = fileName ;
169
169
if ( fName . startsWith ( '/' ) ) {
170
- fName = fName . substring ( 1 )
170
+ fName = fName . substring ( 1 ) ;
171
171
}
172
172
173
- const folderOrFile = this . plugin . app . vault . getAbstractFileByPath ( fName )
173
+ const folderOrFile = this . plugin . app . vault . getAbstractFileByPath ( fName ) ;
174
174
175
175
if ( folderOrFile instanceof TFile ) {
176
176
return folderOrFile as TFile ;
@@ -183,10 +183,10 @@ export class DebouncedProcessors implements Processor {
183
183
if ( img ) {
184
184
renderToBlob ( img , 'An error occurred while exporting the diagram' , async ( blob ) => {
185
185
const filename = await getFilePath ( 'png' ) ;
186
- const buffer = await blob . arrayBuffer ( )
187
- const file = getFile ( filename )
186
+ const buffer = await blob . arrayBuffer ( ) ;
187
+ const file = getFile ( filename ) ;
188
188
if ( file ) {
189
- await this . plugin . app . vault . modifyBinary ( file , buffer )
189
+ await this . plugin . app . vault . modifyBinary ( file , buffer ) ;
190
190
} else {
191
191
await this . plugin . app . vault . createBinary ( filename , buffer ) ;
192
192
}
@@ -198,16 +198,16 @@ export class DebouncedProcessors implements Processor {
198
198
const saveTextFile = async ( type : string , data : string ) => {
199
199
try {
200
200
const filename = await getFilePath ( type ) ;
201
- const file = getFile ( filename )
201
+ const file = getFile ( filename ) ;
202
202
if ( file ) {
203
203
await this . plugin . app . vault . modify ( file , data ) ;
204
204
} else {
205
- await this . plugin . app . vault . create ( filename , data )
205
+ await this . plugin . app . vault . create ( filename , data ) ;
206
206
}
207
207
new Notice ( `Diagram exported to '${ filename } '` ) ;
208
208
} catch ( error ) {
209
209
new Notice ( 'An error occurred while while exporting the diagram' ) ;
210
- console . error ( error )
210
+ console . error ( error ) ;
211
211
}
212
212
}
213
213
0 commit comments