diff --git a/lib/network/modules/ConfigurationSystem.js b/lib/network/modules/ConfigurationSystem.js index c2e57e10..b48d5124 100644 --- a/lib/network/modules/ConfigurationSystem.js +++ b/lib/network/modules/ConfigurationSystem.js @@ -347,6 +347,29 @@ class ConfigurationSystem { this._makeItem(path, label, checkbox); } + /** + * make a text input field for string options. + * @param defaultValue + * @param value + * @param path + * @private + */ + _makeTextInput(defaultValue, value, path) { + var checkbox = document.createElement('input'); + checkbox.type = 'text'; + checkbox.className = 'vis-network-configuration text'; + checkbox.value = value; + if (value !== defaultValue) { + this.changedOptions.push({path:path, value:value}); + } + + let me = this; + checkbox.onchange = function() {me._update(this.value, path)}; + + let label = this._makeLabel(path[path.length-1], path); + this._makeItem(path, label, checkbox); + } + /** * make a color field with a color picker for color fields @@ -418,7 +441,7 @@ class ConfigurationSystem { this._handleArray(item, value, newPath); } else if (typeof item === 'string') { - this._handleString(item, value, newPath); + this._makeTextInput(item, value, newPath); } else if (typeof item === 'boolean') { this._makeCheckbox(item, value, newPath); diff --git a/lib/network/modules/Validator.js b/lib/network/modules/Validator.js index 1404e4da..b2851dc3 100644 --- a/lib/network/modules/Validator.js +++ b/lib/network/modules/Validator.js @@ -141,7 +141,10 @@ class Validator { return 'date'; } if (object.nodeType !== undefined) { - return 'dom' + return 'dom'; + } + if (object._isAMomentObject === true) { + return 'moment'; } return 'object'; }