modules

package
v0.0.0-...-1d33cbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNav   = "nav"
	TypeHTML  = "html"
	TypeText  = "text"
	TypeImage = "image"
)

Variables

View Source
var DefaultCustomizer defaultModuleCustomizer

DefaultCustomizer is the default room.ModuleCustomizer.

Functions

This section is empty.

Types

type HTML

type HTML struct {
	Tag                  string   `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
	IdAttr               string   `protobuf:"bytes,2,opt,name=id_attr,json=idAttr,proto3" json:"id_attr,omitempty"`
	Html                 []byte   `protobuf:"bytes,3,opt,name=html,proto3" json:"html,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

HTMLModule is a module that represents any kind of custom HTML. HTMLModule does not have a ModuleBuilder implementation because its data is always static.

func (*HTML) Compile

func (h *HTML) Compile(_ room.DataStore, _ room.ModuleCustomizer, m *room.Module, _ *room.PageCSS) (*room.Module, error)

Compile implements ModuleCompiler for HTMLModule. This function always returns a static element. If the Tag field is empty, the HTML is rendered inside a <div> element.

func (*HTML) Descriptor

func (*HTML) Descriptor() ([]byte, []int)

func (*HTML) GetHtml

func (m *HTML) GetHtml() []byte

func (*HTML) GetIdAttr

func (m *HTML) GetIdAttr() string

func (*HTML) GetTag

func (m *HTML) GetTag() string

func (*HTML) ProtoMessage

func (*HTML) ProtoMessage()

func (*HTML) Reset

func (m *HTML) Reset()

func (*HTML) String

func (m *HTML) String() string

func (*HTML) XXX_DiscardUnknown

func (m *HTML) XXX_DiscardUnknown()

func (*HTML) XXX_Marshal

func (m *HTML) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HTML) XXX_Merge

func (m *HTML) XXX_Merge(src proto.Message)

func (*HTML) XXX_Size

func (m *HTML) XXX_Size() int

func (*HTML) XXX_Unmarshal

func (m *HTML) XXX_Unmarshal(b []byte) error

type Image

type Image struct {
	Common               *room.Common `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
	Src                  string       `protobuf:"bytes,2,opt,name=src,proto3" json:"src,omitempty"`
	Alt                  string       `protobuf:"bytes,3,opt,name=alt,proto3" json:"alt,omitempty"`
	LinkUrl              string       `protobuf:"bytes,4,opt,name=link_url,json=linkUrl,proto3" json:"link_url,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

Image is an image, optionally wrapped in an anchor (<a>) tag.

func (*Image) BuildHTML

func (i *Image) BuildHTML(_ room.DataStore, _ room.ModuleCustomizer, m *room.Module, b *bytes.Buffer, _ *room.PageCSS) error

BuildHTML implements room.ModuleBuilder for Image. NOTE: For now, the Nav is compiled to its final static form and BuildHTML simply outputs the pre-built HTML. We're doing it this way to prepare for making Nav dynamic.

func (*Image) Compile

func (i *Image) Compile(_ room.DataStore, _ room.ModuleCustomizer, m *room.Module, css *room.PageCSS) (*room.Module, error)

func (*Image) Descriptor

func (*Image) Descriptor() ([]byte, []int)

func (*Image) GetAlt

func (m *Image) GetAlt() string

func (*Image) GetCommon

func (m *Image) GetCommon() *room.Common

func (*Image) GetLinkUrl

func (m *Image) GetLinkUrl() string

func (*Image) GetSrc

func (m *Image) GetSrc() string

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) Reset

func (m *Image) Reset()

func (*Image) String

func (m *Image) String() string

func (*Image) XXX_DiscardUnknown

func (m *Image) XXX_DiscardUnknown()

func (*Image) XXX_Marshal

func (m *Image) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Image) XXX_Merge

func (m *Image) XXX_Merge(src proto.Message)

func (*Image) XXX_Size

func (m *Image) XXX_Size() int

func (*Image) XXX_Unmarshal

func (m *Image) XXX_Unmarshal(b []byte) error
type Nav struct {
	Common               *room.Common `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
	Links                []*NavLink   `protobuf:"bytes,2,rep,name=links,proto3" json:"links,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

A Nav is a collection of NavLinks.

func (n *Nav) BuildHTML(_ room.DataStore, _ room.ModuleCustomizer, _ *room.Module, b *bytes.Buffer, _ *room.PageCSS) error

BuildHTML implements ModuleBuilder. (For now this exists because we will add some dynamic functionality.)

func (n *Nav) Compile(ds room.DataStore, mc room.ModuleCustomizer, m *room.Module, css *room.PageCSS) (*room.Module, error)

Compile implements ModuleCompiler for Nav.

func (*Nav) Descriptor() ([]byte, []int)
func (m *Nav) GetCommon() *room.Common
func (m *Nav) GetLinks() []*NavLink
func (*Nav) ProtoMessage()
func (m *Nav) Reset()
func (m *Nav) String() string
func (m *Nav) XXX_DiscardUnknown()
func (m *Nav) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *Nav) XXX_Merge(src proto.Message)
func (m *Nav) XXX_Size() int
func (m *Nav) XXX_Unmarshal(b []byte) error
type NavLink struct {
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	Href string `protobuf:"bytes,2,opt,name=href,proto3" json:"href,omitempty"`
	// Target is either blank or something like "_blank".
	Target               string   `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A NavLink contains the information needed to render a navigation link.

func (*NavLink) Descriptor() ([]byte, []int)
func (m *NavLink) GetHref() string
func (m *NavLink) GetTarget() string
func (m *NavLink) GetText() string
func (*NavLink) ProtoMessage()
func (m *NavLink) Reset()
func (m *NavLink) String() string
func (m *NavLink) XXX_DiscardUnknown()
func (m *NavLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *NavLink) XXX_Merge(src proto.Message)
func (m *NavLink) XXX_Size() int
func (m *NavLink) XXX_Unmarshal(b []byte) error

type Text

type Text struct {
	Common               *room.Common `protobuf:"bytes,1,opt,name=common,proto3" json:"common,omitempty"`
	Ops                  []byte       `protobuf:"bytes,2,opt,name=ops,proto3" json:"ops,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

Text is a rich text module created using Quill's Delta format (https://quilljs.com/docs/delta).

func (*Text) Compile

func (t *Text) Compile(_ room.DataStore, _ room.ModuleCustomizer, m *room.Module, css *room.PageCSS) (*room.Module, error)

Compile implements ModuleCompiler for TextModule.

func (*Text) Descriptor

func (*Text) Descriptor() ([]byte, []int)

func (*Text) GetCommon

func (m *Text) GetCommon() *room.Common

func (*Text) GetOps

func (m *Text) GetOps() []byte

func (*Text) ProtoMessage

func (*Text) ProtoMessage()

func (*Text) Reset

func (m *Text) Reset()

func (*Text) String

func (m *Text) String() string

func (*Text) XXX_DiscardUnknown

func (m *Text) XXX_DiscardUnknown()

func (*Text) XXX_Marshal

func (m *Text) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Text) XXX_Merge

func (m *Text) XXX_Merge(src proto.Message)

func (*Text) XXX_Size

func (m *Text) XXX_Size() int

func (*Text) XXX_Unmarshal

func (m *Text) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL