Clean props when copying creature -> lib

prevents creature specific fields from leaking
into libraries
This commit is contained in:
Stefan Zermatten
2023-08-24 11:28:02 +02:00
parent f794dbf45a
commit 8b23a4bc24

View File

@@ -132,6 +132,9 @@ function insertNodeFromProperty(propId, ancestors, order, method) {
prop.order = order;
}
// Clean the props
props = cleanProps(props);
// Insert the props as library nodes
LibraryNodes.batchInsert(props);
return prop;
@@ -186,4 +189,11 @@ function assertSourceLibraryCopyPermission(props, method) {
});
}
function cleanProps(props) {
return props.map(prop => {
let schema = LibraryNodes.simpleSchema(prop);
return schema.clean(prop);
});
}
export default copyPropertyToLibrary;