Fix CSP error when reading images from the clipboard using the paste command (#1328)

This commit is contained in:
toasted-nutbread 2021-01-30 11:15:11 -05:00 committed by GitHub
parent 588d8a681a
commit af6e9a8153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,6 +134,9 @@ class ClipboardReader {
document.execCommand('paste'); document.execCommand('paste');
const image = target.querySelector('img[src^="data:"]'); const image = target.querySelector('img[src^="data:"]');
const result = (image !== null ? image.getAttribute('src') : null); const result = (image !== null ? image.getAttribute('src') : null);
for (const image2 of target.querySelectorAll('img')) {
image2.removeAttribute('src');
}
target.textContent = ''; target.textContent = '';
return result; return result;
} }