mirror of https://github.com/keeweb/keeweb
auto-type progress
parent
66e1b0a089
commit
a750e80ea1
|
@ -1,7 +1,8 @@
|
|||
import { Features } from 'util/features';
|
||||
import { NativeModules } from 'comp/launcher/native-modules';
|
||||
import { CopyPaste } from 'comp/browser/copy-paste';
|
||||
import { Logger } from 'util/logger';
|
||||
import { Launcher } from 'comp/launcher';
|
||||
import { Timeouts } from 'const/timeouts';
|
||||
|
||||
const logger = new Logger('auto-type-emitter');
|
||||
|
||||
|
@ -84,7 +85,7 @@ class AutoTypeEmitter {
|
|||
|
||||
key(key) {
|
||||
if (typeof key === 'number') {
|
||||
// TODO
|
||||
// TODO: platform-specific keycodes
|
||||
} else {
|
||||
if (!KeyMap[key]) {
|
||||
return this.callback('Bad key: ' + key);
|
||||
|
@ -95,8 +96,12 @@ class AutoTypeEmitter {
|
|||
}
|
||||
|
||||
copyPaste(text) {
|
||||
CopyPaste.copy(text);
|
||||
this.withCallback(NativeModules.kbdShortcut('V'));
|
||||
setTimeout(() => {
|
||||
Launcher.setClipboardText(text);
|
||||
setTimeout(() => {
|
||||
this.withCallback(NativeModules.kbdShortcut('V'));
|
||||
}, Timeouts.AutoTypeCopyPaste);
|
||||
}, Timeouts.AutoTypeCopyPaste);
|
||||
}
|
||||
|
||||
wait(time) {
|
||||
|
@ -108,7 +113,7 @@ class AutoTypeEmitter {
|
|||
}
|
||||
|
||||
setDelay(delay) {
|
||||
// TODO
|
||||
// TODO: set delay to {delay} milliseconds between keystrokes
|
||||
}
|
||||
|
||||
withCallback(promise) {
|
||||
|
|
|
@ -17,7 +17,8 @@ const Timeouts = {
|
|||
ExternalDeviceAfterReconnect: 1000,
|
||||
FieldLabelDoubleClick: 300,
|
||||
NativeModuleHostRestartTime: 3000,
|
||||
FastAnimation: 100
|
||||
FastAnimation: 100,
|
||||
AutoTypeCopyPaste: 300
|
||||
};
|
||||
|
||||
export { Timeouts };
|
||||
|
|
Loading…
Reference in New Issue