Fix duplicate warning icon not aways showing up
This commit is contained in:
parent
2a551117b2
commit
144be4a16d
|
@ -379,7 +379,7 @@ Node.prototype.setField = function(field, fieldEditable) {
|
|||
*/
|
||||
Node.prototype.getField = function() {
|
||||
if (this.field === undefined) {
|
||||
this._getDomField(true);
|
||||
this._getDomField();
|
||||
}
|
||||
|
||||
return this.field;
|
||||
|
@ -1312,15 +1312,6 @@ Node.select = function(editableDiv) {
|
|||
}, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the values from the DOM field and value of this node
|
||||
*/
|
||||
Node.prototype.blur = function() {
|
||||
// retrieve the actual field and value from the DOM.
|
||||
this._getDomValue();
|
||||
this._getDomField(true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if given node is a child. The method will check recursively to find
|
||||
* this node.
|
||||
|
@ -1932,28 +1923,28 @@ Node.prototype._getDomField = function(forceUnique) {
|
|||
try {
|
||||
var field = this._unescapeHTML(this.fieldInnerText);
|
||||
|
||||
if (field !== this.field) {
|
||||
var existingFieldNames = this.parent.getFieldNames(this);
|
||||
var isDuplicate = existingFieldNames.indexOf(field) !== -1;
|
||||
var existingFieldNames = this.parent.getFieldNames(this);
|
||||
var isDuplicate = existingFieldNames.indexOf(field) !== -1;
|
||||
|
||||
if (!isDuplicate) {
|
||||
if (!isDuplicate) {
|
||||
if (field !== this.field) {
|
||||
this.field = field;
|
||||
this._debouncedOnChangeField();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (forceUnique) {
|
||||
// fix duplicate field: change it into a unique name
|
||||
field = util.findUniqueName(field, existingFieldNames);
|
||||
if (field !== this.field) {
|
||||
this.field = field;
|
||||
|
||||
// TODO: don't debounce but resolve right away, and cancel current debounce
|
||||
this._debouncedOnChangeField();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (forceUnique) {
|
||||
// fix duplicate field: change it into a unique name
|
||||
field = util.findUniqueName(field, existingFieldNames);
|
||||
if (field !== this.field) {
|
||||
this.field = field;
|
||||
// this._debouncedOnChangeField = util.debounce(this._onChangeField.bind(this), Node.prototype.DEBOUNCE_INTERVAL);
|
||||
// this._onChangeField();
|
||||
this._debouncedOnChangeField(); //FIXME: don't debounce but resolve right away, and cancel current debounce
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._setFieldError(translate('duplicateFieldError'));
|
||||
}
|
||||
this._setFieldError(translate('duplicateFieldError'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,13 +283,7 @@ treemode.update = function (json) {
|
|||
* @return {Object | undefined} json
|
||||
*/
|
||||
treemode.get = function () {
|
||||
// remove focus from currently edited node
|
||||
if (this.focusTarget) {
|
||||
var node = Node.getNodeFromTarget(this.focusTarget);
|
||||
if (node) {
|
||||
node.blur();
|
||||
}
|
||||
}
|
||||
// TODO: resolve pending debounced input changes if any, but do not resolve invalid inputs
|
||||
|
||||
if (this.node) {
|
||||
return this.node.getValue();
|
||||
|
|
Loading…
Reference in New Issue