@fileverse-dev/fortune-react 1.0.2-mod-75 → 1.0.2-mod-76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2432,33 +2432,13 @@ var ImgBoxs = function ImgBoxs() {
2432
2432
  context = _useContext.context,
2433
2433
  setContext = _useContext.setContext,
2434
2434
  refs = _useContext.refs;
2435
- var containerRef = useRef(null);
2436
2435
  var activeImg = useMemo(function () {
2437
2436
  return _.find(context.insertedImgs, {
2438
2437
  id: context.activeImg
2439
2438
  });
2440
2439
  }, [context.activeImg, context.insertedImgs]);
2441
- useEffect(function () {
2442
- var handleClickOutside = function handleClickOutside(e) {
2443
- if (!containerRef.current) return;
2444
- var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
2445
- var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
2446
- return el.contains(e.target);
2447
- });
2448
- if (!clickedInsideSomeImage && context.activeImg !== undefined) {
2449
- setContext(function (ctx) {
2450
- ctx.activeImg = undefined;
2451
- });
2452
- }
2453
- };
2454
- document.addEventListener("mousedown", handleClickOutside);
2455
- return function () {
2456
- document.removeEventListener("mousedown", handleClickOutside);
2457
- };
2458
- }, [context.activeImg, setContext]);
2459
2440
  return /*#__PURE__*/React.createElement("div", {
2460
- id: "luckysheet-image-showBoxs",
2461
- ref: containerRef
2441
+ id: "luckysheet-image-showBoxs"
2462
2442
  }, activeImg && (/*#__PURE__*/React.createElement("div", {
2463
2443
  id: "luckysheet-modal-dialog-activeImage",
2464
2444
  className: "luckysheet-modal-dialog",
@@ -2523,41 +2503,16 @@ var ImgBoxs = function ImgBoxs() {
2523
2503
  }, /*#__PURE__*/React.createElement("i", {
2524
2504
  className: "fa fa-window-maximize",
2525
2505
  "aria-hidden": "true"
2526
- })), /*#__PURE__*/React.createElement(IconButton, {
2527
- icon: "Trash2",
2528
- onMouseDown: function onMouseDown(e) {
2529
- e.stopPropagation();
2530
- setContext(function (ctx) {
2531
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2532
- return sheet.id === ctx.currentSheetId;
2533
- });
2534
- if (currentSheet) {
2535
- var _currentSheet$images;
2536
- currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
2537
- return f.id !== activeImg.id;
2538
- });
2539
- }
2540
- ctx.activeImg = undefined;
2541
- });
2542
- },
2543
- onTouchEnd: function onTouchEnd(e) {
2544
- e.stopPropagation();
2545
- setContext(function (ctx) {
2546
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2547
- return sheet.id === ctx.currentSheetId;
2548
- });
2549
- if (currentSheet) {
2550
- var _currentSheet$images2;
2551
- currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
2552
- return f.id !== activeImg.id;
2553
- });
2554
- }
2555
- ctx.activeImg = undefined;
2556
- });
2557
- },
2558
- variant: "ghost",
2559
- className: "fortune-iframe-boxes-delete-button"
2560
- })))), /*#__PURE__*/React.createElement("div", {
2506
+ })), /*#__PURE__*/React.createElement("span", {
2507
+ className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
2508
+ role: "button",
2509
+ tabIndex: 0,
2510
+ "aria-label": "\u5220\u9664",
2511
+ title: "\u5220\u9664"
2512
+ }, /*#__PURE__*/React.createElement("i", {
2513
+ className: "fa fa-trash",
2514
+ "aria-hidden": "true"
2515
+ }))))), /*#__PURE__*/React.createElement("div", {
2561
2516
  className: "img-list"
2562
2517
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
2563
2518
  var id = v.id,
@@ -3888,10 +3843,9 @@ var IframeBoxs = function IframeBoxs() {
3888
3843
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
3889
3844
  return f.id !== frame.id;
3890
3845
  });
3891
- ctx.insertedIframes = currentSheet.iframes;
3892
- saveIframe(ctx);
3893
3846
  }
3894
3847
  ctx.activeIframe = undefined;
3848
+ saveIframe(ctx);
3895
3849
  });
3896
3850
  },
3897
3851
  variant: "ghost",
package/dist/index.js CHANGED
@@ -2443,33 +2443,13 @@ var ImgBoxs = function ImgBoxs() {
2443
2443
  context = _useContext.context,
2444
2444
  setContext = _useContext.setContext,
2445
2445
  refs = _useContext.refs;
2446
- var containerRef = React.useRef(null);
2447
2446
  var activeImg = React.useMemo(function () {
2448
2447
  return ___default['default'].find(context.insertedImgs, {
2449
2448
  id: context.activeImg
2450
2449
  });
2451
2450
  }, [context.activeImg, context.insertedImgs]);
2452
- React.useEffect(function () {
2453
- var handleClickOutside = function handleClickOutside(e) {
2454
- if (!containerRef.current) return;
2455
- var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
2456
- var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
2457
- return el.contains(e.target);
2458
- });
2459
- if (!clickedInsideSomeImage && context.activeImg !== undefined) {
2460
- setContext(function (ctx) {
2461
- ctx.activeImg = undefined;
2462
- });
2463
- }
2464
- };
2465
- document.addEventListener("mousedown", handleClickOutside);
2466
- return function () {
2467
- document.removeEventListener("mousedown", handleClickOutside);
2468
- };
2469
- }, [context.activeImg, setContext]);
2470
2451
  return /*#__PURE__*/React__default['default'].createElement("div", {
2471
- id: "luckysheet-image-showBoxs",
2472
- ref: containerRef
2452
+ id: "luckysheet-image-showBoxs"
2473
2453
  }, activeImg && (/*#__PURE__*/React__default['default'].createElement("div", {
2474
2454
  id: "luckysheet-modal-dialog-activeImage",
2475
2455
  className: "luckysheet-modal-dialog",
@@ -2534,41 +2514,16 @@ var ImgBoxs = function ImgBoxs() {
2534
2514
  }, /*#__PURE__*/React__default['default'].createElement("i", {
2535
2515
  className: "fa fa-window-maximize",
2536
2516
  "aria-hidden": "true"
2537
- })), /*#__PURE__*/React__default['default'].createElement(ui.IconButton, {
2538
- icon: "Trash2",
2539
- onMouseDown: function onMouseDown(e) {
2540
- e.stopPropagation();
2541
- setContext(function (ctx) {
2542
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2543
- return sheet.id === ctx.currentSheetId;
2544
- });
2545
- if (currentSheet) {
2546
- var _currentSheet$images;
2547
- currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
2548
- return f.id !== activeImg.id;
2549
- });
2550
- }
2551
- ctx.activeImg = undefined;
2552
- });
2553
- },
2554
- onTouchEnd: function onTouchEnd(e) {
2555
- e.stopPropagation();
2556
- setContext(function (ctx) {
2557
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
2558
- return sheet.id === ctx.currentSheetId;
2559
- });
2560
- if (currentSheet) {
2561
- var _currentSheet$images2;
2562
- currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
2563
- return f.id !== activeImg.id;
2564
- });
2565
- }
2566
- ctx.activeImg = undefined;
2567
- });
2568
- },
2569
- variant: "ghost",
2570
- className: "fortune-iframe-boxes-delete-button"
2571
- })))), /*#__PURE__*/React__default['default'].createElement("div", {
2517
+ })), /*#__PURE__*/React__default['default'].createElement("span", {
2518
+ className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
2519
+ role: "button",
2520
+ tabIndex: 0,
2521
+ "aria-label": "\u5220\u9664",
2522
+ title: "\u5220\u9664"
2523
+ }, /*#__PURE__*/React__default['default'].createElement("i", {
2524
+ className: "fa fa-trash",
2525
+ "aria-hidden": "true"
2526
+ }))))), /*#__PURE__*/React__default['default'].createElement("div", {
2572
2527
  className: "img-list"
2573
2528
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
2574
2529
  var id = v.id,
@@ -3899,10 +3854,9 @@ var IframeBoxs = function IframeBoxs() {
3899
3854
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
3900
3855
  return f.id !== frame.id;
3901
3856
  });
3902
- ctx.insertedIframes = currentSheet.iframes;
3903
- fortuneCore.saveIframe(ctx);
3904
3857
  }
3905
3858
  ctx.activeIframe = undefined;
3859
+ fortuneCore.saveIframe(ctx);
3906
3860
  });
3907
3861
  },
3908
3862
  variant: "ghost",
package/dist/index.umd.js CHANGED
@@ -106814,33 +106814,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106814
106814
  context = _useContext.context,
106815
106815
  setContext = _useContext.setContext,
106816
106816
  refs = _useContext.refs;
106817
- var containerRef = React.useRef(null);
106818
106817
  var activeImg = React.useMemo(function () {
106819
106818
  return lodash.find(context.insertedImgs, {
106820
106819
  id: context.activeImg
106821
106820
  });
106822
106821
  }, [context.activeImg, context.insertedImgs]);
106823
- React.useEffect(function () {
106824
- var handleClickOutside = function handleClickOutside(e) {
106825
- if (!containerRef.current) return;
106826
- var imageBoxes = containerRef.current.querySelectorAll(".luckysheet-modal-dialog-image");
106827
- var clickedInsideSomeImage = Array.from(imageBoxes).some(function (el) {
106828
- return el.contains(e.target);
106829
- });
106830
- if (!clickedInsideSomeImage && context.activeImg !== undefined) {
106831
- setContext(function (ctx) {
106832
- ctx.activeImg = undefined;
106833
- });
106834
- }
106835
- };
106836
- document.addEventListener("mousedown", handleClickOutside);
106837
- return function () {
106838
- document.removeEventListener("mousedown", handleClickOutside);
106839
- };
106840
- }, [context.activeImg, setContext]);
106841
106822
  return /*#__PURE__*/React__default['default'].createElement("div", {
106842
- id: "luckysheet-image-showBoxs",
106843
- ref: containerRef
106823
+ id: "luckysheet-image-showBoxs"
106844
106824
  }, activeImg && (/*#__PURE__*/React__default['default'].createElement("div", {
106845
106825
  id: "luckysheet-modal-dialog-activeImage",
106846
106826
  className: "luckysheet-modal-dialog",
@@ -106905,41 +106885,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
106905
106885
  }, /*#__PURE__*/React__default['default'].createElement("i", {
106906
106886
  className: "fa fa-window-maximize",
106907
106887
  "aria-hidden": "true"
106908
- })), /*#__PURE__*/React__default['default'].createElement(Er, {
106909
- icon: "Trash2",
106910
- onMouseDown: function onMouseDown(e) {
106911
- e.stopPropagation();
106912
- setContext(function (ctx) {
106913
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
106914
- return sheet.id === ctx.currentSheetId;
106915
- });
106916
- if (currentSheet) {
106917
- var _currentSheet$images;
106918
- currentSheet.images = (_currentSheet$images = currentSheet.images) === null || _currentSheet$images === void 0 ? void 0 : _currentSheet$images.filter(function (f) {
106919
- return f.id !== activeImg.id;
106920
- });
106921
- }
106922
- ctx.activeImg = undefined;
106923
- });
106924
- },
106925
- onTouchEnd: function onTouchEnd(e) {
106926
- e.stopPropagation();
106927
- setContext(function (ctx) {
106928
- var currentSheet = ctx.luckysheetfile.find(function (sheet) {
106929
- return sheet.id === ctx.currentSheetId;
106930
- });
106931
- if (currentSheet) {
106932
- var _currentSheet$images2;
106933
- currentSheet.images = (_currentSheet$images2 = currentSheet.images) === null || _currentSheet$images2 === void 0 ? void 0 : _currentSheet$images2.filter(function (f) {
106934
- return f.id !== activeImg.id;
106935
- });
106936
- }
106937
- ctx.activeImg = undefined;
106938
- });
106939
- },
106940
- variant: "ghost",
106941
- className: "fortune-iframe-boxes-delete-button"
106942
- })))), /*#__PURE__*/React__default['default'].createElement("div", {
106888
+ })), /*#__PURE__*/React__default['default'].createElement("span", {
106889
+ className: "luckysheet-modal-controll-btn luckysheet-modal-controll-del",
106890
+ role: "button",
106891
+ tabIndex: 0,
106892
+ "aria-label": "\u5220\u9664",
106893
+ title: "\u5220\u9664"
106894
+ }, /*#__PURE__*/React__default['default'].createElement("i", {
106895
+ className: "fa fa-trash",
106896
+ "aria-hidden": "true"
106897
+ }))))), /*#__PURE__*/React__default['default'].createElement("div", {
106943
106898
  className: "img-list"
106944
106899
  }, (_context$insertedImgs = context.insertedImgs) === null || _context$insertedImgs === void 0 ? void 0 : _context$insertedImgs.map(function (v) {
106945
106900
  var id = v.id,
@@ -108270,10 +108225,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
108270
108225
  currentSheet.iframes = (_currentSheet$iframes = currentSheet.iframes) === null || _currentSheet$iframes === void 0 ? void 0 : _currentSheet$iframes.filter(function (f) {
108271
108226
  return f.id !== frame.id;
108272
108227
  });
108273
- ctx.insertedIframes = currentSheet.iframes;
108274
- saveIframe(ctx);
108275
108228
  }
108276
108229
  ctx.activeIframe = undefined;
108230
+ saveIframe(ctx);
108277
108231
  });
108278
108232
  },
108279
108233
  variant: "ghost",