44 <toolbar @change =" insert" @click =" clickToolbar" @input =" handleToolbarOperation"
55 :toolbarConfig =" editorConfig.toolbarConfig" ref =" toolbar" ></toolbar >
66 </div >
7- <div id =" mp-editor-area" :style = " { height: editorHeight } " >
7+ <div id =" mp-editor-area" >
88 <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'
1414 @input =" updateCode"
1515 @finish =" insertCode = null"
1616 :insertCode =" insertCode"
17- :height =" editorHeight"
1817 :editorOption =" editorConfig.editorOption" ></input-area >
1918 </div >
2019 <div id =" mp-editor-preview-area" class =" mp-editor-area mp-preview-area" :class =" {
2120 'mp-editor-area': this.config.previewDisplay === 'normal',
2221 'mp-editor-area-hide': this.config.previewDisplay === 'hide'
2322 }" >
24- <preview-area v-model =" code" :parser =" contentParser" ref =" previewArea" :height = " editorHeight " ></preview-area >
23+ <preview-area v-model =" code" :parser =" contentParser" ref =" previewArea" ></preview-area >
2524 </div >
2625 </div >
2726 <div id =" mp-editor-dialog" >
3231</template >
3332
3433<style >
34+ #mp-editor-toolbar {
35+ float : left ;
36+ width : 100% ;
37+ height : 40px ;
38+ }
39+ #mp-editor-area {
40+ position : absolute ;
41+ width : 100% ;
42+ top : 40px ;
43+ bottom : 0 ;
44+ overflow : hidden ;
45+ border : 1px solid #ddd ;
46+ }
47+
3548 .mp-editor-container {
49+ position :relative ;
3650 height : 100% ;
3751 }
3852 .mp-editor-area {
4256 float : left ;
4357 }
4458
45- #mp-editor-area {
46- overflow : hidden ;
47- border : 1px solid #ddd ;
48- }
49-
5059 .mp-editor-area-full {
5160 box-sizing : border-box ;
5261 width : 100% ;
@@ -91,10 +100,6 @@ export default {
91100 default : function () {
92101 return defaultConfig
93102 }
94- },
95- size: {
96- required: false ,
97- default: true
98103 }
99104 },
100105 data () {
@@ -111,7 +116,6 @@ export default {
111116 },
112117 mounted () {
113118 this .code = this .value
114- this .$nextTick (this .updateEditorHeight )
115119 },
116120 components: {
117121 InputArea,
@@ -141,36 +145,12 @@ export default {
141145 }
142146 this .dialogRequest = request
143147 this .showDialog = true
144- },
145- updateEditorHeight () {
146- if (this .config .fullScreen ) {
147- this .editorHeight = (window .innerHeight - this .$refs .toolbar .$el .clientHeight ).toString () + ' px'
148- } else {
149- this .editorHeight = (this .$el .clientHeight - this .$refs .toolbar .$el .clientHeight ).toString () + ' px'
150- }
151- },
152- handleToolbarOperation (operation ) {
153- if (operation === ' hide' ) {
154- if (this .config .previewDisplay === ' normal' ) { this .config .previewDisplay = ' hide' } else { this .config .previewDisplay = ' normal' }
155- }
156- if (operation === ' fullScreen' ) {
157- if (! this .config .fullScreen ) {
158- this .config .fullScreen = true
159- this .updateEditorHeight ()
160- } else {
161- this .config .fullScreen = false
162- this .updateEditorHeight ()
163- }
164- }
165148 }
166149 },
167150 watch: {
168151 value (newValue ) {
169152 this .code = newValue
170153 this .updateCode (newValue)
171- },
172- size () {
173- this .$nextTick (this .updateEditorHeight )
174154 }
175155 }
176156}
0 commit comments