Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
keyDown(element: SModelRoot, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'KeyS', 'ctrlCmd')) {
return [new SaveModelAction()];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'Escape')) {
return [new HideDiagramUIExtensionAction(CommandPalette.ID)];
} else if (matchesKeystroke(event, 'Space', 'ctrl')) {
const selected = toArray(element.root.index.all().filter(e => isSelectable(e) && e.selected)).map(e => e.id);
return [new ShowDiagramUIExtensionAction(CommandPalette.ID, selected)];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'Escape')) {
return [new HideDiagramUIExtensionAction(CommandPalette.ID)];
} else if (matchesKeystroke(event, 'Space', 'ctrl')) {
const selected = toArray(element.root.index.all().filter(e => isSelectable(e) && e.selected)).map(e => e.id);
return [new ShowDiagramUIExtensionAction(CommandPalette.ID, selected)];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'Escape')) {
return [new EnableStandardToolsAction()];
}
return [];
}
}
keyDown(element: SModelRoot, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'KeyS', 'ctrlCmd')) {
return [new SaveModelAction()];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'Delete')) {
const deleteElementIds = Array.from(element.root.index.all().filter(e => isDeletable(e) && isSelectable(e) && e.selected)
.filter(e => e.id !== e.root.id).map(e => e.id));
return [new DeleteElementOperationAction(deleteElementIds)];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'KeyW', 'shift')) {
return [new ResizeElementsAction([], ResizeDimension.Width, Reduce.max)];
}
if (matchesKeystroke(event, 'KeyH', 'shift')) {
return [new ResizeElementsAction([], ResizeDimension.Height, Reduce.max)];
}
return [];
}
}
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
if (matchesKeystroke(event, 'KeyW', 'shift')) {
return [new ResizeElementsAction([], ResizeDimension.Width, Reduce.max)];
}
if (matchesKeystroke(event, 'KeyH', 'shift')) {
return [new ResizeElementsAction([], ResizeDimension.Height, Reduce.max)];
}
return [];
}
}