logo

/repo|v1.4.10

Class

new ToastUIEditor(options)editor.jsline 138

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 857

Button class

codeBlockManager:

CodeBlockManager

editor.jsline 850

CodeBlockManager instance

i18n:

I18n

editor.jsline 837

I18n instance

isViewer:

boolean

editor.jsline 831

check whther is viewer

markdownit:

MarkdownIt

editor.jsline 897

MarkdownIt instance

markdownitHighlight:

MarkdownIt

editor.jsline 891

MarkdownIt hightlight instance

Static Methods

defineExtension(name, ext)editor.jsline 805

Define extension

PARAMETERS
NameTypeDescription

name

string

Extension name

ext

function

extension

factory(options)editor.jsline 814

Factory method for Editor

PARAMETERS
NameTypeDescription

options

object

Option for initialize TUIEditor

RETURNS:
{

object

} - ToastUIEditor or ToastUIEditorViewer

getInstances()editor.jsline 796

Get instance of TUIEditor

RETURNS:
{

Array

}

Instance Methods

addHook(type, handler)editor.jsline 388

Add hook to TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

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

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 362

After added command.

blur()editor.jsline 427

Remove focus of current Editor

changeMode(mode, isWithoutFocus)editor.jsline 649

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 288

change preview style

PARAMETERS
NameTypeDescription

style

string

'tab'|'vertical'

exec(args)editor.jsline 299

call commandManager's exec method

PARAMETERS
NameTypeDescription

args

focus()editor.jsline 420

Set focus to current Editor

getCodeMirror()editor.jsline 405

Get CodeMirror instance

RETURNS:
{

CodeMirror

}

getCurrentModeEditor()editor.jsline 600

Get current editor mode name

RETURNS:
{

Object

} - MarkdownEditor or WysiwygEditor

getCurrentPreviewStyle()editor.jsline 640

Get current Markdown editor's preview style

RETURNS:
{

string

}

getHtml()editor.jsline 508

Get html syntax text.

RETURNS:
{

string

}

getMarkdown()editor.jsline 492

Get markdown syntax text.

RETURNS:
{

string

}

getRange()editor.jsline 759

Get current range

RETURNS:
{

ObjectRange

}

getSelectedText()editor.jsline 776

get selected text

RETURNS:
{

string

} - selected text

getSquire()editor.jsline 413

Get SquireExt instance

RETURNS:
{

SquireExt

}

getTextObject(range)editor.jsline 768

Get text object of current range

PARAMETERS
NameTypeDescription

range

ObjectRange

Range object of each editor

RETURNS:
{

MdTextObjectWwTextObject

} - TextObject class

getUI()editor.jsline 743

Get _ui property

RETURNS:
{

DefaultUIUI

}

deprecatedgetValue()editor.jsline 521

Get editor value.

RETURNS:
{

string

}

height(height)editor.jsline 553

Set and return edithr height

PARAMETERS
NameTypeDescription

height

string

editor height

RETURNS:
{

string

} - editor height

hide()editor.jsline 710

Hide TUIEditor

insertText(text)editor.jsline 529

Insert text

PARAMETERS
NameTypeDescription

text

string

text string to insert

isMarkdownMode()editor.jsline 616

Return true if current editor mode is Markdown

RETURNS:
{

boolean

}

isViewer()editor.jsline 632

Return false

RETURNS:
{

boolean

}

isWysiwygMode()editor.jsline 624

Return true if current editor mode is WYSIWYG

RETURNS:
{

boolean

}

minHeight(minHeight)editor.jsline 578

Set / Get min content height

PARAMETERS
NameTypeDescription

minHeight

string

min content height in pixel

RETURNS:
{

string

} - min height in pixel

moveCursorToEnd()editor.jsline 434

Set cursor position to end

moveCursorToStart()editor.jsline 441

Set cursor position to start

off(type)editor.jsline 379

Unbind eventHandler from event type

PARAMETERS
NameTypeDescription

type

string

Event type

on(type, handler)editor.jsline 371

Bind eventHandler to event type

PARAMETERS
NameTypeDescription

type

string

Event type

handler

function

Event handler

remove()editor.jsline 682

Remove TUIEditor from document

removeHook(type)editor.jsline 397

Remove hook from TUIEditor event

PARAMETERS
NameTypeDescription

type

string

Event type

reset()editor.jsline 750

Reset TUIEditor

scrollTop(value)editor.jsline 727

Scroll Editor content to Top

PARAMETERS
NameTypeDescription

value

number

Scroll amount

RETURNS:
{

number

}

setHtml(html, cursorToEnd)editor.jsline 467

Set html value.

PARAMETERS
NameTypeDescription

html

string

html syntax text

cursorToEnd

boolean = true

move cursor to contents end

setMarkdown(markdown, cursorToEnd)editor.jsline 450

Set markdown syntax text.

PARAMETERS
NameTypeDescription

markdown

string

markdown syntax text.

cursorToEnd

boolean = true

move cursor to contents end

setPlaceholder(placeholder)editor.jsline 787

Set the placeholder on all editors

PARAMETERS
NameTypeDescription

placeholder

string

placeholder to set

setUI(UI)editor.jsline 735

Set UI to private UI property

PARAMETERS
NameTypeDescription

UI

UI

UI instance

deprecatedsetValue(value, cursorToEnd)editor.jsline 484

Set markdown syntax text.

PARAMETERS
NameTypeDescription

value

string

markdown syntax text

cursorToEnd

boolean = true

move cursor to contents end

show()editor.jsline 717

Show TUIEditor

Resizable