Skip to content

Conversation

VipinDevelops
Copy link
Member

@VipinDevelops VipinDevelops commented Jul 15, 2025

Description

This PR Make the emoji suggestion showing modal completely configurable and also refactor some part of code.

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring

Summary by CodeRabbit

  • New Features

    • Added an option to enable or disable emoji suggestions in the editor interface.
    • Users can now control the visibility of emoji suggestions when typing in both standard and collaborative editing modes.
  • Refactor

    • Improved configuration for emoji extension, allowing more flexible control over emoji suggestion behavior.

Copy link
Contributor

coderabbitai bot commented Jul 15, 2025

Walkthrough

A new showEmojiSuggestion boolean prop was introduced throughout the editor codebase, allowing consumers to enable or disable emoji suggestion functionality. This prop is threaded from component props, through hooks, to the emoji extension, which now conditionally includes or omits the suggestion plugin based on this flag.

Changes

File(s) Change Summary
.../editors/document/collaborative-editor.tsx
.../editors/editor-wrapper.tsx
Added showEmojiSuggestion prop to component signatures and passed it to corresponding hooks.
.../core/hooks/use-collaborative-editor.ts
.../core/hooks/use-editor.ts
Updated hooks to accept and forward showEmojiSuggestion to editor extension setup.
.../core/extensions/emoji/emoji.ts Changed emoji node name to constant; simplified HTML rendering logic.
.../core/extensions/emoji/extension.ts Added showSuggestion option; conditionally includes/excludes suggestion plugin based on this option.
.../core/extensions/extensions.ts Extended arguments with showEmojiSuggestion; configures EmojiExtension accordingly.
.../core/types/editor.ts Added optional showEmojiSuggestion property to IEditorProps interface.
.../core/types/hook.ts Added showEmojiSuggestion to relevant hook prop type definitions.

Sequence Diagram(s)

sequenceDiagram
    participant Consumer
    participant EditorComponent
    participant EditorHook
    participant Extensions
    participant EmojiExtension

    Consumer->>EditorComponent: Pass showEmojiSuggestion prop
    EditorComponent->>EditorHook: Pass showEmojiSuggestion
    EditorHook->>Extensions: Pass showEmojiSuggestion
    Extensions->>EmojiExtension: Configure with showSuggestion=showEmojiSuggestion
    EmojiExtension->>EmojiExtension: Conditionally include/exclude Suggestion plugin
Loading

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend, ready to merge

Suggested reviewers

  • aaryan610
  • Palanikannan1437

Poem

In the editor’s warren, a new flag appears,
Emoji suggestions—now controlled by your peers!
A toggle so simple, a hop and a skip,
The code passes options with nary a slip.
🐰✨ Let’s celebrate features that bloom and grow,
With every suggestion, let creativity flow!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfadd37 and e01674a.

📒 Files selected for processing (1)
  • packages/editor/src/core/extensions/emoji/extension.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/editor/src/core/extensions/emoji/extension.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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

makeplane bot commented Jul 15, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@VipinDevelops VipinDevelops changed the title [WIKI-550] [WIKI-550] make emoji suggestion configurable Jul 15, 2025
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: 0

🧹 Nitpick comments (1)
packages/editor/src/core/extensions/emoji/extension.ts (1)

38-49: Clarify the comment for better accuracy.

The implementation logic is correct - when showSuggestion is false, it filters out the suggestion plugin (index 0). However, the comment on line 44 could be more accurate.

-    // Return only the emoji plugin (second plugin from parent)
+    // Filter out the suggestion plugin (first plugin from parent)

The current comment suggests it returns only the second plugin, but the code actually filters out the first plugin and returns all remaining plugins (which happens to be just the emoji plugin in this case).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2058f06 and dfadd37.

📒 Files selected for processing (9)
  • packages/editor/src/core/components/editors/document/collaborative-editor.tsx (2 hunks)
  • packages/editor/src/core/components/editors/editor-wrapper.tsx (2 hunks)
  • packages/editor/src/core/extensions/emoji/emoji.ts (3 hunks)
  • packages/editor/src/core/extensions/emoji/extension.ts (2 hunks)
  • packages/editor/src/core/extensions/extensions.ts (3 hunks)
  • packages/editor/src/core/hooks/use-collaborative-editor.ts (2 hunks)
  • packages/editor/src/core/hooks/use-editor.ts (2 hunks)
  • packages/editor/src/core/types/editor.ts (1 hunks)
  • packages/editor/src/core/types/hook.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/editor/src/core/extensions/extensions.ts (1)
packages/editor/src/core/extensions/emoji/extension.ts (1)
  • EmojiExtension (12-55)
packages/editor/src/core/extensions/emoji/extension.ts (1)
packages/editor/src/core/extensions/emoji/emoji.ts (2)
  • EmojiOptions (70-76)
  • Emoji (89-428)
🔇 Additional comments (11)
packages/editor/src/core/types/editor.ts (1)

143-143: LGTM! Well-structured type addition.

The optional showEmojiSuggestion property is properly typed and positioned within the interface. This enables backward compatibility while providing the new configuration option.

packages/editor/src/core/components/editors/document/collaborative-editor.tsx (1)

42-42: LGTM! Consistent prop threading implementation.

The showEmojiSuggestion prop is properly extracted and passed through to the useCollaborativeEditor hook, following the established pattern for other configuration props.

Also applies to: 76-76

packages/editor/src/core/hooks/use-collaborative-editor.ts (1)

36-36: LGTM! Proper prop threading in collaborative editor hook.

The showEmojiSuggestion prop is correctly extracted and forwarded to the useEditor hook, maintaining consistency with the established prop threading pattern.

Also applies to: 117-117

packages/editor/src/core/extensions/emoji/emoji.ts (2)

18-18: LGTM! Good use of constants for maintainability.

Using the CORE_EXTENSIONS.EMOJI constant instead of a hardcoded string improves consistency and maintainability across the codebase.

Also applies to: 90-90


194-194: Double-check HTML export fallback image behavior for inline emojis

Although we still surface fallbackImage in markdown serialization, suggestion UI, and the emoji picker, the recent change in renderHTML (packages/editor/src/core/extensions/emoji/emoji.ts) now always emits a <span> (no <img> fallback). This will prevent any inline HTML export from rendering custom emoji images.

Please verify:

  • That HTML exports of unsupported emojis no longer need <img> fallbacks, or update them to handle fallbackImage.
  • Existing tests or integrations aren’t relying on inline <img> tags for emojis.
  • Whether to add a new test for HTML serialization of emojis with fallbackImage.
  • If the CSS selector for span[data-type="emoji"] img is now unused and should be cleaned up.
packages/editor/src/core/components/editors/editor-wrapper.tsx (1)

41-41: LGTM! Completes the prop threading pattern in editor wrapper.

The showEmojiSuggestion prop is properly extracted and passed through to the useEditor hook, completing the consistent prop threading implementation across the editor components.

Also applies to: 63-63

packages/editor/src/core/types/hook.ts (1)

27-27: LGTM! Type definitions properly updated.

The showEmojiSuggestion property has been correctly added to both TEditorHookProps and TCollaborativeEditorHookProps type definitions, ensuring type safety throughout the editor stack.

Also applies to: 48-48

packages/editor/src/core/hooks/use-editor.ts (1)

45-45: LGTM! Prop properly threaded through the hook.

The showEmojiSuggestion prop is correctly extracted from the hook arguments and passed to CoreEditorExtensions, following the established pattern for other configuration props.

Also applies to: 71-71

packages/editor/src/core/extensions/extensions.ts (1)

52-52: LGTM! Extension configuration properly implemented.

The showEmojiSuggestion prop is correctly added to the type definition, extracted from arguments, and passed to the EmojiExtension configuration with a sensible default fallback (?? true).

Also applies to: 68-68, 108-110

packages/editor/src/core/extensions/emoji/extension.ts (2)

8-18: LGTM! Interface and options properly extended.

The ExtendedEmojiOptions interface correctly extends the base EmojiOptions with the new showSuggestion property, and the addOptions method properly adds this option with a sensible default value of true.


54-54: LGTM! Configuration properly sets the default.

The showSuggestion option is correctly set to true in the extension configuration, maintaining consistency with the default value in addOptions.

@VipinDevelops VipinDevelops changed the title [WIKI-550] make emoji suggestion configurable [WIKI-550] fix : make emoji suggestion configurable Jul 15, 2025
@VipinDevelops VipinDevelops changed the title [WIKI-550] fix : make emoji suggestion configurable [WIKI-550] improve : make emoji suggestion configurable Jul 17, 2025
@pushya22 pushya22 marked this pull request as draft July 18, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant