Fixed editor JavaScript error in TemplateManager
- Caused when loading the editor with no templates in the system. - Tried to init a search box that did not exist.
This commit is contained in:
parent
c1fe068ffc
commit
ef416d3e86
1 changed files with 5 additions and 1 deletions
|
@ -56,6 +56,10 @@ class TemplateManager {
|
|||
|
||||
setupSearchBox() {
|
||||
const searchBox = this.elem.querySelector('.search-box');
|
||||
|
||||
// Search box may not exist if there are no existing templates in the system.
|
||||
if (!searchBox) return;
|
||||
|
||||
const input = searchBox.querySelector('input');
|
||||
const submitButton = searchBox.querySelector('button');
|
||||
const cancelButton = searchBox.querySelector('button.search-box-cancel');
|
||||
|
@ -70,7 +74,7 @@ class TemplateManager {
|
|||
}
|
||||
performSearch = performSearch.bind(this);
|
||||
|
||||
// Searchbox enter press
|
||||
// Search box enter press
|
||||
searchBox.addEventListener('keypress', event => {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Reference in a new issue