Fix broken Mod-L shortcut

This commit is contained in:
Jonatan Heyman 2023-01-19 13:10:52 +01:00
parent b35e4840a4
commit 1abefce1ec
2 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
import { HeynoteEditor } from '../editor/editor.js' import { HeynoteEditor, LANGUAGE_SELECTOR_EVENT } from '../editor/editor.js'
import { syntaxTree } from "@codemirror/language" import { syntaxTree } from "@codemirror/language"
export default { export default {
@ -25,7 +25,7 @@
}) })
}) })
this.$refs.editor.addEventListener("openLanguageSelector", (e) => { this.$refs.editor.addEventListener(LANGUAGE_SELECTOR_EVENT, (e) => {
this.$emit("openLanguageSelector") this.$emit("openLanguageSelector")
}) })

View File

@ -13,6 +13,8 @@ import { heynoteKeymap } from "./keymap.js"
import { languageDetection } from "./language-detection/autodetect.js" import { languageDetection } from "./language-detection/autodetect.js"
import { autoSaveContent } from "./save.js" import { autoSaveContent } from "./save.js"
export const LANGUAGE_SELECTOR_EVENT = "openLanguageSelector"
export class HeynoteEditor { export class HeynoteEditor {
constructor({element, content, focus=true, theme="light", saveFunction=null}) { constructor({element, content, focus=true, theme="light", saveFunction=null}) {
@ -74,7 +76,7 @@ export class HeynoteEditor {
} }
openLanguageSelector() { openLanguageSelector() {
this.element.dispatchEvent(new Event("open-language-selector")) this.element.dispatchEvent(new Event(LANGUAGE_SELECTOR_EVENT))
} }
setCurrentLanguage(lang, auto=false) { setCurrentLanguage(lang, auto=false) {