| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- //go:build js && wasm
- package ultraviolet
- import (
- "syscall/js"
- )
- type MarkdownComponentWeb struct {
- node js.Value
- view View
- change bool
- content string
- }
- 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),
- 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) {
- this.content = content
- }
|