UNPKG

thebe-core

Version:

Typescript based core functionality for Thebe

95 lines 2.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const passive_1 = tslib_1.__importDefault(require("./passive")); const utils_1 = require("./utils"); /** * A Thebe cell that is exepected to contain markdown (or raw) source. * * Currently this just separates content cells from code cells and thebe provides no * special handling for markdown cells. * */ class ThebeMarkdownCell extends passive_1.default { constructor(id, notebookId, source, metadata, rendermime) { super(id, rendermime); this.kind = 'markdown'; this.id = id; this.notebookId = notebookId; this.source = source; this.busy = false; this.metadata = metadata; } static fromICell(ic, notebookId, rendermime) { const cell = new ThebeMarkdownCell(typeof ic.id === 'string' ? ic.id : (0, utils_1.shortId)(), notebookId, (0, utils_1.ensureString)(ic.source), ic.metadata, rendermime); return cell; } get isAttachedToDOM() { return false; } get isBusy() { return false; } get isAttached() { return false; } get executionCount() { return null; } setAsBusy() { // no-op } setAsIdle() { // no-op } initOutputs(initialOutputs) { // no-op } reset() { // no-op } attachToDOM(el) { // could potentially allow for markdown rendering here } attachSession(session) { // no-op } detachSession() { // no-op } setOutputText(text) { // no-op } clear() { // no-op } clearOnError(error) { // no-op } messageBusy() { // no-op } messageCompleted() { // no-op } messageError(message) { // no-op } render(outputs) { // no-op } get tags() { return []; } get outputs() { return []; } execute(source) { return tslib_1.__awaiter(this, void 0, void 0, function* () { // could potentially allow for markdown rendering here return { id: this.id, height: 0, width: 0 }; }); } } exports.default = ThebeMarkdownCell; //# sourceMappingURL=markdown.js.map