diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /app/assets/javascripts/behaviors | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'app/assets/javascripts/behaviors')
3 files changed, 6 insertions, 13 deletions
diff --git a/app/assets/javascripts/behaviors/copy_to_clipboard.js b/app/assets/javascripts/behaviors/copy_to_clipboard.js index c3c28aeafc0..07fd6dae76a 100644 --- a/app/assets/javascripts/behaviors/copy_to_clipboard.js +++ b/app/assets/javascripts/behaviors/copy_to_clipboard.js @@ -43,7 +43,7 @@ function genericSuccess(e) { } /** - * Safari > 10 doesn't support `execCommand`, so instead we inform the user to copy manually. + * Safari < 10 doesn't support `execCommand`, so instead we inform the user to copy manually. * See http://clipboardjs.com/#browser-support */ function genericError(e) { diff --git a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js index 6922ec9c5a5..3b9f6011c6d 100644 --- a/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js +++ b/app/assets/javascripts/behaviors/markdown/render_sandboxed_mermaid.js @@ -53,9 +53,6 @@ function fixElementSource(el) { // Mermaid doesn't like `<br />` tags, so collapse all like tags into `<br>`, which is parsed correctly. const source = el.textContent?.replace(/<br\s*\/>/g, '<br>'); - // Remove any extra spans added by the backend syntax highlighting. - Object.assign(el, { textContent: source }); - return { source }; } @@ -78,17 +75,13 @@ function renderMermaidEl(el, source) { width: '100%', }); - // Add the original source into the DOM - // to allow Copy-as-GFM to access it. - const sourceEl = document.createElement('text'); - sourceEl.textContent = source; - sourceEl.classList.add('gl-display-none'); - const wrapper = document.createElement('div'); wrapper.appendChild(iframeEl); - wrapper.appendChild(sourceEl); - el.closest('pre').replaceWith(wrapper); + // Hide the markdown but keep it "visible enough" to allow Copy-as-GFM + // https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83202 + el.closest('pre').classList.add('gl-sr-only'); + el.closest('pre').parentNode.appendChild(wrapper); // Event Listeners iframeEl.addEventListener('load', () => { diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js index 6124befd3b6..82229b5aa8f 100644 --- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js +++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.js @@ -156,7 +156,7 @@ export default class ShortcutsIssuable extends Shortcuts { static copyBranchName() { // There are two buttons - one that is shown when the sidebar // is expanded, and one that is shown when it's collapsed. - const allCopyBtns = Array.from(document.querySelectorAll('.js-sidebar-source-branch button')); + const allCopyBtns = Array.from(document.querySelectorAll('.js-source-branch-copy')); // Select whichever button is currently visible so that // the "Copied" tooltip is shown when a click is simulated. |