11import "./css/App.css" ;
2- import html2canvas from "html2canvas " ;
2+ import { dataURL } from "@gripeless/pico " ;
33
44class BugBattle {
55 apiUrl = "https://api.bugbattle.io" ;
@@ -214,7 +214,7 @@ class BugBattle {
214214 }
215215 }
216216
217- addLog ( args , type ) {
217+ addLog ( args , priority ) {
218218 if ( ! args ) {
219219 return ;
220220 }
@@ -226,7 +226,7 @@ class BugBattle {
226226 this . logArray . push ( {
227227 log : log ,
228228 date : new Date ( ) ,
229- type : type ,
229+ priority ,
230230 } ) ;
231231 }
232232
@@ -245,20 +245,20 @@ class BugBattle {
245245
246246 return {
247247 log : function ( ) {
248- self . addLog ( arguments , "log " ) ;
248+ self . addLog ( arguments , "INFO " ) ;
249249 origConsole . log && origConsole . log . apply ( origConsole , arguments ) ;
250250 } ,
251251 warn : function ( ) {
252- self . addLog ( arguments , "warns " ) ;
252+ self . addLog ( arguments , "WARNING " ) ;
253253 origConsole . warn && origConsole . warn . apply ( origConsole , arguments ) ;
254254 } ,
255255 error : function ( ) {
256- self . addLog ( arguments , "error " ) ;
256+ self . addLog ( arguments , "ERROR " ) ;
257257 origConsole . error && origConsole . error . apply ( origConsole , arguments ) ;
258258 self . startCrashFlow ( ) ;
259259 } ,
260260 info : function ( v ) {
261- self . addLog ( arguments , "info " ) ;
261+ self . addLog ( arguments , "INFO " ) ;
262262 origConsole . info && origConsole . info . apply ( origConsole , arguments ) ;
263263 } ,
264264 } ;
@@ -283,7 +283,7 @@ class BugBattle {
283283
284284 var elem = document . createElement ( "div" ) ;
285285 elem . className = "bugbattle--feedback-dialog-container" ;
286- elem . setAttribute ( "data-html2canvas- ignore" , "true" ) ;
286+ elem . setAttribute ( "data-ignore-bb " , "true" ) ;
287287 elem . innerHTML = `<div class='bugbattle--feedback-dialog'>
288288 <div class="bugbattle--feedback-dialog-header">
289289 <div></div>
@@ -328,7 +328,7 @@ class BugBattle {
328328
329329 var elem = document . createElement ( "div" ) ;
330330 elem . className = "bugbattle--feedback-dialog-container" ;
331- elem . setAttribute ( "data-html2canvas- ignore" , "true" ) ;
331+ elem . setAttribute ( "data-ignore-bb " , "true" ) ;
332332 elem . innerHTML = `<div class='bugbattle--feedback-dialog'>
333333 <div class="bugbattle--feedback-dialog-header">
334334 <div></div>
@@ -477,25 +477,19 @@ class BugBattle {
477477 self . preScreenshotCleanup ( ) ;
478478
479479 window . scrollTo ( self . snapshotPosition . x , self . snapshotPosition . y ) ;
480- html2canvas ( document . body , {
481- x : self . snapshotPosition . x ,
482- y : self . snapshotPosition . y ,
483- width : window . innerWidth ,
484- height : window . innerHeight ,
485- letterRendering : 1 ,
486- allowTaint : true ,
487- useCORS : false ,
488- logging : false ,
489- imageTimeout : 15000 ,
490- proxy : "https://jsproxy.bugbattle.io/" ,
480+
481+ dataURL ( window , {
482+ ignore : [ '[data-ignore-bb~="true"]' ] ,
491483 } )
492- . then ( function ( canvas ) {
493- if ( canvas ) {
494- self . screenshot = canvas . toDataURL ( ) ;
484+ . then ( ( screen ) => {
485+ if ( screen && screen . value ) {
486+ self . screenshot = screen . value ;
495487 self . prepareScreenshot ( ) ;
488+ } else {
489+ self . showError ( ) ;
496490 }
497491 } )
498- . catch ( function ( ) {
492+ . catch ( ( exp ) => {
499493 self . showError ( ) ;
500494 } ) ;
501495 } ;
@@ -828,7 +822,7 @@ class BugBattle {
828822 const self = this ;
829823 var bugReportingEditor = document . createElement ( "div" ) ;
830824 bugReportingEditor . className = "bugbattle-screenshot-editor-container" ;
831- bugReportingEditor . setAttribute ( "data-html2canvas- ignore" , "true" ) ;
825+ bugReportingEditor . setAttribute ( "data-ignore-bb " , "true" ) ;
832826 bugReportingEditor . innerHTML = `
833827 <div class='bugbattle-screenshot-editor-container-inner'>
834828 <div class='bugbattle-screenshot-editor-borderlayer'></div>
0 commit comments