custom css inject and file saved state
This commit is contained in:
parent
1b6f3005f5
commit
109eb31aa5
|
@ -22,6 +22,20 @@ export default new class extends Module {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialize() {
|
||||||
|
super.initialize();
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
// TODO this is temporary
|
||||||
|
const userScss = await this.send('readDataFile', 'user.scss');
|
||||||
|
const compiled = await this.send('compileSass', { data: userScss });
|
||||||
|
this.injectStyle('customcss', compiled.css.toString());
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('SCSS Compilation error', err);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
events(ipc) {
|
events(ipc) {
|
||||||
ipc.on('editor-runScript', (e, script) => {
|
ipc.on('editor-runScript', (e, script) => {
|
||||||
try {
|
try {
|
||||||
|
@ -33,11 +47,15 @@ export default new class extends Module {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('editor-injectStyle', (e, { id, style }) => {
|
ipc.on('editor-injectStyle', (e, { id, style }) => {
|
||||||
DOM.injectStyle(style, `userstyle-${id}`);
|
this.injectStyle(id, style);
|
||||||
e.reply('ok');
|
e.reply('ok');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
injectStyle(id, style) {
|
||||||
|
return DOM.injectStyle(style, `userstyle-${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show editor, flashes if already visible.
|
* Show editor, flashes if already visible.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -92,6 +92,11 @@ class Comms {
|
||||||
BDIpc.on('bd-keytar-set', (event, { service, account, password }) => keytar.setPassword(service, account, password), true);
|
BDIpc.on('bd-keytar-set', (event, { service, account, password }) => keytar.setPassword(service, account, password), true);
|
||||||
BDIpc.on('bd-keytar-delete', (event, { service, account }) => keytar.deletePassword(service, account), true);
|
BDIpc.on('bd-keytar-delete', (event, { service, account }) => keytar.deletePassword(service, account), true);
|
||||||
BDIpc.on('bd-keytar-find-credentials', (event, { service }) => keytar.findCredentials(service), true);
|
BDIpc.on('bd-keytar-find-credentials', (event, { service }) => keytar.findCredentials(service), true);
|
||||||
|
|
||||||
|
BDIpc.on('bd-readDataFile', async (event, fileName) => {
|
||||||
|
const rf = await FileUtils.readFile(path.resolve(configProxy().getPath('data'), fileName));
|
||||||
|
event.reply(rf);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(channel, message) {
|
async send(channel, message) {
|
||||||
|
|
|
@ -123,8 +123,13 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
async saveFile(file) {
|
async saveFile(file) {
|
||||||
const result = await ClientIPC.send('bd-editor-saveFile', file);
|
try {
|
||||||
console.log(result);
|
const result = await ClientIPC.send('bd-editor-saveFile', file);
|
||||||
|
file.savedContent = file.content;
|
||||||
|
file.saved = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async saveSnippet(snippet) {
|
async saveSnippet(snippet) {
|
||||||
|
|
Loading…
Reference in New Issue