InnovaStudio WYSIWYG Editor has 4 editing modes:
By default, the Editing Mode is set to HTMLBody. To specify the editing mode, use mode property. For example:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.mode="HTML";
oEdit1.REPLACE("txtContent");
</script>
Editing full HTML content is useful if you wish to save the content as a static html file. However, in many dynamic web applications today (e.g. in database-driven web applications or web content management systems where the ability to manage certain/specific area is required), the HTMLBody or XHTMLBody editing modes are more likely to be used.
InnovaStudio WYSIWYG Editor allows you to load content at runtime, which will replace the current Editor content.
Use putHTML() method to load full HTML content. The syntax is:
oEdit1.putHTML(sHTML)
where sHTML is the full HTML content. Note that putHTML() will also replace the current content style defined by arrStyle property or css property.
Use loadHTML() method to load HTML Body content. The syntax is:
oEdit1.loadHTML(sHTML)
where sHTML is the HTML Body content.
InnovaStudio WYSIWYG Editor allows you to get/read the current Editor content.
Use getHTML() method to get full HTML content. The syntax is:
oEdit1.getHTML()
Use getXHTML() method to get full HTML content with XHTML rules applied. The syntax is:
oEdit1.getXHTML()
Use getHTMLBody() method to get HTML Body content. The syntax is:
oEdit1.getHTMLBody()
Use getXHTMLBody() method to get HTML Body content with XHTML rules applied. The syntax is:
oEdit1.getXHTMLBody()
Lets' say you embed the editor in a web page located in a folder admin :
http://YourServer/admin/edit.asp
The Editor is used for editing content from a database. Then, to view the result, you read the edited content from the database and display it on another web page located in the root of your server:
http://YourServer/view.asp
In this case, you have different locations for editing & viewing (publishing): the admin folder is the Editing path and the 'root' is the Viewing/Publishing path. This will raise a problem if the edited content contains an image that has a relative path, for example:
<img src="images/photo.jpg">
The image won't be displayed when viewing the content. This is because, in Editing, it assumes that the image is located in:
http://YourServer/admin/images/photo.jpg
Whereas in Publishing, it assumes that the image is located in:
http://YourServer/images/photo.jpg
This shouldn't be a problem if both Editing and Viewing/Publishing have the same location. To make the Editing location flexible (regardless the Viewing/Publishing location), there are 2 methods:
With the above methods, the Editing location would be flexible. Means that you can use the Editor in any location on your web server, regardles where you'd like to view/publish the result.
Note:
it's a good idea to always use 'relative to root' path when inserting an image or
other objects as it doesn't generate a problem if you have different location
for Editing and Publishing (and you don't need to set the publishingPath property).
InnovaStudio WYSIWYG Editor has an Asset Manager add-on that you can use to select
a file and return the 'relative to root' path of the file.
By using the Asset Manager add-on you don’t need to set the
publishingPath property.
In IE browser, if you press [ENTER] for line break the Editor will apply <DIV> by default. In Netscape, Mozilla & Firefox, <BR> will be applied.
In IE browser, you can change the behaviour to apply <P> or <BR> by default. To apply <P> by default, set useDIV property to false:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.useDIV=false;
oEdit1.REPLACE("txtContent");
</script>
To apply <BR> by default, set useBR property to true:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.useBR=true;
oEdit1.REPLACE("txtContent");
</script>
Below are the possible values for useDIV and useBR (in IE):
useDIV | useBR | Line Break |
True | False | <DIV> * |
False | False | <P> |
True | True | <BR> |
False | True | <BR> |
* except if the current paragraph is Heading (H1-H6) or Preformatted (PRE)
You can set the useDIV and useBR properties programatically at runtime, thus allows you to change the Editor behaviour while it is running. Note that useDIV and useBR only available in IE. They will not take effect in Netscape, Mozilla and Firefox.
InnovaStudio WYSIWYG Editor can be easily integrated with ieSpell (from www.iespell.com). To enable the "Spell Check" button, set btnSpellCheck property to true:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.btnSpellCheck=true;
oEdit1.REPLACE("txtContent");
</script>
Note that this feature is available only for IE Browser.
InnovaStudio WYSIWYG Editor can also be integrated with NetSpell (from sourceforge.net/projects/netspell/). More info
To set focus the Editor, use focus() method, for example:
oEdit1.focus();
You can add custom/predefined color selection to the Editor color picker dropdown. The color picker dropdown can be accessed through "Text Foreground Color" button, "Text Background Color" button and "Pick" buttons in several editing dialogs.
To add custom color selection, set customColors property with an array of the custom colors. For example:
<script>
var oEdit1 = new InnovaEditor("oEdit1");
oEdit1.customColors=["#ff4500","#ffa500","#808000","#4682b4",
"#1e90ff","#9400d3","#ff1493","#a9a9a9"];
oEdit1.REPLACE("txtContent");
</script>