WysiwygEditor

WysiwygEditor

Constructor

new WysiwygEditor($el, eventManager)

Parameters:
Name Type Description
$el jQuery

element to insert editor

eventManager EventManager

EventManager instance

Methods

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

WysiwygEditor factory method

Parameters:
Name Type Description
$el jQuery

Container element for editor

eventManager EventManager

EventManager instance

Returns:
WysiwygEditor -

wysiwygEditor

static MarkdownEditor#init(initialValueopt)

init

Parameters:
Name Type Attributes Description
initialValue string <optional>

Editor's initial content

addKeyEventHandler(keyMap, handler)

addKeyEventHandler
Add key event handler

Parameters:
Name Type Description
keyMap string

keyMap string

handler function

handler

addWidget(range, node, style, offsetopt)

addWidget
Add widget to selection

Parameters:
Name Type Attributes Description
range Range

Range object

node Node

Widget node

style string

Adding style "over" or "bottom"

offset number <optional>

Offset to adjust position

blur()

blur
Remove focus of editor

breakToNewDefaultBlock(range, whereopt)

breakToNewDefaultBlock
Break line to new default block from passed range

Parameters:
Name Type Attributes Description
range Range

Range object

where string <optional>

"before" or not

changeBlockFormatTo(targetTagName)

changeBlockFormatTo
Change current range block format to passed tag

Parameters:
Name Type Description
targetTagName string

Target element tag name

findTextNodeFilter() → {boolean}

findTextNodeFilter

This:
  • Node
Returns:
boolean -

true or not

focus()

focus
Focus to editor

get$Body() → {JQuery}

get$Body
Get jQuery wrapped body container of Squire

Returns:
JQuery -

jquery body

getEditor() → {SquireExt}

getEditor
Get squire

Returns:
SquireExt -

squire

getRange() → {Range}

Get current Range object

Returns:
Range

getTextObject(range) → {WwTextObject}

Get text object of current range

Parameters:
Name Type Description
range Range

Range object

Returns:
WwTextObject

getValue() → {string}

getValue
Get value of wysiwyg editor

Returns:
string -

html

hasFormatWithRx(rx) → {boolean}

hasFormatWithRx
Check with given regexp whether current path has some format or not

Parameters:
Name Type Description
rx RegExp

Regexp

Returns:
boolean -

Match result

init()

init

makeEmptyBlockCurrentSelection()

makeEmptyBlockCurrentSelection
Make empty block to current selection

moveCursorToEnd()

Set cursor position to end

moveCursorToStart()

Set cursor position to start

readySilentChange()

readySilentChange
Ready to silent change

remove()

remove
Remove wysiwyg editor

removeKeyEventHandler(keyMap, handler)

REmove key event handler.

Parameters:
Name Type Description
keyMap string

keyMap string

handler function

handler

replaceContentText(container, from, to)

replaceContentText
Replace textContet of node

Parameters:
Name Type Description
container Node

Container node

from string

Target text to change

to string

Replacement text

replaceRelativeOffset(content, offset, overwriteLength)

replaceRelativeOffset
Replace content by relative offset

Parameters:
Name Type Description
content string

Content for change current selection

offset number

Offset of current range

overwriteLength number

Length to overwrite content

replaceSelection(content, range)

replaceSelection
Replace text of passed range

Parameters:
Name Type Description
content string

Content for change current selection

range Range

range

reset()

reset
Reset wysiwyg editor

restoreSavedSelection()

restoreSavedSelection
Restore saved selection

saveSelection(range)

saveSelection
Save current selection before modification

Parameters:
Name Type Description
range Range

Range object

scrollTop(value) → {boolean}

Set cursor position to start

Parameters:
Name Type Description
value number

Scroll amount

Returns:
boolean

setHeight(height)

setHeight
Set editor height

Parameters:
Name Type Description
height number | string

pixel of height or "auto"

setValue(html)

setValue
Set value to wysiwyg editor

Parameters:
Name Type Description
html string

HTML text

unwrapBlockTag(conditionopt)

unwrapBlockTag
Unwrap Block tag of current range

Parameters:
Name Type Attributes Description
condition function <optional>

iterate with tagName