kopia lustrzana https://github.com/OpenDroneMap/WebODM
Removed copy to clipboard, better save to text
rodzic
04692c6ff6
commit
7e1705017d
|
@ -26,7 +26,6 @@ class Console extends React.Component {
|
|||
this.handleMouseOver = this.handleMouseOver.bind(this);
|
||||
this.handleMouseOut = this.handleMouseOut.bind(this);
|
||||
this.downloadTxt = this.downloadTxt.bind(this);
|
||||
this.copyTxt = this.copyTxt.bind(this);
|
||||
this.enterFullscreen = this.enterFullscreen.bind(this);
|
||||
this.exitFullscreen = this.exitFullscreen.bind(this);
|
||||
}
|
||||
|
@ -69,17 +68,7 @@ class Console extends React.Component {
|
|||
}
|
||||
|
||||
downloadTxt(filename="console.txt"){
|
||||
Utils.saveAs(this.state.lines.join("\r\n"), filename);
|
||||
}
|
||||
|
||||
copyTxt(){
|
||||
const el = document.createElement('textarea');
|
||||
el.value = this.state.lines.join("\r\n");
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
console.log("Output copied to clipboard");
|
||||
Utils.saveAs(this.state.lines.join("\n"), filename);
|
||||
}
|
||||
|
||||
enterFullscreen(){
|
||||
|
@ -172,9 +161,6 @@ class Console extends React.Component {
|
|||
<a href="javascript:void(0);" onClick={() => this.downloadTxt()} className="btn btn-sm btn-primary" title="Download To File">
|
||||
<i className="fa fa-download"></i>
|
||||
</a>
|
||||
<a href="javascript:void(0);" onClick={this.copyTxt} className="btn btn-sm btn-primary" title="Copy To Clipboard">
|
||||
<i className="fa fa-clipboard"></i>
|
||||
</a>
|
||||
<a href="javascript:void(0);" onClick={this.enterFullscreen} className="btn btn-sm btn-primary" title="Toggle Fullscreen">
|
||||
<i className="fa fa-expand"></i>
|
||||
</a>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const FileSaver = require('file-saver');
|
||||
|
||||
let escapeEntityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
|
@ -83,26 +85,8 @@ export default {
|
|||
},
|
||||
|
||||
saveAs: function(text, filename){
|
||||
function save(uri, filename) {
|
||||
let link = document.createElement('a');
|
||||
if (typeof link.download === 'string') {
|
||||
link.href = uri;
|
||||
link.download = filename;
|
||||
|
||||
//Firefox requires the link to be in the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
//simulate click
|
||||
link.click();
|
||||
|
||||
//remove the link when done
|
||||
document.body.removeChild(link);
|
||||
} else {
|
||||
window.open(uri);
|
||||
}
|
||||
}
|
||||
|
||||
save("data:application/octet-stream," + encodeURIComponent(text), filename);
|
||||
var blob = new Blob([text], {type: "text/plain;charset=utf-8"});
|
||||
FileSaver.saveAs(blob, filename);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
"extract-text-webpack-plugin": "^4.0.0-beta.0",
|
||||
"fbemitter": "^2.1.1",
|
||||
"file-loader": "^0.9.0",
|
||||
"file-saver": "^2.0.2",
|
||||
"gl-matrix": "^2.3.2",
|
||||
"history": "^4.7.2",
|
||||
"immutability-helper": "^2.0.0",
|
||||
|
|
|
@ -182,6 +182,7 @@ STATICFILES_FINDERS = [
|
|||
|
||||
# File Uploads
|
||||
FILE_UPLOAD_MAX_MEMORY_SIZE = 4718592 # 4.5 MB
|
||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 10 MB
|
||||
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
|
||||
|
||||
FILE_UPLOAD_HANDLERS = [
|
||||
|
|
Ładowanie…
Reference in New Issue