mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-27 02:38:45 +02:00
chore: Enhancement + New Feature (#185)
* wip * wip page * chore: style * wip pages * wip pages * chore: toggle * chore: link * feat: topic search * chore: page section * refactor: apply tailwind class ordering * fix: handle loggedIn user for guest route * feat: folder & image schema * chore: move utils to shared * refactor: tailwind class ordering * feat: img ext for editor * refactor: remove qa * fix: tanstack start * fix: wrong import * chore: use toast * chore: schema
This commit is contained in:
43
web/shared/editor/editor.tsx
Normal file
43
web/shared/editor/editor.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import * as React from "react"
|
||||
import "./styles/index.css"
|
||||
|
||||
import { EditorContent } from "@tiptap/react"
|
||||
import { Content } from "@tiptap/core"
|
||||
import { BubbleMenu } from "./components/bubble-menu"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { useLaEditor, UseLaEditorProps } from "./hooks/use-la-editor"
|
||||
|
||||
export interface LaEditorProps extends UseLaEditorProps {
|
||||
value?: Content
|
||||
className?: string
|
||||
editorContentClassName?: string
|
||||
}
|
||||
|
||||
export const LaEditor = React.memo(
|
||||
React.forwardRef<HTMLDivElement, LaEditorProps>(
|
||||
({ className, editorContentClassName, ...props }, ref) => {
|
||||
const editor = useLaEditor(props)
|
||||
|
||||
if (!editor) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn("relative flex h-full w-full grow flex-col", className)}
|
||||
ref={ref}
|
||||
>
|
||||
<EditorContent
|
||||
editor={editor}
|
||||
className={cn("la-editor", editorContentClassName)}
|
||||
/>
|
||||
<BubbleMenu editor={editor} />
|
||||
</div>
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
LaEditor.displayName = "LaEditor"
|
||||
|
||||
export default LaEditor
|
||||
Reference in New Issue
Block a user