mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Dynamically adjust the width of autocomplete popup.
This commit is contained in:
parent
9a85e42ddb
commit
3ffef7fe56
2 changed files with 12 additions and 5 deletions
|
@ -282,7 +282,18 @@ define [
|
|||
editor.completer.autoSelect = true
|
||||
editor.completer.showPopup(editor)
|
||||
editor.completer.cancelContextMenu()
|
||||
$(editor.completer.popup?.container).css({'font-size': @$scope.fontSize + 'px'})
|
||||
container = $(editor.completer.popup?.container)
|
||||
container.css({'font-size': @$scope.fontSize + 'px'})
|
||||
# Dynamically set width of autocomplete popup
|
||||
if filtered = editor?.completer?.completions?.filtered
|
||||
longestCaption = _.max(filtered.map( (c) -> c.caption.length ))
|
||||
longestMeta = _.max(filtered.map( (c) -> c.meta.length ))
|
||||
charScale = @$scope.fontSize * 0.7
|
||||
width = Math.min(
|
||||
Math.round(longestCaption*charScale + longestMeta*charScale + 25),
|
||||
700
|
||||
)
|
||||
container.css({width: "#{width}px"})
|
||||
if editor.completer?.completions?.filtered?.length == 0
|
||||
editor.completer.detach()
|
||||
bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
|
||||
|
|
|
@ -505,7 +505,3 @@
|
|||
border-bottom: 1px solid @modal-header-border-color;
|
||||
}
|
||||
|
||||
// Widen autocomplete popup
|
||||
.ace_autocomplete {
|
||||
width: 380px !important;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue