UNPKG

3.39 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = exports.StrikeThroughPlugin = undefined;
7
8var _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; }; }();
9
10var _dec, _class;
11
12var _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; };
13
14var _react = require('react');
15
16var _react2 = _interopRequireDefault(_react);
17
18var _slateIconShared = require('@canner/slate-icon-shared');
19
20var _slateIconShared2 = _interopRequireDefault(_slateIconShared);
21
22var _marks = require('@canner/slate-constant/lib/marks');
23
24var _commonMark = require('@canner/slate-editor-renderer/lib/commonMark');
25
26var _commonMark2 = _interopRequireDefault(_commonMark);
27
28function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
30function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
32function _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; }
33
34function _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; }
35
36var StrikeThroughPlugin = exports.StrikeThroughPlugin = function StrikeThroughPlugin(opt) {
37 var options = _extends({
38 type: _marks.STRIKETHROUGH,
39 tagName: 's'
40 }, opt);
41
42 return {
43 renderMark: function renderMark(props) {
44 if (props.mark.type === options.type) return (0, _commonMark2.default)(options.tagName)(props);
45 }
46 };
47};
48var StrikeThrough = (_dec = (0, _slateIconShared.basicMarkDecorator)(_marks.STRIKETHROUGH, 'Strike'), _dec(_class = function (_Component) {
49 _inherits(StrikeThrough, _Component);
50
51 function StrikeThrough() {
52 _classCallCheck(this, StrikeThrough);
53
54 return _possibleConstructorReturn(this, (StrikeThrough.__proto__ || Object.getPrototypeOf(StrikeThrough)).apply(this, arguments));
55 }
56
57 _createClass(StrikeThrough, [{
58 key: 'render',
59 value: function render() {
60 return _react2.default.createElement(_slateIconShared2.default, this.props);
61 }
62 }]);
63
64 return StrikeThrough;
65}(_react.Component)) || _class);
66exports.default = StrikeThrough;
\No newline at end of file