Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Destroy an open autocomplete popup in Ace editor

I'm using the Ace Editor with autocompletion turned on. The editor appears in a modal frame on the page.

If the modal frame is closed (i.e. the editor is removed from the DOM) while an autocomplete popup is open, the popup gets stuck and can't be closed. What's the right way to destroy the popup?

The best I've found so far is

editor.completer.detach();

This seems to work, but it's undocumented and I don't know if there are any side-effects or concerns. Is there a better option?

like image 807
nrabinowitz Avatar asked Nov 10 '22 18:11

nrabinowitz


1 Answers

detach is the right method, since it is what is called when pressing esc key see https://github.com/ajaxorg/ace/blob/60c639a34bc4a44ec84484f99bdd879177179b87/lib/ace/autocomplete.js#L207

like image 60
a user Avatar answered Nov 14 '22 22:11

a user