about summary refs log tree commit diff stats
path: root/js/inknswitch/ink.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/inknswitch/ink.js')
-rw-r--r--js/inknswitch/ink.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/js/inknswitch/ink.js b/js/inknswitch/ink.js
index e51bbcd..bd5fb6d 100644
--- a/js/inknswitch/ink.js
+++ b/js/inknswitch/ink.js
@@ -113,5 +113,14 @@ document.addEventListener('keydown', (e) => {
         }
     }
 
+    // S key to save the canvas as an image
+    if (e.key === 's' && canvas.style.pointerEvents === 'auto') {
+        const dataUrl = canvas.toDataURL();
+        const a = document.createElement('a');
+        a.href = dataUrl;
+        a.download = 'canvas.png';
+        a.click();
+    }
+
     localStorage.setItem('noteContent', noteArea.value);
 });
\ No newline at end of file