"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImgSize = void 0;
const ImagePaste_1 = require("./ImagePaste/index.js");
const ImageWidget_1 = require("./ImageWidget/index.js");
const ImgSizeSpecs_1 = require("./ImgSizeSpecs/index.js");
const actions_1 = require("./actions.js");
const const_1 = require("./const.js");
const ImgSizeNodeView_1 = require("./plugins/ImgSizeNodeView/index.js");
const ImgSize = (builder, opts) => {
    builder.use(ImgSizeSpecs_1.ImgSizeSpecs, opts);
    builder.use(ImageWidget_1.ImageWidget, {
        imageUploadHandler: opts.imageUploadHandler,
        needToSetDimensionsForUploadedImages: Boolean(opts.needToSetDimensionsForUploadedImages),
    });
    if (opts.imageUploadHandler || opts.parseInsertedUrlAsImage) {
        builder.use(ImagePaste_1.ImagePaste, {
            imageUploadHandler: opts.imageUploadHandler,
            needDimensions: Boolean(opts.needToSetDimensionsForUploadedImages),
            parseInsertedUrlAsImage: opts.parseInsertedUrlAsImage,
            enableNewImageSizeCalculation: opts.enableNewImageSizeCalculation,
        });
    }
    builder.addAction(const_1.addImageAction, ({ schema }) => (0, actions_1.addImage)(schema));
    builder.addPlugin(ImgSizeNodeView_1.imgSizeNodeViewPlugin);
};
exports.ImgSize = ImgSize;
//# sourceMappingURL=index.js.map
