logo

/github|v3.2.0

Class

new ToastUIEditorViewer(options)

Class ToastUIEditorViewer

PARAMETERS
NameTypeDescription

options

object

Option object

PROPERTIES
NameTypeDescription

el

HTMLElement

container element

initialValue

[ string ]

Editor's initial value

events

[ Object ]

Events

PROPERTIES
NameTypeDescription

load

[ function ]

It would be emitted when editor fully load

change

[ function ]

It would be emitted when content changed

caretChange

[ function ]

It would be emitted when format change by cursor position

focus

[ function ]

It would be emitted when editor get focus

blur

[ function ]

It would be emitted when editor loose focus

plugins

[ Array ]

Array of plugins. A plugin can be either a function or an array in the form of function, options.

extendedAutolinks

[ Object ]

Using extended Autolinks specified in GFM spec

linkAttributes

[ Object ]

Attributes of anchor element that should be rel, target, hreflang, type

customHTMLRenderer

Object = null

Object containing custom renderer functions correspond to change markdown node to preview HTML or wysiwyg node

referenceDefinition

boolean = false

whether use the specification of link reference definition

customHTMLSanitizer

function = null

custom HTML sanitizer

frontMatter

boolean = false

whether use the front matter

theme

[ string ]

The theme to style the viewer with. The default is included in toastui-editor.css.

Instance Methods

addHook(type, handler)

Add hook to TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

destroy()

Remove Viewer preview from document

isMarkdownMode()

Return false

RETURNS:
{

boolean

}

isViewer()

Return true

RETURNS:
{

boolean

}

isWysiwygMode()

Return false

RETURNS:
{

boolean

}

off(type)

Unbind eventHandler from event type

PARAMETERS
NameTypeDescription

type

string

Event type

on(type, handler)

Bind eventHandler to event type

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

setMarkdown(markdown)

Set content for preview

PARAMETERS
NameTypeDescription

markdown

string

Markdown text

Resizable