Moved the tree fab to the toolbar with smart parenting

This commit is contained in:
Stefan Zermatten
2021-04-11 12:36:14 +02:00
parent 81460f8835
commit 885607f685
4 changed files with 108 additions and 134 deletions

View File

@@ -27,13 +27,17 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
parentRef: {
type: RefSchema,
},
order: {
type: Number,
optional: true,
},
}).validator(),
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({nodeId, parentRef}) {
run({nodeId, parentRef, order}) {
// get the new ancestry for the properties
let {parentDoc, ancestors} = getAncestry({parentRef});
@@ -79,10 +83,14 @@ const insertPropertyFromLibraryNode = new ValidatedMethod({
});
// Order the root node
setDocToLastOrder({
collection: CreatureProperties,
doc: node,
});
if (order === undefined){
setDocToLastOrder({
collection: CreatureProperties,
doc: node,
});
} else {
node.order = order;
}
// Insert the creature properties
CreatureProperties.batchInsert(nodes);