generated at
Ctrl+yでredoする(元に戻す)UserScript
Scrapboxにおいて、元に戻す(redo)ショートカットキーはCtrl+Shift+Z
しかし、Windowsにおいてredoの一般的なショートカットはCtrl+y
なので、それをScrapboxでも使えるようにした

ソースコード
ctrl-y.ts
import { redo, textInput } from "https://raw.githubusercontent.com/takker99/scrapbox-userscript-std/0.14.9/browser/dom/mod.ts"; textInput()!.addEventListener("keydown", (e) => { if (!(e.key === "y" && e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey)) return; redo(); });

生成後
ctrl-y.js
var a=(e,n)=>{if(!(e instanceof HTMLTextAreaElement))throw new TypeError(`"${n}" must be HTMLTextAreaElement but actual is "${e}"`)};var t=()=>{let e=document.getElementById("text-input");if(!!e)return a(e,"textarea#text-input"),e};var s=(e,n)=>{let{noModifiedKeys:r=!1,...l}=n??{},c={bubbles:!0,cancelable:!0,keyCode:p[e],...r?{}:{...l}},o=t();if(!o)throw Error("#text-input must exist.");o.dispatchEvent(new KeyboardEvent("keydown",c)),o.dispatchEvent(new KeyboardEvent("keyup",c))},p={Backspace:8,Tab:9,Enter:13,Delete:46,Escape:27," ":32,PageUp:33,PageDown:34,End:35,Home:36,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,F1:113,F2:114,F3:115,F4:116,F5:117,F6:118,F7:119,F8:120,F9:121,F10:122,F11:123,F12:124,":":186,"*":186,";":187,"+":187,"-":189,"=":189,".":190,">":190,"/":191,"?":191,"@":192,"`":192,"[":219,"{":219,"\\":220,"|":220,"]":221,"}":221,"^":222,"~":222,_:226};function*i(e,n){for(let r=e;r<n;r++)yield r}var d=(e=1)=>{for(let n of i(0,e))s("z",{shiftKey:!0,ctrlKey:!0})};t().addEventListener("keydown",e=>{!(e.key==="y"&&e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)||d()});