@flozy/editor 6.0.5 → 6.0.6
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/Editor/CommonEditor.js +15 -17
 - package/dist/Editor/Editor.css +4 -3
 - package/dist/Editor/Elements/AI/PopoverAIInput.js +2 -12
 - package/dist/Editor/Elements/Button/EditorButton.js +1 -0
 - package/dist/Editor/Elements/DataView/DataView.js +4 -3
 - package/dist/Editor/Elements/DataView/Layouts/DataTypes/NumberType.js +5 -1
 - package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +5 -1
 - package/dist/Editor/Elements/DataView/Layouts/FilterView.js +23 -19
 - package/dist/Editor/Elements/Form/Form.js +1 -0
 - package/dist/Editor/Elements/FreeGrid/styles.js +1 -0
 - package/dist/Editor/Elements/List/CheckList.js +2 -1
 - package/dist/Editor/Elements/Search/SearchAttachment.js +1 -0
 - package/dist/Editor/Elements/Search/SearchList.js +8 -1
 - package/dist/Editor/Elements/SimpleText/index.js +19 -7
 - package/dist/Editor/Elements/SimpleText/style.js +5 -1
 - package/dist/Editor/Elements/Table/Table.js +15 -15
 - package/dist/Editor/Elements/Table/TableCell.js +14 -9
 - package/dist/Editor/MiniEditor.js +4 -2
 - package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +37 -28
 - package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +3 -1
 - package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +1 -1
 - package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +3 -1
 - package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +3 -8
 - package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +9 -3
 - package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +1 -1
 - package/dist/Editor/Toolbar/PopupTool/TextFormat.js +45 -0
 - package/dist/Editor/Toolbar/PopupTool/index.js +45 -32
 - package/dist/Editor/common/FontLoader/FontList.js +11 -11
 - package/dist/Editor/common/FontLoader/FontLoader.js +45 -75
 - package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
 - package/dist/Editor/common/ImageSelector/UploadStyles.js +2 -1
 - package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
 - package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +6 -0
 - package/dist/Editor/common/Section/index.js +89 -60
 - package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
 - package/dist/Editor/common/StyleBuilder/fieldTypes/lineSpacing.js +79 -0
 - package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +4 -0
 - package/dist/Editor/commonStyle.js +5 -0
 - package/dist/Editor/helper/deserialize/index.js +1 -1
 - package/dist/Editor/helper/ensureWrappedVariables.js +28 -0
 - package/dist/Editor/helper/theme.js +24 -1
 - package/dist/Editor/hooks/useDrag.js +11 -17
 - package/dist/Editor/hooks/useEditorScroll.js +2 -1
 - package/dist/Editor/hooks/useMouseMove.js +6 -4
 - package/dist/Editor/plugins/withHTML.js +7 -1
 - package/dist/Editor/utils/SlateUtilityFunctions.js +23 -12
 - package/dist/Editor/utils/customHooks/useTableResize.js +2 -1
 - package/dist/Editor/utils/helper.js +41 -0
 - package/dist/Editor/utils/pageSettings.js +14 -2
 - package/dist/Editor/utils/table.js +21 -0
 - package/package.json +3 -3
 
| 
         @@ -4,6 +4,7 @@ import TemplateCard from "./TemplateCard"; 
     | 
|
| 
       4 
4 
     | 
    
         
             
            import FullViewCard from "./FullViewCard";
         
     | 
| 
       5 
5 
     | 
    
         
             
            import ButtonTemplateCard from "./ButtonTemplatesCard";
         
     | 
| 
       6 
6 
     | 
    
         
             
            import { jsx as _jsx } from "react/jsx-runtime";
         
     | 
| 
      
 7 
     | 
    
         
            +
            import { Fragment as _Fragment } from "react/jsx-runtime";
         
     | 
| 
       7 
8 
     | 
    
         
             
            import { jsxs as _jsxs } from "react/jsx-runtime";
         
     | 
| 
       8 
9 
     | 
    
         
             
            const CATEGORIES_SORT_INDEX = {
         
     | 
| 
       9 
10 
     | 
    
         
             
              Brief: 1,
         
     | 
| 
         @@ -46,7 +47,7 @@ const ProgressBar = ({ 
     | 
|
| 
       46 
47 
     | 
    
         
             
                  alignItems: "center",
         
     | 
| 
       47 
48 
     | 
    
         
             
                  margin: 0,
         
     | 
| 
       48 
49 
     | 
    
         
             
                  padding: 0,
         
     | 
| 
       49 
     | 
    
         
            -
                  height: " 
     | 
| 
      
 50 
     | 
    
         
            +
                  height: "300px",
         
     | 
| 
       50 
51 
     | 
    
         
             
                  overflow: "hidden"
         
     | 
| 
       51 
52 
     | 
    
         
             
                },
         
     | 
| 
       52 
53 
     | 
    
         
             
                children: /*#__PURE__*/_jsx(CircularProgress, {})
         
     | 
| 
         @@ -69,41 +70,49 @@ const AddTemplates = props => { 
     | 
|
| 
       69 
70 
     | 
    
         
             
              const [categories, setCategories] = useState([]);
         
     | 
| 
       70 
71 
     | 
    
         
             
              const [category, setCategory] = useState("");
         
     | 
| 
       71 
72 
     | 
    
         
             
              const [templates, setTemplates] = useState([]);
         
     | 
| 
       72 
     | 
    
         
            -
              const [filteredTemplates, setFilteredTemplates] = useState([]);
         
     | 
| 
       73 
73 
     | 
    
         
             
              useEffect(() => {
         
     | 
| 
       74 
     | 
    
         
            -
                 
     | 
| 
      
 74 
     | 
    
         
            +
                getCategoryList();
         
     | 
| 
       75 
75 
     | 
    
         
             
              }, []);
         
     | 
| 
       76 
     | 
    
         
            -
              const  
     | 
| 
       77 
     | 
    
         
            -
                 
     | 
| 
      
 76 
     | 
    
         
            +
              const getCategoryList = async () => {
         
     | 
| 
      
 77 
     | 
    
         
            +
                setLoading(true);
         
     | 
| 
      
 78 
     | 
    
         
            +
                const categoryDB = await services("listCategory");
         
     | 
| 
      
 79 
     | 
    
         
            +
                if (categoryDB?.data?.Template?.length > 0) {
         
     | 
| 
      
 80 
     | 
    
         
            +
                  setCategories(categoryDB.data.Template);
         
     | 
| 
      
 81 
     | 
    
         
            +
                  setCategory(categoryDB.data.Template[0]);
         
     | 
| 
      
 82 
     | 
    
         
            +
                  getTemplatesList(categoryDB.data.Template[0]);
         
     | 
| 
      
 83 
     | 
    
         
            +
                }
         
     | 
| 
      
 84 
     | 
    
         
            +
                setLoading(false);
         
     | 
| 
       78 
85 
     | 
    
         
             
              };
         
     | 
| 
       79 
     | 
    
         
            -
              const getTemplatesList = async  
     | 
| 
      
 86 
     | 
    
         
            +
              const getTemplatesList = async selectedCategory => {
         
     | 
| 
       80 
87 
     | 
    
         
             
                setLoading(true);
         
     | 
| 
       81 
     | 
    
         
            -
                const result = await services("listTemplates", { 
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
                 
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                    a.push(b.category);
         
     | 
| 
       86 
     | 
    
         
            -
                  }
         
     | 
| 
       87 
     | 
    
         
            -
                  return a;
         
     | 
| 
       88 
     | 
    
         
            -
                }, []).sort(sortCategory);
         
     | 
| 
       89 
     | 
    
         
            -
                const ft = tempList?.filter(f => f.category === lic[0]);
         
     | 
| 
       90 
     | 
    
         
            -
                setTemplates(tempList);
         
     | 
| 
       91 
     | 
    
         
            -
                setCategories(lic);
         
     | 
| 
       92 
     | 
    
         
            -
                setCategory(lic[0]);
         
     | 
| 
       93 
     | 
    
         
            -
                setFilteredTemplates(ft);
         
     | 
| 
      
 88 
     | 
    
         
            +
                const result = await services("listTemplates", {
         
     | 
| 
      
 89 
     | 
    
         
            +
                  category: selectedCategory
         
     | 
| 
      
 90 
     | 
    
         
            +
                });
         
     | 
| 
      
 91 
     | 
    
         
            +
                setTemplates(result?.data || []);
         
     | 
| 
       94 
92 
     | 
    
         
             
                setLoading(false);
         
     | 
| 
       95 
93 
     | 
    
         
             
              };
         
     | 
| 
       96 
94 
     | 
    
         
             
              const handleChange = (event, newValue) => {
         
     | 
| 
      
 95 
     | 
    
         
            +
                setTemplates([]);
         
     | 
| 
       97 
96 
     | 
    
         
             
                onSearch("");
         
     | 
| 
       98 
97 
     | 
    
         
             
                setCategory(newValue);
         
     | 
| 
       99 
     | 
    
         
            -
                 
     | 
| 
      
 98 
     | 
    
         
            +
                getTemplatesList(newValue);
         
     | 
| 
       100 
99 
     | 
    
         
             
              };
         
     | 
| 
       101 
     | 
    
         
            -
              const onSelectTemplate = card => () => {
         
     | 
| 
      
 100 
     | 
    
         
            +
              const onSelectTemplate = card => async () => {
         
     | 
| 
       102 
101 
     | 
    
         
             
                try {
         
     | 
| 
       103 
     | 
    
         
            -
                   
     | 
| 
      
 102 
     | 
    
         
            +
                  const {
         
     | 
| 
      
 103 
     | 
    
         
            +
                    data
         
     | 
| 
      
 104 
     | 
    
         
            +
                  } = await services("templateContent", {
         
     | 
| 
      
 105 
     | 
    
         
            +
                    id: card?.id
         
     | 
| 
      
 106 
     | 
    
         
            +
                  });
         
     | 
| 
      
 107 
     | 
    
         
            +
                  const content = data?.content;
         
     | 
| 
      
 108 
     | 
    
         
            +
                  if (content) {
         
     | 
| 
      
 109 
     | 
    
         
            +
                    editor.insertNode(JSON.parse(content));
         
     | 
| 
      
 110 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 111 
     | 
    
         
            +
                    console.log("No data found");
         
     | 
| 
      
 112 
     | 
    
         
            +
                  }
         
     | 
| 
       104 
113 
     | 
    
         
             
                  onClose();
         
     | 
| 
       105 
114 
     | 
    
         
             
                } catch (err) {
         
     | 
| 
       106 
     | 
    
         
            -
                  console.log(err);
         
     | 
| 
      
 115 
     | 
    
         
            +
                  console.log("Error inserting template content into editor:", err);
         
     | 
| 
       107 
116 
     | 
    
         
             
                }
         
     | 
| 
       108 
117 
     | 
    
         
             
              };
         
     | 
| 
       109 
118 
     | 
    
         
             
              const filterByTitle = f => {
         
     | 
| 
         @@ -173,16 +182,16 @@ const AddTemplates = props => { 
     | 
|
| 
       173 
182 
     | 
    
         
             
                    data: categories,
         
     | 
| 
       174 
183 
     | 
    
         
             
                    handleChange: handleChange
         
     | 
| 
       175 
184 
     | 
    
         
             
                  })
         
     | 
| 
       176 
     | 
    
         
            -
                }), /*#__PURE__*/ 
     | 
| 
      
 185 
     | 
    
         
            +
                }), /*#__PURE__*/_jsx(Grid, {
         
     | 
| 
       177 
186 
     | 
    
         
             
                  container: true,
         
     | 
| 
       178 
187 
     | 
    
         
             
                  spacing: 0,
         
     | 
| 
       179 
188 
     | 
    
         
             
                  className: `${fullScreen ? "fullscreen" : ""}`,
         
     | 
| 
       180 
189 
     | 
    
         
             
                  sx: classes.templateCardsWrpr,
         
     | 
| 
       181 
     | 
    
         
            -
                  children:  
     | 
| 
      
 190 
     | 
    
         
            +
                  children: loading ? /*#__PURE__*/_jsx(ProgressBar, {
         
     | 
| 
       182 
191 
     | 
    
         
             
                    loading: loading
         
     | 
| 
       183 
     | 
    
         
            -
                  }) 
     | 
| 
       184 
     | 
    
         
            -
                     
     | 
| 
       185 
     | 
    
         
            -
                  }) 
     | 
| 
      
 192 
     | 
    
         
            +
                  }) : /*#__PURE__*/_jsx(_Fragment, {
         
     | 
| 
      
 193 
     | 
    
         
            +
                    children: templates.filter(filterByTitle).map(renderTemplate)
         
     | 
| 
      
 194 
     | 
    
         
            +
                  })
         
     | 
| 
       186 
195 
     | 
    
         
             
                })]
         
     | 
| 
       187 
196 
     | 
    
         
             
              });
         
     | 
| 
       188 
197 
     | 
    
         
             
            };
         
     | 
| 
         @@ -51,7 +51,8 @@ const alignmentOptions = [{ 
     | 
|
| 
       51 
51 
     | 
    
         
             
            }];
         
     | 
| 
       52 
52 
     | 
    
         
             
            function SelectAlignment({
         
     | 
| 
       53 
53 
     | 
    
         
             
              editor,
         
     | 
| 
       54 
     | 
    
         
            -
              classes
         
     | 
| 
      
 54 
     | 
    
         
            +
              classes,
         
     | 
| 
      
 55 
     | 
    
         
            +
              closeMainPopup
         
     | 
| 
       55 
56 
     | 
    
         
             
            }) {
         
     | 
| 
       56 
57 
     | 
    
         
             
              const selected = useMemo(() => {
         
     | 
| 
       57 
58 
     | 
    
         
             
                return alignmentOptions.find(t => isBlockActive(editor, t.value));
         
     | 
| 
         @@ -59,6 +60,7 @@ function SelectAlignment({ 
     | 
|
| 
       59 
60 
     | 
    
         
             
              const onChange = (format, option) => {
         
     | 
| 
       60 
61 
     | 
    
         
             
                if (option.type === "block") {
         
     | 
| 
       61 
62 
     | 
    
         
             
                  toggleBlock(editor, format);
         
     | 
| 
      
 63 
     | 
    
         
            +
                  closeMainPopup();
         
     | 
| 
       62 
64 
     | 
    
         
             
                }
         
     | 
| 
       63 
65 
     | 
    
         
             
              };
         
     | 
| 
       64 
66 
     | 
    
         
             
              return /*#__PURE__*/_jsx(CustomSelectTool, {
         
     | 
| 
         @@ -68,7 +68,8 @@ const listOptions = [{ 
     | 
|
| 
       68 
68 
     | 
    
         
             
            }];
         
     | 
| 
       69 
69 
     | 
    
         
             
            function SelectList({
         
     | 
| 
       70 
70 
     | 
    
         
             
              editor,
         
     | 
| 
       71 
     | 
    
         
            -
              classes
         
     | 
| 
      
 71 
     | 
    
         
            +
              classes,
         
     | 
| 
      
 72 
     | 
    
         
            +
              closeMainPopup
         
     | 
| 
       72 
73 
     | 
    
         
             
            }) {
         
     | 
| 
       73 
74 
     | 
    
         
             
              const selectedList = useMemo(() => {
         
     | 
| 
       74 
75 
     | 
    
         
             
                return listOptions.find(t => isBlockActive(editor, t.value));
         
     | 
| 
         @@ -79,6 +80,7 @@ function SelectList({ 
     | 
|
| 
       79 
80 
     | 
    
         
             
                } else if (option.type === "accordion") {
         
     | 
| 
       80 
81 
     | 
    
         
             
                  insertAccordion(editor);
         
     | 
| 
       81 
82 
     | 
    
         
             
                }
         
     | 
| 
      
 83 
     | 
    
         
            +
                closeMainPopup();
         
     | 
| 
       82 
84 
     | 
    
         
             
              };
         
     | 
| 
       83 
85 
     | 
    
         
             
              return /*#__PURE__*/_jsx(CustomSelectTool, {
         
     | 
| 
       84 
86 
     | 
    
         
             
                options: listOptions,
         
     | 
| 
         @@ -125,7 +125,6 @@ function SelectTypography({ 
     | 
|
| 
       125 
125 
     | 
    
         
             
                    ...upData
         
     | 
| 
       126 
126 
     | 
    
         
             
                  }
         
     | 
| 
       127 
127 
     | 
    
         
             
                });
         
     | 
| 
       128 
     | 
    
         
            -
                closeMainPopup();
         
     | 
| 
       129 
128 
     | 
    
         
             
              };
         
     | 
| 
       130 
129 
     | 
    
         
             
              const selectedBlock = useMemo(() => {
         
     | 
| 
       131 
130 
     | 
    
         
             
                return typographyOptions.find(t => {
         
     | 
| 
         @@ -152,21 +151,17 @@ function SelectTypography({ 
     | 
|
| 
       152 
151 
     | 
    
         
             
                toggleBlock(editor, format);
         
     | 
| 
       153 
152 
     | 
    
         
             
                if (option.type === "block") {
         
     | 
| 
       154 
153 
     | 
    
         
             
                  // reset old font size
         
     | 
| 
       155 
     | 
    
         
            -
                  let updatedValue = !selectedBlock ? {} : {
         
     | 
| 
       156 
     | 
    
         
            -
                    xs: "16px",
         
     | 
| 
       157 
     | 
    
         
            -
                    sm: "16px",
         
     | 
| 
       158 
     | 
    
         
            -
                    md: "16px",
         
     | 
| 
       159 
     | 
    
         
            -
                    lg: "16px"
         
     | 
| 
       160 
     | 
    
         
            -
                  };
         
     | 
| 
      
 154 
     | 
    
         
            +
                  // let updatedValue = !selectedBlock ? {} : { xs: "16px", sm: "16px", md: "16px", lg: "16px" }
         
     | 
| 
       161 
155 
     | 
    
         
             
                  addMarkData(editor, {
         
     | 
| 
       162 
156 
     | 
    
         
             
                    format: "fontSize",
         
     | 
| 
       163 
     | 
    
         
            -
                    value:  
     | 
| 
      
 157 
     | 
    
         
            +
                    value: {}
         
     | 
| 
       164 
158 
     | 
    
         
             
                  });
         
     | 
| 
       165 
159 
     | 
    
         
             
                } else if (option.type === "mark") {
         
     | 
| 
       166 
160 
     | 
    
         
             
                  const size = sizeMap[option.value] || "";
         
     | 
| 
       167 
161 
     | 
    
         
             
                  const [sizeInNumber] = size.split("px");
         
     | 
| 
       168 
162 
     | 
    
         
             
                  updateMarkData(Number(sizeInNumber));
         
     | 
| 
       169 
163 
     | 
    
         
             
                }
         
     | 
| 
      
 164 
     | 
    
         
            +
                closeMainPopup();
         
     | 
| 
       170 
165 
     | 
    
         
             
              };
         
     | 
| 
       171 
166 
     | 
    
         
             
              return /*#__PURE__*/_jsx(CustomSelectTool, {
         
     | 
| 
       172 
167 
     | 
    
         
             
                options: typographyOptions,
         
     | 
| 
         @@ -14,6 +14,7 @@ import MiniColorPicker from "./MiniColorPicker"; 
     | 
|
| 
       14 
14 
     | 
    
         
             
            import SelectAlignment from "./SelectAlignment";
         
     | 
| 
       15 
15 
     | 
    
         
             
            import SelectFontSize from "./SelectFontSize";
         
     | 
| 
       16 
16 
     | 
    
         
             
            import InfinityAITool from "./InfinityAITool";
         
     | 
| 
      
 17 
     | 
    
         
            +
            import { viewSlateSelection } from "../../../utils/helper";
         
     | 
| 
       17 
18 
     | 
    
         
             
            import { jsx as _jsx } from "react/jsx-runtime";
         
     | 
| 
       18 
19 
     | 
    
         
             
            import { jsxs as _jsxs } from "react/jsx-runtime";
         
     | 
| 
       19 
20 
     | 
    
         
             
            const DEFAULT_COLOR = {
         
     | 
| 
         @@ -60,13 +61,15 @@ const MiniTextFormat = props => { 
     | 
|
| 
       60 
61 
     | 
    
         
             
                      className: "verticalLine"
         
     | 
| 
       61 
62 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(SelectList, {
         
     | 
| 
       62 
63 
     | 
    
         
             
                      classes: classes,
         
     | 
| 
       63 
     | 
    
         
            -
                      editor: editor
         
     | 
| 
      
 64 
     | 
    
         
            +
                      editor: editor,
         
     | 
| 
      
 65 
     | 
    
         
            +
                      closeMainPopup: closeMainPopup
         
     | 
| 
       64 
66 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx("div", {
         
     | 
| 
       65 
67 
     | 
    
         
             
                      className: "verticalLine mr-1"
         
     | 
| 
       66 
68 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(SelectAlignment, {
         
     | 
| 
       67 
69 
     | 
    
         
             
                      fontAlign: fontAlign,
         
     | 
| 
       68 
70 
     | 
    
         
             
                      classes: classes,
         
     | 
| 
       69 
     | 
    
         
            -
                      editor: editor
         
     | 
| 
      
 71 
     | 
    
         
            +
                      editor: editor,
         
     | 
| 
      
 72 
     | 
    
         
            +
                      closeMainPopup: closeMainPopup
         
     | 
| 
       70 
73 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx("div", {
         
     | 
| 
       71 
74 
     | 
    
         
             
                      className: "verticalLine mr-1"
         
     | 
| 
       72 
75 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(SelectFontSize, {
         
     | 
| 
         @@ -98,7 +101,10 @@ const MiniTextFormat = props => { 
     | 
|
| 
       98 
101 
     | 
    
         
             
                      editor: editor,
         
     | 
| 
       99 
102 
     | 
    
         
             
                      customProps: customProps
         
     | 
| 
       100 
103 
     | 
    
         
             
                    }, link.id), /*#__PURE__*/_jsx(IconButton, {
         
     | 
| 
       101 
     | 
    
         
            -
                      onClick: e =>  
     | 
| 
      
 104 
     | 
    
         
            +
                      onClick: e => {
         
     | 
| 
      
 105 
     | 
    
         
            +
                        viewSlateSelection();
         
     | 
| 
      
 106 
     | 
    
         
            +
                        setAnchorEl(document.getElementById("mini-text-editor-wrapper"));
         
     | 
| 
      
 107 
     | 
    
         
            +
                      },
         
     | 
| 
       102 
108 
     | 
    
         
             
                      className: `textSettingsIcon ${open ? "btnActive" : ""}`,
         
     | 
| 
       103 
109 
     | 
    
         
             
                      children: /*#__PURE__*/_jsx(TextToolIcon, {})
         
     | 
| 
       104 
110 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(Popper, {
         
     | 
| 
         @@ -47,7 +47,7 @@ const TemplateCard = props => { 
     | 
|
| 
       47 
47 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(CardMedia, {
         
     | 
| 
       48 
48 
     | 
    
         
             
                      className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
         
     | 
| 
       49 
49 
     | 
    
         
             
                      component: "div",
         
     | 
| 
       50 
     | 
    
         
            -
                      image: m?.thumbnail,
         
     | 
| 
      
 50 
     | 
    
         
            +
                      image: m?.compressedThum || m?.thumbnail,
         
     | 
| 
       51 
51 
     | 
    
         
             
                      alt: m?.title,
         
     | 
| 
       52 
52 
     | 
    
         
             
                      sx: classes.templateCardMedia
         
     | 
| 
       53 
53 
     | 
    
         
             
                    }), /*#__PURE__*/_jsx(PreviewAndSelect, {
         
     | 
| 
         @@ -14,6 +14,8 @@ import SelectSuperSubscript from "./MiniTextFormat/SelectSuperSubscript"; 
     | 
|
| 
       14 
14 
     | 
    
         
             
            import { ColorResetIcon, TextDefaultStyleIcon } from "../../common/iconListV2";
         
     | 
| 
       15 
15 
     | 
    
         
             
            import FontFamilyAutocomplete from "../FormatTools/FontFamilyAutocomplete";
         
     | 
| 
       16 
16 
     | 
    
         
             
            import { useEditorContext } from "../../hooks/useMouseMove";
         
     | 
| 
      
 17 
     | 
    
         
            +
            import LineSpacing from "../../common/StyleBuilder/fieldTypes/lineSpacing";
         
     | 
| 
      
 18 
     | 
    
         
            +
            import { getPageSettings } from "../../utils/pageSettings";
         
     | 
| 
       17 
19 
     | 
    
         
             
            import { jsx as _jsx } from "react/jsx-runtime";
         
     | 
| 
       18 
20 
     | 
    
         
             
            import { jsxs as _jsxs } from "react/jsx-runtime";
         
     | 
| 
       19 
21 
     | 
    
         
             
            const allTools = toolbarGroups.flat();
         
     | 
| 
         @@ -31,10 +33,18 @@ const TextFormat = props => { 
     | 
|
| 
       31 
33 
     | 
    
         
             
              const [anchorEl, setAnchorEl] = useState(null);
         
     | 
| 
       32 
34 
     | 
    
         
             
              const [type, setType] = useState(null);
         
     | 
| 
       33 
35 
     | 
    
         
             
              const open = Boolean(anchorEl);
         
     | 
| 
      
 36 
     | 
    
         
            +
              const {
         
     | 
| 
      
 37 
     | 
    
         
            +
                element: pageSt
         
     | 
| 
      
 38 
     | 
    
         
            +
              } = getPageSettings(editor) || {};
         
     | 
| 
      
 39 
     | 
    
         
            +
              const pageSettingLine = pageSt?.pageProps?.lineHeight;
         
     | 
| 
       34 
40 
     | 
    
         
             
              const {
         
     | 
| 
       35 
41 
     | 
    
         
             
                fontFamilies,
         
     | 
| 
       36 
42 
     | 
    
         
             
                theme
         
     | 
| 
       37 
43 
     | 
    
         
             
              } = useEditorContext();
         
     | 
| 
      
 44 
     | 
    
         
            +
              const {
         
     | 
| 
      
 45 
     | 
    
         
            +
                activeBreakPoint
         
     | 
| 
      
 46 
     | 
    
         
            +
              } = useEditorContext();
         
     | 
| 
      
 47 
     | 
    
         
            +
              const breakpoint = activeBreakPoint === "" ? "lg" : activeBreakPoint;
         
     | 
| 
       38 
48 
     | 
    
         
             
              const fontWeight = allTools.find(f => f.format === "fontWeight");
         
     | 
| 
       39 
49 
     | 
    
         
             
              const fontStyle = allTools.filter(f => f.type === "mark" && f.format !== "strikethrough" && f.format !== "superscript" && f.format !== "subscript");
         
     | 
| 
       40 
50 
     | 
    
         
             
              const fontAlign = allTools.filter(f => f.format?.indexOf("align") >= 0);
         
     | 
| 
         @@ -51,6 +61,8 @@ const TextFormat = props => { 
     | 
|
| 
       51 
61 
     | 
    
         
             
                color: "",
         
     | 
| 
       52 
62 
     | 
    
         
             
                bgColor: ""
         
     | 
| 
       53 
63 
     | 
    
         
             
              };
         
     | 
| 
      
 64 
     | 
    
         
            +
              let lineSpacingValue = activeMark(editor, 'lineHeight');
         
     | 
| 
      
 65 
     | 
    
         
            +
              lineSpacingValue = lineSpacingValue?.[breakpoint] !== undefined ? lineSpacingValue : pageSettingLine;
         
     | 
| 
       54 
66 
     | 
    
         
             
              const handleColorPicker = type => e => {
         
     | 
| 
       55 
67 
     | 
    
         
             
                setType(type);
         
     | 
| 
       56 
68 
     | 
    
         
             
                setAnchorEl(e.currentTarget);
         
     | 
| 
         @@ -91,6 +103,13 @@ const TextFormat = props => { 
     | 
|
| 
       91 
103 
     | 
    
         
             
                  value
         
     | 
| 
       92 
104 
     | 
    
         
             
                });
         
     | 
| 
       93 
105 
     | 
    
         
             
              };
         
     | 
| 
      
 106 
     | 
    
         
            +
              const handleLineSpacing = data => {
         
     | 
| 
      
 107 
     | 
    
         
            +
                const [[format, value]] = Object.entries(data);
         
     | 
| 
      
 108 
     | 
    
         
            +
                addMarkData(editor, {
         
     | 
| 
      
 109 
     | 
    
         
            +
                  format,
         
     | 
| 
      
 110 
     | 
    
         
            +
                  value
         
     | 
| 
      
 111 
     | 
    
         
            +
                });
         
     | 
| 
      
 112 
     | 
    
         
            +
              };
         
     | 
| 
       94 
113 
     | 
    
         
             
              return /*#__PURE__*/_jsxs(Grid, {
         
     | 
| 
       95 
114 
     | 
    
         
             
                container: true,
         
     | 
| 
       96 
115 
     | 
    
         
             
                sx: classes.textFormatWrapper,
         
     | 
| 
         @@ -360,6 +379,32 @@ const TextFormat = props => { 
     | 
|
| 
       360 
379 
     | 
    
         
             
                  xs: 12,
         
     | 
| 
       361 
380 
     | 
    
         
             
                  sx: classes.dividerGrid,
         
     | 
| 
       362 
381 
     | 
    
         
             
                  children: /*#__PURE__*/_jsx(Divider, {})
         
     | 
| 
      
 382 
     | 
    
         
            +
                }), /*#__PURE__*/_jsxs(Grid, {
         
     | 
| 
      
 383 
     | 
    
         
            +
                  item: true,
         
     | 
| 
      
 384 
     | 
    
         
            +
                  xs: 12,
         
     | 
| 
      
 385 
     | 
    
         
            +
                  children: [/*#__PURE__*/_jsx(Typography, {
         
     | 
| 
      
 386 
     | 
    
         
            +
                    variant: "body1",
         
     | 
| 
      
 387 
     | 
    
         
            +
                    color: "primary",
         
     | 
| 
      
 388 
     | 
    
         
            +
                    sx: classes.typoLabel,
         
     | 
| 
      
 389 
     | 
    
         
            +
                    children: "Line Spacing"
         
     | 
| 
      
 390 
     | 
    
         
            +
                  }), /*#__PURE__*/_jsx(Grid, {
         
     | 
| 
      
 391 
     | 
    
         
            +
                    item: true,
         
     | 
| 
      
 392 
     | 
    
         
            +
                    xs: 12,
         
     | 
| 
      
 393 
     | 
    
         
            +
                    className: "typo-icons",
         
     | 
| 
      
 394 
     | 
    
         
            +
                    sx: classes.evenSpace,
         
     | 
| 
      
 395 
     | 
    
         
            +
                    children: /*#__PURE__*/_jsx(LineSpacing, {
         
     | 
| 
      
 396 
     | 
    
         
            +
                      value: lineSpacingValue,
         
     | 
| 
      
 397 
     | 
    
         
            +
                      onChange: handleLineSpacing,
         
     | 
| 
      
 398 
     | 
    
         
            +
                      data: {
         
     | 
| 
      
 399 
     | 
    
         
            +
                        key: 'lineHeight'
         
     | 
| 
      
 400 
     | 
    
         
            +
                      }
         
     | 
| 
      
 401 
     | 
    
         
            +
                    })
         
     | 
| 
      
 402 
     | 
    
         
            +
                  })]
         
     | 
| 
      
 403 
     | 
    
         
            +
                }), /*#__PURE__*/_jsx(Grid, {
         
     | 
| 
      
 404 
     | 
    
         
            +
                  item: true,
         
     | 
| 
      
 405 
     | 
    
         
            +
                  xs: 12,
         
     | 
| 
      
 406 
     | 
    
         
            +
                  sx: classes.dividerGrid,
         
     | 
| 
      
 407 
     | 
    
         
            +
                  children: /*#__PURE__*/_jsx(Divider, {})
         
     | 
| 
       363 
408 
     | 
    
         
             
                }), /*#__PURE__*/_jsx(Grid, {
         
     | 
| 
       364 
409 
     | 
    
         
             
                  item: true,
         
     | 
| 
       365 
410 
     | 
    
         
             
                  xs: 12,
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import React, { useEffect, useState } from "react";
         
     | 
| 
       2 
     | 
    
         
            -
            import { Popper, Paper, ClickAwayListener } from "@mui/material";
         
     | 
| 
      
 1 
     | 
    
         
            +
            import React, { useCallback, useEffect, useState } from "react";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { Popper, Fade, Paper, ClickAwayListener } from "@mui/material";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { Editor, Range, Transforms } from "slate";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { ReactEditor, useSlate } from "slate-react";
         
     | 
| 
       5 
5 
     | 
    
         
             
            import useDrag from "../../hooks/useDrag";
         
     | 
| 
         @@ -9,19 +9,18 @@ import { useEditorContext } from "../../hooks/useMouseMove"; 
     | 
|
| 
       9 
9 
     | 
    
         
             
            import usePopupStyles from "../PopupTool/PopupToolStyle";
         
     | 
| 
       10 
10 
     | 
    
         
             
            import useEditorScroll from "../../hooks/useEditorScroll";
         
     | 
| 
       11 
11 
     | 
    
         
             
            import { isCarouselSelected } from "../../helper";
         
     | 
| 
      
 12 
     | 
    
         
            +
            import { hideSlateSelection } from "../../utils/helper";
         
     | 
| 
       12 
13 
     | 
    
         
             
            import { jsx as _jsx } from "react/jsx-runtime";
         
     | 
| 
       13 
14 
     | 
    
         
             
            const PopupTool = props => {
         
     | 
| 
       14 
15 
     | 
    
         
             
              const {
         
     | 
| 
       15 
16 
     | 
    
         
             
                theme,
         
     | 
| 
       16 
     | 
    
         
            -
                setIsTextSelected,
         
     | 
| 
       17 
17 
     | 
    
         
             
                customProps,
         
     | 
| 
       18 
18 
     | 
    
         
             
                editorWrapper
         
     | 
| 
       19 
19 
     | 
    
         
             
              } = props;
         
     | 
| 
       20 
20 
     | 
    
         
             
              const classes = usePopupStyles(theme);
         
     | 
| 
       21 
21 
     | 
    
         
             
              const {
         
     | 
| 
       22 
22 
     | 
    
         
             
                setPopupType,
         
     | 
| 
       23 
     | 
    
         
            -
                openAI 
     | 
| 
       24 
     | 
    
         
            -
                selectedElement
         
     | 
| 
      
 23 
     | 
    
         
            +
                openAI
         
     | 
| 
       25 
24 
     | 
    
         
             
              } = useEditorContext();
         
     | 
| 
       26 
25 
     | 
    
         
             
              const [anchorEl, setAnchorEl] = useState(null);
         
     | 
| 
       27 
26 
     | 
    
         
             
              const [open, setOpen] = useState(false);
         
     | 
| 
         @@ -32,10 +31,17 @@ const PopupTool = props => { 
     | 
|
| 
       32 
31 
     | 
    
         
             
              const [event] = useDrag(anchorEl);
         
     | 
| 
       33 
32 
     | 
    
         
             
              const id = open ? "popup-edit-tool" : "";
         
     | 
| 
       34 
33 
     | 
    
         
             
              const [size] = useWindowResize();
         
     | 
| 
       35 
     | 
    
         
            -
              const  
     | 
| 
      
 34 
     | 
    
         
            +
              const {
         
     | 
| 
      
 35 
     | 
    
         
            +
                selectedElement
         
     | 
| 
      
 36 
     | 
    
         
            +
              } = useEditorContext();
         
     | 
| 
      
 37 
     | 
    
         
            +
              console.log("Editor debug ====>", event, open, anchorEl, selection);
         
     | 
| 
      
 38 
     | 
    
         
            +
              const updateAnchorEl = useCallback(() => {
         
     | 
| 
       36 
39 
     | 
    
         
             
                try {
         
     | 
| 
      
 40 
     | 
    
         
            +
                  const {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    selection
         
     | 
| 
      
 42 
     | 
    
         
            +
                  } = editor;
         
     | 
| 
       37 
43 
     | 
    
         
             
                  const isHavingSelection = selection && !Range.isCollapsed(selection);
         
     | 
| 
       38 
     | 
    
         
            -
                  if (isHavingSelection 
     | 
| 
      
 44 
     | 
    
         
            +
                  if (isHavingSelection) {
         
     | 
| 
       39 
45 
     | 
    
         
             
                    const domRange = ReactEditor.toDOMRange(editor, editor.selection);
         
     | 
| 
       40 
46 
     | 
    
         
             
                    const editorContainer = document.querySelector("#slate-wrapper-scroll-container")?.getBoundingClientRect();
         
     | 
| 
       41 
47 
     | 
    
         
             
                    const rect = domRange.getBoundingClientRect();
         
     | 
| 
         @@ -44,21 +50,16 @@ const PopupTool = props => { 
     | 
|
| 
       44 
50 
     | 
    
         
             
                      rect.y = -500; // hide the popper
         
     | 
| 
       45 
51 
     | 
    
         
             
                    }
         
     | 
| 
       46 
52 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                     
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                     
     | 
| 
       52 
     | 
    
         
            -
                    document.body.appendChild(anchor);
         
     | 
| 
       53 
     | 
    
         
            -
                    if (!anchorEl || isScroll === "scroll") {
         
     | 
| 
       54 
     | 
    
         
            -
                      setAnchorEl(anchor);
         
     | 
| 
       55 
     | 
    
         
            -
                      setOpen(true);
         
     | 
| 
       56 
     | 
    
         
            -
                    }
         
     | 
| 
      
 53 
     | 
    
         
            +
                    setAnchorEl({
         
     | 
| 
      
 54 
     | 
    
         
            +
                      clientWidth: rect.width,
         
     | 
| 
      
 55 
     | 
    
         
            +
                      clientHeight: rect.height,
         
     | 
| 
      
 56 
     | 
    
         
            +
                      getBoundingClientRect: () => rect
         
     | 
| 
      
 57 
     | 
    
         
            +
                    });
         
     | 
| 
       57 
58 
     | 
    
         
             
                  }
         
     | 
| 
       58 
59 
     | 
    
         
             
                } catch (err) {
         
     | 
| 
       59 
60 
     | 
    
         
             
                  console.log(err);
         
     | 
| 
       60 
61 
     | 
    
         
             
                }
         
     | 
| 
       61 
     | 
    
         
            -
              };
         
     | 
| 
      
 62 
     | 
    
         
            +
              }, [editor?.selection]);
         
     | 
| 
       62 
63 
     | 
    
         
             
              useEditorScroll(editorWrapper, updateAnchorEl);
         
     | 
| 
       63 
64 
     | 
    
         
             
              useEffect(() => {
         
     | 
| 
       64 
65 
     | 
    
         
             
                const userStoppedSelection = size?.device === "xs" ? true : event === "end"; // for mobile, when user starts the selection, we are gonna show the popup tool
         
     | 
| 
         @@ -73,21 +74,27 @@ const PopupTool = props => { 
     | 
|
| 
       73 
74 
     | 
    
         
             
                  if (!isCarouselEdit) {
         
     | 
| 
       74 
75 
     | 
    
         
             
                    setOpen(true);
         
     | 
| 
       75 
76 
     | 
    
         
             
                    setPopupType("textFormat");
         
     | 
| 
       76 
     | 
    
         
            -
                    setIsTextSelected(true);
         
     | 
| 
      
 77 
     | 
    
         
            +
                    // setIsTextSelected(true);
         
     | 
| 
       77 
78 
     | 
    
         
             
                  }
         
     | 
| 
       78 
79 
     | 
    
         
             
                } else if (!anchorEl) {
         
     | 
| 
       79 
80 
     | 
    
         
             
                  setOpen(false);
         
     | 
| 
       80 
81 
     | 
    
         
             
                  setPopupType("");
         
     | 
| 
       81 
     | 
    
         
            -
                  setIsTextSelected(false);
         
     | 
| 
      
 82 
     | 
    
         
            +
                  // setIsTextSelected(false);
         
     | 
| 
       82 
83 
     | 
    
         
             
                }
         
     | 
| 
       83 
84 
     | 
    
         
             
              }, [event, anchorEl]);
         
     | 
| 
       84 
85 
     | 
    
         
             
              useEffect(() => {
         
     | 
| 
       85 
     | 
    
         
            -
                if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "" 
     | 
| 
      
 86 
     | 
    
         
            +
                if (!selection || Range.isCollapsed(selection) || Editor.string(editor, selection) === "") {
         
     | 
| 
       86 
87 
     | 
    
         
             
                  setAnchorEl(null);
         
     | 
| 
       87 
88 
     | 
    
         
             
                } else {
         
     | 
| 
       88 
89 
     | 
    
         
             
                  updateAnchorEl();
         
     | 
| 
      
 90 
     | 
    
         
            +
                  hideSlateSelection(); // removes slate selection background, when there is no selection
         
     | 
| 
      
 91 
     | 
    
         
            +
                }
         
     | 
| 
      
 92 
     | 
    
         
            +
              }, [selection]);
         
     | 
| 
      
 93 
     | 
    
         
            +
              useEffect(() => {
         
     | 
| 
      
 94 
     | 
    
         
            +
                if (selectedElement?.enable === 1) {
         
     | 
| 
      
 95 
     | 
    
         
            +
                  setAnchorEl(null);
         
     | 
| 
       89 
96 
     | 
    
         
             
                }
         
     | 
| 
       90 
     | 
    
         
            -
              }, [selection,  
     | 
| 
      
 97 
     | 
    
         
            +
              }, [selection, selectedElement?.path, selectedElement?.enable]);
         
     | 
| 
       91 
98 
     | 
    
         
             
              const handleClose = () => {
         
     | 
| 
       92 
99 
     | 
    
         
             
                // setAnchorEl(null);
         
     | 
| 
       93 
100 
     | 
    
         
             
                setOpen(false);
         
     | 
| 
         @@ -113,18 +120,24 @@ const PopupTool = props => { 
     | 
|
| 
       113 
120 
     | 
    
         
             
                  id: id,
         
     | 
| 
       114 
121 
     | 
    
         
             
                  open: open,
         
     | 
| 
       115 
122 
     | 
    
         
             
                  anchorEl: anchorEl,
         
     | 
| 
      
 123 
     | 
    
         
            +
                  transition: true,
         
     | 
| 
       116 
124 
     | 
    
         
             
                  sx: classes.popupWrapper,
         
     | 
| 
       117 
125 
     | 
    
         
             
                  placement: "top-start",
         
     | 
| 
       118 
     | 
    
         
            -
                  children:  
     | 
| 
       119 
     | 
    
         
            -
                     
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                     
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
                       
     | 
| 
       127 
     | 
    
         
            -
                       
     | 
| 
      
 126 
     | 
    
         
            +
                  children: ({
         
     | 
| 
      
 127 
     | 
    
         
            +
                    TransitionProps
         
     | 
| 
      
 128 
     | 
    
         
            +
                  }) => /*#__PURE__*/_jsx(Fade, {
         
     | 
| 
      
 129 
     | 
    
         
            +
                    ...TransitionProps,
         
     | 
| 
      
 130 
     | 
    
         
            +
                    children: /*#__PURE__*/_jsx(Paper, {
         
     | 
| 
      
 131 
     | 
    
         
            +
                      style: {
         
     | 
| 
      
 132 
     | 
    
         
            +
                        borderRadius: "6px",
         
     | 
| 
      
 133 
     | 
    
         
            +
                        border: "1px solid #8360FD"
         
     | 
| 
      
 134 
     | 
    
         
            +
                      },
         
     | 
| 
      
 135 
     | 
    
         
            +
                      children: /*#__PURE__*/_jsx(MiniTextFormat, {
         
     | 
| 
      
 136 
     | 
    
         
            +
                        editor: editor,
         
     | 
| 
      
 137 
     | 
    
         
            +
                        classes: classes,
         
     | 
| 
      
 138 
     | 
    
         
            +
                        closeMainPopup: handleClose,
         
     | 
| 
      
 139 
     | 
    
         
            +
                        customProps: customProps
         
     | 
| 
      
 140 
     | 
    
         
            +
                      })
         
     | 
| 
       128 
141 
     | 
    
         
             
                    })
         
     | 
| 
       129 
142 
     | 
    
         
             
                  })
         
     | 
| 
       130 
143 
     | 
    
         
             
                })
         
     | 
| 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            const  
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            export const  
     | 
| 
       5 
     | 
    
         
            -
            const  
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            export const defaultFonts = [
         
     | 
| 
      
 2 
     | 
    
         
            +
            // "EB Garamond",
         
     | 
| 
      
 3 
     | 
    
         
            +
            "Anton", "DM Serif Text", "Libre Baskerville", "Montserrat", "Open Sans", "Public Sans", "Raleway", "Space Mono", "Great Vibes", "Zeyada", "Allura", "Pinyon Script", "Dancing Script", "Gaegu", "Kite One", "Merriweather"];
         
     | 
| 
      
 4 
     | 
    
         
            +
            export const otherFonts = ["PoppinsRegular", "PoppinsBold", "Monaco", "Qwitcher Grypen", "Bulgarian Garamond", "Redacted Script", "Herr Von Muellerhoff", "Dawning of a New Day", "Coming Soon", "Engagement", "Ingrid Darling", "La Belle Aurore", "Mea Culpa", "The Girl Next Door", "Helvetica", "Georgia", "Times New Roman", "Courier New", "Impact"];
         
     | 
| 
      
 5 
     | 
    
         
            +
            export const googleFontList = ["Roboto", "Noto Sans JP", "Poppins", "Lato", "Inter", "Roboto Condensed", "Roboto Mono", "Oswald", "Noto Sans", "Nunito", "Nunito Sans", "Ubuntu", "Rubik", "Playfair Display", "Noto Sans KR", "Roboto Slab", "PT Sans", "Kanit", "Work Sans", "Lora", "DM Sans", "Mulish", "Quicksand", "Fira Sans", "Noto Sans TC", "Inconsolata", "Barlow", "Manrope", "IBM Plex Sans", "PT Serif", "Karla", "Titillium Web", "Heebo", "Noto Serif", "Nanum Gothic", "Noto Color Emoji", "Agdasima", "Bebas Neue", "Libre Franklin", "Mukta", "Outfit", "Josefin Sans", "Source Code Pro", "Jost", "Space Grotesk", "Hind Siliguri", "Arimo", "Cabin", "Barlow Condensed", "Dosis", "Fira Sans Condensed", "Bitter", "Archivo", "Figtree", "Noto Serif JP", "PT Sans Narrow", "Abel", "Noto Sans SC",
         
     | 
| 
      
 6 
     | 
    
         
            +
            // "Source Sans 3",
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Hind",
         
     | 
| 
      
 8 
     | 
    
         
            +
            // "Exo 2",
         
     | 
| 
      
 9 
     | 
    
         
            +
            "Teko", "Oxygen", "Cairo", "Crimson Text", "Plus Jakarta Sans", "Overpass", "Pacifico", "Prompt", "Red Hat Display", "Varela Round", "Cormorant Garamond", "Assistant", "Comfortaa", "Lexend", "Signika Negative",
         
     | 
| 
      
 10 
     | 
    
         
            +
            // "M PLUS Rounded 1c",
         
     | 
| 
      
 11 
     | 
    
         
            +
            "Fjalla One", "Caveat", "IBM Plex Mono", "Arvo", "Lobster", "Schibsted Grotesk", "Chakra Petch", "Maven Pro", "Sora", "Kalam", "Onest", "Space Grotesk", "Outfit", 'Titillium Web', ...defaultFonts];
         
     | 
| 
         @@ -1,11 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { useEffect 
     | 
| 
      
 1 
     | 
    
         
            +
            import { useEffect } from "react";
         
     | 
| 
       2 
2 
     | 
    
         
             
            import WebFont from "webfontloader";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { useEditorContext } from "../../hooks/useMouseMove";
         
     | 
| 
       4 
     | 
    
         
            -
            import { googleFontList } from "./FontList";
         
     | 
| 
       5 
     | 
    
         
            -
            import CircularProgress from "@mui/material/CircularProgress";
         
     | 
| 
       6 
     | 
    
         
            -
            import Box from "@mui/material/Box";
         
     | 
| 
       7 
     | 
    
         
            -
            import { jsx as _jsx } from "react/jsx-runtime";
         
     | 
| 
       8 
     | 
    
         
            -
            import { Fragment as _Fragment } from "react/jsx-runtime";
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { defaultFonts, googleFontList, otherFonts } from "./FontList";
         
     | 
| 
       9 
5 
     | 
    
         
             
            const FontLoader = props => {
         
     | 
| 
       10 
6 
     | 
    
         
             
              const {
         
     | 
| 
       11 
7 
     | 
    
         
             
                otherProps,
         
     | 
| 
         @@ -14,74 +10,69 @@ const FontLoader = props => { 
     | 
|
| 
       14 
10 
     | 
    
         
             
              const {
         
     | 
| 
       15 
11 
     | 
    
         
             
                setFontFamilies
         
     | 
| 
       16 
12 
     | 
    
         
             
              } = useEditorContext();
         
     | 
| 
       17 
     | 
    
         
            -
              const [loading, setLoading] = useState(true);
         
     | 
| 
       18 
13 
     | 
    
         
             
              const loadFontsInBatches = (families, batchSize = 5, maxRetries = 3) => {
         
     | 
| 
       19 
14 
     | 
    
         
             
                let currentIndex = 0;
         
     | 
| 
       20 
15 
     | 
    
         
             
                let retryCount = 0;
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
       22 
     | 
    
         
            -
                   
     | 
| 
       23 
     | 
    
         
            -
                     
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                       
     | 
| 
       36 
     | 
    
         
            -
                       
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
                function loadNextBatch() {
         
     | 
| 
      
 17 
     | 
    
         
            +
                  if (currentIndex >= families?.length) {
         
     | 
| 
      
 18 
     | 
    
         
            +
                    // console.log("All fonts have been loaded");
         
     | 
| 
      
 19 
     | 
    
         
            +
                    return;
         
     | 
| 
      
 20 
     | 
    
         
            +
                  }
         
     | 
| 
      
 21 
     | 
    
         
            +
                  const batch = families?.slice(currentIndex, currentIndex + batchSize);
         
     | 
| 
      
 22 
     | 
    
         
            +
                  const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
         
     | 
| 
      
 23 
     | 
    
         
            +
                  WebFont.load({
         
     | 
| 
      
 24 
     | 
    
         
            +
                    google: {
         
     | 
| 
      
 25 
     | 
    
         
            +
                      families: [...batchWithWeights]
         
     | 
| 
      
 26 
     | 
    
         
            +
                    },
         
     | 
| 
      
 27 
     | 
    
         
            +
                    classes: false,
         
     | 
| 
      
 28 
     | 
    
         
            +
                    timeout: 2000,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    active: () => {
         
     | 
| 
      
 30 
     | 
    
         
            +
                      // console.log(`Fonts loaded successfully: ${batch}`);
         
     | 
| 
      
 31 
     | 
    
         
            +
                      currentIndex += batchSize;
         
     | 
| 
      
 32 
     | 
    
         
            +
                      retryCount = 0; // Reset retry count for the next batch
         
     | 
| 
      
 33 
     | 
    
         
            +
                      loadNextBatch();
         
     | 
| 
      
 34 
     | 
    
         
            +
                    },
         
     | 
| 
      
 35 
     | 
    
         
            +
                    inactive: () => {
         
     | 
| 
      
 36 
     | 
    
         
            +
                      // console.log(`Font loading failed for: ${batch}`);
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                      if (retryCount < maxRetries) {
         
     | 
| 
      
 39 
     | 
    
         
            +
                        retryCount++;
         
     | 
| 
      
 40 
     | 
    
         
            +
                        // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
         
     | 
| 
      
 41 
     | 
    
         
            +
                        // Retry loading the same batch
         
     | 
| 
      
 42 
     | 
    
         
            +
                        loadNextBatch();
         
     | 
| 
      
 43 
     | 
    
         
            +
                      } else {
         
     | 
| 
      
 44 
     | 
    
         
            +
                        // console.log(
         
     | 
| 
      
 45 
     | 
    
         
            +
                        //   `Max retries reached for batch: ${batch}. Moving to the next batch.`
         
     | 
| 
      
 46 
     | 
    
         
            +
                        // );
         
     | 
| 
       38 
47 
     | 
    
         
             
                        currentIndex += batchSize;
         
     | 
| 
       39 
48 
     | 
    
         
             
                        retryCount = 0; // Reset retry count for the next batch
         
     | 
| 
       40 
49 
     | 
    
         
             
                        loadNextBatch();
         
     | 
| 
       41 
     | 
    
         
            -
                      },
         
     | 
| 
       42 
     | 
    
         
            -
                      inactive: () => {
         
     | 
| 
       43 
     | 
    
         
            -
                        // console.log(`Font loading failed for: ${batch}`);
         
     | 
| 
       44 
     | 
    
         
            -
                        if (retryCount < maxRetries) {
         
     | 
| 
       45 
     | 
    
         
            -
                          retryCount++;
         
     | 
| 
       46 
     | 
    
         
            -
                          // console.log(`Retrying batch (${retryCount}/${maxRetries})...`);
         
     | 
| 
       47 
     | 
    
         
            -
                          // Retry loading the same batch
         
     | 
| 
       48 
     | 
    
         
            -
                          loadNextBatch();
         
     | 
| 
       49 
     | 
    
         
            -
                        } else {
         
     | 
| 
       50 
     | 
    
         
            -
                          // console.log(
         
     | 
| 
       51 
     | 
    
         
            -
                          //   `Max retries reached for batch: ${batch}. Moving to the next batch.`
         
     | 
| 
       52 
     | 
    
         
            -
                          // );
         
     | 
| 
       53 
     | 
    
         
            -
                          currentIndex += batchSize;
         
     | 
| 
       54 
     | 
    
         
            -
                          retryCount = 0;
         
     | 
| 
       55 
     | 
    
         
            -
                          loadNextBatch();
         
     | 
| 
       56 
     | 
    
         
            -
                        }
         
     | 
| 
       57 
50 
     | 
    
         
             
                      }
         
     | 
| 
       58 
     | 
    
         
            -
                    } 
     | 
| 
       59 
     | 
    
         
            -
                  } 
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                  }
         
     | 
| 
       62 
     | 
    
         
            -
                };
         
     | 
| 
      
 51 
     | 
    
         
            +
                    }
         
     | 
| 
      
 52 
     | 
    
         
            +
                  });
         
     | 
| 
      
 53 
     | 
    
         
            +
                }
         
     | 
| 
       63 
54 
     | 
    
         
             
                loadNextBatch();
         
     | 
| 
       64 
55 
     | 
    
         
             
              };
         
     | 
| 
       65 
56 
     | 
    
         
             
              useEffect(() => {
         
     | 
| 
       66 
     | 
    
         
            -
                let families = [... 
     | 
| 
      
 57 
     | 
    
         
            +
                let families = [...otherFonts, ...defaultFonts];
         
     | 
| 
       67 
58 
     | 
    
         
             
                if (!readOnly) {
         
     | 
| 
       68 
59 
     | 
    
         
             
                  otherProps?.services("listGoogleFont", []).then(data => {
         
     | 
| 
       69 
     | 
    
         
            -
                    families = [...(data?.data || [])];
         
     | 
| 
      
 60 
     | 
    
         
            +
                    families = [...families, ...(data?.data || [])];
         
     | 
| 
      
 61 
     | 
    
         
            +
                    const filteredfamilies = families?.filter(font => !font?.includes("Material"));
         
     | 
| 
       70 
62 
     | 
    
         
             
                    setFontFamilies({
         
     | 
| 
       71 
63 
     | 
    
         
             
                      id: 1,
         
     | 
| 
       72 
64 
     | 
    
         
             
                      format: "fontFamily",
         
     | 
| 
       73 
65 
     | 
    
         
             
                      type: "fontfamilydropdown",
         
     | 
| 
       74 
     | 
    
         
            -
                      options:  
     | 
| 
      
 66 
     | 
    
         
            +
                      options: filteredfamilies || []
         
     | 
| 
       75 
67 
     | 
    
         
             
                    });
         
     | 
| 
       76 
68 
     | 
    
         
             
                    loadFontsInBatches(families);
         
     | 
| 
       77 
69 
     | 
    
         
             
                  }).catch(err => {
         
     | 
| 
       78 
70 
     | 
    
         
             
                    // console.log(err);
         
     | 
| 
       79 
     | 
    
         
            -
                    setLoading(false);
         
     | 
| 
       80 
71 
     | 
    
         
             
                  });
         
     | 
| 
       81 
72 
     | 
    
         
             
                } else {
         
     | 
| 
       82 
73 
     | 
    
         
             
                  function correctFontArray(fontString) {
         
     | 
| 
       83 
     | 
    
         
            -
                    let fontsArray = fontString 
     | 
| 
       84 
     | 
    
         
            -
                    let cleanedFontsArray = [...new Set(fontsArray 
     | 
| 
      
 74 
     | 
    
         
            +
                    let fontsArray = fontString.split(",");
         
     | 
| 
      
 75 
     | 
    
         
            +
                    let cleanedFontsArray = [...new Set(fontsArray.map(font => font.trim()))];
         
     | 
| 
       85 
76 
     | 
    
         
             
                    return cleanedFontsArray;
         
     | 
| 
       86 
77 
     | 
    
         
             
                  }
         
     | 
| 
       87 
78 
     | 
    
         
             
                  function sanitizeFontFamily(fontFamily) {
         
     | 
| 
         @@ -97,32 +88,11 @@ const FontLoader = props => { 
     | 
|
| 
       97 
88 
     | 
    
         
             
                  let families = Array.from(fontSet);
         
     | 
| 
       98 
89 
     | 
    
         
             
                  families = correctFontArray(families.join(", "));
         
     | 
| 
       99 
90 
     | 
    
         
             
                  families = families?.map(font => font?.replace(/\"/g, ""));
         
     | 
| 
       100 
     | 
    
         
            -
                  families = families?.map(font => font?.replace(", sans-serif", ""));
         
     | 
| 
       101 
     | 
    
         
            -
                  families = families 
     | 
| 
      
 91 
     | 
    
         
            +
                  families = families?.map(font => font?.replace(", sans-serif", "")); //This is temporary fix for patch
         
     | 
| 
      
 92 
     | 
    
         
            +
                  families = families.filter(font => googleFontList.includes(font));
         
     | 
| 
       102 
93 
     | 
    
         
             
                  loadFontsInBatches(families);
         
     | 
| 
       103 
94 
     | 
    
         
             
                }
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                // Set timeout to hide loader after 5 seconds
         
     | 
| 
       106 
     | 
    
         
            -
                const timeoutId = setTimeout(() => {
         
     | 
| 
       107 
     | 
    
         
            -
                  setLoading(false);
         
     | 
| 
       108 
     | 
    
         
            -
                }, 5000);
         
     | 
| 
       109 
     | 
    
         
            -
                return () => clearTimeout(timeoutId);
         
     | 
| 
       110 
95 
     | 
    
         
             
              }, []);
         
     | 
| 
       111 
     | 
    
         
            -
              return  
     | 
| 
       112 
     | 
    
         
            -
                children: loading ? /*#__PURE__*/_jsx(Box, {
         
     | 
| 
       113 
     | 
    
         
            -
                  sx: {
         
     | 
| 
       114 
     | 
    
         
            -
                    position: "absolute",
         
     | 
| 
       115 
     | 
    
         
            -
                    top: 0,
         
     | 
| 
       116 
     | 
    
         
            -
                    left: 0,
         
     | 
| 
       117 
     | 
    
         
            -
                    right: 0,
         
     | 
| 
       118 
     | 
    
         
            -
                    bottom: 0,
         
     | 
| 
       119 
     | 
    
         
            -
                    zIndex: 99999,
         
     | 
| 
       120 
     | 
    
         
            -
                    display: "flex",
         
     | 
| 
       121 
     | 
    
         
            -
                    justifyContent: "center",
         
     | 
| 
       122 
     | 
    
         
            -
                    alignItems: "center"
         
     | 
| 
       123 
     | 
    
         
            -
                  },
         
     | 
| 
       124 
     | 
    
         
            -
                  children: /*#__PURE__*/_jsx(CircularProgress, {})
         
     | 
| 
       125 
     | 
    
         
            -
                }) : null
         
     | 
| 
       126 
     | 
    
         
            -
              });
         
     | 
| 
      
 96 
     | 
    
         
            +
              return null;
         
     | 
| 
       127 
97 
     | 
    
         
             
            };
         
     | 
| 
       128 
98 
     | 
    
         
             
            export default FontLoader;
         
     |