2. JavaScript API

2.1. JavaScript Configuration API

Important:

The functions described in this chapter may only be used before initializing an instance of edit-on Pro as they are used to configure the applet. Calling the function loadEditor will start the initialization of the corresponding editor instance.

editOnPro

Syntax:
object editOnPro (
    string strWidth
    string strHeight
    string strName
    string strId
    string strObj
)
Description:

Constructor for the editOnPro object. Creates an editor object with the width strWidth , the height strHeight , the name strName and the id strId .

Important:

The value of strObj must always be the same as the name of the editOnPro object you are creating.

Example:
eop = new editOnPro(725, 350, "myEditor", "myId", "eop");

setCodeBase

Syntax:
void  setCodeBase(
    string strCodebase
)
Description:

The URL location strCodebase is used as the editor's codebase.

Example:
eop.setCodebase("http://myserver.com/EOP");

addArchive

Syntax:
void addArchive (
    string strArchive
    string strVersion
)
Description:

Specifies a Java archive to be loaded in addition to the editor's archive. To load multiple additional archives, call this function for each archive. strArchive specifies the URL to the archive to be loaded. Use strVersion to specify a version number for the archive. If caching is enabled, this version number will be used when caching the archive.

Example:
eop.addArchive("myarchive.jar","1.0.8.0);

setArchive

Syntax:
void setArchive(
    string strArchive
)
Description:

Specifies the URL to the applet Java Archive.

Example:
eop.setArchive("edit-on-pro-4.jar");

setParam

Syntax:
void setParam(
    string strProperty
    string strValue
)
Description:

The parameter strProperty with the value strValue is added to the editor parameters.

Example:
eop.setParam("sourceview","true");

setBodyOnly

Syntax:
void setBodyOnly(
    boolean bodyonly
)
Description:

Determines whether the "bodyonly" mode should be activated or not.

Example:
eop.disableCaching();

disableCaching

Syntax:
void disableCaching()
Description:

Disables the applet caching feature for this instance of the editor. Caching is enabled by default unless this method is called before initializing the editor.

Example:
eop.disableCaching();

setConfig

Syntax:
void setConfig(
    string sConfig
)
Description:

Specifies the editor's configuration as string.

Example:
strConf = 
    ' <?xml version="1.0" encoding="UTF-8"?><config> ... </config> '; 
eop.setConfig(strConf);

setConfigURL

Syntax:
void
    setConfigURL(
    string sURL
)
Description:

Specifies the URL location of the editor's configuration file. May be relative to the applet's codebase.

Example:
eop.setConfigURL("config.xml");

setExportAsNumerical

Syntax:
void setExportAsNumerical(
    boolean bExportAsNum
)
Description:

Sets the value of the exportasnumerical property.

Example:
eop.setExportAsNumerical(true);

Note:

Characters will only be exported as entities if they are not supported by the encoding specified in the document. If characters are supported by the specified encoding, they will be exported as such.

setHeartBeatInterval

Syntax:
void setHeartBeatInterval(
    string strInterval
)
Description:

Specifies in which interval (in seconds) the editor will perform a HTTP request to the URL specified by setHeartBeatInterval . The default interval is 60 seconds.

Example:
eop.setHeartBeatInterval("30");

setHeartBeatURL

Syntax:
void setHeartBeatURL(
    string strURL
)
Description:

Specifies an URL the editor will perform a GET request to in the interval specified by setHearBeatInterval or in an interval of 60 seconds if setHeartBeatInterval is not specified. This can e.g. be used to prevent a session from timing out if you are using sessions.

Example:
eop.setHeartBeatURL("http://yourserver.com/session.htm");

setHiddenLoading

Syntax:
void setHiddenLoading(
    boolean bState
    [boolean displayOnLoad]
    [int loadingIndicatorOffset]
    [int loadingIndicatorTimeout]
)
Description:

The argument bState specifies if the editor should be visible while it is loading. If set to true, an animated image will be displayed while the editor is loading.

displayOnLoad specifies if the editor should be displayed once it is fully loaded. If set to false, the editor will remain hidden until the method showEditor is called.

loadingIndicatorOffset specifies the time in milliseconds after which the progress indicator should be displayed from the moment on the editor has started loading.

loadingIndicatorTimeout specifies the time in milliseconds after which the progress indicator will not be displayed anymore if an error occured when loading the editor.

Example:
eop.setHiddenLoading(true);

setLoadingIndicator

Syntax:
void setLoadingIndicator(
    string strIndicator
)
Description:

If hidden loading is enabled, this specifies the HTML code that is displayed while the editor is loading.

Example:
strLoad = "The editor is loading. Please wait.";
eop.setLoadingIndicator(strLoad);

setLicenseKey

Syntax:
void setLicenseKey(
    string strLicenseKey
)
Description:

Sets the value of the licensekey property.

Example:
eop.setLicenseKey("licensekey.xml");

setLocaleCode

Syntax:
void setLocaleCode(
    string strLocale
)
Description:

Sets the value of the locale property.

Example:
eop.setLocaleCode("en_US");

setLocaleURL

Syntax:
void
    setLocaleURL(
    string strLocaleURL
)
Description:

Sets the value of the localeurl property.

Example:
eop.setLocaleURL("locale_it_IT.xml");

setNewDocumentDialog

Syntax:
void setNewDocumentDialog(
    boolean bNewDocDialog
)
Description:

Sets the value of the newdocumentdialog property.

Example:
eop.setNewDocumentDialog(false);

setStandAloneHeight

Syntax:
void setStandAloneHeight (
    string sHeight
)
Description:

Sets the default height of the editor in stand-alone mode in pixels.

Example:
eop.setStandAloneHeight("500");

setStandAloneWidth

Syntax:
void setStandAloneWidth (
    string sWidth
)
Description:

Sets the default width of the editor in stand-alone mode in pixels.

Example:
eop.setStandAloneWidth("500");

setStartUpScreenBackgroundColor

Syntax:
void setStartUpScreenBackgroundColor (
    string strColor
)
Description:

Specifies the background color of the applet during initialization.

Example:
eop.setStartUpScreenBackgroundColor("#ffffff");

setStartUpScreenTextColor

Syntax:
void setStartUpScreenTextColor (
    string strColor
)
Description:

Specifies the color of the text displayed in the applet during initialization.

Example:
eop.setStartUpScreenTextColor("#000000");

setUIConfig

Syntax:
void setUIConfig(
    string sUIConfig
)
Description:

Specifies the user interface configuration as string.

Example:
strUIConfig = ' <?xml version="1.0" encoding="UTF-8"?>
<uiconfig> <actions> ... </actions>
<menubar> ... </menubar> <toolbar> ...
</toolbar> <contextmenu> ... </contextmenu>
</uiconfig> '; 
eop.setUIConfigURL("uiconfig.xml");

setUIConfigURL

Syntax:
void setUIConfigURL(
    string sURL
)
Description:

Specifies the URL location of the editor's user interface configuration file. May be relative to the applet's codebase.

Example:
eop.setUIConfigURL("uiconfig.xml");

setUnsupportedBrowserEvent

Syntax:
void setUnsupportedBrowserEvent(
    string sEvent
)
Description:

If this is specified, the function with the name sEvent will be called if the browser / OS combination that is used is not supported.

Example:
eop.setUnsupportedBrowserEvent("myFunc");

setIconRepositoryURL

Syntax:
void setIconRepositoryURL(
    string sIconRepositoryURL
)
Description:

Specifies a repository from which the editor loads the toolbar icons. If this repository is specified, the applet will first look for icons in the repository. If the icon can not be found in the repository, it is loaded from the edit-on Pro JAR file.

If a relative path is used for the repository, it is resolved relative to the editor's codebase.

Example:
eop.setIconRepositoryURL("myicons/");

setDefaultFont

Syntax:
void setDefaultFont(
    string sDefaultFont
)
Description:

Specifies the default font used to display the editor's content where no font is otherwise specified.

This font is only used to render the editor's content, and is not exported in any way.

Example:
eop.setDefaultFont("Arial");

setEventHandler

Syntax:
void setEventHandler(
    string sEvent, string sFunction
)
Description:

Calls the function sFunc every time the event sEvent is fired. For details about available events, please see the chapter Event Handlers.

Example:
eop.setEventHandler("ONDATALOADED","onDataLoaded");

loadEditor

Syntax:
void loadEditor() 
Description:

Inserts and initializes the editor at the location in the document where this function is executed.

Example:
eop.loadEditor();

preloadApplet

Syntax:
void preloadApplet(
    string codebase
    boolean enableJREAutoDownload
    [string JREAutoDownloadURL]
    [string JREMinVersion]
)
Description:

This initializes the JVM and additionally preloads the applet JAR file into the JRE cache. This function should be used on a page before the editor is loaded in order to speed up subsequent start times of the editor.

Note:

The function preloadApplet can be used independently of the editOnPro class. It should be used on a page of your system which does not contain the editor itself, and before the editor is actually instanciated. It is not recommended to use this function on a page containing edit-on Pro.

Important

Using the preload mechanism may cause a warning dialog to be displayed if Java 1.7.0_11 or newer is used. From this Java version on, this dialog is displayed for all unsigned applets.

codebase

Specifies the location of the editor's codebase resp. of "preload.jar" which will be loaded to initialize the JVM.

enableJREAutoDownload

This will only have an effect in Internet Explorer. If set to true, the browser will try to install a JRE from the location specified by JREAutoDownloadURL and no Java was detected or the Java version is below the version specified by JREMinVersion .

JREAutoDownloadURL (optional)

This is only supported in Internet Explorer. If set and no JVM is installed, the browser will try to install a JVM from the specified location.

JREMinVersion (optional)

This is only supported in Internet Explorer. This parameter must be set if JREAutoDownloadURL was set. This specifies the minimum version of the JRE that should be installed.

Example:
preloadApplet("eopro",
    true,
    "http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab",
    "1,4,2");

preloadJVM

Syntax:
void preloadJVM(
    string codebase
    boolean enableJREAutoDownload
    [string JREAutoDownloadURL]
    [string JREMinVersion]
)
Description:

This initializes the JVM. This function should be used on a page before the editor is loaded in order to initialize the Java VM. If the Java VM is already started before the editor is loaded, the startup time of the editor will seem faster to the editor, as the start of the Java VM itself can be quite time consuming on some systems.

Note:

The function preloadJVM can be used independently of the editOnPro class. It should be used on a page of your system which does not contain the editor itself, and before the editor is actually instanciated. Its only purpose is to ensure the JVM is already started when accessing a page with an instance of edit-on Pro. It is not recommended to use this function on a page containing edit-on Pro.

Important

Using the preload mechanism may cause a warning dialog to be displayed if Java 1.7.0_11 or newer is used. From this Java version on, this dialog is displayed for all unsigned applets.

codebase

Specifies the location of the editor's codebase resp. of "preload.jar" which will be loaded to initialize the JVM.

enableJREAutoDownload

This will only have an effect in Internet Explorer. If set to true, the browser will try to install a JRE from the location specified by JREAutoDownloadURL and no Java was detected or the Java version is below the version specified by JREMinVersion .

JREAutoDownloadURL (optional)

This is only supported in Internet Explorer. If set and no JVM is installed, the browser will try to install a JVM from the specified location.

JREMinVersion (optional)

This is only supported in Internet Explorer. This parameter must be set if JREAutoDownloadURL was set. This specifies the minimum version of the JRE that should be installed.

Example:
preloadJVM("eopro",
    true,
    "http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab",
    "1,4,2");

2.2. JavaScript API / Java API

Important:

All functions (excepted get functions) described in this chapter will not be executed immediately as they are called. When they are called, they will first be queued and be executed in sequence when the method pumpEvents() is called.

acceptAll

Syntax:
void acceptAll()
Description:

Accepts all changes made in the document and ends comparison mode.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
eop.acceptAll();

addStyleSheet

Syntax:
void addStyleSheet(
    string strStyles
)
Description:

Loads styles from strStyles into the editor.

Example:
myStyles = "p { text-decoration:underline; }";
eop.addStyleSheet(myStyles);

cleanStyleSheet

Syntax:
void cleanStyleSheet()
Description:

Erases any existing styles within the document. Styles available in the editor because of an external style sheet file will still be available.

Example:
eop.cleanStyleSheet();

clear

Syntax:
void clear()
Description:

Clears the editor's content.

Example:
eop.clear();

compareDocumentContents

Syntax:
void compareDocumentContents(
    string strDoc1,
    string strDoc2
)
Description:

Loads and compares two documents as string.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
strDoc1 = "<p>Some content</p>";
strDoc2 = "<p>Some more content</p>";
eop.compareDocumentContents(strDoc1, strDoc2);

compareDocumentContentToEditorContent

Syntax:
void compareDocumentContentToEditorContent(
    string strDoc
)
Description:

Compares the document specified by the string strDoc to the editor content.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
strDoc = "<p>Some content</p>";
eop.compareDocumentToEditorContent(strDoc1);

compareDocuments

Syntax:
void compareDocuments(
    string strURL1,
    string strURL2
)
Description:

Loads and compares two documents from an URI.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
strURL1 = "http://www.yourserver.com/doc1.htm";
strURL2 = "http://www.yourserver.com/doc2.htm";
eop.compareDocuments(strURL1, strURL2);

compareDocumentToEditorContent

Syntax:
void compareDocumentToEditorContent(
    string strURL
)
Description:

Compares the document from the specified URL strURL to the editor content.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
strURL = "http://www.myserver.com/doc.htm";
eop.compareDocumentToEditorContent(strDoc1);

decode

Syntax:
string decode(
    string strEncodedString
)
Description:

Decodes all HTML entities contained in the specified string to character data and returns the decoded string.

Example:
strEncodedString = "&amp;";
strDecodedString = eop.decode(strEncodedString); //This will return "&"

encode

Syntax:
string encode(
    string strDecodedString
)
Description:

Encodes the specified string according to the encoding specified in the applet by the encoding property. If no encoding is specified, the string will be HTML encoded.

Example:
strDecodedString = "&";
strEncodedString = eop.encode(strDecodedString); //This will return "&amp;"

enforceReadOnlyAPI

Syntax:
void enforceReadOnlyAPI(
    boolean bEnforce
)
Description:

Toggles whether or not the JavaScript API methods can modify the content of read-only custom elements (i.e. any custom element where any of the custom CSS properties "ro-readonlycontent", "ro-readonlyelement" or "ro-formattingonly" are set to true).

If set to "false", it is possible to use JavaScript API methods to modify the content of read-only areas.

Setting bEnforce to true prevents read-only areas from being modified by JavaScript API methods (such as setHTMLData).

Example:
eop.enforceReadOnlyAPI(false);
eop.pumpEvents();

getActiveSpellChecker

Syntax:
string getActiveSpellChecker()
Description:

Returns the localeid of the currently active spell-checker language. The localeid is used in the XML locale file of the editor to map the strings used in dialogs and the localeid attributes of the elements defined in the user interface configuration file to the localized strings of the corresponding language, e.g. "LANGUAGE_AMERICAN" corresponds to "American English".

Example:
strLang = eop.getActiveSpellChecker();

getBase

Syntax:
string getBase()
Description:

Returns the value of the base property.

Example:
base = eop.getBase();

getBlockElementAttributes

Syntax:
Array getBlockElementAttributes()
Description:

Returns an associative array containing the attributes of the current block level element (e.g. " <p> " or " <div> ") and their values. The attribute names of the element form the keys of the array returned by the function, while the attribute values are its values.

Example:
arr = eop.getBlockElementAttributes();
msg = "";
for (var prop in arr) { 
    msg += prop+'="'+arr[prop]+'"\n'; 
} 
if(msg.length<1) msg = "No attributes";
alert(msg);

getCharNoSpacesStatistic

Syntax:
string getCharNoSpacesStatistic()
Description:

Retrieves the number of characters contained in the document. White spaces are ignored.

Example:
noSpacesStat = eop.getCharNoSpacesStatistic();

getBookmarks

Syntax:
Array getBookmarks(boolean bSorted)
Description:

Returns an array containing the names of all bookmarks in the document. The boolean parameter bSorted indicates if this array should be sorted according to the position where the bookmark occurs in the document.

Example: Displaying all bookmarks in the document.
function getBookmarks() {
    arr = eop.getBookmarks(true);
    msg = "";
    for (var prop in arr) {
        msg += prop+'="'+arr[prop]+'"\n';
    }
    if(msg.length<1) msg = "No bookmarks";
    alert(msg);
}

getCharWithSpacesStatistic

Syntax:
string getCharWithSpacesStatistic()
Description:

Retrieves the number of characters contained in the document including white spaces.

Example:
charStat = eop.getCharWithSpacesStatistic();

getCurrentElement

Syntax:
string getCurrentElement()
Description:

Retrieves the element at the current cursor position, including the textual content as well as all children elements.

Example:
curElement = eop.getCurrentElement();

getCurrentElementContent

Syntax:
string getCurrentElementContent()
Description:

Retrieves the content of the element at the cursor position, including the textual content as well as all child elements.

Example:
curElementContent = eop.getCurrentElementContent();

getCurrentTableColumnCellAttributes

Syntax:
Array getCurrentTableColumnCellAttributes()
Description:

Returns the attributes of all table cells in the current table column. The array that is returned is a multi-dimensional array consisting of an array of all table cells of the current column and an array of all attributes for each cell.

Example:
function alertTableColumnCellAttributes() {
	arr = eop.getCurrentTableColumnCellAttributes();
	str = "";
	for (key in arr) {
		str += "Cell: " + key + " Attributes: {";
		for (innerKey in arr[key]) {
        	str += "\n\t" + innerKey + ": " + arr[key][innerKey];
        }
        str += "\n}\n";
	}
	alert(str);
}

getCurrentTableRowCellAttributes

Syntax:
Array getCurrentTableRowCellAttributes()
Description:

Returns the attributes of all table cells in the current table row. The array that is returned is a multi-dimensional array consisting of an array of all table cells of the current row and an array of all attributes for each cell.

Example:
function alertTableRowCellAttributes() {
	arr = eop.getCurrentTableRowCellAttributes();
	str = "";
	for (key in arr) {
		str += "Cell: " + key + " Attributes: {";
		for (innerKey in arr[key]) {
        	str += "\n\t" + innerKey + ": " + arr[key][innerKey];
        }
        str += "\n}\n";
	}
	alert(str);
}

getCustomField

Syntax:
string getCustomField()
Description:

Retrieves the value of the customfield property.

Example:
customField = eop.getCustomField();

getDTDBase

Syntax:
string getDTDBase() 
Description:

Retreives the base URL that is used to resolve relative DTDs if it is set.

Example:
strBase = eop.getDTDBase();

getElementAttributes

Syntax:
Array getElementAttributes()
Description:

Returns an associative array containing the attributes of the current element and their values. The attribute names of the element form the keys of the array returned by the function, while the attribute values are its values.

Example:
arr = eop.getElementAttributes();
msg = "";
for (var prop in arr) {
    msg += prop +'="'+arr[prop]+'"\n'; 
} 
if(msg.length<1) msg = "No attributes"; 
alert(msg);

getEncoding

Syntax:
string getEncoding()
Description:

Retrieves the value of the encoding property.

Example:
curEncoding = eop.getEncoding();

getExportAsNumerical

Syntax:
boolean getExportAsNumerical()
Description:

Retrieves the value of the exportasnumerical property.

Example:
bExportAsNumerical = eop.getExportAsNumerical();

getGetErrorTarget

Syntax:
string getGetErrorTarget()
Description:

Retrieves the value of the geterrortarget property.

Example:
curGetErrorTarget = eop.getGetErrorTarget();

getGetErrorURL

Syntax:
string getGetErrorURL()
Description:

Retrieves the value of the geterrorurl property.

Example:
curGetErrorURL = eop.getGetErrorURL();

getGetHTMLDataURL

Syntax:
string getGetHTMLDataURL()
Description:

Retrieves the value of the gethtmldataurl property.

Example:
curGetHTMLDataURL = eop.getGetHTMLDataURL();

getGetOKTarget

Syntax:
string getGetOKTarget()
Description:

Retrieves the value of the getoktarget property.

Example:
curGetOKTarget = eop.getGetOKTarget();

getGetOKURL

Syntax:
string getGetOKURL()
Description:

Retrieves the value of the getokurl property.

Example:
curGetOKURL = eop.getGetOKURL();

getHeadElementContent

Syntax:
string getHeadElementContent()
Description:

Retrieves the content of the document's <head>...</head> element. This has no effect if the bodyonly property is set to "true".

Example:
headElementContent = eop.getHeadElementContent();

getHTMLData

Syntax:
string getHTMLData()
Description:table_numcols

Retrieves all content from the editor.

Example:
strContent = eop.getHTMLData();

getImageBase

Syntax:
string getImageBase()
Description:

Returns the value of the imagebase property.

Example:
imgBase = eop.getImageBase();

Important:

This method is deprecated as of edit-on Pro version 4.2. Please use automaticallygetBase instead.

getImagesStatistic

Syntax:
string getImagesStatistic()
Description:

Retrieves the number of images contained in the document.

Example:
noImages = eop.getImagesStatistic();

getLinesStatistic

Syntax:
string getLinesStatistic()
Description:

Retrieves the number of lines contained in the document.

Example:
noLines = eop.getLinesStatistic();

getLocaleCode

Syntax:
string getLocaleCode()
Description:

Retrieves the value of the locale property.

Example:
curLocale = eop.getLocaleCode();

getLocaleFromBrowser

Syntax:
string getLocaleFromBrowser()
Description:

Returns the locale of the browser as string which can be used to set the editor's locale via setLocaleCode property. This will set the editor's locale to the browser's locale.

Example:
eop.setLocaleCode(eop.getLocaleCode());

getLocaleURL

Syntax:
string getLocaleURL()
Description:

Retrieves the value of the localeurl property.

Example:
curLocaleURL = eop.getLocaleURL();

getNewDocumentDialog

Syntax:
boolean getNewDocumentDialog()
Description:

Retrieves the value of the newdocumentdialog property.

Example:
bDocDialog = eop.getNewDocumentDialog();

getParagraphsStatistic

Syntax:
string getParagraphsStatistic()
Description:

Retrieves the number of paragraphs contained in the document.

Example:
noParas = eop.getParagraphsStatistic();

getParentElementByName

Syntax:
string getParentElementByName(
    string strParent
)
Description:

Starting from the caret position, searches for a parent element called strParent and retrieves the element, including the textual content as well as all children elements.

Example:
parentElement = eop.getParentElementByName("p");

getParentElementByNameContent

Syntax:
string getParentElementByNameContent(
    string strParent
)
Description:

Starting from the caret position, searches for a parent element called strParent and retrieves the textual content as well as all children elements of the element.

Example:
parentElementContent = eop.getParentElementByNameContent("p");

getParentElementByNameAttributes

Syntax:
string getParentElementByNameAttributes(
    string strParent
)
Description:

Starting from the caret position, searches for a parent element called strParent and retrieves all attributes of the element as an array.

Example:
attributes = eop.getParentElementByNameAttributes("p");

getPlainText

Syntax:
string getPlainText()
Description:

Retrieves the content from the editor as plain text without any tags. Line breaks ("<br/>) and paragraphs ("<p></p>") will be transformed to CRLF while all other tags are removed.

Example:
strPlainText = eop.getPlainText();

getPostErrorMessage

Syntax:
string getPostErrorMessage()
Description:

If an error occured when using the direct HTTP POST API to post the editor's content, this method returns null or the error returned by the server-side script that was the target of the POST operation.

See Direct HTTP Connection API for more details.

Example:
strError = eop.getPostErrorMessage();

getReadOnly

Syntax:
boolean getReadOnly()
Description:30

Returns whether the editor is currently in read-only state. Returns true if the editor currently is in read-only state and can not be edited.

Example:
bState = eop.getReadOnly();

getSelectedHTMLData

Syntax:
string getSelectedHTMLData()
Description:

Retrieves the selected HTML data from the editor.

Example:
sel = eop.getSelectedHTMLData();

getSetErrorTarget

Syntax:
string getSetErrorTarget()
Description:

Retrieves the value of the seterrortarget property.

Example:automatically
setErrTarget = eop.getSetErrorTarget();

getSetErrorURL

Syntax:
string getSetErrorURL()
Description:

Retrieves the value of the seterrorurl property.

Example:
curSetErrorURL = eop.getSetErrorURL();

getSetOKTarget

Syntax:
string getSetOKTarget()
Description:

Retrieves the value of the setoktarget property.

Example:
curSetOKTarget = eop.getSetOKTarget();

getSetOKURL

Syntax:
string getSetOKURL()
Description:

Retrieves the value of the setokurl property.

Example:
curSetOKURL = eop.getSetOKURL();

getSourceView

Syntax:
boolean getSourceView()
Description:

Retrieves the value of the sourceview property.

Example:
bSourceView = eop.getSourceView();

getStandAloneMode

Syntax:
boolean getStandAloneMode()
Description:

Returns the value of the standalonemode property.

Example:
bStMode = eop.getStandAloneMode();

getStatistics

Syntax:
                                Array getWordsStatistic()
                            
Description:

Returns an associative array containing the number of images, lines, paragraphs, characters without spaces, characters with spaces and words contained in the document. The folowing keys are available in the associative array returned by getWordStatistics : images , lines , paragraphs , charNoSpaces , charWithSpaces . words .

Example:
arr = eop.getStatistics();
msg = "";
for (var prop in arr) {
    msg += prop+": "+arr[prop]+"\n"; 
}
alert(msg);

getWebDAVCookieString

Syntax:
Array getWebDAVCookieString()
Description:

Retrieves an associative array containing available Webdav cookies in case the user has previously logged into the Wedav repository using one of edit-on Pro's Webdav dialogs.

Example:
cookie = eop.getWebDAVCookieString();

getWordsStatistic

Syntax:
string getWordsStatistic()
Description:

Retrieves the number of words contained in the document.

Example:
noWords = eop.getWordsStatistic();

hasContentChanged

Syntax:
boolean hasContentChanged()
Description:

Retrieves the state of the document in the editor. Returns true if the document if the document was modified and returns false if it was not modified. The state of hasContentChanged() is reset after calling getHTMLData() .

Example:
bChanged = eop.hasContentChanged();

jumpToBookmark

Syntax:
void jumpToBookmark(
    string sName
    int mode
)
Description:

Jumps to a specific bookmark in the document.

The parameter sName is the name of the bookmark the caret should jump to.

The parameter mode is the type of jump to perform. There are three types of jump: you can select the bookmark, place the caret before the bookmark, or place the caret after the bookmark.

The constants available for the mode parameter are (assuming your edit-on Pro JavaScript object is called "eop"):

eop.JUMPTOBOOKMARK_SELECT: jumps to the bookmark and selects it.

eop.JUMPTOBOOKMARK_BEFORE: places the caret before the bookmark.

eop.JUMPTOBOOKMARK_AFTER: places the caret after the bookmark.

Example:
eop.jumpToBookmark("daffodil",eop.JUMPTOBOOKMARK_SELECT);
eop.pumpEvents();

insertCustomTag

Syntax:
void insertCustomTag(
    string strTagName
    boolean bEmpty
    string strAttributes
)
Description:

If bEmpty is set to true, the empty element strTagName is inserted at the cursor position.

If bEmpty is set to false, the element strTagName is inserted around the current selection. The element will have the attributes specified by strAttributes .

Example:
eop.insertCustomTag("mycustomtag",false,"myattrib='somevalue'");

insertImage

Syntax:
void insertImage(
    string strSrc
    string strAlt
    string strWidth
    string strHeight
    string strBorder
)
Description:

Inserts an image (GIF, JPG or PNG format) from the URL strSrc at the current cursor location.

strWidth , strHeight and strBorder specify the image's width, height and border width resp. strAlt specifies the image's ALT text.

Example:
strSrc = "http://www.google.com/images/logo.gif"; 
strWidth = "200";
strHeight = "100"; 
strBorder = "1"; 
strAlt = "some text describing the image..."; 
eop.insertImage(strSrc, strAlt, strWidth, strHeight, strBorder);

insertHTMLData

Syntax:
void insertHTMLData(
    string strContents
)
Description:

Inserts strContents at the cursor position.

Example:
strContents = "<p>Paragraph with
<strong>strong</strong> text</p>";
eop.insertHTMLData(strContents);

insertHTMLDataFromURL

Syntax:
void insertHTMLDataFromURL(
    string strURL
)
Description:

Inserts content from strURL at the cursor position.

Example:
eop.insertHTMLDataFromURL("http://www.w3.org");

invokeAction

Syntax:
void invokeAction(
    string actionID,
    [string selectedItem],
	[string eventHandler]
)
Description:

This emulates the clicking of the action actionID in the applet's menu bar, tool bar or context menu. If the action that should be fired corresponds to a drop-down box, the optional parameter selectedItem is used to select a specific item from the drop-down box. For a description of all available actions see the chapter Actions .

The parameter eventHandler specifies an event handler function which is called once the action specified by the first parameter actionID has finished executing. If no event handler should be called, pass null as argument to this method.

Example:
eop.invokeAction("BOLD");
eop.invokeAction("BOLD",null,"myHandler");
eop.invokeAction("ADVANCEDSTYLESHEET","H1");
eop.invokeAction("ADVANCEDSTYLESHEET","H1","myHandler");

isActionEnabled

Syntax:
boolean isActionEnabled()
Description:

Returns whetheran edit-on Pro user interface action such as "BOLD", "ITALIC", ect. is enabled or not. If the action is enabled, it can be used from within the user interface. If it is disabled, every control using the action will be disabled and greyed out.

Example:
bIsActive = eop.isActionEnabled();

isVersioTrackEnabled

Syntax:
boolean isVersioTrackEnabled()
Description:

Returns whether or not VersioTrack is enabled in this instance of edit-on Pro.

Example:
bIsEnabled eop.isVersioTrackEnabled();

postDocumentToServer

Syntax:
void postDocumentToServer()
Description:

Performs a POST request to the URL specified by the gethtmldataurl property. The editor's content is stored in a field called HTMLDATA .

Example:
eop.postDocumentToServer();

rejectAll

Syntax:
void rejectAll()
Description:

Rejects all changes made in the document and ends comparison mode.

Note

This only has an effect if VersioTrack is enabled in your license.

Example:
eop.rejectAll();

removeCurrentTableColumnCellAttributes

Syntax:
void removeCurrentTableColumnCellAttributes(
	Array attributes
)
Description:

Removes all attributes of all cells of the current table column if the attribute name corresponds to an attribute name given in the array.

Example:
function removeTableColumnCellAttributes() {
	arr = new Array("height","width");
	eop.removeCurrentTableColumnCellAttributes(arr);
	eop.pumpEvents();
}

removeCurrentTableRowCellAttributes

Syntax:
void removeCurrentTableRowCellAttributes(
	Array attributes
)
Description:

Removes all attributes of all cells of the current table row if the attribute name corresponds to an attribute name given in the array.

Example:
function removeTableRowCellAttributes() {
	arr = new Array("height","width");
	eop.removeCurrentTableRowCellAttributes(arr);
	eop.pumpEvents();
}

removeParentElementByNameAttributes

Syntax:
void removeParentElementByNameAttributes(
    String strParent
    Array arrAttribs
)
Description:

Searches for a parent element specified by strParent from the caret position. If a parent with this name is found, removes the attributes specified in arrAttribs from the element.

Example:
arr = new Array();
arr[0] = "style";
arr[1] = "id";
				
eop.removeParentElementByNameAttributes("p", arr);
eop.pumpEvents();

setActionEnabled

Syntax:
void setActionEnabled(
    string strAction
    boolean bState
)
Description:

Sets the state of an edit-on Pro user interface action such as "BOLD", "ITALIC", ect. If set to true, the action is enabled and can be used from within the user interface. If it is set to false, the action is disabled. If it is integrated in the user interface, every control using the action will be disabled and greyed out.

Example:
eop.setActionEnabled("BOLD",false);

setActiveSpellChecker

Syntax:
string setActiveSpellChecker(string strLang)
Description:

Sets the localeid of the currently active spell-checker language. The localeid is used in the XML locale file of the editor to map the strings used in dialogs and the localeid attributes of the elements defined in the user interface configuration file to the localized strings of the corresponding language, e.g. "LANGUAGE_AMERICAN" corresponds to "American English".

The following spell-checker language localeids are available per default in the editor:

  • American English: LANGUAGE_AMERICAN

  • British English: LANGUAGE_BRITISH

  • Canadian English: LANGUAGE_CANADIAN

  • German: LANGUAGE_GERMAN

  • French: LANGUAGE_FRENCH

  • Spanish: LANGUAGE_SPANISH

  • Italian: LANGUAGE_ITALIAN

  • Dutch: LANGUAGE_DUTCH

  • Swedish: LANGUAGE_SWEDISH

  • Finish: LANGUAGE_FINISH

  • Norwegian: LANGUAGE_NORWEGIAN

  • Danish: LANGUAGE_DANISH

  • Brazilian Porzuguese: LANGUAGE_BRAZILIAN_PORTUGUESE

  • Portuguese: LANGUAGE_PORTUGUESE

  • American Medical: LANGUAGE_AMERICAN_MEDICAL

  • British Medical: LANGUAGE_BRITISH_MEDICAL

  • American Legal: LANGUAGE_AMERICAN_LEGAL

  • British Legal: LANGUAGE_BRITISH_LEGAL

Example:
eop.setActiveSpellChecker("LANGUAGE_AMERICAN");

setBase

Syntax:
void setBase(
    string strBase
)
Description:

Sets the value of the base property.

Example:
eop.setBase("http://www.w3.org");

setBlockElementAttributes

Syntax:
void setBlockElementAttributes(
    Array arrAttribs
)
Description:

Sets the attributes and attribute values of the current block level element (e.g. " <p> " or " <div> "). Use an associative array containing key-value pairs of the attributes and their values to set the attributes.

Example:
arr = new Array(); 
arr["style"] = "color: red;";
arr["align"] = "left"; 
eop.setBlockElementAttributes(arr);

setCaretAtDocumentStart

Syntax:
void setCaretAtDocumentStart()
Description:

Sets the caret at the start of the document inside th editor.

Example:
eop.setCaretAtDocumentStart();

setCaretAfterNextBookmark

Syntax:
void setCaretAfterNextBookmark()
Description:

Sets the caret at the end of the next bookmark found in the document starting from the caret position.

Example:
eop.setCaretAfterNextBookmark();

setCaretAfterPreviousBookmark

Syntax:
void setCaretAfterPreviousBookmark()
Description:

Sets the caret at the end of the previous bookmark found in the document starting from the caret position.

Example:
eop.setCaretAfterPreviousBookmark();

setCurrentElementContent

Syntax:PlainText
void setCurrentElementContent(
    string strContent
)
Description:

Sets the content of the tag at the current cursor position.

Example:
eop.setCurrentElementContent("the new content");

setCurrentTableColumnCellAttributes

Syntax:
void setCurrentTableColumnCellAttributes(
	Array attributes
)
Description:

Sets the attributes of all cells of the current table column. If an attribute is already present in a table cell of the current column, its value is overwritten with the new value.

Example:
function setTableColumnCellAttributes() {
	arr = new Array("height"); 
	arr["height"] = 10;
	eop.setCurrentTableColumnCellAttributes(arr);
	eop.pumpEvents();
}

setCurrentTableRowCellAttributes

Syntax:
void setCurrentTableRowCellAttributes(
	Array attributes
)
Description:

Sets the attributes of all cells of the current table row. If an attribute is already present in a table cell of the current row, its value is overwritten with the new value.

Example:
function setTableRowCellAttributes() {
	arr = new Array("height"); 
	arr["height"] = 10;
	eop.setCurrentTableRowCellAttributes(arr);
	eop.pumpEvents();
}

setCustomField

Syntax:
void setCustomField(
    string strFieldValue
)
Description:

Sets the value of the customfield property.

Example:
eop.setCustomField("myvalue");

setDTDBase

Syntax:
void setDTDBase(
    string strBase
)
Description:

Specifies the base URL which is used by the editor to resolve the DTDs with a relative path.

Example:
eop.setDTDBase("http://www.myserver.com/dtds/");

setEncoding

Syntax:
void setEncoding(
    string strEncoding
)
Description:

Sets the encoding used by the editor.

Example:
eop.setEncoding("UTF8");

setGetErrorTarget

Syntax:
void setGetErrorTarget(
    string strGetErrTarget
)
Description:

Sets the value of the geterrortarget property.

Example:
eop.setGetErrorTarget("_new");

setGetErrorURL

Syntax:
void setGetErrorURL(
    string strGetErrURL
)
Description:

Sets the value of the geterrorurl property.

Example:
eop.setGetErrorURL("_new");

setGetHTMLDataURL

Syntax:
void setGetHTMLDataURL(string strGetHTMLDataURL)
Description:

Sets the value of the gethtmldataurl property.

Example:
eop.setGetHTMLDataURL("http://www.realobjects.com");

setHeadElementContent

Syntax:
void setHeadElementContent(string strContent)
Description:

Sets the document's <head>...</head> element content.

Example:
headElmContent = 
    "<meta http-equiv='Content-type' content='text/html' />";
eop.setHeadElementContent(headElmContent);

setGetOKTarget

Syntax:
void setGetOKTarget(
    string strGetOKTarget
)
Description:

Sets the value of the getoktarget property.

Example:
eop.setGetOKTarget("_blank");

setGetOKURL

Syntax:
void setGetOKURL(
    string strGetOKURL
)
Description:

Sets the value of the getokurl property.

Example:
eop.setGetOKURL("http://myserver.com/ok.htm");

setHelpURL

Syntax:
void setHelpURL(
    string sURL
)
Description:

Specifies the URL that will opened if the HELP action is called. If this method is not used, the online help corresponding to the localeCode specified in the editor is opened.

Example:
setHelpURL("http://www.yourserver.com/userguide.html");

setHTMLData

Syntax:
void setHTMLData(
    string strContent
)
Description:

Loads strContent into the editor.

Example:
strContent = 
"<p>Paragraph with <strong>strong</strong> text</p>";
eop.setHTMLData(strContent);

setHTMLDataFromURL

Syntax:
void setHTMLDataFromURL(
    string strURL
)
Description:

Loads a HTML page from strURL into the editor.

Example:
eop.setHTMLDataFromURL("http://www.w3.org");

setElementAttributes

Syntax:
void setElementAttributes(
    Object attribs
)
Description:

Sets the attributes and attribute values of the current element. Use an object containing key-value pairs of the attributes and their values to set the attributes.

Example:
obj = new Object();
obj["width"] = "100";
obj["height"] = "200";
obj["src"] = "http:eop//myserver/image.gif";
eop.setElementAttributes(obj);

setIgnoreFilter

Syntax:
void setIgnoreFilter(
    string strFilter
)
Description:

Example:
eop.setIgnoreFilter(filter);

setImageBase

Syntax:
void setImageBase(
    string strBase
)
Description:

Specifies a filter for elements which will be ignored in comparison mode. For details, see Ignoring Changes

Example:
eop.setImageBase("http://www.w3.org");

Important:

This method is deprecated as of edit-on Pro version 4.2. Please use setBase instead.

setLookAndFeel

Syntax:
void setLookAndFeel(
    string strLookAndFeel
)
Description:

Sets the look and feel used by the editor. The look and feels supported by default by the editor are:

  • Motif Look and Feel:

    com.sun.java.swing.plaf.motif.MotifLookAndFeel

  • Windows Look and Feel:

    com.sun.java.swing.plaf.windows.WindowsLookAndFeel

  • Mac Aqua Look and Feel:

    apple.laf.AquaLookAndFeel

  • Metal Look and Feel:

    javax.swing.plaf.metal.MetalLookAndFeel

Example:
strPlaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
eop.setLookAndFeel(strPlaf);

setNextBookmarkWrapAroundEnabled

Syntax:
void setNextBookmarkWrapAroundEnabled(
    boolean bEnabled
)
Description:

Enables wrap around when searching for the next bookmark in a document using the setCaretAfterNextBookmark API method or the GOTONEXTBOOKMARK action.

Example:
eop.setNextBookmarkWrapAroundEnabled();

setParentElementByNameAttributes

Syntax:
void setParentElementByNameAttributes(
    String strParent
    Object attribs
)
Description:

Searches for a parent element specified by strParent from the caret position. If a parent with this name is found, sets the attributes and attribute values of the element. Use an object containing key-value pairs of the attributes and their values to set the attributes.

Example:
obj = new Object();
obj["style"] = "color: red;";
obj["lang"] = "en";
eop.setParentElementByNameAttributes("p",obj);

setParentElementByNameContent

Syntax:
void setParentElementByNameContent(
    String strParent
    String strContent
)
Description:

Searches for a parent element specified by strParent from the caret position. If a parent with this name is found, the content of the element is replaced with the content specified by strContent.

Example:
eop.setParentElementByNameContent("p","<span>new content</span>");

setPreviousBookmarkWrapAroundEnabled

Syntax:
void setPreviousBookmarkWrapAroundEnabled(
    boolean bEnabled
)
Description:

Enables wrap around when searching for the previous bookmark in a document using the setCaretAfterPreviousBookmark API method or the GOTOPREVIOUSBOOKMARK action.

Example:
eop.setPreviousBookmarkWrapAroundEnabled();

setReadOnly

Syntax:
void setReadOnly(
    boolean bState
)
Description:

Toggles editing in the editor. If setReadOnly is set to true, no editing actions can be performed anymore in the editor.

Note:

The JavaScript API functions will still function normaly when editing is disabled.

Example:
eop.setReadOnly(true);

setSetErrorTarget

Syntax:
void setSetErrorTarget(
    string strSetErrorTarget
)
Description:

Sets the value of the seterrortarget property.

Example:
eop.setSetErrorTarget("_blank");

setSetErrorURL

Syntax:
void setSetErrorURL(
    string strSetErrorURL
)
Description:

Sets the value of the seterrorurl property.

Example:
eop.setSetErrorURL("http://myserver.com/error.htm");

setSetOKTarget

Syntax:
void setSetOKTarget(
    string strSetOKTarget
)
Description:

Sets the value of the setoktarget property.

Example:
eop.setSetOKTarget("_new");

setSetOKURL

Syntax:
void setSetOKURL(
    string strSetOKURL
)
Description:

Sets the value of the setokurl property.

Example:
eop.setSetOKURL("http://myserver.com/ok.htm");

setSourceView

Syntax:
void setSourceView(
    boolean bSourceView
)
Description:

If set to false, the "Source View" tab of the editor is hidden. If set to true , the "Source View" tab is displayed again.

Example:
eop.setSourceView(false);

setStandAloneMode

Syntax:
void setStandAloneMode(
    boolean bStandAloneMode
)
Description:

Sets the value of the standalonemode property.

Example:
eop.setStandAloneMode(false);

setStyleSheet

Syntax:
void setStyleSheet(
    string strStyles
)
Description:

Loads styles from strStyles into the editor. These styles will overwrite any existing styles within the editor. If you want to add styles without overwriting the existing styles use addStyleSheet .

Example:
eop.setStyleSheet("p { color:blue; }");

setStyleSheetURL

Syntax:
void setStyleSheetURL(
    string strURL
)
Description:

Loads styles from a style sheet document residing at strURL into the editor.

Example:
eop.setStyleSheetURL("http://myserver.com/styles.css"); 

setTemplate

Syntax:
void setTemplate(
    string strTemplate
)
Description:

Loads the template strTemplate into the editor.

Example:
strTemplate = " <!DOCTYPE html SYSTEM 'xhtml1-transitional-eop.dtd'> 
<html>
<head>
    <title>My Template</title>
</head>
<body> 
    <p>&nbsp;</p>
</body>
</html>";
eop.setTemplate(strTemplate);

setTemplateURL

Syntax:
void setTemplateURL(
    string strTemplateURL
)
Description:

Loads a template from the URL strTemplateURL into the editor.

Example:
eop.setTemplateURL("http://myserver.com/template.xhtml");

setWebDAVCookieString

Syntax:
void setWebDAVCookieString(
    String cookie
);
Description:

Sets a cookie to be used in all of the editor's WebDAV connections. The string should consist of name=value pairs separated by a semicolon: "name1=value1;name2=value2;...".

Example:
eop.setWebDAVCookieString("myWebdavRepository=WebdavPort/Path;JSESSION=A4545B6767CBEA34535546576756767");

showWYSIWYGAreaOnly

Syntax:
void showWYSIWYGAreaOnly(
    boolean bShow
)
Description:

If bShow is true, only the editor's WYSIWYG area will be visible. The whole canvas, UI and tab pane are hidden and only the WYSIWYG area is displayed. Setting bShow to false reverses this effect.

Example:
eop.showWYSIWYGAreaOnly(true);

uploadImages

Syntax:
void uploadImages(
    string strFunc
)
Description:

Calling this function will open the "Upload Images" dialog. When the "OK" or "Cancel" button is clicked in this dialog, the applet will call the JavaScript function strFunc and pass an associative array containing information about the upload of each image that was uploaded as argument to the JavaScript function if "OK" was clicked. The JavaScript function strFunc will receive false as argument if "Cancel" was clicked.

Example:
eop.uploadImages("saveFunc");

Note:

Calling the uploadImages function inside an event queue will halt the event cycle. I.e., if you are calling any other methods that need to be registered in the queue after the uploadImages function, call pumpEvents within the definition of uploadImages ' event handler.

Important:

This method is deprecated as of edit-on Pro.2. Please use uploadToRepository instead.

uploadToRepository

Syntax:
void uploadToRepository(
    string strType
    string strFunc
)
Description:

Calling this function will open the upload dialogs of the type specified by strType . The possible types are UPLOADALL , UPLOADOBJECTSANDIMAGES , UPLOADIMAGES , UPLOADOBJECTS and UPLOADDOCUMENT . When the "OK" or "Cancel" button is clicked in this dialog, the applet will call the JavaScript function strFunc and pass an associative array containing information about the upload of each file that was uploaded as argument to the JavaScript function if "OK" was clicked. The JavaScript function strFunc will receive false as argument if "Cancel" was clicked.

Example:
eop.uploadToRepository("UPLOADIMAGES","saveFunc");

Note:

Calling the uploadToRepository function inside an event queue will halt the event cycle. I.e., if you are calling any other methods that need to be registered in the queue after the uploadToRepository function, call pumpEvents within the definition of uploadToRepository ' event handler.

resizeEditor

Syntax:
void resizeEditor(
    int width
    int height
)
Description:

Resizes the editor to the specified width and height in pixels.

Example:
eop.resizeEditor(600, 400);

showEditor

Syntax:
void resizeEditor()
Description:

Displays the editor if it was previously hidden using hideEditor or loaded using setHiddenLoading with the argument displayOnLoad set to false.

Note

Although this is method is a set method, it is exempt from the queue. Thus, the method is executed immediately when it is called, and no calling of pumpEvents is required. This method does not tamper with the event queue in any way.

Example:
eop.showEditor();

hideEditor

Syntax:
void hideEditor(
    boolean noCollapse
)

Note

Although this is method is a set method, it is exempt from the queue. Thus, the method is executed immediately when it is called, and no calling of pumpEvents is required. This method does not tamper with the event queue in any way.

Description:

Hides the editor when it is called. If noCollapse is set to true, the editor will behave like an XML element with the style "visibility: hidden", i.e. while it will no longer be visible, it will still take up the same space as before it was hidden.

If noCollapse is set to false, the editor is hidden and take up a minimal amount of space in the document while it is hidden.

Example:
eop.showEditor();

Note

Although this is method is a set method, it is exempt from the queue. Thus, the method is executed immediately when it is called, and no calling of pumpEvents is required. This method does not tamper with the event queue in any way.