Skip to content

Commit

Permalink
Fixed initial message
Browse files Browse the repository at this point in the history
  • Loading branch information
dvd101x committed Mar 24, 2024
1 parent be4a803 commit 0b1e610
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'katex/dist/katex.min.css'
import Alpine from 'alpinejs'
import makeDoc from './makeDoc.js'

import { EditorState } from "@codemirror/state"
import { EditorView, basicSetup } from "codemirror"
import {
StreamLanguage
Expand Down Expand Up @@ -45,7 +44,7 @@ const example = [
"HAprops('T', {P:1 atm, H:h, R:1.0})"
]

let startState = EditorState.create({
const editor = new EditorView({
doc: example.join('\n'),
extensions: [
basicSetup,
Expand All @@ -54,18 +53,14 @@ let startState = EditorState.create({
EditorView.updateListener.of((update) => {
if (update.docChanged) {
editorDOM.dispatchEvent(docChanged)
if(update.selectionSet){
if (update.selectionSet) {
editorDOM.dispatchEvent(selectionChanged)
}
} else if (update.selectionSet) {
editorDOM.dispatchEvent(selectionChanged)
}
})
],
})

const editor = new EditorView({
state: startState,
parent: editorDOM,
lineWrapping: true,
})
Expand All @@ -75,7 +70,7 @@ window.Alpine = Alpine
Alpine.data(
'app',
() => ({
expressions: makeDoc(editor.state.doc.toString()),
expressions: makeDoc("# # Type and get results - just like that!"),
currentLine: 1,
get calcExpressions() {
this.expressions = makeDoc(editor.state.doc.toString())
Expand Down

0 comments on commit 0b1e610

Please sign in to comment.