diff --git a/README.md b/README.md index bb070d0..e1067e1 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,22 @@ Specify source code that is run before the main source. This code will not be sh ``` +### theme : string + +Create your own theme [here](https://runkit.com/docs/theme-maker). Then, reference the syntax name using `theme`. + +```js + +``` + +### gutterStyle : string + +Control whether the line number gutter is rendered inside or outside the code pane. Defaults to `'outside'`; + +```js + +``` + ### onLoad : function Provide a callback that is run when the embed is loaded. @@ -163,4 +179,3 @@ class App extends React.Component { } } ``` - diff --git a/dist/react-runkit.js b/dist/react-runkit.js index e626706..e94128b 100644 --- a/dist/react-runkit.js +++ b/dist/react-runkit.js @@ -64,7 +64,7 @@ module.exports = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 7); +/******/ return __webpack_require__(__webpack_require__.s = 8); /******/ }) /************************************************************************/ /******/ ([ @@ -461,6 +461,23 @@ module.exports = warning; /* 5 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (text) { + var str = text.toString(); + + return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'); +}; + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -485,23 +502,23 @@ if (process.env.NODE_ENV !== 'production') { // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; - module.exports = __webpack_require__(10)(isValidElement, throwOnDirectAccess); + module.exports = __webpack_require__(11)(isValidElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(9)(); + module.exports = __webpack_require__(10)(); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 6 */ +/* 7 */ /***/ (function(module, exports) { module.exports = require("react"); /***/ }), -/* 7 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -511,14 +528,20 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _urlencode = __webpack_require__(5); + +var _urlencode2 = _interopRequireDefault(_urlencode); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } -var React = __webpack_require__(6); -var PropTypes = __webpack_require__(5); +var React = __webpack_require__(7); +var PropTypes = __webpack_require__(6); var Embed = function (_React$Component) { _inherits(Embed, _React$Component); @@ -564,6 +587,10 @@ var Embed = function (_React$Component) { value: function componentDidMount() { var element = this.refs.embed; var options = _extends({}, this.props, { element: element }); + if ('styles' in options) { + var encodedStyles = (0, _urlencode2.default)(options['styles']); + options['styles'] = encodedStyles; + } this.embed = RunKit.createNotebook(options); } @@ -593,6 +620,7 @@ Embed.propTypes = { minHeight: PropTypes.string, packageTimestamp: PropTypes.string, preamble: PropTypes.string, + styles: PropTypes.object, onLoad: PropTypes.func, onURLChanged: PropTypes.func, onEvaluate: PropTypes.func @@ -601,7 +629,7 @@ Embed.propTypes = { module.exports = Embed; /***/ }), -/* 8 */ +/* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -670,7 +698,7 @@ module.exports = checkPropTypes; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), -/* 9 */ +/* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -736,7 +764,7 @@ module.exports = function() { /***/ }), -/* 10 */ +/* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -756,7 +784,7 @@ var invariant = __webpack_require__(2); var warning = __webpack_require__(4); var ReactPropTypesSecret = __webpack_require__(3); -var checkPropTypes = __webpack_require__(8); +var checkPropTypes = __webpack_require__(9); module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ diff --git a/dist/react-runkit.min.js b/dist/react-runkit.min.js index aa9d99b..8e4d9e7 100644 --- a/dist/react-runkit.min.js +++ b/dist/react-runkit.min.js @@ -1 +1 @@ -module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,n){e.exports=n(5)()},function(e,t){e.exports=require("react")},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var i=Object.assign||function(e){for(var t=1;t=15.5.4" }, "scripts": { "build": "npm run build-dev && npm run build-prod", @@ -19,7 +19,7 @@ }, "main": "./dist/react-runkit.js", "name": "react-runkit", - "version": "0.9.0", + "version": "0.9.1", "description": "RunKit Embed Component.", "repository": "https://github.com/runkitdev/react-runkit", "author": "synchronous", diff --git a/src/index.js b/src/index.js index 2d02618..da54bbc 100644 --- a/src/index.js +++ b/src/index.js @@ -48,6 +48,8 @@ Embed.propTypes = { minHeight: PropTypes.string, packageTimestamp: PropTypes.string, preamble: PropTypes.string, + theme: PropTypes.string, + gutterStyle: PropTypes.string, onLoad: PropTypes.func, onURLChanged: PropTypes.func, onEvaluate: PropTypes.func