@ivanholiak/easy-email-extensions 4.16.6 → 4.16.7

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.
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- export declare const ToolItem: React.FC<{
2
+ export interface ToolItemProps {
3
3
  title?: string;
4
4
  icon: React.ReactNode;
5
5
  onClick?: React.MouseEventHandler<any>;
6
6
  trigger?: string;
7
7
  style?: React.CSSProperties;
8
8
  isActive?: boolean;
9
- }>;
9
+ }
10
+ export declare const ToolItem: React.ForwardRefExoticComponent<ToolItemProps & React.RefAttributes<HTMLButtonElement>>;
package/lib/index2.js CHANGED
@@ -37838,8 +37838,14 @@ function ColorPicker(props) {
37838
37838
  },
37839
37839
  [addCurrentColor, onChange]
37840
37840
  );
37841
- const getPopupContainer = useCallback(() => {
37842
- return getCollapseItemEle(refEle);
37841
+ const getPopupContainerInternal = useCallback(() => {
37842
+ if (!refEle)
37843
+ return document.body;
37844
+ const container2 = getCollapseItemEle(refEle);
37845
+ if (!container2 || !container2.offsetParent) {
37846
+ return document.body;
37847
+ }
37848
+ return container2;
37843
37849
  }, [refEle]);
37844
37850
  const inputColor = useMemo(() => {
37845
37851
  var _a2, _b2, _c;
@@ -37866,8 +37872,11 @@ function ColorPicker(props) {
37866
37872
  value: adapterColor,
37867
37873
  onChange: onInputChange
37868
37874
  }),
37869
- getPopupContainer
37870
- }, props), children || /* @__PURE__ */ React__default.createElement("div", {
37875
+ getPopupContainer: props.getPopupContainer || getPopupContainerInternal
37876
+ }, props), children ? /* @__PURE__ */ React__default.createElement("div", {
37877
+ ref: setRefEle,
37878
+ style: { display: "inline-block" }
37879
+ }, children) : /* @__PURE__ */ React__default.createElement("div", {
37871
37880
  ref: setRefEle,
37872
37881
  style: {
37873
37882
  display: "inline-block",
@@ -37919,9 +37928,10 @@ const ColorPickerField = (props) => {
37919
37928
  config: colorAdapter
37920
37929
  }, props));
37921
37930
  };
37922
- const ToolItem$1 = (props) => {
37931
+ const ToolItem$1 = React__default.forwardRef((props, ref) => {
37923
37932
  if (!props.title) {
37924
37933
  return /* @__PURE__ */ React__default.createElement("button", {
37934
+ ref,
37925
37935
  tabIndex: -1,
37926
37936
  className: "easy-email-extensions-emailToolItem",
37927
37937
  title: props.title,
@@ -37934,12 +37944,14 @@ const ToolItem$1 = (props) => {
37934
37944
  position: "bottom",
37935
37945
  content: props.title
37936
37946
  }, /* @__PURE__ */ React__default.createElement("button", {
37947
+ ref,
37937
37948
  tabIndex: -1,
37938
37949
  className: classnames("easy-email-extensions-emailToolItem", props.isActive && "easy-email-extensions-emailToolItem-active"),
37939
37950
  onClick: props.onClick,
37940
37951
  style: props.style
37941
37952
  }, props.icon));
37942
- };
37953
+ });
37954
+ ToolItem$1.displayName = "ToolItem";
37943
37955
  function getAnchorElement$1(node) {
37944
37956
  if (!node)
37945
37957
  return null;
@@ -54699,6 +54711,7 @@ function Tools(props) {
54699
54711
  case AvailableTools.IconFontColor:
54700
54712
  return [
54701
54713
  /* @__PURE__ */ React__default.createElement(IconFontColor, {
54714
+ key: tool,
54702
54715
  selectionRange,
54703
54716
  execCommand,
54704
54717
  getPopoverMountNode
@@ -54707,6 +54720,7 @@ function Tools(props) {
54707
54720
  case AvailableTools.IconBgColor:
54708
54721
  return [
54709
54722
  /* @__PURE__ */ React__default.createElement(IconBgColor, {
54723
+ key: tool,
54710
54724
  selectionRange,
54711
54725
  execCommand,
54712
54726
  getPopoverMountNode
@@ -54807,13 +54821,12 @@ function Tools(props) {
54807
54821
  display: "flex",
54808
54822
  alignItems: "center"
54809
54823
  }
54810
- }, /* @__PURE__ */ React__default.createElement(BasicTools, null), tools.flatMap((tool, index2) => [
54811
- tool,
54812
- /* @__PURE__ */ React__default.createElement("div", {
54813
- className: "easy-email-extensions-divider",
54814
- key: `divider-${index2}`
54815
- })
54816
- ])), (_b2 = toolbar == null ? void 0 : toolbar.suffix) == null ? void 0 : _b2.call(toolbar, execCommand));
54824
+ }, /* @__PURE__ */ React__default.createElement(BasicTools, null), tools.map((tool, index2) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, {
54825
+ key: `tool-${index2}`
54826
+ }, tool, index2 < tools.length - 1 && /* @__PURE__ */ React__default.createElement("div", {
54827
+ className: "easy-email-extensions-divider",
54828
+ key: `divider-${index2}`
54829
+ })))), (_b2 = toolbar == null ? void 0 : toolbar.suffix) == null ? void 0 : _b2.call(toolbar, execCommand));
54817
54830
  }
54818
54831
  var styleText = ".easy-email-extensions-emailToolItem{display:inline-flex;align-items:center;justify-content:center;position:relative;outline:none;font-weight:400;appearance:none;cursor:pointer!important;white-space:nowrap;transition:all .1s linear;box-sizing:border-box;border-radius:2px;border:none;background-color:transparent;color:#fff;width:28px;height:27px}.easy-email-extensions-emailToolItem:hover,.easy-email-extensions-emailToolItem-active{background-color:#f2f3f5;color:#4e5969}.easy-email-extensions-divider{position:relative;display:inline-flex;width:1px;height:16px;background-color:#808080e6}\n";
54819
54832
  function RichTextToolBar(props) {