From 2618876e628ce15989958ee0a42b19954b0871ad Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 22 Jan 2018 13:22:39 +0200 Subject: [PATCH] css saving --- csseditor/src/Editor.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/csseditor/src/Editor.vue b/csseditor/src/Editor.vue index 7d675b18..5940764e 100644 --- a/csseditor/src/Editor.vue +++ b/csseditor/src/Editor.vue @@ -25,7 +25,7 @@
- +
Live Update @@ -105,7 +105,13 @@ /*Methods*/ function save() { - + const css = this.codemirror.getValue(); + sendToDiscord('save-css', css); + } + + function update() { + const css = this.codemirror.getValue(); + sendToDiscord('update-css', css); } function toggleaot() { @@ -119,7 +125,7 @@ function setCss(css) { this.loading = false; - this.codemirror.setValue(css); + this.codemirror.setValue(css || ''); } function cmOnChange(value) { @@ -136,7 +142,7 @@ this.liveUpdate = !this.liveUpdate; } - const methods = { save, toggleaot, close, setCss, cmOnChange, cmOnKeyUp, toggleLiveUpdate }; + const methods = { save, update, toggleaot, close, setCss, cmOnChange, cmOnKeyUp, toggleLiveUpdate }; export default { methods, @@ -172,12 +178,12 @@ }, mounted: function () { this.codemirror.on('keyup', this.cmOnKeyUp); - this.setCss(); BDIpc.on('set-css', (_, data) => { if (data.error) { console.log(data.error); return; } + console.log(data); this.setCss(data.css); });