feat: add copy (Ctrl+C) and exit (Ctrl+D) shortcuts
This commit is contained in:
@@ -77,10 +77,20 @@ function App() {
|
||||
|
||||
const selectedNote = selectedId ? notes.find((n) => n.id === selectedId) : null;
|
||||
|
||||
const handleCopy = () => {
|
||||
if (selectedNote) {
|
||||
const text = `${selectedNote.title}\n\n${selectedNote.content}`;
|
||||
process.stdout.write('\x1b]52;c;' + btoa(text) + '\x07');
|
||||
}
|
||||
};
|
||||
|
||||
useKeyboard((key) => {
|
||||
if (key.name === "escape") {
|
||||
if (key.ctrl && key.name === "d") {
|
||||
process.exit(0);
|
||||
}
|
||||
if (key.ctrl && key.name === "c") {
|
||||
handleCopy();
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user