jspaint
jspaint copied to clipboard
Shift+Insert, Ctrl+Insert, and Ctrl+Delete shortcuts throw errors
Shift+Insert is meant to trigger Paste.
It's calling paste() with no arguments, but paste expects an image or canvas to be passed in, leading to this error:
TypeError: img_or_canvas is undefined
paste@https://jspaint.app/src/functions.js:1599:6
@https://jspaint.app/src/app.js:1124:4
dispatch@https://jspaint.app/lib/jquery-3.4.1.min.js:2:42571
add/v.handle@https://jspaint.app/lib/jquery-3.4.1.min.js:2:40572
Now, I'm not sure if paste previously referred to a different function or what, but man am I itching to set up typechecking!
There is also an edit_paste function in the repo... git log --all -p --reverse --source -S edit_paste reveals it was introduced in commit ad37213b54a8dc88642ca6fa9c031997031179d3.
Ctrl+Insert is meant to trigger Copy.
It currently gives ReferenceError: copy is not defined
There is an edit_copy function defined. Probably these names need to be updated, but I want to do a little more investigating, to confirm that copy referred to a similar function, and what happened to it.
Ctrl+Delete is meant to trigger Cut.
It currently gives ReferenceError: cut is not defined, same story as Ctrl+Insert.
I have now added typechecking to the codebase with JSDoc + tsc so it will now highlight this as an error. Problems like this should be scarce in the future! Still need to investigate this though.