Skip to content

Commit 0f55024

Browse files
committed
Fix height
1 parent 2be4a53 commit 0f55024

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

src/components/InputArea.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div id="input-area">
2+
<div id="mp-input-area">
33
<codemirror
44
:value="code"
55
:options="editorOption"
@@ -9,6 +9,12 @@
99
</div>
1010
</template>
1111

12+
<style>
13+
#mp-input-area {
14+
overflow: auto;
15+
}
16+
</style>
17+
1218
<script>
1319
import {codemirror} from 'vue-codemirror-lite'
1420
import 'codemirror/mode/markdown/markdown.js'
@@ -22,12 +28,11 @@ export default {
2228
editorOption: {
2329
type: Object
2430
},
25-
height: {
26-
type: String,
27-
default: '400px'
28-
},
2931
insertCode: {
3032
default: null
33+
},
34+
height: {
35+
type: String
3136
}
3237
},
3338
computed: {
@@ -58,11 +63,11 @@ export default {
5863
5964
this.$emit('finish')
6065
},
61-
height (newHeight) {
62-
this.editor.setSize('100%', newHeight)
63-
},
6466
value (newValue) {
6567
this.code = newValue
68+
},
69+
height (newHeight) {
70+
this.editor.setSize('100%', newHeight)
6671
}
6772
},
6873
data: function () {

src/components/MarkdownPalettes.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44
<toolbar @change="insert" @click="clickToolbar" @input="handleToolbarOperation"
55
:toolbarConfig="editorConfig.toolbarConfig" ref="toolbar"></toolbar>
66
</div>
7-
<div id="mp-editor-area">
8-
<div id="mp-editor-input-area" class="mp-input-area" :class="{
7+
<div id="mp-editor-area" :style="{ height: editorHeight }">
8+
<div id="mp-editor-input-area" class="mp-editor-area mp-input-area" :class="{
99
'mp-editor-area': this.config.previewDisplay === 'normal',
1010
'mp-editor-area-full': this.config.previewDisplay === 'hide'
1111
}">
1212
<input-area v-model="code"
1313
ref="inputArea"
1414
@input="updateCode"
1515
@finish="insertCode = null"
16-
:height="editorHeight"
1716
:insertCode="insertCode"
17+
:height="editorHeight"
1818
:editorOption="editorConfig.editorOption"></input-area>
1919
</div>
2020
<div id="mp-editor-preview-area" class="mp-editor-area mp-preview-area" :class="{
2121
'mp-editor-area': this.config.previewDisplay === 'normal',
2222
'mp-editor-area-hide': this.config.previewDisplay === 'hide'
2323
}">
24-
<preview-area v-model="code" :height="editorHeight"
25-
:parsers="editorConfig.parsers" ref="previewArea"></preview-area>
24+
<preview-area v-model="code" :parsers="editorConfig.parsers" ref="previewArea"></preview-area>
2625
</div>
2726
</div>
2827
<div id="mp-editor-dialog">
@@ -36,7 +35,9 @@
3635
.mp-editor-area {
3736
box-sizing: border-box;
3837
width: 50%;
38+
height: 100%;
3939
float: left;
40+
overflow: auto;
4041
border-bottom: 1px solid #ddd;
4142
border-top: 1px solid #ddd;
4243
}
@@ -58,6 +59,7 @@
5859
5960
.mp-preview-area {
6061
border-right: 1px solid #ddd;
62+
padding-bottom: 2px;
6163
}
6264
6365
.mp-fullscreen {

src/components/PreviewArea.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div id="mp-preview-area" :style="{ 'height': height }">
2+
<div id="mp-preview-area">
33
<div id="mp-preview-content" v-html="content"></div>
44
</div>
55
</template>
@@ -16,6 +16,7 @@
1616
#mp-preview-area {
1717
overflow: auto;
1818
background-color: white;
19+
height: 100%;
1920
}
2021
2122
#mp-preview-content table {
@@ -49,10 +50,6 @@ export default {
4950
type: String,
5051
default: ''
5152
},
52-
height: {
53-
type: String,
54-
default: '400px'
55-
},
5653
parsers: {
5754
type: Array
5855
}

0 commit comments

Comments
 (0)