Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/251#discussion_r14065694
--- Diff: src/fauxton/app/addons/documents/views.js ---
@@ -765,6 +805,46 @@ function(app, FauxtonAPI, Components, Documents,
Databases, pouchdb,
FauxtonAPI.navigate(this.database.url("index") + "?limit=100");
},
+ determineStringEditMatch: function(event) {
+ var selStart = this.editor.editor.getSelectionRange().start.row;
+ var selEnd = this.editor.editor.getSelectionRange().end.row;
+ if (selStart >=0 && selEnd >= 0 && selStart == selEnd) {
+ var editLine = this.editor.editor.session.getLine(selStart);
+ var editMatch = editLine.match(/^([ \t]*)("[a-zA-Z0-9_]*": )?(".*",?[
\t]*)$/);
+ if (editMatch) {
+ return editMatch;
+ } else {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ },
+
+ isStringEditingPossible: function (event) {
+ var editMatch = this.determineStringEditMatch(event);
+ if (editMatch) {
+ return true;
+ }
+ return false;
+ },
+
+ stringEditing: function(event) {
+ event.preventDefault();
+ var editMatch = this.determineStringEditMatch(event);
+ if (editMatch) {
+ var indent = editMatch[1] || "";
+ var hashKey = editMatch[2] || "";
+ var editText = editMatch[3];
+ var comma = "";
--- End diff --
This is just a personal taste and what we do in Fauxton. But could you make
these variables only use one `var`. eg:
var indent = editMatch[1] || "",
hashKey = editMatch[2] || "",
editText = editMatch[3],
comma = "";
---
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 [email protected] or file a JIRA ticket
with INFRA.
---