remove csseditor

This commit is contained in:
Jiiks 2019-03-05 09:43:25 +02:00
parent 2528d87b8f
commit c7bea4a743
13 changed files with 0 additions and 655 deletions

View File

@ -1,23 +0,0 @@
{
"name": "bdcsseditor",
"description": "BetterDiscord css editor package",
"author": "Jiiks",
"version": "0.4.0",
"homepage": "https://betterdiscord.net",
"license": "MIT",
"main": "dist/csseditor.js",
"contributors": [
"Jiiks",
"Pohky"
],
"repository": {
"type": "git",
"url": "https://github.com/JsSucks/BetterDiscordApp.git"
},
"private": false,
"scripts": {
"build": "webpack --progress --colors",
"watch": "webpack --progress --colors --watch",
"release": "webpack --progress --colors --config=webpack.production.config.js"
}
}

View File

@ -1,191 +0,0 @@
<template>
<div class="container">
<div class="titlebar">
<div class="draggable"></div>
<div class="icon">
<div class="inner"></div>
</div>
<div class="title">CSS Editor</div>
<div class="flex-spacer"></div>
<div class="controls">
<button :class="{active: alwaysOnTop}" ref="aot" title="Toggle always on top" @click="toggleaot">P</button>
<button title="Close CSS Editor" @click="close">X</button>
</div>
</div>
<div id="spinner" v-if="loading">
<div class="valign">Loading Please Wait...</div>
</div>
<div id="editor" class="editor">
<codemirror ref="mycm" :options="cmOptions" @input="cmOnChange" />
</div>
<div class="parser-error" v-if="error">{{ error.formatted }}</div>
<div class="tools">
<div class="flex-row">
<button @click="save">Save</button>
<button @click="update">Update</button>
<div class="flex-spacer"></div>
<div id="chkboxLiveUpdate">
<label><input type="checkbox" @click="toggleLiveUpdate" v-model="liveUpdate" /><span>Live Update</span></label>
</div>
</div>
</div>
</div>
</template>
<script>
import { ClientIPC } from 'common';
import { remote } from 'electron';
import 'codemirror/addon/scroll/simplescrollbars.js';
import 'codemirror/mode/css/css.js';
import 'codemirror/addon/hint/css-hint.js';
import 'codemirror/addon/search/search.js';
import 'codemirror/addon/search/searchcursor.js';
import 'codemirror/addon/search/jump-to-line.js';
import 'codemirror/addon/dialog/dialog.js';
import 'codemirror/addon/hint/show-hint.js';
const ExcludedIntelliSenseTriggerKeys = {
'8': 'backspace',
'9': 'tab',
'13': 'enter',
'16': 'shift',
'17': 'ctrl',
'18': 'alt',
'19': 'pause',
'20': 'capslock',
'27': 'escape',
'33': 'pageup',
'34': 'pagedown',
'35': 'end',
'36': 'home',
'37': 'left',
'38': 'up',
'39': 'right',
'40': 'down',
'45': 'insert',
'46': 'delete',
'91': 'left window key',
'92': 'right window key',
'93': 'select',
'107': 'add',
'109': 'subtract',
'110': 'decimal point',
'111': 'divide',
'112': 'f1',
'113': 'f2',
'114': 'f3',
'115': 'f4',
'116': 'f5',
'117': 'f6',
'118': 'f7',
'119': 'f8',
'120': 'f9',
'121': 'f10',
'122': 'f11',
'123': 'f12',
'144': 'numlock',
'145': 'scrolllock',
'186': 'semicolon',
'187': 'equalsign',
'188': 'comma',
'189': 'dash',
'190': 'period',
'191': 'slash',
'192': 'graveaccent',
'220': 'backslash',
'222': 'quote'
};
export default {
data() {
return {
loading: true,
codeMirror: null,
alwaysOnTop: false,
liveUpdate: false,
cmOptions: {
indentUnit: 4,
tabSize: 4,
mode: 'text/x-scss',
lineNumbers: true,
theme: 'material',
scrollbarStyle: 'overlay',
extraKeys: {
'Ctrl-Space': 'autocomplete'
},
dialog: {
'position': 'bottom'
}
},
error: null
}
},
computed: {
codemirror() {
return this.$refs.mycm.codemirror;
},
CodeMirror() {
return this.$refs.mycm;
}
},
created() {
ClientIPC.on('set-scss', (_, scss) => this.setScss(scss));
ClientIPC.on('scss-error', (_, err) => {
this.error = err;
this.$forceUpdate();
if (err)
console.error('SCSS parse error:', err);
});
ClientIPC.on('set-liveupdate', (e, liveUpdate) => this.liveUpdate = liveUpdate);
},
mounted() {
this.codemirror.on('keyup', this.cmOnKeyUp);
(async () => {
this.setScss(await ClientIPC.sendToDiscord('get-scss'));
this.liveUpdate = await ClientIPC.sendToDiscord('get-liveupdate');
})();
},
watch: {
liveUpdate(liveUpdate) {
ClientIPC.sendToDiscord('set-liveupdate', liveUpdate);
}
},
methods: {
save() {
const scss = this.codemirror.getValue();
ClientIPC.sendToDiscord('save-scss', scss);
},
update() {
const scss = this.codemirror.getValue();
ClientIPC.sendToDiscord('update-scss', scss);
},
toggleaot() {
this.alwaysOnTop = !this.alwaysOnTop;
remote.getCurrentWindow().setAlwaysOnTop(this.alwaysOnTop);
},
close() {
window.close();
},
setScss(scss) {
this.loading = false;
this.codemirror.setValue(scss || '');
},
cmOnChange(value) {
if(this.liveUpdate) ClientIPC.sendToDiscord('update-scss', value);
},
cmOnKeyUp(editor, event) {
if (event.ctrlKey) return;
if (ExcludedIntelliSenseTriggerKeys[event.keyCode]) return;
cmCommands.autocomplete(editor, null, { completeSingle: false });
},
toggleLiveUpdate(e) {
this.liveUpdate = !this.liveUpdate;
}
}
}
</script>

View File

@ -1,27 +0,0 @@
// const styles = require('./styles/index.scss');
import Vue from 'vue';
import VueCodemirror from 'vue-codemirror';
import Editor from './Editor.vue';
import styles from './styles/index.scss';
Vue.use(VueCodemirror, {});
window.cmCommands = VueCodemirror.CodeMirror.commands;
const mount = document.createElement('div');
mount.classList.add('container');
document.body.appendChild(mount);
const vue = new Vue({
el: mount,
components: { Editor },
template: '<Editor/>'
});
const style = document.createElement('style');
style.id = 'bd-main';
style.type = 'text/css';
style.appendChild(document.createTextNode(styles));
document.head.appendChild(style);

View File

@ -1,105 +0,0 @@
.CodeMirror-scroll {
cursor: text;
}
.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler {
background: #38444a;
}
.CodeMirror-overlayscroll-horizontal div,
.CodeMirror-overlayscroll-vertical div {
background: rgb(41, 43, 47);
}
.CodeMirror-overlayscroll-horizontal,
.CodeMirror-overlayscroll-horizontal div {
height: 10px;
}
.CodeMirror-overlayscroll-vertical,
.CodeMirror-overlayscroll-vertical div {
width: 10px;
}
.CodeMirror-scrollbar-filler {
width: 10px;
height: 10px;
background: rgb(41, 43, 47);
}
.cm-s-material.CodeMirror {
background: #36393f;
}
.CodeMirror-scroll {
cursor: text;
}
.cm-s-material .CodeMirror-gutters {
background: #292b2f;
}
.CodeMirror-gutter {
min-width: 34px;
border-right: 1px solid hsla(218,5%,47%,.3);
cursor: default;
}
.CodeMirror-hints {
/*background: #1e262a;*/
background: #292b2f;
box-shadow: 2px 3px 5px rgba(4, 4, 4, 0.22);
border: 1px solid #262f33;
&::-webkit-scrollbar {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background-color: rgba(0,0,0,.4);
border-color: transparent;
}
&::-webkit-scrollbar-thumb,
&::-webkit-scrollbar-track {
background-clip: padding-box;
border-width: 3px;
border-style: solid;
border-radius: 7px;
}
&::-webkit-scrollbar-track {
background-color: transparent;
border-color: transparent;
}
}
.CodeMirror-linenumber,
.CodeMirror-line {
padding: 0 5px !important;
}
.CodeMirror-linenumber {
cursor: text;
}
.cm-s-material .CodeMirror-linenumber {
color: #f6f6f7;
}
.CodeMirror-hint {
color: #bac9d2;
}
li.CodeMirror-hint-active {
color: #bac9d2;
/*background: #3b4950;*/
background: #36393f;
}
.CodeMirror-dialog-top {
bottom: 0;
top: auto;
border: none;
background: #1e262a;
}

View File

@ -1,17 +0,0 @@
.editor {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;
.vue-codemirror {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow: hidden;
&, & .CodeMirror {
flex-grow: 1;
}
}
}

View File

@ -1,2 +0,0 @@
$logoSmallGw: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkltYWdlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGUgdH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Zz48L3N2Zz4=);
$bdicon: $logoSmallGw;

View File

@ -1,13 +0,0 @@
@import '../../../node_modules/codemirror/lib/codemirror.css';
@import '../../../node_modules/codemirror/theme/material.css';
@import '../../../node_modules/codemirror/addon/scroll/simplescrollbars.css';
@import '../../../node_modules/codemirror/addon/dialog/dialog.css';
@import '../../../node_modules/codemirror/addon/hint/show-hint.css';
@import './images.scss';
@import './main.scss';
@import './titlebar.scss';
@import './spinner.scss';
@import './editor.scss';
@import './tools.scss';
@import './codemirror.scss';

View File

@ -1,36 +0,0 @@
html, body {
margin: 0;
padding: 0;
max-height: 100%;
height: 100%;
background: #2c383e;
min-width: 700px;
min-height: 400px;
}
* {
outline: none;
}
.flex-spacer {
flex-grow: 1;
}
.flex-row {
display: flex;
flex-direction: row;
}
.valign {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.container {
display: flex;
flex-grow: 1;
flex-direction: column;
height: 100%;
}

View File

@ -1,14 +0,0 @@
#spinner {
background: rgba(51, 48, 48, 0.41);
position: absolute;
top: 34px;
left: 0;
right: 0;
bottom: 0;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
font-weight: 600;
font-size: 2em;
z-index: 90000;
user-select: none;
}

View File

@ -1,71 +0,0 @@
.titlebar {
display: flex;
height: 25px;
padding: 4px 5px;
background: #292b2f;
border-bottom: 1px solid hsla(218,5%,47%,.3);
user-select: none;
cursor: default;
.icon {
width: 31px;
height: 25px;
.inner {
width: 25px;
height: 25px;
background-image: $bdicon;
background-size: 22px 22px;
background-repeat: no-repeat;
background-position: center;
}
}
.title {
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
line-height: 25px;
font-size: 15px;
}
.controls {
margin: 0 0 0 2px;
font-size: 0;
button {
-webkit-app-region: no-drag;
border-radius: 3px;
width: 25px;
font-size: 12px;
font-weight: 600;
background: #36393f;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
transition: background-color .2s ease, color .2s ease;
cursor: default;
border: 0;
height: 25px;
z-index: 900062;
padding: 0;
margin: 0 0 0 4px;
&:hover {
background: #44474e;
color: #FFF;
}
&.active {
background: #3a71c1;
}
}
}
.draggable {
top: 0;
left: 0;
right: 63px;
position: absolute;
height: 33px;
-webkit-app-region: drag;
}
}

View File

@ -1,66 +0,0 @@
.parser-error {
padding: 4px 6px;
background: #292b2f;
border-top: 1px solid hsla(218,5%,47%,.3);
color: #d84040;
font-family: monospace;
white-space: pre-wrap;
font-size: 12px;
}
.tools {
height: 36px;
background: #292b2f;
border-top: 1px solid hsla(218,5%,47%,.3);
display: flex;
flex-direction: column;
user-select: none;
.flex-row {
flex-grow: 1;
padding: 4px 5px;
}
button {
border-radius: 3px;
width: 100px;
padding: 3px 10px;
font-size: 12px;
font-weight: 600;
background: #36393f;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
transition: background-color .2s ease, color .2s ease;
cursor: pointer;
border: 0;
margin-right: 4px;
flex: 0 0 auto;
&:hover {
background: #44474e;
color: #fff;
}
}
#chkboxLiveUpdate {
padding: 3px 10px;
line-height: 22px;
flex: 0 0 auto;
label {
cursor: pointer;
}
input[type="checkbox"] {
margin: 0 6px 0 0;
cursor: pointer;
}
span {
font-size: 12px;
font-weight: 500;
color: #bac9d2;
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
}
}
}

View File

@ -1,43 +0,0 @@
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const vueLoader = {
test: /\.(vue)$/,
exclude: /node_modules/,
use: 'vue-loader'
};
const scssLoader = {
test: /\.(css|scss)$/,
use: ['css-loader', 'sass-loader']
};
module.exports = {
entry: './src/index.js',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'csseditor.js'
},
module: {
rules: [vueLoader, scssLoader]
},
externals: {
electron: 'window.require("electron")',
fs: 'window.require("fs")',
util: 'window.require("util")',
process: 'require("process")'
},
resolve: {
alias: {
vue$: path.resolve('..', 'node_modules', 'vue', 'dist', 'vue.esm.js')
},
modules: [
path.resolve('..', 'node_modules'),
path.resolve('..', 'common', 'modules')
]
},
plugins: [
new VueLoaderPlugin()
]
};

View File

@ -1,47 +0,0 @@
const path = require('path');
const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const vueLoader = {
test: /\.(vue)$/,
exclude: /node_modules/,
use: 'vue-loader'
};
const scssLoader = {
test: /\.(css|scss)$/,
use: ['css-loader', 'sass-loader']
};
module.exports = {
entry: './src/index.js',
mode: 'production',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'csseditor-release.js'
},
module: {
rules: [vueLoader, scssLoader]
},
externals: {
electron: 'window.require("electron")',
fs: 'window.require("fs")',
util: 'window.require("util")',
process: 'require("process")'
},
resolve: {
alias: {
vue$: path.resolve('..', 'node_modules', 'vue', 'dist', 'vue.esm.js')
},
modules: [
path.resolve('..', 'node_modules'),
path.resolve('..', 'common', 'modules')
]
},
plugins: [
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(true)
}),
new VueLoaderPlugin()
]
};