@flozy/editor 3.8.0 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/CommonEditor.js +169 -111
- package/dist/Editor/Editor.css +1 -12
- package/dist/Editor/Elements/AI/AIInput.js +16 -5
- package/dist/Editor/Elements/AI/PopoverAIInput.js +31 -17
- package/dist/Editor/Elements/AI/Styles.js +2 -1
- package/dist/Editor/Elements/AI/VoiceToText/AudioWave.js +73 -0
- package/dist/Editor/Elements/AI/VoiceToText/index.js +167 -0
- package/dist/Editor/Elements/AI/VoiceToText/style.js +40 -0
- package/dist/Editor/Elements/Accordion/Accordion.js +74 -7
- package/dist/Editor/Elements/Accordion/AccordionBtnPopup.js +3 -2
- package/dist/Editor/Elements/Accordion/AccordionSummary.js +7 -74
- package/dist/Editor/Elements/AppHeader/AppHeader.js +26 -4
- package/dist/Editor/Elements/Button/EditorButton.js +28 -16
- 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/Image.js +28 -20
- package/dist/Editor/Elements/Embed/Video.js +15 -11
- 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/Table.js +1 -1
- 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 +6 -5
- package/dist/Editor/Toolbar/toolbarGroups.js +48 -6
- package/dist/Editor/assets/svg/AIIcons.js +153 -1
- 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/EditorCmds.js +35 -0
- package/dist/Editor/common/Icon.js +30 -2
- package/dist/Editor/common/LinkSettings/NavComponents.js +5 -2
- package/dist/Editor/common/LinkSettings/index.js +2 -1
- package/dist/Editor/common/LinkSettings/navOptions.js +7 -2
- package/dist/Editor/common/MentionsPopup/Styles.js +5 -2
- package/dist/Editor/common/Shorthands/elements.js +54 -0
- package/dist/Editor/common/StyleBuilder/accordionTitleBtnStyle.js +7 -7
- package/dist/Editor/common/StyleBuilder/accordionTitleStyle.js +16 -16
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +4 -2
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +33 -29
- package/dist/Editor/common/StyleBuilder/fieldTypes/borderRadius.js +31 -25
- package/dist/Editor/common/StyleBuilder/fieldTypes/buttonLink.js +1 -1
- 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 +189 -4
- package/dist/Editor/hooks/useEditorTheme.js +139 -0
- package/dist/Editor/hooks/useMouseMove.js +4 -2
- package/dist/Editor/plugins/withEmbeds.js +1 -1
- package/dist/Editor/plugins/withHTML.js +47 -5
- package/dist/Editor/plugins/withLayout.js +15 -10
- package/dist/Editor/plugins/withTable.js +2 -2
- 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 +161 -25
- package/dist/Editor/utils/button.js +1 -17
- package/dist/Editor/utils/events.js +11 -4
- package/dist/Editor/utils/font.js +40 -37
- package/dist/Editor/utils/helper.js +73 -13
- package/package.json +2 -1
@@ -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: "
|
14
|
-
qwitcher: "
|
15
|
-
garamond: "
|
16
|
-
anton: "
|
17
|
-
dmserif: "
|
18
|
-
inter: "
|
19
|
-
libre: "
|
20
|
-
montserrat: "
|
21
|
-
opensans: "
|
22
|
-
publicsans: "
|
23
|
-
raleway: "
|
24
|
-
spacemono: "
|
25
|
-
bulgarian: "
|
26
|
-
impact: "
|
27
|
-
redacted: "
|
28
|
-
greatVibes: "
|
29
|
-
zeyada: "
|
30
|
-
allura: "
|
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: "
|
38
|
-
gaegu: "
|
39
|
-
ingridDarling: "
|
40
|
-
kitaOne: "
|
41
|
-
laBelleAurore: "
|
42
|
-
lobster: "
|
43
|
-
meaCulpa: "
|
44
|
-
meddon: "
|
45
|
-
merriWeather: "
|
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: "Times",
|
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,5 +62,8 @@ 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"
|
65
|
+
"headingThree": "19px",
|
66
|
+
"headingFour": "16px",
|
67
|
+
"headingFive": "13px",
|
68
|
+
"headingSix": "11px"
|
66
69
|
};
|
@@ -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) {
|
@@ -235,7 +246,8 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
235
246
|
props.target = "_blank";
|
236
247
|
}
|
237
248
|
break;
|
238
|
-
case "
|
249
|
+
case "nextTrigger":
|
250
|
+
case "prevTrigger":
|
239
251
|
if (!readOnly) {
|
240
252
|
props.component = "button";
|
241
253
|
props.onClick = () => {};
|
@@ -306,23 +318,22 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
306
318
|
|
307
319
|
// for iphone fix
|
308
320
|
if (props.component === "a" && props.href) {
|
309
|
-
|
321
|
+
const isMobile = getDevice(window.innerWidth) === "xs";
|
322
|
+
if (isMobile) {
|
310
323
|
props.component = "button"; // iphone is opening two tabs, on open in new tab because of a tag.
|
311
324
|
}
|
312
325
|
|
326
|
+
let touchEndClicked = false;
|
313
327
|
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
|
-
}
|
328
|
+
touchEndClicked = true;
|
329
|
+
handleLinkBtnClick(e, props);
|
324
330
|
};
|
325
|
-
props.onClick =
|
331
|
+
props.onClick = e => {
|
332
|
+
// This condition is used for mobile preview in the page editor.
|
333
|
+
// 'touchEnd' will not work in the mobile page preview.
|
334
|
+
if (!touchEndClicked && isMobile) {
|
335
|
+
handleLinkBtnClick(e, props);
|
336
|
+
}
|
326
337
|
return false;
|
327
338
|
};
|
328
339
|
}
|
@@ -367,4 +378,53 @@ export const decodeString = str => {
|
|
367
378
|
} catch (err) {
|
368
379
|
console.log(err);
|
369
380
|
}
|
381
|
+
};
|
382
|
+
export const getContrastColor = color => {
|
383
|
+
let r, g, b;
|
384
|
+
|
385
|
+
// Check if the color is in hex format
|
386
|
+
if (color.startsWith("#")) {
|
387
|
+
r = parseInt(color.substring(1, 3), 16);
|
388
|
+
g = parseInt(color.substring(3, 5), 16);
|
389
|
+
b = parseInt(color.substring(5, 7), 16);
|
390
|
+
}
|
391
|
+
// Check if the color is in RGB/RGBA format
|
392
|
+
else if (color.startsWith("rgb")) {
|
393
|
+
const rgbValues = color.replace(/^rgba?\(|\s+|\)$/g, "") // Remove the rgb/rgba and spaces
|
394
|
+
.split(","); // Split the values into an array
|
395
|
+
|
396
|
+
r = parseInt(rgbValues[0]);
|
397
|
+
g = parseInt(rgbValues[1]);
|
398
|
+
b = parseInt(rgbValues[2]);
|
399
|
+
} else {
|
400
|
+
// If the format is not recognized, default to black text
|
401
|
+
return "#000000";
|
402
|
+
}
|
403
|
+
|
404
|
+
// Calculate relative luminance
|
405
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
406
|
+
|
407
|
+
// Return black for light colors, white for dark colors
|
408
|
+
return luminance > 0.5 ? "#000000" : "#FFFFFF";
|
409
|
+
};
|
410
|
+
export const onDeleteKey = (event, {
|
411
|
+
editor
|
412
|
+
}) => {
|
413
|
+
try {
|
414
|
+
const {
|
415
|
+
selection
|
416
|
+
} = editor;
|
417
|
+
if (selection) {
|
418
|
+
// If text is selected, delete the selection
|
419
|
+
Transforms.delete(editor);
|
420
|
+
} else {
|
421
|
+
// If no text is selected, handle deleting the next character/element
|
422
|
+
Transforms.delete(editor, {
|
423
|
+
unit: "character",
|
424
|
+
reverse: false
|
425
|
+
});
|
426
|
+
}
|
427
|
+
} catch (err) {
|
428
|
+
console.log(err);
|
429
|
+
}
|
370
430
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@flozy/editor",
|
3
|
-
"version": "3.8.
|
3
|
+
"version": "3.8.1",
|
4
4
|
"description": "An Editor for flozy app brain",
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -46,6 +46,7 @@
|
|
46
46
|
"slate-react": "^0.98.3",
|
47
47
|
"styled-components": "^5.3.11",
|
48
48
|
"use-debounce": "^10.0.0",
|
49
|
+
"wavesurfer.js": "^7.8.6",
|
49
50
|
"web-vitals": "^2.1.4",
|
50
51
|
"y-websocket": "^1.5.0",
|
51
52
|
"yjs": "^13.6.8"
|