imageCtrl.js 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  1. import { mouseposition } from '../global/location';
  2. import server from './server';
  3. import luckysheetsizeauto from './resize';
  4. import { modelHTML } from './constant';
  5. import {checkProtectionAuthorityNormal} from './protection';
  6. import { getSheetIndex } from '../methods/get';
  7. import { setluckysheet_scroll_status } from '../methods/set';
  8. import { replaceHtml } from '../utils/util';
  9. import Store from '../store';
  10. import locale from '../locale/locale';
  11. import tooltip from '../global/tooltip';
  12. import method from '../global/method';
  13. const imageCtrl = {
  14. imgItem: {
  15. type: '3', //1移动并调整单元格大小 2移动并且不调整单元格的大小 3不要移动单元格并调整其大小
  16. src: '', //图片url
  17. originWidth: null, //图片原始宽度
  18. originHeight: null, //图片原始高度
  19. default: {
  20. width: null, //图片 宽度
  21. height: null, //图片 高度
  22. left: null, //图片离表格左边的 位置
  23. top: null, //图片离表格顶部的 位置
  24. },
  25. crop: {
  26. width: null, //图片裁剪后 宽度
  27. height: null, //图片裁剪后 高度
  28. offsetLeft: 0, //图片裁剪后离未裁剪时 左边的位移
  29. offsetTop: 0, //图片裁剪后离未裁剪时 顶部的位移
  30. },
  31. isFixedPos: false, //固定位置
  32. fixedLeft: null, //固定位置 左位移
  33. fixedTop: null, //固定位置 右位移
  34. border: {
  35. width: 0, //边框宽度
  36. radius: 0, //边框半径
  37. style: 'solid', //边框类型
  38. color: '#000', //边框颜色
  39. }
  40. },
  41. images: null,
  42. currentImgId: null,
  43. currentWinW: null,
  44. currentWinH: null,
  45. resize: null,
  46. resizeXY: null,
  47. move: false,
  48. moveXY: null,
  49. cropChange: null,
  50. cropChangeXY: null,
  51. cropChangeObj: null,
  52. copyImgItemObj: null,
  53. insertImg: function (file) {
  54. const uploadImage = Store.toJsonOptions && Store.toJsonOptions['uploadImage'];
  55. if (typeof uploadImage === 'function') {
  56. // 上传形式
  57. uploadImage(file).then(url => {
  58. imageCtrl._insertImg(url);
  59. }).catch(error => {
  60. tooltip.info('<i class="fa fa-exclamation-triangle"></i>', '图片上传失败');
  61. });
  62. } else {
  63. // 内部base64形式
  64. let render = new FileReader();
  65. render.readAsDataURL(file);
  66. render.onload = function(event){
  67. let src = event.target.result;
  68. imageCtrl._insertImg(src);
  69. $("#luckysheet-imgUpload").val("");
  70. }
  71. }
  72. },
  73. _insertImg: function(src){
  74. let _this = this;
  75. let last = Store.luckysheet_select_save[Store.luckysheet_select_save.length - 1];
  76. let rowIndex = last.row_focus || 0;
  77. let colIndex = last.column_focus || 0;
  78. let left = colIndex == 0 ? 0 : Store.visibledatacolumn[colIndex - 1];
  79. let top = rowIndex == 0 ? 0 : Store.visibledatarow[rowIndex - 1];
  80. let image = new Image();
  81. image.onload = function(){
  82. let width = image.width,
  83. height = image.height;
  84. let img = {
  85. src: src,
  86. left: left,
  87. top: top,
  88. originWidth: width,
  89. originHeight: height
  90. }
  91. _this.addImgItem(img);
  92. }
  93. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  94. image.src = typeof imageUrlHandle === 'function' ? imageUrlHandle(src) : src;
  95. },
  96. generateRandomId: function(prefix) {
  97. if(prefix == null){
  98. prefix = "img";
  99. }
  100. let userAgent = window.navigator.userAgent.replace(/[^a-zA-Z0-9]/g, "").split("");
  101. let mid = "";
  102. for(let i = 0; i < 12; i++){
  103. mid += userAgent[Math.round(Math.random() * (userAgent.length - 1))];
  104. }
  105. let time = new Date().getTime();
  106. return prefix + "_" + mid + "_" + time;
  107. },
  108. modelHtml: function(id, imgItem) {
  109. let _this = this;
  110. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  111. let src = typeof imageUrlHandle === 'function' ? imageUrlHandle(imgItem.src) : imgItem.src;
  112. let imgItemParam = _this.getImgItemParam(imgItem);
  113. let width = imgItemParam.width * Store.zoomRatio;
  114. let height = imgItemParam.height * Store.zoomRatio;
  115. let left = imgItemParam.left * Store.zoomRatio;
  116. let top = imgItemParam.top * Store.zoomRatio;
  117. let position = imgItemParam.position;
  118. let borderWidth = imgItem.border.width;
  119. return `<div id="${id}" class="luckysheet-modal-dialog luckysheet-modal-dialog-image" style="width:${width}px;height:${height}px;padding:0;position:${position};left:${left}px;top:${top}px;z-index:200;">
  120. <div class="luckysheet-modal-dialog-content" style="width:100%;height:100%;overflow:hidden;position:relative;">
  121. <img src="${src}" style="position:absolute;width:${imgItem.default.width * Store.zoomRatio}px;height:${imgItem.default.height * Store.zoomRatio}px;left:${-imgItem.crop.offsetLeft * Store.zoomRatio}px;top:${-imgItem.crop.offsetTop * Store.zoomRatio}px;" />
  122. </div>
  123. <div class="luckysheet-modal-dialog-border" style="border:${borderWidth}px ${imgItem.border.style} ${imgItem.border.color};border-radius:${imgItem.border.radius * Store.zoomRatio}px;position:absolute;left:${-borderWidth}px;right:${-borderWidth}px;top:${-borderWidth}px;bottom:${-borderWidth}px;"></div>
  124. </div>`;
  125. },
  126. getSliderHtml: function() {
  127. let imageText = locale().imageText;
  128. return `<div id="luckysheet-modal-dialog-slider-imageCtrl" class="luckysheet-modal-dialog-slider luckysheet-modal-dialog-slider-imageCtrl" style="display:block;">
  129. <div class="luckysheet-modal-dialog-slider-title">
  130. <span>${imageText.imageSetting}</span>
  131. <span class="luckysheet-model-close-btn" title="${imageText.close}">
  132. <i class="fa fa-times" aria-hidden="true"></i>
  133. </span>
  134. </div>
  135. <div class="luckysheet-modal-dialog-slider-content">
  136. <div class="slider-box">
  137. <div class="slider-box-title">${imageText.conventional}</div>
  138. <div class="slider-box-radios">
  139. <div class="radio-item">
  140. <input type="radio" id="imgItemType1" name="imgItemType" value="1">
  141. <label for="imgItemType1">${imageText.moveCell1}</label>
  142. </div>
  143. <div class="radio-item">
  144. <input type="radio" id="imgItemType2" name="imgItemType" value="2">
  145. <label for="imgItemType2">${imageText.moveCell2}</label>
  146. </div>
  147. <div class="radio-item">
  148. <input type="radio" id="imgItemType3" name="imgItemType" value="3">
  149. <label for="imgItemType3">${imageText.moveCell3}</label>
  150. </div>
  151. </div>
  152. <div class="slider-box-checkbox">
  153. <input type="checkbox" id="imgItemIsFixedPos">
  154. <label for="imgItemIsFixedPos">${imageText.fixedPos}</label>
  155. </div>
  156. </div>
  157. <div class="slider-box">
  158. <div class="slider-box-title">${imageText.border}</div>
  159. <div class="slider-box-borderConfig">
  160. <div class="border-item">
  161. <label>${imageText.width}</label>
  162. <input type="number" id="imgItemBorderWidth" min="0">
  163. </div>
  164. <div class="border-item">
  165. <label>${imageText.radius}</label>
  166. <input type="number" id="imgItemBorderRadius" min="0">
  167. </div>
  168. <div class="border-item">
  169. <label>${imageText.style}</label>
  170. <select id="imgItemBorderStyle">
  171. <option value="solid">${imageText.solid}</option>
  172. <option value="dashed">${imageText.dashed}</option>
  173. <option value="dotted">${imageText.dotted}</option>
  174. <option value="double">${imageText.double}</option>
  175. </select>
  176. </div>
  177. <div class="border-item">
  178. <label>${imageText.color}</label>
  179. <div id="imgItemBorderColor" class="imgItemBorderColor">
  180. <span></span>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>`;
  187. },
  188. sliderHtmlShow: function() {
  189. let _this = this;
  190. $("#luckysheet-modal-dialog-slider-imageCtrl").remove();
  191. let sliderHtml = _this.getSliderHtml();
  192. $("body").first().append(sliderHtml);
  193. luckysheetsizeauto();
  194. let imgItem = _this.images[_this.currentImgId];
  195. //类型
  196. let type = imgItem.type;
  197. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemType" + type).prop("checked", true);
  198. //固定位置
  199. let isFixedPos = imgItem.isFixedPos;
  200. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemIsFixedPos").prop("checked", isFixedPos);
  201. //边框宽度
  202. let border = imgItem.border;
  203. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderWidth").val(border.width);
  204. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderRadius").val(border.radius);
  205. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderStyle").val(border.style);
  206. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderColor span").css("background-color", border.color).attr("title", border.color);
  207. _this.init();
  208. },
  209. colorSelectDialog: function(currenColor){
  210. const _locale = locale();
  211. const locale_button = _locale.button;
  212. const locale_toolbar = _locale.toolbar;
  213. const locale_imageCtrl = _locale.imageCtrl;
  214. $("#luckysheet-modal-dialog-mask").show();
  215. $("#luckysheet-imageCtrl-colorSelect-dialog").remove();
  216. $("body").first().append(replaceHtml(modelHTML, {
  217. "id": "luckysheet-imageCtrl-colorSelect-dialog",
  218. "addclass": "luckysheet-imageCtrl-colorSelect-dialog",
  219. "title": locale_imageCtrl.borderTile,
  220. "content": `<div class="currenColor">
  221. ${locale_imageCtrl.borderCur}:<span title="${currenColor}" style="background-color:${currenColor}"></span>
  222. </div>
  223. <div class="colorshowbox"></div>`,
  224. "botton": `<button id="luckysheet-imageCtrl-colorSelect-dialog-confirm" class="btn btn-primary">${locale_button.confirm}</button>
  225. <button class="btn btn-default luckysheet-model-close-btn">${locale_button.cancel}</button>`,
  226. "style": "z-index:100003"
  227. }));
  228. let $t = $("#luckysheet-imageCtrl-colorSelect-dialog")
  229. .find(".luckysheet-modal-dialog-content")
  230. .css("min-width", 300)
  231. .end(),
  232. myh = $t.outerHeight(),
  233. myw = $t.outerWidth();
  234. let winw = $(window).width(), winh = $(window).height();
  235. let scrollLeft = $(document).scrollLeft(), scrollTop = $(document).scrollTop();
  236. $("#luckysheet-imageCtrl-colorSelect-dialog").css({
  237. "left": (winw + scrollLeft - myw) / 2,
  238. "top": (winh + scrollTop - myh) / 3
  239. }).show();
  240. //初始化选择颜色插件
  241. $("#luckysheet-imageCtrl-colorSelect-dialog").find(".colorshowbox").spectrum({
  242. showPalette: true,
  243. showPaletteOnly: true,
  244. preferredFormat: "hex",
  245. clickoutFiresChange: false,
  246. showInitial: true,
  247. showInput: true,
  248. flat: true,
  249. hideAfterPaletteSelect: true,
  250. showSelectionPalette: true,
  251. showButtons: false,//隐藏选择取消按钮
  252. maxPaletteSize: 8,
  253. maxSelectionSize: 8,
  254. color: currenColor,
  255. cancelText: locale_button.cancel,
  256. chooseText: locale_toolbar.confirmColor,
  257. togglePaletteMoreText: locale_toolbar.customColor,
  258. togglePaletteLessText: locale_toolbar.collapse,
  259. togglePaletteOnly: true,
  260. clearText: locale_toolbar.clearText,
  261. noColorSelectedText: locale_toolbar.noColorSelectedText,
  262. localStorageKey: "spectrum.textcolor" + server.gridKey,
  263. palette: [
  264. ["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"],
  265. ["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"],
  266. ["#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#cfe2f3", "#d9d2e9", "#ead1dc"],
  267. ["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
  268. ["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"],
  269. ["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"],
  270. ["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"],
  271. ["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"]
  272. ],
  273. move: function(color){
  274. if (color != null) {
  275. color = color.toHexString();
  276. }
  277. else {
  278. color = "#000";
  279. }
  280. $("#luckysheet-imageCtrl-colorSelect-dialog .currenColor span").css("background-color", color).attr("title", color);
  281. }
  282. });
  283. },
  284. init: function() {
  285. let _this = this;
  286. //关闭
  287. $("#luckysheet-modal-dialog-slider-imageCtrl .luckysheet-model-close-btn").click(function () {
  288. $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
  289. luckysheetsizeauto();
  290. });
  291. //常规
  292. $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.radio").on("change.radio", ".radio-item input[type=radio][name=imgItemType]", function() {
  293. _this.configChange("type", this.value);
  294. })
  295. //固定位置
  296. $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.checkbox").on("change.checkbox", ".slider-box-checkbox input[type=checkbox]", function() {
  297. _this.configChange("fixedPos", this.checked);
  298. })
  299. //边框宽度
  300. $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderWidth").on("change.borderWidth", "#imgItemBorderWidth", function() {
  301. _this.configChange("border-width", this.valueAsNumber);
  302. })
  303. //边框半径
  304. $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderRadius").on("change.borderRadius", "#imgItemBorderRadius", function() {
  305. _this.configChange("border-radius", this.valueAsNumber);
  306. })
  307. //边框样式
  308. $("#luckysheet-modal-dialog-slider-imageCtrl").off("change.borderStyle").on("change.borderStyle", "#imgItemBorderStyle", function() {
  309. _this.configChange("border-style", this.value);
  310. })
  311. //边框颜色 选择
  312. $("#luckysheet-modal-dialog-slider-imageCtrl").off("click.color").on("click.color", "#imgItemBorderColor", function() {
  313. let currenColor = $(this).find("span").attr("title");
  314. _this.colorSelectDialog(currenColor);
  315. })
  316. //边框选择颜色 确定
  317. $(document).off("click.selectColorConfirm").on("click.selectColorConfirm", "#luckysheet-imageCtrl-colorSelect-dialog-confirm", function(){
  318. let $parent = $(this).parents("#luckysheet-imageCtrl-colorSelect-dialog");
  319. $("#luckysheet-modal-dialog-mask").hide();
  320. $parent.hide();
  321. let currenColor = $parent.find(".currenColor span").attr("title");
  322. $("#luckysheet-modal-dialog-slider-imageCtrl #imgItemBorderColor span").css("background-color", currenColor).attr("title", currenColor);
  323. _this.configChange("border-color", currenColor);
  324. });
  325. //image active
  326. $("#luckysheet-image-showBoxs").off("mousedown.active").on("mousedown.active", ".luckysheet-modal-dialog-image", function(e) {
  327. if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "editObjects",false)){
  328. return;
  329. }
  330. $(this).hide();
  331. let id = $(this).attr("id");
  332. if(_this.currentImgId != null && _this.currentImgId != id){
  333. _this.cancelActiveImgItem();
  334. }
  335. _this.currentImgId = id;
  336. let item = _this.images[id];
  337. let imgItemParam = _this.getImgItemParam(item);
  338. let width = imgItemParam.width * Store.zoomRatio;
  339. let height = imgItemParam.height * Store.zoomRatio;
  340. let left = imgItemParam.left * Store.zoomRatio;
  341. let top = imgItemParam.top * Store.zoomRatio;
  342. let position = imgItemParam.position;
  343. $("#luckysheet-modal-dialog-activeImage").show().css({
  344. "width": width,
  345. "height": height,
  346. "left": left,
  347. "top": top,
  348. "position": position
  349. });
  350. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  351. let imgUrl = typeof imageUrlHandle === 'function' ? imageUrlHandle(item.src) : item.src;
  352. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
  353. "background-image": "url(" + imgUrl + ")",
  354. "background-size": item.default.width * Store.zoomRatio + "px " + item.default.height * Store.zoomRatio + "px",
  355. "background-position": -item.crop.offsetLeft * Store.zoomRatio + "px " + -item.crop.offsetTop * Store.zoomRatio + "px"
  356. })
  357. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({
  358. "border-width": item.border.width * Store.zoomRatio,
  359. "border-style": item.border.style,
  360. "border-color": item.border.color,
  361. "border-radius": item.border.radius * Store.zoomRatio,
  362. "left": -item.border.width * Store.zoomRatio,
  363. "right": -item.border.width * Store.zoomRatio,
  364. "top": -item.border.width * Store.zoomRatio,
  365. "bottom": -item.border.width * Store.zoomRatio,
  366. })
  367. _this.sliderHtmlShow();
  368. e.stopPropagation();
  369. })
  370. //image move
  371. $("#luckysheet-modal-dialog-activeImage").off("mousedown.move").on("mousedown.move", ".luckysheet-modal-dialog-content", function(e) {
  372. if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "editObjects",false)){
  373. return;
  374. }
  375. if(!$("#luckysheet-modal-dialog-slider-imageCtrl").is(":visible")){
  376. _this.sliderHtmlShow();
  377. }
  378. _this.move = true;
  379. _this.currentWinW = $("#luckysheet-cell-main")[0].scrollWidth;
  380. _this.currentWinH = $("#luckysheet-cell-main")[0].scrollHeight;
  381. let offset = $("#luckysheet-modal-dialog-activeImage").offset();
  382. _this.moveXY = [
  383. e.pageX - offset.left,
  384. e.pageY - offset.top,
  385. ];
  386. setluckysheet_scroll_status(true);
  387. e.stopPropagation();
  388. })
  389. //image resize
  390. $("#luckysheet-modal-dialog-activeImage").off("mousedown.resize").on("mousedown.resize", ".luckysheet-modal-dialog-resize-item", function(e) {
  391. if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "editObjects",false)){
  392. return;
  393. }
  394. _this.currentWinW = $("#luckysheet-cell-main")[0].scrollWidth;
  395. _this.currentWinH = $("#luckysheet-cell-main")[0].scrollHeight;
  396. _this.resize = $(this).data("type");
  397. let scrollTop = $("#luckysheet-cell-main").scrollTop(),
  398. scrollLeft = $("#luckysheet-cell-main").scrollLeft();
  399. let mouse = mouseposition(e.pageX, e.pageY);
  400. let x = mouse[0] + scrollLeft;
  401. let y = mouse[1] + scrollTop;
  402. let position = $("#luckysheet-modal-dialog-activeImage").position();
  403. let width = $("#luckysheet-modal-dialog-activeImage").width();
  404. let height = $("#luckysheet-modal-dialog-activeImage").height();
  405. _this.resizeXY = [
  406. x,
  407. y,
  408. width,
  409. height,
  410. position.left + scrollLeft,
  411. position.top + scrollTop,
  412. scrollLeft,
  413. scrollTop
  414. ];
  415. setluckysheet_scroll_status(true);
  416. e.stopPropagation();
  417. })
  418. //image croppingEnter
  419. $("#luckysheet-modal-dialog-activeImage").off("mousedown.croppingEnter").on("mousedown.croppingEnter", ".luckysheet-modal-controll-crop", function(e) {
  420. _this.croppingEnter();
  421. e.stopPropagation();
  422. })
  423. //image croppingExit
  424. $("#luckysheet-modal-dialog-cropping").off("mousedown.croppingExit").on("mousedown.croppingExit", ".luckysheet-modal-controll-crop", function(e) {
  425. _this.croppingExit();
  426. e.stopPropagation();
  427. })
  428. //image crop change
  429. $("#luckysheet-modal-dialog-cropping").off("mousedown.cropChange").on("mousedown.cropChange", ".resize-item", function(e) {
  430. _this.cropChange = $(this).data("type");
  431. let scrollTop = $("#luckysheet-cell-main").scrollTop(),
  432. scrollLeft = $("#luckysheet-cell-main").scrollLeft();
  433. let mouse = mouseposition(e.pageX, e.pageY);
  434. let x = mouse[0] + scrollLeft;
  435. let y = mouse[1] + scrollTop;
  436. _this.cropChangeXY = [
  437. x,
  438. y
  439. ];
  440. setluckysheet_scroll_status(true);
  441. e.stopPropagation();
  442. })
  443. //image restore
  444. $("#luckysheet-image-showBoxs").off("mousedown.restore").on("mousedown.restore", ".luckysheet-modal-controll-restore", function(e) {
  445. _this.restoreImgItem();
  446. e.stopPropagation();
  447. })
  448. //image delete
  449. $("#luckysheet-image-showBoxs").off("mousedown.delete").on("mousedown.delete", ".luckysheet-modal-controll-del", function(e) {
  450. _this.removeImgItem();
  451. e.stopPropagation();
  452. })
  453. },
  454. configChange: function(type, value){
  455. let _this = this;
  456. let imgItem = _this.images[_this.currentImgId];
  457. switch(type){
  458. case "type":
  459. imgItem.type = value;
  460. break;
  461. case "fixedPos":
  462. imgItem.isFixedPos = value;
  463. let imgItemParam = _this.getImgItemParam(imgItem);
  464. let width = imgItemParam.width;
  465. let height = imgItemParam.height;
  466. let left = imgItemParam.left;
  467. let top = imgItemParam.top;
  468. let position = imgItemParam.position;
  469. $("#luckysheet-modal-dialog-activeImage").show().css({
  470. "width": width,
  471. "height": height,
  472. "left": left,
  473. "top": top,
  474. "position": position
  475. });
  476. break;
  477. case "border-width":
  478. imgItem.border.width = value;
  479. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css({
  480. "border-width": value,
  481. "left": -value,
  482. "right": -value,
  483. "top": -value,
  484. "bottom": -value
  485. });
  486. break;
  487. case "border-radius":
  488. imgItem.border.radius = value;
  489. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-radius", value);
  490. break;
  491. case "border-style":
  492. imgItem.border.style = value;
  493. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-style", value);
  494. break;
  495. case "border-color":
  496. imgItem.border.color = value;
  497. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-border").css("border-color", value);
  498. break;
  499. }
  500. _this.ref();
  501. },
  502. getImgItemParam(imgItem){
  503. let isFixedPos = imgItem.isFixedPos;
  504. let width = imgItem.default.width,
  505. height = imgItem.default.height,
  506. left = imgItem.default.left,
  507. top = imgItem.default.top;
  508. if(imgItem.crop.width != width || imgItem.crop.height != height){
  509. width = imgItem.crop.width;
  510. height = imgItem.crop.height;
  511. left += imgItem.crop.offsetLeft;
  512. top += imgItem.crop.offsetTop;
  513. }
  514. let position = 'absolute';
  515. if(isFixedPos){
  516. position = 'fixed';
  517. left = imgItem.fixedLeft + imgItem.crop.offsetLeft;
  518. top = imgItem.fixedTop + imgItem.crop.offsetTop;
  519. }
  520. return {
  521. width: width,
  522. height: height,
  523. left: left,
  524. top: top,
  525. position: position
  526. }
  527. },
  528. cancelActiveImgItem: function(){
  529. let _this = this;
  530. $("#luckysheet-modal-dialog-activeImage").hide();
  531. $("#luckysheet-modal-dialog-cropping").hide();
  532. $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
  533. let imgItem = _this.images[_this.currentImgId];
  534. let imgItemParam = _this.getImgItemParam(imgItem);
  535. let width = imgItemParam.width * Store.zoomRatio;
  536. let height = imgItemParam.height * Store.zoomRatio;
  537. let left = imgItemParam.left * Store.zoomRatio;
  538. let top = imgItemParam.top * Store.zoomRatio;
  539. let position = imgItemParam.position;
  540. $("#" + _this.currentImgId).show().css({
  541. "width": width,
  542. "height": height,
  543. "left": left,
  544. "top": top,
  545. "position": position
  546. });
  547. $("#" + _this.currentImgId + " img").css({
  548. "width": imgItem.default.width * Store.zoomRatio,
  549. "height": imgItem.default.height * Store.zoomRatio,
  550. "left": -imgItem.crop.offsetLeft * Store.zoomRatio,
  551. "top": -imgItem.crop.offsetTop * Store.zoomRatio
  552. });
  553. $("#" + _this.currentImgId + " .luckysheet-modal-dialog-border").css({
  554. "border-width": imgItem.border.width * Store.zoomRatio,
  555. "border-style": imgItem.border.style,
  556. "border-color": imgItem.border.color,
  557. "border-radius": imgItem.border.radius * Store.zoomRatio,
  558. "left": -imgItem.border.width * Store.zoomRatio,
  559. "right": -imgItem.border.width * Store.zoomRatio,
  560. "top": -imgItem.border.width * Store.zoomRatio,
  561. "bottom": -imgItem.border.width * Store.zoomRatio,
  562. })
  563. _this.currentImgId = null;
  564. },
  565. addImgItem: function(img) {
  566. let _this = this;
  567. let width, height;
  568. let max = 400;
  569. if(img.originHeight < img.originWidth){
  570. height = Math.round(img.originHeight * (max / img.originWidth));
  571. width = max;
  572. }
  573. else{
  574. width = Math.round(img.originWidth * (max / img.originHeight));
  575. height = max;
  576. }
  577. if(_this.images == null){
  578. _this.images = {};
  579. }
  580. let imgItem = $.extend(true, {}, _this.imgItem);
  581. imgItem.src = img.src;
  582. imgItem.originWidth = img.originWidth;
  583. imgItem.originHeight = img.originHeight;
  584. imgItem.default.width = width;
  585. imgItem.default.height = height;
  586. imgItem.default.left = img.left;
  587. imgItem.default.top = img.top;
  588. imgItem.crop.width = width;
  589. imgItem.crop.height = height;
  590. let scrollTop = $("#luckysheet-cell-main").scrollTop(),
  591. scrollLeft = $("#luckysheet-cell-main").scrollLeft();
  592. imgItem.fixedLeft = img.left - scrollLeft + Store.rowHeaderWidth;
  593. imgItem.fixedTop = img.top - scrollTop + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columnHeaderHeight;
  594. let id = _this.generateRandomId();
  595. let modelHtml = _this.modelHtml(id, imgItem);
  596. $("#luckysheet-image-showBoxs .img-list").append(modelHtml);
  597. _this.images[id] = imgItem;
  598. _this.ref();
  599. _this.init();
  600. },
  601. moveImgItem: function() {
  602. let _this = this;
  603. _this.move = false;
  604. let obj = $("#luckysheet-modal-dialog-activeImage")[0];
  605. let item = _this.images[_this.currentImgId];
  606. if(item.isFixedPos){
  607. item.fixedLeft = obj.offsetLeft - item.crop.offsetLeft;
  608. item.fixedTop = obj.offsetTop - item.crop.offsetTop;
  609. }
  610. else{
  611. item.default.left = obj.offsetLeft - item.crop.offsetLeft;
  612. item.default.top = obj.offsetTop - item.crop.offsetTop;
  613. }
  614. _this.ref();
  615. },
  616. resizeImgItem: function() {
  617. let _this = this;
  618. _this.resize = null;
  619. let obj = $("#luckysheet-modal-dialog-activeImage")[0];
  620. let item = _this.images[_this.currentImgId];
  621. let scaleX = obj.clientWidth / item.crop.width;
  622. let scaleY = obj.clientHeight / item.crop.height;
  623. item.default.width = Math.round(item.default.width * scaleX);
  624. item.default.height = Math.round(item.default.height * scaleY);
  625. item.crop.width = Math.round(item.crop.width * scaleX);
  626. item.crop.height = Math.round(item.crop.height * scaleY);
  627. item.crop.offsetLeft = Math.round(item.crop.offsetLeft * scaleX);
  628. item.crop.offsetTop = Math.round(item.crop.offsetTop * scaleY);
  629. if(item.isFixedPos){
  630. item.fixedLeft = obj.offsetLeft;
  631. item.fixedTop = obj.offsetTop;
  632. }
  633. else{
  634. item.default.left = obj.offsetLeft - item.crop.offsetLeft;
  635. item.default.top = obj.offsetTop - item.crop.offsetTop;
  636. }
  637. _this.ref();
  638. },
  639. croppingEnter: function() {
  640. let _this = this;
  641. _this.cropping = true;
  642. if(!checkProtectionAuthorityNormal(Store.currentSheetIndex, "editObjects",false)){
  643. return;
  644. }
  645. $("#luckysheet-modal-dialog-activeImage").hide();
  646. $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
  647. let item = _this.images[_this.currentImgId];
  648. let imgItemParam = _this.getImgItemParam(item);
  649. let width = imgItemParam.width;
  650. let height = imgItemParam.height;
  651. let left = imgItemParam.left;
  652. let top = imgItemParam.top;
  653. let position = imgItemParam.position;
  654. $("#luckysheet-modal-dialog-cropping").show().css({
  655. "width": width,
  656. "height": height,
  657. "left": left,
  658. "top": top,
  659. "position": position
  660. });
  661. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  662. let imgSrc = typeof imageUrlHandle === 'function' ? imageUrlHandle(item.src) : item.src;
  663. $("#luckysheet-modal-dialog-cropping .cropping-mask").css({
  664. "width": item.default.width,
  665. "height": item.default.height,
  666. "background-image": "url(" + imgSrc + ")",
  667. "left": -item.crop.offsetLeft,
  668. "top": -item.crop.offsetTop
  669. })
  670. $("#luckysheet-modal-dialog-cropping .cropping-content").css({
  671. "background-image": "url(" + imgSrc + ")",
  672. "background-size": item.default.width + "px " + item.default.height + "px",
  673. "background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
  674. })
  675. $("#luckysheet-modal-dialog-cropping .luckysheet-modal-dialog-border").css({
  676. "border-width": item.border.width,
  677. "border-style": item.border.style,
  678. "border-color": item.border.color,
  679. "border-radius": item.border.radius,
  680. "left": -item.border.width,
  681. "right": -item.border.width,
  682. "top": -item.border.width,
  683. "bottom": -item.border.width,
  684. })
  685. },
  686. croppingExit: function() {
  687. let _this = this;
  688. _this.cropping = false;
  689. $("#luckysheet-modal-dialog-cropping").hide();
  690. let item = _this.images[_this.currentImgId];
  691. let imgItemParam = _this.getImgItemParam(item);
  692. let width = imgItemParam.width;
  693. let height = imgItemParam.height;
  694. let left = imgItemParam.left;
  695. let top = imgItemParam.top;
  696. let position = imgItemParam.position;
  697. $("#luckysheet-modal-dialog-activeImage").show().css({
  698. "width": width,
  699. "height": height,
  700. "left": left,
  701. "top": top,
  702. "position": position
  703. });
  704. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  705. let imgSrc = typeof imageUrlHandle === 'function' ? imageUrlHandle(item.src) : item.src;
  706. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
  707. "background-image": "url(" + imgSrc + ")",
  708. "background-size": item.default.width + "px " + item.default.height + "px",
  709. "background-position": -item.crop.offsetLeft + "px " + -item.crop.offsetTop + "px"
  710. })
  711. },
  712. cropChangeImgItem: function() {
  713. let _this = this;
  714. _this.cropChange = null;
  715. let item = _this.images[_this.currentImgId];
  716. item.crop.width = _this.cropChangeObj.width;
  717. item.crop.height = _this.cropChangeObj.height;
  718. item.crop.offsetLeft = _this.cropChangeObj.offsetLeft;
  719. item.crop.offsetTop = _this.cropChangeObj.offsetTop;
  720. _this.ref();
  721. },
  722. restoreImgItem: function() {
  723. let _this = this;
  724. let imgItem = _this.images[_this.currentImgId];
  725. imgItem.default.width = imgItem.originWidth;
  726. imgItem.default.height = imgItem.originHeight;
  727. imgItem.crop.width = imgItem.originWidth;
  728. imgItem.crop.height = imgItem.originHeight;
  729. imgItem.crop.offsetLeft = 0;
  730. imgItem.crop.offsetTop = 0;
  731. let imgItemParam = _this.getImgItemParam(imgItem);
  732. let width = imgItemParam.width;
  733. let height = imgItemParam.height;
  734. let left = imgItemParam.left;
  735. let top = imgItemParam.top;
  736. let position = imgItemParam.position;
  737. $("#luckysheet-modal-dialog-activeImage").show().css({
  738. "width": width,
  739. "height": height,
  740. "left": left,
  741. "top": top,
  742. "position": position
  743. });
  744. let imageUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imageUrlHandle'];
  745. let imgSrc = typeof imageUrlHandle === 'function' ? imageUrlHandle(imgItem.src) : imgItem.src;
  746. $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({
  747. "background-image": "url(" + imgSrc + ")",
  748. "background-size": imgItem.default.width + "px " + imgItem.default.height + "px",
  749. "background-position": -imgItem.crop.offsetLeft + "px " + -imgItem.crop.offsetTop + "px"
  750. })
  751. _this.ref();
  752. },
  753. removeImgItem: function() {
  754. let _this = this;
  755. let imgItem = _this.images[_this.currentImgId];
  756. // 钩子 imageDeleteBefore
  757. if(!method.createHookFunction('imageDeleteBefore', imgItem)){
  758. return;
  759. }
  760. $("#luckysheet-modal-dialog-activeImage").hide();
  761. $("#luckysheet-modal-dialog-cropping").hide();
  762. $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
  763. $("#" + _this.currentImgId).remove();
  764. delete _this.images[_this.currentImgId];
  765. _this.currentImgId = null;
  766. // 钩子 imageDeleteAfter
  767. method.createHookFunction('imageDeleteAfter', imgItem);
  768. _this.ref();
  769. },
  770. copyImgItem: function(e) {
  771. let _this = this;
  772. _this.copyImgItemObj = $.extend(true, {}, _this.images[_this.currentImgId]);
  773. let clipboardData = window.clipboardData; //for IE
  774. if (!clipboardData) { // for chrome
  775. clipboardData = e.originalEvent.clipboardData;
  776. }
  777. let cpdata = '<table data-type="luckysheet_copy_action_image"><tr><td><td></tr></table>';
  778. if (!clipboardData) {
  779. let textarea = $("#luckysheet-copy-content");
  780. textarea.html(cpdata);
  781. textarea.focus();
  782. textarea.select();
  783. document.execCommand("selectAll");
  784. document.execCommand("Copy");
  785. // 等50毫秒,keyPress事件发生了再去处理数据
  786. setTimeout(function () {
  787. $("#luckysheet-copy-content").blur();
  788. }, 10);
  789. }
  790. else {
  791. clipboardData.setData('Text', cpdata);
  792. return false;//否则设不生效
  793. }
  794. },
  795. pasteImgItem: function() {
  796. let _this = this;
  797. if(_this.images == null){
  798. _this.images = {};
  799. }
  800. let rowIndex = Store.luckysheet_select_save[0].row_focus || 0;
  801. let colIndex = Store.luckysheet_select_save[0].column_focus || 0;
  802. let left = colIndex == 0 ? 0 : Store.visibledatacolumn[colIndex - 1];
  803. let top = rowIndex == 0 ? 0 : Store.visibledatarow[rowIndex - 1];
  804. let img = $.extend(true, {}, _this.copyImgItemObj);
  805. img.default.left = left - img.crop.offsetLeft;
  806. img.default.top = top - img.crop.offsetTop;
  807. let scrollTop = $("#luckysheet-cell-main").scrollTop(),
  808. scrollLeft = $("#luckysheet-cell-main").scrollLeft();
  809. img.fixedLeft = img.default.left - scrollLeft + Store.rowHeaderWidth;
  810. img.fixedTop = img.default.top - scrollTop + Store.infobarHeight + Store.toolbarHeight + Store.calculatebarHeight + Store.columnHeaderHeight;
  811. let id = _this.generateRandomId();
  812. let modelHtml = _this.modelHtml(id, img);
  813. $("#luckysheet-image-showBoxs .img-list").append(modelHtml);
  814. _this.images[id] = img;
  815. _this.ref();
  816. _this.init();
  817. },
  818. allImagesShow: function() {
  819. let _this = this;
  820. $("#luckysheet-modal-dialog-activeImage").hide();
  821. $("#luckysheet-modal-dialog-cropping").hide();
  822. $("#luckysheet-modal-dialog-slider-imageCtrl").hide();
  823. $("#luckysheet-image-showBoxs .img-list").empty();
  824. if(_this.images == null){
  825. return;
  826. }
  827. for(let imgId in _this.images){
  828. let imgItem = _this.images[imgId];
  829. let modelHtml = _this.modelHtml(imgId, imgItem);
  830. $("#luckysheet-image-showBoxs .img-list").append(modelHtml);
  831. }
  832. },
  833. moveChangeSize: function(rc, index, size) {
  834. let _this = this;
  835. let images = $.extend(true, {}, _this.images);
  836. if(rc == "row"){
  837. let row = Store.visibledatarow[index],
  838. row_pre = index - 1 == -1 ? 0 : Store.visibledatarow[index - 1];
  839. let changeSize = size - (row - row_pre - 1);
  840. for(let imgId in images){
  841. let imgItem = images[imgId];
  842. let imgItemParam = _this.getImgItemParam(imgItem);
  843. let type = imgItem.type;
  844. if(type == "1"){
  845. if(imgItemParam.top >= row){
  846. imgItem.default.top = imgItemParam.top + changeSize - imgItem.crop.offsetTop;
  847. }
  848. else{
  849. if(imgItemParam.top + imgItemParam.height >= row-2){
  850. if(imgItemParam.top < row + changeSize){
  851. let scaleY = (imgItemParam.height + changeSize) / imgItemParam.height;
  852. imgItem.default.height = Math.round(imgItem.default.height * scaleY);
  853. imgItem.crop.height = Math.round(imgItem.crop.height * scaleY);
  854. imgItem.crop.offsetTop = Math.round(imgItem.crop.offsetTop * scaleY);
  855. }
  856. else{
  857. let scaleY = (imgItemParam.top + imgItemParam.height - row) / imgItemParam.height;
  858. imgItem.default.height = Math.round(imgItem.default.height * scaleY);
  859. imgItem.crop.height = Math.round(imgItem.crop.height * scaleY);
  860. imgItem.crop.offsetTop = Math.round(imgItem.crop.offsetTop * scaleY);
  861. imgItem.default.top = row + changeSize - imgItem.crop.offsetTop;
  862. }
  863. }
  864. else{
  865. if(imgItemParam.top > row + changeSize){
  866. let scaleY = 1 / imgItemParam.height;
  867. imgItem.default.height = Math.round(imgItem.default.height * scaleY);
  868. imgItem.crop.height = Math.round(imgItem.crop.height * scaleY);
  869. imgItem.crop.offsetTop = Math.round(imgItem.crop.offsetTop * scaleY);
  870. imgItem.default.top = row + changeSize - imgItem.crop.offsetTop;
  871. }
  872. else if(imgItemParam.top + imgItemParam.height > row + changeSize){
  873. let scaleY = (row + changeSize - imgItemParam.top) / imgItemParam.height;
  874. imgItem.default.height = Math.round(imgItem.default.height * scaleY);
  875. imgItem.crop.height = Math.round(imgItem.crop.height * scaleY);
  876. imgItem.crop.offsetTop = Math.round(imgItem.crop.offsetTop * scaleY);
  877. }
  878. }
  879. }
  880. }
  881. else if(type == "2"){
  882. if(imgItemParam.top >= row){
  883. imgItem.default.top = imgItemParam.top + changeSize - imgItem.crop.offsetTop;
  884. }
  885. else if(imgItemParam.top > row + changeSize){
  886. imgItem.default.top = row + changeSize - imgItem.crop.offsetTop;
  887. }
  888. }
  889. }
  890. }
  891. else if(rc == "column"){
  892. let col = Store.visibledatacolumn[index],
  893. col_pre = index - 1 == -1 ? 0 : Store.visibledatacolumn[index - 1];
  894. let changeSize = size - (col - col_pre - 1);
  895. for(let imgId in images){
  896. let imgItem = images[imgId];
  897. let imgItemParam = _this.getImgItemParam(imgItem);
  898. let type = imgItem.type;
  899. if(type == "1"){
  900. if(imgItemParam.left >= col){
  901. imgItem.default.left = imgItemParam.left + changeSize - imgItem.crop.offsetLeft;
  902. }
  903. else{
  904. if(imgItemParam.left + imgItemParam.width >= col-2){
  905. if(imgItemParam.left < col + changeSize){
  906. let scaleX = (imgItemParam.width + changeSize) / imgItemParam.width;
  907. imgItem.default.width = Math.round(imgItem.default.width * scaleX);
  908. imgItem.crop.width = Math.round(imgItem.crop.width * scaleX);
  909. imgItem.crop.offsetLeft = Math.round(imgItem.crop.offsetLeft * scaleX);
  910. }
  911. else{
  912. let scaleX = (imgItemParam.left + imgItemParam.width - col) / imgItemParam.width;
  913. imgItem.default.width = Math.round(imgItem.default.width * scaleX);
  914. imgItem.crop.width = Math.round(imgItem.crop.width * scaleX);
  915. imgItem.crop.offsetLeft = Math.round(imgItem.crop.offsetLeft * scaleX);
  916. imgItem.default.left = col + changeSize - imgItem.crop.offsetLeft;
  917. }
  918. }
  919. else{
  920. if(imgItemParam.left > col + changeSize){
  921. let scaleX = 1 / imgItemParam.width;
  922. imgItem.default.width = Math.round(imgItem.default.width * scaleX);
  923. imgItem.crop.width = Math.round(imgItem.crop.width * scaleX);
  924. imgItem.crop.offsetLeft = Math.round(imgItem.crop.offsetLeft * scaleX);
  925. imgItem.default.left = col + changeSize - imgItem.crop.offsetLeft;
  926. }
  927. else if(imgItemParam.left + imgItemParam.width > col + changeSize){
  928. let scaleX = (col + changeSize - imgItemParam.left) / imgItemParam.width;
  929. imgItem.default.width = Math.round(imgItem.default.width * scaleX);
  930. imgItem.crop.width = Math.round(imgItem.crop.width * scaleX);
  931. imgItem.crop.offsetLeft = Math.round(imgItem.crop.offsetLeft * scaleX);
  932. }
  933. }
  934. }
  935. }
  936. else if(type == "2"){
  937. if(imgItemParam.left >= col){
  938. imgItem.default.left = imgItemParam.left + changeSize - imgItem.crop.offsetLeft;
  939. }
  940. else if(imgItemParam.left > col + changeSize){
  941. imgItem.default.left = col + changeSize - imgItem.crop.offsetLeft;
  942. }
  943. }
  944. }
  945. }
  946. return images;
  947. },
  948. ref: function() {
  949. let _this = this;
  950. let file = Store.luckysheetfile[getSheetIndex(Store.currentSheetIndex)];
  951. let images = _this.images;
  952. if (Store.clearjfundo) {
  953. Store.jfundo.length = 0;
  954. Store.jfredo.push({
  955. "type": "imageCtrl",
  956. "sheetIndex": Store.currentSheetIndex,
  957. "images": file.images == null ? null : $.extend(true, {}, file.images),
  958. "curImages": images
  959. });
  960. }
  961. file.images = $.extend(true, {}, images);
  962. server.saveParam("all", Store.currentSheetIndex, file.images, { "k": "images" });
  963. },
  964. }
  965. export default imageCtrl;