Created
June 24, 2022 11:44
-
-
Save tpluscode/a486d8ff73cdfe1b27b2032d02b23345 to your computer and use it in GitHub Desktop.
lit-tui-editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { css, html, LitElement, unsafeCSS } from 'lit' | |
import { customElement, property } from 'lit/decorators.js' | |
import Editor from '@toast-ui/editor' | |
import styles from '@toast-ui/editor/dist/toastui-editor.css' | |
@customElement('tui-markdown') | |
export class TuiMarkdown extends LitElement { | |
@property({ type: String }) | |
public value: string | undefined = '' | |
private editor?: Editor | |
static get styles() { | |
return css`${unsafeCSS(styles)}` | |
} | |
protected firstUpdated() { | |
this.editor = new Editor({ | |
el: this.renderRoot.querySelector('div')!, | |
initialEditType: 'markdown', | |
previewStyle: 'tab', | |
usageStatistics: false, | |
}) | |
} | |
protected render(): unknown { | |
return html`<div></div>` | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment