mirror of https://github.com/keeweb/keeweb
using batch text entry
parent
ef354fb8af
commit
4e58285cc2
|
@ -210,26 +210,31 @@ function kbdModifier(modifiers) {
|
|||
}
|
||||
|
||||
function kbdTextAsKeys(str, modifiers) {
|
||||
const typer = getAutoType();
|
||||
const modifier = kbdModifier(modifiers);
|
||||
let ix = 0;
|
||||
for (const kc of typer.osKeyCodesForChars(str)) {
|
||||
const char = str[ix++];
|
||||
let effectiveModifier = modifier;
|
||||
if (kc?.modifier) {
|
||||
typer.keyMoveWithModifier(true, kc.modifier);
|
||||
effectiveModifier |= kc.modifier;
|
||||
}
|
||||
if (kc) {
|
||||
typer.keyMoveWithCharacter(true, null, kc.code, effectiveModifier);
|
||||
typer.keyMoveWithCharacter(false, null, kc.code, effectiveModifier);
|
||||
} else {
|
||||
typer.keyMoveWithCharacter(true, char, null, effectiveModifier);
|
||||
typer.keyMoveWithCharacter(false, char, null, effectiveModifier);
|
||||
}
|
||||
if (kc?.modifier) {
|
||||
typer.keyMoveWithModifier(false, kc.modifier);
|
||||
const typer = getAutoType();
|
||||
const tx = typer.beginBatchTextEntry();
|
||||
try {
|
||||
for (const kc of typer.osKeyCodesForChars(str)) {
|
||||
const char = str[ix++];
|
||||
let effectiveModifier = modifier;
|
||||
if (kc?.modifier) {
|
||||
typer.keyMoveWithModifier(true, kc.modifier);
|
||||
effectiveModifier |= kc.modifier;
|
||||
}
|
||||
if (kc) {
|
||||
typer.keyMoveWithCharacter(true, null, kc.code, effectiveModifier);
|
||||
typer.keyMoveWithCharacter(false, null, kc.code, effectiveModifier);
|
||||
} else {
|
||||
typer.keyMoveWithCharacter(true, char, null, effectiveModifier);
|
||||
typer.keyMoveWithCharacter(false, char, null, effectiveModifier);
|
||||
}
|
||||
if (kc?.modifier) {
|
||||
typer.keyMoveWithModifier(false, kc.modifier);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
tx.done();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2062,8 +2062,8 @@
|
|||
}
|
||||
},
|
||||
"@keeweb/keeweb-native-modules": {
|
||||
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.7.11/keeweb-native-modules.tgz",
|
||||
"integrity": "sha512-EPK6HlxCPvkZJlHLknr8HIxvmJ9vXStI2H16lYdJAWX3GytlN6DIEnSLo25mo9uKCYhHjOyNwxkXfi0UppdZmg=="
|
||||
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.7.12/keeweb-native-modules.tgz",
|
||||
"integrity": "sha512-56LkWAQUeyTUQyLzy3cdtPPrhqZ5mfcLsyO53245hO1X4KBoHmec1gYNu9lvNQrFs/7okhMFHdjCHOcyBfeCkQ=="
|
||||
},
|
||||
"@polka/url": {
|
||||
"version": "1.0.0-next.11",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
|
||||
"@babel/preset-env": "^7.12.11",
|
||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.7.11/keeweb-native-modules.tgz",
|
||||
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.7.12/keeweb-native-modules.tgz",
|
||||
"adm-zip": "^0.5.2",
|
||||
"argon2-browser": "1.15.3",
|
||||
"autoprefixer": "^10.2.4",
|
||||
|
|
Loading…
Reference in New Issue