| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //go:build js && wasm
- package ultraviolet
- import (
- "syscall/js"
- )
- type MarkdownComponentWeb struct {
- node js.Value
- view View
- change bool
- content string
- paragraph bool
- }
- func NewMarkdownComponentWeb(view View) *MarkdownComponentWeb {
- return &MarkdownComponentWeb{
- view: view,
- change: true,
- }
- }
- // Component
- func (this *MarkdownComponentWeb) Build(parent Component) {
- this.node = WebBuildDiv(
- this.node,
- parent,
- this.view,
- "",
- MarkdownConvert(this.content, this.paragraph),
- AbstractHandlers{},
- )
- }
- func (this *MarkdownComponentWeb) Invalidate() bool {
- result := this.change
- this.change = false
- return result
- }
- func (this *MarkdownComponentWeb) Clean() {
- WebCleanChildren(this.node)
- this.change = true
- }
- // JS
- func (this *MarkdownComponentWeb) Node() js.Value {
- return this.node
- }
- // ComponentMarkdown
- func (this *MarkdownComponentWeb) SetMarkdown(content string, paragraph bool) {
- this.content = content
- this.paragraph = paragraph
- }
|