import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { cn } from "../classname.js";
import { ReactRendererComponent } from "../extensions/index.js";
import { globalLogger } from "../logger.js";
import { useRenderTime } from "../react-utils/hooks.js";
import { ToolbarView } from "./ToolbarView.js";
import { WysiwygEditorComponent } from "./WysiwygEditorComponent.js";
import "./WysiwygEditorView.css";
const b = cn('wysiwyg-editor');
export const WysiwygEditorView = (props) => {
    const { editor, autofocus, settingsVisible, toolbarVisible, toolbarConfig, hiddenActionsConfig, qa, className, toolbarClassName, children, stickyToolbar = true, toolbarDisplay, } = props;
    useRenderTime((time) => {
        globalLogger.metrics({
            component: 'wysiwyg-editor',
            event: 'render',
            duration: time,
        });
        editor.logger.metrics({
            component: 'wysiwyg-editor',
            event: 'render',
            duration: time,
        });
    });
    return (_jsxs("div", { className: b({ toolbar: toolbarVisible }, [className]), "data-qa": qa, children: [toolbarVisible ? (_jsx(ToolbarView, { qa: "g-md-toolbar-main", editor: editor, editorMode: "wysiwyg", toolbarEditor: editor, stickyToolbar: stickyToolbar, toolbarConfig: toolbarConfig, hiddenActionsConfig: hiddenActionsConfig, settingsVisible: settingsVisible, className: b('toolbar', [toolbarClassName]), toolbarDisplay: toolbarDisplay, children: children })) : null, _jsx(WysiwygEditorComponent, { autofocus: autofocus, editor: editor, className: b('editor'), children: _jsx(ReactRendererComponent, { storage: editor.renderStorage }) })] }));
};
WysiwygEditorView.displayName = 'MarkdownWysiwgEditorView';
//# sourceMappingURL=WysiwygEditorView.js.map
