Skip to content

Commit 6c64441

Browse files
committed
switch bull-codemirror to typescript
The TypeScript compiler (tsc) passes, but is not wired up, so you need to install it yourself: % npm install -g typescript % tsc
1 parent b0d4238 commit 6c64441

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

internal/codemirror/bull-codemirror.bundle.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/codemirror/bull-codemirror.jsx internal/codemirror/bull-codemirror.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {markdown} from "@codemirror/lang-markdown"
99
import {keymap, highlightSpecialChars, drawSelection, highlightActiveLine, dropCursor,
1010
rectangularSelection, crosshairCursor,
1111
lineNumbers, highlightActiveLineGutter} from "@codemirror/view"
12-
import {Extension, EditorState} from "@codemirror/state"
12+
import {EditorState} from "@codemirror/state"
1313
import {defaultHighlightStyle, syntaxHighlighting, indentOnInput, bracketMatching,
1414
foldGutter, foldKeymap} from "@codemirror/language"
1515
import {defaultKeymap, history, historyKeymap, indentWithTab} from "@codemirror/commands"
@@ -53,6 +53,8 @@ let bullSetup = [
5353
]),
5454
]
5555

56+
declare var BullMarkdown: string
57+
5658
let editor = new EditorView({
5759
doc: BullMarkdown,
5860
extensions: [
@@ -66,6 +68,7 @@ let editor = new EditorView({
6668
editor.focus();
6769

6870
// Inject the editor content into the <form> before submit
69-
document.getElementById('bull-save').onclick = function(event) {
70-
document.getElementById('bull-markdown').value = editor.state.doc.toString();
71+
document.getElementById('bull-save').onclick = function(_unused) {
72+
var bullMarkdown = <HTMLTextAreaElement>document.getElementById('bull-markdown');
73+
bullMarkdown.value = editor.state.doc.toString();
7174
}

regenerate.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export NODE_PATH=$PWD/third_party/codemirror/node_modules
44
go tool esbuild \
5-
internal/codemirror/bull-codemirror.jsx \
5+
internal/codemirror/bull-codemirror.ts \
66
--bundle \
77
--minify \
88
--outfile=internal/codemirror/bull-codemirror.bundle.js

tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2019",
4+
"module": "commonjs",
5+
"alwaysStrict": true,
6+
"noUnusedLocals": true,
7+
"noUnusedParameters": true,
8+
"noImplicitReturns": true,
9+
"moduleResolution": "node",
10+
"baseUrl": "./third_party/codemirror/node_modules",
11+
"esModuleInterop": true,
12+
"forceConsistentCasingInFileNames": true
13+
},
14+
"include": [
15+
"internal/codemirror/*.ts"
16+
],
17+
"exclude": [
18+
"third_party/codemirror/node_modules"
19+
]
20+
}

0 commit comments

Comments
 (0)