mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2026-04-29 18:45:57 +00: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:
@@ -1296,7 +1296,8 @@ class SendTextDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _onKeyDown(e) {
|
async _onKeyDown(e) {
|
||||||
if (this.isShown()) {
|
if (!this.isShown()) return;
|
||||||
|
|
||||||
if (e.code === "Escape") {
|
if (e.code === "Escape") {
|
||||||
this.hide();
|
this.hide();
|
||||||
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
@@ -1304,7 +1305,6 @@ class SendTextDialog extends Dialog {
|
|||||||
this._send();
|
this._send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_textInputEmpty() {
|
_textInputEmpty() {
|
||||||
return !this.$text.innerText || this.$text.innerText === "\n";
|
return !this.$text.innerText || this.$text.innerText === "\n";
|
||||||
@@ -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,7 +1297,8 @@ class SendTextDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _onKeyDown(e) {
|
async _onKeyDown(e) {
|
||||||
if (this.isShown()) {
|
if (!this.isShown()) return;
|
||||||
|
|
||||||
if (e.code === "Escape") {
|
if (e.code === "Escape") {
|
||||||
this.hide();
|
this.hide();
|
||||||
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
} else if (e.code === "Enter" && (e.ctrlKey || e.metaKey)) {
|
||||||
@@ -1305,7 +1306,6 @@ class SendTextDialog extends Dialog {
|
|||||||
this._send();
|
this._send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_textInputEmpty() {
|
_textInputEmpty() {
|
||||||
return !this.$text.innerText || this.$text.innerText === "\n";
|
return !this.$text.innerText || this.$text.innerText === "\n";
|
||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user