From cca79f98df304b5cb2f0d753ec7524abbc614e45 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Fri, 13 Jul 2018 13:17:44 -0700 Subject: [PATCH 1/3] fix: modal height CSS bug --- src/standalone/topbar/topbar.jsx | 4 ++-- src/standalone/topbar/topbar.less | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/standalone/topbar/topbar.jsx b/src/standalone/topbar/topbar.jsx index 73d504f4fcc..9248aa4b5a8 100644 --- a/src/standalone/topbar/topbar.jsx +++ b/src/standalone/topbar/topbar.jsx @@ -384,7 +384,7 @@ export default class Topbar extends React.Component { : null } - +

Upload file

@@ -394,7 +394,7 @@ export default class Topbar extends React.Component {
- +

Code generation for OAS3 is currently work in progress. The available languages is smaller than the for OAS/Swagger 2.0 and is constantly being updated. diff --git a/src/standalone/topbar/topbar.less b/src/standalone/topbar/topbar.less index 1fc0cabfc5d..b4339a91e7f 100644 --- a/src/standalone/topbar/topbar.less +++ b/src/standalone/topbar/topbar.less @@ -84,6 +84,8 @@ } .modal { + font-family: sans-serif; + color: #3b4151; padding: 1em; position: relative; min-height: 12em; From 56119fa0ab0230b72ffebd2f1794bdeae883cce3 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Tue, 17 Jul 2018 15:12:13 -0700 Subject: [PATCH 2/3] Migrate split-pane-mode and ast plugins to Editor --- package.json | 1 + src/plugins/ast/index.js | 4 +- src/plugins/ast/jump-to-path.jsx | 9 -- .../components/split-pane-mode.jsx | 85 +++++++++++++++++++ src/plugins/split-pane-mode/index.js | 15 ++++ 5 files changed, 102 insertions(+), 12 deletions(-) delete mode 100644 src/plugins/ast/jump-to-path.jsx create mode 100644 src/plugins/split-pane-mode/components/split-pane-mode.jsx create mode 100644 src/plugins/split-pane-mode/index.js diff --git a/package.json b/package.json index dbcb3118362..0479f262eb7 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "react-file-download": "^0.3.2", "react-immutable-proptypes": "^2.1.0", "react-redux": "^4.x.x", + "react-split-pane": "^0.1.82", "react-transition-group": "^1.1.1", "redux": "^3.x.x", "reselect": "^2.5.4", diff --git a/src/plugins/ast/index.js b/src/plugins/ast/index.js index 39bda25073f..feaeb530d93 100644 --- a/src/plugins/ast/index.js +++ b/src/plugins/ast/index.js @@ -1,9 +1,7 @@ import * as AST from "./ast" -import JumpToPath from "./jump-to-path" export default function() { return { - fn: { AST }, - components: { JumpToPath } + fn: { AST } } } diff --git a/src/plugins/ast/jump-to-path.jsx b/src/plugins/ast/jump-to-path.jsx deleted file mode 100644 index 5f385982e2b..00000000000 --- a/src/plugins/ast/jump-to-path.jsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react" - -// Nothing by default- component can be overriden by another plugin. - -export default class JumpToPath extends React.Component { - render() { - return null - } -} diff --git a/src/plugins/split-pane-mode/components/split-pane-mode.jsx b/src/plugins/split-pane-mode/components/split-pane-mode.jsx new file mode 100644 index 00000000000..c1a8fa9c2a9 --- /dev/null +++ b/src/plugins/split-pane-mode/components/split-pane-mode.jsx @@ -0,0 +1,85 @@ +import React from "react" +import PropTypes from "prop-types" +import SplitPane from "react-split-pane" + +const MODE_KEY = ["split-pane-mode"] +const MODE_LEFT = "left" +const MODE_RIGHT = "right" +const MODE_BOTH = "both" // or anything other than left/right + +export default class SplitPaneMode extends React.Component { + + static propTypes = { + threshold: PropTypes.number, + + children: PropTypes.array, + + layoutSelectors: PropTypes.object.isRequired, + layoutActions: PropTypes.object.isRequired, + }; + + static defaultProps = { + threshold: 100, // in pixels + children: [], + }; + + initializeComponent = (c) => { + this.splitPane = c + } + + onDragFinished = () => { + let { threshold, layoutActions } = this.props + let { position, draggedSize } = this.splitPane.state + this.draggedSize = draggedSize + + let nearLeftEdge = position <= threshold + let nearRightEdge = draggedSize <= threshold + + layoutActions + .changeMode(MODE_KEY, ( + nearLeftEdge + ? MODE_RIGHT : nearRightEdge + ? MODE_LEFT : MODE_BOTH + )) + } + + sizeFromMode = (mode, defaultSize) => { + if(mode === MODE_LEFT) { + this.draggedSize = null + return "0px" + } else if (mode === MODE_RIGHT) { + this.draggedSize = null + return "100%" + } + // mode === "both" + return this.draggedSize || defaultSize + } + + render() { + let { children, layoutSelectors } = this.props + + const mode = layoutSelectors.whatMode(MODE_KEY) + const left = mode === MODE_RIGHT ?