Платформа ЦРНП "Мирокод" для разработки проектов
https://git.mirocod.ru
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
463 B
16 lines
463 B
import {svg} from '../svg.js'; |
|
|
|
export function renderCodeCopy() { |
|
const els = document.querySelectorAll('.markup .code-block code'); |
|
if (!els.length) return; |
|
|
|
const button = document.createElement('button'); |
|
button.classList.add('code-copy', 'ui', 'button'); |
|
button.innerHTML = svg('octicon-copy'); |
|
|
|
for (const el of els) { |
|
const btn = button.cloneNode(true); |
|
btn.setAttribute('data-clipboard-text', el.textContent); |
|
el.after(btn); |
|
} |
|
}
|
|
|