Module

Milkdown.Crepe

Package
purescript-milkdown
Repository
philippedev101/purescript-milkdown

#Editor Source

data Editor

Opaque type for the Crepe editor instance

#MilkdownPlugin Source

data MilkdownPlugin

Opaque type for a Milkdown plugin (built in JS by the consumer)

#EditorConfig Source

type EditorConfig = { defaultValue :: String, features :: Array Feature, plugins :: Array MilkdownPlugin, readonly :: Boolean, root :: Element }

Configuration for creating an editor

#Feature Source

data Feature

Milkdown Crepe features that can be enabled/disabled

Constructors

#create Source

create :: EditorConfig -> Aff Editor

Create and mount a Crepe editor. Returns Aff because Crepe.create() is async.

#destroy Source

destroy :: Editor -> Effect Unit

Destroy and unmount the editor.

#getMarkdown Source

getMarkdown :: Editor -> Effect String

Get the current markdown content.

#setMarkdown Source

setMarkdown :: Editor -> String -> Effect Unit

Replace editor content with new markdown.

#setReadonly Source

setReadonly :: Editor -> Boolean -> Effect Unit

Toggle read-only mode.

#focus Source

focus :: Editor -> Effect Unit

Programmatically focus the editor.

#onMarkdownUpdated Source

onMarkdownUpdated :: Editor -> (String -> Effect Unit) -> Effect Unit

Register a callback for markdown content changes.

#onFocus Source

onFocus :: Editor -> Effect Unit -> Effect Unit

Register a focus callback.

#onBlur Source

onBlur :: Editor -> Effect Unit -> Effect Unit

Register a blur callback.