-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from XpressAI/adry/cut-copy-paste
✨Enable cut, copy and paste node
- Loading branch information
Showing
7 changed files
with
197 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Action, ActionEvent, InputType } from '@projectstorm/react-canvas-core'; | ||
import { JupyterFrontEnd } from '@jupyterlab/application'; | ||
import { commandIDs } from '../components/xircuitBodyWidget'; | ||
|
||
interface CustomActionEventOptions { | ||
app: JupyterFrontEnd; | ||
} | ||
|
||
export class CustomActionEvent extends Action { | ||
constructor(options: CustomActionEventOptions) { | ||
super({ | ||
type: InputType.KEY_DOWN, | ||
fire: (event: ActionEvent<React.KeyboardEvent>) => { | ||
const app = options.app; | ||
const keyCode = event.event.key; | ||
const ctrlKey = event.event.ctrlKey; | ||
|
||
// Comment this first until the TODO below is fix | ||
// if (ctrlKey && keyCode === 'x') app.commands.execute(commandIDs.cutNode); | ||
// if (ctrlKey && keyCode === 'c') app.commands.execute(commandIDs.copyNode); | ||
// TODO: Fix this paste issue where it paste multiple times. | ||
// if (ctrlKey && keyCode === 'v') app.commands.execute(commandIDs.pasteNode); | ||
if (keyCode == 'Delete' || keyCode == 'Backspace') app.commands.execute(commandIDs.deleteNode); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters