Introduction

Alongside DevEdit's powerful PHP API is a Javascript API that can be used to manipulate the DevEdit control from the client side, using Javascript. The Javascript API functions need to be called against the name of the editor that you set using SetName function:

$myDE->SetName("myDevEditControl");

AddCustomInsert

This function clears all the content from the editor.

Function Syntax:

void clearContent()

Function Example:

myDevEditControl.clearContent()

execCommand

This function lets you access toolbar functions such as bold, italic, underline etc. The available commands are:

Save
Fullscreen
Cut
Copy
Paste
Findreplace
Undo
Redo
Spellcheck
RemoveFormat
Bold
Underline
Italic
Strikethrough
OrderedList
UnorderedList
Indent
Outdent
SubScript
SuperScript
JustifyLeft
JustifyCenter
JustifyRight
JustifyFull
CreateLink
CreateEmailLink
Anchor
Help
Fontname
Fontsize
Formatblock
Styles
Fontcolor
Highlight
Table
Form
Flash
Image
Media
Inserttextbox
HR
Insertchars
Pageproperties
Clearcode
Custominsert
Toggleposition
Showborders

Function Syntax:

void execCommand (string Command)

Function Example:

myDevEditControl.execCommand("Bold")

getHTMLContent

This function returns the HTML content of the DevEdit control.

Function Syntax:

string getHTMLContent ( )

Function Example:

var htmlCode = myDevEditControl.getHTMLContent()

getSelectedElement

This function returns an object of the selected element inside the editor.

Function Syntax:

object getSelectedElement( )

Function Example:

obj selectedElement = myDevEditControl.getSelectedElement()

getSelectedText

This function returns the text of what's being selected in the DevEdit control.

Function Syntax:

string getSelectedText( )

Function Example:

var selectedText = myDevEditControl.getSelectedText()

getTextContent

This function returns the text content of the DevEdit control without any HTML markup.

Function Syntax:

string getTextContent ( )

Function Example:

var TextContent = myDevEditControl.getTextContent()

insertHTML

This function inserts HTML into the editor at the cursor position.

Function Syntax:

void writeContent (string HTMLValue)

Function Example:

myDevEditControl.insertHTML("My HTML")

lockPage

When using editable regions, the editor automatically locks the non-editable regions so they cannot be edited. The unlockPage function removes this restriction. This function re-locks the page when the unlockPage function has been called.

Function Syntax:

void lockPage ( )

Function Example:

myDevEditControl.lockPage()

unlockPage

When using editable regions, the editor automatically locks the non-editable regions so they cannot be edited. The unlockPage function removes this restriction.

Function Syntax:

void unlockPage ( )

Function Example:

myDevEditControl.unlockPage()

writeHTMLContent

This function writes HTML content into the editor replacing all the existing HTML. See the insertHTML function if you'd like to insert HTML at the cursor position and not replace the existing HTML.

Function Syntax:

void writeHTMLContent (string HTMLValue)

Function Example:

myDevEditControl.writeHTMLContent("My HTML")

switchModeTo

This function writes HTML content into the editor replacing all the existing HTML. See the insertHTML function if you'd like to insert HTML at the cursor position and not replace the existing HTML.

Function Syntax:

void switchModeTo(string TabName)

Available Tab Names

  • Edit
  • Source
  • Preview

Function Example:

myDevEditControl.switchModeTo('source');