1
0
Fork 0
forked from 0x2620/oxjs

no confirmation dialog for empty annotations

This commit is contained in:
j 2025-01-30 16:59:35 +05:30
commit 6e1e2be9c4

View file

@ -117,12 +117,12 @@ Ox.ArrayEditable = function(options, self) {
self.selected = getSelectedPosition(); self.selected = getSelectedPosition();
function deleteItem(id) { function deleteItem(id, empty) {
// it is possible to delete an (empty-value) item // it is possible to delete an (empty-value) item
// by selecting another one // by selecting another one
id = id || self.options.selected; id = id || self.options.selected;
(self.options.confirmDeleteDialog ? self.options.confirmDeleteDialog: Ox.noop)({ (self.options.confirmDeleteDialog && !empty ? self.options.confirmDeleteDialog: Ox.noop)({
items: Ox.isArray(id) ? id : [id], items: Ox.isArray(id) ? id : [id],
}, function(result) { }, function(result) {
if (self.options.editable) { if (self.options.editable) {
@ -437,7 +437,7 @@ Ox.ArrayEditable = function(options, self) {
var item = Ox.getObjectById(self.options.items, id); var item = Ox.getObjectById(self.options.items, id);
Ox.Log('AE', 'submitItem', id, item) Ox.Log('AE', 'submitItem', id, item)
if (value === '') { if (value === '') {
deleteItem(item.id); deleteItem(item.id, true);
} else { } else {
that.triggerEvent(item.value === value ? 'blur' : 'submit', { that.triggerEvent(item.value === value ? 'blur' : 'submit', {
id: item.id, id: item.id,