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

Dictionary alias #1270

Merged
merged 50 commits into from
Aug 7, 2024
Merged

Dictionary alias #1270

merged 50 commits into from
Aug 7, 2024

Conversation

khaitruong922
Copy link

#569

  • Add field alias to dictionary settings, which has default value of title
  • Make dictionary title editable

@khaitruong922 khaitruong922 requested a review from a team as a code owner July 25, 2024 12:20
@khaitruong922 khaitruong922 marked this pull request as draft July 25, 2024 12:24
@khaitruong922
Copy link
Author

TO DO:

  • Make popup displays alias instead of title.
  • Update preview popup whenever the alias is changed.

Need advice
Currently DOMDataBinder only binds input element, which does not work for contenteditable. Currently my workaround is to create a hidden input field which updates whenever the contenteditable element is updated. This is probably not a good pracitce. I'm not too sure of how DOMDataBinder class works. Is it possible to add a binding for elements with contenteditable === "true"?

Copy link

codspeed-hq bot commented Jul 25, 2024

CodSpeed Performance Report

Merging #1270 will not alter performance

Comparing khaitruong922:dictionary-alias (ee153cd) with master (9ef85b5)

Summary

✅ 5 untouched benchmarks

@jamesmaa
Copy link
Collaborator

Currently DOMDataBinder only binds input element, which does not work for contenteditable. Currently my workaround is to create a hidden input field which updates whenever the contenteditable element is updated. This is probably not a good pracitce. I'm not too sure of how DOMDataBinder class works. Is it possible to add a binding for elements with contenteditable === "true"?

@Kuuuube could you help out with this if you happen to know something?

@Kuuuube
Copy link
Member

Kuuuube commented Jul 26, 2024

From a quick look I dont see any reason why adding a div or other contenteditable element is an issue. DOMDataBinder doesnt seem particularly complex either.

Creating a hidden element to mirror the setting sounds like a future hell-bug waiting to happen.

@khaitruong922
Copy link
Author

Should we use dictionary alias or original dictionary name in Anki glossary field?

@khaitruong922 khaitruong922 marked this pull request as ready for review July 26, 2024 11:05
@khaitruong922 khaitruong922 marked this pull request as draft July 26, 2024 11:18
@Casheeew
Copy link
Collaborator

Should we use dictionary alias or original dictionary name in Anki glossary field?

I believe so. We should only use the original dictionary name for keying purposes (I believe that's how it's implemented currently?) but basically use the dictionary alias everywhere else for consistency.

Copy link
Member

@Kuuuube Kuuuube left a comment

Choose a reason for hiding this comment

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

Can this be fixed? When clicking on empty space next to the dict name it starts editing the name of the dict below it something like this:
image

@Kuuuube
Copy link
Member

Kuuuube commented Jul 30, 2024

Not seeing any way to revert the alias also. There should be a button or something somewhere to revert it. Maybe on the kebab menu.

@khaitruong922
Copy link
Author

The user can empty the alias to reset it back to the original name. Adding an option on kebab menu sounds fine.

@khaitruong922
Copy link
Author

khaitruong922 commented Jul 30, 2024

  • Move alias edit inside modal which is opened kebab menu and use input instead.
  • Remove contenteditable and add element type in dom-data-binder
  • Add Reset button to set the input to dictionary name.

Please give feedback on wording, UI/UX of new design.

StefanVukovic99
StefanVukovic99 previously approved these changes Aug 7, 2024
Copy link
Member

@StefanVukovic99 StefanVukovic99 left a comment

Choose a reason for hiding this comment

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

I think it's good.
I'd maybe like to have the Set Alias be called Rename to be easier to understand. The {dictionary} and {dictionary-alias} handlebars might then be less understandable, but I don't think they get much use anyway.

@khaitruong922
Copy link
Author

khaitruong922 commented Aug 7, 2024

I would prefer something in between like changing the menu option to Rename but the help message will be kept as Input the alias for X dictionary:. It should be clear that this is not a complete rename (the user cannot rename then add the same dictionary) but just a visual change for pop-up and Anki. The user can still recall what alias is after they have done the renaming.

@StefanVukovic99
Copy link
Member

StefanVukovic99 commented Aug 7, 2024

The term Display name might also be helpful somewhere as an alternative to alias

@khaitruong922
Copy link
Author

Documentation and menu updated with new texts. Still keeps the alias for code naming and Anki marker,

@Kuuuube Kuuuube added this pull request to the merge queue Aug 7, 2024
Merged via the queue into themoeway:master with commit ecd9ffc Aug 7, 2024
10 of 11 checks passed
@khaitruong922 khaitruong922 deleted the dictionary-alias branch August 8, 2024 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui-ux The issue or PR is related to UI/UX/Design kind/enhancement The issue or PR is a new feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants