MarkdownEditor

MarkdownEditor

Constructor

new MarkdownEditor($el, eventManager)

Parameters:
Name Type Description
$el jQuery

element to insert editor

eventManager EventManager

EventManager instance

Methods

static factory($el, eventManager) → {MarkdownEditor}

MarkdownEditor factory method

Parameters:
Name Type Description
$el jQuery

Container element for editor

eventManager EventManager

EventManager instance

Returns:
MarkdownEditor -

MarkdownEditor

addWidget(selection, node, style, offset)

Add widget

Parameters:
Name Type Description
selection object

Selection object

node HTMLElement

Widget node

style string

Adding style "over" or "bottom"

offset number

Adding offset

blur()

Set focus to current Editor

focus()

Set focus to current Editor

getCaretPosition() → {Object}

Get current caret position

Returns:
Object

getCurrentRange() → {object}

getCurrentRange
returns current selection's range

Returns:
object -

selection range

getEditor() → {CodeMirror}

Get CodeMirror instance

Returns:
CodeMirror

getRange() → {Object}

Get start, end position of current selection

Returns:
Object

getTextObject(range) → {object}

Get text object of current range

Parameters:
Name Type Description
range Object

Range object of each editor

Returns:
object

getValue() → {string}

Get editor value

Returns:
string

moveCursorToEnd()

Set cursor position to end

moveCursorToStart()

Set cursor position to start

remove()

Remove Editor from document

replaceRelativeOffset(content, offset, overwriteLength)

Replace selection with replacement content and offset

Parameters:
Name Type Description
content string

Replacement content text

offset number

Offset

overwriteLength number

Length to overwrite

replaceSelection(content, selection)

Replace selection with given replacement content

Parameters:
Name Type Description
content string

Replacement content text

selection object

Selection object

reset()

Reset Editor

scrollTop(value) → {number}

Scroll Editor content to Top

Parameters:
Name Type Description
value number

Scroll amount

Returns:
number

setHeight(height)

Set Editor height

Parameters:
Name Type Description
height number

Editor height

setValue(markdown)

Set Editor value

Parameters:
Name Type Description
markdown string

Markdown syntax text