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

Added option for a nested context menu #84

Merged
merged 4 commits into from
Dec 8, 2023
Merged

Added option for a nested context menu #84

merged 4 commits into from
Dec 8, 2023

Conversation

tdulcet
Copy link
Collaborator

@tdulcet tdulcet commented Nov 12, 2023

image

@tdulcet tdulcet requested a review from rugk November 12, 2023 13:30
@tdulcet
Copy link
Collaborator Author

tdulcet commented Nov 12, 2023

We should probably give some thought to this from #44 (comment):

am also not sure how this would work with the live preview option.

Hmm, just do not live-preview the categories should be enough, should not it? 🤔 Though it may look strange if some things are previewed and some are not. 🤔 Anyway… taht’s an implementation detail/UX thing that can be found out when implementing it and looking/comparing how it looks. I could also imagine it does sth. like not changing the top-level entries like “Superscript” to a live preview only, but still always forces to add the description, so one knows what is done there.

@rugk
Copy link
Owner

rugk commented Nov 18, 2023

Yeah, but IMHO your screenshot looks nice. And thanks, this looks good!

Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

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

Minor stuff but thanks!

src/background/modules/ContextMenu.js Outdated Show resolved Hide resolved
src/background/modules/ContextMenu.js Outdated Show resolved Hide resolved
title: menuText,
contexts: ["editable"]
});
for (const atransformationId of amenuItems) {
Copy link
Owner

Choose a reason for hiding this comment

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

I am still not convinced by this a prefixing again. And here it looks absurd as it is grammatically wrong in English, I mean what is "a menu items"? Plural/singular what?

Suggested change
for (const atransformationId of amenuItems) {
for (const currentTransformationId of currentMenuItems) {

Copy link
Owner

Choose a reason for hiding this comment

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

Also I ponder whether this could be written/refactored with less indentation in a recursive way or so, just unsure. So e.g. check if the item is a list and then call the function itself to add it to a new list in a sub-item.

This could drastically reduce the code and complexity and make the code more understandable.

As an addition you can then easily build more sub-entries recursively.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I will remove the a prefixes.

Regarding refactoring, I am open to suggestions. I doubt there would ever be multiple levels of nesting, as it would then make it too difficult for users to use.

Copy link
Owner

Choose a reason for hiding this comment

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

Well yeah, recursive is likely more readable anyway, but it's okish… (It's just quote hard to understand currently, so…)

src/options/options.html Outdated Show resolved Hide resolved
@tdulcet tdulcet requested a review from rugk November 19, 2023 12:30
rugk
rugk previously approved these changes Dec 7, 2023
Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

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

Okayish, dunno if we could optimize the readability as said a bit more there, but otherwise okay.

src/background/modules/ContextMenu.js Outdated Show resolved Hide resolved
Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

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

Now this looks much more readable!

@rugk rugk merged commit c49096b into main Dec 8, 2023
7 checks passed
@rugk rugk deleted the nested branch December 8, 2023 21:20
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.

Option for nested context menu
2 participants