logo

/repo|v2.5.0

Class

new WysiwygEditor(el, eventManager, options)wysiwygEditor.jsline 53

Class WysiwygEditor

PARAMETERS
NameTypeDescription

el

HTMLElement

element to insert editor

eventManager

EventManager

EventManager instance

options

= {}

Instance Methods

addKeyEventHandler(keyMap, handler)wysiwygEditor.jsline 124

Add key event handler

PARAMETERS
NameTypeDescription

keyMap

stringArray.<string>

keyMap string or array of string

handler

function

handler

addWidget(range, node, style, offset)wysiwygEditor.jsline 947

Add widget to selection

PARAMETERS
NameTypeDescription

range

Range

Range object

node

Node

Widget node

style

string

Adding style "over" or "bottom"

offset

[ number ]

Offset to adjust position

blur()wysiwygEditor.jsline 739

Remove focus of editor

breakToNewDefaultBlock(range, where)wysiwygEditor.jsline 984

Break line to new default block from passed range

PARAMETERS
NameTypeDescription

range

Range

Range object

where

[ string ]

"before" or not

changeBlockFormatTo(targetTagName)wysiwygEditor.jsline 703

Change current range block format to passed tag

PARAMETERS
NameTypeDescription

targetTagName

string

Target element tag name

fixIMERange()wysiwygEditor.jsline 1141

get IME range
cjk composition causes wrong caret position.
it sets fixed IME composition range

focus()wysiwygEditor.jsline 724

Focus to editor

getBody()wysiwygEditor.jsline 964

Get body container of Squire

RETURNS:
{

HTMLElement

} - body element

getEditor()wysiwygEditor.jsline 917

Get squire

RETURNS:
{

SquireExt

} - squire

getIMERange()wysiwygEditor.jsline 1125

get IME range
cjk composition causes wrong caret position.
it returns fixed IME composition range

RETURNS:
{

Range

}

getLinkAttribute()wysiwygEditor.jsline 803

Get attribute of link for wysiwyg

RETURNS:
{

object

} - attribute - attribute of anchor tag

getRange()wysiwygEditor.jsline 1113

Get current Range object

RETURNS:
{

Range

}

getTextObject(range)wysiwygEditor.jsline 1183

Get text object of current range

PARAMETERS
NameTypeDescription

range

Range

Range object

RETURNS:
{

WwTextObject

}

getValue()wysiwygEditor.jsline 842

Get value of wysiwyg editor

RETURNS:
{

string

} - html

hasFormatWithRx(rx)wysiwygEditor.jsline 973

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

PARAMETERS
NameTypeDescription

rx

RegExp

Regexp

RETURNS:
{

boolean

} - Match result

insertText(text)wysiwygEditor.jsline 834

Insert given text to cursor position or selected area

PARAMETERS
NameTypeDescription

text

string

text string to insert

isInTable(range)wysiwygEditor.jsline 1172

Check whether passed range is in table or not

PARAMETERS
NameTypeDescription

range

Range

range

RETURNS:
{

boolean

} - result

makeEmptyBlockCurrentSelection()wysiwygEditor.jsline 711

Make empty block to current selection

moveCursorToEnd()wysiwygEditor.jsline 1051

Set cursor position to end

moveCursorToStart()wysiwygEditor.jsline 1060

Set cursor position to start

postProcessForChange()wysiwygEditor.jsline 894

postProcessForChange

readySilentChange()wysiwygEditor.jsline 907

Ready to silent change

remove()wysiwygEditor.jsline 746

Remove wysiwyg editor

removeKeyEventHandler(keyMap, handler)wysiwygEditor.jsline 147

Remove key event handler.

PARAMETERS
NameTypeDescription

keyMap

string

keyMap string

handler

function

handler

replaceContentText(container, from, to)wysiwygEditor.jsline 1008

Replace textContet of node

PARAMETERS
NameTypeDescription

container

Node

Container node

from

string

Target text to change

to

string

Replacement text

replaceRelativeOffset(content, offset, overwriteLength)wysiwygEditor.jsline 936

Replace content by relative offset

PARAMETERS
NameTypeDescription

content

string

Content for change current selection

offset

number

Offset of current range

overwriteLength

number

Length to overwrite content

replaceSelection(content, range)wysiwygEditor.jsline 926

Replace text of passed range

PARAMETERS
NameTypeDescription

content

string

Content for change current selection

range

Range

range

reset()wysiwygEditor.jsline 695

Reset wysiwyg editor

restoreSavedSelection()wysiwygEditor.jsline 688

Restore saved selection

saveSelection(range)wysiwygEditor.jsline 658

Save current selection before modification

PARAMETERS
NameTypeDescription

range

Range

Range object

scrollIntoCursor()wysiwygEditor.jsline 1033

move scroll to cursor
scrollIntoView browser function may cause scrolling on document.
this function aims to replace scrollIntoView function to prevent that.
it will move the scroll of squire only.

scrollTop(value)wysiwygEditor.jsline 1070

Set cursor position to start

PARAMETERS
NameTypeDescription

value

number

Scroll amount

RETURNS:
{

number

} - value of scrollTop

setHeight(height)wysiwygEditor.jsline 758

Set editor height

PARAMETERS
NameTypeDescription

height

numberstring

pixel of height or "auto"

setMinHeight(minHeight)wysiwygEditor.jsline 781

Set min height

PARAMETERS
NameTypeDescription

minHeight

number

min height in px

setPlaceholder(placeholder)wysiwygEditor.jsline 791

Set the placeholder to wysiwyg editor

PARAMETERS
NameTypeDescription

placeholder

string

placeholder to set

setRange(range)wysiwygEditor.jsline 1163

set range

PARAMETERS
NameTypeDescription

range

Range

range to set

setSelectionByContainerAndOffset(startContainer, startOffset, endContainer, endOffset)wysiwygEditor.jsline 674

set selection by start/end container/offset

PARAMETERS
NameTypeDescription

startContainer

HTMLNode

start container

startOffset

Number

start offset

endContainer

HTMLNode

end container

endOffset

Number

end offset

RETURNS:
{

Range

} - range instance

setValue(html, cursorToEnd)wysiwygEditor.jsline 812

Set value to wysiwyg editor

PARAMETERS
NameTypeDescription

html

string

HTML text

cursorToEnd

boolean = true

move cursor to contents end

unwrapBlockTag(condition)wysiwygEditor.jsline 1018

Unwrap Block tag of current range

PARAMETERS
NameTypeDescription

condition

[ function ]

iterate with tagName

Resizable