Documentation
¶
Overview ¶
draftjs exporter for go language
Index ¶
- func GetBlockEndTag(block *ContentBlock, config *Config) string
- func GetBlockStartTag(block *ContentBlock, config *Config) string
- func GetBlockTag(block *ContentBlock, config *Config) string
- func GetBlockWrapperEndTag(block *ContentBlock, config *Config) string
- func GetBlockWrapperStartTag(block *ContentBlock, config *Config) string
- func GetBlockWrapperTag(block *ContentBlock, config *Config) string
- func GetBreakPoints(block *ContentBlock) ([]int, int)
- func GetEntityDecorator(content *ContentState, entityRange *EntityRange, config *Config) (Decorator, *Entity)
- func GetEntityEndTag(content *ContentState, entityRange *EntityRange, config *Config) string
- func GetEntityStartTag(content *ContentState, entityRange *EntityRange, config *Config) string
- func GetMathJaxData(data string) string
- func GetMaxHeightStyle() string
- func GetStyleEndTag(style *InlineStyleRange, config *Config) string
- func GetStyleStartTag(style *InlineStyleRange, config *Config) string
- func GetStylemapElement(style *InlineStyleRange, config *Config) string
- func PerformInlineStylesAndEntities(content *ContentState, block *ContentBlock, config *Config, buf *bytes.Buffer)
- func Render(contentState *ContentState, config *Config) string
- func RenderPlainText(contentState *ContentState) string
- func RenderPlainTextToBuffer(contentState *ContentState, buffer *bytes.Buffer)
- func RenderWithBuf(contentState *ContentState, config *Config, buf *bytes.Buffer)
- func SetDefaultBlocks(config *Config)
- func SetDefaultDecorators(config *Config)
- func SetDefaultStyles(config *Config)
- type AudioDecorator
- type BlockAudioDecorator
- type BlockImageDecorator
- type BlockIterator
- type BlockMathJaxDecorator
- type Cache
- type CacheElement
- type Config
- func (config *Config) GetBlockMapElement(descriptorType string) *Descriptor
- func (config *Config) GetEntityDecorator(descriptorType string) *Descriptor
- func (config *Config) GetFromCache(key1, key2 string) (string, bool)
- func (config *Config) GetStyleMapElement(descriptorType string) *Descriptor
- func (config *Config) Precache()
- func (config *Config) PrecacheBlocks()
- func (config *Config) PrecacheStyles()
- func (config *Config) SetBlockMapElement(descriptor *Descriptor)
- func (config *Config) SetEntityDecorator(descriptor *Descriptor)
- func (config *Config) SetStyleMapElement(descriptor *Descriptor)
- func (config *Config) SetToCache(key1, key2, value string)
- type ContentBlock
- type ContentState
- type Decorator
- type Descriptor
- type Entity
- type EntityRange
- type ImageDecorator
- type InlineAudioDecorator
- type InlineImageDecorator
- type InlineMathJaxDecorator
- type InlineStyleRange
- type LinkDecorator
- type Range
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBlockEndTag ¶
func GetBlockEndTag(block *ContentBlock, config *Config) string
func GetBlockStartTag ¶
func GetBlockStartTag(block *ContentBlock, config *Config) string
func GetBlockTag ¶
func GetBlockTag(block *ContentBlock, config *Config) string
func GetBlockWrapperEndTag ¶
func GetBlockWrapperEndTag(block *ContentBlock, config *Config) string
func GetBlockWrapperStartTag ¶
func GetBlockWrapperStartTag(block *ContentBlock, config *Config) string
func GetBlockWrapperTag ¶
func GetBlockWrapperTag(block *ContentBlock, config *Config) string
func GetBreakPoints ¶
func GetBreakPoints(block *ContentBlock) ([]int, int)
func GetEntityDecorator ¶
func GetEntityDecorator(content *ContentState, entityRange *EntityRange, config *Config) (Decorator, *Entity)
func GetEntityEndTag ¶
func GetEntityEndTag(content *ContentState, entityRange *EntityRange, config *Config) string
func GetEntityStartTag ¶
func GetEntityStartTag(content *ContentState, entityRange *EntityRange, config *Config) string
func GetMathJaxData ¶
func GetMaxHeightStyle ¶
func GetMaxHeightStyle() string
func GetStyleEndTag ¶
func GetStyleEndTag(style *InlineStyleRange, config *Config) string
func GetStyleStartTag ¶
func GetStyleStartTag(style *InlineStyleRange, config *Config) string
func GetStylemapElement ¶
func GetStylemapElement(style *InlineStyleRange, config *Config) string
func PerformInlineStylesAndEntities ¶
func PerformInlineStylesAndEntities(content *ContentState, block *ContentBlock, config *Config, buf *bytes.Buffer)
func Render ¶
func Render(contentState *ContentState, config *Config) string
Render renders Draft.js content state to string with config
func RenderPlainText ¶
func RenderPlainText(contentState *ContentState) string
func RenderPlainTextToBuffer ¶
func RenderPlainTextToBuffer(contentState *ContentState, buffer *bytes.Buffer)
func RenderWithBuf ¶
func RenderWithBuf(contentState *ContentState, config *Config, buf *bytes.Buffer)
RenderWithBuf renders Draft.js content state to buffer with config
func SetDefaultBlocks ¶
func SetDefaultBlocks(config *Config)
func SetDefaultDecorators ¶
func SetDefaultDecorators(config *Config)
func SetDefaultStyles ¶
func SetDefaultStyles(config *Config)
Types ¶
type AudioDecorator ¶
type AudioDecorator struct { }
func (*AudioDecorator) RenderBeginning ¶
func (decorator *AudioDecorator) RenderBeginning(data map[string]string) string
func (*AudioDecorator) RenderEnding ¶
func (decorator *AudioDecorator) RenderEnding(data map[string]string) string
type BlockAudioDecorator ¶
type BlockAudioDecorator struct { }
func (*BlockAudioDecorator) RenderBeginning ¶
func (decorator *BlockAudioDecorator) RenderBeginning(data map[string]string) string
func (*BlockAudioDecorator) RenderEnding ¶
func (decorator *BlockAudioDecorator) RenderEnding(data map[string]string) string
type BlockImageDecorator ¶
type BlockImageDecorator struct { }
func (*BlockImageDecorator) RenderBeginning ¶
func (decorator *BlockImageDecorator) RenderBeginning(data map[string]string) string
func (*BlockImageDecorator) RenderEnding ¶
func (decorator *BlockImageDecorator) RenderEnding(data map[string]string) string
type BlockIterator ¶
type BlockIterator struct {
// contains filtered or unexported fields
}
func NewBlockIterator ¶
func NewBlockIterator(contentState *ContentState) *BlockIterator
func (*BlockIterator) HasNext ¶
func (bi *BlockIterator) HasNext() bool
func (BlockIterator) NextBlock ¶
func (bi BlockIterator) NextBlock() *ContentBlock
func (*BlockIterator) StepNext ¶
func (bi *BlockIterator) StepNext() *BlockIterator
type BlockMathJaxDecorator ¶
type BlockMathJaxDecorator struct { }
func (*BlockMathJaxDecorator) RenderBeginning ¶
func (decorator *BlockMathJaxDecorator) RenderBeginning(data map[string]string) string
func (*BlockMathJaxDecorator) RenderEnding ¶
func (decorator *BlockMathJaxDecorator) RenderEnding(data map[string]string) string
type CacheElement ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig Makes new config and fills it with default HTML elements
func (*Config) GetBlockMapElement ¶
func (config *Config) GetBlockMapElement(descriptorType string) *Descriptor
func (*Config) GetEntityDecorator ¶
func (config *Config) GetEntityDecorator(descriptorType string) *Descriptor
func (*Config) GetStyleMapElement ¶
func (config *Config) GetStyleMapElement(descriptorType string) *Descriptor
func (*Config) PrecacheBlocks ¶
func (config *Config) PrecacheBlocks()
func (*Config) PrecacheStyles ¶
func (config *Config) PrecacheStyles()
func (*Config) SetBlockMapElement ¶
func (config *Config) SetBlockMapElement(descriptor *Descriptor)
func (*Config) SetEntityDecorator ¶
func (config *Config) SetEntityDecorator(descriptor *Descriptor)
func (*Config) SetStyleMapElement ¶
func (config *Config) SetStyleMapElement(descriptor *Descriptor)
func (*Config) SetToCache ¶
type ContentBlock ¶
type ContentBlock struct { Key string `json:"key"` Type string `json:"type"` Text string `json:"text"` Depth int `json:"depth"` InlineStyleRanges []*InlineStyleRange `json:"inlineStyleRanges"` EntityRanges []*EntityRange `json:"entityRanges"` Data interface{} `json:"data"` }
ContentBlock https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftContentBlock.js
type ContentState ¶
type ContentState struct { Blocks []*ContentBlock `json:"blocks"` EntityMap map[string]*Entity `json:"entityMap"` }
ContentState https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftContentState.js
func (*ContentState) String ¶
func (contentState *ContentState) String() string
Interface implementation
type Descriptor ¶
func GetDescriptorFromMap ¶
func GetDescriptorFromMap(key string, sourceMap map[string]*Descriptor) *Descriptor
type Entity ¶
type Entity struct { Type string `json:"type"` Mutability string `json:"mutability"` Data map[string]string `json:"data"` }
Entity https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftEntity.js
type EntityRange ¶
EntityRange https://github.com/facebook/draft-js/blob/master/src/model/encoding/EntityRange.js
func GetEntityForRange ¶
func GetEntityForRange(r *Range, block *ContentBlock) []*EntityRange
type ImageDecorator ¶
type ImageDecorator struct { }
func (*ImageDecorator) RenderBeginning ¶
func (decorator *ImageDecorator) RenderBeginning(data map[string]string) string
func (*ImageDecorator) RenderEnding ¶
func (decorator *ImageDecorator) RenderEnding(data map[string]string) string
type InlineAudioDecorator ¶
type InlineAudioDecorator struct { }
func (*InlineAudioDecorator) RenderBeginning ¶
func (decorator *InlineAudioDecorator) RenderBeginning(data map[string]string) string
func (*InlineAudioDecorator) RenderEnding ¶
func (decorator *InlineAudioDecorator) RenderEnding(data map[string]string) string
type InlineImageDecorator ¶
type InlineImageDecorator struct { }
func (*InlineImageDecorator) RenderBeginning ¶
func (decorator *InlineImageDecorator) RenderBeginning(data map[string]string) string
func (*InlineImageDecorator) RenderEnding ¶
func (decorator *InlineImageDecorator) RenderEnding(data map[string]string) string
type InlineMathJaxDecorator ¶
type InlineMathJaxDecorator struct { }
func (*InlineMathJaxDecorator) RenderBeginning ¶
func (decorator *InlineMathJaxDecorator) RenderBeginning(data map[string]string) string
func (*InlineMathJaxDecorator) RenderEnding ¶
func (decorator *InlineMathJaxDecorator) RenderEnding(data map[string]string) string
type InlineStyleRange ¶
InlineStyleRange https://github.com/facebook/draft-js/blob/master/src/model/encoding/InlineStyleRange.js
func GetStyleForRange ¶
func GetStyleForRange(r *Range, block *ContentBlock) []*InlineStyleRange
type LinkDecorator ¶
type LinkDecorator struct { }
func (*LinkDecorator) RenderBeginning ¶
func (decorator *LinkDecorator) RenderBeginning(data map[string]string) string
func (*LinkDecorator) RenderEnding ¶
func (decorator *LinkDecorator) RenderEnding(data map[string]string) string