Skip to content

Instantly share code, notes, and snippets.

@tpluscode
Created June 24, 2022 11:44
Show Gist options
  • Save tpluscode/a486d8ff73cdfe1b27b2032d02b23345 to your computer and use it in GitHub Desktop.
Save tpluscode/a486d8ff73cdfe1b27b2032d02b23345 to your computer and use it in GitHub Desktop.
lit-tui-editor
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