tinymce-components-editor-image.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. exports.ids = [42];
  2. exports.modules = {
  3. /***/ 285:
  4. /***/ (function(module, exports) {
  5. // Exports
  6. module.exports = {
  7. };
  8. /***/ }),
  9. /***/ 346:
  10. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11. "use strict";
  12. __webpack_require__.r(__webpack_exports__);
  13. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EditorImage_vue_vue_type_style_index_0_id_481a2804_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(285);
  14. /* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EditorImage_vue_vue_type_style_index_0_id_481a2804_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EditorImage_vue_vue_type_style_index_0_id_481a2804_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
  15. /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EditorImage_vue_vue_type_style_index_0_id_481a2804_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_EditorImage_vue_vue_type_style_index_0_id_481a2804_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
  16. /***/ }),
  17. /***/ 382:
  18. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19. "use strict";
  20. // ESM COMPAT FLAG
  21. __webpack_require__.r(__webpack_exports__);
  22. // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Tinymce/components/EditorImage.vue?vue&type=template&id=481a2804&scoped=true
  23. var render = function render() {
  24. var _vm = this,
  25. _c = _vm._self._c;
  26. return _c('div', {
  27. staticClass: "upload-container"
  28. }, [_c('el-button', {
  29. style: {
  30. background: _vm.color,
  31. borderColor: _vm.color
  32. },
  33. attrs: {
  34. "icon": "el-icon-upload",
  35. "size": "mini",
  36. "type": "primary"
  37. },
  38. on: {
  39. "click": function ($event) {
  40. _vm.dialogVisible = true;
  41. }
  42. }
  43. }, [_vm._v("\n upload\n ")]), _vm._ssrNode(" "), _c('el-dialog', {
  44. attrs: {
  45. "lock-scroll": false,
  46. "visible": _vm.dialogVisible
  47. },
  48. on: {
  49. "update:visible": function ($event) {
  50. _vm.dialogVisible = $event;
  51. }
  52. }
  53. }, [_c('el-upload', {
  54. staticClass: "editor-slide-upload",
  55. attrs: {
  56. "multiple": true,
  57. "file-list": _vm.fileList,
  58. "show-file-list": true,
  59. "on-remove": _vm.handleRemove,
  60. "on-success": _vm.handleSuccess,
  61. "before-upload": _vm.beforeUpload,
  62. "action": "https://httpbin.org/post",
  63. "list-type": "picture-card"
  64. }
  65. }, [_c('el-button', {
  66. attrs: {
  67. "size": "small",
  68. "type": "primary"
  69. }
  70. }, [_vm._v("\n Click upload\n ")])], 1), _vm._v(" "), _c('el-button', {
  71. on: {
  72. "click": function ($event) {
  73. _vm.dialogVisible = false;
  74. }
  75. }
  76. }, [_vm._v("\n Cancel\n ")]), _vm._v(" "), _c('el-button', {
  77. attrs: {
  78. "type": "primary"
  79. },
  80. on: {
  81. "click": _vm.handleSubmit
  82. }
  83. }, [_vm._v("\n Confirm\n ")])], 1)], 2);
  84. };
  85. var staticRenderFns = [];
  86. // CONCATENATED MODULE: ./components/Tinymce/components/EditorImage.vue?vue&type=template&id=481a2804&scoped=true
  87. // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Tinymce/components/EditorImage.vue?vue&type=script&lang=js
  88. /* harmony default export */ var EditorImagevue_type_script_lang_js = ({
  89. name: 'EditorSlideUpload',
  90. props: {
  91. color: {
  92. type: String,
  93. default: '#1890ff'
  94. }
  95. },
  96. data() {
  97. return {
  98. dialogVisible: false,
  99. listObj: {},
  100. fileList: []
  101. };
  102. },
  103. methods: {
  104. checkAllSuccess() {
  105. return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess);
  106. },
  107. handleSubmit() {
  108. const arr = Object.keys(this.listObj).map(v => this.listObj[v]);
  109. if (!this.checkAllSuccess()) {
  110. this.$message('Please wait for all images to be uploaded successfully. If there is a network problem, please refresh the page and upload again!');
  111. return;
  112. }
  113. this.$emit('successCBK', arr);
  114. this.listObj = {};
  115. this.fileList = [];
  116. this.dialogVisible = false;
  117. },
  118. handleSuccess(response, file) {
  119. const uid = file.uid;
  120. const objKeyArr = Object.keys(this.listObj);
  121. for (let i = 0, len = objKeyArr.length; i < len; i++) {
  122. if (this.listObj[objKeyArr[i]].uid === uid) {
  123. this.listObj[objKeyArr[i]].url = response.files.file;
  124. this.listObj[objKeyArr[i]].hasSuccess = true;
  125. return;
  126. }
  127. }
  128. },
  129. handleRemove(file) {
  130. const uid = file.uid;
  131. const objKeyArr = Object.keys(this.listObj);
  132. for (let i = 0, len = objKeyArr.length; i < len; i++) {
  133. if (this.listObj[objKeyArr[i]].uid === uid) {
  134. delete this.listObj[objKeyArr[i]];
  135. return;
  136. }
  137. }
  138. },
  139. beforeUpload(file) {
  140. const _self = this;
  141. const _URL = window.URL || window.webkitURL;
  142. const fileName = file.uid;
  143. this.listObj[fileName] = {};
  144. return new Promise((resolve, reject) => {
  145. const img = new Image();
  146. img.src = _URL.createObjectURL(file);
  147. img.onload = function () {
  148. _self.listObj[fileName] = {
  149. hasSuccess: false,
  150. uid: file.uid,
  151. width: this.width,
  152. height: this.height
  153. };
  154. };
  155. resolve(true);
  156. });
  157. }
  158. }
  159. });
  160. // CONCATENATED MODULE: ./components/Tinymce/components/EditorImage.vue?vue&type=script&lang=js
  161. /* harmony default export */ var components_EditorImagevue_type_script_lang_js = (EditorImagevue_type_script_lang_js);
  162. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  163. var componentNormalizer = __webpack_require__(2);
  164. // CONCATENATED MODULE: ./components/Tinymce/components/EditorImage.vue
  165. function injectStyles (context) {
  166. var style0 = __webpack_require__(346)
  167. if (style0.__inject__) style0.__inject__(context)
  168. }
  169. /* normalize component */
  170. var component = Object(componentNormalizer["a" /* default */])(
  171. components_EditorImagevue_type_script_lang_js,
  172. render,
  173. staticRenderFns,
  174. false,
  175. injectStyles,
  176. "481a2804",
  177. "c9f04bfa"
  178. )
  179. /* harmony default export */ var EditorImage = __webpack_exports__["default"] = (component.exports);
  180. /***/ })
  181. };;
  182. //# sourceMappingURL=tinymce-components-editor-image.js.map