1
1
/* global CodeMirror, $, editor, Cookies */
2
+ import { options , Alignment , FormatType } from '@susisu/mte-kernel'
3
+ import debounce from 'lodash/debounce'
4
+
2
5
import * as utils from './utils'
3
6
import config from './config'
4
7
import statusBarTemplate from './statusbar.html'
5
8
import toolBarTemplate from './toolbar.html'
6
9
import './markdown-lint'
7
10
import { initTableEditor } from './table-editor'
8
- import { options , Alignment , FormatType } from '@susisu/mte-kernel'
9
11
import { availableThemes } from './constants'
12
+ import { } from './ui-elements'
10
13
11
14
/* config section */
12
15
const isMac = CodeMirror . keyMap . default === CodeMirror . keyMap . macDefault
@@ -326,6 +329,8 @@ export default class Editor {
326
329
this . setSpellcheck ( )
327
330
this . setLinter ( )
328
331
this . setPreferences ( )
332
+
333
+ this . handleStatusBarResize ( )
329
334
}
330
335
331
336
updateStatusBar ( ) {
@@ -350,6 +355,21 @@ export default class Editor {
350
355
}
351
356
}
352
357
358
+ handleStatusBarResize ( ) {
359
+ const onResize = debounce ( ( ) => {
360
+ if ( ! this . statusBar ) {
361
+ return
362
+ }
363
+
364
+ const maxHeight = window . innerHeight - this . statusBar . height ( ) - 50 /* navbar height */ - 10 /* spacing */
365
+ this . statusBar . find ( '.status-theme ul.dropdown-menu' ) . css ( 'max-height' , `${ maxHeight } px` )
366
+ } , 300 )
367
+
368
+ $ ( window ) . resize ( onResize )
369
+
370
+ onResize ( )
371
+ }
372
+
353
373
setIndent ( ) {
354
374
var cookieIndentType = Cookies . get ( 'indent_type' )
355
375
var cookieTabSize = parseInt ( Cookies . get ( 'tab_size' ) )
0 commit comments