How to use the sprotty/lib/utils/keyboard.matchesKeystroke function in sprotty

To help you get started, we’ve selected a few sprotty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / save / save.ts View on Github external
keyDown(element: SModelRoot, event: KeyboardEvent): Action[] {
        if (matchesKeystroke(event, 'KeyS', 'ctrlCmd')) {
            return [new SaveModelAction()];
        }
        return [];
    }
}
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / command-palette / command-palette.ts View on Github external
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 [];
    }
}
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / command-palette / command-palette.ts View on Github external
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 [];
    }
}
github eclipsesource / graphical-lsp / client / packages / glsp-sprotty / src / features / tool-manager / tool-manager.ts View on Github external
keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
        if (matchesKeystroke(event, 'Escape')) {
            return [new EnableStandardToolsAction()];
        }
        return [];
    }
}
github eclipsesource / graphical-lsp / client / packages / glsp-sprotty / src / features / save / save.ts View on Github external
keyDown(element: SModelRoot, event: KeyboardEvent): Action[] {
        if (matchesKeystroke(event, 'KeyS', 'ctrlCmd')) {
            return [new SaveModelAction()];
        }
        return [];
    }
}
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / tools / delete-tool.ts View on Github external
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 [];
    }
}
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / layout / layout-commands.ts View on Github external
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 [];
    }
}
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / layout / layout-commands.ts View on Github external
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 [];
    }
}