Merge pull request #4079 from overleaf/ae-ace-replace-range-symbol

Replace all selected ranges when inserting symbol into source editor

GitOrigin-RevId: bc0d7548f61fd740a87b34bb181516e8dc21fff1
This commit is contained in:
Alf Eaton 2021-05-25 10:55:46 +01:00 committed by Copybot
parent 6dc7f662aa
commit 823960f763

View file

@ -135,7 +135,11 @@ App.directive(
ide.$scope.$on('editor:replace-selection', (event, text) => { ide.$scope.$on('editor:replace-selection', (event, text) => {
editor.focus() editor.focus()
editor.insert(text) const document = editor.session.getDocument()
const ranges = editor.selection.getAllRanges()
for (const range of ranges) {
document.replace(range, text)
}
}) })
scope.$watch('autoPairDelimiters', autoPairDelimiters => { scope.$watch('autoPairDelimiters', autoPairDelimiters => {