@flozy/editor 9.2.4 → 9.2.5
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 +9 -33
- package/dist/Editor/CommonEditor.js +27 -117
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +1 -19
- 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 +2 -4
- 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 +14 -31
- 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 +12 -57
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +5 -5
- package/dist/Editor/Elements/Color Picker/Styles.js +1 -1
- 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 +1 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/Select.js +4 -3
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/styles.js +1 -6
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/DateType.js +9 -19
- 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 +2 -3
- 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 +6 -7
- 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 -12
- package/dist/Editor/Elements/DataView/Layouts/TableStyles.js +2 -32
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +33 -132
- package/dist/Editor/Elements/DataView/Layouts/ViewData.js +3 -3
- package/dist/Editor/Elements/DataView/Layouts/index.js +1 -3
- package/dist/Editor/Elements/DataView/Providers/DataViewProvider.js +3 -6
- package/dist/Editor/Elements/DataView/styles.js +8 -8
- 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 +7 -10
- 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/UserInputs.js +2 -4
- package/dist/Editor/Elements/Form/Workflow/index.js +9 -15
- package/dist/Editor/Elements/FreeGrid/FreeGrid.js +18 -21
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +2 -6
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +3 -8
- package/dist/Editor/Elements/FreeGrid/Options/AddElement.js +2 -3
- package/dist/Editor/Elements/FreeGrid/Options/More.js +3 -4
- 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 +10 -15
- 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 +44 -74
- 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 +5 -16
- package/dist/Editor/Elements/PageSettings/PageSettingsPopup.js +1 -4
- package/dist/Editor/Elements/Search/SearchButton.js +3 -6
- package/dist/Editor/Elements/Search/SearchList.js +3 -7
- package/dist/Editor/Elements/Signature/SignatureButton.js +2 -6
- 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 +5 -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 +32 -56
- package/dist/Editor/Elements/Table/TableCell.js +27 -6
- 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 +0 -10
- package/dist/Editor/Elements/TopBanner/TopBannerButton.js +1 -4
- package/dist/Editor/Elements/Variables/Style.js +2 -28
- package/dist/Editor/Elements/Variables/VariableButton.js +4 -17
- package/dist/Editor/MiniEditor.js +3 -9
- 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 +15 -7
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +15 -20
- package/dist/Editor/Toolbar/PopupTool/AddTemplates.js +13 -19
- 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 +2 -6
- 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 +7 -15
- package/dist/Editor/Toolbar/PopupTool/PopperHeader.js +4 -8
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +12 -16
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +32 -84
- package/dist/Editor/Toolbar/PopupTool/index.js +8 -3
- package/dist/Editor/Toolbar/Toolbar.js +10 -20
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/common/ColorPickerButton.js +9 -35
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/DnD/Draggable.js +1 -0
- package/dist/Editor/common/FontLoader/FontLoader.js +0 -3
- package/dist/Editor/common/Icon.js +0 -28
- 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/ImageSelector/UploadStyles.js +1 -0
- 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/MentionsPopup/Styles.js +12 -6
- package/dist/Editor/common/MentionsPopup/index.js +2 -6
- package/dist/Editor/common/RnD/ContextMenu/CMenus.js +22 -22
- 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 -4
- 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/SwitchViewport/SwitchViewport.js +4 -11
- package/dist/Editor/common/RnD/Theme/ViewportStimulator.js +8 -20
- package/dist/Editor/common/RnD/Utils/gridDropItem.js +4 -5
- package/dist/Editor/common/RnD/Utils/index.js +0 -45
- package/dist/Editor/common/RnD/VirtualElement/index.js +2 -1
- package/dist/Editor/common/RnD/index.js +7 -34
- package/dist/Editor/common/Section/index.js +4 -7
- package/dist/Editor/common/Shorthands/elements.js +4 -75
- 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 -41
- 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/Uploader.js +5 -16
- package/dist/Editor/commonStyle.js +69 -114
- package/dist/Editor/helper/index.js +12 -8
- package/dist/Editor/helper/theme.js +2 -200
- package/dist/Editor/hooks/useDrag.js +10 -16
- package/dist/Editor/hooks/useEditorScroll.js +5 -10
- package/dist/Editor/hooks/useMouseMove.js +13 -25
- package/dist/Editor/hooks/useTable.js +1 -1
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +14 -19
- package/dist/Editor/plugins/withLayout.js +2 -3
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +173 -50
- package/dist/Editor/utils/SlateUtilityFunctions.js +45 -162
- package/dist/Editor/utils/button.js +14 -0
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -23
- package/dist/Editor/utils/divider.js +0 -8
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/helper.js +19 -77
- package/dist/Editor/utils/link.js +1 -1
- package/dist/Editor/utils/table.js +0 -8
- package/package.json +2 -5
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -438
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/common/CustomColorPicker/index.js +0 -106
- package/dist/Editor/common/CustomColorPicker/style.js +0 -53
- package/dist/Editor/common/CustomDialog/index.js +0 -88
- package/dist/Editor/common/CustomDialog/styles.js +0 -80
- 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 -33
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/hooks/useEditorTheme.js +0 -153
- package/dist/Editor/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -283
- package/dist/Editor/themeSettings/buttons/style.js +0 -21
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -292
- package/dist/Editor/themeSettings/colorTheme/style.js +0 -77
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +0 -121
- package/dist/Editor/themeSettings/fonts/index.js +0 -220
- package/dist/Editor/themeSettings/fonts/style.js +0 -44
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -320
- package/dist/Editor/themeSettings/style.js +0 -152
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -356
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -197
- package/dist/Editor/themeSettingsAI/style.js +0 -250
@@ -34,12 +34,12 @@ import SimpleText from "../Elements/SimpleText";
|
|
34
34
|
import CheckList from "../Elements/List/CheckList";
|
35
35
|
import { getTextColor, isEmptyTextNode } from "../helper";
|
36
36
|
import Attachments from "../Elements/Attachments/Attachments";
|
37
|
-
import { getBreakPointsValue,
|
37
|
+
import { getBreakPointsValue, groupByBreakpoint } from "../helper/theme";
|
38
38
|
import Variables from "../Elements/Variables/Variable";
|
39
|
+
import insertNewLine from "./insertNewLine";
|
39
40
|
import Divider from "../Elements/Divider/Divider";
|
40
41
|
import { getBorderColor, getSlateDom } from "./helper";
|
41
42
|
import Code from "../Elements/EmbedScript/Code";
|
42
|
-
import { ReactEditor } from "slate-react";
|
43
43
|
import FreeGrid from "../Elements/FreeGrid/FreeGrid";
|
44
44
|
import FreeGridItem from "../Elements/FreeGrid/FreeGridItem";
|
45
45
|
import FreeGridBox from "../Elements/FreeGrid/FreeGridBox";
|
@@ -47,7 +47,7 @@ import DataView from "../Elements/DataView/DataView";
|
|
47
47
|
import ViewData from "../Elements/DataView/Layouts/ViewData";
|
48
48
|
import ColumnView from "../Elements/DataView/Layouts/ColumnView";
|
49
49
|
import SearchAttachment from "../Elements/Search/SearchAttachment";
|
50
|
-
import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
50
|
+
// import { wrapThemeBreakpoints } from "../Elements/FreeGrid/breakpointConstants";
|
51
51
|
import { jsx as _jsx } from "react/jsx-runtime";
|
52
52
|
const alignment = ["alignLeft", "alignRight", "alignCenter", "alignJustify"];
|
53
53
|
const list_types = ["orderedList", "unorderedList"];
|
@@ -55,17 +55,7 @@ const LIST_FORMAT_TYPE = {
|
|
55
55
|
orderedList: "list-item",
|
56
56
|
unorderedList: "list-item"
|
57
57
|
};
|
58
|
-
|
59
|
-
// const NEWLINESAFTER = [
|
60
|
-
// "headingOne",
|
61
|
-
// "headingTwo",
|
62
|
-
// "headingThree",
|
63
|
-
// "headingFour",
|
64
|
-
// "headingFive",
|
65
|
-
// "headingSix",
|
66
|
-
// ];
|
67
|
-
|
68
|
-
const THEME_BLOCK_FIELDS = ["headingOne", "headingTwo", "headingThree", "headingFour", "headingFive", "headingSix", "paragraphOne", "paragraphTwo", "paragraphThree"];
|
58
|
+
const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
|
69
59
|
export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
70
60
|
const isActive = isBlockActive(editor, format);
|
71
61
|
const isList = list_types.includes(format);
|
@@ -98,9 +88,8 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
98
88
|
if (!selection) {
|
99
89
|
Transforms.insertText(editor, "");
|
100
90
|
}
|
101
|
-
const forActiveType = THEME_BLOCK_FIELDS.some(f => f === format) ? format : "paragraph";
|
102
91
|
Transforms.setNodes(editor, {
|
103
|
-
type: isActive ?
|
92
|
+
type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
|
104
93
|
...attr
|
105
94
|
});
|
106
95
|
if (isList && !isActive) {
|
@@ -109,12 +98,10 @@ export const toggleBlock = (editor, format, selection = true, attr = {}) => {
|
|
109
98
|
children: []
|
110
99
|
});
|
111
100
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
// }
|
101
|
+
if (NEWLINESAFTER.indexOf(format) > -1) {
|
102
|
+
insertNewLine(editor);
|
103
|
+
}
|
116
104
|
};
|
117
|
-
|
118
105
|
export const addMarkData = (editor, data) => {
|
119
106
|
try {
|
120
107
|
Editor.addMark(editor, data.format, data.value);
|
@@ -123,14 +110,9 @@ export const addMarkData = (editor, data) => {
|
|
123
110
|
}
|
124
111
|
};
|
125
112
|
export const toggleMark = (editor, format) => {
|
126
|
-
const isActive =
|
113
|
+
const isActive = isMarkActive(editor, format);
|
127
114
|
if (isActive) {
|
128
|
-
|
129
|
-
if (isThemeSupportedMark) {
|
130
|
-
Editor.addMark(editor, format, false);
|
131
|
-
} else {
|
132
|
-
Editor.removeMark(editor, format);
|
133
|
-
}
|
115
|
+
Editor.removeMark(editor, format);
|
134
116
|
} else {
|
135
117
|
Editor.addMark(editor, format, true);
|
136
118
|
}
|
@@ -144,52 +126,6 @@ export const isMarkActive = (editor, format) => {
|
|
144
126
|
return null;
|
145
127
|
}
|
146
128
|
};
|
147
|
-
export const isMarkBtnActive = (editor, format) => {
|
148
|
-
switch (format) {
|
149
|
-
case "bold":
|
150
|
-
{
|
151
|
-
const style = getSelectedElementStyle("font-weight", editor);
|
152
|
-
return style === "700";
|
153
|
-
}
|
154
|
-
case "italic":
|
155
|
-
{
|
156
|
-
const style = getSelectedElementStyle("font-style", editor);
|
157
|
-
return style === format;
|
158
|
-
}
|
159
|
-
// case "underline": {
|
160
|
-
// const style = getSelectedElementStyle("text-decoration");
|
161
|
-
|
162
|
-
// return style?.includes(format);
|
163
|
-
// }
|
164
|
-
// case "strikethrough": {
|
165
|
-
// const style = getSelectedElementStyle("text-decoration");
|
166
|
-
|
167
|
-
// return style?.includes("line-through");
|
168
|
-
// }
|
169
|
-
default:
|
170
|
-
return isMarkActive(editor, format);
|
171
|
-
}
|
172
|
-
};
|
173
|
-
export const getSelectedElementStyle = (styleProperty, editor) => {
|
174
|
-
try {
|
175
|
-
if (!editor.selection) {
|
176
|
-
return "";
|
177
|
-
}
|
178
|
-
if (Range.isCollapsed(editor.selection)) {
|
179
|
-
return "";
|
180
|
-
}
|
181
|
-
const domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
182
|
-
const selectedDomNode = domRange.commonAncestorContainer;
|
183
|
-
|
184
|
-
// If it's a text node, get its parent element
|
185
|
-
const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
|
186
|
-
if (selectedElement) {
|
187
|
-
return getElementProperty(selectedElement, styleProperty);
|
188
|
-
}
|
189
|
-
} catch (err) {
|
190
|
-
console.log(err);
|
191
|
-
}
|
192
|
-
};
|
193
129
|
export const isBlockActive = (editor, format) => {
|
194
130
|
const [match] = Editor.nodes(editor, {
|
195
131
|
match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
|
@@ -242,31 +178,6 @@ export const activeMark = (editor, format) => {
|
|
242
178
|
return null;
|
243
179
|
}
|
244
180
|
};
|
245
|
-
|
246
|
-
// to avoid the styles, that automatically assign from themes
|
247
|
-
const getThemeMarkedLeaf = (leaf, children) => {
|
248
|
-
const {
|
249
|
-
italic,
|
250
|
-
bold
|
251
|
-
} = leaf || {};
|
252
|
-
const style = {};
|
253
|
-
if (italic === false) {
|
254
|
-
style.fontStyle = "normal";
|
255
|
-
}
|
256
|
-
if (bold === false) {
|
257
|
-
style.fontWeight = "normal";
|
258
|
-
}
|
259
|
-
if (Object.keys(style).length) {
|
260
|
-
children = /*#__PURE__*/_jsx(Box, {
|
261
|
-
component: "span",
|
262
|
-
sx: {
|
263
|
-
"& span": style
|
264
|
-
},
|
265
|
-
children: children
|
266
|
-
});
|
267
|
-
}
|
268
|
-
return children;
|
269
|
-
};
|
270
181
|
export const getMarked = (leaf, children, theme) => {
|
271
182
|
const className = leaf?.doublequote ? "doublequote" : "";
|
272
183
|
if (leaf.highlight) {
|
@@ -293,7 +204,6 @@ export const getMarked = (leaf, children, theme) => {
|
|
293
204
|
children: children
|
294
205
|
});
|
295
206
|
}
|
296
|
-
children = getThemeMarkedLeaf(leaf, children);
|
297
207
|
if (leaf.strikethrough) {
|
298
208
|
children = /*#__PURE__*/_jsx("span", {
|
299
209
|
style: {
|
@@ -321,27 +231,20 @@ export const getMarked = (leaf, children, theme) => {
|
|
321
231
|
if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
|
322
232
|
const family = leaf?.fontFamily;
|
323
233
|
const textStyles = getTextColor(leaf?.color);
|
324
|
-
const fontSize = {
|
325
|
-
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
326
|
-
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
327
|
-
};
|
328
|
-
const fontSizesImportant = {};
|
329
|
-
Object.entries(fontSize).forEach(([key, value]) => {
|
330
|
-
fontSizesImportant[key] = `${value} !important`;
|
331
|
-
});
|
332
|
-
const fontSizeWithBreakpoints = wrapThemeBreakpoints(fontSizesImportant, "fontSize", theme);
|
333
234
|
children = /*#__PURE__*/_jsx("span", {
|
235
|
+
style: {
|
236
|
+
background: leaf.bgColor
|
237
|
+
},
|
334
238
|
children: /*#__PURE__*/_jsx(Box, {
|
335
239
|
className: className,
|
336
240
|
component: "span",
|
337
241
|
sx: {
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
},
|
344
|
-
...fontSizeWithBreakpoints,
|
242
|
+
...groupByBreakpoint({
|
243
|
+
fontSize: {
|
244
|
+
lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
245
|
+
...getBreakPointsValue(leaf.fontSize, null, "overrideText")
|
246
|
+
}
|
247
|
+
}, theme),
|
345
248
|
// ...wrapThemeBreakpoints(
|
346
249
|
// {
|
347
250
|
// lg: sizeMap[leaf.fontSize] || leaf.fontSize,
|
@@ -379,77 +282,57 @@ export const getMarked = (leaf, children, theme) => {
|
|
379
282
|
export const getBlock = props => {
|
380
283
|
const {
|
381
284
|
element,
|
382
|
-
children
|
383
|
-
customProps
|
285
|
+
children
|
384
286
|
} = props;
|
385
287
|
const attributes = props.attributes ?? {};
|
386
288
|
const isEmpty = isEmptyTextNode(element);
|
387
|
-
const {
|
388
|
-
translation
|
389
|
-
} = customProps;
|
390
|
-
const commonHeadingProps = () => ({
|
391
|
-
...attributes,
|
392
|
-
...element.attr,
|
393
|
-
className: `edt-headings content-editable ${isEmpty ? "empty" : ""} theme-element`
|
394
|
-
});
|
395
|
-
const commonParaProps = paraType => ({
|
396
|
-
...attributes,
|
397
|
-
...element.attr,
|
398
|
-
className: `content-editable ${isEmpty ? "empty" : ""} theme-element ${paraType}`
|
399
|
-
});
|
400
289
|
switch (element.type) {
|
401
290
|
case "headingOne":
|
402
291
|
return /*#__PURE__*/_jsx("h1", {
|
403
|
-
...
|
404
|
-
|
292
|
+
...attributes,
|
293
|
+
...element.attr,
|
294
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
295
|
+
placeholder: "Heading 1",
|
405
296
|
children: children
|
406
297
|
});
|
407
298
|
case "headingTwo":
|
408
299
|
return /*#__PURE__*/_jsx("h2", {
|
409
|
-
...
|
410
|
-
|
300
|
+
...attributes,
|
301
|
+
...element.attr,
|
302
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
303
|
+
placeholder: "Heading 2",
|
411
304
|
children: children
|
412
305
|
});
|
413
306
|
case "headingThree":
|
414
307
|
return /*#__PURE__*/_jsx("h3", {
|
415
|
-
...
|
416
|
-
|
308
|
+
...attributes,
|
309
|
+
...element.attr,
|
310
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
311
|
+
placeholder: "Heading 3",
|
417
312
|
children: children
|
418
313
|
});
|
419
314
|
case "headingFour":
|
420
315
|
return /*#__PURE__*/_jsx("h4", {
|
421
|
-
...
|
422
|
-
|
316
|
+
...attributes,
|
317
|
+
...element.attr,
|
318
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
319
|
+
placeholder: "Heading 4",
|
423
320
|
children: children
|
424
321
|
});
|
425
322
|
case "headingFive":
|
426
323
|
return /*#__PURE__*/_jsx("h5", {
|
427
|
-
...
|
428
|
-
|
324
|
+
...attributes,
|
325
|
+
...element.attr,
|
326
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
327
|
+
placeholder: "Heading 5",
|
429
328
|
children: children
|
430
329
|
});
|
431
330
|
case "headingSix":
|
432
331
|
return /*#__PURE__*/_jsx("h6", {
|
433
|
-
...
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
case "paragraphOne":
|
438
|
-
return /*#__PURE__*/_jsx("p", {
|
439
|
-
...commonParaProps("para1"),
|
440
|
-
placeholder: "Paragraph 1",
|
441
|
-
children: children
|
442
|
-
});
|
443
|
-
case "paragraphTwo":
|
444
|
-
return /*#__PURE__*/_jsx("p", {
|
445
|
-
...commonParaProps("para2"),
|
446
|
-
placeholder: "Paragraph 2",
|
447
|
-
children: children
|
448
|
-
});
|
449
|
-
case "paragraphThree":
|
450
|
-
return /*#__PURE__*/_jsx("p", {
|
451
|
-
...commonParaProps("para3"),
|
452
|
-
placeholder: "Paragraph 3",
|
332
|
+
...attributes,
|
333
|
+
...element.attr,
|
334
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
335
|
+
placeholder: "Heading 6",
|
453
336
|
children: children
|
454
337
|
});
|
455
338
|
case "blockquote":
|
@@ -517,7 +400,7 @@ export const getBlock = props => {
|
|
517
400
|
...attributes,
|
518
401
|
...element.attr,
|
519
402
|
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
520
|
-
placeholder:
|
403
|
+
placeholder: "List",
|
521
404
|
style: {
|
522
405
|
color: firstChildren?.color
|
523
406
|
},
|
@@ -11,6 +11,20 @@ export const insertButton = editor => {
|
|
11
11
|
linkType: "webAddress"
|
12
12
|
},
|
13
13
|
iconPosition: "start",
|
14
|
+
bgColor: "#2563EB",
|
15
|
+
textColor: "#FFF",
|
16
|
+
borderRadius: {
|
17
|
+
topLeft: 30,
|
18
|
+
topRight: 30,
|
19
|
+
bottomLeft: 30,
|
20
|
+
bottomRight: 30
|
21
|
+
},
|
22
|
+
bannerSpacing: {
|
23
|
+
left: 16,
|
24
|
+
top: 8,
|
25
|
+
right: 16,
|
26
|
+
bottom: 8
|
27
|
+
},
|
14
28
|
...(windowVar.lastButtonProps || {})
|
15
29
|
};
|
16
30
|
Transforms.insertNodes(editor, button);
|
@@ -8,9 +8,6 @@ import { isEmptyTextNode } from "../../helper";
|
|
8
8
|
import { getBreakPointsValue } from "../../helper/theme";
|
9
9
|
import insertNewLine from "../insertNewLine";
|
10
10
|
import { getBorderColor } from "../helper";
|
11
|
-
import Table from "../../Elements/Table/Table";
|
12
|
-
import TableRow from "../../Elements/Table/TableRow";
|
13
|
-
import TableCell from "../../Elements/Table/TableCell";
|
14
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
15
12
|
const alignment = ["alignLeft", "alignRight", "alignCenter"];
|
16
13
|
const list_types = ["orderedList", "unorderedList"];
|
@@ -409,26 +406,6 @@ export const getBlock = props => {
|
|
409
406
|
return /*#__PURE__*/_jsx(Mentions, {
|
410
407
|
...props
|
411
408
|
});
|
412
|
-
case "table":
|
413
|
-
return /*#__PURE__*/_jsx(Table, {
|
414
|
-
...props
|
415
|
-
});
|
416
|
-
case "table-head":
|
417
|
-
return /*#__PURE__*/_jsx("thead", {
|
418
|
-
children: children
|
419
|
-
});
|
420
|
-
case "table-body":
|
421
|
-
return /*#__PURE__*/_jsx("tbody", {
|
422
|
-
children: children
|
423
|
-
});
|
424
|
-
case "table-row":
|
425
|
-
return /*#__PURE__*/_jsx(TableRow, {
|
426
|
-
...props
|
427
|
-
});
|
428
|
-
case "table-cell":
|
429
|
-
return /*#__PURE__*/_jsx(TableCell, {
|
430
|
-
...props
|
431
|
-
});
|
432
409
|
default:
|
433
410
|
return /*#__PURE__*/_jsx(SimpleText, {
|
434
411
|
...props,
|
@@ -1,20 +1,12 @@
|
|
1
1
|
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { getCurrentNodeText } from "./helper";
|
4
3
|
export const insertDivider = editor => {
|
5
|
-
Transforms.delete(editor, editor.selection);
|
6
|
-
const blockText = getCurrentNodeText(editor);
|
7
4
|
const divider = {
|
8
5
|
type: "divider",
|
9
6
|
children: [{
|
10
7
|
text: ""
|
11
8
|
}]
|
12
9
|
};
|
13
|
-
if (!blockText) {
|
14
|
-
Transforms.removeNodes(editor, {
|
15
|
-
at: editor?.selection
|
16
|
-
});
|
17
|
-
}
|
18
10
|
Transforms.insertNodes(editor, divider);
|
19
11
|
insertNewLine(editor);
|
20
12
|
};
|
@@ -82,8 +82,7 @@ const splitInlineStyleRanges = (text, inlineStyleRanges, data) => {
|
|
82
82
|
};
|
83
83
|
export const draftToSlate = props => {
|
84
84
|
const {
|
85
|
-
data
|
86
|
-
needLayout
|
85
|
+
data
|
87
86
|
} = props;
|
88
87
|
if (data?.blocks && data?.blocks?.length > 0) {
|
89
88
|
const converted = data?.blocks?.reduce((a, b) => {
|
@@ -105,7 +104,7 @@ export const draftToSlate = props => {
|
|
105
104
|
return data;
|
106
105
|
} else {
|
107
106
|
return [{
|
108
|
-
type:
|
107
|
+
type: "paragraph",
|
109
108
|
children: [{
|
110
109
|
text: ""
|
111
110
|
}]
|
@@ -7,43 +7,43 @@ export const sizeMap = {
|
|
7
7
|
export const fontFamilyMap = {
|
8
8
|
PoppinsRegular: "PoppinsRegular",
|
9
9
|
PoppinsBold: "PoppinsBold",
|
10
|
-
sans:
|
11
|
-
serif:
|
12
|
-
monospace:
|
13
|
-
roboto: "Roboto, sans-serif",
|
14
|
-
qwitcher: '
|
15
|
-
garamond: '
|
16
|
-
anton: "Anton, sans-serif",
|
17
|
-
dmserif: '
|
18
|
-
inter: "Inter, sans-serif",
|
19
|
-
libre: '
|
20
|
-
montserrat: "Montserrat, sans-serif",
|
21
|
-
opensans: '
|
22
|
-
publicsans: '
|
23
|
-
raleway: "Raleway, sans-serif",
|
24
|
-
spacemono: '
|
25
|
-
bulgarian: '
|
26
|
-
impact: "Impact, serif",
|
27
|
-
redacted: '
|
28
|
-
greatVibes: '
|
29
|
-
zeyada: "Zeyada, cursive",
|
30
|
-
allura: "Allura, cursive",
|
31
|
-
pinyon: '
|
32
|
-
muellerhoff: '
|
33
|
-
dawning: '
|
10
|
+
sans: "Helvetica,Arial, sans serif",
|
11
|
+
serif: "Georgia, Times New Roaman,serif",
|
12
|
+
monospace: "Monaco, Courier New,monospace",
|
13
|
+
roboto: "'Roboto', sans-serif",
|
14
|
+
qwitcher: "'Qwitcher Grypen', cursive",
|
15
|
+
garamond: "'EB Garamond', serif",
|
16
|
+
anton: "'Anton', sans-serif",
|
17
|
+
dmserif: "'DM Serif Text', serif",
|
18
|
+
inter: "'Inter', sans-serif",
|
19
|
+
libre: "'Libre Baskerville', serif",
|
20
|
+
montserrat: "'Montserrat', sans-serif",
|
21
|
+
opensans: "'Open Sans', sans-serif",
|
22
|
+
publicsans: "'Public Sans', sans-serif",
|
23
|
+
raleway: "'Raleway', sans-serif",
|
24
|
+
spacemono: "'Space Mono', sans-serif",
|
25
|
+
bulgarian: "'Bulgarian Garamond', monospace",
|
26
|
+
impact: "'Impact', serif",
|
27
|
+
redacted: "'Redacted Script', cursive",
|
28
|
+
greatVibes: "'Great Vibes', cursive",
|
29
|
+
zeyada: "'Zeyada', cursive",
|
30
|
+
allura: "'Allura', cursive",
|
31
|
+
pinyon: "'Pinyon Script', cursive",
|
32
|
+
muellerhoff: "'Herr Von Muellerhoff', cursive",
|
33
|
+
dawning: "'Dawning of a New Day', cursive",
|
34
34
|
// New Font Added for Type Signature
|
35
|
-
comingsoon: '
|
36
|
-
dancingScript: '
|
37
|
-
engagement: "Engagement, cursive",
|
38
|
-
gaegu: "Gaegu, cursive",
|
39
|
-
ingridDarling: '
|
40
|
-
kitaOne: "
|
41
|
-
laBelleAurore: '
|
42
|
-
lobster: "Lobster, cursive",
|
43
|
-
meaCulpa: '
|
44
|
-
meddon: "Meddon, cursive",
|
45
|
-
merriWeather: "Merriweather, serif",
|
46
|
-
theGirlNextDoor: '
|
35
|
+
comingsoon: "'Coming Soon', cursive",
|
36
|
+
dancingScript: "'Dancing Script', cursive",
|
37
|
+
engagement: "'Engagement', cursive",
|
38
|
+
gaegu: "'Gaegu', cursive",
|
39
|
+
ingridDarling: "'Ingrid Darling', cursive",
|
40
|
+
kitaOne: "'Kite One', sans - serif",
|
41
|
+
laBelleAurore: "'La Belle Aurore', cursive",
|
42
|
+
lobster: "'Lobster', cursive",
|
43
|
+
meaCulpa: "'Mea Culpa', cursive",
|
44
|
+
meddon: "'Meddon', cursive",
|
45
|
+
merriWeather: "'Merriweather', serif",
|
46
|
+
theGirlNextDoor: "'The Girl Next Door', cursive"
|
47
47
|
};
|
48
48
|
export const fontOptions = Object.keys(fontFamilyMap).map(m => {
|
49
49
|
return {
|
@@ -62,10 +62,7 @@ export const signedTextFonts = Object.keys(fontFamilyMap).slice(-12).map(m => {
|
|
62
62
|
export const headingMap = {
|
63
63
|
headingOne: "32px",
|
64
64
|
headingTwo: "24px",
|
65
|
-
headingThree: "19px"
|
66
|
-
headingFour: "16px",
|
67
|
-
headingFive: "13px",
|
68
|
-
headingSix: "11px"
|
65
|
+
headingThree: "19px"
|
69
66
|
};
|
70
67
|
export const fontWeightOptions = [{
|
71
68
|
text: "Bold",
|
@@ -472,34 +472,6 @@ export const decodeString = str => {
|
|
472
472
|
console.log(err);
|
473
473
|
}
|
474
474
|
};
|
475
|
-
export const getContrastColor = color => {
|
476
|
-
let r, g, b;
|
477
|
-
|
478
|
-
// Check if the color is in hex format
|
479
|
-
if (color.startsWith("#")) {
|
480
|
-
r = parseInt(color.substring(1, 3), 16);
|
481
|
-
g = parseInt(color.substring(3, 5), 16);
|
482
|
-
b = parseInt(color.substring(5, 7), 16);
|
483
|
-
}
|
484
|
-
// Check if the color is in RGB/RGBA format
|
485
|
-
else if (color.startsWith("rgb")) {
|
486
|
-
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
487
|
-
.split(","); // Split the values into an array
|
488
|
-
|
489
|
-
r = parseInt(rgbValues[0]);
|
490
|
-
g = parseInt(rgbValues[1]);
|
491
|
-
b = parseInt(rgbValues[2]);
|
492
|
-
} else {
|
493
|
-
// If the format is not recognized, default to black text
|
494
|
-
return "#000000";
|
495
|
-
}
|
496
|
-
|
497
|
-
// Calculate relative luminance
|
498
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
499
|
-
|
500
|
-
// Return black for light colors, white for dark colors
|
501
|
-
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
502
|
-
};
|
503
475
|
export const onDeleteKey = (event, {
|
504
476
|
editor
|
505
477
|
}) => {
|
@@ -661,10 +633,6 @@ export const isRestrictedNode = (event, editor) => {
|
|
661
633
|
return isNodeRestricted;
|
662
634
|
}
|
663
635
|
};
|
664
|
-
export function capitalizeFirstLetter(str) {
|
665
|
-
if (!str) return str;
|
666
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
667
|
-
}
|
668
636
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
669
637
|
try {
|
670
638
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -683,13 +651,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
683
651
|
console.log(err);
|
684
652
|
}
|
685
653
|
};
|
686
|
-
export function isHavingSelection(editor) {
|
687
|
-
try {
|
688
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
689
|
-
} catch (err) {
|
690
|
-
console.log(err);
|
691
|
-
}
|
692
|
-
}
|
693
654
|
const omitNodes = ["site-settings", "page-settings"];
|
694
655
|
export function getInitialValue(value = [], readOnly) {
|
695
656
|
if (readOnly === "readonly" && value?.length) {
|
@@ -720,17 +681,20 @@ export function getInitialValue(value = [], readOnly) {
|
|
720
681
|
}
|
721
682
|
return value;
|
722
683
|
}
|
684
|
+
export function capitalizeFirstLetter(str) {
|
685
|
+
if (!str) return str;
|
686
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
687
|
+
}
|
688
|
+
export function isHavingSelection(editor) {
|
689
|
+
try {
|
690
|
+
return editor?.selection && !Range.isCollapsed(editor.selection);
|
691
|
+
} catch (err) {
|
692
|
+
console.log(err);
|
693
|
+
}
|
694
|
+
}
|
723
695
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
724
696
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
725
697
|
}
|
726
|
-
export function handleNegativeInteger(val) {
|
727
|
-
return val < 0 ? 0 : val;
|
728
|
-
}
|
729
|
-
export const containsSurrogatePair = text => {
|
730
|
-
// Match surrogate pairs (high and low surrogate)
|
731
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
732
|
-
return surrogatePairRegex.test(text);
|
733
|
-
};
|
734
698
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
735
699
|
try {
|
736
700
|
const options = {
|
@@ -744,6 +708,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
744
708
|
return [];
|
745
709
|
}
|
746
710
|
};
|
711
|
+
export const containsSurrogatePair = text => {
|
712
|
+
// Match surrogate pairs (high and low surrogate)
|
713
|
+
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
714
|
+
return surrogatePairRegex.test(text);
|
715
|
+
};
|
747
716
|
export const getSlateDom = (editor, range) => {
|
748
717
|
try {
|
749
718
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -793,33 +762,6 @@ export const hideSlateSelection = () => {
|
|
793
762
|
const root = document.documentElement;
|
794
763
|
root.style.setProperty("--slate-highlight-bg", "none");
|
795
764
|
};
|
796
|
-
export
|
797
|
-
|
798
|
-
|
799
|
-
} = editor;
|
800
|
-
if (selection && Range.isExpanded(selection)) {
|
801
|
-
if (Range.includes(selection, Editor.start(editor, [])) && Range.includes(selection, Editor.end(editor, []))) {
|
802
|
-
return true;
|
803
|
-
} else {
|
804
|
-
return false;
|
805
|
-
}
|
806
|
-
}
|
807
|
-
};
|
808
|
-
export const getCurrentNodeText = editor => {
|
809
|
-
try {
|
810
|
-
const {
|
811
|
-
selection
|
812
|
-
} = editor;
|
813
|
-
if (selection) {
|
814
|
-
const [block] = Editor.node(editor, selection, {
|
815
|
-
match: n => Editor.isBlock(editor, n)
|
816
|
-
});
|
817
|
-
const blockText = block?.text;
|
818
|
-
return blockText;
|
819
|
-
} else {
|
820
|
-
return;
|
821
|
-
}
|
822
|
-
} catch (error) {
|
823
|
-
console.log("Error:", error);
|
824
|
-
}
|
825
|
-
};
|
765
|
+
export function handleNegativeInteger(val) {
|
766
|
+
return val < 0 ? 0 : val;
|
767
|
+
}
|
@@ -3,7 +3,7 @@ import { isBlockActive } from "./SlateUtilityFunctions";
|
|
3
3
|
export const createLinkNode = (href, showInNewTab, text, linkType) => ({
|
4
4
|
type: "link",
|
5
5
|
href,
|
6
|
-
target: showInNewTab
|
6
|
+
target: showInNewTab ? "_blank" : "_self",
|
7
7
|
linkType,
|
8
8
|
children: [{
|
9
9
|
text
|
@@ -174,14 +174,6 @@ export class TableUtil {
|
|
174
174
|
Transforms.removeNodes(this.editor, {
|
175
175
|
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
176
176
|
});
|
177
|
-
if (this.editor.children.length === 0) {
|
178
|
-
Transforms.insertNodes(this.editor, {
|
179
|
-
type: "paragraph",
|
180
|
-
children: [{
|
181
|
-
text: ""
|
182
|
-
}]
|
183
|
-
});
|
184
|
-
}
|
185
177
|
}
|
186
178
|
};
|
187
179
|
duplicateTable = () => {
|