File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ export default class Topbar extends React.Component {
139139
140140 }
141141
142+ clearEditor = ( ) => {
143+ if ( window . localStorage ) {
144+ window . localStorage . removeItem ( 'swagger-editor-content' ) ;
145+ this . props . specActions . updateSpec ( '' ) ;
146+ }
147+ }
148+
142149 // Helpers
143150
144151 showModal = ( ) => {
@@ -178,6 +185,8 @@ export default class Topbar extends React.Component {
178185 < li role = "separator" > </ li >
179186 < li > < button type = "button" onClick = { this . saveAsYaml } > Download YAML</ button > </ li >
180187 < li > < button type = "button" onClick = { this . saveAsJson } > Download JSON</ button > </ li >
188+ < li role = "separator" > </ li >
189+ < li > < button type = "button" onClick = { this . clearEditor } > Clear editor</ button > </ li >
181190 </ DropdownMenu >
182191 < DropdownMenu { ...makeMenuOptions ( "Edit" ) } >
183192 < li > < button type = "button" onClick = { this . convertToYaml } > Convert to YAML</ button > </ li >
You can’t perform that action at this time.
0 commit comments