fix: don't toggle elements if there is no inputEl

This commit is contained in:
Barış Soner Uşaklı
2020-09-03 11:29:34 -04:00
parent 0a24260571
commit 57f67e2b91

View File

@@ -65,9 +65,11 @@ define('forum/post-queue', ['categorySelector'], function (categorySelector) {
function handleContentEdit(displayClass, editableClass, inputSelector) {
$('.posts-list').on('click', displayClass, function () {
var el = $(this);
el.addClass('hidden');
var inputEl = el.parent().find(editableClass);
inputEl.removeClass('hidden').find(inputSelector).focus();
if (inputEl.length) {
el.addClass('hidden');
inputEl.removeClass('hidden').find(inputSelector).focus();
}
});
$('.posts-list').on('blur', editableClass + ' ' + inputSelector, function () {