@@ -159,9 +159,9 @@ class MarkdownSplitEditor extends React.Component {
159
159
const { config, value, storageKey, noteKey, linesHighlighted, isStacking} = this . props
160
160
const storage = findStorage ( storageKey )
161
161
162
- const editorStyle = { }
163
- const previewStyle = { }
164
- const sliderStyle = { }
162
+ let editorStyle = { }
163
+ let previewStyle = { }
164
+ let sliderStyle = { }
165
165
166
166
let editorFontSize = parseInt ( config . editor . fontSize , 10 )
167
167
if ( ! ( editorFontSize > 0 && editorFontSize < 101 ) ) editorFontSize = 14
@@ -171,21 +171,29 @@ class MarkdownSplitEditor extends React.Component {
171
171
if ( ! ( editorStyle . fontSize > 0 && editorStyle . fontSize < 132 ) ) editorIndentSize = 4
172
172
editorStyle . indentSize = editorIndentSize
173
173
174
- if ( isStacking ) {
175
- editorStyle . width = 100 + '%'
176
- editorStyle . height = this . state . codeEditorHeightInPercent + '%'
177
- previewStyle . width = 100 + '%'
178
- previewStyle . height = ( 100 - this . state . codeEditorHeightInPercent ) + '%'
179
- sliderStyle . left = 0
180
- sliderStyle . top = this . state . codeEditorHeightInPercent + '%'
181
- } else {
182
- editorStyle . width = this . state . codeEditorWidthInPercent + '%'
183
- editorStyle . height = 100 + '%'
184
- previewStyle . width = ( 100 - this . state . codeEditorWidthInPercent ) + '%'
185
- previewStyle . height = 100 + '%'
186
- sliderStyle . left = this . state . codeEditorWidthInPercent + '%'
187
- sliderStyle . top = 0
188
- }
174
+ editorStyle = Object . assign ( editorStyle , isStacking ? {
175
+ width : '100%' ,
176
+ height : `${ this . state . codeEditorHeightInPercent } %`
177
+ } : {
178
+ width : `${ this . state . codeEditorWidthInPercent } %` ,
179
+ height : '100%'
180
+ } )
181
+
182
+ previewStyle = Object . assign ( previewStyle , isStacking ? {
183
+ width : '100%' ,
184
+ height : `${ 100 - this . state . codeEditorHeightInPercent } %`
185
+ } : {
186
+ width : `${ 100 - this . state . codeEditorWidthInPercent } %` ,
187
+ height : '100%'
188
+ } )
189
+
190
+ sliderStyle = Object . assign ( sliderStyle , isStacking ? {
191
+ left : 0 ,
192
+ top : `${ this . state . codeEditorHeightInPercent } %`
193
+ } : {
194
+ left : `${ this . state . codeEditorWidthInPercent } %` ,
195
+ top : 0
196
+ } )
189
197
190
198
if ( this . props . ignorePreviewPointerEvents || this . state . isSliderFocused ) previewStyle . pointerEvents = 'none'
191
199
0 commit comments