Variable
-
-
The unique global variable is also the namespace of the program.
-
Data Type: Object
-
The version information of the editor.
-
Data Type: String
-
The Chinese information of the editor.
-
Data Type: Object
-
Kindeditor. js path.
-
Data Type: String
-
The HTML page path of the editor.
-
Data Type: String
-
Note: Version 3.4 is obsolete.
-
Browser type and VERSION, which are KE. browser. VERSION, KE. browser. IE, KE. browser. WEBKIT, KE. browser. GECKO, And KE. browser. OPERA.
-
Data Type: Object
-
Note: strings earlier than version 3.4 are directly returned, which are "IE", "WEBKIT", "GECKO", and "OPERA ".
-
Editor initialization attributes and other configurations.
-
Data Type: Object
-
The variable set of an Editor contains all the attributes of the editor. In addition, it contains the following variables, which are often expressed by KE. g [id.
-
For example, KE. g ["content_1"]. iframeDoc indicates the iframe document Object of the editor whose id is "content_1.
-
Data Type: Object
-
Main variables:
-
- Container: The External element Object of the editor.
- Iframe: the iframe object of the editing area.
- IframeWin: the iframe window object of the editing area.
- IframeDoc: Specifies the iframe document object in the editing area.
- KeSel: the KE. selection object of the selected information.
- KeRange: the KE. range object of the selected information.
- Sel: Native browser selection object of the selected information.
- Range: the native range object of the browser for the selected information.
- LayoutDiv: The div object of the pop-up layer of the editor. Version 3.4 has been deprecated.
- HideDiv: the parent div object in the pop-up layer of the editor.
- Dialog: iframe object in the pop-up window. Version 3.4 has been deprecated.
- YesButton: the input object of the OK button in the pop-up window.
- NoButton: The cancel button input object in the pop-up window.
- PreviewButton: the input object of the preview button in the pop-up window.
- MaskDiv: The div object of the gray mask layer in the pop-up window.
- UndoStack: undo record of undo/redo.
- RedoStack: redo record of undo/redo.
-
Define the editor plug-in.
-
Data Type: Object
Function
-
-
Get the alias of the element Object doc. getElementById.
-
Parameters:
-
Id: String, element id
-
Doc: Object, the document Object where element is located. It is an optional parameter and the default value is document.
-
Return Value:
-
Object, element Object
-
Create an element object, the alias of doc. createElement.
-
Parameters:
-
Name: String, the tag name of the element
-
Doc: Object, the document Object where element is located. It is an optional parameter and the default value is document.
-
Return Value:
-
Object, element Object
- 3. KE. event. add (el, event, listener)
-
Add an event.
-
Parameters:
-
El: Object: The element Object of the event to be added.
-
Event: String, event name. You can set "click", "change", and "mousedown.
-
Listener: Function, callback Function for event processing.
-
Return Value: None
- 4. KE. event. remove (el, event, listener)
-
Delete an added event.
-
Parameters:
-
El: Object: The element Object of the event to be added.
-
Event: String, event name. You can set "click", "change", and "mousedown.
-
Listener: Function, callback Function for event processing.
-
Return Value: None
- 5. KE. event. input (el, func)
-
Add an editor input event.
-
Parameters:
-
El: Object: The element Object of the event to be added.
-
Func: Function. This Function is called when the editor inputs content.
-
Return Value: None
- 6. KE. event. ctrl (el, key, func)
-
Add a Ctrl + [?] Event.
-
Parameters:
-
El: Object: The element Object of the event to be added.
-
Key: String, Ctrl key combination letter, supports A to Z.
-
Func: Function. Press Ctrl + [?]. This function is called.
-
Return Value: None
- 7. KE. event. ready (func)
-
Add the DOMContentLoaded event of a document.
-
Parameters:
-
Func: Function. This Function is called after the DOM is loaded.
-
Return Value: None
-
Traverses an object.
-
Parameters:
-
Obj: Object. The object to be traversed.
-
Func: Function. This Function is called in a loop. The parameter is the key and value of the object.
-
Return Value: None
- 9. KE. eachNode (node, func)
-
Traverse a node.
-
Parameters:
-
Node: Object, the parent node to be traversed
-
Func: Function. This Function is called in a loop. The parameter is node.
-
Return Value: None
- 10. KE. format. getHtml (html, htmlTags)
-
Converts HTML to XHTML. When the htmlTags parameter is specified, HTML tags are filtered according to the htmlTags rule.
-
Parameters:
-
Html: String, HTML text
-
HtmlTags: Object, Filtering Rule, optional parameter.
-
Return Value:
-
String, XHTML text
- 11. KE. util. getDocumentElement ()
-
Obtain the document element Object.
-
Parameter: None
-
Return Value:
-
Object, element Object
- 12. KE. util. getDocumentWidth ()
-
Obtain the width of the current page.
-
Parameter: None
-
Return Value:
-
Int, document width
- 13. KE. util. getincluentheight ()
-
Obtain the height of the current page.
-
Parameter: None
-
Return Value:
-
Int, document height
- 14. KE. util. loadStyle (path)
-
Load a CSS file on the current page.
-
Parameters:
-
Path: String, the URL path of the CSS file
-
Return Value: None
- 15. KE. util. inArray (str, arr)
-
Checks whether a string is in an array.
-
Parameters:
-
Str: String
-
Arr: Array
-
Return Value:
-
Boolean, returns true in the array, and false in the array.
-
Removes spaces on both sides of a string.
-
Parameters:
-
Str: String
-
Return Value: String
- 17. KE. util. getJsKey (key)
-
Convert the CSS name in the HTML style to the JavaScript attribute name. For example, KE. util. getJsKey ("font-size") returns "fontSize ".
-
Parameters:
-
Key: String
-
Return Value: String
- 18. KE. util. escape (html)
-
Convert special characters in HTML.
-
Parameters:
-
HTML: String, HTML text
-
Return Value: String
- 19. KE. util. getElementPos (el)
-
Obtains the coordinates of the specified element.
-
Parameters:
-
El: object, Element Object
-
Returned value: Object
- 20. KE. util. getCoords (ev)
-
Get the mouse coordinates.
-
Parameters:
-
Ev: object, event object
-
Returned value: Object
- 21. KE. util. setOpacity (el, opacity)
-
Sets the transparency of the element.
-
Parameters:
-
El: object, Element Object
-
Opacity: int, transparency. It can be a number ranging from 0 to 100.
-
Return Value: None
- 22. KE. util. getIframeDoc (iframe)
-
Obtain the IFRAME Document Object.
-
Parameters:
-
IFRAME: object, IFRAME object
-
Returned value: Object
- 23. KE. util. rgbToHex (str)
-
Converts an RGB color to a hexadecimal color.
-
Parameters:
-
STR: String, RGB Color Mark
-
Return Value: String
- 24. KE. util. createRange (doc)
-
Creates the range of the specified document.
-
Parameters:
-
DOC: object, Document Object
-
Returned value: object, range object
- 25. KE. util. getFullHtml (id, tagLineMode)
-
Obtains the initialization HTML text of the IFRAME editor.
-
Parameters:
-
ID: String, Editor ID
-
TagLineMode: Boolean. If it is true, the outline of the module tag is displayed.
-
Return Value: String
- 26. KE. util. getData (id)
-
Obtain the HTML content of the editor.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: String
- 27. KE. util. getSrcData (id)
-
Obtain the native HTML content of the editor, that is, the HTML directly returned by innerHTML.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: String
- 28. KE. util. getPureData (id)
-
Obtain the plain text content of the editor, excluding HTML tags. Version 3.4 starts to contain the img and embed labels.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: String
- 29. KE. util. setData (id)
-
Set the content of the editor to the original TEXTAREA control.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: None
-
Move the focus to the editor.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: None
- 31. KE. util. selection (id)
-
Set the selected information to KE. g [id]. sel, KE. g [id]. range, KE. g [id]. keSel, KE. g [id]. keRange.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: None
- 32. KE. util. select (id)
-
Reselect range, which is only valid for IE.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: None
-
The BR tag is generated when you press the Enter key, which is only valid for IE.
-
Parameters:
-
Id: String, Editor ID
-
Return Value: None
-
Note: Version 3.4 is obsolete.
- 34. KE.util.exe cCommand (id, cmd, value)
-
Execute the Command provided by the browser. For details, refer to document.exe cCommand in the browser API.
-
Parameters:
-
Id: String, Editor ID
-
Cmd: String, cmd parameter in execCommand of the browser
-
Value: String, the value parameter in the browser execCommand
-
Return Value: None
- 35. KE. util. insertHtml (id, html)
-
Insert HTML content to the cursor in the editing area.
-
Parameters:
-
Id: String, Editor ID
-
Html: String, HTML content
-
Return Value: None
-
Note: You must run KE before executing this function. util. selection (id), because you need to set KE first. g [id]. sel and KE. g [id]. range.
- 36. KE. create (id, mode)
-
Create an editor.
-
Parameters:
-
Id: String, Editor ID
-
Mode: Int. An optional parameter. If the parameter is set to 1, an editor is created under the body. If the parameter is set to 0 or unspecified, an editor is created before TEXTAREA.
-
Return Value: None
- 37. KE. remove (id, mode)
-
Remove the editor.
-
Parameters:
-
Id: String, Editor ID
-
Mode: Int. It is an optional parameter. If it is set to 1, the editor in the body is removed. If it is set to 0 or unspecified, the editor in front of TEXTAREA is removed.
-
Return Value: None
-
Set Editor initialization parameters.
-
Parameters:
-
Config: Object: A hash array of the editor attributes. For details, refer to editor attributes.
-
Return Value: None
-
Initialize and create an editor. When executing this function, call KE. init to set initialization parameters, and then run KE. create after DOM loading is complete.
-
Parameters:
-
Config: Object: A hash array of the editor attributes. For details, refer to editor attributes.
-
Return Value: None
Class
-
- 1. KE. selection (win, doc)
-
KindEditor selection class to get or set the range of the selected part.
-
Parameters:
-
Win: Object, window Object
-
Oc: Object, document Object
-
Member variables:
-
- Sel: Object, browser native selection Object
- Range: Object, which is the native range Object of the current selection browser.
- KeRange: Object, the KindEditor range Object of the current selection. See KE. range.
-
Method:
-
- AddRange (keRange): sets the current selection.
- Focus (): Select again, only valid for IE.
-
KindEditor's range class provides a unified range interface for various browsers.
-
Parameters:
-
Doc: Object, document Object
-
Member variables:
-
- StartNode: Object, Start Node
- StartPos: Int, Start Node location
- EndNode: Object, End Node
- EndPos: Int, End Node location
-
Method:
-
- GetParentElement (): returns the parent element containing range.
- GetNodeList (): return the node list in the range.
- ComparePoints (how, range): compare two keRange positions. You can set "START_TO_START", "START_TO_END", "END_TO_START", "END_TO_END ".
- SetStart (node, pos): Set the Start node and position of the range.
- SetEnd (node, pos): set the end node and position of the range.
- SelectNode (node): Set the node to range. The Start node and end node are both nodes.
- ExtractContents (): extract the content of range.
- CloneContents (): copy the content of range.
- GetText (): Get the plain text content of range.
-
KindEditor command class, similar to execCommand.
-
Parameters:
-
Id: String, Editor ID
-
Member variables:
-
- Doc: Object: The iframe document Object of the editor.
- KeSel: Int, KindEditor selection object
- KeRange: Object, the KindEditor range Object of the current selection
-
Method:
-
- Wrap (tagName, attributes): Specifies the selected text of the tag package. Currently, only the inline tag is supported. TagName is the tag name, and attributes is the tag attribute array.
- Remove (tags): Clear the specified tag and attribute in the selected text. Tags: the tags and attributes you want to delete.
|