diff --git a/apps/website/src/app/components/editor/page.tsx b/apps/website/src/app/components/editor/page.tsx index 417503484..6c9eeda63 100644 --- a/apps/website/src/app/components/editor/page.tsx +++ b/apps/website/src/app/components/editor/page.tsx @@ -13,23 +13,48 @@ const defaultContent = `
-Integration with shadcn/cli +Easy Integration -

To ensure seamless integration and consistency within our codebase, we utilize the shadcn/cli tool. This CLI allows us to install all necessary dependencies and components directly into our project repository, maintaining a cohesive structure and simplifying management of the editor and its associated elements.

+

To ensure seamless integration and consistency within your codebase, we've made it easy to add the Midday Editor to your project. You can simply copy and paste the necessary code from our dedicated documentation. This method allows you to quickly incorporate all required dependencies and components directly into your project repository.


-

If you already have shadcn/cli installed, you can run this command:

+

We're actively working on adding the Midday Editor to the shadcn/cli, which will soon allow you to install it with just one command. Stay tuned for this upcoming feature!


-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum convallis congue tellus a lobortis. Curabitur sed velit at sem sagittis accumsan. Quisque non tortor eu orci rutrum iaculis. Nullam tincidunt bibendum lacus, eu dignissim nunc congue at. +Ongoing Development + +

As we continue to develop and expand Midday's features, we're constantly adding new functionality to the editor. Our team is committed to enhancing its capabilities, improving performance, and introducing innovative AI-powered tools to make your editing experience even more powerful and efficient.

+ +
`; export default function Page() { return (
+ +
+
+
+

Install Midday Editor

+

+ Get started with our powerful AI-enhanced text editor +

+
+
+ + View implementation + +
+
+
); } diff --git a/bun.lockb b/bun.lockb index 1c3a6c351..9a42a5183 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/ui/package.json b/packages/ui/package.json index 3a79ae011..e401b7f82 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -108,7 +108,12 @@ "@storybook/addon-themes": "^8.3.5", "@storybook/manager-api": "^8.3.5", "@tiptap/extension-bold": "^2.9.1", + "@tiptap/extension-document": "^2.9.1", + "@tiptap/extension-link": "^2.9.1", + "@tiptap/extension-paragraph": "^2.9.1", "@tiptap/extension-placeholder": "^2.9.1", + "@tiptap/extension-text": "^2.9.1", + "@tiptap/extension-underline": "^2.9.1", "@tiptap/pm": "^2.9.1", "@tiptap/react": "^2.9.1", "@tiptap/starter-kit": "^2.9.1", diff --git a/packages/ui/src/components/editor/extentions/register.ts b/packages/ui/src/components/editor/extentions/register.ts index 292c25ee8..194ee607b 100644 --- a/packages/ui/src/components/editor/extentions/register.ts +++ b/packages/ui/src/components/editor/extentions/register.ts @@ -1,3 +1,6 @@ +// You can find the list of extensions here: https://tiptap.dev/docs/editor/extensions/functionality + +import Link from "@tiptap/extension-link"; import Placeholder from "@tiptap/extension-placeholder"; import StarterKit from "@tiptap/starter-kit"; @@ -5,4 +8,8 @@ import StarterKit from "@tiptap/starter-kit"; export const extensions = [ StarterKit, Placeholder.configure({ placeholder: "Write something..." }), + Link.configure({ + openOnClick: false, + defaultProtocol: "https", + }), ]; diff --git a/packages/ui/src/components/editor/index.tsx b/packages/ui/src/components/editor/index.tsx index 955556132..5d06d2185 100644 --- a/packages/ui/src/components/editor/index.tsx +++ b/packages/ui/src/components/editor/index.tsx @@ -2,18 +2,22 @@ import "./styles.css"; -import { EditorContent, useEditor } from "@tiptap/react"; +import { EditorContent, type JSONContent, useEditor } from "@tiptap/react"; import { BubbleMenu } from "./extentions/bubble-menu"; import { extensions } from "./extentions/register"; type EditorProps = { content?: string; + onChange?: (content: JSONContent) => void; }; -export function Editor({ content }: EditorProps) { +export function Editor({ content, onChange }: EditorProps) { const editor = useEditor({ extensions, content, + onUpdate: ({ editor }) => { + onChange?.(editor.getJSON()); + }, }); return (