mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add our very own implementation of tokenfield (aka pillbox, tag list)
Summary: - Supports auto-completion - Supports various keyboard interactions to delete/select/copy-paste tokens - Supports various mouse interactions to select and move tokens. - Supports undo/redo while editing tokens. Test Plan: stand-alone fixture and browser test verify the supported behaviors Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2789
This commit is contained in:
@@ -18,3 +18,11 @@ export function isDesktop() {
|
||||
export function isIOS() {
|
||||
return navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
||||
}
|
||||
|
||||
// Returns 'metaKey' on Mac / iOS, and 'ctrlKey' elsewhere. This is useful for various keyboard
|
||||
// interactions that use Control on Windows and Linux, and Command key on Mac for the same
|
||||
// purpose. Suitable to use with KeyboardEvent and MouseEvent.
|
||||
// (Note: Mousetrap.js uses the same logic to interpret its "mod" key alias.)
|
||||
export function modKeyProp(): 'metaKey'|'ctrlKey' {
|
||||
return /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user