easy-email-extensions 3.1.54 → 3.1.60

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.
@@ -0,0 +1,6 @@
1
+ export declare function useFontFamily(): {
2
+ fontList: {
3
+ value: string;
4
+ label: string;
5
+ }[];
6
+ };
package/lib/index2.js CHANGED
@@ -55,12 +55,12 @@ var __async = (__this, __arguments, generator) => {
55
55
  };
56
56
  import * as React from "react";
57
57
  import React__default, { Children, isValidElement, cloneElement, createContext, useContext, Component, useMemo, memo, forwardRef, useEffect, useRef, useLayoutEffect, useState, createRef, useImperativeHandle, PureComponent, useCallback, useReducer, Fragment, createElement, Suspense } from "react";
58
- import { IconFont, useEditorProps, Stack as Stack$6, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, TextStyle, useFocusIdx, useEditorContext, getShadowRoot, FIXED_CONTAINER_ID, useFocusBlockLayout, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, useRefState, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
58
+ import { IconFont, useEditorProps, Stack as Stack$6, getBlockNodeByIdx, useBlock, getEditNode, getEditContent, TextStyle, useEditorContext, useFocusIdx, getShadowRoot, FIXED_CONTAINER_ID, useFocusBlockLayout, scrollBlockEleIntoView, useHoverIdx, useDataTransfer, useRefState, getBlockNodeByChildEle, getDirectionPosition, DATA_ATTRIBUTE_DROP_CONTAINER, BlockAvatarWrapper, getEditorRoot, useActiveTab, ActiveTabKeys } from "easy-email-editor";
59
59
  import { BasicType, ImageManager, BlockManager, createBlockDataByType, getParentByIdx, getParentIdx, getValueByIdx, getIndexByIdx, getSiblingIdx, getNodeIdxFromClassName, getNodeIdxClassName, getPageIdx, getChildIdx, MjmlToJson, JsonToMjml, getNodeTypeFromClassName } from "easy-email-core";
60
60
  import ReactDOM, { findDOMNode, createPortal } from "react-dom";
61
61
  import { useField, Field, useForm as useForm$1, Form as Form$3, version as version$2, useFormState } from "react-final-form";
62
62
  var index$2 = "";
63
- const title = "_title_15b2l_1";
63
+ const title = "_title_1f523_1";
64
64
  var styles$6 = {
65
65
  title
66
66
  };
@@ -38408,14 +38408,14 @@ function RadioGroup(props) {
38408
38408
  value: item2.value
38409
38409
  }, item2.label))));
38410
38410
  }
38411
- const helperText = "_helperText_fadvl_1";
38412
- const labelHidden = "_label-hidden_fadvl_9";
38413
- const editTab = "_editTab_fadvl_20";
38414
- const inputWithUnit = "_inputWithUnit_fadvl_27";
38415
- const inputWithUnitSelectOption = "_inputWithUnitSelectOption_fadvl_35";
38411
+ const helperText = "_helperText_k05ys_1";
38412
+ const labelHidden = "_label-hidden_k05ys_9";
38413
+ const editTab = "_editTab_k05ys_20";
38414
+ const inputWithUnit = "_inputWithUnit_k05ys_27";
38415
+ const inputWithUnitSelectOption = "_inputWithUnitSelectOption_k05ys_35";
38416
38416
  var styles$3 = {
38417
38417
  helperText,
38418
- "label-hidden": "_label-hidden_fadvl_9",
38418
+ "label-hidden": "_label-hidden_k05ys_9",
38419
38419
  labelHidden,
38420
38420
  editTab,
38421
38421
  inputWithUnit,
@@ -38947,8 +38947,27 @@ function FontSizeList(props) {
38947
38947
  key: item2.value
38948
38948
  }, item2.label))));
38949
38949
  }
38950
+ function useFontFamily() {
38951
+ const { fontList: defaultFontList } = useEditorProps();
38952
+ const { pageData: pageData2 } = useEditorContext();
38953
+ const addFonts = pageData2.data.value.fonts;
38954
+ const fontList2 = useMemo(() => {
38955
+ const fonts = [];
38956
+ if (defaultFontList) {
38957
+ fonts.push(...defaultFontList);
38958
+ }
38959
+ if (addFonts) {
38960
+ const options2 = addFonts.map((item2) => ({ value: item2.name, label: item2.name }));
38961
+ fonts.unshift(...options2);
38962
+ }
38963
+ return fonts;
38964
+ }, [addFonts, defaultFontList]);
38965
+ return {
38966
+ fontList: fontList2
38967
+ };
38968
+ }
38950
38969
  function FontFamily$1(props) {
38951
- const { fontList: fontList2 = [] } = useEditorProps();
38970
+ const { fontList: fontList2 } = useFontFamily();
38952
38971
  return /* @__PURE__ */ React__default.createElement("div", {
38953
38972
  style: {
38954
38973
  maxWidth: 150,
@@ -39140,13 +39159,11 @@ function AddFont() {
39140
39159
  }, /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
39141
39160
  fill: true
39142
39161
  }, /* @__PURE__ */ React__default.createElement(TextField, {
39143
- inline: true,
39144
39162
  name: `${focusIdx2}.data.value.fonts.${index2}.name`,
39145
39163
  label: "Name"
39146
39164
  })), /* @__PURE__ */ React__default.createElement(Stack$6.Item, {
39147
39165
  fill: true
39148
39166
  }, /* @__PURE__ */ React__default.createElement(TextField, {
39149
- inline: true,
39150
39167
  name: `${focusIdx2}.data.value.fonts.${index2}.href`,
39151
39168
  label: "Href"
39152
39169
  })), /* @__PURE__ */ React__default.createElement(Button$4, {
@@ -39217,8 +39234,8 @@ function EyeIcon() {
39217
39234
  });
39218
39235
  }
39219
39236
  function FontFamily() {
39220
- const { fontList: fontList2 = [] } = useEditorProps();
39221
39237
  const { focusIdx: focusIdx2 } = useFocusIdx();
39238
+ const { fontList: fontList2 } = useFontFamily();
39222
39239
  return useMemo(() => {
39223
39240
  return /* @__PURE__ */ React__default.createElement(AutoCompleteField, {
39224
39241
  style: { minWidth: 100, flex: 1 },
@@ -42062,7 +42079,12 @@ function BlockLayer(props) {
42062
42079
  style: { fontSize: 12, color: "#999" }
42063
42080
  }), /* @__PURE__ */ React__default.createElement("div", {
42064
42081
  title: lodash.exports.isString(title2) ? title2 : "",
42065
- style: { overflow: "hidden", whiteSpace: "nowrap", width: "5em" }
42082
+ style: {
42083
+ overflow: "hidden",
42084
+ whiteSpace: "nowrap",
42085
+ width: "5em",
42086
+ textOverflow: "ellipsis"
42087
+ }
42066
42088
  }, /* @__PURE__ */ React__default.createElement(TextStyle, {
42067
42089
  size: "smallest"
42068
42090
  }, title2))), /* @__PURE__ */ React__default.createElement("div", {