Skip to content

Commit

Permalink
Merge pull request #34 from hiro0218/feature/redesign-toolbar
Browse files Browse the repository at this point in the history
Feature/redesign toolbar
  • Loading branch information
hiro0218 committed Jun 10, 2018
2 parents 9872cdb + fbe8d8c commit a51525c
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 225 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -34,6 +34,7 @@
"lodash": "^4.17.10",
"vue": "^2.5.16",
"vue-electron": "^1.0.6",
"vue-material": "^1.0.0-beta-10.2",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
Expand Down
Binary file modified screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/index.ejs
Expand Up @@ -9,6 +9,7 @@
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
</script>
<% } %>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:400,700,400italic|Material+Icons">
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/assets/style/common/_variables.scss
Expand Up @@ -2,7 +2,7 @@
// Font
// -------------------------
$font-family-sansSerif: -apple-system, BlinkMacSystemFont, "Noto Sans JP", YuGothic, "Yu Gothic", "游ゴシック体", "游ゴシック", "ヒラギノ角ゴ ProN W3", "Hiragino Kaku Gothic ProN", "メイリオ", Meiryo, Emoji, sans-serif !default;
$font-family-monospace: "Source Code Pro", #{$font-family-sansSerif}, Emoji, monospace !default;
$font-family-monospace: Roboto, #{$font-family-sansSerif}, Emoji, monospace !default;
$font-weight-base: normal;

$font-size-base: 16px;
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/assets/style/plugin/_github-markdown.scss
Expand Up @@ -147,7 +147,7 @@
.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
font-family: monospace, monospace;
font-family: $font-family-monospace, monospace;
font-size: 1em;
}

Expand Down Expand Up @@ -312,7 +312,6 @@
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

.markdown-body .octicon {
Expand Down Expand Up @@ -653,7 +652,6 @@
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
Expand Down
24 changes: 23 additions & 1 deletion src/renderer/components/Editor.vue
Expand Up @@ -4,7 +4,8 @@
<codemirror ref="editor"
:code="code"
:options="editorOptions"
@input="onEditorCodeChange"/>
@input="onEditorCodeChange"
@changes="checkEditorHistory"/>
</div>
<div v-if="isPreview == true" class="preview">
<div class="markdown-body" v-html="input"/>
Expand Down Expand Up @@ -55,6 +56,7 @@ export default {
},
mounted() {
Menu.togglePreview = this.togglePreview;
Menu.toggleToolbar = this.toggleToolbar;
Menu.newFile = this.newFile;
Menu.openFile = this.openFile;
Menu.saveFile = this.saveFile;
Expand All @@ -64,15 +66,35 @@ export default {
this.openLinkExternal();
},
methods: {
checkEditorHistory() {
let { undo, redo } = this.editor.historySize();
this.$store.dispatch('setCanUndo', undo > 0);
this.$store.dispatch('setCanRedo', redo > 0);
},
togglePreview() {
this.$store.dispatch('updateIsPreview', !this.isPreview);
},
toggleToolbar() {
this.$store.dispatch('toggleToolbar');
},
onEditorCodeChange: debounce(function(newCode) {
this.code = newCode;
if (this.isPreview) {
this.input = this.markdown.render(newCode);
}
}, 200),
undo() {
this.editor.undo();
},
redo() {
this.editor.redo();
},
canUndo() {
return this.editor.historySize().undo > 0;
},
canRedo() {
return this.editor.historySize().redo > 0;
},
openDialog(type, msg) {
const remote = this.$electron.remote;
const dialog = remote.dialog;
Expand Down
12 changes: 8 additions & 4 deletions src/renderer/components/Main.vue
@@ -1,21 +1,25 @@
<template>
<div>
<editor ref="mii-editor"/>
<div class="container">
<toolbar/>
<editor ref="miiEditor"/>
</div>
</template>

<script>
import Toolbar from '@/components/Toolbar';
import Editor from '@/components/Editor';
export default {
name: 'MiiMain',
components: {
Toolbar,
Editor,
},
mounted: function() {},
methods: {},
};
</script>

<style scoped>
.container {
display: flex;
}
</style>

0 comments on commit a51525c

Please sign in to comment.