logo

/repo|v2.5.1

Class

new ToastUIEditor(options)editor.jsline 131

ToastUI Editor

PARAMETERS
NameTypeDescription

options

Object

Option object

PROPERTIES
NameTypeDescription

el

HTMLElement

container element

height

string = '300px'

Editor's height style value. Height is applied as border-box ex) '300px', '100%', 'auto'

minHeight

string = '200px'

Editor's min-height style value in pixel ex) '300px'

initialValue

[ string ]

Editor's initial value

previewStyle

[ string ]

Markdown editor's preview style (tab, vertical)

previewHighlight

boolean = true

Highlight a preview element corresponds to the cursor position in the markdwon editor

initialEditType

[ string ]

Initial editor type (markdown, wysiwyg)

events

[ Object ]

Events

PROPERTIES
NameTypeDescription

load

[ function ]

It would be emitted when editor fully load

change

[ function ]

It would be emitted when content changed

stateChange

[ 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

hooks

[ Object ]

Hooks

PROPERTIES
NameTypeDescription

previewBeforeHook

[ function ]

Submit preview to hook URL before preview be shown

addImageBlobHook

[ addImageBlobHook ]

hook for image upload

language

string = 'en-US'

language

useCommandShortcut

boolean = true

whether use keyboard shortcuts to perform commands

useDefaultHTMLSanitizer

boolean = true

use default htmlSanitizer

usageStatistics

boolean = true

send hostname to google analytics

toolbarItems

[ Array ]

toolbar items.

hideModeSwitch

boolean = false

hide mode switch tab bar

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

customConvertor

[ Object ]

convertor extention

placeholder

[ string ]

The placeholder text of the editable element.

linkAttribute

[ Object ]

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

customHTMLRenderer

[ Object ]

Object containing custom renderer functions correspond to markdown 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

Static Properties

isViewer:

boolean

editor.jsline 869

Check whether is viewer (using in plugins)

Static Methods

factory(options)editor.jsline 839

Factory method for Editor

PARAMETERS
NameTypeDescription

options

object

Option for initialize TUIEditor

RETURNS:
{

object

} - ToastUIEditor or ToastUIEditorViewer

getInstances()editor.jsline 830

Get instance of TUIEditor

RETURNS:
{

Array

}

setLanguage(code, data)editor.jsline 856

Set language

PARAMETERS
NameTypeDescription

code

string

code for I18N language

data

object

language set

Instance Methods

addHook(type, handler)editor.jsline 420

Add hook to TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

addWidget(selection, node, style, offset)editor.jsline 560

Add widget to selection

PARAMETERS
NameTypeDescription

selection

Range

Current selection

node

Node

widget node

style

string

Adding style "over" or "bottom"

offset

[ number ]

Offset for adjust position

afterAddedCommand()editor.jsline 394

After added command.

blur()editor.jsline 459

Remove focus of current Editor

changeMode(mode, isWithoutFocus)editor.jsline 668

Change editor's mode to given mode string

PARAMETERS
NameTypeDescription

mode

string

Editor mode name of want to change

isWithoutFocus

[ boolean ]

Change mode without focus

changePreviewStyle(style)editor.jsline 315

change preview style

PARAMETERS
NameTypeDescription

style

string

'tab'|'vertical'

exec(args)editor.jsline 326

call commandManager's exec method

PARAMETERS
NameTypeDescription

args

focus()editor.jsline 452

Set focus to current Editor

getCodeMirror()editor.jsline 437

Get CodeMirror instance

RETURNS:
{

CodeMirror

}

getCurrentModeEditor()editor.jsline 619

Get current editor mode name

RETURNS:
{

Object

} - MarkdownEditor or WysiwygEditor

getCurrentPreviewStyle()editor.jsline 659

Get current Markdown editor's preview style

RETURNS:
{

string

}

getHtml()editor.jsline 531

Get html syntax text.

RETURNS:
{

string

}

getMarkdown()editor.jsline 515

Get markdown syntax text.

RETURNS:
{

string

}

getRange()editor.jsline 780

Get current range

RETURNS:
{

ObjectRange

}

getSelectedText()editor.jsline 797

get selected text

RETURNS:
{

string

} - selected text

getSquire()editor.jsline 445

Get SquireExt instance

RETURNS:
{

SquireExt

}

getTextObject(range)editor.jsline 789

Get text object of current range

PARAMETERS
NameTypeDescription

range

ObjectRange

Range object of each editor

RETURNS:
{

MdTextObjectWwTextObject

} - TextObject class

getUI()editor.jsline 764

Get _ui property

RETURNS:
{

DefaultUIUI

}

height(height)editor.jsline 569

Set and return edithr height

PARAMETERS
NameTypeDescription

height

string

editor height

RETURNS:
{

string

} - editor height

hide()editor.jsline 731

Hide TUIEditor

insertText(text)editor.jsline 545

Insert text

PARAMETERS
NameTypeDescription

text

string

text string to insert

isMarkdownMode()editor.jsline 635

Return true if current editor mode is Markdown

RETURNS:
{

boolean

}

isViewer()editor.jsline 651

Return false

RETURNS:
{

boolean

}

isWysiwygMode()editor.jsline 643

Return true if current editor mode is WYSIWYG

RETURNS:
{

boolean

}

minHeight(minHeight)editor.jsline 596

Set / Get min content height

PARAMETERS
NameTypeDescription

minHeight

string

min content height in pixel

RETURNS:
{

string

} - min height in pixel

moveCursorToEnd()editor.jsline 466

Set cursor position to end

moveCursorToStart()editor.jsline 473

Set cursor position to start

off(type)editor.jsline 411

Unbind eventHandler from event type

PARAMETERS
NameTypeDescription

type

string

Event type

on(type, handler)editor.jsline 403

Bind eventHandler to event type

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

remove()editor.jsline 702

Remove TUIEditor from document

removeHook(type)editor.jsline 429

Remove hook from TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

reset()editor.jsline 771

Reset TUIEditor

scrollTop(value)editor.jsline 748

Scroll Editor content to Top

PARAMETERS
NameTypeDescription

value

number

Scroll amount

RETURNS:
{

number

}

setCodeBlockLanguages(languages)editor.jsline 817

Set code block languages

PARAMETERS
NameTypeDescription

languages

Array = []

code language list

setHtml(html, cursorToEnd)editor.jsline 499

Set html value.

PARAMETERS
NameTypeDescription

html

string

html syntax text

cursorToEnd

boolean = true

move cursor to contents end

setMarkdown(markdown, cursorToEnd)editor.jsline 482

Set markdown syntax text.

PARAMETERS
NameTypeDescription

markdown

string

markdown syntax text.

cursorToEnd

boolean = true

move cursor to contents end

setPlaceholder(placeholder)editor.jsline 808

Set the placeholder on all editors

PARAMETERS
NameTypeDescription

placeholder

string

placeholder to set

setUI(UI)editor.jsline 756

Set UI to private UI property

PARAMETERS
NameTypeDescription

UI

UI

UI instance

show()editor.jsline 738

Show TUIEditor

Resizable