"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WysiwygEditorView = 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 ToolbarView_1 = require("./ToolbarView.js");
const WysiwygEditorComponent_1 = require("./WysiwygEditorComponent.js");
require("./WysiwygEditorView.css");
const b = (0, classname_1.cn)('wysiwyg-editor');
exports.WysiwygEditorView = (0, react_1.memo)((props) => {
    const { editor, autofocus, settingsVisible, toolbarVisible, toolbarConfig, hiddenActionsConfig, qa, className, toolbarClassName, children, stickyToolbar = true, } = props;
    (0, hooks_1.useRenderTime)((time) => {
        logger_1.globalLogger.metrics({
            component: 'wysiwyg-editor',
            event: 'render',
            duration: time,
        });
        editor.logger.metrics({
            component: 'wysiwyg-editor',
            event: 'render',
            duration: time,
        });
    });
    return ((0, jsx_runtime_1.jsxs)("div", { className: b({ toolbar: toolbarVisible }, [className]), "data-qa": qa, children: [toolbarVisible ? ((0, jsx_runtime_1.jsx)(ToolbarView_1.ToolbarView, { editor: editor, editorMode: "wysiwyg", toolbarEditor: editor, stickyToolbar: stickyToolbar, toolbarConfig: toolbarConfig, toolbarFocus: () => editor.focus(), hiddenActionsConfig: hiddenActionsConfig, settingsVisible: settingsVisible, className: b('toolbar', [toolbarClassName]), children: children })) : null, (0, jsx_runtime_1.jsx)(WysiwygEditorComponent_1.WysiwygEditorComponent, { autofocus: autofocus, editor: editor, className: b('editor'), children: (0, jsx_runtime_1.jsx)(extensions_1.ReactRendererComponent, { storage: editor.renderStorage }) })] }));
});
exports.WysiwygEditorView.displayName = 'MarkdownWysiwgEditorView';
//# sourceMappingURL=WysiwygEditorView.js.map
