IInsertedInlineImageOptions Interface

Declares settings of an inline image.

Declaration

export interface IInsertedInlineImageOptions

Remarks

The inline image settings are used in the createInline(position, options) method.

The example below demonstrates how to create an inline image with the specified settings in the document, and add a figure caption field and image description below the image.

var imgUrl = 'https://images.unsplash.com/photo-1561037404-61cd46aa615b';
var size = new DevExpress.RichEdit.Size(richEdit.unitConverter.centimetersToTwips(12), 
    richEdit.unitConverter.centimetersToTwips(8));
var imgDescription = 'A nice dog';
// adds a figure caption and image description below the image
function insertImageDescription(img){
    richEdit.document.insertParagraph(img.interval.start);
    var positionAfterImg = img.interval.start + 2;
    richEdit.document.insertParagraph(positionAfterImg);
    richEdit.document.insertText(positionAfterImg, ' ' + img.description);
    richEdit.selection.setSelection(positionAfterImg);
    richEdit.executeCommand(DevExpress.RichEdit.ReferencesTabCommandId.CreateFigureCaptionField);
    richEdit.document.insertParagraph(positionAfterImg);
};
richEdit.document.images.createInline(richEdit.selection.active, {
    url: imgUrl, 
    actualSize: size, 
    description: imgDescription, 
    callback: insertImageDescription
});

Properties

actualSize Property

Specifies the actual size of an inline image in the document.

Declaration

actualSize: Size

Property Value

Type Description
Size

An object that contains an image size, in twips.

Remarks

var imgUrl = 'https://images.unsplash.com/photo-1561037404-61cd46aa615b';
var size = new DevExpress.RichEdit.Size(richEdit.unitConverter.centimetersToTwips(12), 
    richEdit.unitConverter.centimetersToTwips(8));
richEdit.document.images.createInline(richEdit.selection.active, {url: imgUrl, actualSize: size});

base64 Property

The image content that is encoded with base64 digits.

Declaration

base64?: string

Property Value

Type Description
string

The image content.

callback Property

Specifies a function that is called after an image is loaded to the document.

Declaration

callback?: (image: InlineImage) => void

Property Value

Type Description
(image: InlineImage) => void

The function. The image parameter returns the newly created image.

Remarks

richEdit.document.images.createInline(richEdit.selection.active, {
    url: 'https://images.unsplash.com/photo-1561037404-61cd46aa615b', description: 'A nice dog',
    callback: (function(img){console.log('The following image has been added: '+ img.description)})});

description Property

Specifies an image description.

Declaration

description?: string

Property Value

Type Description
string

The description.

Remarks

richEdit.document.images.createInline(richEdit.selection.active, {
  url: 'https://images.unsplash.com/photo-1561037404-61cd46aa615b', 
  description: 'A nice dog'
});

url Property

Specifies the image URL.

Declaration

url?: string

Property Value

Type Description
string

The image URL.

Remarks

richEdit.document.images.createInline(richEdit.selection.active, {
  url: 'https://images.unsplash.com/photo-1561037404-61cd46aa615b'
});