Documentation ¶
Overview ¶
templ: version: v0.2.707
templ: version: v0.2.707
templ: version: v0.2.707
templ: version: v0.2.707
Index ¶
- Variables
- type BaseFeature
- func (b *BaseFeature) Config(widgetContext ctx.Context) map[string]interface{}
- func (b *BaseFeature) Constructor() string
- func (b *BaseFeature) Media() media.Media
- func (b *BaseFeature) Name() string
- func (b *BaseFeature) OnRegister(m django.Mux) error
- func (b *BaseFeature) OnValidate(data editor.BlockData) error
- func (b *BaseFeature) Render(d editor.BlockData) editor.FeatureBlock
- type Block
- type BlockRenderer
- type BlockTune
- type FeatureBlock
- func (b *FeatureBlock) Attribute(key string, value interface{})
- func (b *FeatureBlock) Attributes() map[string]interface{}
- func (b *FeatureBlock) Data() editor.BlockData
- func (b *FeatureBlock) Feature() editor.BaseFeature
- func (b *FeatureBlock) ID() string
- func (b *FeatureBlock) Render(ctx context.Context, w io.Writer) error
- func (b *FeatureBlock) String() string
- func (b *FeatureBlock) Type() string
- type WrapperBlock
- type WrapperTune
Constants ¶
This section is empty.
Variables ¶
View Source
var AlignmentBlockTune = &BlockTune{ BaseFeature: BaseFeature{ Type: "text-align", JSConstructor: "AlignmentBlockTune", JSFiles: []string{ "editorjs/js/deps/tools/text-alignment.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { fb.GetString = func(d editor.BlockData) string { return d.Data["text"].(string) } return fb }, }, TuneFunc: tuneBlocks, }
View Source
var CheckListBlock = &Block{ BaseFeature: BaseFeature{ Type: "checklist", JSConstructor: "Checklist", JSFiles: []string{ "editorjs/js/deps/tools/checklist.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { return fb }, }, RenderFunc: func(b editor.FeatureBlock, c context.Context, w io.Writer) error { var items = make([]checkListItem, 0) var checklistItems = b.Data().Data["items"].([]map[string]interface{}) for _, item := range checklistItems { items = append(items, checkListItem{ Text: item["text"].(string), Checked: item["checked"].(bool), }) } return renderCheckList(items).Render(c, w) }, }
View Source
var DelimiterFeature = &Block{ BaseFeature: BaseFeature{ Type: "delimiter", JSConstructor: "Delimiter", JSFiles: []string{ "editorjs/js/deps/tools/delimiter.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { fb.GetString = func(editor.BlockData) string { return "----" } return fb }, }, RenderFunc: renderDelimiter, }
View Source
var (
ErrRenderNotImplemented = errors.New("feature does not implement RenderBlock")
)
View Source
var HeadingFeature = &Block{ BaseFeature: BaseFeature{ Type: "header", JSConstructor: "Header", JSFiles: []string{ "editorjs/js/deps/tools/header.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { fb.GetString = func(d editor.BlockData) string { return d.Data["text"].(string) } return fb }, }, RenderFunc: renderHeading, }
View Source
var ListBlock = &Block{ BaseFeature: BaseFeature{ Type: "list", JSConstructor: "List", JSFiles: []string{ "editorjs/js/deps/tools/list.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { return fb }, }, RenderFunc: func(b editor.FeatureBlock, c context.Context, w io.Writer) error { var items = make([]string, 0) for _, item := range b.Data().Data["items"].([]interface{}) { items = append(items, item.(string)) } return renderList(items).Render(c, w) }, }
View Source
var ParagraphFeature = &Block{ BaseFeature: BaseFeature{ Type: "paragraph", JSConstructor: "Paragraph", JSFiles: []string{ "editorjs/js/deps/tools/paragraph.umd.js", }, Build: func(fb *FeatureBlock) *FeatureBlock { fb.GetString = func(d editor.BlockData) string { return d.Data["text"].(string) } return fb }, }, RenderFunc: renderParagraph, }
Functions ¶
This section is empty.
Types ¶
type BaseFeature ¶
type BaseFeature struct { Type string Extra map[string]interface{} JSConstructor string JSFiles []string CSSFles []string Validate func(editor.BlockData) error Build func(*FeatureBlock) *FeatureBlock Register func(django.Mux) }
func (*BaseFeature) Config ¶
func (b *BaseFeature) Config(widgetContext ctx.Context) map[string]interface{}
Config returns the configuration of the feature.
func (*BaseFeature) Constructor ¶
func (b *BaseFeature) Constructor() string
Constructor returns the JS class name of the feature.
func (*BaseFeature) Media ¶
func (b *BaseFeature) Media() media.Media
Media return's the feature's static / media files.
func (*BaseFeature) Name ¶
func (b *BaseFeature) Name() string
Name returns the name of the feature.
func (*BaseFeature) OnRegister ¶ added in v1.6.9
func (b *BaseFeature) OnRegister(m django.Mux) error
OnRegister is called when the feature is registered.
It is allowed to add custom routes or do other setup here.
func (*BaseFeature) OnValidate ¶ added in v1.6.9
func (b *BaseFeature) OnValidate(data editor.BlockData) error
OnValidate is called when the feature is validated.
func (*BaseFeature) Render ¶
func (b *BaseFeature) Render(d editor.BlockData) editor.FeatureBlock
Render returns the feature block.
type Block ¶
type Block struct { BaseFeature RenderFunc func(b editor.FeatureBlock, c context.Context, w io.Writer) error }
func (*Block) RenderBlock ¶
type BlockRenderer ¶
type BlockTune ¶
type BlockTune struct { BaseFeature TuneFunc func(fb editor.FeatureBlock, data interface{}) editor.FeatureBlock }
func (*BlockTune) Tune ¶
func (b *BlockTune) Tune(fb editor.FeatureBlock, data interface{}) editor.FeatureBlock
type FeatureBlock ¶
type FeatureBlock struct { Attrs map[string]interface{} Identifier string FeatureData editor.BlockData FeatureObject editor.BaseFeature FeatureName string GetString func(editor.BlockData) string }
func (*FeatureBlock) Attribute ¶
func (b *FeatureBlock) Attribute(key string, value interface{})
func (*FeatureBlock) Attributes ¶
func (b *FeatureBlock) Attributes() map[string]interface{}
func (*FeatureBlock) Data ¶
func (b *FeatureBlock) Data() editor.BlockData
func (*FeatureBlock) Feature ¶
func (b *FeatureBlock) Feature() editor.BaseFeature
func (*FeatureBlock) ID ¶
func (b *FeatureBlock) ID() string
func (*FeatureBlock) String ¶
func (b *FeatureBlock) String() string
func (*FeatureBlock) Type ¶
func (b *FeatureBlock) Type() string
type WrapperBlock ¶
type WrapperBlock struct { editor.FeatureBlock Wrap func(editor.FeatureBlock) func(context.Context, io.Writer) error }
type WrapperTune ¶
type WrapperTune struct { BaseFeature Wrap func(editor.FeatureBlock) func(context.Context, io.Writer) error }
func (*WrapperTune) Render ¶
func (b *WrapperTune) Render(d editor.BlockData) editor.FeatureBlock
Click to show internal directories.
Click to hide internal directories.