Fix selection of text when 3D touching a token on iOS
This commit is contained in:
parent
4e2d14e7ac
commit
78dac55d7a
@ -165,7 +165,14 @@ function TokenBar({ onMapTokensStateCreate }) {
|
|||||||
padding: "0 16px",
|
padding: "0 16px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid columns="1fr" gap={2} py={2}>
|
<Grid
|
||||||
|
columns="1fr"
|
||||||
|
gap={2}
|
||||||
|
py={2}
|
||||||
|
// Prevent selection on 3D touch for iOS
|
||||||
|
onTouchStart={preventSelect}
|
||||||
|
onTouchEnd={resumeSelect}
|
||||||
|
>
|
||||||
{tokenGroups.map((group) => renderToken(group))}
|
{tokenGroups.map((group) => renderToken(group))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</SimpleBar>
|
</SimpleBar>
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
function usePreventSelect() {
|
function usePreventSelect() {
|
||||||
|
function clearSelection() {
|
||||||
|
if (window.getSelection) {
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
|
}
|
||||||
|
if (document.selection) {
|
||||||
|
document.selection.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
function preventSelect() {
|
function preventSelect() {
|
||||||
|
clearSelection();
|
||||||
document.body.classList.add("no-select");
|
document.body.classList.add("no-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user