18 lines
437 B
TypeScript
18 lines
437 B
TypeScript
/*
|
|
* https://github.com/morethanwords/tweb
|
|
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
*/
|
|
|
|
export default function getSelectedText(): string {
|
|
if(window.getSelection) {
|
|
return window.getSelection().toString();
|
|
// @ts-ignore
|
|
} else if(document.selection) {
|
|
// @ts-ignore
|
|
return document.selection.createRange().text;
|
|
}
|
|
|
|
return '';
|
|
}
|