"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarkupEditorView = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const classname_1 = require("../classname.js");
const extensions_1 = require("../extensions/index.js");
const logger_1 = require("../logger.js");
const hooks_1 = require("../react-utils/hooks.js");
const MarkupEditorComponent_1 = require("./MarkupEditorComponent.js");
const ToolbarView_1 = require("./ToolbarView.js");
const context_1 = require("./toolbar/markup/context.js");
require("./MarkupEditorView.css");
const b = (0, classname_1.cn)('markup-editor');
exports.MarkupEditorView = (0, react_1.memo)((props) => {
    const { editor, autofocus, settingsVisible, toolbarVisible, toolbarConfig, hiddenActionsConfig, className, toolbarClassName, children, stickyToolbar = true, } = props;
    (0, hooks_1.useRenderTime)((time) => {
        logger_1.globalLogger.metrics({
            component: 'markup-editor',
            event: 'render',
            duration: time,
        });
        editor.logger.metrics({
            component: 'markup-editor',
            event: 'render',
            duration: time,
        });
    });
    return ((0, jsx_runtime_1.jsxs)("div", { className: b({ toolbar: toolbarVisible }, [className]), children: [toolbarVisible ? ((0, jsx_runtime_1.jsx)(context_1.MarkupToolbarContextProvider, { value: {
                    uploadHandler: editor.fileUploadHandler,
                    needToSetDimensionsForUploadedImages: editor.needToSetDimensionsForUploadedImages,
                }, children: (0, jsx_runtime_1.jsx)(ToolbarView_1.ToolbarView, { editor: editor, editorMode: "markup", toolbarEditor: editor, hiddenActionsConfig: hiddenActionsConfig, stickyToolbar: stickyToolbar, toolbarConfig: toolbarConfig, toolbarFocus: () => editor.focus(), settingsVisible: settingsVisible, className: b('toolbar', [toolbarClassName]), children: children }) })) : null, (0, jsx_runtime_1.jsx)(MarkupEditorComponent_1.MarkupEditorComponent, { autofocus: autofocus, editor: editor, className: b('editor', { 'toolbar-visible': toolbarVisible }), children: (0, jsx_runtime_1.jsx)(extensions_1.ReactRendererComponent, { storage: editor.renderStorage }) })] }));
});
exports.MarkupEditorView.displayName = 'MarkdownMarkupEditorView';
//# sourceMappingURL=MarkupEditorView.js.map
