diff --git a/src/lib/editor/editor.component.html b/src/lib/editor/editor.component.html
index 8c0f5ce..bb8d39f 100644
--- a/src/lib/editor/editor.component.html
+++ b/src/lib/editor/editor.component.html
@@ -20,7 +20,7 @@
[resizerRight]="'#paper-container'">
-
diff --git a/src/lib/editor/editor.component.ts b/src/lib/editor/editor.component.ts
index eadc1ce..c268f28 100644
--- a/src/lib/editor/editor.component.ts
+++ b/src/lib/editor/editor.component.ts
@@ -288,13 +288,11 @@ export class EditorComponent implements OnInit, OnDestroy {
}
deleteSelectedNode(): void {
- if (self.selection) {
- self.graph.trigger('startDeletion', self.selection.model);
- }
+ self.deleteSelected();
}
delete(cell: dia.Cell) {
- self.graph.trigger('startDeletion', cell);
+ self.delete(cell);
}
get textToGraphConversionObservable(): Observable {
@@ -346,16 +344,16 @@ export class EditorComponent implements OnInit, OnDestroy {
this._disposables.dispose();
}
- private delete(cell: dia.Cell) {
- if (this.editor && this.editor.preDelete) {
- if (this.editor.preDelete(this.editorContext, this.selection.model)) {
- cell.remove();
- }
- } else {
- cell.remove();
+ deleteSelected() {
+ if (this.selection) {
+ this.delete(this.selection.model);
}
}
+ delete(cell: dia.Cell) {
+ this.graph.trigger('startDeletion', cell);
+ }
+
get noPalette(): boolean {
return this._hiddenPalette;
}
@@ -1164,7 +1162,15 @@ export class EditorComponent implements OnInit, OnDestroy {
// adjust vertices when a cell is removed or its source/target was changed
this.graph.on('add remove change:source change:target change:vertices change:position', _.partial(Utils.fanRoute, this.graph));
- this.graph.on('startDeletion', (cell: dia.Cell) => this.delete(cell));
+ this.graph.on('startDeletion', (cell: dia.Cell) => {
+ if (this.editor && this.editor.preDelete) {
+ if (this.editor.preDelete(this.editorContext, this.selection.model)) {
+ cell.remove();
+ }
+ } else {
+ cell.remove();
+ }
+ });
}
initPaperListeners() {
diff --git a/src/lib/editor/paper.component.ts b/src/lib/editor/paper.component.ts
index 4b3b281..e73826b 100644
--- a/src/lib/editor/paper.component.ts
+++ b/src/lib/editor/paper.component.ts
@@ -41,6 +41,11 @@ export class PaperComponent {
this.onDelete.emit();
}
+ @HostListener('keydown.delete')
+ deleteHandle() {
+ this.onDelete.emit();
+ }
+
@HostListener('keydown.o')
oHandle() {
this.onProperties.emit();