Skip to content
代码片段 群组 项目
提交 79fd61b7 编辑于 作者: Jose Ivan Vargas's avatar Jose Ivan Vargas
浏览文件

Merge branch 'ph/388125/fixMultipleCopyCodeButtons' into 'master'

Fix bug where multiple copy code buttons could exist

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113504



Merged-by: default avatarJose Ivan Vargas <jvargas@gitlab.com>
Approved-by: default avatarJose Ivan Vargas <jvargas@gitlab.com>
Co-authored-by: default avatarPhil Hughes <me@iamphill.com>
No related branches found
No related tags found
无相关合并请求
...@@ -5,6 +5,8 @@ import { setAttributes } from '~/lib/utils/dom_utils'; ...@@ -5,6 +5,8 @@ import { setAttributes } from '~/lib/utils/dom_utils';
class CopyCodeButton extends HTMLElement { class CopyCodeButton extends HTMLElement {
connectedCallback() { connectedCallback() {
if (this.querySelector('.btn')) return;
this.for = uniqueId('code-'); this.for = uniqueId('code-');
const target = this.parentNode.querySelector('pre'); const target = this.parentNode.querySelector('pre');
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册