As discussed in issue #123, this PR add a new option to the CodeFlask constructor: customEventListeners.
customEventListeners is an object where the keys are the event names and the values are the callbacks for the event. This is an example of using this option to implement a hotkey like cmd+enter which doesn't cause a newline to get added to the content of the editor.
flask = new CodeFlask(editor, {
customEventListeners: {
"keydown": e => {
if (e.key == "Enter" && e.ctrlKey) {
e.preventDefault()
e.stopImmediatePropagation()
// trigger hotkey
}
}
}
})
As discussed in issue #123, this PR add a new option to the
CodeFlask
constructor:customEventListeners
.customEventListeners
is an object where the keys are the event names and the values are the callbacks for the event. This is an example of using this option to implement a hotkey like cmd+enter which doesn't cause a newline to get added to the content of the editor.