|
1 | 1 | <template> |
2 | 2 | <div class="mp-editor-container" :class="{'mp-full-screen': this.fullScreen}"> |
3 | | - <div class="mp-editor-toolbar"> |
4 | | - <ul class="mp-editor-menu" v-if="toolbarConfig.length > 0"> |
5 | | - <li v-for="(item, index) in toolbarConfig" :class="{'mp-divider':item.name === '|'}" :key="item.name + index"> |
| 3 | + <div class="mp-editor-toolbar" v-if="toolbarBtns.length"> |
| 4 | + <ul class="mp-editor-menu"> |
| 5 | + <li v-for="(item, index) in toolbarBtns" :class="{'mp-divider':item.name === '|'}" :key="item.name + index"> |
6 | 6 | <span v-if="item.name === '|'">|</span> |
7 | 7 | <a v-else :title="t(ensureValue(item.title))" @click="toolbarAction(item)" unselectable="on"> |
8 | 8 | <i :class="['fa', ensureValue(item.icon)]" unselectable="on">{{ ensureValue(item.content) }}</i> |
|
13 | 13 | <div class="mp-editor-ground"> |
14 | 14 | <div class="mp-editor-zone mp-input-zone" :class="{ |
15 | 15 | 'mp-editor-zone': previewDisplay === 'normal', |
16 | | - 'mp-editor-zone-full': previewDisplay === 'hide' |
| 16 | + 'mp-editor-zone-full': previewDisplay === 'hide', |
| 17 | + 'mp-editor-zone-hide': previewDisplay === 'full' |
17 | 18 | }"> |
18 | 19 | <div class="mp-input-area" ref="inputArea"></div> |
19 | 20 | </div> |
20 | 21 | <div class="mp-editor-zone mp-preview-zone" :class="{ |
21 | 22 | 'mp-editor-zone': previewDisplay === 'normal', |
22 | | - 'mp-editor-zone-hide': previewDisplay === 'hide' |
| 23 | + 'mp-editor-zone-hide': previewDisplay === 'hide', |
| 24 | + 'mp-editor-zone-full': previewDisplay === 'full' |
23 | 25 | }"> |
24 | 26 | <div class="mp-preview-area" ref="previewArea" @scroll="previewAreaScroll"> |
25 | 27 | <div class="mp-preview-content" ref="previewContent" v-html="previewContent"></div> |
|
34 | 36 | </template> |
35 | 37 |
|
36 | 38 | <style scoped lang="stylus"> |
| 39 | + .mp-editor-zone |
| 40 | + height: 100% |
| 41 | + .mp-input-zone |
| 42 | + box-sizing: border-box |
| 43 | + width: 100% |
| 44 | + height: 100% |
| 45 | + .mp-preview-zone |
| 46 | + display: none |
| 47 | +
|
| 48 | + .mp-editor-zone-full |
| 49 | + display: block |
| 50 | + box-sizing: border-box |
| 51 | + width: 100% |
| 52 | + border: none !important |
| 53 | + .mp-editor-zone-hide |
| 54 | + display: none !important |
| 55 | + @media only screen and (min-width: 768px) |
| 56 | + .mp-editor-zone |
| 57 | + display block |
| 58 | + box-sizing: border-box |
| 59 | + width: 50% |
| 60 | + float: left |
| 61 | +
|
37 | 62 | .mp-editor-container |
38 | 63 | position:relative |
39 | 64 | height: 100% |
|
59 | 84 | bottom: 0 |
60 | 85 | overflow: hidden |
61 | 86 | border-top: 1px solid #ddd |
62 | | -
|
63 | | - .mp-editor-zone |
64 | | - box-sizing: border-box |
65 | | - width: 50% |
66 | | - height: 100% |
67 | | - float: left |
68 | | - .mp-editor-zone-full |
69 | | - box-sizing: border-box |
70 | | - width: 100% |
71 | | - .mp-editor-zone-hide |
72 | | - display: none |
73 | | -
|
74 | 87 | .mp-preview-zone |
75 | 88 | border-left: 1px solid #ddd |
76 | 89 | padding-bottom: 2px |
|
129 | 142 | .mp-editor-menu>li>a |
130 | 143 | outline: 0 |
131 | 144 | color: #666 |
| 145 | + cursor pointer |
132 | 146 | display: inline-block |
133 | 147 | min-width: 24px |
134 | 148 | font-size: 16px |
@@ -198,7 +212,16 @@ export default { |
198 | 212 | } |
199 | 213 | }, |
200 | 214 | computed: { |
201 | | - contentParser () { return contentParserFactory([...this.parsers, InjectLnParser]) } |
| 215 | + contentParser () { |
| 216 | + return contentParserFactory([...this.parsers, InjectLnParser]) |
| 217 | + }, |
| 218 | + toolbarBtns () { |
| 219 | + if (window.screen.width > 768) { |
| 220 | + return this.config.bigScreenToolbarConfig |
| 221 | + } else { |
| 222 | + return this.config.smallScreenToolbarConfig |
| 223 | + } |
| 224 | + } |
202 | 225 | }, |
203 | 226 | methods: { |
204 | 227 | setCode (code) { |
|
0 commit comments