Skip to content

Commit cb2bf76

Browse files
committed
Add comments
1 parent e53fb7c commit cb2bf76

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/actions/clipboard.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ export class Clipboard {
123123
ContextMenuRegistry.registry.register(cutAction);
124124
}
125125

126+
/**
127+
* Precondition function for the cut context menu. This wraps the core cut
128+
* precondition to support context menus.
129+
*
130+
* @param scope scope of the shortcut or context menu item
131+
* @returns 'enabled' if the node can be cut, 'disabled' otherwise.
132+
*/
126133
private cutPrecondition(scope: ContextMenuRegistry.Scope): string {
127134
const focused = scope.focusedNode;
128135
if (!focused || !isCopyable(focused)) return 'hidden';
@@ -139,6 +146,13 @@ export class Clipboard {
139146
return 'disabled';
140147
}
141148

149+
/**
150+
* Precondition function for the copy context menu. This wraps the core copy
151+
* precondition to support context menus.
152+
*
153+
* @param scope scope of the shortcut or context menu item
154+
* @returns 'enabled' if the node can be copied, 'disabled' otherwise.
155+
*/
142156
private copyPrecondition(scope: ContextMenuRegistry.Scope): string {
143157
const focused = scope.focusedNode;
144158
if (!focused || !isCopyable(focused)) return 'hidden';
@@ -155,6 +169,13 @@ export class Clipboard {
155169
return 'disabled';
156170
}
157171

172+
/**
173+
* Precondition function for the paste context menu. This wraps the core
174+
* paste precondition to support context menus.
175+
*
176+
* @param scope scope of the shortcut or context menu item
177+
* @returns 'enabled' if the node can be pasted, 'disabled' otherwise.
178+
*/
158179
private pastePrecondition(scope: ContextMenuRegistry.Scope): string {
159180
if (!this.copyWorkspace) return 'disabled';
160181

0 commit comments

Comments
 (0)