mirror of
https://github.com/heyman/heynote.git
synced 2025-01-22 22:08:35 +01:00
Set theme as a data property in App component
This commit is contained in:
parent
db9ed4e1db
commit
856a9b16fd
@ -18,6 +18,7 @@
|
|||||||
column: 1,
|
column: 1,
|
||||||
language: "plaintext",
|
language: "plaintext",
|
||||||
languageAuto: true,
|
languageAuto: true,
|
||||||
|
theme: "dark",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -37,6 +38,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Editor
|
<Editor
|
||||||
@cursorChange="onCursorChange"
|
@cursorChange="onCursorChange"
|
||||||
|
:theme="theme"
|
||||||
class="editor"
|
class="editor"
|
||||||
/>
|
/>
|
||||||
<StatusBar
|
<StatusBar
|
||||||
@ -44,6 +46,7 @@
|
|||||||
:column="column"
|
:column="column"
|
||||||
:language="language"
|
:language="language"
|
||||||
:languageAuto="languageAuto"
|
:languageAuto="languageAuto"
|
||||||
|
:theme="theme"
|
||||||
class="status"
|
class="status"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
import initialData from "../editor/fixture.js"
|
import initialData from "../editor/fixture.js"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
props: [
|
||||||
|
"theme",
|
||||||
|
],
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$refs.editor.addEventListener("selectionChange", (e) => {
|
this.$refs.editor.addEventListener("selectionChange", (e) => {
|
||||||
//console.log("selectionChange:", e)
|
//console.log("selectionChange:", e)
|
||||||
@ -18,6 +21,7 @@
|
|||||||
element: this.$refs.editor,
|
element: this.$refs.editor,
|
||||||
//content: "\n∞∞∞text\n",
|
//content: "\n∞∞∞text\n",
|
||||||
content: initialData,
|
content: initialData,
|
||||||
|
theme: this.theme,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"column",
|
"column",
|
||||||
"language",
|
"language",
|
||||||
"languageAuto",
|
"languageAuto",
|
||||||
|
"theme",
|
||||||
],
|
],
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -28,12 +29,16 @@
|
|||||||
languageName() {
|
languageName() {
|
||||||
return LANGUAGE_NAMES[this.language] || this.language
|
return LANGUAGE_NAMES[this.language] || this.language
|
||||||
},
|
},
|
||||||
|
|
||||||
|
className() {
|
||||||
|
return `status ${this.theme}`
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="status">
|
<div :class="className">
|
||||||
<div class="status-block line-number">
|
<div class="status-block line-number">
|
||||||
Ln <span class="num">{{ line }}</span>
|
Ln <span class="num">{{ line }}</span>
|
||||||
Col <span class="num">{{ column }}</span>
|
Col <span class="num">{{ column }}</span>
|
||||||
|
@ -13,7 +13,7 @@ import { languageDetection } from "./language-detection/autodetect.js"
|
|||||||
|
|
||||||
|
|
||||||
export class HeynoteEditor {
|
export class HeynoteEditor {
|
||||||
constructor({element, content, focus=true}) {
|
constructor({element, content, focus=true, theme="light"}) {
|
||||||
this.state = EditorState.create({
|
this.state = EditorState.create({
|
||||||
doc: content || "",
|
doc: content || "",
|
||||||
extensions: [
|
extensions: [
|
||||||
@ -23,8 +23,7 @@ export class HeynoteEditor {
|
|||||||
|
|
||||||
customSetup,
|
customSetup,
|
||||||
|
|
||||||
//heynoteDark,
|
theme === "dark" ? heynoteDark : heynoteLight,
|
||||||
heynoteLight,
|
|
||||||
heynoteBase,
|
heynoteBase,
|
||||||
indentUnit.of(" "),
|
indentUnit.of(" "),
|
||||||
EditorView.scrollMargins.of(f => {
|
EditorView.scrollMargins.of(f => {
|
||||||
|
Loading…
Reference in New Issue
Block a user