mirror of https://github.com/keeweb/keeweb.git
escape chars
This commit is contained in:
parent
31c6c10381
commit
a3afc4f7e4
|
@ -186,11 +186,30 @@ AutoTypeRunner.prototype.getEntryFieldKeys = function(field, op) {
|
|||
op.type = 'group';
|
||||
var ops = [];
|
||||
value.forEachChar(function(ch) {
|
||||
ops.push({ type: 'text', value: String.fromCharCode(ch) });
|
||||
if (ch === 10 || ch === 13) {
|
||||
ops.push({type: 'key', value: 'enter'});
|
||||
} else {
|
||||
ops.push({type: 'text', value: String.fromCharCode(ch)});
|
||||
}
|
||||
});
|
||||
return ops.length ? ops : '';
|
||||
} else {
|
||||
var parts = value.split(/[\r\n]/g);
|
||||
if (parts.length === 1) {
|
||||
return value;
|
||||
}
|
||||
op.type = 'group';
|
||||
var partsOps = [];
|
||||
parts.forEach(function(part) {
|
||||
if (partsOps.length) {
|
||||
partsOps.push({type: 'key', value: 'enter'});
|
||||
}
|
||||
if (part) {
|
||||
partsOps.push({type: 'text', value: part});
|
||||
}
|
||||
});
|
||||
return partsOps;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
AutoTypeRunner.prototype.getEntryGroupName = function() {
|
||||
|
|
|
@ -37,7 +37,7 @@ AutoTypeEmitter.prototype.setMod = function(mod, enabled) {
|
|||
};
|
||||
|
||||
AutoTypeEmitter.prototype.text = function(text) {
|
||||
text = text.replace(/"/g, '\\"');
|
||||
text = text.replace(/"/g, '\\"').replace(/\\/g, '\\\\');
|
||||
this.pendingScript.push('keystroke "' + text + '"'+ this.modString());
|
||||
this.callback();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue