Fixed the _getJsonObject
Added handling for the change event in the select input field
This commit is contained in:
parent
266faef8a9
commit
24c9440bbb
|
@ -1930,6 +1930,9 @@ Node.prototype.updateDom = function (options) {
|
||||||
//Store the schema of the node in the schema attribute. Hereafter, wherever you have acces in the node
|
//Store the schema of the node in the schema attribute. Hereafter, wherever you have acces in the node
|
||||||
//you will have also access in its own schema
|
//you will have also access in its own schema
|
||||||
this.schema = this._getJsonObject(this.editor.options.schema, 'name', field)[0];
|
this.schema = this._getJsonObject(this.editor.options.schema, 'name', field)[0];
|
||||||
|
if(!this.schema) {
|
||||||
|
this.schema = this._getJsonObject(this.editor.options.schema, field)[0];
|
||||||
|
}
|
||||||
//Try now to locate any enumerations inside the schema of the field
|
//Try now to locate any enumerations inside the schema of the field
|
||||||
if(this.schema){
|
if(this.schema){
|
||||||
//We check here some different cases in order to locate any defined enum field in the schema of the field
|
//We check here some different cases in order to locate any defined enum field in the schema of the field
|
||||||
|
@ -2010,8 +2013,12 @@ Node.prototype._getJsonObject = function (obj, key, val) {
|
||||||
for (var i in obj) {
|
for (var i in obj) {
|
||||||
if (!obj.hasOwnProperty(i)) continue;
|
if (!obj.hasOwnProperty(i)) continue;
|
||||||
if (typeof obj[i] == 'object') {
|
if (typeof obj[i] == 'object') {
|
||||||
if(i == key && val === undefined && Array.isArray(obj[i])){
|
if(i === key && val === undefined){
|
||||||
objects.push(obj);
|
if(Array.isArray(obj[i])) {
|
||||||
|
objects.push(obj);
|
||||||
|
} else {
|
||||||
|
objects.push(obj[i]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
objects = objects.concat(this._getJsonObject(obj[i], key, val));
|
objects = objects.concat(this._getJsonObject(obj[i], key, val));
|
||||||
}
|
}
|
||||||
|
@ -2216,6 +2223,12 @@ Node.prototype.onEvent = function (event) {
|
||||||
this.dom.value.innerHTML = !this.value;
|
this.dom.value.innerHTML = !this.value;
|
||||||
this._getDomValue();
|
this._getDomValue();
|
||||||
}
|
}
|
||||||
|
//Update the value of the node based on the selected option
|
||||||
|
if (type == 'change' && target == dom.select) {
|
||||||
|
this.dom.value.innerHTML = dom.select.value;
|
||||||
|
this._getDomValue();
|
||||||
|
this._updateDomValue();
|
||||||
|
}
|
||||||
|
|
||||||
// value events
|
// value events
|
||||||
var domValue = dom.value;
|
var domValue = dom.value;
|
||||||
|
|
Loading…
Reference in New Issue