fix(browser-extension): issue #943

This commit is contained in:
wanhose 2024-09-12 21:22:07 +02:00
parent 91755a8cbb
commit a777434666

View File

@ -136,22 +136,6 @@ function inputKeyDownHandler(event) {
}
}
/**
* @description Input paste handler
* @param {ClipboardEvent} event
*/
function inputPasteHandler(event) {
event.preventDefault();
const text = event.clipboardData?.getData('text').replace(/\r?\n|\r/g, ' ');
const selection = window.getSelection();
if (selection.rangeCount) {
selection.deleteFromDocument();
selection.getRangeAt(0).insertNode(document.createTextNode(text));
}
}
/**
* @description Show report dialog
*/
@ -184,11 +168,9 @@ function showReportDialog() {
link.setAttribute('rel', 'stylesheet');
reasonInput.addEventListener('input', inputChangeHandler);
reasonInput.addEventListener('keydown', inputKeyDownHandler);
reasonInput.addEventListener('paste', inputPasteHandler);
submitButton.addEventListener('click', submitButtonClickHandler);
urlInput.addEventListener('input', inputChangeHandler);
urlInput.addEventListener('keydown', inputKeyDownHandler);
urlInput.addEventListener('paste', inputPasteHandler);
dispatch({ type: 'INSERT_DIALOG_CSS' });
document.body.appendChild(dialog);