mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add support for editing on mobile.
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
This commit is contained in:
@@ -62,7 +62,7 @@ function Clipboard(app) {
|
||||
|
||||
FocusLayer.create(this, {
|
||||
defaultFocusElem: this.copypasteField,
|
||||
allowFocus: isCopyPasteTarget,
|
||||
allowFocus: allowFocus,
|
||||
onDefaultFocus: () => {
|
||||
this.copypasteField.value = ' ';
|
||||
this.copypasteField.select();
|
||||
@@ -184,10 +184,12 @@ var FOCUS_TARGET_TAGS = {
|
||||
* copy-paste events. Besides inputs and textareas, any element can be marked to be a valid
|
||||
* copy-paste target by adding 'clipboard_focus' class to it.
|
||||
*/
|
||||
function isCopyPasteTarget(elem) {
|
||||
function allowFocus(elem) {
|
||||
return elem && (FOCUS_TARGET_TAGS.hasOwnProperty(elem.tagName) ||
|
||||
elem.hasAttribute("tabindex") ||
|
||||
elem.classList.contains('clipboard_focus'));
|
||||
}
|
||||
|
||||
Clipboard.allowFocus = allowFocus;
|
||||
|
||||
module.exports = Clipboard;
|
||||
|
||||
Reference in New Issue
Block a user