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

Add menu bar button for media embed. #16337

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mremiszewski
Copy link
Contributor

@mremiszewski mremiszewski commented May 10, 2024

Suggested merge commit message (convention)

Feature (media-embed): Added menu bar integration to media embed.

MINOR BREAKING CHANGE (media-embed): Media embed uses dialog instead of dropdown for inserting media.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

Copy link
Contributor

coderabbitai bot commented May 10, 2024

Walkthrough

The recent updates to the CKEditor5 packages primarily focus on enhancing the media embed functionality. Key changes include the replacement of dropdown elements with button and dialog components for media embedding, simplification of UI by removing unused buttons and focus management in forms, and adjustments to menu bar configurations and utilities to support these modifications.

Changes

File Path Summary of Changes
.../mediaembedui.ts Replaced dropdown imports with button and dialog components, refactored methods, and updated event handling.
.../mediaformview.ts Removed unused imports, button functionality, and simplified focus management.
.../tests/manual/mediaembed.js Added menu bar visibility configuration to ClassicEditor settings.
.../ui/src/menubar/utils.ts Updated DefaultMenuBarItems to include media embed in the insertMinorWidgets group.

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between a2279f5 and e286379.
Files selected for processing (4)
  • packages/ckeditor5-media-embed/src/mediaembedui.ts (2 hunks)
  • packages/ckeditor5-media-embed/src/ui/mediaformview.ts (7 hunks)
  • packages/ckeditor5-media-embed/tests/manual/mediaembed.js (1 hunks)
  • packages/ckeditor5-ui/src/menubar/utils.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/ckeditor5-media-embed/src/ui/mediaformview.ts
Additional comments not posted (5)
packages/ckeditor5-media-embed/tests/manual/mediaembed.js (1)

20-20: Visibility configuration for the menu bar is correctly added.

packages/ckeditor5-media-embed/src/mediaembedui.ts (3)

11-11: Updated imports to support new dialog-based UI components.


43-54: Refactored UI components to use dialog buttons instead of dropdowns, enhancing user interaction.


58-130: Implemented detailed dialog interaction for media embedding. Ensure thorough testing for UI correctness and responsiveness.

packages/ckeditor5-ui/src/menubar/utils.ts (1)

771-771: Added 'menuBar:mediaEmbed' to the menu bar configuration, aligning with the PR's objectives to enhance accessibility.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@DawidKossowski DawidKossowski left a comment

Choose a reason for hiding this comment

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

There are still several things to fix/improve:

  1. You should add the Dialog plugin to requires in mediaembedui.ts.
  2. IMO, the dialog is too small. We could discuss it at the daily meeting.
  3. The dialog content does not clear after closing, resulting in the bug where the input label hovers over the starting input value (after reopening the modal):
Nagranie.z.ekranu.2024-05-16.o.09.33.42.mov
  1. Unit tests are still missing.

packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
@mremiszewski
Copy link
Contributor Author

Ad 3. is still not fixed, I'm waiting for a decision about the way it will be handled.

Copy link
Contributor

@scofalik scofalik left a comment

Choose a reason for hiding this comment

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

In general LGTM. I tested it manually a bit and it looks good. Mostly minor changes except that it should be a centered modal.

packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
/**
* Creates a button for for menu bar that will show find and replace dialog.
*/
private _createDialogButton<T extends typeof ButtonView | typeof MenuBarMenuListItemButtonView>( ButtonClass: T ): InstanceType<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this type:

T extends typeof ButtonView | typeof MenuBarMenuListItemButtonView

I think I've seen this before in other menu bar related plugins but refrained from commenting then.

My question is. MenuBarMenuListItemButtonView extends ButtonView so what is the point of having them both in T declaration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

First, IMO that suggests the ways this function will be used, to emphasize that it will be called with both ButtonView and MenuBarMenuListItemButtonView, so just for better readability. Second, as you mentioned, I followed already established convention.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, do you confirm that from types perspective, it doesn't matter (at least in this case)?

packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
packages/ckeditor5-media-embed/tests/mediaembedui.js Outdated Show resolved Hide resolved
packages/ckeditor5-media-embed/tests/mediaembedui.js Outdated Show resolved Hide resolved
@mremiszewski mremiszewski marked this pull request as ready for review May 24, 2024 09:53
Copy link
Contributor

@scofalik scofalik left a comment

Choose a reason for hiding this comment

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

One minor thing. I'd change it myself but there may be a related unit test. If there's not maybe we should check how the modal is opened (with what params?)

packages/ckeditor5-media-embed/src/mediaembedui.ts Outdated Show resolved Hide resolved
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.

None yet

3 participants