logo

/repo|v1.4.8

Class

new ToastUIEditor(options)editor.jsline 137

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)

initialEditType

[ string ]

Initial editor type (markdown, wysiwyg)

events

[ Array ]

eventlist Event list

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

[ Array ]

Hook list

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

codeBlockLanguages

[ Array ]

supported code block languages to be listed. default is what highlight.js supports

usageStatistics

boolean = true

send hostname to google analytics

toolbarItems

[ Array ]

toolbar items.

hideModeSwitch

boolean = false

hide mode switch tab bar

exts

[ Array ]

extensions

customConvertor

[ object ]

convertor extention

placeholder

[ string ]

The placeholder text of the editable element.

previewDelayTime

[ string ]

the delay time for rendering preview

linkAttribute

[ object ]

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

Static Properties

deprecatedButton:

Class.<Button>

editor.jsline 856

Button class

codeBlockManager:

CodeBlockManager

editor.jsline 849

CodeBlockManager instance

i18n:

I18n

editor.jsline 836

I18n instance

isViewer:

boolean

editor.jsline 830

check whther is viewer

markdownit:

MarkdownIt

editor.jsline 896

MarkdownIt instance

markdownitHighlight:

MarkdownIt

editor.jsline 890

MarkdownIt hightlight instance

Static Methods

defineExtension(name, ext)editor.jsline 804

Define extension

PARAMETERS
NameTypeDescription

name

string

Extension name

ext

function

extension

factory(options)editor.jsline 813

Factory method for Editor

PARAMETERS
NameTypeDescription

options

object

Option for initialize TUIEditor

RETURNS:
{

object

} - ToastUIEditor or ToastUIEditorViewer

getInstances()editor.jsline 795

Get instance of TUIEditor

RETURNS:
{

Array

}

Instance Methods

addHook(type, handler)editor.jsline 387

Add hook to TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

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

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 361

After added command.

blur()editor.jsline 426

Remove focus of current Editor

changeMode(mode, isWithoutFocus)editor.jsline 648

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 287

change preview style

PARAMETERS
NameTypeDescription

style

string

'tab'|'vertical'

exec(args)editor.jsline 298

call commandManager's exec method

PARAMETERS
NameTypeDescription

args

focus()editor.jsline 419

Set focus to current Editor

getCodeMirror()editor.jsline 404

Get CodeMirror instance

RETURNS:
{

CodeMirror

}

getCurrentModeEditor()editor.jsline 599

Get current editor mode name

RETURNS:
{

Object

} - MarkdownEditor or WysiwygEditor

getCurrentPreviewStyle()editor.jsline 639

Get current Markdown editor's preview style

RETURNS:
{

string

}

getHtml()editor.jsline 507

Get html syntax text.

RETURNS:
{

string

}

getMarkdown()editor.jsline 491

Get markdown syntax text.

RETURNS:
{

string

}

getRange()editor.jsline 758

Get current range

RETURNS:
{

ObjectRange

}

getSelectedText()editor.jsline 775

get selected text

RETURNS:
{

string

} - selected text

getSquire()editor.jsline 412

Get SquireExt instance

RETURNS:
{

SquireExt

}

getTextObject(range)editor.jsline 767

Get text object of current range

PARAMETERS
NameTypeDescription

range

ObjectRange

Range object of each editor

RETURNS:
{

MdTextObjectWwTextObject

} - TextObject class

getUI()editor.jsline 742

Get _ui property

RETURNS:
{

DefaultUIUI

}

deprecatedgetValue()editor.jsline 520

Get editor value.

RETURNS:
{

string

}

height(height)editor.jsline 552

Set and return edithr height

PARAMETERS
NameTypeDescription

height

string

editor height

RETURNS:
{

string

} - editor height

hide()editor.jsline 709

Hide TUIEditor

insertText(text)editor.jsline 528

Insert text

PARAMETERS
NameTypeDescription

text

string

text string to insert

isMarkdownMode()editor.jsline 615

Return true if current editor mode is Markdown

RETURNS:
{

boolean

}

isViewer()editor.jsline 631

Return false

RETURNS:
{

boolean

}

isWysiwygMode()editor.jsline 623

Return true if current editor mode is WYSIWYG

RETURNS:
{

boolean

}

minHeight(minHeight)editor.jsline 577

Set / Get min content height

PARAMETERS
NameTypeDescription

minHeight

string

min content height in pixel

RETURNS:
{

string

} - min height in pixel

moveCursorToEnd()editor.jsline 433

Set cursor position to end

moveCursorToStart()editor.jsline 440

Set cursor position to start

off(type)editor.jsline 378

Unbind eventHandler from event type

PARAMETERS
NameTypeDescription

type

string

Event type

on(type, handler)editor.jsline 370

Bind eventHandler to event type

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

remove()editor.jsline 681

Remove TUIEditor from document

removeHook(type)editor.jsline 396

Remove hook from TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

reset()editor.jsline 749

Reset TUIEditor

scrollTop(value)editor.jsline 726

Scroll Editor content to Top

PARAMETERS
NameTypeDescription

value

number

Scroll amount

RETURNS:
{

number

}

setHtml(html, cursorToEnd)editor.jsline 466

Set html value.

PARAMETERS
NameTypeDescription

html

string

html syntax text

cursorToEnd

boolean = true

move cursor to contents end

setMarkdown(markdown, cursorToEnd)editor.jsline 449

Set markdown syntax text.

PARAMETERS
NameTypeDescription

markdown

string

markdown syntax text.

cursorToEnd

boolean = true

move cursor to contents end

setPlaceholder(placeholder)editor.jsline 786

Set the placeholder on all editors

PARAMETERS
NameTypeDescription

placeholder

string

placeholder to set

setUI(UI)editor.jsline 734

Set UI to private UI property

PARAMETERS
NameTypeDescription

UI

UI

UI instance

deprecatedsetValue(value, cursorToEnd)editor.jsline 483

Set markdown syntax text.

PARAMETERS
NameTypeDescription

value

string

markdown syntax text

cursorToEnd

boolean = true

move cursor to contents end

show()editor.jsline 716

Show TUIEditor

Resizable