dididy commented on code in PR #5057:
URL: https://github.com/apache/zeppelin/pull/5057#discussion_r2319341188


##########
zeppelin-web-angular/src/app/pages/workspace/notebook/paragraph/paragraph.component.ts:
##########
@@ -217,7 +221,8 @@ export class NotebookParagraphComponent extends 
ParagraphBase implements OnInit,
     if (this.paragraph.config.editorSetting.editOnDblClick && 
this.revisionView !== true) {
       this.paragraph.config.editorHide = false;
       this.paragraph.config.tableHide = true;
-      // TODO(hsuanxyz): focus editor
+      this.focusEditor();
+      setTimeout(() => 
this.notebookParagraphCodeEditorComponent?.setCursorPositionToEnd());

Review Comment:
   3d48cfe
   
   I didn’t know much about Angular’s lifecycle before, but after looking into 
`markForCheck()`, I checked it out a bit. In the current situation, it seemed 
possible to use `this.cdr.detectChanges()`, and it worked as I intended.  
   
   `this.cdr.detectChanges()` forces Angular to immediately check and update 
the current component and its child views, eliminating the need to wait for the 
next rendering cycle with `setTimeout()`.  
   
   However, this doesn’t solve the issue for focusing the Monaco editor(you 
mentioned below comment). It’s probably due to Monaco’s complex DOM structure 
and rendering behavior. I’ll need to look into it further.



-- 
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

Reply via email to