Class TextEditor
Defined in: wodotexteditor.js.
Constructor Attributes | Constructor Name and Description |
---|---|
TextEditor(mainContainerElementId, editorOptions)
|
Method Attributes | Method Name and Description |
---|---|
addEventListener(eventId, callback)
Registers a callback which should be called if the given event happens.
|
|
closeDocument(callback)
Closes the document, and does cleanup.
|
|
destroy(callback)
Destructs the editor object completely.
|
|
getDocumentAsByteArray(callback)
|
|
getMetadata(property)
Returns the value of the requested document metadata field.
|
|
Returns the data set for the person that is editing the document.
|
|
Returns if the current state of the document matches the unmodified state.
|
|
openDocumentFromUrl(docUrl, callback)
Loads an ODT document into the editor.
|
|
removeEventListener(eventId, callback)
Unregisters a callback for the given event.
|
|
setDocumentModified(modified)
Sets the current state of the document to be either the unmodified state
or a modified state.
|
|
setMetadata(setProperties, removedProperties)
Sets the metadata fields from the given properties map.
|
|
setUserData(data)
Sets the data for the person that is editing the document.
|
Class Detail
TextEditor(mainContainerElementId, editorOptions)
- Parameters:
- {!string} mainContainerElementId
- {!Object.} editorOptions
Method Detail
{undefined}
addEventListener(eventId, callback)
Registers a callback which should be called if the given event happens.
- Parameters:
- {!string} eventId
- {!Function} callback
- Returns:
- {undefined}
{undefined}
closeDocument(callback)
Closes the document, and does cleanup.
- Parameters:
- {!function(!Error=):undefined} callback
- Called once the document has been closed, passes an error object in case of error
- Returns:
- {undefined}
{undefined}
destroy(callback)
Destructs the editor object completely.
- Parameters:
- {!function(!Error=):undefined} callback
- Called once the destruction has been completed, passes an error object in case of error
- Returns:
- {undefined}
{undefined}
getDocumentAsByteArray(callback)
- Parameters:
- {!function(err:?Error|file:!Uint8Array=):undefined} callback
- Called with the current document as ODT file as bytearray, passes an error object in case of error
- Returns:
- {undefined}
{?string}
getMetadata(property)
Returns the value of the requested document metadata field.
- Parameters:
- {!string} property
- A namespace-prefixed field name, for example dc:creator
- Returns:
- {?string}
{!Object.}
getUserData()
Returns the data set for the person that is editing the document.
- Returns:
- {!Object.}
{!boolean}
isDocumentModified()
Returns if the current state of the document matches the unmodified state.
- Returns:
- {!boolean}
{undefined}
openDocumentFromUrl(docUrl, callback)
Loads an ODT document into the editor.
- Parameters:
- {!string} docUrl
- url from which the ODT document can be loaded
- {!function(!Error=):undefined} callback
- Called once the document has been opened, passes an error object in case of error
- Returns:
- {undefined}
{undefined}
removeEventListener(eventId, callback)
Unregisters a callback for the given event.
- Parameters:
- {!string} eventId
- {!Function} callback
- Returns:
- {undefined}
{undefined}
setDocumentModified(modified)
Sets the current state of the document to be either the unmodified state
or a modified state.
If @p modified is @true and the current state was already a modified state,
this call has no effect and also does not remove the unmodified flag
from the state which has it set.
- Parameters:
- {!boolean} modified
- Returns:
- {undefined}
{undefined}
setMetadata(setProperties, removedProperties)
Sets the metadata fields from the given properties map.
Avoid setting certain fields since they are automatically set:
dc:creator
dc:date
meta:editing-cycles
The following properties are never used and will be removed for semantic
consistency from the document:
meta:editing-duration
meta:document-statistic
Setting any of the above mentioned fields using this method will have no effect.
- Parameters:
- {?Object.} setProperties
- A flat object that is a string->string map of field name -> value.
- {?Array.} removedProperties
- An array of metadata field names (prefixed).
- Returns:
- {undefined}
{undefined}
setUserData(data)
Sets the data for the person that is editing the document.
The supported fields are:
"fullName": the full name of the editing person
"color": color to use for the user specific UI elements
- Parameters:
- {?Object.|undefined} data
- Returns:
- {undefined}