mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 05:18:21 +00:00
Extract spellMenu component and use when showing spell suggestions
This commit is contained in:
parent
e6ffaaa489
commit
cf123ce857
3 changed files with 36 additions and 16 deletions
|
@ -1,5 +1,6 @@
|
|||
define [
|
||||
"ide/editor/Document"
|
||||
"ide/editor/components/spellMenu"
|
||||
"ide/editor/directives/aceEditor"
|
||||
"ide/editor/directives/toggleSwitch"
|
||||
"ide/editor/controllers/SavingNotificationController"
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
define ["base"], (App) ->
|
||||
App.component "spellMenu", {
|
||||
bindings: {
|
||||
open: "<"
|
||||
top: "<"
|
||||
left: "<"
|
||||
suggestions: "<"
|
||||
replaceWord: "&"
|
||||
learnWord: "&"
|
||||
}
|
||||
template: """
|
||||
<div
|
||||
class="dropdown context-menu spell-check-menu"
|
||||
ng-show="$ctrl.open"
|
||||
ng-style="{top: $ctrl.top, left: $ctrl.left}"
|
||||
ng-class="{open: $ctrl.open}"
|
||||
>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-repeat="suggestion in $ctrl.suggestions | limitTo:8">
|
||||
<a href ng-click="$ctrl.replaceWord(suggestion)">{{ suggestion }}</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href ng-click="$ctrl.learnWord(suggestion)">Add to Dictionary</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
"""
|
||||
}
|
|
@ -510,22 +510,12 @@ define [
|
|||
>Dismiss</a>
|
||||
</div>
|
||||
<div class="ace-editor-body"></div>
|
||||
<div
|
||||
class="dropdown context-menu spell-check-menu"
|
||||
ng-show="spellingMenu.open"
|
||||
ng-style="{top: spellingMenu.top, left: spellingMenu.left}"
|
||||
ng-class="{open: spellingMenu.open}"
|
||||
>
|
||||
<ul class="dropdown-menu">
|
||||
<li ng-repeat="suggestion in spellingMenu.highlight.suggestions | limitTo:8">
|
||||
<a href ng-click="replaceWord(spellingMenu.highlight, suggestion)">{{ suggestion }}</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href ng-click="learnWord(spellingMenu.highlight)">Add to Dictionary</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<spell-menu
|
||||
open="spellMenu.open"
|
||||
top="spellMenu.top"
|
||||
left="spellMenu.left"
|
||||
suggestions="spellMenu.suggestions"
|
||||
></spell-menu>
|
||||
<div
|
||||
class="annotation-label"
|
||||
ng-show="annotationLabel.show"
|
||||
|
|
Loading…
Reference in a new issue