Class: ContentEditManager

Core. ContentEditManager

A manager class that controls document content editing

new ContentEditManager()

Extends

  • EventHandler

Methods


endContentEditMode()

Ends the Content Edit mode, re-enabling links and removing content edit boxes from the document.

getContentBoxAttributes(contentBoxId)

Gets the text attributes applied to the content edit box.
Parameters:
Name Type Description
contentBoxId string The id of the content box.
Returns:
Resolves to an object of text attrbutes.
Type
Promise.<Object>

getContentBoxById(id)

Gets a content box instance by its id.
Parameters:
Name Type Description
id string The content box ID
Returns:
The content box instance
Type
Core.ContentEdit.ContentBox

isInContentEditMode()

Gets if the Content Edit manager is currently in content edit mode
Returns:
Type
boolean

startContentEditMode()

Starts the Content Edit mode, a mode in which links are disabled and boxes are drawn around all editable content so users can edit them

toggleInvisibleCharacters()

Toggles the visibility of invisible characters in the content edit boxes

Events


contentBoxAdded

Triggered when a content box (text or image) is added while in content edit mode.
Parameters:
Name Type Description
contentBox object An object containing information about the added content box.
Properties
Name Type Description
id string ID of the added content box.
type string Determines what type of content was added. Either "text" or "image".
pageNumber number The page number where the content was added.
position Core.Math.Rect The content position in viewer coordinates.
data ArrayBuffer | string If type is image the data will be an ArrayBuffer of image data. Otherwise the data is an HTML string representing the inner styling and text of the content box.
Example
const { Core } = instance;
const { documentViewer } = Core;
const contentEditManager = documentViewer.getContentEditManager();
contentEditManager.addEventListener('contentBoxAdded', (contentBox) => {
  console.log(contentBox.id);
  console.log(contentBox.type);
  console.log(contentBox.pageNumber);
  console.log(contentBox.position);
  console.log(contentBox.data);
});

contentBoxDeleted

Triggered when a content box (text or image) is deleted while in content edit mode.
Parameters:
Name Type Description
contentBox object An object containing information about the deleted content box.
Properties
Name Type Description
id string ID of the deleted content box.
type string Determines what type of content was deleted. Either "text" or "image".
pageNumber number The page number where the content was deleted.
Example
const { Core } = instance;
const { documentViewer } = Core;
const contentEditManager = documentViewer.getContentEditManager();
contentEditManager.addEventListener('contentBoxDeleted', (contentBox) => {
  console.log(contentBox.id);
  console.log(contentBox.type);
  console.log(contentBox.pageNumber);
});

contentBoxEditEnded

Triggered when a Content edit box has ended being edited.

contentBoxEditStarted

Triggered when a Content edit box has started being edited.
Returns:
The content box editor instance.
Type
Core.ContentEdit.ContentBoxEditor

contentEditDocumentDigitallySigned

Triggered when a document is digital signed in Content Edit mode.

contentEditModeEnded

Triggered when Content Edit mode is ended.

contentEditModeStarted

Triggered when Content Edit mode is started.

contentEditSelectionChange

Triggered when a text selection has changed in a content edit box.
Type: SelectionChangeEvent
Parameters:
Name Type Description
selectionChangeEvent object The JavaScript event object for the native selectionchange event.
Example
const { Core } = instance;
const { documentViewer } = Core;
const contentEditManager = documentViewer.getContentEditManager();
contentEditManager.addEventListener('contentEditSelectionChange', (selectionChangeEvent) => {
 console.log(selectionChangeEvent.event.target.getSelection().toString());
});