Cleaned up export dialog, fixed copying
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
.exportDialog .iiexport {
|
||||||
|
overflow-y: auto;
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
@@ -1,26 +1,28 @@
|
|||||||
<template name="exportDialog">
|
<template name="exportDialog">
|
||||||
<div class="fit layout vertical">
|
<div class="exportDialog fit layout vertical">
|
||||||
{{#with character}}
|
{{#with character}}
|
||||||
<app-header-layout has-scrolling-region class="export flex">
|
<app-header fixed effects="waterfall">
|
||||||
<app-header fixed effects="waterfall">
|
<app-toolbar>
|
||||||
<app-toolbar>
|
<div main-title>Export Character to Improved Initiative</div>
|
||||||
<div main-title>Export Character to Improved Initiative</div>
|
</app-toolbar>
|
||||||
</app-toolbar>
|
</app-header>
|
||||||
</app-header>
|
<div class="form flex layout vertical">
|
||||||
<div class="form flex layout vertical">
|
<paper-toggle-button id="exportFeatures" checked={{settings.exportFeatures}}>
|
||||||
<paper-toggle-button id="exportFeatures" checked={{settings.exportFeatures}}>
|
Features
|
||||||
Features
|
</paper-toggle-button>
|
||||||
</paper-toggle-button>
|
<paper-toggle-button id="exportAttacks" checked={{settings.exportAttacks}}>
|
||||||
<paper-toggle-button id="exportAttacks" checked={{settings.exportAttacks}}>
|
Attacks
|
||||||
Attacks
|
</paper-toggle-button>
|
||||||
</paper-toggle-button>
|
<paper-toggle-button id="exportDescription" checked={{settings.exportDescription}}>
|
||||||
<paper-toggle-button id="exportDescription" checked={{settings.exportDescription}}>
|
Description
|
||||||
Description
|
</paper-toggle-button>
|
||||||
</paper-toggle-button>
|
<div class="paper-font-title padded">JSON</div>
|
||||||
<paper-textarea class="flex iiexport" label="JSON" value={{improvedInitiativeJson}}></paper-textarea>
|
<textarea class="flex iiexport">{{improvedInitiativeJson}}</textarea>
|
||||||
<paper-button id="copyExportButton" class="red-button" raised>Copy to Clipboard</paper-button>
|
<paper-button id="copyExportButton" class="red-button" raised>
|
||||||
</div>
|
<iron-icon icon="content-copy"></iron-icon>
|
||||||
</app-header-layout>
|
Copy to Clipboard
|
||||||
|
</paper-button>
|
||||||
|
</div>
|
||||||
<div class="buttons layout horizontal end-justified">
|
<div class="buttons layout horizontal end-justified">
|
||||||
<paper-button class="doneButton"> Done </paper-button>
|
<paper-button class="doneButton"> Done </paper-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,16 +30,31 @@ Template.exportDialog.events({
|
|||||||
},
|
},
|
||||||
"click #copyExportButton": function(event, template){
|
"click #copyExportButton": function(event, template){
|
||||||
var copyTextarea = template.find(".iiexport");
|
var copyTextarea = template.find(".iiexport");
|
||||||
copyTextarea && copyTextarea.select();
|
copyTextarea.select();
|
||||||
|
var msg;
|
||||||
try {
|
try {
|
||||||
var successful = document.execCommand("copy");
|
var successful = document.execCommand("copy");
|
||||||
var msg = successful ? "successful" : "unsuccessful";
|
var msg = successful ? "JSON copied to clipboard" : "Unable to copy JSON";
|
||||||
console.log("Copying text command was " + msg);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Oops, unable to copy");
|
msg = "Unable to copy JSON";
|
||||||
|
} finally {
|
||||||
|
clearSelection();
|
||||||
|
GlobalUI.toast(msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"click .doneButton": function(event, instance){
|
"click .doneButton": function(event, instance){
|
||||||
popDialogStack();
|
popDialogStack();
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
|
var clearSelection = function(){
|
||||||
|
if (window.getSelection) {
|
||||||
|
if (window.getSelection().empty) { // Chrome
|
||||||
|
window.getSelection().empty();
|
||||||
|
} else if (window.getSelection().removeAllRanges) { // Firefox
|
||||||
|
window.getSelection().removeAllRanges();
|
||||||
|
}
|
||||||
|
} else if (document.selection) { // IE?
|
||||||
|
document.selection.empty();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user