@flozy/editor 9.3.6 → 9.3.7
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 +16 -52
- package/dist/Editor/CommonEditor.js +23 -133
- package/dist/Editor/DialogWrapper.js +25 -31
- package/dist/Editor/Editor.css +9 -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 +14 -60
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +1 -25
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +3 -3
- 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 +3 -4
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/MultiSelectType.js +5 -23
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/TextType.js +2 -7
- 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 +38 -64
- 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/TableStyles.js +1 -4
- package/dist/Editor/Elements/DataView/Layouts/TableView.js +4 -6
- 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 +12 -18
- 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 +25 -63
- package/dist/Editor/Elements/FreeGrid/FreeGridBox.js +4 -22
- package/dist/Editor/Elements/FreeGrid/FreeGridButton.js +2 -6
- package/dist/Editor/Elements/FreeGrid/FreeGridItem.js +5 -34
- 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 +7 -14
- 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 +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 +25 -48
- package/dist/Editor/Elements/Table/TableCell.js +27 -10
- 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/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 -7
- package/dist/Editor/Toolbar/Mini/MiniToolbar.js +15 -20
- 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 +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 +9 -16
- package/dist/Editor/Toolbar/PopupTool/TemplateCard.js +5 -11
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +44 -126
- package/dist/Editor/Toolbar/PopupTool/index.js +17 -6
- package/dist/Editor/Toolbar/Toolbar.js +10 -20
- package/dist/Editor/Toolbar/toolbarGroups.js +6 -48
- package/dist/Editor/assets/svg/CalenderIconTick.js +0 -1
- package/dist/Editor/common/ColorPickerButton.js +10 -45
- package/dist/Editor/common/CustomDialog/index.js +10 -8
- package/dist/Editor/common/CustomDialog/styles.js +1 -1
- 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 -46
- package/dist/Editor/common/ImageSelector/ImageSelector.js +8 -10
- package/dist/Editor/common/ImageSelector/Options/AddLink.js +4 -6
- package/dist/Editor/common/ImageSelector/Options/Upload.js +1 -1
- package/dist/Editor/common/ImageSelector/Styles.js +9 -3
- package/dist/Editor/common/ImageSelector/UploadStyles.js +9 -9
- 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 +73 -111
- package/dist/Editor/common/MentionsPopup/index.js +4 -8
- 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 -6
- package/dist/Editor/common/RnD/ElementSettings/Settings/VideoSettings.js +2 -3
- package/dist/Editor/common/RnD/ElementSettings/styles.js +1 -0
- 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 +7 -58
- package/dist/Editor/common/RnD/Utils/index.js +0 -48
- package/dist/Editor/common/RnD/VirtualElement/index.js +104 -186
- package/dist/Editor/common/RnD/VirtualElement/styles.js +8 -95
- package/dist/Editor/common/RnD/VirtualElement/updateAutoProps.js +3 -5
- package/dist/Editor/common/RnD/index.js +10 -82
- package/dist/Editor/common/Section/index.js +4 -7
- package/dist/Editor/common/Shorthands/elements.js +10 -98
- 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/StyleBuilder/pageSettingsStyle.js +7 -5
- package/dist/Editor/common/Uploader.js +5 -16
- package/dist/Editor/commonStyle.js +23 -13
- package/dist/Editor/helper/index.js +12 -8
- package/dist/Editor/helper/theme.js +2 -200
- package/dist/Editor/hooks/useDrag.js +11 -17
- package/dist/Editor/hooks/useEditorScroll.js +6 -10
- package/dist/Editor/hooks/useMouseMove.js +13 -28
- package/dist/Editor/hooks/useTable.js +2 -5
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +15 -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 +47 -171
- package/dist/Editor/utils/button.js +2 -7
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +0 -23
- package/dist/Editor/utils/dataView.js +2 -5
- package/dist/Editor/utils/divider.js +2 -18
- package/dist/Editor/utils/draftToSlate.js +2 -3
- package/dist/Editor/utils/embed.js +4 -9
- package/dist/Editor/utils/font.js +37 -40
- package/dist/Editor/utils/freegrid.js +2 -2
- package/dist/Editor/utils/helper.js +29 -136
- package/dist/Editor/utils/signature.js +2 -5
- package/dist/Editor/utils/table.js +37 -53
- package/package.json +2 -2
- package/dist/Editor/Elements/DataView/Layouts/DataTypes/Components/MultiSelect.js +0 -422
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +0 -441
- package/dist/Editor/assets/svg/ClearAllRounded.js +0 -31
- package/dist/Editor/assets/svg/ThemeIcons.js +0 -291
- package/dist/Editor/common/CustomColorPicker/index.js +0 -125
- 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 -33
- package/dist/Editor/common/RnD/Theme/MainThemeProvider.js +0 -17
- package/dist/Editor/common/RnD/VirtualElement/ForceAutoAlignment.js +0 -110
- package/dist/Editor/common/RnD/VirtualElement/VirtualTextElement.js +0 -112
- package/dist/Editor/common/RnD/VirtualElement/helper.js +0 -267
- 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/theme/index.js +0 -144
- package/dist/Editor/themeSettings/ActiveTheme.js +0 -72
- package/dist/Editor/themeSettings/buttons/index.js +0 -285
- package/dist/Editor/themeSettings/buttons/style.js +0 -23
- package/dist/Editor/themeSettings/colorTheme/index.js +0 -297
- 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 -222
- package/dist/Editor/themeSettings/fonts/style.js +0 -59
- package/dist/Editor/themeSettings/icons.js +0 -60
- package/dist/Editor/themeSettings/index.js +0 -328
- package/dist/Editor/themeSettings/style.js +0 -193
- package/dist/Editor/themeSettingsAI/icons.js +0 -96
- package/dist/Editor/themeSettingsAI/index.js +0 -355
- package/dist/Editor/themeSettingsAI/saveTheme.js +0 -215
- package/dist/Editor/themeSettingsAI/style.js +0 -250
@@ -261,15 +261,7 @@ export const customInsertNode = (editor, insertNode, defaultInsertOptions = {})
|
|
261
261
|
if (isListItem) {
|
262
262
|
insertOptions.at = editor.selection.focus;
|
263
263
|
}
|
264
|
-
|
265
|
-
if (hasText) {
|
266
|
-
Transforms.insertNodes(editor, insertNode, {
|
267
|
-
at: Path.next(Path.parent(editor?.selection.focus.path)),
|
268
|
-
select: true
|
269
|
-
});
|
270
|
-
} else {
|
271
|
-
Transforms.insertNodes(editor, insertNode, insertOptions);
|
272
|
-
}
|
264
|
+
Transforms.insertNodes(editor, insertNode, insertOptions);
|
273
265
|
insertNewLine(editor);
|
274
266
|
};
|
275
267
|
export const decodeAndParseBase64 = encodedString => {
|
@@ -480,34 +472,6 @@ export const decodeString = str => {
|
|
480
472
|
console.log(err);
|
481
473
|
}
|
482
474
|
};
|
483
|
-
export const getContrastColor = color => {
|
484
|
-
let r, g, b;
|
485
|
-
|
486
|
-
// Check if the color is in hex format
|
487
|
-
if (color.startsWith("#")) {
|
488
|
-
r = parseInt(color.substring(1, 3), 16);
|
489
|
-
g = parseInt(color.substring(3, 5), 16);
|
490
|
-
b = parseInt(color.substring(5, 7), 16);
|
491
|
-
}
|
492
|
-
// Check if the color is in RGB/RGBA format
|
493
|
-
else if (color.startsWith("rgb")) {
|
494
|
-
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
495
|
-
.split(","); // Split the values into an array
|
496
|
-
|
497
|
-
r = parseInt(rgbValues[0]);
|
498
|
-
g = parseInt(rgbValues[1]);
|
499
|
-
b = parseInt(rgbValues[2]);
|
500
|
-
} else {
|
501
|
-
// If the format is not recognized, default to black text
|
502
|
-
return "#000000";
|
503
|
-
}
|
504
|
-
|
505
|
-
// Calculate relative luminance
|
506
|
-
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
507
|
-
|
508
|
-
// Return black for light colors, white for dark colors
|
509
|
-
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
510
|
-
};
|
511
475
|
export const onDeleteKey = (event, {
|
512
476
|
editor
|
513
477
|
}) => {
|
@@ -624,38 +588,20 @@ export const getNextNode = editor => {
|
|
624
588
|
return;
|
625
589
|
}
|
626
590
|
};
|
627
|
-
export const
|
591
|
+
export const getPreviousNode = editor => {
|
628
592
|
try {
|
629
|
-
const
|
630
|
-
|
631
|
-
|
632
|
-
});
|
633
|
-
if (!prevEntry) return null;
|
634
|
-
const [previousNode, previousPath] = prevEntry;
|
593
|
+
const parentPath = Path.parent(editor?.selection?.anchor?.path);
|
594
|
+
const previousPath = Path.previous(parentPath);
|
595
|
+
const previousNode = Node.get(editor, previousPath);
|
635
596
|
return {
|
636
597
|
previousNode,
|
637
598
|
previousPath
|
638
599
|
};
|
639
|
-
} catch (
|
640
|
-
return;
|
641
|
-
}
|
642
|
-
};
|
643
|
-
export const getCurrentEntry = editor => {
|
644
|
-
try {
|
645
|
-
const currentEntry = Editor.node(editor, editor.selection, {
|
646
|
-
depth: 1
|
647
|
-
});
|
648
|
-
if (!currentEntry) return null;
|
649
|
-
const [currentNode, currentPath] = currentEntry;
|
650
|
-
return {
|
651
|
-
currentNode,
|
652
|
-
currentPath
|
653
|
-
};
|
654
|
-
} catch (error) {
|
600
|
+
} catch (err) {
|
655
601
|
return;
|
656
602
|
}
|
657
603
|
};
|
658
|
-
const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.
|
604
|
+
const isRestricted = node => node?.type === "page-settings" || node?.type === "site-settings" || node?.children?.some(child => child.type === "dataView");
|
659
605
|
export const isRestrictedNode = (event, editor) => {
|
660
606
|
let isNodeRestricted = false;
|
661
607
|
try {
|
@@ -669,50 +615,15 @@ export const isRestrictedNode = (event, editor) => {
|
|
669
615
|
const {
|
670
616
|
previousNode,
|
671
617
|
previousPath
|
672
|
-
} =
|
673
|
-
|
674
|
-
currentNode
|
675
|
-
} = getCurrentEntry(editor) || {};
|
676
|
-
if (currentNode?.type === "orderedList" || currentNode?.type === "unorderedList") {
|
677
|
-
event.preventDefault();
|
678
|
-
const path = selection?.anchor?.path;
|
679
|
-
if (!path) return;
|
680
|
-
|
681
|
-
// Lift the selected list-item out of the list
|
682
|
-
Transforms.liftNodes(editor, {
|
683
|
-
match: n => n.type === "list-item"
|
684
|
-
});
|
685
|
-
|
686
|
-
// Convert the lifted list-item into a paragraph
|
687
|
-
Transforms.setNodes(editor, {
|
688
|
-
type: "paragraph"
|
689
|
-
}, {
|
690
|
-
match: n => n.type === "list-item"
|
691
|
-
});
|
692
|
-
|
693
|
-
// Move focus to the modified paragraph (same path)
|
694
|
-
Transforms.select(editor, path);
|
695
|
-
} else if (isRestricted(previousNode)) {
|
618
|
+
} = getPreviousNode(editor) || {};
|
619
|
+
if (isRestricted(previousNode)) {
|
696
620
|
event.preventDefault(); // stops deleting backward
|
697
621
|
|
698
622
|
// move the cursor to node which is before page-settings node
|
699
|
-
const pathBeforePageSettings = Path.previous(
|
623
|
+
const pathBeforePageSettings = Path.previous(previousPath);
|
700
624
|
const endPath = Editor.end(editor, pathBeforePageSettings);
|
701
625
|
Transforms.select(editor, endPath);
|
702
626
|
isNodeRestricted = true;
|
703
|
-
} else if (previousNode?.type === "divider") {
|
704
|
-
event.preventDefault();
|
705
|
-
Transforms.removeNodes(editor, {
|
706
|
-
at: previousPath
|
707
|
-
});
|
708
|
-
Transforms.insertNodes(editor, {
|
709
|
-
type: "paragraph",
|
710
|
-
children: [{
|
711
|
-
text: " "
|
712
|
-
}]
|
713
|
-
}, {
|
714
|
-
at: previousPath
|
715
|
-
});
|
716
627
|
}
|
717
628
|
}
|
718
629
|
return isNodeRestricted;
|
@@ -722,10 +633,6 @@ export const isRestrictedNode = (event, editor) => {
|
|
722
633
|
return isNodeRestricted;
|
723
634
|
}
|
724
635
|
};
|
725
|
-
export function capitalizeFirstLetter(str) {
|
726
|
-
if (!str) return str;
|
727
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
728
|
-
}
|
729
636
|
export const insertLineBreakAtEndOfPath = (editor, path) => {
|
730
637
|
try {
|
731
638
|
const [node, nodePath] = Editor.node(editor, path); // Get the node at the specified path
|
@@ -744,13 +651,6 @@ export const insertLineBreakAtEndOfPath = (editor, path) => {
|
|
744
651
|
console.log(err);
|
745
652
|
}
|
746
653
|
};
|
747
|
-
export function isHavingSelection(editor) {
|
748
|
-
try {
|
749
|
-
return editor?.selection && !Range.isCollapsed(editor.selection);
|
750
|
-
} catch (err) {
|
751
|
-
console.log(err);
|
752
|
-
}
|
753
|
-
}
|
754
654
|
const omitNodes = ["site-settings", "page-settings"];
|
755
655
|
export function getInitialValue(value = [], readOnly) {
|
756
656
|
if (readOnly === "readonly" && value?.length) {
|
@@ -781,17 +681,20 @@ export function getInitialValue(value = [], readOnly) {
|
|
781
681
|
}
|
782
682
|
return value;
|
783
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
|
+
}
|
784
695
|
export function getSelectedCls(defaultCls = "", selected, selectedClsName = "selected") {
|
785
696
|
return `${defaultCls} ${selected ? selectedClsName : ""}`;
|
786
697
|
}
|
787
|
-
export function handleNegativeInteger(val) {
|
788
|
-
return val < 0 ? 0 : val;
|
789
|
-
}
|
790
|
-
export const containsSurrogatePair = text => {
|
791
|
-
// Match surrogate pairs (high and low surrogate)
|
792
|
-
const surrogatePairRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
793
|
-
return surrogatePairRegex.test(text);
|
794
|
-
};
|
795
698
|
export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
796
699
|
try {
|
797
700
|
const options = {
|
@@ -805,6 +708,11 @@ export const getNodeWithType = (editor, nodeType = "", otherOptions) => {
|
|
805
708
|
return [];
|
806
709
|
}
|
807
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
|
+
};
|
808
716
|
export const getSlateDom = (editor, range) => {
|
809
717
|
try {
|
810
718
|
const slateDom = ReactEditor.toDOMRange(editor, range);
|
@@ -854,6 +762,9 @@ export const hideSlateSelection = () => {
|
|
854
762
|
const root = document.documentElement;
|
855
763
|
root.style.setProperty("--slate-highlight-bg", "none");
|
856
764
|
};
|
765
|
+
export function handleNegativeInteger(val) {
|
766
|
+
return val < 0 ? 0 : val;
|
767
|
+
}
|
857
768
|
export const isEverythingSelected = editor => {
|
858
769
|
const {
|
859
770
|
selection
|
@@ -865,22 +776,4 @@ export const isEverythingSelected = editor => {
|
|
865
776
|
return false;
|
866
777
|
}
|
867
778
|
}
|
868
|
-
};
|
869
|
-
export const getCurrentNodeText = editor => {
|
870
|
-
try {
|
871
|
-
const {
|
872
|
-
selection
|
873
|
-
} = editor;
|
874
|
-
if (selection) {
|
875
|
-
const [block] = Editor.node(editor, selection, {
|
876
|
-
match: n => Editor.isBlock(editor, n)
|
877
|
-
});
|
878
|
-
const blockText = block?.text;
|
879
|
-
return blockText;
|
880
|
-
} else {
|
881
|
-
return;
|
882
|
-
}
|
883
|
-
} catch (error) {
|
884
|
-
console.log("Error:", error);
|
885
|
-
}
|
886
779
|
};
|
@@ -1,9 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { Transforms } from "slate";
|
2
2
|
import insertNewLine from "./insertNewLine";
|
3
|
-
import { getCurrentElementText } from "../plugins/withHTML";
|
4
3
|
export const insertSignature = editor => {
|
5
|
-
const hasText = getCurrentElementText(editor);
|
6
|
-
const insertPath = hasText ? Path.next(Path.parent(editor?.selection.focus.path)) : editor.selection.anchor.path;
|
7
4
|
const signature = {
|
8
5
|
type: "signature",
|
9
6
|
alignment: "center",
|
@@ -18,7 +15,7 @@ export const insertSignature = editor => {
|
|
18
15
|
}]
|
19
16
|
};
|
20
17
|
Transforms.insertNodes(editor, signature, {
|
21
|
-
at:
|
18
|
+
at: editor.selection.anchor.path
|
22
19
|
});
|
23
20
|
insertNewLine(editor);
|
24
21
|
};
|
@@ -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 = () => {
|
@@ -450,53 +442,51 @@ export class TableUtil {
|
|
450
442
|
at: currentTablePath
|
451
443
|
});
|
452
444
|
Transforms.setNodes(this.editor, {
|
453
|
-
...rowProps
|
445
|
+
...rowProps,
|
446
|
+
tableBorder: tableProps?.borderColor
|
454
447
|
}, {
|
455
448
|
at: currentRowPath
|
456
449
|
});
|
457
450
|
Transforms.setNodes(this.editor, {
|
458
|
-
...cellProps
|
451
|
+
...cellProps,
|
452
|
+
rowBorder: rowProps?.borderColor,
|
453
|
+
tableBorder: tableProps?.borderColor
|
459
454
|
}, {
|
460
455
|
at: currentCellPath
|
461
456
|
});
|
462
457
|
applyColumnStyle(this.editor, currentCellPath, currentTablePath, cellProps, tableProps?.rows);
|
463
458
|
|
464
459
|
// cell bg entire
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
// },
|
478
|
-
// { at: [currentCellPath[0], r, currentCellPath[2]] }
|
479
|
-
// );
|
480
|
-
// }
|
481
|
-
// }
|
460
|
+
if (cellProps?.entireBgColor || tableProps?.borderColor || rowProps?.borderColor) {
|
461
|
+
const {
|
462
|
+
rows
|
463
|
+
} = tableProps;
|
464
|
+
for (let r = 0; r < rows; r++) {
|
465
|
+
Transforms.setNodes(this.editor, {
|
466
|
+
entireBgColor: cellProps?.entireBgColor
|
467
|
+
}, {
|
468
|
+
at: [currentCellPath[0], r, currentCellPath[2]]
|
469
|
+
});
|
470
|
+
}
|
471
|
+
}
|
482
472
|
|
483
473
|
// cell border all
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
474
|
+
if (tableProps?.borderColor || rowProps?.borderColor) {
|
475
|
+
const {
|
476
|
+
rows,
|
477
|
+
columns
|
478
|
+
} = tableProps;
|
479
|
+
for (let r = 0; r < rows; r++) {
|
480
|
+
for (let c = 0; c < columns; c++) {
|
481
|
+
Transforms.setNodes(this.editor, {
|
482
|
+
entireBorderColor: tableProps?.borderColor,
|
483
|
+
rowBorder: rowProps?.borderColor
|
484
|
+
}, {
|
485
|
+
at: [currentCellPath[0], r, c]
|
486
|
+
});
|
487
|
+
}
|
488
|
+
}
|
489
|
+
}
|
500
490
|
}
|
501
491
|
} catch (err) {
|
502
492
|
console.log(err);
|
@@ -510,25 +500,19 @@ export class TableUtil {
|
|
510
500
|
at: path
|
511
501
|
});
|
512
502
|
};
|
513
|
-
getTableProps =
|
503
|
+
getTableProps = () => {
|
514
504
|
const {
|
515
505
|
selection
|
516
506
|
} = this.editor;
|
517
|
-
const options = {
|
518
|
-
...(otherOptions || {})
|
519
|
-
};
|
520
507
|
if (!!selection && Range.isCollapsed(selection)) {
|
521
508
|
const [tableNode] = Editor.nodes(this.editor, {
|
522
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
523
|
-
...options
|
509
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table"
|
524
510
|
});
|
525
511
|
const [tableCellNode] = Editor.nodes(this.editor, {
|
526
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
527
|
-
...options
|
512
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-cell"
|
528
513
|
});
|
529
514
|
const [tableRowNode] = Editor.nodes(this.editor, {
|
530
|
-
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
531
|
-
...options
|
515
|
+
match: n => !Editor.isEditor(n) && Element.isElement(n) && n.type === "table-row"
|
532
516
|
});
|
533
517
|
if (tableNode && tableCellNode && tableRowNode) {
|
534
518
|
const [currentTable, currentTablePath] = tableNode;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "9.3.
|
3
|
+
"version": "9.3.7",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -61,7 +61,7 @@
|
|
61
61
|
"scripts": {
|
62
62
|
"prepare": "husky install .husky",
|
63
63
|
"analyze": "source-map-explorer build/static/js/*.js",
|
64
|
-
"lint": "./node_modules/.bin/eslint --ignore-path .gitignore .",
|
64
|
+
"lint": "./node_modules/. bin/eslint --ignore-path .gitignore .",
|
65
65
|
"start": "craco start",
|
66
66
|
"build": "NODE_OPTIONS='--max_old_space_size=4096' craco build",
|
67
67
|
"test": "craco test --passWithNoTests",
|