Image

getStates #

Checks which images have been removed from the content.


let changes = this.app.image.getStates();
for (let [key, item] of Object.entries(changes)) {
    if (item.status === false) {
        // image was deleted
    }
    else {
        // image is still in the content
    }
}

insert #

Arguments
image Object

Inserts an image to content.


let image = {
    'my-image': {
        url: 'my-image.jpg'
    }
};

// insert
this.app.image.insert(image);

Inserts multiple images to the content.


let images = {
    'my-image-1': {
        url: 'my-image-1.jpg'
    },
    'my-image-2': {
        url: 'my-image-2.jpg'
    }
};

// insert
this.app.image.insert(images);

Inserts an image with link.


let image = {
    'my-image': {
        url: 'my-image.jpg',
        link: 'https://example.com'
    }
};

// insert
this.app.image.insert(image);

change #

Arguments
image Object

Changes the url of the selected image.


let image = {
    'my-image': {
        url: 'my-new-image.jpg'
    }
};

// change
this.app.image.change(image);