diff --git a/.gitignore b/.gitignore index 2707b00..3b9c3fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules -yarn.lock \ No newline at end of file +yarn.lock +yarn-error.log \ No newline at end of file diff --git a/client/dist/bundle.min.js b/client/dist/bundle.min.js index e188855..dc6b836 100644 --- a/client/dist/bundle.min.js +++ b/client/dist/bundle.min.js @@ -47,6 +47,7 @@ 'use strict'; __webpack_require__(1); + __webpack_require__(14); /***/ }), /* 1 */ @@ -54,21 +55,737 @@ 'use strict'; + var _jquery = __webpack_require__(2); + + var _jquery2 = _interopRequireDefault(_jquery); + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _reactDom = __webpack_require__(4); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _reactApollo = __webpack_require__(5); + + var _Injector = __webpack_require__(6); + + var _InsertEmbedModal = __webpack_require__(7); + + var _InsertEmbedModal2 = _interopRequireDefault(_InsertEmbedModal); + + var _MarkdownEmbedModal = __webpack_require__(13); + + var _MarkdownEmbedModal2 = _interopRequireDefault(_MarkdownEmbedModal); + + var _FormBuilderModal = __webpack_require__(11); + + var _FormBuilderModal2 = _interopRequireDefault(_FormBuilderModal); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + // import { ApolloProvider } from 'react-apollo'; + console.log(window.InsertEmbedModal); + // import InsertEmbedModal from 'components/InsertEmbedModal/InsertEmbedModal'; + + console.log(_InsertEmbedModal2.default); + var InjectableInsertEmbedModal = (0, _Injector.provideInjector)(_InsertEmbedModal2.default); + var filter = 'div[data-shortcode="embed"]'; + + console.log(InjectableInsertEmbedModal); + _jquery2.default.entwine('ss', function ($) { + + $('#insert-md-embed-react__dialog-wrapper').entwine({ + + Element: null, + + Data: {}, + + onunmatch: function onunmatch() { + // solves errors given by ReactDOM "no matched root found" error. + this._clearModal(); + }, + _clearModal: function _clearModal() { + _reactDom2.default.unmountComponentAtNode(this[0]); + }, + open: function open() { + this._renderModal(true); + }, + close: function close() { + this.setData({}); + this._renderModal(false); + }, + + + /** + * Renders the react modal component + * + * @param {boolean} show + * @private + */ + _renderModal: function _renderModal(show) { + var _this = this; + + // alert('test'); + var handleHide = function handleHide() { + return _this.close(); + }; + // Inserts embed into page + var handleInsert = function handleInsert() { + return _this._handleInsert.apply(_this, arguments); + }; + // Create edit form from url + var handleCreate = function handleCreate() { + return _this._handleCreate.apply(_this, arguments); + }; + var handleLoadingError = function handleLoadingError() { + return _this._handleLoadingError.apply(_this, arguments); + }; + var store = window.ss.store; + var client = window.ss.apolloClient; + var attrs = this.getOriginalAttributes(); + + // create/update the react component + _reactDom2.default.render(_react2.default.createElement( + _reactApollo.ApolloProvider, + { store: store, client: client }, + _react2.default.createElement(InjectableInsertEmbedModal, { + show: show, + type: 'insert-media', + onCreate: handleCreate, + onInsert: handleInsert, + onHide: handleHide, + onLoadingError: handleLoadingError, + fileAttributes: attrs, + bodyClassName: 'modal__dialog modal__dialog--scrollable', + className: 'insert-embed-react__dialog-wrapper' + }) + ), this[0]); + }, + _handleLoadingError: function _handleLoadingError() { + this.setData({}); + this.open(); + }, + + + /** + * Handles inserting the selected file in the modal + * + * @param {object} data + * @returns {Promise} + * @private + */ + _handleInsert: function _handleInsert(data) { + var oldData = this.getData(); + this.setData(Object.assign({ Url: oldData.Url }, data)); + this.insertRemote(); + this.close(); + }, + _handleCreate: function _handleCreate(data) { + this.setData(Object.assign({}, this.getData(), data)); + this.open(); + }, + + + /** + * Find the selected node and get attributes associated to attach the data to the form + * + * @returns {object} + */ + getOriginalAttributes: function getOriginalAttributes() { + var data = this.getData(); + return data; + }, + + + /** + * Calculate placement from css class + */ + findPosition: function findPosition(cssClass) { + var alignments = ['leftAlone', 'center', 'rightAlone', 'left', 'right']; + if (typeof cssClass !== 'string') { + return ''; + } + var classes = cssClass.split(' '); + return alignments.find(function (alignment) { + return classes.indexOf(alignment) > -1; + }); + }, + insertRemote: function insertRemote() { + var $field = this.getElement(); + if (!$field) { + return false; + } + + var data = this.getData(); + + var base = (0, _jquery2.default)('
').attr('data-url', data.Url).attr('data-shortcode', 'embed').addClass(data.Placement).addClass('embed'); + + var placeholder = (0, _jquery2.default)('').attr('src', data.PreviewUrl).addClass('placeholder'); + + // Set dimensions + if (data.Width) { + base.width(data.Width); + placeholder.attr('width', data.Width); + } + if (data.Height) { + // Note: Leave height auto sizing on parent, but set height on inner placeholder + placeholder.attr('height', data.Height); + } + + // Add caption p tag + if (data.CaptionText) { + var caption = (0, _jquery2.default)('

').addClass('caption').text(data.CaptionText); + base.append(caption); + } + + // Add to base + base.append(placeholder); + + var pos = $field.codemirror.getCursor(); + $field.codemirror.setSelection(pos, pos); + $field.codemirror.replaceSelection("\n" + $('

').append(base.clone()).html() + "\n"); + return true; + } + }); + }); + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + + module.exports = jQuery; + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + module.exports = React; + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + module.exports = ReactDom; + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + + module.exports = ReactApollo; + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + + module.exports = Injector; + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.InsertEmbedModal = undefined; + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + 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 = __webpack_require__(2); + var _i18n = __webpack_require__(8); + + var _i18n2 = _interopRequireDefault(_i18n); + + var _react = __webpack_require__(3); var _react2 = _interopRequireDefault(_react); - var _reactDom = __webpack_require__(3); + var _redux = __webpack_require__(9); + + var _reactRedux = __webpack_require__(10); + + var _FormBuilderModal = __webpack_require__(11); + + var _FormBuilderModal2 = _interopRequireDefault(_FormBuilderModal); + + var _SchemaActions = __webpack_require__(12); + + var schemaActions = _interopRequireWildcard(_SchemaActions); + + 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 _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 sectionConfigKey = 'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin'; + + var InsertEmbedModal = function (_Component) { + _inherits(InsertEmbedModal, _Component); + + function InsertEmbedModal(props) { + _classCallCheck(this, InsertEmbedModal); + + var _this = _possibleConstructorReturn(this, (InsertEmbedModal.__proto__ || Object.getPrototypeOf(InsertEmbedModal)).call(this, props)); + + _this.handleSubmit = _this.handleSubmit.bind(_this); + return _this; + } + + _createClass(InsertEmbedModal, [{ + key: 'componentWillMount', + value: function componentWillMount() { + this.setOverrides(this.props); + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(props) { + if (props.show && !this.props.show) { + this.setOverrides(props); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this.clearOverrides(); + } + + /** + * Compares the current properties with received properties and determines if overrides need to be + * cleared or added. + * + * @param {object} props + */ + + }, { + key: 'setOverrides', + value: function setOverrides(props) { + if (this.props.schemaUrl !== props.schemaUrl) { + this.clearOverrides(); + } + if (props.schemaUrl) { + var attrs = Object.assign({}, props.fileAttributes); + delete attrs.ID; + + var overrides = { + fields: Object.entries(attrs).map(function (field) { + var _field = _slicedToArray(field, 2), + name = _field[0], + value = _field[1]; + + return { name: name, value: value }; + }) + }; + // set overrides into redux store, so that it can be accessed by FormBuilder with the same + // schemaUrl. + this.props.actions.schema.setSchemaStateOverrides(props.schemaUrl, overrides); + } + } + + /** + * Generates the properties for the modal + * + * @returns {object} + */ + + }, { + key: 'getModalProps', + value: function getModalProps() { + var props = Object.assign({ + handleSubmit: this.handleSubmit, + onLoadingError: this.handleLoadingError, + showErrorMessage: true, + responseClassBad: 'alert alert-danger', + identifier: 'AssetAdmin.InsertEmbedModal' + }, this.props, { + className: 'insert-embed-modal ' + this.props.className, + bsSize: 'lg', + handleHide: this.props.onHide, + title: this.props.targetUrl ? _i18n2.default._t('AssetAdmin.EditTitle', 'Media from the web') : _i18n2.default._t('AssetAdmin.CreateTitle', 'Insert new media from the web') + }); + delete props.onHide; + delete props.sectionConfig; + delete props.onInsert; + delete props.fileAttributes; + + return props; + } + + /** + * Clear any overrides that may be in place + */ + + }, { + key: 'clearOverrides', + value: function clearOverrides() { + this.props.actions.schema.setSchemaStateOverrides(this.props.schemaUrl, null); + } + + /** + * Handler for when loading the form returns an error + * + * @param error + */ + + }, { + key: 'handleLoadingError', + value: function handleLoadingError(error) { + if (typeof this.props.onLoadingError === 'function') { + this.props.onLoadingError(error); + } + } + + /** + * Capture submission in the form and stop the default submit behaviour + * + * @param data + * @param action + * @returns {Promise} + */ + + }, { + key: 'handleSubmit', + value: function handleSubmit(data, action) { + switch (action) { + case 'action_addmedia': + { + this.props.onCreate(data); + break; + } + case 'action_insertmedia': + { + this.props.onInsert(data); + break; + } + case 'action_cancel': + { + this.props.onHide(); + break; + } + default: + { + // noop + } + } + + return Promise.resolve(); + } + }, { + key: 'render', + value: function render() { + return _react2.default.createElement(_FormBuilderModal2.default, this.getModalProps()); + } + }]); + + return InsertEmbedModal; + }(_react.Component); + + InsertEmbedModal.propTypes = { + sectionConfig: _react.PropTypes.shape({ + url: _react.PropTypes.string, + form: _react.PropTypes.object + }), + show: _react.PropTypes.bool, + onInsert: _react.PropTypes.func.isRequired, + onCreate: _react.PropTypes.func.isRequired, + fileAttributes: _react.PropTypes.shape({ + Url: _react.PropTypes.string, + CaptionText: _react.PropTypes.string, + PreviewUrl: _react.PropTypes.string, + Placement: _react.PropTypes.string, + Width: _react.PropTypes.number, + Height: _react.PropTypes.number + }), + onHide: _react.PropTypes.func.isRequired, + className: _react.PropTypes.string, + actions: _react.PropTypes.object, + schemaUrl: _react.PropTypes.string.isRequired, + targetUrl: _react.PropTypes.string, + onLoadingError: _react.PropTypes.func + }; + + InsertEmbedModal.defaultProps = { + className: '', + fileAttributes: {} + }; + + function mapStateToProps(state, ownProps) { + var sectionConfig = state.config.sections.find(function (section) { + return section.name === sectionConfigKey; + }); + + // get the schemaUrl to use as a key for overrides + var targetUrl = ownProps.fileAttributes ? ownProps.fileAttributes.Url : ''; + var baseEditUrl = sectionConfig.form.remoteEditForm.schemaUrl; + + var editUrl = targetUrl && baseEditUrl + '/?embedurl=' + encodeURIComponent(targetUrl); + var createUrl = sectionConfig.form.remoteCreateForm.schemaUrl; + + var schemaUrl = editUrl || createUrl; + + return { + sectionConfig: sectionConfig, + schemaUrl: schemaUrl, + targetUrl: targetUrl + }; + } + + function mapDispatchToProps(dispatch) { + return { + actions: { + schema: (0, _redux.bindActionCreators)(schemaActions, dispatch) + } + }; + } + + exports.InsertEmbedModal = InsertEmbedModal; + exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(InsertEmbedModal); + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + + module.exports = i18n; + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + module.exports = Redux; + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + module.exports = ReactRedux; + +/***/ }), +/* 11 */ +/***/ (function(module, exports) { + + module.exports = FormBuilderModal; + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + + module.exports = SchemaActions; + +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.MarkdownEmbedModal = undefined; + + 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 _i18n = __webpack_require__(8); + + var _i18n2 = _interopRequireDefault(_i18n); + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _redux = __webpack_require__(9); + + var _reactRedux = __webpack_require__(10); + + var _FormBuilderModal = __webpack_require__(11); + + var _FormBuilderModal2 = _interopRequireDefault(_FormBuilderModal); + + var _SchemaActions = __webpack_require__(12); + + var schemaActions = _interopRequireWildcard(_SchemaActions); + + 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 _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 sectionConfigKey = 'SilverStripe\\AssetAdmin\\Controller\\AssetAdmin'; + + var MarkdownEmbedModal = function (_Component) { + _inherits(MarkdownEmbedModal, _Component); + + function MarkdownEmbedModal(props) { + _classCallCheck(this, MarkdownEmbedModal); + + return _possibleConstructorReturn(this, (MarkdownEmbedModal.__proto__ || Object.getPrototypeOf(MarkdownEmbedModal)).call(this, props)); + + //this.handleSubmit = this.handleSubmit.bind(this); + } + + _createClass(MarkdownEmbedModal, [{ + key: 'getModalProps', + value: function getModalProps() { + + var props = Object.assign({ + handleSubmit: this.handleSubmit, + onLoadingError: this.handleLoadingError, + showErrorMessage: true, + responseClassBad: 'alert alert-danger', + identifier: 'AssetAdmin.InsertEmbedModal' + }, this.props, { + className: 'insert-media-modal ' + this.props.className, + bsSize: 'lg', + handleHide: this.props.onHide, + title: this.props.targetUrl ? _i18n2.default._t('AssetAdmin.EditTitle', 'Media from the web') : _i18n2.default._t('AssetAdmin.CreateTitle', 'Insert new media from the web') + }); + + delete props.onHide; + delete props.sectionConfig; + delete props.onInsert; + delete props.fileAttributes; + + return props; + } + }, { + key: 'handleSubmit', + value: function handleSubmit(data, action) { + switch (action) { + case 'action_addmedia': + { + //this.props.onCreate(data); + break; + } + case 'action_insertmedia': + { + //this.props.onInsert(data); + break; + } + case 'action_cancel': + { + //this.props.onHide(); + break; + } + default: + { + // noop + } + } + + return Promise.resolve(); + } + }, { + key: 'render', + value: function render() { + return _react2.default.createElement(_FormBuilderModal2.default, this.getModalProps()); + } + }]); + + return MarkdownEmbedModal; + }(_react.Component); + + MarkdownEmbedModal.propTypes = { + sectionConfig: _react.PropTypes.shape({ + url: _react.PropTypes.string, + form: _react.PropTypes.object + }), + show: _react.PropTypes.bool, + onInsert: _react.PropTypes.func.isRequired, + onCreate: _react.PropTypes.func.isRequired, + fileAttributes: _react.PropTypes.shape({ + Url: _react.PropTypes.string, + CaptionText: _react.PropTypes.string, + PreviewUrl: _react.PropTypes.string, + Placement: _react.PropTypes.string, + Width: _react.PropTypes.number, + Height: _react.PropTypes.number + }), + onHide: _react.PropTypes.func.isRequired, + className: _react.PropTypes.string, + actions: _react.PropTypes.object, + schemaUrl: _react.PropTypes.string.isRequired, + targetUrl: _react.PropTypes.string, + onLoadingError: _react.PropTypes.func + }; + + MarkdownEmbedModal.defaultProps = { + className: '', + fileAttributes: {} + }; + + function mapStateToProps(state, ownProps) { + var sectionConfig = state.config.sections.find(function (section) { + return section.name === sectionConfigKey; + }); + + // get the schemaUrl to use as a key for overrides + var targetUrl = ownProps.fileAttributes ? ownProps.fileAttributes.Url : ''; + var baseEditUrl = sectionConfig.form.remoteEditForm.schemaUrl; + + var editUrl = targetUrl && baseEditUrl + '/?embedurl=' + encodeURIComponent(targetUrl); + var createUrl = sectionConfig.form.remoteCreateForm.schemaUrl; + + var schemaUrl = editUrl || createUrl; + + return { + sectionConfig: sectionConfig, + //schemaUrl, + targetUrl: targetUrl + }; + } + + function mapDispatchToProps(dispatch) { + return { + actions: { + schema: (0, _redux.bindActionCreators)(schemaActions, dispatch) + } + }; + } + + exports.MarkdownEmbedModal = MarkdownEmbedModal; + exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(MarkdownEmbedModal); + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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 = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _reactDom = __webpack_require__(4); var _reactDom2 = _interopRequireDefault(_reactDom); - var _reactSimplemdeEditor = __webpack_require__(4); + var _reactSimplemdeEditor = __webpack_require__(15); var _reactSimplemdeEditor2 = _interopRequireDefault(_reactSimplemdeEditor); - var _Injector = __webpack_require__(9); + var _Injector = __webpack_require__(6); + + var _jquery = __webpack_require__(2); + + var _jquery2 = _interopRequireDefault(_jquery); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78,7 +795,133 @@ 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 SimpleMDE = __webpack_require__(10); + var SimpleMDE = __webpack_require__(20); + + + var markdownConfigs = {}; + + _jquery2.default.entwine('ss', function ($) { + + markdownConfigs.toolbar = [{ + name: "heading", + action: SimpleMDE.toggleHeadingSmaller, + className: "fa fa-header", + title: "Heading HTML" + }, { + name: "bold", + action: SimpleMDE.toggleBold, + className: "fa fa-bold", + title: "Bold" + }, { + name: "italic", + action: SimpleMDE.toggleItalic, + className: "fa fa-italic", + title: "Italic" + }, { + name: "strikethrough", + action: SimpleMDE.toggleStrikethrough, + className: "fa fa-strikethrough", + title: "Strikethrough" + }, "|", { + name: "quote", + action: SimpleMDE.toggleBlockquote, + className: "fa fa-quote-left", + title: "Quote" + }, { + name: "unordered-list", + action: SimpleMDE.toggleUnorderedList, + className: "fa fa-list-ul", + title: "Generic List" + }, { + name: "ordered-list", + action: SimpleMDE.toggleOrderedList, + className: "fa fa-list-ol", + title: "Ordered List" + }, "|", { + name: "link", + action: SimpleMDE.drawLink, + /* + action: function() { + let dialog = jQuery('#insert-link-markdown-react__dialog-wrapper'); + if (!dialog.length) { + dialog = jQuery('