File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 301301 width : 20px ;
302302 height : 20px ;
303303 }
304+
305+ .tool-button : disabled {
306+ opacity : 0.3 ;
307+ cursor : not-allowed;
308+ pointer-events : none;
309+ }
310+
311+ .tool-button : disabled : hover {
312+ transform : none;
313+ background : var (--color-surface );
314+ }
304315 </ style >
305316</ head >
306317< body >
310321 < div class ="shortcuts ">
311322 < span > < span class ="shortcut-key "> A</ span > Arrow</ span >
312323 < span > < span class ="shortcut-key "> R</ span > Rectangle</ span >
324+ < span > < span class ="shortcut-key "> Ctrl+Z</ span > Undo</ span >
313325 < span > < span class ="shortcut-key "> Esc</ span > Cancel</ span >
314326 < span > < span class ="shortcut-key "> Ctrl+Enter</ span > Save</ span >
315327 </ div >
332344 < rect x ="3 " y ="3 " width ="18 " height ="18 " rx ="2 " ry ="2 "> </ rect >
333345 </ svg >
334346 </ button >
347+ < button class ="tool-button " id ="undo-button " data-tooltip ="Undo (Ctrl+Z) " disabled >
348+ < svg width ="20 " height ="20 " viewBox ="0 0 24 24 " fill ="none " stroke ="currentColor " stroke-width ="2 " stroke-linecap ="round " stroke-linejoin ="round ">
349+ < polyline points ="1 4 1 10 7 10 "> </ polyline >
350+ < path d ="M3.51 15a9 9 0 1 0 2.13-9.36L1 10 "> </ path >
351+ </ svg >
352+ </ button >
335353 </ div >
336354
337355 < div class ="toolbar-section ">
Original file line number Diff line number Diff line change 3636 img . src = screenshotDataUrl ;
3737 }
3838
39+ // Undo last annotation
40+ function undo ( ) {
41+ if ( annotations . length === 0 ) return ;
42+ annotations . pop ( ) ;
43+ redrawCanvas ( ) ;
44+ updateUndoButton ( ) ;
45+ }
46+
47+ // Enable/disable undo button based on annotations count
48+ function updateUndoButton ( ) {
49+ document . getElementById ( 'undo-button' ) . disabled = annotations . length === 0 ;
50+ }
51+
3952 // Redraw canvas with base image and all annotations
4053 function redrawCanvas ( ) {
4154 // Clear canvas
168181 }
169182
170183 redrawCanvas ( ) ;
184+ updateUndoButton ( ) ;
171185 } ) ;
172186
173187 // Tool selection
185199 canvas . className = 'tool-rectangle' ;
186200 } ) ;
187201
202+ // Undo button
203+ document . getElementById ( 'undo-button' ) . addEventListener ( 'click' , undo ) ;
204+
188205 // Action buttons
189206 document . getElementById ( 'save-with-annotations' ) . addEventListener ( 'click' , ( ) => {
190207 // Get final canvas as data URL
228245 document . getElementById ( 'arrow-tool' ) . click ( ) ;
229246 } else if ( e . key === 'r' || e . key === 'R' ) {
230247 document . getElementById ( 'rectangle-tool' ) . click ( ) ;
248+ } else if ( e . key === 'z' && ( e . ctrlKey || e . metaKey ) ) {
249+ e . preventDefault ( ) ;
250+ undo ( ) ;
231251 } else if ( e . key === 'Enter' && ( e . ctrlKey || e . metaKey ) ) {
232252 document . getElementById ( 'save-with-annotations' ) . click ( ) ;
233253 }
Original file line number Diff line number Diff line change 11{
22 "manifest_version" : 3 ,
33 "name" : " Exploratory Testing Extension" ,
4- "version" : " 4.0.1 " ,
4+ "version" : " 4.1.0 " ,
55 "description" : " Chrome extension for exploratory testing" ,
66 "permissions" : [
77 " storage" ,
You can’t perform that action at this time.
0 commit comments