11/* global CodeMirror, $, editor, Cookies */
2+ import { options , Alignment , FormatType } from '@susisu/mte-kernel'
3+ import debounce from 'lodash/debounce'
4+
25import * as utils from './utils'
36import config from './config'
47import statusBarTemplate from './statusbar.html'
58import toolBarTemplate from './toolbar.html'
69import './markdown-lint'
710import { initTableEditor } from './table-editor'
8- import { options , Alignment , FormatType } from '@susisu/mte-kernel'
911import { availableThemes } from './constants'
12+ import { } from './ui-elements'
1013
1114/* config section */
1215const isMac = CodeMirror . keyMap . default === CodeMirror . keyMap . macDefault
@@ -326,6 +329,8 @@ export default class Editor {
326329 this . setSpellcheck ( )
327330 this . setLinter ( )
328331 this . setPreferences ( )
332+
333+ this . handleStatusBarResize ( )
329334 }
330335
331336 updateStatusBar ( ) {
@@ -350,6 +355,21 @@ export default class Editor {
350355 }
351356 }
352357
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+
353373 setIndent ( ) {
354374 var cookieIndentType = Cookies . get ( 'indent_type' )
355375 var cookieTabSize = parseInt ( Cookies . get ( 'tab_size' ) )
0 commit comments