|
|
|
@ -4,13 +4,15 @@
@@ -4,13 +4,15 @@
|
|
|
|
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
import SelectionSaver from "../selectionSaver"; |
|
|
|
|
import selectElementContents from "./selectElementContents"; |
|
|
|
|
import { copyTextToClipboard } from "../clipboard"; |
|
|
|
|
// import SelectionSaver from "../selectionSaver";
|
|
|
|
|
// import selectElementContents from "./selectElementContents";
|
|
|
|
|
|
|
|
|
|
export default function copyFromElement(element: HTMLElement) { |
|
|
|
|
const saver = new SelectionSaver(); |
|
|
|
|
saver.save(); |
|
|
|
|
selectElementContents(element); |
|
|
|
|
document.execCommand('copy'); |
|
|
|
|
saver.restore(); |
|
|
|
|
copyTextToClipboard(element.textContent); |
|
|
|
|
// const saver = new SelectionSaver();
|
|
|
|
|
// saver.save();
|
|
|
|
|
// selectElementContents(element);
|
|
|
|
|
// document.execCommand('copy');
|
|
|
|
|
// saver.restore();
|
|
|
|
|
} |
|
|
|
|