123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- "use strict";
-
- 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 _react = require("react");
-
- var _react2 = _interopRequireDefault(_react);
-
- var _reactDom = require("react-dom");
-
- var _reactDom2 = _interopRequireDefault(_reactDom);
-
- var _App = require("./App");
-
- var _App2 = _interopRequireDefault(_App);
-
- var _registerServiceWorker = require("./registerServiceWorker");
-
- var _registerServiceWorker2 = _interopRequireDefault(_registerServiceWorker);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- var Index = function Index(props) {
- return _react2.default.createElement(
- _App2.default,
- _extends({ showAlertComment: true, showAlertReply: true, showAlertFavor: true, showError: true }, props),
- _react2.default.createElement(_App.Editor, { maxUpload: 9, autoFocus: true })
- );
- };
-
- /**
- * 渲染评论组件
- * @param {object} config 编辑器配置
- * - {string} id 渲染评论的DOM的 ID
- * - {number} type 评论的 type
- * - {string} businessId 评论的 businessId
- */
- function renderComment(config) {
- if (!config.id) {
- throw new Error("id is required");
- }
- if (!config.id) {
- throw new Error("type is required");
- }
- if (!config.id) {
- throw new Error("businessId is required");
- }
- var id = config.id,
- _config$type = config.type,
- type = _config$type === undefined ? 1 : _config$type,
- _config$businessId = config.businessId,
- businessId = _config$businessId === undefined ? "test" : _config$businessId;
-
-
- _reactDom2.default.render(_react2.default.createElement(Index, { type: type, businessId: businessId }), document.getElementById(id));
- // registerServiceWorker();
- }
-
- window.renderComment = renderComment;
-
- // renderComment({
- // id: "root-comment",
- // type: 1,
- // businessId: "test"
- // });
- //# sourceMappingURL=index.js.map
|