Documentation
¶
Overview ¶
Package editor defines the WYSIWYG editor provider interface for workflow-plugin-cms.
The CMS engine stores page content in TWO complementary forms:
- body_blocks: structured block JSON (provider-specific shape)
- body_html: rendered HTML for serve-time output
Providers translate between the two and render block trees to HTML.
Per gocodealone-multisite SPEC.md V10: provider impls share a common interface; swap = config flag, no code change.
Default provider = TipTap (MIT, ProseMirror-based). Alt providers (Editor.js, Lexical, TinyMCE community) implement the same interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider interface {
// Name returns the provider's short identifier (e.g. "tiptap",
// "editorjs", "lexical"). Matches the `provider` config key.
Name() string
// FrontendBundleID returns the identifier of the editor's JS bundle
// shipped with the admin UI. Empty string = host serves no bundle
// for this provider (rare; usually only true for stub/test).
FrontendBundleID() string
// EmptyBlocks returns the canonical "empty document" block JSON for
// new pages. Callers persist this as `body_blocks` for newly-created
// drafts.
EmptyBlocks() json.RawMessage
// Render translates block JSON to HTML for serve-time output.
// Returns ("", false) on bad input — caller falls back to last
// known good body_html (V14: dynamic rendering is server-side
// deterministic, never client-fetch).
Render(blocks json.RawMessage) (html string, ok bool)
// Validate returns nil if the block JSON is structurally valid for
// this provider; otherwise an error suitable for surfacing to the
// admin UI.
Validate(blocks json.RawMessage) error
}
Provider is the contract every WYSIWYG backend implements.
Methods are intentionally minimal — the CMS engine owns persistence, auth, and route resolution. The provider owns block-format <→> HTML rendering and front-end-component identity.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the set of available providers and resolves the currently-configured default by name.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry returns an empty Registry. Use Register to add providers at process start; lookup is concurrency-safe thereafter.