|
Inserting Contents, Images & Hyperlinks into Editor
If you would like to change the content of the editor during runtime, for example for passing the content from other page elements such as <textarea>, <div> or other document fields, you can use the various javascript functions as follows:
if your editor is named htmleditor, you can invoke the various javascript functions directly the following way:
htmleditor.setContent(some_html_content);
This may be associated with various event handlers such as button click or onLoad page handlers.
htmleditor.insertContent(some_html_content);
This will insert new content at the caret position. May be used to insert page fragments in already existing documents.
htmleditor.setURLEncodedContent(String htmlURLEncodedContent) - sets the content of the HTMLEditor. The content could be an html document which is URLEncoded - it will be decoded by the editor and rendered properly.
htmleditor.insertText(String plainText) -inserts plain text content inside the editor without erasing the rest of the document. The new content is inserted at the current caret position. The text inserted will take the attributes of the text at the caret position (ex. bold, italic etc.) If there is a selection, the selection will be replaced with the new text.
htmleditor.insertImage(String imageURL) -inserts an image inside the editor. It could be also relative URL - the correct resolving of the relative URLs depends on the configuration of the applet parameter absoluteDocumentTranslationURL
htmleditor.insertLink(String linkURL) -inserts a hyperlink over the selected text in the editor. For correct resolving of relative URLs if used as an applet you may cosider the Applet Edition of this product.
|