Load correct editor file

This commit is contained in:
Jiiks 2019-02-28 17:07:53 +02:00
parent b22923d12f
commit b8d16c6e4d
1 changed files with 8 additions and 2 deletions

View File

@ -209,7 +209,13 @@ export default class Editor extends Module {
* Opens an editor.
* @return {Promise}
*/
openEditor(options) {
async openEditor(options) {
if (!this.editorPkg) {
this.editorPkg = await FileUtils.readJsonFromFile(path.join(this.editorPath, 'package.json'));
}
console.log(this.editorPkg);
return new Promise((resolve, reject) => {
if (this.editor) {
if (this.editor.isFocused()) return;
@ -236,7 +242,7 @@ export default class Editor extends Module {
});
this.editor.webContents.on('did-finish-load', () => {
this.editorUtils.injectScript(path.join(this.editorPath, 'editor.js'));
this.editorUtils.injectScript(path.join(this.editorPath, this.editorPkg.main));
resolve(true);
});
})