Members
zeroWidthSpace
Unicode Character 'ZERO WIDTH SPACE' (U+200B)
Methods
onlyZeroWidthSpace(text) → {Boolean}
A method that checks If the text is blank or to see if it contains only Unicode 'ZERO WIDTH SPACE' (\u200B)
Parameters:
Name | Type | Description |
---|---|---|
text |
String|Node | String value or Node |
getXMLHttpRequest() → {Object}
Gets XMLHttpRequest object
createElement(elementName) → {Element}
Create Element node
Parameters:
Name | Type | Description |
---|---|---|
elementName |
String | Element name |
createTextNode(text) → {Node}
Create text node
Parameters:
Name | Type | Description |
---|---|---|
text |
String | Text contents |
getIncludePath(nameArray, extension) → {String}
Get the the tag path of the arguments value
If not found, return the first found value
If not found, return the first found value
Parameters:
Name | Type | Description |
---|---|---|
nameArray |
Array | File name array |
extension |
String | js, css |
getPageStyle() → {String}
Returns the CSS text that has been applied to the current page.
convertContentsForEditor(contents) → {String}
Converts contents into a format that can be placed in an editor.
Parameters:
Name | Type | Description |
---|---|---|
contents |
String | Contents |
convertHTMLForCodeView(wysiwygDiv) → {String}
Converts wysiwyg area element into a format that can be placed in an editor of code view mode
Parameters:
Name | Type | Description |
---|---|---|
wysiwygDiv |
Element | WYSIWYG element (context.element.wysiwyg) |
isWysiwygDiv(element) → {Boolean}
It is judged whether it is the edit region top div element or iframe's body tag.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element to check |
isFormatElement(element) → {Boolean}
It is judged whether it is the format element. (P, DIV, H1-6, LI, TH, TD)
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element to check |
isRangeFormatElement(element) → {Boolean}
It is judged whether it is the range format element. (BLOCKQUOTE, OL, UL, PRE, FIGCAPTION, TABLE, THEAD, TBODY, TR, TH, TD)
Range format element is wrap the format element (P, DIV, H1-6, LI)
Range format element is wrap the format element (P, DIV, H1-6, LI)
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element to check |
isComponent(element) → {Boolean}
It is judged whether it is the component(img, iframe cover, table, hr) element - ".kothing-editor-id-comp"
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element to check |
getFormatElement(element, validation) → {Element}
If a parent node that contains an argument node finds a format node (P, DIV, H[1-6], LI), it returns that node.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Reference element if null or no value, it is relative to the current focus node. |
validation |
Function|null | Additional validation function. |
getRangeFormatElement(element, validation) → {Element|null}
If a parent node that contains an argument node finds a format node (BLOCKQUOTE, TABLE, TH, TD, OL, UL, PRE), it returns that node.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Reference element if null or no value, it is relative to the current focus node. |
validation |
Function|null | Additional validation function. |
getArrayIndex(array, element) → {Number}
Get the index of the argument value in the element array
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | element array |
element |
Element | Element to find index |
nextIdx(array, element) → {Number}
Get the next index of the argument value in the element array
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | element array |
item |
Element | Element to find index |
prevIdx(array, element) → {Number}
Get the previous index of the argument value in the element array
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | element array |
element |
Element | Element to find index |
getPositionIndex(node) → {Number}
Returns the index compared to other sibling nodes.
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | Node to find index |
getNodePath(node, parentNode) → {Array}
Returns the position of the "node" in the "parentNode" in a numerical array.
ex) <p><span>aa</span><span>bb</span></p> : (node: "bb", parentNode: "<P>") → [1, 0]
ex) <p><span>aa</span><span>bb</span></p> : (node: "bb", parentNode: "<P>") → [1, 0]
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | The Node to find position path |
parentNode |
Element|null | Parent node. If null, wysiwyg div area |
getNodeFromPath(node, parentNode) → {Array}
Returns the node in the location of the path array obtained from "util.getNodePath".
Parameters:
Name | Type | Description |
---|---|---|
offsets |
Array | Position array, array obtained from "util.getNodePath" |
parentNode |
Element | Base parent element |
isList(node) → {Boolean}
Check the node is a list (ol, ul)
Parameters:
Name | Type | Description |
---|---|---|
node |
Element|String | The element or element name to check |
isListCell(node) → {Boolean}
Check the node is a list cell (li)
Parameters:
Name | Type | Description |
---|---|---|
node |
Element|String | The element or element name to check |
isTable(node) → {Boolean}
Check the node is a list table (table, thead, tbody, tr, th, td)
Parameters:
Name | Type | Description |
---|---|---|
node |
Element|String | The element or element name to check |
isCell(node) → {Boolean}
Check the node is a table cell (td, th)
Parameters:
Name | Type | Description |
---|---|---|
node |
Element|String | The element or element name to check |
isBreak(node) → {Boolean}
Check the node is a break node (BR)
Parameters:
Name | Type | Description |
---|---|---|
node |
Element|String | The element or element name to check |
getListChildren(element, validation) → {Array}
Get all child nodes of the argument value element (Without text node)
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | element to get child node |
validation |
function | null | Conditional function |
getListChildNodes(element, validation) → {Array}
Get all child nodes of the argument value element (Include text nodes)
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | element to get child node |
validation |
function | null | Conditional function |
getElementDepth(element) → {Number}
Returns the number of parents nodes.
"0" when the parent node is the WYSIWYG area.
"0" when the parent node is the WYSIWYG area.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The element to check |
getParentElement(element, query) → {Element}
Get the parent element of the argument value.
A tag that satisfies the query condition is imported.
Returns null if not found.
A tag that satisfies the query condition is imported.
Returns null if not found.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Reference element |
query |
String | Function | Query String (nodeName, .className, #ID, :name) or validation function. Not use it like jquery. Only one condition can be entered at a time. |
getChildElement(element, query, last) → {Element}
Get the parent child of the argument value.
A tag that satisfies the query condition is imported.
Returns null if not found.
A tag that satisfies the query condition is imported.
Returns null if not found.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Reference element |
query |
String | Function | Query String (nodeName, .className, #ID, :name) or validation function. Not use it like jquery. Only one condition can be entered at a time. |
last |
Boolean | If true returns the last node among the found child nodes. (default: first node) |
getEdgeChildNodes(first, last) → {Object}
1. The first node of all the child nodes of the "first" element is returned.
2. The last node of all the child nodes of the "last" element is returned.
3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
{ sc: "first", ec: "last" }
2. The last node of all the child nodes of the "last" element is returned.
3. When there is no "last" element, the first and last nodes of all the children of the "first" element are returned.
{ sc: "first", ec: "last" }
Parameters:
Name | Type | Description |
---|---|---|
first |
Element | First element |
last |
Element | null | Last element |
getOffset(element, wysiwygFrame) → {Object}
Returns the position of the left and top of argument.
{left:0, top:0}
{left:0, top:0}
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Element node |
wysiwygFrame |
Element|null | When use iframe option, iframe object should be sent (context.element.wysiwygFrame) |
getOverlapRangeAtIndex(aStart, aEnd, bStart, bEnd) → {Number}
It compares the start and end indexes of "a" and "b" and returns the number of overlapping indexes in the range.
ex) 1, 5, 4, 6 => 2 (4 ~ 5)
ex) 1, 5, 4, 6 => 2 (4 ~ 5)
Parameters:
Name | Type | Description |
---|---|---|
aStart |
Number | Start index of "a" |
aEnd |
Number | End index of "a" |
bStart |
Number | Start index of "b" |
bEnd |
Number | End index of "b" |
changeTxt(element, txt)
Set the text content value of the argument value element
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Elements to replace text content |
txt |
String | Text to be applied |
hasClass(element, className) → {Boolean}
Determine whether any of the matched elements are assigned the given class
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Elements to search class name |
className |
String | Class name to search for |
addClass(element, className)
Append the className value of the argument value element
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Element to add class name |
className |
String | Class name to be add |
removeClass(element, className)
Delete the className value of the argument value element
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Elements to remove class name |
className |
String | Class name to be remove |
toggleClass(element, className)
Argument value If there is no class name, insert it and delete the class name if it exists
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Elements to replace class name |
className |
String | Class name to be change |
removeItem(item)
Delete argumenu value element
Parameters:
Name | Type | Description |
---|---|---|
item |
Element | Element to be remove |
removeItemAllParents(item, validation) → {Object|null}
Delete all parent nodes that match the condition.
Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
Returns an {sc: previousSibling, ec: nextSibling}(the deleted node reference) or null.
Parameters:
Name | Type | Description |
---|---|---|
item |
Element | Element to be remove |
validation |
Function|null | Validation function. default(Deleted if it only have breakLine and blanks) |
removeEmptyNode(element)
Delete a empty child node of argument element
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Element node |
isIgnoreNodeChange(element) → {Boolean}
Nodes that need to be added without modification when changing text nodes !(span|font|b|strong|var|i|em|u|ins|s|strike|del|sub|sup|mark)
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | Element to check |
cleanHTML(html) → {String}
Gets the clean HTML code for editor
Parameters:
Name | Type | Description |
---|---|---|
html |
String | HTML string |