### Examples | Developer's Guide | ASP.NET Developer's Guide

1. Getting Started
2. Applying Stylesheet
3. Using Asset Manager Add-on
4. Advanced Settings
5. Extending the Editor
   1. Calling the Editor Object from a Popup/Window dialog
   2. Inserting Custom Content
      1. Inserting Custom Tags
      2. Inserting Custom Links
      3. Inserting Custom HTML Content
6. Toolbar
7. Localization
8. FAQ

## V. Extending the Editor

### V.1. Calling the Editor Object from a Popup/Window dialog

Calling the Editor object from a Popup Window or Modal/Modeless dialog sometimes is required if you’d like to exted the functionality of the Editor, for example if you want to create a custom content insertion from a popup/window dialog.

InnovaStudio WYSIWYG Editor provides a javascript oUtil object with obj property that you can use to call the active Editor object. If you have more than one Editor in a web page, the obj property will return the object of the current selected Editor (where the cursor is placed).

To call the oUtil.obj from a popup window, use:

var oEdit=window.opener.oUtil.obj;

To call the oUtil.obj from a modal/modeless dialog (IE only), use:

var oEdit=dialogArguments.oUtil.obj;

Example use of the oUtil object will be explained in the next sections (Inserting Custom Links & Inserting Custom HTML Content).

### V.2. Inserting Custom Content

#### V.2.a. Inserting Custom Tags

InnovaStudio WYSIWYG Editor has a Custom Tag Insertion feature. With this feature, you can insert predefined custom tags into the current Editor content. Custom Tag insertion is a feature that is commonly used in mailing applications or template editing in web content management systems. To use Custom Tag Insertion feature, set CustomTagList property with an array of your Custom Tags in the form of ["Caption", "Custom Tag"], for example :

oEdit1.CustomTagList = New String(,){ _
{"First Name","{%first_name%}"}, _
{"Last Name","{%last_name%}"}, _
{"Email","{%email%}"}}

#### V.2.b. Inserting Custom Links

InnovaStudio WYSIWYG Editor allows you to insert Custom Links using a javascript insertLink() method. With this feature, you can create a functionality to insert 'Internal Links' (links to other documents/files on your server).

The parameters of insertLink() method are: url, title (optional) and target (optional). For example:

oUtil.obj.insertLink("products.htm","Products","_blank");

This will insert:

<a href="products.htm" target="_blank">Products</a>

If it is applied to a selected text, the result is:

<a href="products.htm" target="_blank">selected text</a>

To create a functionality to insert 'Internal Links' you can create a custom link lookup page.

InnovaStudio WYSIWYG Editor has an optional "Internal Link" button that can be enabled to call your custom link lookup page in a window/dialog. To enable the button:

- Specify InternalLink property with a link to open your custom lookup page.
- specify InternalLinkWidth & InternalLinkHeight properties with the width & height of the window/dialog.

<editor:wysiwygeditor
Runat="server"
scriptPath="scripts/"
InternalLink="links.htm"
InternalLinkWidth=365
InternalLinkHeight=270
ID="oEdit1" />

In the above example we created custom link lookup page named links.htm. In this page you can call the Editor object (using oUtil.obj as explained before) and use insertLink() method to insert links into the current Editor content. Below is a sample Javascript implementation that you can use in links.htm:

<script>
function doInsert(url,title,target)
{
if(navigator.appName.indexOf('Microsoft')!=-1)
{/*For IE browser, use dialogArguments.oUtil.obj
to get the active editor object*/
var oEdit=dialogArguments.oUtil.obj;
oEdit.insertLink(url,title,target);
}
else
{/*For Mozilla browsers, use window.opener.oUtil.obj
to get the active editor object*/
var oEdit=window.opener.oUtil.obj;
oEdit.insertLink(url,title,target);
}
}
</script>

As seen on the code, we created a function doInsert() and then get the Editor object to be able to call the insertLink() method.

#### V.2.c. Inserting Custom HTML Content

InnovaStudio WYSIWYG Editor allows you to insert custom HTML into the current Editor content using a Javascript insertHTML() method. For example, this dropdown will insert custom html content into the Editor:

<select onchange="oUtil.obj.insertHTML(this.value)">
<option value="" selected>Insert..</option>
<option value="<h1>InnovaStudio</h1>">Company Name</option>
<option value="<img src='/images/logo.gif' />">Company Logo</option>
</select>

In the above example, we called the oUtil.obj directly, not using window.opener.oUtil.obj or dialogArguments.oUtil.obj (since it is implemented in the same page where the Editor is embedded, not implemented in a popup/dialog). You can also call the Editor object name directly, for example: oEdit1. However, using oUtil.obj is recommended if you have multiple instances of the Editor since it will refer to the current/active Edtor object (where the cursor is placed).

You can also create a custom lookup page which list your custom html content that can be inserted into the current Editor content. For this purpose, InnovaStudio WYSIWYG Editor has a 'Custom Object' button which can be enabled to open your own custom html Lookup page. To enable the 'button:

- Specify CustomObject property with a link to open your custom lookup page.
- specify CustomObjectWidth & CustomObjectHeight properties with the width & height of the window/dialog.

<editor:wysiwygeditor
Runat="server"
scriptPath="scripts/"
CustomObject="links.htm"
CustomObjectWidth=365
CustomObjectHeight=270
ID="oEdit1" />

© 2003-2005, INNOVA STUDIO (www.InnovaStudio.com). All rights reserved.