Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.fakeElem.style.border = '0';
this.fakeElem.style.padding = '0';
this.fakeElem.style.margin = '0';
// Move element out of screen horizontally
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = `${yPosition}px`;
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;
this.container.appendChild(this.fakeElem);
this.selectedText = select(this.fakeElem);
this.copyText();
}
this.fakeElem.style.border = '0';
this.fakeElem.style.padding = '0';
this.fakeElem.style.margin = '0';
// Move element out of screen horizontally
this.fakeElem.style.position = 'absolute';
this.fakeElem.style[ isRTL ? 'right' : 'left' ] = '-9999px';
// Move element to the same position vertically
let yPosition = window.pageYOffset || document.documentElement.scrollTop;
this.fakeElem.style.top = `${yPosition}px`;
this.fakeElem.setAttribute('readonly', '');
this.fakeElem.value = this.text;
this.container.appendChild(this.fakeElem);
this.selectedText = select(this.fakeElem);
this.copyText();
}
$(document).on("click", "[data-clipboard-copy]", (ev) => {
const $el = $(ev.target);
if (!$el.data("clipboard-copy") || $el.data("clipboard-copy").length < 1) {
return;
}
const $input = $($el.data("clipboard-copy"));
if ($input.length < 1 || !$input.is("input, textarea, select")) {
return;
}
// Get the available text to clipboard.
const selectedText = select($input[0]);
if (!selectedText || selectedText.length < 1) {
return;
}
// Move the selected text to clipboard.
const $temp = $(`<textarea>${selectedText}</textarea>`).css({
width: 1,
height: 1
});
$el.after($temp);
$temp.select();
const copyDone = () => {
$temp.remove();
$el.focus();
};
selectTarget() {
this.selectedText = select(this.target);
this.copyText();
}
selectTarget() {
this.selectedText = select(this.target);
this.copyText();
}
el.onclick = () => {
select(textarea);
copy = document.execCommand('copy');
if (copy) {
showSuccess(true);
m.redraw();
} else {
textarea.blur();
}
return false;
};
}
<a> select(document.getElementById('code'))} style={{
float: 'right',</a>