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

    https://github.com/apache/couchdb-fauxton/pull/475#discussion_r38589067
  
    --- Diff: app/addons/documents/doc-editor/components.react.jsx ---
    @@ -0,0 +1,540 @@
    +define([
    +  'api',
    +  'app',
    +  'react',
    +  'addons/documents/doc-editor/actions',
    +  'addons/documents/doc-editor/stores',
    +  'addons/fauxton/components.react',
    +  'addons/components/react-components.react',
    +  'helpers'
    +], function (FauxtonAPI, app, React, Actions, Stores, FauxtonComponents, 
GeneralComponents, Helpers) {
    +
    +  var store = Stores.docEditorStore;
    +
    +
    +  var DocEditorController = React.createClass({
    +
    +    getInitialState: function () {
    +      return this.getStoreState();
    +    },
    +
    +    getStoreState: function () {
    +      return {
    +        isLoading: store.isLoading(),
    +        doc: store.getDoc(),
    +        cloneDocModalVisible: store.isCloneDocModalVisible(),
    +        uploadModalVisible: store.isUploadModalVisible(),
    +        deleteDocModalVisible: store.isDeleteDocModalVisible()
    +      };
    +    },
    +
    +    getDefaultProps: function () {
    +      return {
    +        database: {},
    +        previousPage: '',
    +        isNewDoc: false
    +      };
    +    },
    +
    +    getCodeEditor: function () {
    +      if (this.state.isLoading) {
    +        return (<GeneralComponents.LoadLines />);
    +      }
    +
    +      var code = JSON.stringify(this.state.doc.attributes, null, '  ');
    +      var editorCommands = [{
    +        name: 'save',
    +        bindKey: { win: 'Ctrl-S', mac: 'Ctrl-S' },
    +        exec: this.saveDoc
    +      }];
    +
    +      return (
    +        <GeneralComponents.CodeEditor
    +          id="docEditor"
    +          ref="docEditor"
    +          defaultCode={code}
    +          mode="json"
    +          autoFocus={true}
    +          editorCommands={editorCommands}
    +          notifyUnsavedChanges={true}
    +          stringEditModalEnabled={true}
    +          change={this.onChangeDoc} />
    +      );
    +    },
    +
    +    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
    --- End diff --
    
    I agree, be nice to remove. But I played around with it + it'll require a 
little more effort to check for the values + do a create request for that 
scenario. Very doable, but I'm relegating it to the Out Of Scope pile for now. 
:)


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

Reply via email to