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
Refactor repo-legacy.js, remove messy global variables. Fix errors. #17646
Conversation
Fix an error in Sortable Fix a incorrect call assignMenuAttributes from the template
Good refactor, these globals were a very ugly hack. |
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
The legacy code is still very difficult to understand, so we have to continue to refactor them again and again. ps: during refactoring, usually I just do copy and paste to untouched code and keep most code as before. |
I guess this editor stuff should ideally be rewritten as a Vue (or dare I say React) component. Things like 2-way binding in imperative jQuery-style code will always a pain. |
I agree to introduce some MVVM mechanism. Since we are still using these jQuery code heavliy, I think it's good to make them clear first. And if the legacy code becomes clear, it's easier to migrate them to new frameworks. That's why I am doing some refactoring work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Code looks good but I haven't gotten around to testing this. |
I have tested it on my side. If there is any bug, I will fix it ASAP. |
…o-gitea#17646) Refactor repo-legacy.js, remove messy global variables. Fix errors. Fix an error in Sortable Fix a incorrect call assignMenuAttributes from the template
The JS global variable
commentMDEditors
andautoSimpleMDE
are removed. JS code uses$('textarea').data('simplemde')
directly.Two JS errors are also fixed:
And the nodejs version mentioned in document is too old, so I just changed it to
Node.js LTS
:)