-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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 copy codeblock button to built-in documentation #87363
Add copy codeblock button to built-in documentation #87363
Conversation
1485634
to
b64bbc4
Compare
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.
It doesn't quite work at the moment. Left-brackets get eaten somewhere
godot.windows.editor.dev.x86_64_2024-01-29_18-32-50.mp4
It would also be nice to add some visual indication to the click. We might need to modify RTL to achieve that, but without any feedback it feels very poor.
On the subject of modifying RTL, we should be able to add a new argument to the meta
tag which allows disabling the underlining on the case by case to solve your issue with the icon.
I've definitely been missing hover/pressed feedback in RTL (also in projects), so we'll probably need to modify RTL to support this using additional theme items. |
b64bbc4
to
6a18dc4
Compare
The PR has been updated to fix the above quirks. Still, I suppose it cannot be merged as is because the above things are missing in RichTextLabel. |
Sidenote, all of these desired features may give more "credence" to implement godotengine/godot-proposals#7617, but that would be a huge undertaking. |
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.
Seems to work correctly now. However, without #87301, or something similar, this isn't really practical. Copied code snippets will immediate err and throw the user into confusion.
So approving for functionality, but as is, I wouldn't merge it. Usability improvements discussed above would also be nice (can be implemented separately as a pre-requisite, then this could be updated on top).
Needs rebase. |
I will gladly rebase if this is desired, even without the above omissions due to RichTextLabel's limitations |
f05bb59
to
266bc29
Compare
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.
Looks fine. The Copy button doesn't overlap anything, so as long as it's usable, it can be improved later.
The codeblock_text
optimization I mentioned should be looked into, as appending that many strings might actually make the help slower to load (though it doesn't seem to have significant impact).
266bc29
to
17eda55
Compare
The entire built-in class ref generation would benefit from StringBuilder t.b.h.. I don't know what that is, never used it, but maybe it'll be the occasion to... For now I updated the PR to remove the default |
17eda55
to
adfa6e4
Compare
Hey, that's not too bad. Updated the PR to use StringBuilder. This "thing" could be used in so many other places... |
adfa6e4
to
29470b3
Compare
I can do that. There is still a problem of "lack of feedback" when hovering and clicking over the button that the "Copy" text would mitigate (because the underline could appear on hover). |
29470b3
to
e1265b0
Compare
e1265b0
to
f739f78
Compare
The icon looks a bit blurry to me, is there a scaling issue? |
Yeah. It's 24x24 (excluding editor scale), I can tone the scale down to 16x16 (as per the previews in the description of the PR) if you wish. |
Seems like meta hover callbacks are using wrong argument (for selection, instead of meta), will fix it in a moment. |
I think it should be rendered from SVG at the size we want to use it with (including editor scale), so it's crisp. Linearly scaling up will always look bad. |
I guess it's fine as is for now, but we really need to solve these blurry icons :) |
Thanks! |
Would combine really well with #87301
This PR adds a Copy button to the codeblock examples in the built-in class reference.
Unfortunately, with the icon, the underline still shows up and cuts through the icon. This is a bug with RichTextLabel itself.
If the underline could be removed outright this would be less of an issue, but alas. So in the current PR it looks like this: