import React from 'react';
import { Loader } from '@wix/design-system';
import { ensureRicosContent, fromPlainText, toPlainTextSync, } from '@wix/ricos/content';
import { defineCellType } from '../../types';
import { RichContentView } from './View';
const richContentEditFactory = () => import(/* webpackChunkName: "EditableTableRichContentEdit" */ './Edit');
if (process.env.STORYBOOK_VISUAL_E2E !== 'true') {
    richContentEditFactory();
}
const LazyRichContentEdit = React.lazy(richContentEditFactory);
const RichContentEdit = (props) => (React.createElement(React.Suspense, { fallback: React.createElement(Loader, { size: "tiny" }) },
    React.createElement(LazyRichContentEdit, { ...props })));
export const richContentCellType = defineCellType({
    type: 'richContent',
    ViewComponent: RichContentView,
    EditComponent: RichContentEdit,
    /** Serialize to single-line plain text for TSV clipboard. */
    serialize: (value) => {
        if (!value) {
            return '';
        }
        return toPlainTextSync(ensureRicosContent(value), {
            delimiter: ' ',
        });
    },
    /** Deserialize a pasted plain-text string back to a minimal Ricos document. */
    deserialize: (raw) => (raw ? fromPlainText(raw) : null),
    editable: true,
    clearable: false,
    onTypeToEdit: () => ({}),
});
//# sourceMappingURL=index.js.map