|
8 | 8 |
|
9 | 9 | import {BlockSvg} from './block_svg.js'; |
10 | 10 | import * as clipboard from './clipboard.js'; |
11 | | -import { RenderedWorkspaceComment } from './comments.js'; |
| 11 | +import {RenderedWorkspaceComment} from './comments.js'; |
12 | 12 | import * as eventUtils from './events/utils.js'; |
13 | 13 | import {getFocusManager} from './focus_manager.js'; |
14 | 14 | import {Gesture} from './gesture.js'; |
15 | | -import { |
16 | | - ICopyable, |
17 | | - ICopyData, |
18 | | - isCopyable as isICopyable, |
19 | | -} from './interfaces/i_copyable.js'; |
20 | | -import { |
21 | | - IDeletable, |
22 | | - isDeletable as isIDeletable, |
23 | | -} from './interfaces/i_deletable.js'; |
24 | | -import {IDraggable, isDraggable} from './interfaces/i_draggable.js'; |
| 15 | +import {ICopyData, isCopyable as isICopyable} from './interfaces/i_copyable.js'; |
| 16 | +import {isDeletable as isIDeletable} from './interfaces/i_deletable.js'; |
| 17 | +import {isDraggable} from './interfaces/i_draggable.js'; |
25 | 18 | import {IFocusableNode} from './interfaces/i_focusable_node.js'; |
26 | 19 | import {KeyboardShortcut, ShortcutRegistry} from './shortcut_registry.js'; |
27 | 20 | import {Coordinate} from './utils/coordinate.js'; |
@@ -182,17 +175,27 @@ export function registerCopy() { |
182 | 175 | e.preventDefault(); |
183 | 176 |
|
184 | 177 | const focused = scope.focusedNode; |
185 | | - if (!focused || !isCopyable(focused)) return false; |
186 | | - let targetWorkspace: WorkspaceSvg | null = |
187 | | - focused.workspace instanceof WorkspaceSvg |
188 | | - ? focused.workspace |
| 178 | + if (!focused || !isICopyable(focused) || !isCopyable(focused)) |
| 179 | + return false; |
| 180 | + let targetWorkspace: WorkspaceSvg | null; |
| 181 | + let hideChaff = false; |
| 182 | + if (focused instanceof BlockSvg) { |
| 183 | + hideChaff = !focused.workspace.isFlyout; |
| 184 | + targetWorkspace = |
| 185 | + focused.workspace instanceof WorkspaceSvg |
| 186 | + ? focused.workspace |
| 187 | + : workspace; |
| 188 | + targetWorkspace = targetWorkspace.isFlyout |
| 189 | + ? targetWorkspace.targetWorkspace |
| 190 | + : targetWorkspace; |
| 191 | + } else { |
| 192 | + targetWorkspace = workspace.isFlyout |
| 193 | + ? workspace.targetWorkspace |
189 | 194 | : workspace; |
190 | | - targetWorkspace = targetWorkspace.isFlyout |
191 | | - ? targetWorkspace.targetWorkspace |
192 | | - : targetWorkspace; |
| 195 | + } |
193 | 196 | if (!targetWorkspace) return false; |
194 | 197 |
|
195 | | - if (!focused.workspace.isFlyout) { |
| 198 | + if (hideChaff) { |
196 | 199 | targetWorkspace.hideChaff(); |
197 | 200 | } |
198 | 201 | copyData = focused.toCopyData(); |
|
0 commit comments