@@ -5,11 +5,40 @@ define( ["qlik", "text!./template.html","//cdn.rawgit.com/tsayen/dom-to-image/bf
55
66 return {
77 template : template ,
8+
89 support : {
910 snapshot : true ,
1011 export : true ,
1112 exportData : false
1213 } ,
14+ definition : {
15+ type : "items" ,
16+ component : "accordion" ,
17+ items : {
18+
19+ settings :{
20+ uses : "settings" ,
21+ items :{
22+ Container :{
23+ ref :"Container" ,
24+ label : "Container Identifier" ,
25+ type : "string" ,
26+ defaultValue :".qvt-sheet"
27+ } ,
28+ bgColor :{
29+ ref :"bgColor" ,
30+ label : "Background Color (hex)" ,
31+ type : "string" ,
32+ defaultValue :"#ffff"
33+ }
34+ }
35+
36+ } ,
37+ sorting : {
38+ uses : "sorting"
39+ }
40+ }
41+ } ,
1342 paint : function ( ) {
1443 return qlik . Promise . resolve ( ) ;
1544 } ,
@@ -45,9 +74,12 @@ define( ["qlik", "text!./template.html","//cdn.rawgit.com/tsayen/dom-to-image/bf
4574 $ ( '.qv-object' ) . prepend ( '<div class="qv-object-codewander-screenshot codewander-ssbutton"><button class="btn btn-primary active" ><i class="fas fa-camera"></i>Take screenshot</button></div>' ) ;
4675 $ ( '.qv-object-codewander-screenshot' ) . find ( '.codewander-ssbutton' ) . first ( ) . remove ( ) ;
4776 $ ( '.codewander-ssbutton' ) . click ( function ( ) {
77+
78+ var containerIdentifier = $scope . layout . Container == null ? ".qvt-sheet" : $scope . layout . Container ;
79+ var bgColor = $scope . layout . bgColor == null ? "#ffff" : $scope . layout . bgColor ;
4880 var e = $ ( this ) . parent ( ) . first ( ) ;
4981 $ ( e ) . append ( '<span class="codewander-watermark">screenshot by www.codewander.com</span>' ) ;
50- domtoimage . toPng ( e [ 0 ] , { height : $ ( e [ 0 ] ) . height ( ) , width :$ ( e [ 0 ] ) . width ( ) , filter :convert } ) . then ( function ( i ) {
82+ domtoimage . toPng ( e [ 0 ] , { height : $ ( e [ 0 ] ) . height ( ) , width :$ ( e [ 0 ] ) . width ( ) , bgcolor : bgColor , filter :convert } ) . then ( function ( i ) {
5183 var sshot = new Image ( ) ;
5284 sshot . src = i ;
5385 saveBase64AsFile ( i , "codewander.com-chart.png" ) ;
@@ -64,13 +96,14 @@ define( ["qlik", "text!./template.html","//cdn.rawgit.com/tsayen/dom-to-image/bf
6496 }
6597 $scope . fullsheet = function ( ) {
6698
67-
68- var divs = $ ( document ) . find ( ".qvt-sheet" ) ;
99+ var containerIdentifier = $scope . layout . Container == null ? ".qvt-sheet" : $scope . layout . Container ;
100+ var bgColor = $scope . layout . bgColor == null ? "#ffff" : $scope . layout . bgColor ;
101+ var divs = $ ( document ) . find ( containerIdentifier ) ;
69102
70103
71104 $ . each ( divs , function ( i , e ) {
72105 $ ( e ) . append ( '<span class="codewander-watermark">screenshot by www.codewander.com</span>' ) ;
73- domtoimage . toPng ( e , { height : $ ( e ) . height ( ) , width :$ ( e ) . width ( ) , filter :convert } ) . then ( function ( i ) {
106+ domtoimage . toPng ( e , { height : $ ( e ) . height ( ) , width :$ ( e ) . width ( ) , bgcolor : bgColor , filter :convert } ) . then ( function ( i ) {
74107 var sshot = new Image ( ) ;
75108 sshot . src = i ;
76109 saveBase64AsFile ( i , "codewander-fullsheet.PNG" ) ;
0 commit comments