Skip to content

Commit 328806b

Browse files
committed
Moved Configuration/default note directory out of root app directory so it doesn't get nuked on update. fixed some styling issues.
1 parent 0583fdd commit 328806b

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

public/style.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ body {
1111
border-radius: 5px;
1212
}
1313

14-
#app #home #settings .editor .CodeMirror {
14+
#app #home .editor .CodeMirror {
1515
font-family: 'Avenir', Helvetica, Arial, sans-serif;
1616
-webkit-font-smoothing: antialiased;
1717
-moz-osx-font-smoothing: grayscale;
@@ -20,6 +20,7 @@ body {
2020
height: 88vh;
2121
}
2222

23+
2324
.CodeMirror {
2425
height: 100%;
2526
}
@@ -89,10 +90,21 @@ body {
8990
border-radius: 5px;
9091
color: white;
9192
padding: 5px;
93+
margin-top:20px;
9294
text-align: center;
9395
text-decoration: none;
9496
}
97+
#settings{
98+
overflow: hidden;
99+
}
95100

96-
#settings #container{
101+
#settings form{
97102
padding:10px;
103+
}
104+
105+
#settings form p{
106+
overflow: hidden;
107+
text-overflow: ellipsis;
108+
max-width: 100vw;
109+
color:red;
98110
}

src/utility/Configuration.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { access, writeFile, constants as fsConstants, readFile } from 'fs';
2-
3-
2+
import {join} from "path";
3+
import { remote } from 'electron';
4+
const configPath = join(remote.app.getPath('userData'), "config.json")
5+
const defaultNotePath = join(remote.app.getPath('userData'), "notes")
46
export default class Configuration {
5-
public notePath: string = "notes"
7+
public notePath: string = defaultNotePath
68
public defaultNote: string = "note.md"
79
public editorConfig: EditorConfig = {
810
lineNumbers: false,
@@ -17,8 +19,8 @@ export default class Configuration {
1719
static getConfig(){
1820
var stashed = new Configuration()
1921
return new Promise<Configuration>((r,e) =>{
20-
access("./config.json", fsConstants.F_OK, (err) => {
21-
if(err) writeFile("./config.json",JSON.stringify(stashed,null,"\t"),ex =>{
22+
access(configPath, fsConstants.F_OK, (err) => {
23+
if(err) writeFile(configPath,JSON.stringify(stashed,null,"\t"),ex =>{
2224
if(ex) e(ex)
2325
this.readFile(stashed,r);
2426
})
@@ -29,7 +31,7 @@ export default class Configuration {
2931
}
3032

3133
private static readFile(stashed:Configuration, resolve){
32-
readFile("./config.json",(e,b)=>{
34+
readFile(configPath,(e,b)=>{
3335
var obj = Object.assign(stashed,JSON.parse(b.toString()));
3436
resolve(obj);
3537
})
@@ -40,7 +42,7 @@ export default class Configuration {
4042
delete (<any>this).data
4143
delete (<any>this).type
4244
console.log(JSON.stringify(this,null,"\t"))
43-
writeFile("./config.json",JSON.stringify(this, null, "\t"),(e) => {
45+
writeFile(configPath,JSON.stringify(this, null, "\t"),(e) => {
4446
if(callback) callback(e);
4547
else console.log(e);
4648
})

src/views/Settings.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<template>
22
<div id="settings">
3-
<NavBar> <router-link slot="controls" :to="'/'"><a><i class="fas fa-sticky-note"></i></a></router-link></NavBar>
4-
5-
<div id="container">
3+
<NavBar> <router-link slot="controls" :to="'/'"><a><i class="fas fa-sticky-note"></i></a></router-link></NavBar>
64
<form>
7-
<div>
8-
<label for="notePath" class="btn" >Select Note Path:</label><span style="margin-left:5px;">"{{config.notePath}}"</span>
5+
<label for="notePath" class="btn">Select Note Path:</label>
6+
<br/><input type="text" readonly alt="test" style="margin-top:15px; width:90vw;" v-model="config.notePath">
97
<input id="notePath" ref="notePath" v-on:change="noteDirChange" webkitdirectory style="visibility:hidden;" type="file">
10-
</div>
8+
<br/>
119
<label for="defaultNote">Default Note:</label>
1210
<select
1311
v-on:change="propChange"
@@ -45,7 +43,6 @@
4543
</label>
4644
</form>
4745
</div>
48-
</div>
4946
</template>
5047

5148
<script lang="ts">

0 commit comments

Comments
 (0)