Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/use codemirror #27

Merged
merged 4 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<div class="container py-2">
<div class="row">
<div class="col-lg">
<textarea id="input" class="form-control font-monospace" rows="10">(1..3).map do
["Hello", "こんにちは", "😀"].sample
end.join(":")
<textarea id="input" class="form-control font-monospace" rows="10">3.times do
puts ["Hello", "こんにちは", "😀"].sample
end
</textarea>
<button id="clear" type="button" class="btn btn-secondary">Select All</button>
<button id="run" type="button" class="btn btn-primary float-end">Run (Ctrl + Enter)</button>
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { BrowserVm } from "./browserVm";
import CodeMirror from "codemirror";
import "codemirror/mode/ruby/ruby";
import "codemirror/lib/codemirror.css";
import "codemirror/theme/monokai.css";
import "codemirror/theme/rubyblue.css";
import "./style.css";

let browserVm:BrowserVm;

let outputBuffer:string[] = [];

const codeEditor = CodeMirror.fromTextArea(document.getElementById("input") as HTMLTextAreaElement, {
theme: 'monokai', // TODO: See other themes
theme: 'rubyblue',
mode: "text/x-ruby",
// matchBrackets: true, // TODO: Support TypeScript
indentUnit: 2
Expand Down
17 changes: 17 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,21 @@ nav {

.navbar-brand {
font-size: 1.1rem;
}

.CodeMirror {
border: 1px solid #eee;
height: 240px;
}

@media (min-width: 768px) { /* Medium(md) */
.CodeMirror {
height: 320px;
}
}

@media (min-width: 992px) { /* Large(lg) */
.CodeMirror {
height: 640px;
}
}