Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/204#discussion_r22274463
  
    --- Diff: app/addons/documents/views-doceditor.js ---
    @@ -529,13 +454,160 @@ function (app, FauxtonAPI, Components, Documents, 
Databases, prettify) {
               showHideEditDocString(event);
             });
     
    +        // place focus on the editor
    +        editor.editor.focus();
    +
           }.bind(this));
    +
    +      // this sucks having to reference #dashboard, but when user clicks 
in the region below the editor I want it
    +      // to focus on the final line. It feels natural that way
    +      $('.scrollable').on('click', function(e) {
    --- End diff --
    
    this is a bit funky - we have access to `.scrollable` so I also can't 
imagine why we should do it that way? to reuse the local variables in the scope?
    
    here is a solution (at the top of the literal):
    ```javascript
      Views.CodeEditor = FauxtonAPI.View.extend({
        template: 'addons/documents/templates/code_editor',
        className: 'editor-content-page',
        events: {
          'click button.save-doc': 'saveDoc',
          'click button.delete': 'destroy',
          'click button.duplicate': 'duplicate',
          'click button.upload': 'upload',
          'click button.string-edit': 'stringEditing',
          'click a.js-back': 'onClickGoBack',
          'click .scrollable': 'focusOnLastLine'
        },
    
        focusOnLastLine: function (e) {
          var clickedInEditor = $(e.target).closest('#editor-container');
          if (clickedInEditor.length === 0) {
            this.editor.editor.focus();
            var session = this.editor.editor.getSession();
            var count = session.getLength();
            this.editor.editor.gotoLine(count, session.getLine(count-1).length);
          }
        },
    
    
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to