UNPKG

@tntx/remind

Version:

脑图编辑器

1,413 lines (1,169 loc) 179 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Remind"] = factory(); else root["Remind"] = factory(); })(self, function() { return /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 156: /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (/* binding */ _defineProperty) /* harmony export */ }); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /***/ }), /***/ 540: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); function drawItem(item) { var rect = item.rect, contentRect = item.contentRect; var direction = this.direction; var isTop = this.isTop(item); var color = item.getColor(); var shape = item.getShape(); var isUnderLine = shape.indexOf("underline") > -1; var angle = this.remind.options.fish.angle; if (isUnderLine) { var underlineData = this.line.common.renderUnderline.call(this, item, {}, isTop); this.page.lines.push(underlineData); } var k = Math.tan(angle); var startPos = { x: item.x + contentRect.width / 2, y: item.y + (isTop ? contentRect.height : 0), type: "moveTo" }; var endPos = { x: direction === 'right' ? (rect.height - contentRect.height) / k + item.x + contentRect.width / 2 : item.globalPos.x, y: item.globalPos.y + (isTop ? rect.height : 0) }; if (item.depth % 2 !== 1) { // 水平 if (!isUnderLine) { var disX = contentRect.height / 2 / k; startPos.x = item.x + (direction === 'right' ? item.contentRect.width : 0); endPos.x = direction === 'right' ? item.globalPos.x + item.rect.width + disX : item.globalPos.x - disX; startPos.y = item.y + contentRect.height * 0.5; endPos.y = startPos.y; } else { startPos.x = item.x + (direction === 'right' ? 0 : item.contentRect.width); endPos.x = startPos.x + (direction === 'right' ? 1 : -1) * (item.rect.width + item.rect.height / k); } } var bodyData = { path: [startPos, endPos], color: color }; this.page.lines.push(bodyData); } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawItem); /***/ }), /***/ 105: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__/* .default */ .Z)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function drawRoot(item) { var rect = item.rect, contentRect = item.contentRect; var direction = this.direction; var _this$remind$options$ = this.remind.options.fish, _this$remind$options$2 = _this$remind$options$.minFishWidth, minFishWidth = _this$remind$options$2 === void 0 ? 200 : _this$remind$options$2, _this$remind$options$3 = _this$remind$options$.minFishHeight, minFishHeight = _this$remind$options$3 === void 0 ? 50 : _this$remind$options$3, angle = _this$remind$options$.angle, _this$remind$options$4 = _this$remind$options$.fishTailWidth, fishTailWidth = _this$remind$options$4 === void 0 ? 50 : _this$remind$options$4, _this$remind$options$5 = _this$remind$options$.headGap, headGap = _this$remind$options$5 === void 0 ? 50 : _this$remind$options$5; var color = item.getColor(); var startPos = { x: item.x + (direction === 'right' ? 0 : -contentRect.width), y: item.y + contentRect.height / 2, type: "moveTo" }; var endPos = { x: direction === 'right' ? item.globalPos.x + fishTailWidth : item.globalPos.x + rect.width - fishTailWidth, y: startPos.y }; var bodyData = { path: [startPos, endPos], color: color }; this.page.lines.push(bodyData); //尾巴 var startX = endPos.x + (direction === 'right' ? -fishTailWidth : fishTailWidth); var disY = fishTailWidth * Math.tan(angle / 2); this.page.lines.push({ path: [{ type: 'moveTo', x: startX, y: endPos.y - disY }, _objectSpread({}, endPos), { x: startX, y: endPos.y + disY }], color: color }); // if(item.children.length){ // item.children.forEach(child=>{ // if(child.data.layout && child.data.layout !== 'fish'){ // this.line.item.call(this,child) // } // }) // } } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (drawRoot); /***/ }), /***/ 275: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__/* .default */ .Z)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function bezier(item) { var _this = this; var isUnderLine = item.getShape().indexOf('underline') > -1; var direction = this.direction; var underlinePos = { x: item.x + item.contentRect.width, y: item.y + item.contentRect.height / 2 }; // 下划线的话给自己底部加上颜色 if (isUnderLine) { this.page.lines.push(this.line.common.renderUnderline.call(this, item, underlinePos)); } if (item.data.shrink || !item.children.length) { return item; } var startPos = { x: item.x + item.contentRect.width / 2, y: item.y + (direction === 'bottom' ? item.contentRect.height : 0) }; item.children.forEach(function (child) { var x = child.x + child.contentRect.width / 2, y = child.y + (direction !== 'bottom' ? child.contentRect.height : 0), start = startPos; var bezierPos = { x1: start.x, y1: (start.y + y) * 0.5, x2: x, y2: (start.y + y) * 0.5 }; var data = { path: [], color: child.getColor() }; data.path.push({ x: start.x, y: start.y, type: "moveTo" }); data.path.push(_objectSpread(_objectSpread({}, bezierPos), {}, { x: x, y: y, type: "bezier3" })); _this.page.lines.push(data); }); } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (bezier); /***/ }), /***/ 133: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__/* .default */ .Z)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function polyline(item) { var _this = this; var spaceY = this.remind.options.site.spaceY; var isUnderLine = item.getShape().indexOf('underline') > -1; var direction = this.direction; // 下划线的话给自己底部加上颜色 if (isUnderLine) { this.page.lines.push(this.line.common.renderUnderline.call(this, item, {})); } // 收缩不绘制子元素 if (item.data.shrink || item.children.length < 1) { return item; } var startPos = { x: item.x + item.contentRect.width / 2, y: item.y + (direction === 'bottom' ? item.contentRect.height : 0) }; var middle = { x: startPos.x, y: startPos.y + (direction === 'bottom' ? spaceY / 2 : -spaceY / 2) }; var lineData = { path: [], color: item.getColor() }; lineData.path.push(_objectSpread(_objectSpread({}, startPos), {}, { name: 'middle', type: "moveTo" }), middle); this.page.lines.push(lineData); // 绘制右边子节点的连接线 item.children.forEach(function (child, index) { var x = child.x + child.contentRect.width / 2, y = startPos.y + (direction === 'bottom' ? spaceY : -spaceY); var lineData = { path: [], name: 'connect', color: child.getColor() }; if (index === 0 || index === item.children.length - 1) { lineData.path.push(_objectSpread(_objectSpread({}, middle), {}, { type: 'moveTo' }), { y: middle.y, x: x }); } else { lineData.path.push({ type: "moveTo", x: x, y: middle.y }); } lineData.path.push({ x: x, y: y }); // 箭头 if (_this.remind.options.showArrow) { var arrowData = _this.line.common.renderArrow.call(_this, { x: x, y: middle.y }, { x: x, y: y }); arrowData.color = lineData.color; arrowData.name = 'arrow'; _this.page.lines.push(arrowData); } _this.page.lines.push(lineData); }); } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (polyline); /***/ }), /***/ 380: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); function taper(item) { var _this = this; var direction = this.direction; if (item.data.shrink || !item.children.length) { return item; } var itemPos = { x: item.x + item.contentRect.width * 0.5, y: item.y + item.contentRect.height * 0.5 }; var halfThick = this.LINE_THICKNESS / 2; item.children.forEach(function (child) { var x = child.x + child.contentRect.width * 0.5; var y = child.y + (direction !== 'bottom' ? child.contentRect.height : 0); var angle = Math.atan2(y - itemPos.y, x - itemPos.x) + Math.PI / 2; var dx = Math.cos(angle) * halfThick; var dy = Math.sin(angle) * halfThick; var color = child.getColor(); var data = { path: [], fill: color, color: color }; data.path.push({ x: itemPos.x - dx, y: itemPos.y - dy, type: "moveTo" }); data.path.push({ x1: x, y1: (y + itemPos.y) / 2, x: x, y: y, type: "bezier2" }); data.path.push({ y1: (y + itemPos.y) / 2, x1: x, x: itemPos.x + dx, y: itemPos.y + dy, type: "bezier2" }); _this.page.lines.push(data); }); } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (taper); /***/ }), /***/ 607: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(156); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__/* .default */ .Z)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var radius = 4; function bezier(item) { var _this = this; var spaceX = this.remind.options.tree.spaceX; var direction = this.direction; var isUnderLine = item.getShape().indexOf('underline') > -1; // 下划线的话给自己底部加上颜色 if (isUnderLine) { this.page.lines.push(this.line.common.renderUnderline.call(this, item, {})); } if (item.data.shrink || !item.children.length) { return item; } var startPos = { x: item.x + (direction === 'right' ? spaceX : item.contentRect.width - spaceX), y: item.y + item.contentRect.height }; // 直接连接到底部的线 var lastChild = item.children.slice(-1)[0]; var lastShape = lastChild.getShape(); var endY = lastChild.y + lastChild.contentRect.height * (lastShape.indexOf('underline') > -1 ? 1 : 0.5) - radius; //4像素的转角 var lineData = { path: [_objectSpread({ type: "moveTo" }, startPos), { x: startPos.x, y: endY }], color: item.getColor() }; this.page.lines.push(lineData); item.children.forEach(function (child) { var x, y; var shape = child.getShape(); x = child.x; var isUnderLine = shape.indexOf('underline') > -1; // 下划线情况,终点坐标要不太一样 if (isUnderLine) { y = child.y + child.contentRect.height; } else { y = child.y + child.contentRect.height / 2; } var data = { path: [], color: lineData.color }; data.path.push({ x: startPos.x, y: y - radius, type: "moveTo" }); data.path.push({ x1: startPos.x, y1: y, x: startPos.x + (direction === 'right' ? radius : -radius), y: y, type: "bezier2" }); data.path.push({ x: x, y: y }); _this.page.lines.push(data); }); } // 不得使用箭头函数 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (bezier); /***/ }), /***/ 739: /***/ ((module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(645); /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__); // Imports var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]}); // Module ___CSS_LOADER_EXPORT___.push([module.id, ".remind.theme-stright {\n background-color: #f4f9fa;\n}\n.remind.theme-stright .remind-page .shape-ellipse {\n border-radius: 10px;\n background-color: #ff383e !important;\n border: 3px solid #ff8d8f;\n padding: 20px;\n}\n.remind.theme-stright .remind-page .shape-ellipse .item-text {\n font-size: 28px;\n}\n.remind.theme-box {\n background-color: #1f2934;\n}\n.remind.theme-box .remind-scroll .remind-page .shape-ellipse {\n background-color: #1f2934;\n border: 3px solid #20a5a1;\n font-size: 48px;\n padding: 20px;\n color: #20a5a1;\n}\n.remind.theme-box .remind-scroll .remind-page .shape-ellipse .item-text {\n color: #20a5a1;\n font-size: 28px;\n}\n.remind.theme-box .remind-scroll .remind-page .shape-box {\n background-color: #20a5a1;\n color: #000;\n padding: 10px 20px;\n border-radius: 10px;\n}\n.remind.theme-box .remind-scroll .remind-page .shape-box > .children .shape-box > .content {\n background-color: transparent;\n border: none;\n color: #20a5a1;\n padding: 5px;\n font-size: 22px;\n}\n.remind.theme-box .remind-scroll .remind-page .shape-blank {\n background-color: transparent;\n border: none;\n color: #20a5a1;\n padding: 5px;\n font-size: 22px;\n}\n.remind {\n overflow: scroll;\n width: 100%;\n height: 100%;\n transition: background 400ms ease-out;\n}\n.remind * {\n box-sizing: border-box;\n}\n.remind ul,\n.remind li {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.remind ul li,\n.remind li li {\n list-style: none;\n}\n.remind .remind-scroll {\n position: relative;\n}\n.remind .remind-scroll .remind-page {\n position: absolute;\n left: 0;\n top: 0;\n transform-origin: 0% 0%;\n}\n.remind .remind-scroll .remind-page .remind-canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n.remind .remind-scroll .remind-page .remind-selection {\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n display: none;\n transition: all 100ms ease-out;\n pointer-events: none;\n}\n.remind .remind-scroll .remind-page .remind-selection:after {\n transition: all 100ms ease-out;\n content: ' ';\n display: block;\n width: calc(100% + 6px);\n height: calc(100% + 6px);\n position: absolute;\n left: -5px;\n top: -5px;\n border: 2px solid blue;\n}\n.remind .remind-scroll .remind-page .remind-item {\n position: absolute;\n top: 0;\n left: 0;\n padding: 4px 10px;\n color: #123;\n border-radius: 3px;\n cursor: pointer;\n user-select: none;\n align-items: center;\n}\n.remind .remind-scroll .remind-page .remind-item::after {\n content: ' ';\n z-index: -1;\n transition: all;\n width: 100%;\n height: 100%;\n position: absolute;\n top: -4px;\n left: -4px;\n padding: 2px;\n display: none;\n box-sizing: content-box;\n}\n.remind .remind-scroll .remind-page .remind-item .item-text {\n display: inline-block;\n border: none;\n outline: none;\n white-space: nowrap;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-icon {\n display: inline-flex;\n flex-direction: row-reverse;\n align-items: center;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-icon > li {\n font-size: 18px;\n display: inline-block;\n margin-left: -5px;\n width: 24px;\n height: 24px;\n background-size: 20px;\n border: 2px solid #fff;\n border-radius: 24px;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-icon > li:last-child {\n margin-left: 0px;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-icon > li:first-child {\n margin-right: 5px;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle {\n position: absolute;\n right: -15px;\n top: calc(50% - 6px);\n display: none;\n cursor: pointer;\n padding-left: 4px;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle > div {\n width: 12px;\n height: 12px;\n border: 1px solid #4a90e2;\n border-radius: 6px;\n text-align: center;\n display: inline-block;\n background: #fff;\n color: black;\n font-size: 12px;\n line-height: 8px;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle > .toggle-off {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle > .toggle-on {\n display: none;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle:hover {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle.toggled {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle.toggled > .toggle-off {\n display: none;\n}\n.remind .remind-scroll .remind-page .remind-item .remind-toggle.toggled > .toggle-on {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item:hover .remind-toggle {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item:hover::after {\n border: 2px solid #779ecc;\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item.active .remind-toggle {\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item.active::after {\n border: 2px solid #0775f3;\n display: block;\n}\n.remind .remind-scroll .remind-page .remind-item .item-note::before {\n content: \"\\1f4dd\";\n}\n.remind .remind-scroll .remind-page .shape-box {\n background-color: #4a90e2;\n color: #fff;\n}\n.remind .remind-scroll .remind-page .shape-underline {\n padding: 4px 5px;\n}\n.remind .remind-scroll .remind-page .shape-ellipse {\n padding: 10px 10px;\n color: #fff;\n background-color: #39ac03;\n}\n.remind .remind-scroll .remind-page .item-ghost {\n opacity: 0.15;\n}\n.remind .remind-scroll .remind-page .mm-note {\n display: flex;\n flex-direction: column;\n position: absolute;\n top: 80px;\n left: 0px;\n z-index: 2;\n background: #fff;\n transition: opacity, height 300ms ease-in;\n overflow: hidden;\n width: 300px;\n border: 1px solid #efefef;\n border-radius: 3px;\n box-shadow: 2px 2px 20px 1px rgba(0, 0, 0, 0.2);\n}\n.remind .remind-scroll .remind-page .mm-note .note-util {\n height: 30px;\n width: 100%;\n border-bottom: 1px solid #efefef;\n padding-left: 10px;\n padding-top: 4px;\n}\n.remind .remind-scroll .remind-page .mm-note .note-content {\n height: 300px;\n width: 100%;\n overflow: scroll;\n outline: none;\n}\n.remind .remind-scroll .remind-page .mm-note .note-content p {\n white-space: pre-line;\n padding: 10px;\n outline: none;\n height: 300px;\n width: 100%;\n}\n.remind .remind-scroll .remind-page .mm-note.hide {\n height: 0;\n opacity: 0;\n}\n.remind .remind-scroll .menu {\n outline: none;\n margin: 0;\n padding: 5px 0;\n list-style: none;\n position: absolute;\n left: 0;\n top: 0;\n z-index: 2;\n background: #fff;\n -webkit-box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);\n border-radius: 2px;\n width: 200px;\n}\n.remind .remind-scroll .menu > button {\n height: 32px;\n line-height: 32px;\n padding: 0 20px;\n color: #666;\n font-size: 13px;\n font-weight: 400;\n cursor: pointer;\n -webkit-transition: all 0.3s;\n transition: all 0.3s;\n white-space: nowrap;\n display: block;\n background-color: transparent;\n border: none;\n margin: 0;\n width: 100%;\n text-align: left;\n}\n.remind .remind-scroll .menu > button:hover {\n background: #efefef;\n}\n.remind .remind-scroll .menu span {\n display: block;\n border-top: 1px solid #eee;\n margin-top: 4px;\n padding-top: 4px;\n}\n", ""]); // Exports /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); /***/ }), /***/ 645: /***/ ((module) => { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader // eslint-disable-next-line func-names module.exports = function (cssWithMappingToString) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item); if (item[2]) { return "@media ".concat(item[2], " {").concat(content, "}"); } return content; }).join(""); }; // import a list of modules into the list // eslint-disable-next-line func-names list.i = function (modules, mediaQuery, dedupe) { if (typeof modules === "string") { // eslint-disable-next-line no-param-reassign modules = [[null, modules, ""]]; } var alreadyImportedModules = {}; if (dedupe) { for (var i = 0; i < this.length; i++) { // eslint-disable-next-line prefer-destructuring var id = this[i][0]; if (id != null) { alreadyImportedModules[id] = true; } } } for (var _i = 0; _i < modules.length; _i++) { var item = [].concat(modules[_i]); if (dedupe && alreadyImportedModules[item[0]]) { // eslint-disable-next-line no-continue continue; } if (mediaQuery) { if (!item[2]) { item[2] = mediaQuery; } else { item[2] = "".concat(mediaQuery, " and ").concat(item[2]); } } list.push(item); } }; return list; }; /***/ }), /***/ 379: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var isOldIE = function isOldIE() { var memo; return function memorize() { if (typeof memo === 'undefined') { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 memo = Boolean(window && document && document.all && !window.atob); } return memo; }; }(); var getTarget = function getTarget() { var memo = {}; return function memorize(target) { if (typeof memo[target] === 'undefined') { var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch (e) { // istanbul ignore next styleTarget = null; } } memo[target] = styleTarget; } return memo[target]; }; }(); var stylesInDom = []; function getIndexByIdentifier(identifier) { var result = -1; for (var i = 0; i < stylesInDom.length; i++) { if (stylesInDom[i].identifier === identifier) { result = i; break; } } return result; } function modulesToDom(list, options) { var idCountMap = {}; var identifiers = []; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var count = idCountMap[id] || 0; var identifier = "".concat(id, " ").concat(count); idCountMap[id] = count + 1; var index = getIndexByIdentifier(identifier); var obj = { css: item[1], media: item[2], sourceMap: item[3] }; if (index !== -1) { stylesInDom[index].references++; stylesInDom[index].updater(obj); } else { stylesInDom.push({ identifier: identifier, updater: addStyle(obj, options), references: 1 }); } identifiers.push(identifier); } return identifiers; } function insertStyleElement(options) { var style = document.createElement('style'); var attributes = options.attributes || {}; if (typeof attributes.nonce === 'undefined') { var nonce = true ? __webpack_require__.nc : 0; if (nonce) { attributes.nonce = nonce; } } Object.keys(attributes).forEach(function (key) { style.setAttribute(key, attributes[key]); }); if (typeof options.insert === 'function') { options.insert(style); } else { var target = getTarget(options.insert || 'head'); if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); } target.appendChild(style); } return style; } function removeStyleElement(style) { // istanbul ignore if if (style.parentNode === null) { return false; } style.parentNode.removeChild(style); } /* istanbul ignore next */ var replaceText = function replaceText() { var textStore = []; return function replace(index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; }(); function applyToSingletonTag(style, index, remove, obj) { var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE /* istanbul ignore if */ if (style.styleSheet) { style.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = style.childNodes; if (childNodes[index]) { style.removeChild(childNodes[index]); } if (childNodes.length) { style.insertBefore(cssNode, childNodes[index]); } else { style.appendChild(cssNode); } } } function applyToTag(style, options, obj) { var css = obj.css; var media = obj.media; var sourceMap = obj.sourceMap; if (media) { style.setAttribute('media', media); } else { style.removeAttribute('media'); } if (sourceMap && typeof btoa !== 'undefined') { css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); } // For old IE /* istanbul ignore if */ if (style.styleSheet) { style.styleSheet.cssText = css; } else { while (style.firstChild) { style.removeChild(style.firstChild); } style.appendChild(document.createTextNode(css)); } } var singleton = null; var singletonCounter = 0; function addStyle(obj, options) { var style; var update; var remove; if (options.singleton) { var styleIndex = singletonCounter++; style = singleton || (singleton = insertStyleElement(options)); update = applyToSingletonTag.bind(null, style, styleIndex, false); remove = applyToSingletonTag.bind(null, style, styleIndex, true); } else { style = insertStyleElement(options); update = applyToTag.bind(null, style, options); remove = function remove() { removeStyleElement(style); }; } update(obj); return function updateStyle(newObj) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { return; } update(obj = newObj); } else { remove(); } }; } module.exports = function (list, options) { options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (!options.singleton && typeof options.singleton !== 'boolean') { options.singleton = isOldIE(); } list = list || []; var lastIdentifiers = modulesToDom(list, options); return function update(newList) { newList = newList || []; if (Object.prototype.toString.call(newList) !== '[object Array]') { return; } for (var i = 0; i < lastIdentifiers.length; i++) { var identifier = lastIdentifiers[i]; var index = getIndexByIdentifier(identifier); stylesInDom[index].references--; } var newLastIdentifiers = modulesToDom(newList, options); for (var _i = 0; _i < lastIdentifiers.length; _i++) { var _identifier = lastIdentifiers[_i]; var _index = getIndexByIdentifier(_identifier); if (stylesInDom[_index].references === 0) { stylesInDom[_index].updater(); stylesInDom.splice(_index, 1); } } lastIdentifiers = newLastIdentifiers; }; }; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ id: moduleId, /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": () => (/* binding */ app) }); // NAMESPACE OBJECT: ./src/Layout/Lines/common.js var common_namespaceObject = {}; __webpack_require__.r(common_namespaceObject); __webpack_require__.d(common_namespaceObject, { "renderArrow": () => (renderArrow), "renderUnderline": () => (renderUnderline) }); ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__(156); ;// CONCATENATED MODULE: ./src/Control/Commands/index.js var getAllCommands = function getAllCommands(remind) { var _isValid = function isValid() { if (remind.note.status === "show") { return false; } if (!remind.page.current) { return false; } if (remind.page.editing) { return false; } if (remind.options.readonly) { return false; } return true; }; return [{ name: "Finish", keys: [{ keyCode: 13, altKey: false, ctrlKey: false, shiftKey: false }], execute: function execute() { var item = remind.page.current; item.stopEdit(); if (!item.data.text) { remind.action.execute('RemoveItem', item); remind.fire("item-change", item); } if (item.data.text === item.oldText) { return; } remind.action.execute('SetText', item, item.data.text, item.oldText); remind.fire("item:change", item); }, isValid: _isValid }, { name: "InsertSibling", keys: [{ keyCode: 13 }], prevent: true, isValid: _isValid, execute: function execute() { var item = remind.page.current; if (item.isRoot()) { remind.action.execute('InsertNewItem', item, item.children.length); } else { var parent = item.parent; var index = parent.children.indexOf(item); remind.action.execute("InsertNewItem", parent, index + 1); } if (remind.options.autoEdit) { remind.command.execute("Edit"); } } }, { name: 'InsertChild', isValid: _isValid, prevent: true, keys: [{ keyCode: 9, ctrlKey: false }, { keyCode: 45 }], execute: function execute() { var item = remind.page.current; var action = remind.action.execute('InsertNewItem', item, item.children.length); if (remind.options.autoEdit && !action._item.data.disableEdit) { remind.command.execute("Edit"); } } }, { name: "Edit", keys: [{ keyCode: 32 }, { keyCode: 113 }], execute: function execute() { if (remind.page.current) { var range = document.createRange(); range.selectNodeContents(remind.page.current.textDOM); var selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); remind.page.current.startEdit(); } } }, { name: "Delete", keys: [{ keyCode: 46 }, { keyCode: 8 }], isValid: function isValid() { return _isValid() && !remind.page.current.isRoot(); }, execute: function execute() { var item = remind.page.current; if (item.isRoot()) return; remind.action.execute('RemoveItem', item); } }, { name: "Center", keys: [{ key: 'c' }], execute: function execute() { (remind.page.current || remind.page.root).center(); }, isValid: _isValid }, { name: "Save", keys: [{ key: "s", ctrlKey: true, shiftKey: false }, { key: "s", metaKey: true, shiftKey: false }], prevent: true, execute: function execute() { console.log('save'); remind.fire("save"); } }, { name: "Undo", keys: [{ key: "z", ctrlKey: true, shiftKey: false }, { key: "z", metaKey: true, shiftKey: false }], isValid: _isValid, prevent: true, execute: function execute() { var history = remind.history; history.history[history.historyIndex - 1].undo(); history.historyIndex--; remind.fire("undo", history.historyIndex); } }, { name: "Redo", keys: [{ keyCode: "z", ctrlKey: true, shiftKey: true }, { keyCode: "z", metaKey: true, shiftKey: true }], prevent: true, isValid: _isValid, execute: function execute() { var history = remind.history; history.history[history.historyIndex].perform(); history.historyIndex++; remind.fire("redo", history.historyIndex); } }, { name: "DeleteIcon", keys: [], prevent: true, execute: function execute(item, event) { var key = event.target.getAttribute("data-key"); remind.action.execute('SetIcon', item, null, key); remind.fire("item:change", item); } }]; }; /* harmony default export */ const Control_Commands = (getAllCommands); ;// CONCATENATED MODULE: ./src/Control/Command.js function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0,defineProperty/* default */.Z)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * @class */ var Command = /*#__PURE__*/function () { function Command(remind) { _classCallCheck(this, Command); this.remind = remind; var commandMap = {}; var Commands = Control_Commands(remind); Commands.forEach(function (item) { var command = _objectSpread({ isValid: function isValid() { return true; } }, item); // copy,避免多个引用的remind冲突 commandMap[item.name] = command; }); /** * @instance */ this.commandMap = commandMap; } /** * 执行对应的命令 * @param {String} name * @param {...any} argus */ _createClass(Command, [{ key: "execute", value: function execute(name) { var command = this.commandMap[name]; for (var _len = arguments.length, argus = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { argus[_key - 1] = arguments[_key]; } command.execute.apply(command, argus); } }]); return Command; }(); /* harmony default export */ const Control_Command = (Command); ;// CONCATENATED MODULE: ./src/Control/Keyboard.js /** * @class */ var Keyboard = function Keyboard(remind) { var _this = this; _classCallCheck(this, Keyboard); this.init = function () { window.addEventListener("keydown", this.onKeyDown); window.addEventListener("keypress", this.onKeyDown); window.addEventListener("keyup", this.onKeyUp); }; this.destroy = function () { window.removeEventListener("keydown", _this.onKeyDown); window.removeEventListener("keypress", _this.onKeyDown); window.removeEventListener("keyup", _this.onKeyUp); }; this.onKeyUp = function (e) { // 同步鼠标状态 ['shiftKey', 'altKey', 'ctrlKey', 'metaKey'].forEach(function (key) { _this[key] = e[key]; }); }; this.onKeyDown = function (e) { if (["TEXTAREA", "INPUT"].indexOf(document.activeElement.tagName) > -1 && document.activeElement.className !== "remind-clip") { return; } // 同步鼠标状态 ['shiftKey', 'altKey', 'ctrlKey', 'metaKey'].forEach(function (key) { _this[key] = e[key]; }); //只读模式 if (_this.remind.options.readonly) { return; } var commandMap = _this.remind.command.commandMap; for (var key in commandMap) { var command = commandMap[key]; if (!command || !command.isValid()) { continue; } var keys = command.keys; for (var j = 0; j < keys.length; j++) { if (_this.checkKey(keys[j], e)) { command.prevent && e.preventDefault(); command.execute(e); return true; } } } }; this.checkKey = function (key, e) { if ("keyCode" in key && e.type != "keydown") { return false; } if ("charCode" in key && e.type != "keypress") { return false; } for (var p in key) { if (key[p] != e[p]) { return false; } } return true; }; this.remind = remind; this.init(); }; /* harmony default export */ const Control_Keyboard = (Keyboard); ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } ;// CONCATENATED MODULE: ./src/View/Nodes/Nodes.js var _this = undefined; /* harmony default export */ const Nodes = ({ /** * 节点渲染器,默认为default */ nodes: { /** * 支持icon,note的节点 * @name Remind.nodes#default * @function * @param {Item} item * @param {HTMLElement} container */ "default": function _default(item, container) { container.innerHTML = ''; var data = item.data; // 生成icon var iconDOM = document.createElement('ul'); iconDOM.className = 'remind-icon'; var icon = data.icon; var iconList = ''; for (var key in icon) { if (icon[key]) iconList += "<li class=\"mind-icon ".concat(icon[key], "\" data-key=\"").concat(key, "\"></li>"); } iconDOM.innerHTML = iconList; item.iconDOM = iconDOM; container.appendChild(iconDOM); // 生成text var text = docum