這是一個可以讓DICE程式教學平台開啟複製貼上的功能,程式碼請看index.js。
- 登入DICE,開啟Dev tool。
- 貼上程式碼
const editor = ace.edit(document.querySelector(".ace_editor")); editor.commands.addCommand({ name: "forcePaste", bindKey: { win: "Ctrl-V", mac: "Command-V" }, exec: function (editor) { navigator.clipboard.readText().then((text) => { editor.insert(text); }); }, });