import { ImagePaste } from "./ImagePaste/index.js";
import { ImageWidget } from "./ImageWidget/index.js";
import { ImgSizeSpecs } from "./ImgSizeSpecs/index.js";
import { addImage } from "./actions.js";
import { addImageAction } from "./const.js";
import { imgSizeNodeViewPlugin } from "./plugins/ImgSizeNodeView/index.js";
export const ImgSize = (builder, opts) => {
    builder.use(ImgSizeSpecs, opts);
    builder.use(ImageWidget, {
        imageUploadHandler: opts.imageUploadHandler,
        renderImageWidgetForm: opts.renderImageWidgetForm,
        needToSetDimensionsForUploadedImages: Boolean(opts.needToSetDimensionsForUploadedImages),
        enableNewImageSizeCalculation: Boolean(opts.enableNewImageSizeCalculation),
    });
    if (opts.imageUploadHandler || opts.parseInsertedUrlAsImage) {
        builder.use(ImagePaste, {
            imageUploadHandler: opts.imageUploadHandler,
            needDimensions: Boolean(opts.needToSetDimensionsForUploadedImages),
            parseInsertedUrlAsImage: opts.parseInsertedUrlAsImage,
            enableNewImageSizeCalculation: opts.enableNewImageSizeCalculation,
        });
    }
    builder.addAction(addImageAction, ({ schema }) => addImage(schema));
    builder.addPlugin(imgSizeNodeViewPlugin);
};
//# sourceMappingURL=index.js.map
