commajs
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"; //if needed

options = {
    ...,                
    plugins: [
        ...,
        { 
            pClass: CommaImage,
            options: {
                externalFunctions: {
                    SaveEditedImage: (dataUri, oldUrl) => {
                        //dataUri = data:image/png;base64,....
                        return new Promise((res,rej) => {
                            // You should probably save the edited image to your servers 
                            // and return the url of the image
                            // Here we just embed the dataUri in the document:
                            res(dataUri);
                        });
                    }                    
                    MarkFileForDelete: (url) => {}, //when image is deleted
                    KeepFileFromDelete: (url) => {} //when image is added
                },
                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"
});
 
© 2020 Plugg, Inc. All rights reserved. Various trademarks held by their respective owners.
Plugg, Inc. - San Francisco, CA 94114, United States