@dodona/papyros
Version:
Scratchpad for multiple programming languages in the browser.
51 lines • 2.02 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { customElement, property } from "lit/decorators.js";
import { CodeMirrorEditor } from "./CodeMirrorEditor";
import { EditorView, keymap } from "@codemirror/view";
import { css } from "lit";
import { defaultKeymap } from "@codemirror/commands";
import { setUsedLines, usedLineExtension } from "./Extensions";
let BatchInputEditor = class BatchInputEditor extends CodeMirrorEditor {
static get styles() {
return css `
:host {
width: 100%;
height: 100%;
}
`;
}
set usedLines(value) {
var _a;
const lines = Array.from({ length: value }, (a, i) => i + 1);
(_a = this.view) === null || _a === void 0 ? void 0 : _a.dispatch({
effects: setUsedLines.of(lines),
});
}
set readOnly(value) {
this.configure({
debugging: value ? EditorView.editable.of(false) : [],
});
}
constructor() {
super();
this.configure({
default: [usedLineExtension, keymap.of(defaultKeymap)],
});
}
};
__decorate([
property({ type: Number })
], BatchInputEditor.prototype, "usedLines", null);
__decorate([
property({ type: Boolean })
], BatchInputEditor.prototype, "readOnly", null);
BatchInputEditor = __decorate([
customElement("p-batch-input-editor")
], BatchInputEditor);
export { BatchInputEditor };
//# sourceMappingURL=BatchInputEditor.js.map