|
@@ -191,10 +191,18 @@
|
|
|
options.onSave(currentSelectize.getValue());
|
|
options.onSave(currentSelectize.getValue());
|
|
|
}
|
|
}
|
|
|
$(document).off('click', saveOnClickOutside);
|
|
$(document).off('click', saveOnClickOutside);
|
|
|
|
|
+ $(document).off('keyup', hideOnEscape);
|
|
|
showReadOnly();
|
|
showReadOnly();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ var hideOnEscape = function (event) {
|
|
|
|
|
+ if (event.which === 27) {
|
|
|
|
|
+ showReadOnly();
|
|
|
|
|
+ $(document).off('click', saveOnClickOutside);
|
|
|
|
|
+ $(document).off('keyup', hideOnEscape);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
var showEdit = function () {
|
|
var showEdit = function () {
|
|
|
optionsBeforeEdit = options.setTags().concat();
|
|
optionsBeforeEdit = options.setTags().concat();
|
|
@@ -210,13 +218,16 @@
|
|
|
}
|
|
}
|
|
|
showReadOnly();
|
|
showReadOnly();
|
|
|
$(document).off('click', saveOnClickOutside);
|
|
$(document).off('click', saveOnClickOutside);
|
|
|
|
|
+ $(document).off('keyup', hideOnEscape);
|
|
|
}).appendTo($editActions);
|
|
}).appendTo($editActions);
|
|
|
$('<i>').addClass('fa fa-close').click(function () {
|
|
$('<i>').addClass('fa fa-close').click(function () {
|
|
|
showReadOnly();
|
|
showReadOnly();
|
|
|
$(document).off('click', saveOnClickOutside);
|
|
$(document).off('click', saveOnClickOutside);
|
|
|
|
|
+ $(document).off('keyup', hideOnEscape);
|
|
|
}).appendTo($editActions);
|
|
}).appendTo($editActions);
|
|
|
window.setTimeout(function () {
|
|
window.setTimeout(function () {
|
|
|
$(document).on('click', saveOnClickOutside);
|
|
$(document).on('click', saveOnClickOutside);
|
|
|
|
|
+ $(document).on('keyup', hideOnEscape);
|
|
|
}, 0);
|
|
}, 0);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -224,6 +235,7 @@
|
|
|
if (currentSelectize) {
|
|
if (currentSelectize) {
|
|
|
currentSelectize.destroy();
|
|
currentSelectize.destroy();
|
|
|
$element.hide();
|
|
$element.hide();
|
|
|
|
|
+ $element.val(options.setTags().join(','))
|
|
|
}
|
|
}
|
|
|
$readOnlyContainer.empty();
|
|
$readOnlyContainer.empty();
|
|
|
var $readOnlyInner = $('<div>').addClass('selectize-input items not-full has-options has-items').appendTo($readOnlyContainer);
|
|
var $readOnlyInner = $('<div>').addClass('selectize-input items not-full has-options has-items').appendTo($readOnlyContainer);
|