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

Remove toolbar from the alpha editor #1114

Merged
merged 7 commits into from
Oct 14, 2024

Conversation

MichaelMoyles
Copy link
Contributor

✨ Codu Pull Request 💻

Fixes #1028

Pull Request details

Removed the toolbar & other unused features below:

  • Strikethrough
  • Codeblock
  • Text alignment
  • Superscript
  • Subscript
  • Table
  • Color Selector
  • Highlighting
  • Underline

Any Breaking changes

  • None

Associated Screenshots

Screenshot2 Screenshot1

@MichaelMoyles MichaelMoyles requested a review from a team as a code owner October 13, 2024 12:33
Copy link

vercel bot commented Oct 13, 2024

@MichaelMoyles is attempting to deploy a commit to the Codú Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Oct 13, 2024

Walkthrough

The pull request involves significant modifications to the editor components, primarily focusing on the removal of various features to simplify the editor's functionality. Key changes include the deletion of the Toolbar, CodeBlock, CustomTableNodeView, and ColorSelector components, along with their associated styles. Additionally, several Tiptap extensions have been removed, and the RenderPost component has been updated to exclude the CustomCodeBlockReadOnly extension. The overall structure of the editor remains intact, but with a reduced set of features.

Changes

File Path Change Summary
components/editor/editor/RenderPost.tsx Removed CustomCodeBlockReadOnly from extensions array in useEditor hook.
components/editor/editor/components/CodeBlock/* Deleted CodeBlock.tsx and CodeBlock.module.css.
components/editor/editor/components/Table/* Deleted CustomTableNodeView.tsx.
components/editor/editor/components/Toolbar/* Deleted Toolbar.tsx, Toolbar.module.css, and ToolbarItemButton.tsx.
components/editor/editor/components/bubble-menu.tsx Removed "strike" formatting option from EditorBubbleMenu.
components/editor/editor/components/color-selector.tsx Deleted ColorSelector.tsx and associated interfaces.
components/editor/editor/extensions/index.tsx Removed several Tiptap extensions and updated TiptapExtensions array.
components/editor/editor/index.tsx Removed Toolbar component from the editor's rendering logic.

Assessment against linked issues

Objective Addressed Explanation
Remove toolbar from the alpha editor (Issue #1028)
Remove unused features including strikethrough and codeblock (Issue #1028)

Possibly related PRs

Suggested reviewers

  • NiallJoeMaher
  • John-Paul-Larkin

🐰 In a world of code, so bright and new,
We bid farewell to blocks and buttons too.
With a simpler path, our editor gleams,
A canvas for creativity, fueled by dreams!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
components/editor/editor/index.tsx (1)

Line range hint 36-38: Address the TODO comment regarding accessibility

There's an unaddressed TODO comment about accessibility issues:

// TODO: Review this for no-static-element-interactions click-events-have-key-events

This comment highlights potential accessibility concerns that should be addressed. Consider implementing keyboard event handlers to improve accessibility or use a more semantic HTML element if possible.

Would you like assistance in implementing a solution for this accessibility issue?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d45d070 and a6a83e9.

📒 Files selected for processing (11)
  • components/editor/editor/RenderPost.tsx (2 hunks)
  • components/editor/editor/components/CodeBlock/CodeBlock.module.css (0 hunks)
  • components/editor/editor/components/CodeBlock/CodeBlock.tsx (0 hunks)
  • components/editor/editor/components/Table/CustomTableNodeView.tsx (0 hunks)
  • components/editor/editor/components/Toolbar/Toolbar.module.css (0 hunks)
  • components/editor/editor/components/Toolbar/Toolbar.tsx (0 hunks)
  • components/editor/editor/components/Toolbar/ToolbarItemButton.tsx (0 hunks)
  • components/editor/editor/components/bubble-menu.tsx (0 hunks)
  • components/editor/editor/components/color-selector.tsx (0 hunks)
  • components/editor/editor/extensions/index.tsx (0 hunks)
  • components/editor/editor/index.tsx (1 hunks)
💤 Files with no reviewable changes (9)
  • components/editor/editor/components/CodeBlock/CodeBlock.module.css
  • components/editor/editor/components/CodeBlock/CodeBlock.tsx
  • components/editor/editor/components/Table/CustomTableNodeView.tsx
  • components/editor/editor/components/Toolbar/Toolbar.module.css
  • components/editor/editor/components/Toolbar/Toolbar.tsx
  • components/editor/editor/components/Toolbar/ToolbarItemButton.tsx
  • components/editor/editor/components/bubble-menu.tsx
  • components/editor/editor/components/color-selector.tsx
  • components/editor/editor/extensions/index.tsx
🧰 Additional context used
🔇 Additional comments (4)
components/editor/editor/index.tsx (4)

Line range hint 36-53: Toolbar removal aligns with PR objectives

The removal of the Toolbar component from the render tree aligns well with the PR objective of simplifying the editor interface. Good job on implementing this change.


Line range hint 1-53: Summary of review findings

  1. The removal of the Toolbar component aligns with the PR objectives.
  2. The addition of the TiptapExtensions import needs verification or removal if unused.
  3. The editor configuration may need adjustment to fully align with the simplified feature set described in the PR objectives.
  4. The accessibility TODO comment should be addressed to improve the component's accessibility.
  5. The functionality of the EditorBubbleMenu should be verified to ensure it provides the intended simplified set of formatting options.

Overall, the changes are moving in the right direction, but some refinements and verifications are needed to fully meet the PR objectives and maintain code quality.


Line range hint 47-49: Verify EditorBubbleMenu functionality

The EditorBubbleMenu component is still present in the render tree. Given the PR objectives to simplify the interface and make editing functionalities accessible via a slash menu and tooltips, please verify that:

  1. The EditorBubbleMenu provides the intended simplified set of formatting options.
  2. It doesn't reintroduce any of the removed features (strikethrough, codeblock, etc.).
  3. It aligns with the described slash menu and tooltip functionality.

Let's check the implementation of EditorBubbleMenu:

#!/bin/bash
# Description: Check the implementation of EditorBubbleMenu

# Test: Display the contents of the file containing EditorBubbleMenu
fd -e ts -e tsx -e js -e jsx --exec cat {} | rg -A 30 "export (const|function) EditorBubbleMenu"

Line range hint 21-25: Review editor extensions for consistency with PR objectives

The current editor configuration retains extensions like StarterKit, Highlight, and Typography. This seems inconsistent with the PR objective of removing features such as strikethrough, codeblock, and text alignment options.

Please review the extensions and consider:

  1. Removing or customizing StarterKit to exclude unwanted features.
  2. Verifying if Highlight and Typography extensions are still needed.
  3. Updating TiptapEditorProps to reflect the reduced feature set.

This will ensure that the editor's capabilities align with the simplified interface described in the PR objectives.

Let's check the contents of the TiptapEditorProps:

@@ -11,7 +11,7 @@ const RenderPost = ({ json }: RenderPostProps) => {

const editor = useEditor({
editable: false,
extensions: [...TiptapExtensions, CustomCodeBlockReadOnly],
extensions: [...TiptapExtensions],
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Please address the remaining usages of removed extensions.

The search identified several instances of removed extensions such as table and underline in the following files:

  • utils/createPasswordLessEmailTemplate.ts
  • utils/createEmailTemplate.ts
  • components/editor/editor/RenderPost.tsx
  • server/trpc/react.tsx
  • components/ui/Search.tsx
  • and others.

Please verify and remove or update these usages to ensure consistency with the PR objectives.

🔗 Analysis chain

LGTM! Verify removed extensions.

The change aligns with the PR objectives of simplifying the editor by removing unused features. The CustomCodeBlockReadOnly extension has been removed, leaving only the core TiptapExtensions.

To ensure consistency across the codebase, let's verify that the removed extensions are not being used elsewhere:

This script will help us confirm that the removed extensions are not being used in other parts of the codebase, ensuring that the simplification is consistent throughout the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining usage of removed extensions

# Test 1: Search for CustomCodeBlockReadOnly
echo "Searching for CustomCodeBlockReadOnly usage:"
rg "CustomCodeBlockReadOnly" --type typescript --type tsx

# Test 2: Search for other removed extensions mentioned in the PR objectives
echo "Searching for other removed extensions:"
rg -e "strikethrough" -e "codeblock" -e "text alignment" -e "superscript" -e "subscript" -e "table" -e "color selector" -e "highlighting" -e "underline" --type typescript --type tsx

Length of output: 485


Script:

#!/bin/bash
# Description: Check for any remaining usage of removed extensions by specifying file extensions

# Test 1: Search for CustomCodeBlockReadOnly
echo "Searching for CustomCodeBlockReadOnly usage:"
rg "CustomCodeBlockReadOnly" -g "*.ts" -g "*.tsx"

# Test 2: Search for other removed extensions mentioned in the PR objectives
echo "Searching for other removed extensions:"
rg -e "strikethrough" -e "codeblock" -e "text alignment" -e "superscript" -e "subscript" -e "table" -e "color selector" -e "highlighting" -e "underline" -g "*.ts" -g "*.tsx"

Length of output: 15375


Script:

#!/bin/bash
# Description: Check for any remaining usage of removed extensions by specifying file extensions

# Test 1: Search for CustomCodeBlockReadOnly
echo "Searching for CustomCodeBlockReadOnly usage:"
rg "CustomCodeBlockReadOnly" -g "*.ts" -g "*.tsx"

# Test 2: Search for other removed extensions mentioned in the PR objectives
echo "Searching for other removed extensions:"
rg -e "strikethrough" -e "codeblock" -e "text alignment" -e "superscript" -e "subscript" -e "table" -e "color selector" -e "highlighting" -e "underline" -g "*.ts" -g "*.tsx"

Length of output: 15375

@@ -5,10 +5,9 @@ import Typography from '@tiptap/extension-typography'
import { EditorContent, useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import { TiptapEditorProps } from "./props";
import { CustomCodeBlockEdit, TiptapExtensions } from "./extensions";
import { TiptapExtensions } from "./extensions";
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Unused TiptapExtensions import identified

The TiptapExtensions import in components/editor/editor/index.tsx is not used within this file. Please either implement its usage or remove the unused import to maintain code cleanliness.

  • File: components/editor/editor/index.tsx, Line: 8
🔗 Analysis chain

Verify the usage of TiptapExtensions import

The TiptapExtensions import has been added, but it doesn't appear to be used within this file. This could indicate either:

  1. Incomplete changes where the import is intended to be used but the implementation is missing.
  2. An unnecessary import that should be removed.

Please review and either implement the usage of TiptapExtensions or remove the unused import.

Let's verify if TiptapExtensions is used elsewhere in the codebase:


Retry searching for TiptapExtensions usage with corrected file types

Let's rerun the search using the correct file type identifiers to ensure we capture all instances of TiptapExtensions.


Retry searching for TiptapExtensions usage with glob patterns

Let's rerun the search using glob patterns to accurately target .ts and .tsx files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of TiptapExtensions in the codebase

# Test: Search for TiptapExtensions usage
rg --type typescript --type tsx "TiptapExtensions"

Length of output: 85


Script:

#!/bin/bash
# Description: Re-check usage of TiptapExtensions in TypeScript and TSX files

rg --type ts --type tsx "TiptapExtensions"

Length of output: 70


Script:

#!/bin/bash
# Description: Re-check usage of TiptapExtensions in TypeScript and TSX files using glob patterns

rg "TiptapExtensions" -g "*.ts" -g "*.tsx"

Length of output: 374

@John-Paul-Larkin
Copy link
Member

Hey @MichaelMoyles
I looked over this PR and it looks good to me. Thanks.
However, I was unable to test the slash menu, because it seems to have been disabled in PR #1068
I think we can merge this @NiallJoeMaher and worry about fixing that later.

@NiallJoeMaher
Copy link
Contributor

Hey @MichaelMoyles I looked over this PR and it looks good to me. Thanks. However, I was unable to test the slash menu, because it seems to have been disabled in PR #1068 I think we can merge this @NiallJoeMaher and worry about fixing that later.

Shoot! Open up a something to fix that 😭 My bad

Copy link

vercel bot commented Oct 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
codu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2024 6:06pm

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.

Remove toolbar from the alpha editor
3 participants