easy-email-extensions 3.1.57 → 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,7 +55,7 @@ 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";
@@ -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 },