Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.4 KB
Raw Blame
import { MakeLogicType, kea, key, path, props, selectors } from 'kea'

import { RichContentEditorType, TTEditor } from './types'
import { createEditor } from './utils'

export interface RichContentEditorLogicProps {
    logicKey: string
    editor: TTEditor
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface richContentEditorLogicValues {
    richContentEditor: RichContentEditorType
    ttEditor: TTEditor
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface richContentEditorLogicMeta {
    key: string
    __keaTypeGenInternalSelectorTypes: {
        ttEditor: (editor: TTEditor) => TTEditor
        richContentEditor: (ttEditor: TTEditor) => RichContentEditorType
    }
}

export type richContentEditorLogicType = MakeLogicType<
    richContentEditorLogicValues,
    {},
    RichContentEditorLogicProps,
    richContentEditorLogicMeta
>

export const richContentEditorLogic = kea<richContentEditorLogicType>([
    path(['lib', 'components', 'RichContentEditor', 'richContentEditorLogic']),
    props({} as RichContentEditorLogicProps),
    key(({ logicKey }) => `RichContentEditor.${logicKey}`),
    selectors({
        ttEditor: [(_, p) => [p.editor], (editor: TTEditor): TTEditor => editor],
        richContentEditor: [(s) => [s.ttEditor], (ttEditor: TTEditor): RichContentEditorType => createEditor(ttEditor)],
    }),
])