@webwriter/code
Version:
Write and run code as a code cell. Supports several languages (HTML/CSS/JS, TypeScript, Python).
37 lines (26 loc) • 980 B
text/typescript
import '@shoelace-style/shoelace/dist/themes/light.css';
import { customElement } from 'lit/decorators.js';
import Code from '../shared/ww-code-template'
import { style } from '../shared/ww-code-css-single';
// CodeMirror
import { LanguageSupport } from '@codemirror/language';
// Language Modules
import { htmlModule } from './languageModules/htmlModule';
export type LanguageModule = {
name: string;
executionFunction: ((code: string, context: CodeHTML) => any) | undefined;
languageExtension: LanguageSupport;
};
('webwriter-code-html')
export default class CodeHTML extends Code {
static styles = style;
constructor(){
super()
this.languages= [htmlModule];
this.languageModule = this.languages[0]
}
firstUpdated(): void {
super.firstUpdated()
this.shadowRoot.getElementById("iframePreview").contentDocument.body.style.fontFamily = "Arial";
}
}