thebe-core
Version:
Typescript based core functionality for Thebe
92 lines • 2.17 kB
JavaScript
import { __awaiter } from "tslib";
import PassiveCellRenderer from './passive';
import { ensureString, shortId } from './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.
*
*/
export default class ThebeMarkdownCell extends PassiveCellRenderer {
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 : shortId(), notebookId, 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 __awaiter(this, void 0, void 0, function* () {
// could potentially allow for markdown rendering here
return { id: this.id, height: 0, width: 0 };
});
}
}
//# sourceMappingURL=markdown.js.map