@flozy/editor 9.8.1 → 9.8.3
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/ChatEditor.js +19 -26
- package/dist/Editor/CommonEditor.js +25 -139
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +7 -11
- package/dist/Editor/Elements/AI/AIInput.js +3 -5
- package/dist/Editor/Elements/AI/CustomSelect.js +5 -9
- package/dist/Editor/Elements/AI/PopoverAIInput.js +5 -15
- package/dist/Editor/Elements/Accordion/Accordion.js +3 -4
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +1 -4
- package/dist/Editor/Elements/Accordion/AccordionButton.js +2 -6
- package/dist/Editor/Elements/Accordion/AccordionTitlePopup.js +1 -4
- package/dist/Editor/Elements/AppHeader/AppHeader.js +3 -3
- package/dist/Editor/Elements/AppHeader/AppHeaderButton.js +2 -6
- package/dist/Editor/Elements/AppHeader/AppHeaderPopup.js +1 -4
- package/dist/Editor/Elements/Attachments/AttachmentsButton.js +1 -4
- package/dist/Editor/Elements/Button/ButtonPopup.js +1 -4
- package/dist/Editor/Elements/Button/ButtonToolIcon.js +2 -6
- package/dist/Editor/Elements/Button/EditorButton.js +30 -43
- package/dist/Editor/Elements/Carousel/Carousel.js +4 -5
- package/dist/Editor/Elements/Carousel/CarouselButton.js +2 -6
- package/dist/Editor/Elements/Carousel/CarouselItem.js +2 -3
- package/dist/Editor/Elements/ChipText/ChipTextPopup.js +1 -4
- package/dist/Editor/Elements/CodeToText/CodeToText.js +4 -5
- package/dist/Editor/Elements/CodeToText/HtmlContextMenu.js +2 -6
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +14 -60
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +7 -10
- package/dist/Editor/Elements/Color Picker/Styles.js +13 -15
- package/dist/Editor/Elements/Colorbox/ColorboxButton.js +2 -6
- package/dist/Editor/Elements/DataView/DataView.js +2 -5
- package/dist/Editor/Elements/DataView/DataViewButton.js +2 -6
- package/dist/Editor/Elements/DataView/Layouts/ColumnView.js +2 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +6 -21
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/ChooseSort.js +12 -13
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/SortOptions/index.js +4 -7
- package/dist/Editor/Elements/DataView/Layouts/FilterSort/index.js +5 -7
- package/dist/Editor/Elements/DataView/Layouts/FilterView.js +7 -9
- package/dist/Editor/Elements/DataView/Layouts/Options/AddOptions.js +3 -8
- package/dist/Editor/Elements/DataView/Layouts/Options/AddProperty.js +3 -5
- package/dist/Editor/Elements/DataView/Layouts/Options/AllProperties.js +5 -6
- package/dist/Editor/Elements/DataView/Layouts/Options/ChangeProperty.js +3 -5
- package/dist/Editor/Elements/DataView/Layouts/Options/EditOption.js +7 -9
- package/dist/Editor/Elements/DataView/Layouts/Options/EditProperty.js +12 -15
- package/dist/Editor/Elements/DataView/Layouts/Options/FilterProperty.js +2 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/PropertyList.js +2 -3
- package/dist/Editor/Elements/DataView/Layouts/Options/index.js +6 -23
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +4 -6
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +4 -8
- package/dist/Editor/Elements/DataView/Layouts/index.js +1 -3
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +2 -5
- package/dist/Editor/Elements/Divider/Divider.js +3 -5
- package/dist/Editor/Elements/Divider/DividerButton.js +2 -6
- package/dist/Editor/Elements/Divider/DividerPopup.js +2 -3
- package/dist/Editor/Elements/Embed/Embed.js +1 -4
- package/dist/Editor/Elements/Embed/EmbedPopup.js +1 -4
- package/dist/Editor/Elements/Embed/Image.js +11 -16
- package/dist/Editor/Elements/Embed/Video.js +6 -9
- package/dist/Editor/Elements/EmbedScript/Code.js +4 -7
- package/dist/Editor/Elements/EmbedScript/EmbedScript.js +2 -6
- package/dist/Editor/Elements/EmbedScript/EmbedScriptPopup.js +5 -8
- package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -6
- package/dist/Editor/Elements/Form/FieldPopup.js +1 -4
- package/dist/Editor/Elements/Form/Form.js +9 -12
- package/dist/Editor/Elements/Form/FormButton.js +2 -6
- package/dist/Editor/Elements/Form/FormPopup.js +2 -3
- package/dist/Editor/Elements/Form/Workflow/FormWorkflow.js +12 -18
- package/dist/Editor/Elements/Form/Workflow/ListWorkflow.js +8 -13
- package/dist/Editor/Elements/Form/Workflow/MoreOptions.js +2 -3
- package/dist/Editor/Elements/Form/Workflow/Styles.js +22 -24
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -4
- package/dist/Editor/Elements/Form/Workflow/index.js +9 -15
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +23 -67
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +6 -31
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +6 -54
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +2 -3
- package/dist/Editor/Elements/FreeGrid/Options/More.js +4 -10
- package/dist/Editor/Elements/FreeGrid/styles.js +0 -3
- package/dist/Editor/Elements/Grid/Grid.js +10 -13
- package/dist/Editor/Elements/Grid/GridButton.js +5 -9
- package/dist/Editor/Elements/Grid/GridItem.js +8 -14
- package/dist/Editor/Elements/Grid/GridItemPopup.js +1 -4
- package/dist/Editor/Elements/Grid/GridPopup.js +1 -4
- package/dist/Editor/Elements/Grid/SectionPopup.js +1 -4
- package/dist/Editor/Elements/Link/Link.js +5 -8
- package/dist/Editor/Elements/Link/LinkButton.js +1 -4
- package/dist/Editor/Elements/List/CheckList.js +9 -14
- package/dist/Editor/Elements/NewLine/NewLineButton.js +2 -6
- package/dist/Editor/Elements/PageSettings/PageSettingsButton.js +1 -4
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -4
- package/dist/Editor/Elements/Search/SearchButton.js +4 -7
- package/dist/Editor/Elements/Search/SearchList.js +5 -10
- package/dist/Editor/Elements/Signature/SignatureButton.js +2 -6
- package/dist/Editor/Elements/Signature/SignatureOptions/DrawSignature.js +8 -2
- package/dist/Editor/Elements/Signature/SignatureOptions/TypeSignature.js +2 -6
- package/dist/Editor/Elements/Signature/SignatureOptions/UploadSignature.js +1 -4
- package/dist/Editor/Elements/Signature/SignaturePopup.js +16 -17
- package/dist/Editor/Elements/SimpleText/index.js +4 -5
- package/dist/Editor/Elements/SimpleText/style.js +2 -2
- package/dist/Editor/Elements/Table/DragButton.js +2 -4
- package/dist/Editor/Elements/Table/Table.js +12 -24
- package/dist/Editor/Elements/Table/TablePopup.js +1 -4
- package/dist/Editor/Elements/Table/TableSelector.js +6 -10
- package/dist/Editor/Elements/Table/TableTool.js +4 -8
- package/dist/Editor/Elements/Title/title.js +8 -9
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +1 -4
- package/dist/Editor/Elements/Variables/VariableButton.js +1 -10
- package/dist/Editor/MiniEditor.js +3 -10
- package/dist/Editor/Styles/EditorStyles.js +5 -5
- package/dist/Editor/Toolbar/Basic/index.js +1 -2
- package/dist/Editor/Toolbar/FormatTools/BlockButton.js +2 -6
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +3 -27
- package/dist/Editor/Toolbar/FormatTools/FontFamilyAutocomplete.js +3 -4
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +4 -8
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +13 -10
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +5 -17
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +5 -10
- package/dist/Editor/Toolbar/PopupTool/ButtonTemplatesCard.js +4 -10
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +4 -10
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/MiniColorPicker.js +3 -9
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectAlignment.js +35 -42
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +13 -6
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectList.js +51 -58
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectSuperSubscript.js +22 -29
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +87 -226
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +10 -20
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +5 -10
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +11 -71
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +42 -122
- package/dist/Editor/Toolbar/PopupTool/index.js +2 -18
- package/dist/Editor/Toolbar/Toolbar.js +10 -20
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +14 -39
- package/dist/Editor/common/CustomDialog/index.js +10 -8
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
- package/dist/Editor/common/Icon.js +1 -31
- package/dist/Editor/common/ImageSelector/ImageSelector.js +8 -10
- package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -6
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/LinkSettings/NavComponents.js +10 -14
- package/dist/Editor/common/LinkSettings/index.js +14 -20
- package/dist/Editor/common/LinkSettings/navOptions.js +1 -1
- package/dist/Editor/common/MUIIcon/index.js +3 -0
- package/dist/Editor/common/MentionsPopup/index.js +2 -6
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +22 -46
- package/dist/Editor/common/RnD/ContextMenu/index.js +2 -3
- package/dist/Editor/common/RnD/ElementOptions/index.js +2 -7
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/SaveAsTemplate.js +3 -8
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +3 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/AppHeaderSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/BoxSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/ButtonSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/CodeSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/FormSettings.js +4 -7
- package/dist/Editor/common/RnD/ElementSettings/Settings/ImageSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TableSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/Settings/TextSettings.js +2 -6
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
- package/dist/Editor/common/RnD/OptionsPopup/index.js +3 -4
- package/dist/Editor/common/RnD/ShadowElement.js +1 -2
- package/dist/Editor/common/RnD/SwitchViewport/SwitchViewport.js +4 -11
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +3 -6
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +8 -55
- package/dist/Editor/common/RnD/Utils/index.js +0 -3
- package/dist/Editor/common/RnD/VirtualElement/index.js +103 -187
- package/dist/Editor/common/RnD/VirtualElement/styles.js +7 -155
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
- package/dist/Editor/common/RnD/index.js +13 -69
- package/dist/Editor/common/Section/index.js +4 -7
- package/dist/Editor/common/Shorthands/elements.js +3 -74
- package/dist/Editor/common/StyleBuilder/appHeaderStyle.js +4 -4
- package/dist/Editor/common/StyleBuilder/boxStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -6
- package/dist/Editor/common/StyleBuilder/dividerStyles.js +2 -2
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +6 -6
- package/dist/Editor/common/StyleBuilder/fieldStyle.js +2 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/alignment.js +9 -13
- package/dist/Editor/common/StyleBuilder/fieldTypes/backgroundImage.js +3 -11
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +5 -19
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +10 -22
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +3 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/card.js +13 -27
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +14 -43
- package/dist/Editor/common/StyleBuilder/fieldTypes/elementSize.js +6 -10
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +6 -19
- package/dist/Editor/common/StyleBuilder/fieldTypes/gridSize.js +2 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +2 -5
- package/dist/Editor/common/StyleBuilder/fieldTypes/menusArray.js +6 -9
- package/dist/Editor/common/StyleBuilder/fieldTypes/metaDataMapping.js +2 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +11 -12
- package/dist/Editor/common/StyleBuilder/fieldTypes/selectBox.js +2 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/text.js +4 -8
- package/dist/Editor/common/StyleBuilder/fieldTypes/textAlign.js +2 -6
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +12 -21
- package/dist/Editor/common/StyleBuilder/formStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/gridItemStyle.js +6 -6
- package/dist/Editor/common/StyleBuilder/gridStyle.js +5 -5
- package/dist/Editor/common/StyleBuilder/index.js +5 -8
- package/dist/Editor/common/StyleBuilder/pageSettingsStyle.js +7 -5
- package/dist/Editor/common/SwipeableDrawer/index.js +1 -1
- package/dist/Editor/common/Uploader.js +5 -16
- package/dist/Editor/commonStyle.js +57 -68
- package/dist/Editor/helper/index.js +3 -27
- package/dist/Editor/helper/theme.js +2 -202
- package/dist/Editor/hooks/useMouseMove.js +3 -9
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +9 -11
- package/dist/Editor/plugins/withLayout.js +2 -3
- package/dist/Editor/plugins/withLinks.js +0 -10
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +50 -178
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/freegrid.js +3 -3
- package/dist/Editor/utils/helper.js +21 -92
- package/package.json +4 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -444
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -436
- package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
- package/dist/Editor/assets/svg/ResetIconNew.js +0 -23
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/common/CustomColorPicker/index.js +0 -131
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog2/index.js +0 -94
- package/dist/Editor/common/CustomDialog2/style.js +0 -67
- package/dist/Editor/common/CustomSelect.js +0 -43
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/RnD/VirtualElement/BoxHeaderAutoAlignment.js +0 -43
- package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -44
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -134
- package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -381
- package/dist/Editor/common/SnackBar/index.js +0 -43
- package/dist/Editor/helper/textIndeces.js +0 -58
- package/dist/Editor/hooks/useAutoScroll.js +0 -38
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/hooks/useThemeValues.js +0 -63
- package/dist/Editor/theme/index.js +0 -149
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -290
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -310
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -81
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -240
- package/dist/Editor/themeSettings/fonts/style.js +0 -61
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -351
- package/dist/Editor/themeSettings/style.js +0 -220
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -205
- package/dist/Editor/themeSettingsAI/style.js +0 -259
@@ -1,58 +0,0 @@
|
|
1
|
-
export function extractTextWithPath(data, path = []) {
|
2
|
-
let result = [];
|
3
|
-
data.forEach((item, index) => {
|
4
|
-
const currentPath = [...path, index];
|
5
|
-
if (item.text) {
|
6
|
-
result.push({
|
7
|
-
path_id: currentPath.join(","),
|
8
|
-
text: item.text
|
9
|
-
});
|
10
|
-
}
|
11
|
-
if (item.children) {
|
12
|
-
result = result.concat(extractTextWithPath(item.children, currentPath));
|
13
|
-
}
|
14
|
-
});
|
15
|
-
return result;
|
16
|
-
}
|
17
|
-
export function replaceTextPath(nestedJson, pathIdJson) {
|
18
|
-
// Create a map from path_id JSON for quick lookup
|
19
|
-
const pathIdMap = new Map(pathIdJson.map(item => [item.path_id, item.text]));
|
20
|
-
console.log(pathIdMap);
|
21
|
-
function extractTextWithPath(data, path = []) {
|
22
|
-
data.forEach((item, index) => {
|
23
|
-
const currentPath = [...path, index];
|
24
|
-
if (item.text) {
|
25
|
-
if (pathIdMap.has(currentPath?.join(","))) {
|
26
|
-
item.text = pathIdMap.get(currentPath?.join(","));
|
27
|
-
}
|
28
|
-
}
|
29
|
-
if (item.children) {
|
30
|
-
extractTextWithPath(item.children, currentPath);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
extractTextWithPath(nestedJson, []);
|
35
|
-
return nestedJson;
|
36
|
-
}
|
37
|
-
|
38
|
-
// export function replaceTextPath(nestedJson, pathIdJson) {
|
39
|
-
// // Create a map from path_id JSON for quick lookup
|
40
|
-
// const pathIdMap = new Map(
|
41
|
-
// pathIdJson.map((item) => [item.path_id, item.text])
|
42
|
-
// );
|
43
|
-
|
44
|
-
// function traverseAndReplace(node) {
|
45
|
-
// if (Array.isArray(node)) {
|
46
|
-
// node.forEach(traverseAndReplace);
|
47
|
-
// } else if (typeof node === "object" && node !== null) {
|
48
|
-
// console.log(node);
|
49
|
-
// if (node.text && pathIdMap.has(node.text)) {
|
50
|
-
// node.text = pathIdMap.get(node.path_id);
|
51
|
-
// }
|
52
|
-
// Object.values(node).forEach(traverseAndReplace);
|
53
|
-
// }
|
54
|
-
// }
|
55
|
-
|
56
|
-
// traverseAndReplace(nestedJson);
|
57
|
-
// return nestedJson;
|
58
|
-
// }
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { useEffect, useRef } from "react";
|
2
|
-
function useAutoScroll(speed = 10, scrollElementId = "slate-wrapper-scroll-container") {
|
3
|
-
const scrollInterval = useRef(null);
|
4
|
-
function getScrollElement() {
|
5
|
-
return document.getElementById(scrollElementId) || window;
|
6
|
-
}
|
7
|
-
function startAutoScroll(direction) {
|
8
|
-
if (scrollInterval.current) return; // Prevent multiple intervals
|
9
|
-
|
10
|
-
const scrollContainer = getScrollElement();
|
11
|
-
scrollInterval.current = setInterval(() => {
|
12
|
-
scrollContainer.style.scrollBehavior = "auto";
|
13
|
-
if (direction === "up") {
|
14
|
-
scrollContainer.scrollBy(0, -speed);
|
15
|
-
} else if (direction === "down") {
|
16
|
-
scrollContainer.scrollBy(0, speed);
|
17
|
-
scrollContainer.style.scrollBehavior = "smooth";
|
18
|
-
}
|
19
|
-
}, 16); // Approx 60fps
|
20
|
-
}
|
21
|
-
|
22
|
-
function stopAutoScroll() {
|
23
|
-
if (scrollInterval.current) {
|
24
|
-
clearInterval(scrollInterval.current);
|
25
|
-
scrollInterval.current = null;
|
26
|
-
const scrollContainer = getScrollElement();
|
27
|
-
scrollContainer.style.scrollBehavior = "smooth";
|
28
|
-
}
|
29
|
-
}
|
30
|
-
useEffect(() => {
|
31
|
-
return () => stopAutoScroll(); // Cleanup on unmount
|
32
|
-
}, []);
|
33
|
-
return {
|
34
|
-
startAutoScroll,
|
35
|
-
stopAutoScroll
|
36
|
-
};
|
37
|
-
}
|
38
|
-
export default useAutoScroll;
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import { useSlate } from "slate-react";
|
2
|
-
import { defaultTheme } from "../theme";
|
3
|
-
import { getPageSettings, updatePageSettings } from "../utils/pageSettings";
|
4
|
-
import { HEADING_THEME_FIELDS, PARAGRAPH_THEME_FIELDS } from "../helper/theme";
|
5
|
-
import { useEditorContext } from "./useMouseMove";
|
6
|
-
const MAP_FIELDS = {
|
7
|
-
HEADING: HEADING_THEME_FIELDS,
|
8
|
-
PARAGRAPH: PARAGRAPH_THEME_FIELDS
|
9
|
-
};
|
10
|
-
const MAP_FONT_FIELD_KEYS = {
|
11
|
-
HEADING: "headingFontFamily",
|
12
|
-
PARAGRAPH: "paragraphFontFamily"
|
13
|
-
};
|
14
|
-
function getUpdatePayload(prevTheme = {}, update, actionData) {
|
15
|
-
const {
|
16
|
-
action,
|
17
|
-
fieldName
|
18
|
-
} = actionData || {};
|
19
|
-
const {
|
20
|
-
theme: prev
|
21
|
-
} = prevTheme;
|
22
|
-
let theme = {};
|
23
|
-
let themeProps = {};
|
24
|
-
switch (action) {
|
25
|
-
case "THEME_CHANGE":
|
26
|
-
theme = update;
|
27
|
-
break;
|
28
|
-
case "CSS_VAR_CHANGE":
|
29
|
-
const prevCssVars = prev?.cssVars || {};
|
30
|
-
const prevValue = prevCssVars[fieldName] || {};
|
31
|
-
themeProps = {
|
32
|
-
...(prev || {}),
|
33
|
-
cssVars: {
|
34
|
-
...prevCssVars,
|
35
|
-
[fieldName]: {
|
36
|
-
...prevValue,
|
37
|
-
...update
|
38
|
-
}
|
39
|
-
}
|
40
|
-
};
|
41
|
-
theme = {
|
42
|
-
...prevTheme,
|
43
|
-
theme: themeProps
|
44
|
-
};
|
45
|
-
break;
|
46
|
-
case "ELEMENT_PROPS_CHANGE":
|
47
|
-
const prevEleProps = prev?.elementProps || {};
|
48
|
-
const prevEleValue = prevEleProps[fieldName] || {};
|
49
|
-
themeProps = {
|
50
|
-
...(prev || {}),
|
51
|
-
elementProps: {
|
52
|
-
...prevEleProps,
|
53
|
-
[fieldName]: {
|
54
|
-
...prevEleValue,
|
55
|
-
...update
|
56
|
-
}
|
57
|
-
}
|
58
|
-
};
|
59
|
-
theme = {
|
60
|
-
...prevTheme,
|
61
|
-
theme: themeProps
|
62
|
-
};
|
63
|
-
break;
|
64
|
-
case "OTHER_PROPS_CHANGE":
|
65
|
-
themeProps = {
|
66
|
-
...(prev || {}),
|
67
|
-
otherProps: {
|
68
|
-
...(prev.otherProps || {}),
|
69
|
-
...update
|
70
|
-
}
|
71
|
-
};
|
72
|
-
theme = {
|
73
|
-
...prevTheme,
|
74
|
-
theme: themeProps
|
75
|
-
};
|
76
|
-
break;
|
77
|
-
case "FONT_CHANGE":
|
78
|
-
const {
|
79
|
-
elementProps = {},
|
80
|
-
otherProps = {}
|
81
|
-
} = prev;
|
82
|
-
const {
|
83
|
-
fieldType
|
84
|
-
} = actionData || {};
|
85
|
-
const fields = MAP_FIELDS[fieldType];
|
86
|
-
const fontFieldsUpdate = {};
|
87
|
-
fields?.forEach(field => {
|
88
|
-
const prevFieldData = elementProps[field];
|
89
|
-
fontFieldsUpdate[field] = {
|
90
|
-
...prevFieldData,
|
91
|
-
...update
|
92
|
-
};
|
93
|
-
});
|
94
|
-
const FONT_KEY_FOR_FIELD = MAP_FONT_FIELD_KEYS[fieldType];
|
95
|
-
themeProps = {
|
96
|
-
...(prev || {}),
|
97
|
-
elementProps: {
|
98
|
-
...elementProps,
|
99
|
-
...fontFieldsUpdate
|
100
|
-
},
|
101
|
-
otherProps: {
|
102
|
-
...otherProps,
|
103
|
-
[FONT_KEY_FOR_FIELD]: update?.fontFamily
|
104
|
-
}
|
105
|
-
};
|
106
|
-
theme = {
|
107
|
-
...prevTheme,
|
108
|
-
theme: themeProps
|
109
|
-
};
|
110
|
-
break;
|
111
|
-
default:
|
112
|
-
theme = {
|
113
|
-
...prevTheme,
|
114
|
-
...(update || {})
|
115
|
-
};
|
116
|
-
break;
|
117
|
-
}
|
118
|
-
return theme;
|
119
|
-
}
|
120
|
-
const updateTheme = (editor, pageSt, update, actionData, triggerRender) => {
|
121
|
-
const {
|
122
|
-
pageProps
|
123
|
-
} = pageSt || {};
|
124
|
-
const {
|
125
|
-
theme
|
126
|
-
} = pageProps || {};
|
127
|
-
const updatedTheme = getUpdatePayload(theme, update, actionData);
|
128
|
-
updatePageSettings(editor, {
|
129
|
-
...(pageProps || {}),
|
130
|
-
theme: updatedTheme
|
131
|
-
});
|
132
|
-
triggerRender();
|
133
|
-
};
|
134
|
-
export const useEditorTheme = () => {
|
135
|
-
const editor = useSlate();
|
136
|
-
const {
|
137
|
-
triggerRender
|
138
|
-
} = useEditorContext();
|
139
|
-
const {
|
140
|
-
element: pageSt
|
141
|
-
} = getPageSettings(editor) || {};
|
142
|
-
const {
|
143
|
-
pageProps
|
144
|
-
} = pageSt || {};
|
145
|
-
const {
|
146
|
-
theme
|
147
|
-
} = pageProps || {};
|
148
|
-
return {
|
149
|
-
selectedTheme: theme?.theme || defaultTheme?.theme,
|
150
|
-
updateTheme: (update, actionData) => updateTheme(editor, pageSt, update, actionData, triggerRender),
|
151
|
-
theme
|
152
|
-
};
|
153
|
-
};
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from "react";
|
2
|
-
import { getElementProperty } from "../helper/theme";
|
3
|
-
import { ReactEditor } from "slate-react";
|
4
|
-
import { Node } from "slate";
|
5
|
-
import { useEditorTheme } from "./useEditorTheme";
|
6
|
-
function useThemeValues() {
|
7
|
-
return {};
|
8
|
-
}
|
9
|
-
export default useThemeValues;
|
10
|
-
export function useButtonStyle(value, key, element) {
|
11
|
-
const [buttonStyle, setButtonStyle] = useState(value);
|
12
|
-
const {
|
13
|
-
selectedTheme
|
14
|
-
} = useEditorTheme();
|
15
|
-
const themeBtnProps = selectedTheme?.elementProps?.button || {};
|
16
|
-
useEffect(() => {
|
17
|
-
const color = getColorValue(value, key, element, themeBtnProps);
|
18
|
-
setButtonStyle({
|
19
|
-
color
|
20
|
-
});
|
21
|
-
}, [value, key, element]);
|
22
|
-
return {
|
23
|
-
buttonStyle
|
24
|
-
};
|
25
|
-
}
|
26
|
-
const DEFAULT_MAP_THEMES = {
|
27
|
-
textColor: "color",
|
28
|
-
bgColor: "backgroundColor"
|
29
|
-
};
|
30
|
-
const hoverMap = (theme, format) => {
|
31
|
-
const hover = theme?.hover || {};
|
32
|
-
const key = DEFAULT_MAP_THEMES[format];
|
33
|
-
return hover[key];
|
34
|
-
};
|
35
|
-
const MAP_THEME_KEYS = {
|
36
|
-
...DEFAULT_MAP_THEMES,
|
37
|
-
textColorHover: hoverMap,
|
38
|
-
bgColorHover: hoverMap
|
39
|
-
};
|
40
|
-
const getColorValue = (val, key, elementProps, themeBtnProps) => {
|
41
|
-
const themeKey = MAP_THEME_KEYS[key];
|
42
|
-
if (elementProps?.type === "button" && !val && themeKey) {
|
43
|
-
if (typeof themeKey === "string") {
|
44
|
-
return themeBtnProps[themeKey];
|
45
|
-
} else {
|
46
|
-
return themeKey(themeBtnProps, key);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
return val;
|
50
|
-
};
|
51
|
-
export function getButtonElementStyle(editor, element, stylePropertyName) {
|
52
|
-
try {
|
53
|
-
const path = ReactEditor.findPath(editor, element);
|
54
|
-
if (path?.length) {
|
55
|
-
const currentEle = Node.get(editor, path);
|
56
|
-
const dom = ReactEditor.toDOMNode(editor, currentEle);
|
57
|
-
const editorBtn = dom?.querySelector(".button.theme-element");
|
58
|
-
return getElementProperty(editorBtn, stylePropertyName);
|
59
|
-
}
|
60
|
-
} catch (err) {
|
61
|
-
// console.log(err);
|
62
|
-
}
|
63
|
-
}
|
@@ -1,149 +0,0 @@
|
|
1
|
-
import { getDevice } from "../helper/theme";
|
2
|
-
const themeClassName = ".theme-element";
|
3
|
-
function getTextStyles(props) {
|
4
|
-
const {
|
5
|
-
fontSize,
|
6
|
-
textDecoration,
|
7
|
-
color,
|
8
|
-
...rest
|
9
|
-
} = props;
|
10
|
-
const device = getDevice();
|
11
|
-
const fontS = typeof fontSize === "object" ? fontSize[device] : fontSize;
|
12
|
-
return {
|
13
|
-
...rest,
|
14
|
-
'& span[data-slate-string="true"]': {
|
15
|
-
textDecoration,
|
16
|
-
fontSize: fontS,
|
17
|
-
color: color || "inherit"
|
18
|
-
}
|
19
|
-
|
20
|
-
// "&::after": {
|
21
|
-
// // for placeholder
|
22
|
-
// fontSize,
|
23
|
-
// },
|
24
|
-
};
|
25
|
-
}
|
26
|
-
|
27
|
-
const transformHeading = (props, elementType) => {
|
28
|
-
return {
|
29
|
-
[`& ${elementType}${themeClassName}`]: getTextStyles(props)
|
30
|
-
};
|
31
|
-
};
|
32
|
-
const transformParagraph = (props, paraType) => {
|
33
|
-
return {
|
34
|
-
[`& p${themeClassName}.${paraType}`]: getTextStyles(props)
|
35
|
-
};
|
36
|
-
};
|
37
|
-
const transformButton = props => {
|
38
|
-
const {
|
39
|
-
borderRadius,
|
40
|
-
lockRadius,
|
41
|
-
bannerSpacing,
|
42
|
-
buttonIcon,
|
43
|
-
hover,
|
44
|
-
...classProps
|
45
|
-
} = props;
|
46
|
-
return {
|
47
|
-
[`& .button${themeClassName}`]: {
|
48
|
-
...classProps,
|
49
|
-
"&:hover": hover
|
50
|
-
},
|
51
|
-
buttonTheme: {
|
52
|
-
borderRadius,
|
53
|
-
lockRadius,
|
54
|
-
bannerSpacing,
|
55
|
-
buttonIcon
|
56
|
-
}
|
57
|
-
};
|
58
|
-
};
|
59
|
-
const transformProps = (elementType, props) => {
|
60
|
-
let transformedProp = {};
|
61
|
-
let otherProps = {};
|
62
|
-
switch (elementType) {
|
63
|
-
case "h1":
|
64
|
-
case "h2":
|
65
|
-
case "h3":
|
66
|
-
case "h4":
|
67
|
-
case "h5":
|
68
|
-
case "h6":
|
69
|
-
transformedProp = transformHeading(props, elementType);
|
70
|
-
break;
|
71
|
-
case "para1":
|
72
|
-
case "para2":
|
73
|
-
case "para3":
|
74
|
-
transformedProp = transformParagraph(props, elementType);
|
75
|
-
break;
|
76
|
-
case "button":
|
77
|
-
const {
|
78
|
-
buttonTheme,
|
79
|
-
...classProps
|
80
|
-
} = transformButton(props, elementType);
|
81
|
-
transformedProp = classProps;
|
82
|
-
otherProps = {
|
83
|
-
buttonTheme
|
84
|
-
};
|
85
|
-
break;
|
86
|
-
default:
|
87
|
-
}
|
88
|
-
return {
|
89
|
-
transformedProp,
|
90
|
-
otherProps
|
91
|
-
};
|
92
|
-
};
|
93
|
-
export const transformTheme = (selectedTheme = {}) => {
|
94
|
-
let sxProps = {};
|
95
|
-
let others = {};
|
96
|
-
const {
|
97
|
-
elementProps
|
98
|
-
} = selectedTheme;
|
99
|
-
if (elementProps) {
|
100
|
-
Object.entries(elementProps).forEach(([key, value]) => {
|
101
|
-
const {
|
102
|
-
transformedProp,
|
103
|
-
otherProps
|
104
|
-
} = transformProps(key, value);
|
105
|
-
sxProps = {
|
106
|
-
...sxProps,
|
107
|
-
...transformedProp
|
108
|
-
};
|
109
|
-
others = {
|
110
|
-
...others,
|
111
|
-
...otherProps
|
112
|
-
};
|
113
|
-
});
|
114
|
-
}
|
115
|
-
return {
|
116
|
-
sxProps,
|
117
|
-
...others
|
118
|
-
};
|
119
|
-
};
|
120
|
-
export const defaultTheme = {
|
121
|
-
theme: {
|
122
|
-
cssVars: {},
|
123
|
-
elementProps: {
|
124
|
-
button: {
|
125
|
-
color: "#FFFFFF",
|
126
|
-
background: "#2563EB",
|
127
|
-
fontFamily: "PoppinsRegular",
|
128
|
-
fontWeight: 400,
|
129
|
-
fontSize: "inherit",
|
130
|
-
borderColor: "transparent",
|
131
|
-
borderRadius: {
|
132
|
-
topLeft: 30,
|
133
|
-
topRight: 30,
|
134
|
-
bottomLeft: 30,
|
135
|
-
bottomRight: 30
|
136
|
-
},
|
137
|
-
bannerSpacing: {
|
138
|
-
left: 16,
|
139
|
-
top: 8,
|
140
|
-
right: 16,
|
141
|
-
bottom: 8
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
};
|
147
|
-
export function getTheme(selectedTheme) {
|
148
|
-
return transformTheme(selectedTheme?.theme || defaultTheme.theme);
|
149
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import { Grid, Link, Typography } from "@mui/material";
|
2
|
-
import { useEditorTheme } from "../hooks/useEditorTheme";
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
4
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
5
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
6
|
-
function ActiveTheme(props) {
|
7
|
-
const {
|
8
|
-
onExplore
|
9
|
-
} = props;
|
10
|
-
const {
|
11
|
-
theme
|
12
|
-
} = useEditorTheme();
|
13
|
-
const {
|
14
|
-
colors = {}
|
15
|
-
} = theme?.theme?.cssVars || {};
|
16
|
-
const {
|
17
|
-
id,
|
18
|
-
name,
|
19
|
-
mood_name = ""
|
20
|
-
} = theme || {};
|
21
|
-
const themeColors = Object.values(colors || {});
|
22
|
-
return /*#__PURE__*/_jsxs(Grid, {
|
23
|
-
className: "activeThemeInnner",
|
24
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
25
|
-
variant: "body1",
|
26
|
-
className: "title activeThemeTitle",
|
27
|
-
children: id ? "Active Theme" : "No theme activated"
|
28
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
29
|
-
className: "flexAlign",
|
30
|
-
children: [/*#__PURE__*/_jsx(Typography, {
|
31
|
-
variant: "body1",
|
32
|
-
className: "fs-14",
|
33
|
-
children: name
|
34
|
-
}), /*#__PURE__*/_jsxs(Typography, {
|
35
|
-
variant: "body2",
|
36
|
-
className: "fs-12 textSecondary",
|
37
|
-
style: {
|
38
|
-
marginLeft: id ? "4px" : "0px"
|
39
|
-
},
|
40
|
-
children: [id ? ` - ` : null, id ? mood_name : "Select 'Explore More' to activate a theme and customize your design."]
|
41
|
-
})]
|
42
|
-
}), /*#__PURE__*/_jsxs(Grid, {
|
43
|
-
container: true,
|
44
|
-
justifyContent: "space-between",
|
45
|
-
alignItems: "end",
|
46
|
-
sx: {
|
47
|
-
mt: 1
|
48
|
-
},
|
49
|
-
children: [/*#__PURE__*/_jsx(Grid, {
|
50
|
-
className: "flexAlign",
|
51
|
-
sx: {
|
52
|
-
gap: "10px"
|
53
|
-
},
|
54
|
-
children: id ? /*#__PURE__*/_jsx(_Fragment, {
|
55
|
-
children: themeColors?.map((color, i) => {
|
56
|
-
return /*#__PURE__*/_jsx(Grid, {
|
57
|
-
className: "activeColorBox",
|
58
|
-
style: {
|
59
|
-
background: color
|
60
|
-
}
|
61
|
-
}, i);
|
62
|
-
})
|
63
|
-
}) : null
|
64
|
-
}), onExplore && /*#__PURE__*/_jsx(Link, {
|
65
|
-
className: "pointer fs-12 fw-500 exploreBtn",
|
66
|
-
onClick: onExplore,
|
67
|
-
children: "Explore More"
|
68
|
-
})]
|
69
|
-
})]
|
70
|
-
});
|
71
|
-
}
|
72
|
-
export default ActiveTheme;
|