mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 15:26:17 -04:00
strip 'NO-BREAK SPACE' (U+00A0) of received text as some browsers seem to add them when pasting text
This commit is contained in:
parent
3e2368c0c9
commit
3505f161c6
2 changed files with 18 additions and 16 deletions
|
@ -1296,13 +1296,13 @@ class SendTextDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onKeyDown(e) {
|
async _onKeyDown(e) {
|
||||||
if (this.isShown()) {
|
if (!this.isShown()) return;
|
||||||
if (e.code === "Escape") {
|
|
||||||
this.hide();
|
if (e.code === "Escape") {
|
||||||
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
this.hide();
|
||||||
if (this._textInputEmpty()) return;
|
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
this._send();
|
if (this._textInputEmpty()) return;
|
||||||
}
|
this._send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1420,7 +1420,8 @@ class ReceiveTextDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onCopy() {
|
async _onCopy() {
|
||||||
await navigator.clipboard.writeText(this.$text.innerText);
|
const sanitizedText = this.$text.innerText.replace(/\u00A0/gm, ' ');
|
||||||
|
await navigator.clipboard.writeText(sanitizedText);
|
||||||
Events.fire('notify-user', 'Copied to clipboard');
|
Events.fire('notify-user', 'Copied to clipboard');
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1297,13 +1297,13 @@ class SendTextDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onKeyDown(e) {
|
async _onKeyDown(e) {
|
||||||
if (this.isShown()) {
|
if (!this.isShown()) return;
|
||||||
if (e.code === "Escape") {
|
|
||||||
this.hide();
|
if (e.code === "Escape") {
|
||||||
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
this.hide();
|
||||||
if (this._textInputEmpty()) return;
|
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
this._send();
|
if (this._textInputEmpty()) return;
|
||||||
}
|
this._send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1421,7 +1421,8 @@ class ReceiveTextDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onCopy() {
|
async _onCopy() {
|
||||||
await navigator.clipboard.writeText(this.$text.innerText);
|
const sanitizedText = this.$text.innerText.replace(/\u00A0/gm, ' ');
|
||||||
|
await navigator.clipboard.writeText(sanitizedText);
|
||||||
Events.fire('notify-user', 'Copied to clipboard');
|
Events.fire('notify-user', 'Copied to clipboard');
|
||||||
this.hide();
|
this.hide();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue