Enable the message right-click context menu in the browser (#8336)
* Enable the message right-click context menu in the browser Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Move `getSelectedText()` to `strings.ts` Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com> * Move `canCancel()` to `EventUtils.ts` Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -84,3 +84,11 @@ const collator = new Intl.Collator();
|
||||
export function compare(a: string, b: string): number {
|
||||
return collator.compare(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns text which has been selected by the user
|
||||
* @returns the selected text
|
||||
*/
|
||||
export function getSelectedText(): string {
|
||||
return window.getSelection().toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user