Skip to content

Commit

Permalink
Merge pull request steven-tey#87 from eyalcohen4/main
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey authored Sep 1, 2023
2 parents dba0eb1 + e20f3cd commit 5f2f944
Show file tree
Hide file tree
Showing 78 changed files with 7,631 additions and 1,148 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extends": ["next/core-web-vitals", "eslint:recommended"]
"root": true,
// This tells ESLint to load the config from the package `eslint-config-custom`
"extends": ["next/core-web-vitals", "eslint:recommended"],
"settings": {
"next": {
"rootDir": ["apps/*/"]
}
}
}
39 changes: 0 additions & 39 deletions .github/workflows/playwright.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
/.pnp
.pnp.js

node_modules
packages/*/node_modules
apps/*/node_modules
.next

# next.js
/.next/
/out/
Expand Down Expand Up @@ -34,6 +39,12 @@ next-env.d.ts

# vscode
.vscode

dist/**
/dist
packages/*/dist

.turbo
/test-results/
/playwright-report/
/playwright/.cache/
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<p align="center">
<a href="#introduction"><strong>Introduction</strong></a> ·
<a href="#installation"><strong>Installation</strong></a> ·
<a href="#deploy-your-own"><strong>Deploy Your Own</strong></a> ·
<a href="#setting-up-locally"><strong>Setting Up Locally</strong></a> ·
<a href="#tech-stack"><strong>Tech Stack</strong></a> ·
Expand All @@ -29,12 +30,45 @@

[Novel](https://novel.sh/) is a Notion-style WYSIWYG editor with AI-powered autocompletions.

Here's a quick 30-second demo:

https://github.com/steven-tey/novel/assets/28986134/2099877f-4f2b-4b1c-8782-5d803d63be5c

<br />

## Installation

To use Novel in a project, you can run the following command to install the `novel` NPM package:

```
npm i novel
```

Then, you can use it in your code like this:

```
import { Editor } from "novel";
import "novel/styles.css";
export default function App() {
return (
<Editor />
)
}
```

The `Edtior` is a React component that takes in the following props:

| Prop | Type | Description | Default |
| ------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `completionApi` | `string` | The API route to use for the OpenAI completion API. | `/api/generate` |
| `defaultValue` | `string` | The default value to use for the editor. | [`defaultEditorContent`](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/default-content.tsx) |
| `extensions` | `Extension[]` | A list of extensions to use for the editor, in addition to the [default Novel extensions](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/extensions/index.tsx). | `[]` |
| `editorProps` | `EditorProps` | Props to pass to the underlying Tiptap editor, in addition to the [default Novel editor props](https://github.com/steven-tey/novel/blob/main/packages/core/src/ui/editor/props.ts). | `{}` |
| `onUpdate` | `(content: JSONContent) => void` | A callback function that is called whenever the editor's value is updated. | `() => {}` |
| `onDebouncedUpdate` | `(content: JSONContent) => void` | A callback function that is called whenever the editor's value is updated, but only after the defined debounce duration. | `() => {}` |
| `debounceDuration` | `number` | The duration (in milliseconds) to debounce the `onDebouncedUpdate` callback. | `750` |

Here's an example application: https://github.com/steven-tey/novella

## Deploy Your Own

You can deploy your own version of Novel to Vercel with one click:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion app/layout.tsx → apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "@/styles/globals.css";
import "@/styles/prosemirror.css";

import { Metadata } from "next";
import { ReactNode } from "react";
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions app/page.tsx → apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Github } from "@/ui/icons";
import Menu from "@/ui/menu";
import Editor from "@/ui/editor";
import Github from "@/ui/icons/github";
import Menu from "./menu";

export default function Page() {
return (
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions apps/web/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
File renamed without changes.
59 changes: 59 additions & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "novel-next-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"format:write": "prettier --write \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",
"lint": "next lint"
},
"dependencies": {
"@radix-ui/react-popover": "^1.0.6",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-color": "^2.0.3",
"@tiptap/extension-highlight": "^2.0.3",
"@tiptap/extension-horizontal-rule": "^2.0.3",
"@tiptap/extension-image": "^2.0.3",
"@tiptap/extension-link": "^2.0.0-beta.220",
"@tiptap/extension-placeholder": "2.0.3",
"@tiptap/extension-task-item": "^2.0.3",
"@tiptap/extension-task-list": "^2.0.3",
"@tiptap/extension-text-style": "^2.0.3",
"@tiptap/extension-underline": "^2.0.3",
"@tiptap/pm": "^2.0.0-beta.220",
"@tiptap/react": "^2.0.3",
"@tiptap/starter-kit": "^2.0.0-beta.220",
"@tiptap/suggestion": "^2.0.3",
"@types/node": "18.15.3",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@upstash/ratelimit": "^0.4.3",
"@vercel/analytics": "^1.0.1",
"@vercel/blob": "^0.9.2",
"@vercel/kv": "^0.2.1",
"ai": "^2.1.3",
"clsx": "^1.2.1",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"eventsource-parser": "^0.1.0",
"framer-motion": "^10.12.18",
"lucide-react": "^0.244.0",
"next": "13.4.8-canary.14",
"novel": "workspace:^",
"openai-edge": "^1.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^8.0.5",
"sonner": "^0.7.0",
"tippy.js": "^6.3.7",
"tiptap-markdown": "^0.8.1",
"typescript": "4.9.5",
"use-debounce": "^9.0.3"
},
"devDependencies": {
"tailwind-config": "workspace:*"
}
}
Loading

0 comments on commit 5f2f944

Please sign in to comment.