@flozy/editor 3.6.6 → 3.6.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +166 -109
- package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
- package/dist/Editor/Elements/Button/EditorButton.js +25 -14
- package/dist/Editor/Elements/Color Picker/ColorButtons.js +60 -17
- package/dist/Editor/Elements/Color Picker/ColorPicker.css +25 -1
- package/dist/Editor/Elements/Color Picker/ColorPicker.js +4 -4
- package/dist/Editor/Elements/Color Picker/Styles.js +2 -1
- package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +1 -0
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +2 -0
- package/dist/Editor/Elements/Grid/GridItem.js +3 -1
- package/dist/Editor/Elements/Link/Link.js +6 -1
- package/dist/Editor/Elements/Link/LinkButton.js +4 -2
- package/dist/Editor/Elements/Link/LinkPopup.js +11 -3
- package/dist/Editor/Elements/Link/LinkPopupStyles.js +28 -0
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/FormatTools/Dropdown.js +26 -2
- package/dist/Editor/Toolbar/FormatTools/MarkButton.js +2 -2
- package/dist/Editor/Toolbar/FormatTools/TextSize.js +5 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectFontSize.js +4 -11
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/SelectTypography.js +213 -86
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +2 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +20 -13
- package/dist/Editor/Toolbar/PopupTool/TextFormat.js +52 -7
- package/dist/Editor/Toolbar/PopupTool/ThemeTextFormat.js +438 -0
- package/dist/Editor/Toolbar/PopupTool/index.js +4 -2
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/ThemeIcons.js +291 -0
- package/dist/Editor/common/ColorPickerButton.js +25 -9
- package/dist/Editor/common/CustomColorPicker/index.js +106 -0
- package/dist/Editor/common/CustomColorPicker/style.js +53 -0
- package/dist/Editor/common/CustomDialog/index.js +94 -0
- package/dist/Editor/common/CustomDialog/style.js +67 -0
- package/dist/Editor/common/CustomSelect.js +33 -0
- package/dist/Editor/common/DnD/DragHandleButton.js +1 -1
- package/dist/Editor/common/Icon.js +30 -2
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +13 -3
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +15 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/color.js +31 -7
- package/dist/Editor/common/StyleBuilder/fieldTypes/fontSize.js +13 -4
- package/dist/Editor/common/StyleBuilder/fieldTypes/textOptions.js +14 -4
- package/dist/Editor/common/StyleBuilder/index.js +1 -1
- package/dist/Editor/helper/theme.js +190 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -1
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +47 -5
- package/dist/Editor/plugins/withTable.js +1 -1
- package/dist/Editor/theme/ThemeList.js +50 -173
- package/dist/Editor/theme/index.js +144 -0
- package/dist/Editor/themeSettings/ActiveTheme.js +72 -0
- package/dist/Editor/themeSettings/buttons/index.js +290 -0
- package/dist/Editor/themeSettings/buttons/style.js +21 -0
- package/dist/Editor/themeSettings/colorTheme/index.js +290 -0
- package/dist/Editor/themeSettings/colorTheme/style.js +77 -0
- package/dist/Editor/themeSettings/fonts/PreviewElement.js +123 -0
- package/dist/Editor/themeSettings/fonts/index.js +213 -0
- package/dist/Editor/themeSettings/fonts/style.js +44 -0
- package/dist/Editor/themeSettings/icons.js +60 -0
- package/dist/Editor/themeSettings/index.js +320 -0
- package/dist/Editor/themeSettings/style.js +152 -0
- package/dist/Editor/themeSettingsAI/icons.js +96 -0
- package/dist/Editor/themeSettingsAI/index.js +356 -0
- package/dist/Editor/themeSettingsAI/saveTheme.js +190 -0
- package/dist/Editor/themeSettingsAI/style.js +247 -0
- package/dist/Editor/utils/SlateUtilityFunctions.js +157 -25
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +50 -12
- package/package.json +1 -1
@@ -216,6 +216,17 @@ const getScrollElement = () => {
|
|
216
216
|
const scrollFrom = isSlateWrapperScroll ? slateWrapper : window;
|
217
217
|
return scrollFrom;
|
218
218
|
};
|
219
|
+
const handleLinkBtnClick = (e, props) => {
|
220
|
+
if (e) {
|
221
|
+
e.preventDefault();
|
222
|
+
e.stopPropagation();
|
223
|
+
}
|
224
|
+
if (props.target) {
|
225
|
+
window.open(props.href);
|
226
|
+
} else {
|
227
|
+
window.location.href = props.href;
|
228
|
+
}
|
229
|
+
};
|
219
230
|
export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
|
220
231
|
const props = {};
|
221
232
|
if (!readOnly) {
|
@@ -306,23 +317,22 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
306
317
|
|
307
318
|
// for iphone fix
|
308
319
|
if (props.component === "a" && props.href) {
|
309
|
-
|
320
|
+
const isMobile = getDevice(window.innerWidth) === "xs";
|
321
|
+
if (isMobile) {
|
310
322
|
props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
|
311
323
|
}
|
312
324
|
|
325
|
+
let touchEndClicked = false;
|
313
326
|
props.onTouchEnd = e => {
|
314
|
-
|
315
|
-
|
316
|
-
e.preventDefault();
|
317
|
-
e.stopPropagation();
|
318
|
-
}
|
319
|
-
if (props.target) {
|
320
|
-
window.open(props.href);
|
321
|
-
} else {
|
322
|
-
window.location.href = props.href;
|
323
|
-
}
|
327
|
+
touchEndClicked = true;
|
328
|
+
handleLinkBtnClick(e, props);
|
324
329
|
};
|
325
|
-
props.onClick =
|
330
|
+
props.onClick = e => {
|
331
|
+
// This condition is used for mobile preview in the page editor.
|
332
|
+
// 'touchEnd' will not work in the mobile page preview.
|
333
|
+
if (!touchEndClicked && isMobile) {
|
334
|
+
handleLinkBtnClick(e, props);
|
335
|
+
}
|
326
336
|
return false;
|
327
337
|
};
|
328
338
|
}
|
@@ -367,4 +377,32 @@ export const decodeString = str => {
|
|
367
377
|
} catch (err) {
|
368
378
|
console.log(err);
|
369
379
|
}
|
380
|
+
};
|
381
|
+
export const getContrastColor = color => {
|
382
|
+
let r, g, b;
|
383
|
+
|
384
|
+
// Check if the color is in hex format
|
385
|
+
if (color.startsWith("#")) {
|
386
|
+
r = parseInt(color.substring(1, 3), 16);
|
387
|
+
g = parseInt(color.substring(3, 5), 16);
|
388
|
+
b = parseInt(color.substring(5, 7), 16);
|
389
|
+
}
|
390
|
+
// Check if the color is in RGB/RGBA format
|
391
|
+
else if (color.startsWith("rgb")) {
|
392
|
+
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
393
|
+
.split(","); // Split the values into an array
|
394
|
+
|
395
|
+
r = parseInt(rgbValues[0]);
|
396
|
+
g = parseInt(rgbValues[1]);
|
397
|
+
b = parseInt(rgbValues[2]);
|
398
|
+
} else {
|
399
|
+
// If the format is not recognized, default to black text
|
400
|
+
return "#000000";
|
401
|
+
}
|
402
|
+
|
403
|
+
// Calculate relative luminance
|
404
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
405
|
+
|
406
|
+
// Return black for light colors, white for dark colors
|
407
|
+
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
370
408
|
};
|