Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic editor #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

basic editor #1

wants to merge 1 commit into from

Conversation

alfister
Copy link

@alfister alfister commented Jan 2, 2025

No description provided.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Implements a basic Novel-based text editor with Tailwind styling and local storage persistence, featuring a clean UI with a collapsible sidebar and GitHub repository input.

  • Configures Novel editor extensions in /src/lib/extensions.ts with comprehensive Tailwind styling for elements like code blocks, lists, and blockquotes
  • Implements local storage persistence in /src/app/page.tsx to maintain editor state between sessions
  • Adds minimal default content structure in /src/lib/content.ts with a single text paragraph
  • Pins Novel package to version 0.5.0 in package.json for stability
  • TODO comment in extensions.ts indicates need for Tailwind autocomplete improvement via regex

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

4 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -0,0 +1,95 @@
/* From https://novel.sh/docs/guides/tailwind/extensions */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Attribution comment should be removed since this is now part of the project's source code

},
code: {
HTMLAttributes: {
class: cx("rounded-md bg-muted px-1.5 py-1 font-mono font-medium"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Extra space in class string between bg-muted and px-1.5

spellcheck: "false",
},
},
horizontalRule: false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: horizontalRule disabled here but added back as separate extension - consider using one approach for consistency

@@ -18,7 +18,7 @@
"clsx": "^2.1.1",
"lucide-react": "^0.469.0",
"next": "15.1.2",
"novel": "^0.5.0",
"novel": "0.5.0",
"react": "^19.0.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: React v19 is not yet officially released. This could cause stability issues.

Comment on lines +31 to +33
const content = window.localStorage.getItem("novel-content");
if (content) setInitialContent(JSON.parse(content));
else setInitialContent(defaultEditorContent);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: JSON.parse() could throw if content is malformed. Wrap in try/catch to prevent runtime errors.

Comment on lines 71 to 75
<EditorContent
initialContent={[]}
initialContent={initialContent}
extensions={extensions}
className="min-h-[500px] border rounded-lg"
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: No save handler implemented - content changes won't persist to localStorage

import { Menu } from 'lucide-react';

export default function Home() {
const [repoUrl, setRepoUrl] = useState('');
const [isSidebarOpen, setIsSidebarOpen] = useState(false);

const [initialContent, setInitialContent] = useState<null | JSONContent>(null);

const extensions = [...defaultExtensions];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Extensions array recreated on every render. Move outside component or use useMemo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant