-
-
Notifications
You must be signed in to change notification settings - Fork 23
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 code button to code fragments in descriptions #4488
Conversation
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.
- For some reason it doesn't seem to work for me in Chrome (using version 111).
- The error message that appears is also not that useful I think ("Druk Ctrl-C om te kopiëren")
- Some (or most?) of the HTML problem statements don't use a
<code>
tag, only a<pre>
, so they don't get a button.
Fixed, it needed extra permissions because it is in an Iframe
I now actually select the text if copying failed.
These problem statements do not follow the specification: https://docs.dodona.be/nl/references/exercise-description/#blokken-code Thus we cannot guarantee the layout. I did update the matching form |
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.
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.
Forgot to push the fix for this
That was an artifact of adding the copy button inside the codeblock. The copy button is now no longer included in the copied text. I prefer this solution to a trim, because leading and ending whitespace might be relevant in some code examples.
Fixed |
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.
Can we also replace the existing copy buttons by the new web component?
This pull request adds a copy code button to code fragments in descriptions.
I matched on the
<pre><code></code></pre>
html tags in descriptions to match all logical cases. This tag is also correctly used by markdown.Should the copying fail, it selects the text and suggests to use Ctrl + c
Closes #3532