1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
- 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 _react = require("react");
-
- var React = _interopRequireWildcard(_react);
-
- var _reactMde = require("react-mde");
-
- var _reactMde2 = _interopRequireDefault(_reactMde);
-
- var _showdown = require("showdown");
-
- var Showdown = _interopRequireWildcard(_showdown);
-
- require("react-mde/lib/styles/css/react-mde-all.css");
-
- var _reactFontawesome = require("@fortawesome/react-fontawesome");
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
-
- 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 icons = {
- "bold": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "bold" }),
- "heading": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "heading" }),
- "italic": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "italic" }),
- "strikethrough": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "strikethrough" }),
- "link": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "link" }),
- "quote-right": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "quote-right" }),
- "code": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "code" }),
- "image": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "image" }),
- "list-ul": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "list-ul" }),
- "list-ol": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "list-ol" }),
- "tasks": React.createElement(_reactFontawesome.FontAwesomeIcon, { icon: "tasks" })
- };
-
- var iconProvider = function iconProvider(name) {
- return icons[name] || "❓";
- };
-
- var MarkdownEditor = function (_React$Component) {
- _inherits(MarkdownEditor, _React$Component);
-
- function MarkdownEditor(props) {
- _classCallCheck(this, MarkdownEditor);
-
- var _this = _possibleConstructorReturn(this, (MarkdownEditor.__proto__ || Object.getPrototypeOf(MarkdownEditor)).call(this, props));
-
- _this.handleValueChange = function (mdeState) {
- _this.setState({ mdeState: mdeState });
- };
-
- _this.converter = new Showdown.Converter({ tables: true, simplifiedAutoLink: true });
- return _this;
- }
-
- _createClass(MarkdownEditor, [{
- key: "render",
- value: function render() {
- var _this2 = this;
-
- var defaultProps = {
- layout: 'horizontal',
- buttonContentOptions: { iconProvider: iconProvider },
- generateMarkdownPreview: function generateMarkdownPreview(markdown) {
- return Promise.resolve(_this2.converter.makeHtml(markdown));
- }
- };
- var props = _extends({}, defaultProps, this.props);
- return React.createElement(_reactMde2.default, props);
- }
- }]);
-
- return MarkdownEditor;
- }(React.Component);
-
- exports.default = MarkdownEditor;
- //# sourceMappingURL=index.js.map
|