-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Limit max-height of CodeMirror editors for issue comment and wiki #18271
Conversation
On codeberg community it was requested to make the wiki editor toolbar sticky for longer wiki posts, so one wouldn't have to scroll to the top to use it. (Reference; https://codeberg.org/Codeberg/Community/issues/533). In order to make this happen, the .editor-toolbar class needs to become position: sticky, and we need to fix it's transparent background and border-bottom. Because the bottom disappears, we add it. This makes the border become a double border, because the CodeMirror area defines borders for all. As such I've added a border-top: none, on the wiki write tab for the CodeMirror class.
In issue go-gitea#10675 it's requested to make the issue bar sticky upon scrolling in the issue view. The proposed change changes inline html, which is not desirable. As such I've added the position sticky option to it's container, and fix the background upon scrolling.
Fix 0px -> 0 to make the linter happy.
Fix 0px -> 0 to make the linter happy.
As per review of @silverwind change the z-index to it's lowest requirement of 1.
As per review of @silverwind change the z-index to it's lowest requirement of 1.
CI failure is related to #18277. Need to rebase this branch against master. |
I'm not sure about the issue title thing. I dislike it very much because it takes away a lot of vertical space for not much gain. I even run userstyle to remove this stickying on GitHub because I hate it so much. Regarding editor toolbar, I think the issue may be solveable by adding a |
I agree that title is taking too much space to be sticky, if it would autocompact somehow when scrolled than it could be useful but otherwise I'm also dislike it. |
Sorry for the delay; I've been offline because of an eye infection.
I'm not sure on both what then the appropiate approach is, one could also make it a user preference. But for things like this I don't like preferences. It should be sane by default and not flood the user with settings. |
I think a |
@sexybiggetje are you still working on this PR? |
To sum it up:
|
I should update it, but health came in between. Need a small bit of time |
I could do it for you if you dont mind |
@silverwind 90vh is too big and it is not scroll-able. The text just disappears .repository.wiki .tab[data-tab="write"] .CodeMirror {
max-height: 90vh;
overflow: scroll;
} |
@schorsch13 I see that @sexybiggetje gave your comment a thumbs-up, so I assume that means you are clear to finish it up so he can rest easy. ;) |
@andy5995 thanks for letting me know but I am kinda stuck currently. I added the following part to .repository.wiki .tab[data-tab="write"] .CodeMirror {
max-height: 90vh;
overflow: scroll;
} The text area does not expand and there is a scrollbar but every time I try to scroll it glitches back to the top. |
@sexybiggetje I think I am not able to implement the scroll-able text area |
No worries, I think I'm able to take a look later today. I''sm assuming the second scrollbar is because a calculated problem caused by paddings. Thanks @andy5995 for responding on my behalf 👌 |
Fixes the max-height to 85vh, on the proposed 90vh it just came out just slightly too large. Unstickies the changes from the sticky commits.
Removes the changes as done by the sticky title editor.
The usage of the CSS styles should be limited to the wiki(or issue) editor elements. For example, there are other CSS styles for gitea/web_src/less/_review.less Lines 202 to 205 in 77d1c7b
If we do not isolate these styles, they would conflict in one day. |
.dropdown:not(.selection) > .menu.review-box > * { | ||
@media (max-height: 700px) { | ||
.CodeMirror, | ||
.CodeMirror-scroll { | ||
min-height: 100px; | ||
} | ||
} | ||
} | ||
|
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.
These code has been covered by #19003
Keep this open for a few days before merge - if people have more thoughts. About:
|
PR title is inaccurate, it does not do any more stickying, just limit the CodeMirror height. I think a similar fix could be done to the |
Please do not pollute the global styles, another example, there was #10897 , it says:
Then, how it is now? It becomes very messy code now:
Do you think the code is more and more maintainable? Even so, many users complains that "why new Gitea make the dropdown so narrow". That's all caused by the pollution from the beginning (#10897). If there was no pollution from the beginning, the fix could be very clear and no more messy work from then on. |
No, but that is literally the worst-case example. Limiting codemirror/textarea height is not something that will require such exception rules, the class is unique enough. |
Every pollution might lead to the worst-case. There are too many examples. Let me find them:
Sometimes people just imagine that "OK, it's unique/general, let's do the tricky/make the style as the default", but the fact is not what they thought in most cases. There are so many worst-case examples. Every time a CSS class is polluted, the more messy Gitea's code base becomes. |
@silverwind @wxiaoguang Is this ready to merge? |
* giteaofficial/main: Add alt text to logo (go-gitea#19892) Limit max-height of CodeMirror editors for issue comment and wiki (go-gitea#18271) Implement http signatures support for the API (go-gitea#17565) Increment tests time out from 40m to 50m because sometimes the machine is slow (go-gitea#19887) fix(CI/CD): correct CI variable. (go-gitea#19886) Fix typo (go-gitea#19889) Fixing wrong paging when filtering on the issue dashboard (go-gitea#19801) Move `/info` outside authorization (go-gitea#19888) Fix order by parameter (go-gitea#19849) Exclude Archived repos from Dashboard Milestones (go-gitea#19882) use exact search instead of fuzzy search for branch filter dropdown (go-gitea#19885)
…-gitea#18271) * Make the wiki editor bar sticky for longer wiki edits On codeberg community it was requested to make the wiki editor toolbar sticky for longer wiki posts, so one wouldn't have to scroll to the top to use it. (Reference; https://codeberg.org/Codeberg/Community/issues/533). In order to make this happen, the .editor-toolbar class needs to become position: sticky, and we need to fix it's transparent background and border-bottom. Because the bottom disappears, we add it. This makes the border become a double border, because the CodeMirror area defines borders for all. As such I've added a border-top: none, on the wiki write tab for the CodeMirror class. * Make the issue bar in the issue view sticky for issue go-gitea#10675 In issue go-gitea#10675 it's requested to make the issue bar sticky upon scrolling in the issue view. The proposed change changes inline html, which is not desirable. As such I've added the position sticky option to it's container, and fix the background upon scrolling. * Make linter happy on _repository.less Fix 0px -> 0 to make the linter happy. * Make linter happy on _editor.less Fix 0px -> 0 to make the linter happy. * Change z-index to the lowest boundary of 1 As per review of @silverwind change the z-index to it's lowest requirement of 1. * Change z-index to the lowest boundary of 1 As per review of @silverwind change the z-index to it's lowest requirement of 1. * Revert changes made to wiki editor (unsticky) and add max-height Fixes the max-height to 85vh, on the proposed 90vh it just came out just slightly too large. Unstickies the changes from the sticky commits. * Revert changes for the sticky title editor Removes the changes as done by the sticky title editor. * Add max-height definition to CodeMirror-scroll Add the max-height definition for the CodeMirror-scroll class in order to generalize the changes spoken about in PR go-gitea#18271 * Remove CodeMirror-scroll definition Remove the max-height in CodeMirror-scroll definition, in order to generalize it in the CodeMirror less file. As per discussion in go-gitea#18271. * fine tune CodeMirror min-height/max-height Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
On Codeberg.org it was requested to make the .editor-toolbar sticky when editing large wiki posts. This PR makes that happen.
When searching for appropiate issues on the issue tracker, I also came across issue #10675, which requests to make the issue title bar sticky, but the proposed change there included inline changes to the HTML template. Since this issue can be fixed in the same way using CSS-only, I've included it in this PR.
I've included screenshots of both commit's with this PR;
Position sticky added to the wiki editor, screenshot when scrolling.
Positing sticky added to the wiki editor toolbar, screenshot when on top.
Position sticky added to the issue title container, when scrolling.
Position sticky added to the issue title container, when on top.