From 3fc1adc503b6c6a352798afdc850b261a7f5ee4d Mon Sep 17 00:00:00 2001 From: Jiiks Date: Sun, 24 Feb 2019 18:39:28 +0200 Subject: [PATCH] get files/snippets from core --- core/src/main.js | 12 ++++++++++++ editor/src/Editor.vue | 34 ++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/core/src/main.js b/core/src/main.js index aeae655d..3f2efbac 100644 --- a/core/src/main.js +++ b/core/src/main.js @@ -101,6 +101,18 @@ class Comms { const result = await this.sendToDiscord('bd-runEditorScript', script); event.reply(result); }); + + BDIpc.on('bd-editor-getFiles', async (event) => { + event.reply([ + { type: 'file', name: 'custom.scss', content: '', savedContent: '', mode: 'scss', saved: true } + ]); + }); + + BDIpc.on('bd-editor-getSnippets', async (event) => { + event.reply([ + { type: 'snippet', name: 'test.js', content: '', savedContent: '', mode: 'javascript', saved: true } + ]); + }); } async send(channel, message) { diff --git a/editor/src/Editor.vue b/editor/src/Editor.vue index 71430d37..140c18c9 100644 --- a/editor/src/Editor.vue +++ b/editor/src/Editor.vue @@ -12,16 +12,17 @@ - +
+
Loading Please Wait...
+
+ @@ -51,7 +52,7 @@ export default { data() { return { - files: [{ type: 'file', name: 'custom.scss', content: 'asd', savedContent: 'asd', mode: 'scss', saved: true }], + files: [], snippets: [], loading: true, alwaysOnTop: false, @@ -64,9 +65,17 @@ ClientIPC.on('bd-editor-addSnippet', (_, snippet) => this.addSnippet(snippet)); }, mounted() { + (async () => { + this.files = await ClientIPC.send('bd-editor-getFiles'); + this.snippets = await ClientIPC.send('bd-editor-getSnippets'); + + this.loading = false; + })(); }, methods: { - addFile(file) { this.files.push(file) }, + addFile(file) { + this.files.push(file); + }, addSnippet(snippet) { this.snippets.push(file) }, updateContent(item, content) { @@ -124,6 +133,7 @@ this.alwaysOnTop = !this.alwaysOnTop; remote.getCurrentWindow().setAlwaysOnTop(this.alwaysOnTop); }, + close() { window.close(); }