mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
7284644313
Summary: - Add custom handling for dblclick on mobile, to allow focusing editor. - In place of Clipboard.js, use a FocusLayer with document.body as the default focus element. - Set maximum-scale on iOS viewport to prevent auto-zoom. - Reposition the editor on window resize when editing a cell, which is a normal occurrence on Android when virtual keyboard is shown. - Add Save/Cancel icon-buttons next to cell editor on mobile. Test Plan: Tested manually on Safari / FF on iPhone, and on Chrome on Android emulator. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2721
21 lines
720 B
TypeScript
21 lines
720 B
TypeScript
import * as Bowser from "bowser"; // TypeScript
|
|
|
|
let parser: Bowser.Parser.Parser|undefined;
|
|
|
|
function getParser() {
|
|
return parser || (parser = Bowser.getParser(window.navigator.userAgent));
|
|
}
|
|
|
|
// Returns whether the browser we are in is a desktop browser.
|
|
export function isDesktop() {
|
|
const platformType = getParser().getPlatformType();
|
|
return (!platformType || platformType === 'desktop');
|
|
}
|
|
|
|
// Returns whether the browser is on mobile iOS.
|
|
// This is used in particular in viewport.ts to set maximum-scale=1 (to prevent iOS auto-zoom when
|
|
// an input is focused, without preventing manual pinch-to-zoom).
|
|
export function isIOS() {
|
|
return navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
|
}
|