copy button - initialized clipboardJS for support in modal window #8992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #8990
clipboardJS that powers the copy button needs to be aware of the container in focus for it to work. (https://github.com/zenorocha/clipboard.js#advanced-options & zenorocha/clipboard.js#368)
Currently, I don't think there is a way to initiallize when clipboardJS instance for handling both button in main body and those in modal windows. I did a few tries, but probably this is still a missing feature (zenorocha/clipboard.js#860)
So my understanding is that we need to initialize clipboardJS differently for code block inside modal window.
This PR makes the source code inside the Modal we create for source embedding works.
If we add new modals, we'll need probably to adapt as I did something quite scoped for the
container
right now. It could be probably made more global but the value takes only one element right now, so we need to select only one modals.I tested this locally - as this is in browser, this is hard to test differently.
Regarding feature matrix, I am still unsure how to add this but it improve for sure the quality of the copy-button feature among code tools one