File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/packages/frontend/frame-editors/code-editor Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1281,11 +1281,29 @@ export class Actions<
1281
1281
}
1282
1282
1283
1283
time_travel ( opts : { path ?: string ; frame ?: boolean } ) : void {
1284
+ const path = opts ?. path ?? this . path ;
1285
+ if ( path . startsWith ( ".snapshots/" ) ) {
1286
+ // see https://github.com/sagemathinc/cocalc/issues/2588
1287
+ let file = path . slice ( ".snapshots/" . length ) ;
1288
+ // if file's first path segment starts with an iso timestamp like, '2023-06-03-153543', remove that:
1289
+ const parts = file . split ( "/" ) ;
1290
+ if ( parts . length > 0 && / ^ \d { 4 } - \d { 2 } - \d { 2 } - \d { 6 } $ / . test ( parts [ 0 ] ) ) {
1291
+ parts . shift ( ) ;
1292
+ file = parts . join ( "/" ) ;
1293
+ }
1294
+ const hist = history_path ( file ) ;
1295
+ this . _get_project_actions ( ) . open_file ( {
1296
+ path : hist ,
1297
+ foreground : true ,
1298
+ } ) ;
1299
+ return ;
1300
+ }
1301
+
1284
1302
if ( opts . frame ) {
1285
1303
this . show_focused_frame_of_type ( "time_travel" ) ;
1286
1304
} else {
1287
1305
this . _get_project_actions ( ) . open_file ( {
1288
- path : history_path ( opts . path || this . path ) ,
1306
+ path : history_path ( path ) ,
1289
1307
foreground : true ,
1290
1308
} ) ;
1291
1309
}
You can’t perform that action at this time.
0 commit comments