Skip to content

Commit

Permalink
Set "text/plain" data only when it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Leilei332 committed Jan 27, 2025
1 parent 79c326b commit 939a207
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/modules/utils/dom/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ exports.copyToClipboard = function(text,options,type) {
textArea.setSelectionRange(0,text.length);
textArea.addEventListener("copy",function(event) {
event.preventDefault();
event.clipboardData.setData("text/plain",options.plainText);
if (options.plainText) {
event.clipboardData.setData("text/plain",options.plainText);
}
event.clipboardData.setData(type,text);
});
var succeeded = false;
Expand Down

0 comments on commit 939a207

Please # to comment.