@fileverse-dev/fortune-react 1.3.5-hyper → 1.3.5-hyper-1

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.
@@ -643,6 +643,12 @@ var Toolbar = function Toolbar(_a) {
643
643
  window.dataVerificationClick = dataVerificationClick;
644
644
  window.conditionalFormatClick = conditionalFormatClick;
645
645
  }, []);
646
+ useEffect(function () {
647
+ if (cell != null) {
648
+ refs.globalCache.recentTextColor = normalizedCellAttr(cell, "fc");
649
+ refs.globalCache.recentBackgroundColor = normalizedCellAttr(cell, "bg");
650
+ }
651
+ }, [cell, refs.globalCache]);
646
652
  var getToolbarItem = useCallback(function (name, i) {
647
653
  var _a, _b, _c, _d, _e, _f, _g;
648
654
  var tooltip = toolbar[name];
@@ -652,6 +658,8 @@ var Toolbar = function Toolbar(_a) {
652
658
  });
653
659
  }
654
660
  if (["font-color", "background"].includes(name)) {
661
+ var displayTextColor_1 = cell != null ? normalizedCellAttr(cell, "fc") : "#000000";
662
+ var displayBackgroundColor_1 = cell != null ? normalizedCellAttr(cell, "bg") : undefined;
655
663
  var pick_1 = function pick_1(color) {
656
664
  setContext(function (draftCtx) {
657
665
  return (name === "font-color" ? handleTextColor : handleTextBackground)(draftCtx, refs.cellInput.current, color);
@@ -671,7 +679,7 @@ var Toolbar = function Toolbar(_a) {
671
679
  style: {
672
680
  width: 24,
673
681
  height: 4,
674
- backgroundColor: name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor,
682
+ backgroundColor: name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1,
675
683
  position: "absolute",
676
684
  bottom: 2,
677
685
  left: 3,
@@ -681,9 +689,9 @@ var Toolbar = function Toolbar(_a) {
681
689
  iconId: name,
682
690
  tooltip: tooltip,
683
691
  showArrow: false,
684
- fillColor: name === "font-color" ? refs.globalCache.recentTextColor : undefined,
692
+ fillColor: name === "font-color" ? displayTextColor_1 : undefined,
685
693
  onClick: function onClick() {
686
- var color = name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor;
694
+ var color = name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1;
687
695
  if (color) pick_1(color);
688
696
  }
689
697
  }, function (setOpen) {
@@ -652,6 +652,12 @@ var Toolbar = function Toolbar(_a) {
652
652
  window.dataVerificationClick = dataVerificationClick;
653
653
  window.conditionalFormatClick = conditionalFormatClick;
654
654
  }, []);
655
+ (0, _react.useEffect)(function () {
656
+ if (cell != null) {
657
+ refs.globalCache.recentTextColor = (0, _fortuneCore.normalizedCellAttr)(cell, "fc");
658
+ refs.globalCache.recentBackgroundColor = (0, _fortuneCore.normalizedCellAttr)(cell, "bg");
659
+ }
660
+ }, [cell, refs.globalCache]);
655
661
  var getToolbarItem = (0, _react.useCallback)(function (name, i) {
656
662
  var _a, _b, _c, _d, _e, _f, _g;
657
663
  var tooltip = toolbar[name];
@@ -661,6 +667,8 @@ var Toolbar = function Toolbar(_a) {
661
667
  });
662
668
  }
663
669
  if (["font-color", "background"].includes(name)) {
670
+ var displayTextColor_1 = cell != null ? (0, _fortuneCore.normalizedCellAttr)(cell, "fc") : "#000000";
671
+ var displayBackgroundColor_1 = cell != null ? (0, _fortuneCore.normalizedCellAttr)(cell, "bg") : undefined;
664
672
  var pick_1 = function pick_1(color) {
665
673
  setContext(function (draftCtx) {
666
674
  return (name === "font-color" ? _fortuneCore.handleTextColor : _fortuneCore.handleTextBackground)(draftCtx, refs.cellInput.current, color);
@@ -680,7 +688,7 @@ var Toolbar = function Toolbar(_a) {
680
688
  style: {
681
689
  width: 24,
682
690
  height: 4,
683
- backgroundColor: name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor,
691
+ backgroundColor: name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1,
684
692
  position: "absolute",
685
693
  bottom: 2,
686
694
  left: 3,
@@ -690,9 +698,9 @@ var Toolbar = function Toolbar(_a) {
690
698
  iconId: name,
691
699
  tooltip: tooltip,
692
700
  showArrow: false,
693
- fillColor: name === "font-color" ? refs.globalCache.recentTextColor : undefined,
701
+ fillColor: name === "font-color" ? displayTextColor_1 : undefined,
694
702
  onClick: function onClick() {
695
- var color = name === "font-color" ? refs.globalCache.recentTextColor : refs.globalCache.recentBackgroundColor;
703
+ var color = name === "font-color" ? displayTextColor_1 : displayBackgroundColor_1;
696
704
  if (color) pick_1(color);
697
705
  }
698
706
  }, function (setOpen) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.3.5-hyper",
3
+ "version": "1.3.5-hyper-1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.3.5-hyper",
19
+ "@fileverse-dev/fortune-core": "1.3.5-hyper-1",
20
20
  "@fileverse/ui": "5.0.0",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",