dididy commented on code in PR #5064: URL: https://github.com/apache/zeppelin/pull/5064#discussion_r2325342044
########## zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts: ########## @@ -576,6 +543,75 @@ export class NotebookParagraphComponent extends ParagraphBase implements OnInit, event.preventDefault(); this.cancelParagraph(); break; + case ParagraphActions.MoveCursorUp: + event.preventDefault(); + this.moveCursorUp(); + break; + case ParagraphActions.MoveCursorDown: + event.preventDefault(); + this.moveCursorDown(); + break; + case ParagraphActions.Delete: + this.removeParagraph(); + break; + case ParagraphActions.InsertAbove: + this.insertParagraph('above'); + break; + case ParagraphActions.InsertBelow: + this.insertParagraph('below'); + break; + case ParagraphActions.InsertCopyOfParagraphBelow: + this.cloneParagraph('below'); Review Comment: #5044 If the current issue is the one where a blank paragraph appears when cloning a paragraph and only shows the cloned content correctly after a refresh, a PR for this had already been opened. The points raised in the previous review have been addressed, and I’ve also updated the code to handle additional cases. ########## zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/code-editor/code-editor.component.ts: ########## @@ -120,6 +121,71 @@ export class NotebookParagraphCodeEditorComponent implements OnChanges, OnDestro '!suggestWidgetVisible' ); + this.editor.addCommand(monaco.KeyMod.WinCtrl | monaco.KeyMod.Alt | monaco.KeyCode.KeyE, () => { + this.toggleEditorShow.emit(); + }); + + this.editor.addCommand(monaco.KeyMod.WinCtrl | monaco.KeyCode.KeyK, async () => { + if (this.editor) { + const position = this.editor.getPosition(); + const model = this.editor.getModel(); + if (!position || !model) { + return; + } + + const lineNumber = position.lineNumber; + const lineContent = model.getLineContent(lineNumber); + + if (!lineContent) { + return; + } + + await navigator.clipboard.writeText(lineContent); + + this.editor.executeEdits('cut-line', [ + { + range: new monaco.Range(lineNumber, 1, lineNumber, lineContent.length + 1), + text: '', + forceMoveMarkers: true + } + ]); + } + }); + + this.editor.addCommand(monaco.KeyMod.WinCtrl | monaco.KeyCode.KeyY, async () => { + if (this.editor) { + const text = await navigator.clipboard.readText(); + const position = this.editor.getPosition(); + if (position) { + this.editor.executeEdits('my-source', [ + { + range: new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column), + text: text, + forceMoveMarkers: true + } + ]); + } + } + }); + + this.editor.addCommand(monaco.KeyMod.WinCtrl | monaco.KeyCode.KeyS, async () => { + if (this.editor) { + const controller = this.editor.getContribution( + 'editor.contrib.findController' + ) as MonacoEditor.IEditorContribution & { + start(options: { forceRevealReplace: boolean; seedSearchStringFromSelection: boolean }): void; + getFindInputFocusElement(): HTMLElement | null; + }; + if (controller) { + controller.start({ + forceRevealReplace: false, + seedSearchStringFromSelection: true + }); + controller.getFindInputFocusElement()?.focus(); + } Review Comment: f75faa9 This code is meant to open the editor's find widget and focus it, but it wasn’t working correctly. The `getFindInputFocusElement()` method doesn’t work in current old versions of the Monaco editor, so I changed it to use a query selector to get the element and manually trigger the focus event. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org