couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowalski <...@git.apache.org>
Subject [GitHub] couchdb-fauxton pull request: Update full page document editor
Date Thu, 25 Dec 2014 16:46:27 GMT
Github user robertkowalski commented on a diff in the pull request:

    https://github.com/apache/couchdb-fauxton/pull/204#discussion_r22274475
  
    --- 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) {
    +        var clickedInEditor = $(e.target).closest('#editor-container');
    +        if (clickedInEditor.length === 0) {
    +          editor.editor.focus();
    +          var session = editor.editor.getSession();
    +          var count = session.getLength();
    +          editor.editor.gotoLine(count, session.getLine(count-1).length);
    +        }
    +      });
    +    },
    +
    +    serialize: function () {
    +      return {
    +        doc: this.model,
    +        attachments: this.getAttachments()
    +      };
    +    },
    +
    +    getAttachments: function () {
    +      var attachments = this.model.get('_attachments');
    +      if (!attachments) { return false; }
    +
    +      return _.map(attachments, function (att, key) {
    +        return {
    +          fileName: key,
    +          size: att.length,
    +          contentType: att.content_type,
    +          url: this.model.url() + '/' + app.utils.safeURLName(key)
    +        };
    +      }, this);
    +    },
    +
    +    determineStringEditMatch: function (event) {
    +      var selStart = this.editor.getSelectionStart().row;
    +      var selEnd = this.editor.getSelectionEnd().row;
    +
    +      // one JS(ON) string can't span more than one line - we edit one string, so ensure
we don't select several lines
    +      if (selStart >=0 && selEnd >= 0 && selStart === selEnd &&
this.editor.isRowExpanded(selStart)) {
    +        var editLine = this.editor.getLine(selStart),
    +            editMatch = editLine.match(/^([ \t]*)(["|'][a-zA-Z0-9_]*["|']: )?(["|'].*["|'],?[
\t]*)$/);
    +
    +        if (editMatch) {
    +          return editMatch;
    +        }
    +      }
    +      return null;
    +    },
    +
    +    showHideEditDocString: function (event) {
    --- End diff --
    
    What is the reason to move all that code around in this diff? It makes it very hard to
review for me


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message