|
|
@ -4,7 +4,6 @@ import EventEmitter from 'events' |
|
|
|
|
|
|
|
|
|
|
|
export class DocViewer extends PluginClient { |
|
|
|
export class DocViewer extends PluginClient { |
|
|
|
mdFile: string |
|
|
|
mdFile: string |
|
|
|
fileContents: string |
|
|
|
|
|
|
|
eventEmitter: EventEmitter |
|
|
|
eventEmitter: EventEmitter |
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
super() |
|
|
|
super() |
|
|
@ -15,25 +14,9 @@ export class DocViewer extends PluginClient { |
|
|
|
this.onload() |
|
|
|
this.onload() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async setProperties() { |
|
|
|
|
|
|
|
console.log('inside setProperties') |
|
|
|
|
|
|
|
this.on('docgen' as any, 'docsGenerated', async (docs: string[]) => { |
|
|
|
|
|
|
|
console.log('docsGenerated', docs) |
|
|
|
|
|
|
|
this.mdFile = docs[0] |
|
|
|
|
|
|
|
const contents = await this.call('fileManager', 'readFile', this.mdFile) |
|
|
|
|
|
|
|
console.log({ contents }) |
|
|
|
|
|
|
|
this.fileContents = contents |
|
|
|
|
|
|
|
this.eventEmitter.emit('docviewer', 'contentsReady', this.fileContents) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async viewDocs(docs: string[]) { |
|
|
|
async viewDocs(docs: string[]) { |
|
|
|
console.log('viewDocs', docs) |
|
|
|
|
|
|
|
console.log('docsGenerated', docs) |
|
|
|
|
|
|
|
this.mdFile = docs[0] |
|
|
|
this.mdFile = docs[0] |
|
|
|
const contents = await this.call('fileManager', 'readFile', this.mdFile) |
|
|
|
const contents = await this.call('fileManager', 'readFile', this.mdFile) |
|
|
|
console.log({ contents }) |
|
|
|
|
|
|
|
this.fileContents = contents |
|
|
|
|
|
|
|
this.eventEmitter.emit('contentsReady', contents) |
|
|
|
this.eventEmitter.emit('contentsReady', contents) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |