In organize mode, new library properties get placed under the selected node
This commit is contained in:
@@ -76,6 +76,7 @@ import LibraryNodes, { insertNode } from '/imports/api/library/LibraryNodes.js';
|
|||||||
import Libraries, { insertLibrary } from '/imports/api/library/Libraries.js';
|
import Libraries, { insertLibrary } from '/imports/api/library/Libraries.js';
|
||||||
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
import { getUserTier } from '/imports/api/users/patreon/tiers.js';
|
||||||
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
|
||||||
|
import { getAncestry } from '/imports/api/parenting/parenting.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -139,13 +140,20 @@ export default {
|
|||||||
},
|
},
|
||||||
insertLibraryNode(libraryId){
|
insertLibraryNode(libraryId){
|
||||||
if (this.paidBenefits){
|
if (this.paidBenefits){
|
||||||
|
let parentRef;
|
||||||
|
if (this.organizeMode && this.selectedNodeId){
|
||||||
|
parentRef = {collection: 'libraryNodes', id: this.selectedNodeId}
|
||||||
|
} else {
|
||||||
|
parentRef = {collection: 'libraries', id: libraryId};
|
||||||
|
}
|
||||||
|
let {ancestors} = getAncestry({parentRef});
|
||||||
this.$store.commit('pushDialogStack', {
|
this.$store.commit('pushDialogStack', {
|
||||||
component: 'library-node-creation-dialog',
|
component: 'library-node-creation-dialog',
|
||||||
elementId: `insert-node-${libraryId}`,
|
elementId: `insert-node-${libraryId}`,
|
||||||
callback(libraryNode){
|
callback(libraryNode){
|
||||||
if (!libraryNode) return;
|
if (!libraryNode) return;
|
||||||
libraryNode.parent = {collection: 'libraries', id: libraryId};
|
libraryNode.parent = parentRef;
|
||||||
libraryNode.ancestors = [ {collection: 'libraries', id: libraryId}];
|
libraryNode.ancestors = ancestors;
|
||||||
setDocToLastOrder({collection: LibraryNodes, doc: libraryNode});
|
setDocToLastOrder({collection: LibraryNodes, doc: libraryNode});
|
||||||
let libraryNodeId = insertNode.call(libraryNode);
|
let libraryNodeId = insertNode.call(libraryNode);
|
||||||
return `tree-node-${libraryNodeId}`;
|
return `tree-node-${libraryNodeId}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user