Class: ContentEditManager

Core. ContentEditManager

A manager class that controls document content editing.

new ContentEditManager(documentViewer)

Parameters:
Name Type Description
documentViewer Core.DocumentViewer

Extends

  • EventHandler

Methods


endContentEditMode()

Ends the Content Edit mode and removes 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

Type Definitions


ContentBoxProperties

An event object of content box properties.
Properties:
Name Type Description
ContentBoxProperties Object
Properties
Name Type Argument Description
id string ID of the content box.
type Core.ContentEdit.Types Determines what type of content was added or removed.
pageNumber number The page number where the content was added ore removed.
position Core.Math.Rect <optional>
The content position in viewer coordinates.
data ArrayBuffer | string <optional>
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.

Events


contentBoxAdded

Triggered when a content box (text or image) is added while in content edit mode.
Parameters:
Name Type Description
contentBoxProperties Core.ContentEditManager.ContentBoxProperties An object containing information about the added 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
contentBoxProperties Core.ContentEditManager.ContentBoxProperties An object containing information about the deleted content box.
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 digitally 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());
});