-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a copy button for comparison table rows (#2216)
* Add a copy button for comparision table rows * Let the user select the text of the comparison row path * Disable toggling while selecting comparison row path * Add more tests * Revert colspan move * Revert change
- Loading branch information
Showing
4 changed files
with
91 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export const createWindowTextSelection = ( | ||
nodeValue: string | null, | ||
offset = 0 | ||
) => { | ||
window.getSelection = () => { | ||
return { | ||
anchorOffset: 1, | ||
focusNode: nodeValue ? ({ nodeValue } as Node) : null, | ||
focusOffset: 1 + offset | ||
} as Selection | ||
} | ||
} | ||
|
||
export const clearSelection = () => createWindowTextSelection(null) |