Comments (7)
Thanks @FMorschel for reporting the bug, I will look into it.
from thunder-client-support.
In Iframe clipboard is not allowed. Use below code instead.
parent.postMessage( {command: 'copy-text', "text": "textdatatocopy"});
Below is updated code
var html = `
<div id="container"></div>
<script>
// get the container element
let container = document.getElementById("container");
// Create a new button element
var button = document.createElement('button');
button.innerHTML = 'Copy to clipboard';
// Add an event listener for the click event
button.addEventListener('click', function() {
// Use the Clipboard API to write text
try{
parent.postMessage({command:'copy-text', "text": "textdata"});
// Create a new paragraph element
var p = document.createElement('p');
p.innerHTML = 'Text copied to clipboard';
// Append the paragraph to the body of the document
document.body.appendChild(p);
} catch(error) {
// Create a new paragraph element
var p = document.createElement('p');
p.innerHTML = 'Failed to copy text' + error;
// Append the paragraph to the body of the document
document.body.appendChild(p);
}
});
// Append the button to the body of the container
container.appendChild(button);
</script>
`
tc.chartHTML(html);
from thunder-client-support.
Done that!
from thunder-client-support.
Testing script:
var html = `
<div id="container"></div>
<script>
// get the container element
let container = document.getElementById("container");
// Create a new button element
var button = document.createElement('button');
button.innerHTML = 'Copy to clipboard';
// Add an event listener for the click event
button.addEventListener('click', function() {
// Use the Clipboard API to write text
navigator.clipboard.writeText('test').then(function() {
// Create a new paragraph element
var p = document.createElement('p');
p.innerHTML = 'Text copied to clipboard';
// Append the paragraph to the body of the document
document.body.appendChild(p);
}).catch(function(error) {
// Create a new paragraph element
var p = document.createElement('p');
p.innerHTML = 'Failed to copy text' + error;
// Append the paragraph to the body of the document
document.body.appendChild(p);
});
});
// Append the button to the body of the container
container.appendChild(button);
</script>
`
tc.chartHTML(html);
Exact error:
Failed to copy textNotAllowedError: Write permission denied.
from thunder-client-support.
It worked! Thanks! Could this be mentioned in the docs? I think this could be a great help for the extension users.
from thunder-client-support.
Sure, also feel free to submit PR
https://docs.thunderclient.com/testing/chart-view
from thunder-client-support.
Thanks for the PR
from thunder-client-support.
Related Issues (20)
- cannot import nor export environments HOT 4
- Collection disappeared HOT 1
- Oauth says "Saved Successfully" when it fails
- HMAC calculation is not same as POSTMAN HOT 2
- Size, in response page, does not reflect gzip compression
- Cannot Copy, Cut or Paste when you save a large query HOT 2
- Logout from all of my devices HOT 3
- Right click menu broken when the bottom bar's align panel is set to justify HOT 1
- Error "Update to latest version" shown although already updated to latest version (v2.23.1) HOT 5
- CSV file uploaded is not reading in my query . HOT 16
- Dynamic variable syntax in JSON body HOT 2
- tc.loadFromPath missing HOT 1
- Failed to Import: 1 files - thunder-collection-xyxyxyxyxy.json HOT 2
- set-cookie from server supports or not? HOT 5
- setVar inside tests from requests that is run from another request's (parent request) pre-run results in the parent request's getVar getting outdated value HOT 1
- Incorrect execution order of main request pre-run script when pre-request request(s) are specified HOT 5
- V S Code editor thunder client not showing anything on the side bar HOT 1
- Get Request ID HOT 2
- content-type error,application/x-www-form-urlencoded HOT 1
- keeps activating HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thunder-client-support.