Add ability to reposition nodes and insert before/after
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -68,15 +68,24 @@ export class EditorPage implements OnInit {
|
||||
});
|
||||
|
||||
popover.onDidDismiss().then(result => {
|
||||
if ( result.data === 'delete_node' ) {
|
||||
const { event: dismissEvent , value } = result.data;
|
||||
if ( value === 'delete_node' ) {
|
||||
this.editorService.deleteNode(node.UUID);
|
||||
} else if ( value === 'move_up' ) {
|
||||
this.editorService.moveNode(node, 'up');
|
||||
} else if ( value === 'move_down' ) {
|
||||
this.editorService.moveNode(node, 'down');
|
||||
} else if ( value === 'add_before' ) {
|
||||
this.onAddClick(dismissEvent, 'before', node.UUID);
|
||||
} else if ( value === 'add_after' ) {
|
||||
this.onAddClick(dismissEvent, 'after', node.UUID);
|
||||
}
|
||||
});
|
||||
|
||||
await popover.present();
|
||||
}
|
||||
|
||||
async onAddClick(event: MouseEvent) {
|
||||
async onAddClick(event: MouseEvent, position?: 'before' | 'after', positionNodeId?: string) {
|
||||
if ( !this.editorService.canEdit() ) {
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +97,7 @@ export class EditorPage implements OnInit {
|
||||
|
||||
popover.onDidDismiss().then(result => {
|
||||
console.log('adding node', result.data);
|
||||
this.editorService.addNode(result.data);
|
||||
this.editorService.addNode(result.data, position, positionNodeId);
|
||||
});
|
||||
|
||||
// popover.onDidDismiss().then(arg => {
|
||||
|
||||
Reference in New Issue
Block a user