{"remainingRequest":"/Users/admin/projects/dms/src/dealer_admin/node_modules/thread-loader/dist/cjs.js!/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js!/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js??ref--0-0!/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/admin/projects/dms/src/dealer_admin/src/components/QuillEditor/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/Users/admin/projects/dms/src/dealer_admin/src/components/QuillEditor/index.vue","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/babel.config.js","mtime":1713161556000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/thread-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/admin/projects/dms/src/dealer_admin/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["import _regeneratorRuntime from \"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/esm/regeneratorRuntime.js\";\nimport \"core-js/modules/es6.function.name\";\nimport \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"/Users/admin/projects/dms/src/dealer_admin/node_modules/@babel/runtime-corejs2/helpers/esm/asyncToGenerator.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { put } from '@/utils/alioss.js';\nimport { createUniqueString } from '@/utils/index.js';\nimport { quillEditor } from \"vue-quill-editor\"; //调用编辑器\n// import \"quill/dist/quill.core.css\";\nimport \"quill/dist/quill.snow.css\";\nimport * as Quill from 'quill';\n// import \"quill/dist/quill.bubble.css\";\nexport default {\n  name: 'QuillEditor',\n  components: {\n    quillEditor: quillEditor\n  },\n  props: {\n    leftPath: {\n      type: String,\n      default: ''\n    },\n    content: {\n      type: String,\n      default: ''\n    }\n  },\n  data: function data() {\n    var _this = this;\n    return {\n      editorOption: {\n        modules: {\n          toolbar: {\n            container: [['bold', 'italic', 'underline', 'strike'], ['blockquote', 'code-block'], [{\n              'header': 1\n            }, {\n              'header': 2\n            }], [{\n              'list': 'ordered'\n            }, {\n              'list': 'bullet'\n            }], [{\n              'script': 'sub'\n            }, {\n              'script': 'super'\n            }], [{\n              'indent': '-1'\n            }, {\n              'indent': '+1'\n            }], [{\n              'direction': 'rtl'\n            }], [{\n              'size': ['small', false, 'large', 'huge']\n            }], [{\n              'header': [1, 2, 3, 4, 5, 6, false]\n            }], [{\n              'color': []\n            }, {\n              'background': []\n            }], [{\n              'font': []\n            }], [{\n              'align': []\n            }], ['clean'], ['link', 'image']],\n            // 工具栏选项\n            handlers: {\n              image: function image() {\n                _this.photoUplaod();\n              }\n            } // 事件重写\n          }\n        },\n        theme: 'snow',\n        placeholder: '请输入正文'\n      }\n    };\n  },\n  methods: {\n    onEditorChange: function onEditorChange(e) {\n      if (e && e.html && e.html != undefined) {\n        this.$emit('contentChange', e.html);\n      }\n    },\n    photoUplaod: function photoUplaod() {\n      var _this2 = this;\n      this.$nextTick(function () {\n        _this2.$refs.photoInput.click();\n      });\n    },\n    photoChange: function () {\n      var _photoChange = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {\n        var _this3 = this;\n        return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n          while (1) switch (_context2.prev = _context2.next) {\n            case 0:\n              this.$nextTick(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n                var file, random_str, sec_name, result, imageUrl, quill, length;\n                return _regeneratorRuntime().wrap(function _callee$(_context) {\n                  while (1) switch (_context.prev = _context.next) {\n                    case 0:\n                      if (!(_this3.$refs.photoInput.files.length <= 0 || _this3.$refs.photoInput.files[0] == null || _this3.$refs.photoInput.files[0] == undefined)) {\n                        _context.next = 2;\n                        break;\n                      }\n                      return _context.abrupt(\"return\");\n                    case 2:\n                      if (!_this3.photoUploadStatus) {\n                        _context.next = 4;\n                        break;\n                      }\n                      return _context.abrupt(\"return\");\n                    case 4:\n                      _this3.photoUploadStatus = true;\n                      file = _this3.$refs.photoInput.files[0];\n                      random_str = createUniqueString();\n                      sec_name = file.name.lastIndexOf('.') != -1 ? file.name.substring(file.name.lastIndexOf('.')) : \"\";\n                      _context.next = 10;\n                      return put(_this3.leftPath + random_str + sec_name, file);\n                    case 10:\n                      result = _context.sent;\n                      imageUrl = result.url;\n                      _this3.$refs.photoInput.value = \"\";\n                      _this3.photoUploadStatus = false;\n                      if (imageUrl != '') {\n                        quill = _this3.$refs.myQuillEditor.quill; // 获取光标所在位置\n                        length = quill.getSelection().index; // 插入图片  res.info为服务器返回的图片地址\n                        quill.insertEmbed(length, 'image', imageUrl);\n                        // 调整光标到最后\n                        quill.setSelection(length + 1);\n                      }\n                    case 15:\n                    case \"end\":\n                      return _context.stop();\n                  }\n                }, _callee);\n              })));\n            case 1:\n            case \"end\":\n              return _context2.stop();\n          }\n        }, _callee2, this);\n      }));\n      function photoChange(_x) {\n        return _photoChange.apply(this, arguments);\n      }\n      return photoChange;\n    }()\n  }\n};",null]}