File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -403,14 +403,29 @@ export const ReadOnly: Story = {
403
403
}
404
404
} ,
405
405
decorators : [
406
- ( Story , context ) => {
406
+ ( Story ) => {
407
407
const { inputXml, urlToBase64 } = useRemoteFile ( ) ;
408
+ const [ editMode , setEditMode ] = useState ( false ) ;
408
409
409
410
useEffect ( ( ) => {
410
411
urlToBase64 ( '/mydrawio.png' ) ;
411
412
} , [ ] ) ;
412
413
413
- return < Story args = { { ...context . args , xml : inputXml } } /> ;
414
+ return (
415
+ < >
416
+ < button onClick = { ( ) => setEditMode ( ! editMode ) } >
417
+ Toggle view/edit
418
+ </ button >
419
+ < Story
420
+ args = { {
421
+ // Key was only added for rerendering the component properly
422
+ key : editMode ? 'draw-edit' : 'draw-view' ,
423
+ urlParameters : { lightbox : ! editMode } ,
424
+ xml : inputXml
425
+ } }
426
+ />
427
+ </ >
428
+ ) ;
414
429
}
415
430
]
416
431
} ;
You can’t perform that action at this time.
0 commit comments