"Reprint" Kindeditor API, Kindeditor user manual, Kindeditor function, kindeditor use, super large collection

Source: Internet
Author: User

variables
    • 1. KE
The
only global variable is the namespace of the program.
data type: Object
    • 2. Ke.version
version information for the editor.
data type: String
    • 3. Ke.lang
The Chinese information for the editor.
data type: Object
    • 4. Ke.scriptpath
The path of the kindeditor.js.
data type: String
    • 5. Ke.htmlpath
the HTML page path of the editor.
data type: String
Note: Version 3.4 is deprecated.
    • 6. Ke.browser
Browser type and version, respectively KE.browser.VERSION, KE.browser.IE, KE.browser.WEBKIT, KE.browser.GECKO, KE.browser.OPERA.
data type: Object
Note: 3.4 The previous version returns strings directly, IE, WEBKIT, GECKO, OPERA, respectively.
    • 7. ke.setting
The initialization properties and other configurations of the editor.
data type: Object
    • 8. ke.g
A set of variables for an editor that contains all editor properties, and also contains the following variables, often expressed in ke.g[id].
For example: ke.g["Content_1"].iframedoc an IFrame Document object that represents an editor with an ID of "content_1".
Data type: Object
Primary variable:
  • Container: External element object of the editor.
  • iframe: An IFrame object that edits a region.
  • Iframewin: The IFrame Window object of the editing area.
  • Iframedoc: The IFrame Document object for the editing area.
  • Kesel: The Ke.selection object for the currently selected information.
  • Kerange: The Ke.range object for the currently selected information.
  • SEL: The browser-Native Selection object for the currently selected information.
  • Range: The browser-native Range object for the currently selected information.
  • Layoutdiv: The div object for the editor pop-up layer. Version 3.4 is obsolete.
  • Hidediv: The parent div object of the editor pop-up layer.
  • dialog: The IFrame object for the popup window. Version 3.4 is obsolete.
  • Yesbutton: The OK button of the popup window input object.
  • Nobutton: The Cancel button of the popup window input object.
  • Previewbutton: The preview button of the popup window input object.
  • Maskdiv: The div object for the gray matte layer when the popup window appears. The undo record for the
  • Undostack:undo/redo. The redo record for the
  • Redostack:undo/redo.
    • 9. Ke.plugin
defines the plug-in for the editor.
data type: Object

function
    • 1. ke.$ (ID, doc)
Gets the element object, Doc.getelementbyid alias.
parameter:
id:string,element ID
doc:object,element the Document object, which is an optional parameter and the default value is document.
return value:
object,element Object
    • 2. ke.$$ (name, doc)
creates an element object, Doc.createelement alias.
Parameters:
name:string,element's tag name
doc:object,element The Document object, which is an optional parameter, and the default value is docu ment.
return value:
object,element Object
    • 3. KE.event.add (El, event, listener)
Add an event.
Parameters:
el:object, to add an element object of the event
event:string, event name, you can set "click", "Change", "MouseDown" and so on.
Listener:function, the event handler callback function.
return value: None
    • 4. KE.event.remove (El, event, listener)
Deletes an event that has been added.
Parameters:
el:object, to add an element object of the event
event:string, event name, you can set "click", "Change", "MouseDown such as
Listener:function, the event handler callback function.
return value: None
    • 5. KE.event.input (EL, func)
Adds an editor input event.
parameter:
el:object, which is called when the editor enters content
to add an element object
func:function the event.
return value: None
    • 6. KE.event.ctrl (EL, Key, Func)
Add a ctrl+[?] Event.
parameter:
el:object, to add an element object of the event
Key:string,ctrl The letter of the key combination, supports A to Z.
func:function, press ctrl+[?] This function is called when the
return value: None
    • 7. KE.event.ready (func)
adds a document for the domcontentloaded event.
parameter:
func:function,dom The function is called after loading is complete.
return value: None
    • 8. Ke.each (obj, func)
iterates over an object.
Parameters:
Obj:object, the object to traverse
func:function, call this function when looping, parameter is the key and value of object.
return value: None
    • 9. Ke.eachnode (node, func)
traverse a node.
parameter:
node:object, the parent node func:function to traverse
,
call this function when looping, the parameter is node.
return value: None
    • KE.format.getHtml (HTML, htmltags)
convert HTML to XHTML, and filter HTML tags according to htmltags rules when specifying the Htmltags parameter.
Parameters:
html:string,html text
Htmltags:object, filter rules, optional parameters.
return value:
string,xhtml text
    • KE.util.getDocumentElement ()
Gets the document element object.
parameter: No
return value:
object,element Object
    • KE.util.getDocumentWidth ()
Gets the width of the current page.
parameter: No
return value:
int,document width
    • KE.util.getDocumentHeight ()
Gets the height of the current page.
parameter: No
return value:
int,document height
    • KE.util.loadStyle (PATH)
Loads a CSS file on the current page.
parameter:
URL path return value for Path:string,css file
: None
    • KE.util.inArray (str, arr)
Determines whether a string is in an array.
Parameters:
str:string
arr:array
return value:
Boolean, returns True to indicate the number of Group, the return of false indicates that it is not in the array.
    • KE.util.trim (str)
Delete the space characters on either side of the string.
parameter:
str:string
return value: String
    • KE.util.getJsKey (Key)
converts the CSS name in the HTML style to the JavaScript attribute name. For example: KE.util.getJsKey ("Font-size") returns "FontSize".
parameter:
key:string
return value: String
    • KE.util.escape (HTML)
converts special characters in HTML.
parameter:
html:string,html text
return value: String
    • KE.util.getElementPos (EL)
Gets the coordinates of the specified element.
parameter:
el:object,element
return value:
object
    • KE.util.getCoords (EV)
gets the mouse coordinates.
parameter:
ev:object,event
return value:
object
    • KE.util.setOpacity (el, opacity)
Sets the transparency of the element.
Parameters:
el:object,element Object
opacity:int, transparency, can set numbers from 0 to 100.
return value: None
    • KE.util.getIframeDoc (IFRAME)
Gets the IFRAME document object.
parameter:
iframe:object,iframe
return value:
object
    • KE.util.rgbToHex (str)
converts colors in RGB format to 16 colors.
parameter:
str:string,rgb color tag
return value: String
    • KE.util.createRange (DOC)
creates a range for the specified document.
parameter:
doc:object,document Object
return value: Object,range object
    • KE.util.getFullHtml (ID, Taglinemode)
Gets the initialization HTML text for the editor IFrame.
Parameters:
id:string, the profile of the module label is displayed when the
Editor's ID
taglinemode:boolean,true.
return value: String
    • KE.util.getData (ID)
Gets the HTML content of the editor.
parameter:
id:string, editor ID
return value: String
    • KE.util.getSrcData (ID)
gets the native HTML content of the editor, which is the HTML that innerhtml directly returns.
parameter:
id:string, editor ID
return value: String
    • KE.util.getPureData (ID)
Gets the plain text content of the editor and does not contain HTML tags. Version 3.4 begins with the IMG and embed tags.
parameter:
id:string, editor ID
return value: String
    • KE.util.setData (ID)
Set the contents of the editor to the original textarea control.
parameter:
id:string, editor ID
return value: None
    • KE.util.focus (ID)
Move the focus to the editor.
parameter:
id:string, editor ID
return value: None
    • KE.util.selection (ID)
Set the current selected information to Ke.g[id].sel,ke.g[id].range,ke.g[id].kesel,ke.g[id].kerange.
parameter:
id:string, editor ID
return value: None
    • KE.util.select (ID)
Check range again, only valid in IE.
parameter:
id:string, editor ID
return value: None
    • KE.util.pToBr (ID)
The
br tag is generated when the ENTER key is pressed, only valid in IE.
Parameters:
id:string, editor ID
return value: No
Note: Version 3.4 has been deprecated.
    • KE.util.execCommand (ID, cmd, value)
Execute the command that comes with the browser, please refer to Document.execcommand in the browser API for details.
Parameters:
id:string, editor ID
cmd:string, cmd parameter in browser execcommand
value:string, browser E The value of the Xeccommand parameter
returns: None
    • KE.util.insertHtml (ID, HTML)
inserts the HTML content into the editing area at the cursor.
Parameters:
id:string, editor ID
html:string,html content
return value: No
Note: You must perform the KE.util.selection (ID) before executing this function, because you want to set Ke.g[id].sel and Ke.g[id].range first.
    • Ke.create (ID, mode)
Create an editor.
Parameters:
id:string, editor ID
mode:int, optional parameter, specify 1 o'clock Create editor under body, 0 or unspecified when creating editor in front of textarea.
return value: None
    • Panax Notoginseng ke.remove (ID, mode)
removes the editor.
Parameters:
id:string, editor ID
mode:int, optional parameter, specify 1 o'clock Remove editor before body, 0 or unspecified when removing in front of textarea.
return value: None
    • Ke.init (config)
Sets the initialization parameters for the editor.
Parameters:
config:object, the hash array for editor properties, refer to the editor property
return value: None
    • Ke.show (config)
Initialize and create the editor. The function is executed by calling Ke.init to set the initialization parameters and then executing the ke.create after the DOM is loaded.
Parameters:
config:object, the hash array for editor properties, refer to the editor property
return value: None

class
    • 1. Ke.selection (Win, Doc)
Kindeditor the selection class, gets or sets the range of the selected section.
Parameters:
Win:object,window Object
oc:object,document object
member variable:
  • Sel:object, browser native Selection object
  • Range:object, the browser native Range object for the current selection
  • Kerange:object, for the current selection Kindeditor Range object, refer to Ke.range.
Method:
  • AddRange (Kerange): Sets the current selection.
  • Focus (): Re-selected, only valid in IE.
    • 2. Ke.range (DOC)
the range class of Kindeditor provides a unified range interface for each browser.
parameter:
doc:object,document Object
member variable:
  • Startnode:object, starting node
  • Startpos:int, the location of the start node
  • Endnode:object, End node
  • Endpos:int, ending the position of the node
Method:
  • Getparentelement (): Returns the parent element that contains the range.
  • Getnodelist (): Returns the node list in range.
  • Comparepoints (How, Range): Compare the positions of 2 kerange, how you can set "Start_to_start", "Start_to_end", "End_to_start", "End_to_end".
  • Setstart (node, POS): Sets the start node and location of the range.
  • SetEnd (node, POS): Sets the end node and location of the range.
  • Selectnode (node): Set node to range, both the start and end nodes are node.
  • Extractcontents (): Extracts the contents of range.
  • Clonecontents (): Copies the contents of range.
  • GetText (): Gets the plain text content of range.
    • 3. Ke.cmd (ID)
kindeditor Command class, similar to ExecCommand.
parameter:
id:string, the ID member variable of the editor
:
  • Doc:object, the iframe document object for the editor
  • Kesel:int,kindeditor Selection Object
  • Kerange:object, the Kindeditor Range object for the current selection
Method:
  • Wrap (TagName, attributes): The currently selected text with the specified label package, currently only supports inline tag. TagName is the label signature, and attributes is an array of the tag attributes.
  • Remove (Tags): Clears the specified label and attributes in the currently selected text. tags for the tags and attributes you want to delete.

"Reprint" Kindeditor API, Kindeditor user manual, Kindeditor function, kindeditor use, super large collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.