X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditorForwardingGraph%2FonFormInputChangedModifyContainerAndNotify.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FEditorForwardingGraph%2FonFormInputChangedModifyContainerAndNotify.js;h=a50a10546d06da8d31432c507457163368fc2008;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/components/EditorForwardingGraph/onFormInputChangedModifyContainerAndNotify.js b/skyquake/plugins/composer/src/src/components/EditorForwardingGraph/onFormInputChangedModifyContainerAndNotify.js new file mode 100644 index 000000000..a50a10546 --- /dev/null +++ b/skyquake/plugins/composer/src/src/components/EditorForwardingGraph/onFormInputChangedModifyContainerAndNotify.js @@ -0,0 +1,18 @@ +/** + * Created by onvelocity on 3/2/16. + */ +'use strict'; +import utils from '../../libraries/utils' +import DescriptorModelFactory from '../../libraries/model/DescriptorModelFactory' +import CatalogItemsActions from '../../actions/CatalogItemsActions' +export default function onFormInputChangedModifyContainerAndNotify(container, event) { + if (DescriptorModelFactory.isContainer(container)) { + event.preventDefault(); + const name = event.target.name; + const value = event.target.value; + utils.assignPathValue(container.model, name, value); + CatalogItemsActions.catalogItemDescriptorChanged(container.getRoot()); + } else { + throw new TypeError('onFormInputChangedModifyContainerAndNotify called without a DescriptorModel. Did you forget to bind a DescriptorModel to the event handler?'); + } +}