mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Use clipboard.writeText() instead of execCommand("copy")
This commit is contained in:
		@@ -940,29 +940,25 @@ RED.clipboard = (function() {
 | 
			
		||||
        if (truncated) {
 | 
			
		||||
            msg += "_truncated";
 | 
			
		||||
        }
 | 
			
		||||
        var clipboardHidden = $('<textarea type="text" id="red-ui-clipboard-hidden" tabIndex="-1">').appendTo(document.body);
 | 
			
		||||
        $("#red-ui-clipboard-hidden").val(value).focus().select();
 | 
			
		||||
        var result =  document.execCommand("copy");
 | 
			
		||||
        if (result && element) {
 | 
			
		||||
            var popover = RED.popover.create({
 | 
			
		||||
                target: element,
 | 
			
		||||
                direction: 'left',
 | 
			
		||||
                size: 'small',
 | 
			
		||||
                content: RED._(msg)
 | 
			
		||||
            });
 | 
			
		||||
            setTimeout(function() {
 | 
			
		||||
                popover.close();
 | 
			
		||||
            },1000);
 | 
			
		||||
            popover.open();
 | 
			
		||||
        }
 | 
			
		||||
        clipboardHidden.remove();
 | 
			
		||||
        if (currentFocus) {
 | 
			
		||||
            $(currentFocus).focus();
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
        navigator.clipboard.writeText(value).then(function () {
 | 
			
		||||
            if (element) {
 | 
			
		||||
                var popover = RED.popover.create({
 | 
			
		||||
                    target: element,
 | 
			
		||||
                    direction: 'left',
 | 
			
		||||
                    size: 'small',
 | 
			
		||||
                    content: RED._(msg)
 | 
			
		||||
                });
 | 
			
		||||
                setTimeout(function() {
 | 
			
		||||
                    popover.close();
 | 
			
		||||
                },1000);
 | 
			
		||||
                popover.open();
 | 
			
		||||
            }
 | 
			
		||||
            if (currentFocus) {
 | 
			
		||||
                $(currentFocus).focus();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    function importNodes(nodesStr,addFlow) {
 | 
			
		||||
        var newNodes = nodesStr;
 | 
			
		||||
        if (typeof nodesStr === 'string') {
 | 
			
		||||
 
 | 
			
		||||
@@ -356,10 +356,6 @@ button.red-ui-button-small
 | 
			
		||||
    background: $secondary-background;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#red-ui-clipboard-hidden {
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    top: -3000px;
 | 
			
		||||
}
 | 
			
		||||
.form-row .red-ui-editor-node-label-form-row {
 | 
			
		||||
    margin: 5px 0 0 50px;
 | 
			
		||||
    label {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user