Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

This function retrieves the contents of the EditLive! applet, according to the returnBodyOnly setting.

Info

This method is new in EditLive! 8.1.

Syntax

JavaScript
Code Block
String editliveInstance.getContent([jsFunct],[blnUploadImages]);

Parameters

jsFunct

This parameter is optional.

The JavaScript function which receives the retrieved EditLive! applet contents.

blnUploadImages

This parameter is optional.

This is a boolean which indicates whether images should be uploaded to the server when this function is called. The uploading of images will occur immediately before the content is retrieved.

The default value is false.

Returns

The contents of the EditLive! editor. This will either be a full HTML document, or the contents within the <body> tag, according to the returnBodyOnly setting.

Synchronous Example (EditLive 8.1+)

Calling getContent synchronously returns the appropriate contents of the editor as a string. This example retrieves the contents of the editor and then saves the retrieved contents to a <textarea> with the ID of contents. Images will be uploaded to the server when getContent is called as blnUploadImages is set to true. The name of the EditLive applet is editlive_js.

Code Block
languagejavascript
document.getElementById('contents').value = editlivejs.getContent();

Asynchronous Example (EditLive 8.1+)

When calling getContent asynchronously you must provide a JavaScript function as the callback parameter for the getContent method. In this example the retrieveContent callback function receives the appropriate contents of the editor as a string. Images will be uploaded to the server when getContent is called as blnUploadImages is set to true. The name of the EditLive applet is editlive_js.

Code Block
languagejavascript
editlive_js.getContent("retrieveContent", true);

The retrieveContent function receives the contents of the editor and then saves the retrieved contents to a <textarea> with the name bodyContents.

Code Block
languagejavascript
function retrieveContent(src){
        document.exampleForm.bodyContent.value = src;
     }

Remarks

When uploading locally stored images to a web server for an instance of EditLive!, ensure that the blnUploadImages parameter is set to true when calling this method.

See Also