Documentation
¶
Index ¶
- Constants
- func GetBlockAfter(block *ContentBlock, config *Config) string
- func GetBlockBefore(block *ContentBlock, config *Config) string
- func GetBlockParentAfter(block *ContentBlock, config *Config) string
- func GetBlockParentBefore(block *ContentBlock, config *Config) string
- func GetBreakPoints(block *ContentBlock) ([]int, int)
- func GetEntityAfter(entity *Entity, config *Config) string
- func GetEntityBefore(entity *Entity, config *Config) string
- func GetStyleAfter(style *InlineStyleRange, config *Config) string
- func GetStyleBefore(style *InlineStyleRange, config *Config) string
- func Render(contentState *ContentState, config *Config) string
- func RenderInlineStylesAndEntities(content *ContentState, block *ContentBlock, config *Config, buf *bytes.Buffer)
- type BlockIterator
- type BlockOption
- type Config
- type ContentBlock
- type ContentState
- type Entity
- type EntityDecorator
- type EntityRange
- type InlineStyleRange
- type LinkDecorator
- type PlainTextLinkDecorator
- type Range
- type WrapperBlockStack
Constants ¶
View Source
const TAB = " "
Variables ¶
This section is empty.
Functions ¶
func GetBlockAfter ¶
func GetBlockAfter(block *ContentBlock, config *Config) string
func GetBlockBefore ¶
func GetBlockBefore(block *ContentBlock, config *Config) string
func GetBlockParentAfter ¶
func GetBlockParentAfter(block *ContentBlock, config *Config) string
func GetBlockParentBefore ¶
func GetBlockParentBefore(block *ContentBlock, config *Config) string
func GetBreakPoints ¶
func GetBreakPoints(block *ContentBlock) ([]int, int)
func GetEntityAfter ¶
func GetEntityBefore ¶
func GetStyleAfter ¶
func GetStyleAfter(style *InlineStyleRange, config *Config) string
func GetStyleBefore ¶
func GetStyleBefore(style *InlineStyleRange, config *Config) string
func Render ¶
func Render(contentState *ContentState, config *Config) string
func RenderInlineStylesAndEntities ¶
func RenderInlineStylesAndEntities(content *ContentState, block *ContentBlock, config *Config, buf *bytes.Buffer)
Types ¶
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 BlockOption ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewHTMLConfig ¶
func NewHTMLConfig() *Config
func NewMarkdownConfig ¶
func NewMarkdownConfig() *Config
func NewPlainTextConfig ¶
func NewPlainTextConfig() *Config
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
type Entity ¶
type Entity struct { Type string `json:"type"` Mutability string `json:"mutability"` Data map[string]interface{} `json:"data"` }
Entity https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftEntity.js
func GetEntity ¶
func GetEntity(contentState *ContentState, entityRange *EntityRange) *Entity
type EntityDecorator ¶
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 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) RenderAfter ¶
func (d *LinkDecorator) RenderAfter(data map[string]interface{}) string
func (*LinkDecorator) RenderBefore ¶
func (d *LinkDecorator) RenderBefore(data map[string]interface{}) string
type PlainTextLinkDecorator ¶
type PlainTextLinkDecorator struct{}
func (*PlainTextLinkDecorator) RenderAfter ¶
func (d *PlainTextLinkDecorator) RenderAfter(data map[string]interface{}) string
func (*PlainTextLinkDecorator) RenderBefore ¶
func (d *PlainTextLinkDecorator) RenderBefore(data map[string]interface{}) string
type Range ¶
func GetRanges ¶
func GetRanges(block *ContentBlock) ([]*Range, bool)
bool == fullstring (no styles)
type WrapperBlockStack ¶
type WrapperBlockStack struct {
// contains filtered or unexported fields
}
func (*WrapperBlockStack) CurrentBlock ¶
func (s *WrapperBlockStack) CurrentBlock() *ContentBlock
func (*WrapperBlockStack) Pop ¶
func (s *WrapperBlockStack) Pop() *ContentBlock
func (*WrapperBlockStack) Push ¶
func (s *WrapperBlockStack) Push(block *ContentBlock) *WrapperBlockStack
Click to show internal directories.
Click to hide internal directories.