Documentation
¶
Overview ¶
templ: version: v0.2.707
Index ¶
- Variables
- func EditorJSField(features []string, opts ...func(fields.Field)) fields.Field
- func FeatureNames(f ...BaseFeature) []string
- func JSONMarshalEditorData(d *EditorJSBlockData) ([]byte, error)
- type BaseFeature
- type BlockData
- type BlockTuneFeature
- type EditorJSBlockData
- type EditorJSData
- type EditorJSFormField
- func (e *EditorJSFormField) HasChanged(initial, data interface{}) bool
- func (e *EditorJSFormField) SetWidget(widget widgets.Widget)
- func (e *EditorJSFormField) ValueToForm(value interface{}) interface{}
- func (e *EditorJSFormField) ValueToGo(value interface{}) (interface{}, error)
- func (e *EditorJSFormField) Widget() widgets.Widget
- type EditorJSWidget
- func (b *EditorJSWidget) Component(id, name, value string, errors []error, attrs map[string]string, ...) templ.Component
- func (b *EditorJSWidget) GetContextData(id, name string, value interface{}, attrs map[string]string) ctx.Context
- func (b *EditorJSWidget) Media() media.Media
- func (b *EditorJSWidget) Render(w io.Writer, id, name string, value interface{}, attrs map[string]string) error
- func (b *EditorJSWidget) RenderWithErrors(w io.Writer, id, name string, value interface{}, errors []error, ...) error
- func (b EditorJSWidget) ValueToForm(value interface{}) interface{}
- func (b EditorJSWidget) ValueToGo(value interface{}) (interface{}, error)
- type FeatureBlock
- type FeatureBlockRenderer
- type InlineFeature
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EditorRegistry = newEditorRegistry() ValueToForm = EditorRegistry.ValueToForm ValueToGo = EditorRegistry.ValueToGo Features = EditorRegistry.Features Register = EditorRegistry.Register TuneFeature = EditorRegistry.TuneFeature Tune = EditorRegistry.Tune )
View Source
var (
RENDER_ERRORS = true
)
Functions ¶
func FeatureNames ¶ added in v1.6.6
func FeatureNames(f ...BaseFeature) []string
func JSONMarshalEditorData ¶ added in v1.6.6
func JSONMarshalEditorData(d *EditorJSBlockData) ([]byte, error)
Types ¶
type BaseFeature ¶
type BaseFeature interface { // Name returns the name of the feature. Name() string // Config returns the configuration of the feature. Config(widgetContext ctx.Context) map[string]interface{} // Constructor returns the JS class name of the feature. Constructor() string // Media return's the feature's static / media files. Media() media.Media }
type BlockTuneFeature ¶
type BlockTuneFeature interface { BaseFeature Tune(FeatureBlock, interface{}) FeatureBlock }
BlockTuneFeature is a feature that can tune a block.
This is used to tune the block after it has been converted from JSON to Go.
The tune method should return a new block, or the same block if no changes were made.
The tune object should wrap the provided block or make changes to it.
type EditorJSBlockData ¶
type EditorJSBlockData struct { Time int64 `json:"time"` Blocks []FeatureBlock `json:"blocks"` Version string `json:"version"` Features []BaseFeature `json:"-"` }
func JSONUnmarshalEditorData ¶ added in v1.6.6
func JSONUnmarshalEditorData(features []string, data []byte) (*EditorJSBlockData, error)
func (*EditorJSBlockData) Render ¶
func (e *EditorJSBlockData) Render() template.HTML
func (*EditorJSBlockData) String ¶
func (e *EditorJSBlockData) String() string
type EditorJSData ¶
type EditorJSFormField ¶
type EditorJSFormField struct { *fields.JSONFormField[EditorJSData] Features []string // contains filtered or unexported fields }
func (*EditorJSFormField) HasChanged ¶
func (e *EditorJSFormField) HasChanged(initial, data interface{}) bool
func (*EditorJSFormField) SetWidget ¶
func (e *EditorJSFormField) SetWidget(widget widgets.Widget)
func (*EditorJSFormField) ValueToForm ¶
func (e *EditorJSFormField) ValueToForm(value interface{}) interface{}
func (*EditorJSFormField) ValueToGo ¶
func (e *EditorJSFormField) ValueToGo(value interface{}) (interface{}, error)
func (*EditorJSFormField) Widget ¶
func (e *EditorJSFormField) Widget() widgets.Widget
type EditorJSWidget ¶
type EditorJSWidget struct { widgets.BaseWidget Features []string }
func NewEditorJSWidget ¶
func NewEditorJSWidget(features ...string) *EditorJSWidget
func (*EditorJSWidget) GetContextData ¶
func (*EditorJSWidget) Media ¶
func (b *EditorJSWidget) Media() media.Media
func (*EditorJSWidget) RenderWithErrors ¶
func (EditorJSWidget) ValueToForm ¶
func (b EditorJSWidget) ValueToForm(value interface{}) interface{}
func (EditorJSWidget) ValueToGo ¶
func (b EditorJSWidget) ValueToGo(value interface{}) (interface{}, error)
type FeatureBlock ¶
type FeatureBlockRenderer ¶
type FeatureBlockRenderer interface { BaseFeature // Render should return a new block object that can be used to render // the HTML. Render(BlockData) FeatureBlock }
FeatureBlockRenderer is a feature that can render a block.
This is used to render the block after it has been converted from JSON to Go.
The render method should return an object based on the provided data. This object will be used to render the HTML.
type InlineFeature ¶
type InlineFeature interface { BaseFeature }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.