File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -303,13 +303,17 @@ export class Clipboard {
303303 const pasteAction : ContextMenuRegistry . RegistryItem = {
304304 displayText : ( scope ) => `Paste (${ this . getPlatformPrefix ( ) } V)` ,
305305 preconditionFn : ( scope ) => {
306- const ws = scope . block ?. workspace ;
306+ const ws =
307+ scope . block ?. workspace ??
308+ ( scope as any ) . connection ?. getSourceBlock ( ) . workspace ;
307309 if ( ! ws ) return 'hidden' ;
308310
309311 return this . pastePrecondition ( ws ) ? 'enabled' : 'disabled' ;
310312 } ,
311313 callback : ( scope ) => {
312- const ws = scope . block ?. workspace ;
314+ const ws =
315+ scope . block ?. workspace ??
316+ ( scope as any ) . connection ?. getSourceBlock ( ) . workspace ;
313317 if ( ! ws ) return ;
314318 return this . pasteCallback ( ws ) ;
315319 } ,
Original file line number Diff line number Diff line change @@ -1365,7 +1365,12 @@ export class Navigation {
13651365 const insertAction =
13661366 Blockly . ContextMenuRegistry . registry . getItem ( 'insert' ) ;
13671367 if ( ! insertAction ) throw new Error ( "can't find insert action" ) ;
1368- const possibleOptions = [ insertAction /* etc.*/ ] ;
1368+
1369+ const pasteAction = Blockly . ContextMenuRegistry . registry . getItem (
1370+ 'blockPasteFromContextMenu' ,
1371+ ) ;
1372+ if ( ! pasteAction ) throw new Error ( "can't find paste action" ) ;
1373+ const possibleOptions = [ insertAction , pasteAction /* etc.*/ ] ;
13691374
13701375 // Check preconditions and get menu texts.
13711376 const scope = {
You can’t perform that action at this time.
0 commit comments