Skip to content

Commit

Permalink
update: editor in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aolyang committed Dec 27, 2024
1 parent 7fce953 commit 3766f30
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 35 deletions.
6 changes: 3 additions & 3 deletions docs/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export default async function RootLayout({ children, params }: Props) {

const navbar = (
<Navbar
logo={(<h1 className="font-bold">Tiptiz Editor</h1>)}
logo={(<h1 className="font-bold">Tiptiz suits</h1>)}
projectLink="https://github.com/tiptiz/editor"
>
<>
<div className="hidden sm:flex">
<LocaleSwitch />
<ThemeSwitch />
</>
</div>
</Navbar>
)
const footer = (
Expand Down
9 changes: 9 additions & 0 deletions docs/src/components/page-index/Heading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function Heading() {
return (
<h1 className="home-headline">
Tiptiz suits <br />
based on <br />
Tiptap & ProseMirror
</h1>
)
}
32 changes: 32 additions & 0 deletions docs/src/components/page-index/TiptapEditor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use client"
import type { ReactNode } from "react"

import Document from "@tiptap/extension-document"
import DropCursor from "@tiptap/extension-dropcursor"
import History from "@tiptap/extension-history"
import { EditorConsumer, EditorContent, EditorContext, useEditor } from "@tiptap/react"
import TiptizSuites from "@tiptiz/rich-suits"

const extensions = [
Document,
DropCursor,
History,
TiptizSuites.configure({
// CodeBlockShiki: false
})
]
export default function TiptapEditor({ children }: { children: ReactNode }) {
const editor = useEditor({
extensions,
immediatelyRender: false,
content: "<h1>Tiptiz Editor</h1>"
})
return (
<EditorContext.Provider value={{ editor }}>
{children}
<EditorConsumer>
{({ editor: currentEditor }) => <EditorContent editor={currentEditor} />}
</EditorConsumer>
</EditorContext.Provider>
)
}
Empty file.
Empty file.
Empty file.
Empty file.
23 changes: 23 additions & 0 deletions docs/src/components/page-index/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.home-headline {
font-size: min(4rem, max(8vw, 2rem));
font-weight: 700;
font-feature-settings: initial;
letter-spacing: -0.12rem;
margin-left: -0.2rem;
margin-top: 3.4rem;
line-height: 1.1;
color: transparent;
background-image: linear-gradient(166deg, #003b76, #07c160);
background-clip: text;
}

.dark .home-headline {
background-image: linear-gradient(166deg, #2694ff, #00d164);
}

.home-headline::selection {
color: #444444;
}
.dark .home-headline::selection {
color: #dcdcdc;
}
11 changes: 0 additions & 11 deletions docs/src/components/pages/Index.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions docs/src/components/pages/index.css

This file was deleted.

12 changes: 10 additions & 2 deletions docs/src/content/en/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# index page En
---
title: "Home page"
---
import "@/components/page-index/index.css"
import Heading from "@/components/page-index/Heading"

## introduction En
<Heading/>

```bash
pnpm add @tiptiz/editor-icons
```
12 changes: 10 additions & 2 deletions docs/src/content/zh/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
---
title: "首页"
---
import Index from "@/components/pages/Index"
import "@/components/page-index/index.css"
import Heading from "@/components/page-index/Heading"
import TiptapEditor from "@/components/page-index/TiptapEditor"

<Index/>
<Heading/>

```bash
pnpm add @tiptiz/editor-icons
```

<TiptapEditor />
16 changes: 16 additions & 0 deletions packages/tiptiz-markdown-suites/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@tiptiz/markdown-suits",
"version": "0.0.1",
"license": "MIT",
"repository": "https://github.com/tiptiz/editor.git",
"author": "aolyang <[email protected]>",
"exports": {
".": {
"import": "./src/index.ts"
}
},
"devDependencies": {
},
"peerDependencies": {
}
}
Empty file.

0 comments on commit 3766f30

Please sign in to comment.