]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/auto-suggest.js
Lexical: Added about button/view
[bookstack] / resources / js / components / auto-suggest.js
index 92a6c6af3f43fde8ff5288c460f92c76eab31650..0b828e71bd1ea35976f348d02fd1c31dca2c5de6 100644 (file)
@@ -1,7 +1,7 @@
-import {escapeHtml} from '../services/util';
-import {onChildEvent} from '../services/dom';
+import {escapeHtml} from '../services/util.ts';
+import {onChildEvent} from '../services/dom.ts';
 import {Component} from './component';
-import {KeyboardNavigationHandler} from '../services/keyboard-navigation';
+import {KeyboardNavigationHandler} from '../services/keyboard-navigation.ts';
 
 const ajaxCache = {};
 
@@ -31,7 +31,10 @@ export class AutoSuggest extends Component {
             },
             event => {
                 event.preventDefault();
-                this.selectSuggestion(event.target.textContent);
+                const selectionValue = event.target.textContent;
+                if (selectionValue) {
+                    this.selectSuggestion(selectionValue);
+                }
             },
         );
         navHandler.shareHandlingToEl(this.input);