/** * @copyright 2009-2019 Vanilla Forums Inc. * @license GPL-2.0-only */ import { Omit } from "@library/@types/utils"; import React from "react"; import { IWithEditorProps, useEditor } from "@rich-editor/editor/context"; import { useEditorContents } from "@rich-editor/editor/contentContext"; /** * Map a quill context to props. * * @param WrappedComponent - The component to map. * * @returns A component with a quill context injected as props. */ export function withEditor(WrappedComponent: React.ComponentType) { type Omitted = Omit; function ComponentWithEditor(props: Omitted) { const context = useEditor(); const content = useEditorContents(); return ; } ComponentWithEditor.displayName = WrappedComponent.displayName || WrappedComponent.name || "Component"; return ComponentWithEditor as React.ComponentType; }