Images
Introduction
This plugin adds support for images.
Installation
npm install commajs-image
In commajs-core options add:
import CommaImage from "commajs-image";
import CommaImageEditor from "commajs-image-editor";
options = {
...,
plugins: [
...,
{
pClass: CommaImage,
options: {
externalFunctions: {
SaveEditedImage: (dataUri, oldUrl) => {
return new Promise((res,rej) => {
res(dataUri);
});
}
MarkFileForDelete: (url) => {},
KeepFileFromDelete: (url) => {}
},
imageEditor: CommaImageEditor
}
}
]
}
SaveEditedImage is needed only if you intend to use our
Image Editor.
MarkFileForDelete and KeepFileFromDelete are fired when an image is removed or added to the document.
Styling
Images require
Font Awesome 4 and they are styled using the css file that you can find in the commajs-image package.
Usage
To add an image to a document:
commajsInstance.InsertPluginAtSection(CommaImage.GetName(), {
link: ".../example.png"
});