couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to fd89698
Date Fri, 23 Oct 2015 17:42:39 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 537853e2f -> fd8969801


remove doc-editor check

i quite often run into the problem where i want to copy the json
of an existing doc for testing. i copy the whole json, click
"new doc" and have toremoev the _rev in order to save it.
sometimes i also want to remove the id, to get a random one. right
now i have to copy/paste the json into an offline editor before
that as the fauxton editor tells me i can't delete the rev or id
and refuses to make changes.

PR: #566
PR-URL: https://github.com/apache/couchdb-fauxton/pull/566
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/fd896980
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/fd896980
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/fd896980

Branch: refs/heads/master
Commit: fd896980199174bf77bf7fe0ed4fe20aa3afb9c0
Parents: 537853e
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Oct 23 13:10:05 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Fri Oct 23 19:42:28 2015 +0200

----------------------------------------------------------------------
 .../documents/doc-editor/components.react.jsx   | 35 +-------------------
 1 file changed, 1 insertion(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/fd896980/app/addons/documents/doc-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/components.react.jsx b/app/addons/documents/doc-editor/components.react.jsx
index 252654c..90f6c24 100644
--- a/app/addons/documents/doc-editor/components.react.jsx
+++ b/app/addons/documents/doc-editor/components.react.jsx
@@ -58,43 +58,10 @@ define([
           autoFocus={true}
           editorCommands={editorCommands}
           notifyUnsavedChanges={true}
-          stringEditModalEnabled={true}
-          change={this.onChangeDoc} />
+          stringEditModalEnabled={true} />
       );
     },
 
-    onChangeDoc: function (doc) {
-      // super ugly, but necessary. This tells the user they can't delete the _id or _rev
fields as they type and actually
-      // prevents it from being removed in the editable doc
-      var json;
-      try {
-        json = JSON.parse(doc);
-      } catch (exception) {
-        return;
-      }
-
-      var keyChecked = ['_id'];
-      if (this.state.doc.get('_rev')) {
-        keyChecked.push('_rev');
-      }
-      if (_.isEmpty(_.difference(keyChecked, _.keys(json)))) {
-        return;
-      }
-
-      this.getEditor().setReadOnly(true);
-      setTimeout(function () { this.getEditor().setReadOnly(false); }.bind(this), 400);
-
-      // extend ensures _id stays at the top of the editor doc
-      json = _.extend({ _id: this.state.doc.id, _rev: this.state.doc.get('_rev') }, json);
-      this.getEditor().setValue(JSON.stringify(json, null, '  '));
-
-      FauxtonAPI.addNotification({
-        type: 'error',
-        msg: "Cannot remove a document's id or revision.",
-        clear: true
-      });
-    },
-
     componentDidMount: function () {
       store.on('change', this.onChange, this);
     },


Mime
View raw message