ToastUIEditor

ToastUIEditor

Constructor

new ToastUIEditor(options, language, useDefaultHTMLSanitizer)

Parameters:
Name Type Description
options object

Option object

Properties
Name Type Description
height number

Editor's height (px)

initialValue string

Editor's initial value

previewStyle string

Markdown editor's preview style (tab, vertical)

initialEditType string

Initial editor type (markdown, wysiwyg)

events object

eventlist Event list

Properties
Name Type Description
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

Hook list

Properties
Name Type Description
previewBeforeHook function

Submit preview to hook URL before preview be shown

addImageBlobHook function

hook for image upload.

language string

language

useDefaultHTMLSanitizer boolean

use default htmlSanitizer

Members

static i18n :I18n

Export i18n instance

static markdownItRenderer

MarkdownIt custom renderer with code highlighting

Methods

static defineExtension(name, ext)

Define extension

Parameters:
Name Type Description
name string

Extension name

ext ExtManager~extension

extension

static factory(options) → {ToastUIEditor}

Factory method for Editor

Parameters:
Name Type Description
options object

Option for initialize TUIEditor

Returns:
ToastUIEditor

static getInstances() → {Array}

Get instance of TUIEditor

Returns:
Array

addHook(type, handler)

Add hook to TUIEditor event

Parameters:
Name Type Description
type string

Event type

handler function

Event handler

addWidget(selection, node, style, offsetopt)

Add widget to selection

Parameters:
Name Type Attributes Description
selection Range

Current selection

node Node

widget node

style string

Adding style "over" or "bottom"

offset number <optional>

Offset for adjust position

afterAddedCommand()

After added command.

blur()

Remove focus of current Editor

changeMode(mode, isWithoutFocus)

Change editor's mode to given mode string

Parameters:
Name Type Description
mode string

Editor mode name of want to change

isWithoutFocus boolean

Change mode without focus

changePreviewStyle(style)

프리뷰가 보여지는 방식을 변경한다

Parameters:
Name Type Description
style string

스타일 이름 tab, vertical

contentHeight(height) → {number}

Set and return content area height

Parameters:
Name Type Description
height number

Content area height

Returns:
number

exec()

call commandManager's exec method

focus()

Set focus to current Editor

getCodeMirror() → {CodeMirror}

Get CodeMirror instance

Returns:
CodeMirror

getCurrentModeEditor() → {string}

Get current editor mode name

Returns:
string

getCurrentPreviewStyle() → {string}

Get current Markdown editor's preview style

Returns:
string

getHtml() → {string}

Get html syntax text.

Returns:
string

getMarkdown() → {string}

Get markdown syntax text.

Returns:
string

getRange() → {Object|Range}

Get current range

Returns:
Object | Range

getSquire() → {SquireExt}

Get SquireExt instance

Returns:
SquireExt

getTextObject(range) → {object}

Get text object of current range

Parameters:
Name Type Description
range Object | Range

Range object of each editor

Returns:
object -

TextObject class

getUI() → {UI}

Get _ui property

Returns:
UI

getValue() → {string}

Get editor value.

Returns:
string
Deprecated:
  • Yes

hide()

Hide TUIEditor

isMarkdownMode() → {boolean}

Return true if current editor mode is Markdown

Returns:
boolean

isViewOnly() → {boolean}

Return false

Returns:
boolean

isWysiwygMode() → {boolean}

Return true if current editor mode is WYSIWYG

Returns:
boolean

moveCursorToEnd()

Set cursor position to end

moveCursorToStart()

Set cursor position to start

off(type)

Unbind eventHandler from event type

Parameters:
Name Type Description
type string

Event type

on(type, handler)

Bind eventHandler to event type

Parameters:
Name Type Description
type string

Event type

handler function

Event handler

remove()

Remove TUIEditor from document

removeHook(type)

Remove hook from TUIEditor event

Parameters:
Name Type Description
type string

Event type

reset()

Reset TUIEditor

scrollTop(value) → {number}

Scroll Editor content to Top

Parameters:
Name Type Description
value number

Scroll amount

Returns:
number

setHtml(html)

Set html value.

Parameters:
Name Type Description
html string

html syntax text

setMarkdown(markdown)

Set markdown syntax text.

Parameters:
Name Type Description
markdown string

markdown syntax text.

setUI(UI)

Set UI to private UI property

Parameters:
Name Type Description
UI UI

UI instance

setValue(value)

Set markdown syntax text.

Parameters:
Name Type Description
value string

markdown syntax text

Deprecated:
  • Yes

show()

Show TUIEditor