Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/475#discussion_r38317733
--- Diff: app/addons/components/react-components.react.jsx ---
@@ -385,18 +495,145 @@ function (app, FauxtonAPI, React, Components, ace,
beautifyHelper) {
return this;
},
+ getLine: function (lineNum) {
+ return this.editor.session.getLine(lineNum);
+ },
+
+ getSelectionStart: function () {
+ return this.editor.getSelectionRange().start;
+ },
+
+ getSelectionEnd: function () {
+ return this.editor.getSelectionRange().end;
+ },
+
+ getRowHeight: function () {
+ return this.editor.renderer.layerConfig.lineHeight;
+ },
+
+ isRowExpanded: function (row) {
+ return !this.editor.getSession().isRowFolded(row);
+ },
+
+ documentToScreenRow: function (row) {
+ return this.editor.getSession().documentToScreenRow(row, 0);
+ },
+
+ replaceCurrentLine: function (replacement) {
+ this.editor.getSelection().selectLine();
+ this.editor.insert(replacement);
+ this.editor.getSelection().moveCursorUp();
+ },
+
+ render: function () {
+ return (
+ <div>
+ <div ref="ace" className="js-editor" id={this.props.id}></div>
+ <button ref="stringEditIcon" className="btn string-edit"
title="Edit string" disabled={!this.state.stringEditIconVisible}
+ style={this.state.stringEditIconStyle}
onClick={this.openStringEditModal}>
+ <i className="icon icon-edit"></i>
+ </button>
+ <StringEditModal
+ ref="stringEditModal"
+ visible={this.state.stringEditModalVisible}
+ onSave={this.saveStringEditModal}
+ onClose={this.closeStringEditModal} />
--- End diff --
this callback means that the subcomponent directly alters the state of the
parent component, i think in react we have to use actions and stores to
transfer state to components.
---
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.
---