editor

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assets

func Assets() fs.FS

Assets returns the embedded filesystem containing CSS, JS, and templates. Use this with http.FileServer or to read individual files.

func CSS

func CSS(includeFullscreen bool) string

CSS returns the combined CSS for the editor (for consumers who want to serve it separately rather than inline).

func JS

func JS(includeFullscreen bool) string

JS returns the combined JS for the editor.

func RenderEditor

func RenderEditor(cfg EditorConfig) (template.HTML, error)

RenderEditor returns the complete editor HTML fragment — toolbar, textarea, fullscreen overlay, config script, CSS, and JS — ready to drop into a page.

Types

type EditorConfig

type EditorConfig struct {
	PreviewEndpoint   string // required: URL for live preview POST (e.g. "/wiki/preview")
	UploadEndpoint    string // optional: if empty, upload buttons are hidden
	EnableFullscreen  bool   // default: true
	EnableImageUpload bool   // default: false
	DarkMode          bool   // default: true (consumer controls via CSS class on <body>)
	TextareaName      string // form field name, default: "content"
	InitialContent    string // pre-filled content for the textarea
	ExtraCSS          string // additional CSS to inject
	ExtraJS           string // additional JS to inject
}

EditorConfig controls what the rendered editor includes.

func DefaultEditorConfig

func DefaultEditorConfig(previewEndpoint string) EditorConfig

DefaultEditorConfig returns a config with sensible defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL