@flozy/editor 3.6.1 → 3.6.2

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.
@@ -2,8 +2,7 @@ import React, { useState } from "react";
2
2
  import { Transforms } from "slate";
3
3
  import { ReactEditor, useSlateStatic } from "slate-react";
4
4
  import { IconButton, Tooltip, Box } from "@mui/material";
5
- // import * as fIcons from "@mui/icons-material";
6
- import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
5
+ import * as fIcons from "@mui/icons-material";
7
6
  import SettingsIcon from "@mui/icons-material/Settings";
8
7
  import OpenInNewIcon from "@mui/icons-material/OpenInNew";
9
8
  import LinkIcon from "@mui/icons-material/Link";
@@ -64,7 +63,7 @@ const EditorButton = props => {
64
63
  };
65
64
  const isTrigger = linkType === "actionTrigger";
66
65
  const refURl = isTrigger ? buttonLink?.url : url;
67
- const BtnIcon = buttonIcon ? buttonIcon : null;
66
+ const BtnIcon = buttonIcon ? fIcons[buttonIcon] : null;
68
67
  windowVar.lastButtonProps = element;
69
68
  const handleTrigger = async () => {
70
69
  if (metadata?.buttonLink?.handler) {
@@ -81,7 +80,6 @@ const EditorButton = props => {
81
80
  }
82
81
  };
83
82
  const buttonProps = handleLinkType(refURl, linkType, readOnly, openInNewTab, handleTrigger);
84
- console.log(openInNewTab);
85
83
  const onMenuClick = val => () => {
86
84
  switch (val) {
87
85
  case "edit":
@@ -133,7 +131,6 @@ const EditorButton = props => {
133
131
  color: "rgba(0, 0, 0, 0.54)"
134
132
  },
135
133
  ...btnProps,
136
- target: openInNewTab ? "_blank" : "_self",
137
134
  children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
138
135
  })
139
136
  })]
@@ -215,14 +212,12 @@ const EditorButton = props => {
215
212
  }
216
213
  },
217
214
  ...buttonProps,
218
- children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
219
- iconName: buttonIcon,
215
+ children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(BtnIcon, {
220
216
  style: {
221
217
  paddingLeft: "4px",
222
218
  paddingRight: "4px"
223
219
  }
224
- }), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(MUIIcon, {
225
- iconName: buttonIcon,
220
+ }), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(BtnIcon, {
226
221
  style: {
227
222
  paddingLeft: "4px",
228
223
  paddingRight: "4px"
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from "react";
2
2
  import { Transforms } from "slate";
3
3
  import { useSlateStatic, ReactEditor } from "slate-react";
4
+ import * as fIcons from "@mui/icons-material";
4
5
  import { Box } from "@mui/material";
5
6
  import ChipTextPopup from "./ChipTextPopup";
6
7
  import { getTRBLBreakPoints, getBreakPointsValue } from "../../helper/theme";
7
- import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const ChipText = props => {
@@ -26,6 +26,7 @@ const ChipText = props => {
26
26
  buttonIcon,
27
27
  textSize
28
28
  } = element;
29
+ const BtnIcon = buttonIcon ? fIcons[buttonIcon] : fIcons["Check"];
29
30
  const [openSetttings, setOpenSettings] = useState(false);
30
31
  const editor = useSlateStatic();
31
32
  const path = ReactEditor.findPath(editor, element);
@@ -81,8 +82,7 @@ const ChipText = props => {
81
82
  background: bgColor || "#CCC",
82
83
  color: textColor
83
84
  },
84
- children: [/*#__PURE__*/_jsx(MUIIcon, {
85
- iconName: buttonIcon || "Check",
85
+ children: [/*#__PURE__*/_jsx(BtnIcon, {
86
86
  style: {
87
87
  fontSize: textSize || "16px",
88
88
  lineHeight: textSize || "16px",
@@ -2,10 +2,10 @@ import React, { useState, forwardRef, useImperativeHandle } from "react";
2
2
  import { useSlateStatic, ReactEditor } from "slate-react";
3
3
  import { Paper, Popover } from "@mui/material";
4
4
  import data from "@emoji-mart/data";
5
+ import Picker from "@emoji-mart/react";
5
6
  import { insertEmoji } from "../../utils/emoji";
6
7
  import ToolbarIcon from "../../common/ToolbarIcon";
7
8
  import Icon from "../../common/Icon";
8
- import EmojiPicker from "./EmojiPicker";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -61,7 +61,7 @@ const EmojiButton = /*#__PURE__*/forwardRef((props, ref) => {
61
61
  },
62
62
  onClose: handleClose,
63
63
  children: /*#__PURE__*/_jsx(Paper, {
64
- children: /*#__PURE__*/_jsx(EmojiPicker, {
64
+ children: /*#__PURE__*/_jsx(Picker, {
65
65
  data: data,
66
66
  onEmojiSelect: onEmojiSelect
67
67
  })
@@ -1,16 +0,0 @@
1
- import data from "@emoji-mart/data";
2
- import Picker from "@emoji-mart/react";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { Fragment as _Fragment } from "react/jsx-runtime";
5
- const EmojiPicker = props => {
6
- const {
7
- onEmojiSelect
8
- } = props;
9
- return /*#__PURE__*/_jsx(_Fragment, {
10
- children: /*#__PURE__*/_jsx(Picker, {
11
- data: data,
12
- onEmojiSelect: onEmojiSelect
13
- })
14
- });
15
- };
16
- export default EmojiPicker;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
+ import * as fIcons from "@mui/icons-material";
2
3
  import { Box } from "@mui/material";
3
- import Check from "@mui/icons-material/Check";
4
4
  import { getBreakPointsValue } from "../../helper/theme";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -23,6 +23,7 @@ const InlineIcon = props => {
23
23
  right,
24
24
  bottom
25
25
  } = bannerSpacing || {};
26
+ const BtnIcon = fIcons["Check"];
26
27
  return /*#__PURE__*/_jsxs(Box, {
27
28
  ...attributes,
28
29
  className: "editor-icon-text",
@@ -41,7 +42,7 @@ const InlineIcon = props => {
41
42
  background: bgColor || "#CCC",
42
43
  color: textColor
43
44
  },
44
- children: [/*#__PURE__*/_jsx(Check, {}), /*#__PURE__*/_jsx("div", {
45
+ children: [/*#__PURE__*/_jsx(BtnIcon, {}), /*#__PURE__*/_jsx("div", {
45
46
  contentEditable: true,
46
47
  children: children
47
48
  })]
@@ -11,9 +11,7 @@ const CheckList = ({
11
11
  attributes,
12
12
  children,
13
13
  element,
14
- isEmpty,
15
- className,
16
- style
14
+ isEmpty
17
15
  }) => {
18
16
  const editor = useSlateStatic();
19
17
  const readOnly = useReadOnly();
@@ -32,14 +30,12 @@ const CheckList = ({
32
30
  const nestedCheckList = element?.children?.length && element.children[0].type === "check-list-item";
33
31
  return /*#__PURE__*/_jsx(_Fragment, {
34
32
  children: /*#__PURE__*/_jsxs("div", {
35
- className: className || "",
36
33
  ...attributes,
37
34
  style: {
38
35
  textAlign: element.alignment || "left",
39
36
  display: "flex",
40
37
  justifyContent: "center",
41
- alignItems: "center",
42
- ...(style || {})
38
+ alignItems: "center"
43
39
  },
44
40
  children: [/*#__PURE__*/_jsxs("div", {
45
41
  contentEditable: false,
@@ -188,7 +188,6 @@ const editorStyles = ({
188
188
  }
189
189
  },
190
190
  "& .checkbox-edit": {
191
- alignSelf: "flex-start",
192
191
  "& .MuiFormControlLabel-root": {
193
192
  marginRight: "0px"
194
193
  },
@@ -213,7 +212,7 @@ const editorStyles = ({
213
212
  "& svg": {
214
213
  width: "17px",
215
214
  height: "18px",
216
- marginTop: "-1px"
215
+ marginTop: '-1px'
217
216
  }
218
217
  }
219
218
  },
@@ -274,7 +273,7 @@ const editorStyles = ({
274
273
  },
275
274
  cardsTypo: {
276
275
  color: theme?.palette?.editor?.textColor,
277
- fontSize: "14px !important"
276
+ fontSize: '14px !important'
278
277
  }
279
278
  });
280
279
  export default editorStyles;
@@ -1,10 +1,29 @@
1
1
  import React, { useState } from "react";
2
2
  import { Grid, IconButton, TextField, Tooltip } from "@mui/material";
3
- import MUIIcon from "./loadIcon";
4
- import MUIFilledIcons from "./mui_filled_icons";
3
+ import * as fIcons from "@mui/icons-material";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
6
  import { Fragment as _Fragment } from "react/jsx-runtime";
7
+ const MUIIcons = Object.keys(fIcons).reduce((a, b) => {
8
+ if (b.indexOf("Outlined") > -1) {
9
+ a.outlined.push(b);
10
+ } else if (b.indexOf("Rounded") > -1) {
11
+ a.rounded.push(b);
12
+ } else if (b.indexOf("Sharp") > -1) {
13
+ a.sharp.push(b);
14
+ } else if (b.indexOf("TwoTone") > -1) {
15
+ a.tt.push(b);
16
+ } else {
17
+ a.filled.push(b);
18
+ }
19
+ return a;
20
+ }, {
21
+ filled: [],
22
+ outlined: [],
23
+ rounded: [],
24
+ tt: [],
25
+ sharp: []
26
+ });
8
27
  const Icons = props => {
9
28
  const {
10
29
  value,
@@ -15,7 +34,7 @@ const Icons = props => {
15
34
  key
16
35
  } = data;
17
36
  const [val, setVal] = useState("");
18
- const [list, setList] = useState(MUIFilledIcons.slice(0, 90));
37
+ const [list, setList] = useState(MUIIcons.filled.slice(0, 90));
19
38
  const onSelectIcon = ico => () => {
20
39
  onChange({
21
40
  [key]: ico
@@ -25,11 +44,11 @@ const Icons = props => {
25
44
  const keyVal = e.target.value?.toLowerCase();
26
45
  setVal(keyVal);
27
46
  if (keyVal) {
28
- setList(MUIFilledIcons.filter(f => {
47
+ setList(MUIIcons.filled.filter(f => {
29
48
  return f.toLowerCase().indexOf(keyVal) > -1;
30
49
  }).slice(0, 90));
31
50
  } else {
32
- setList(MUIFilledIcons.slice(0, 90));
51
+ setList(MUIIcons.filled.slice(0, 90));
33
52
  }
34
53
  };
35
54
  const onRemoveIcon = () => {
@@ -37,7 +56,7 @@ const Icons = props => {
37
56
  [key]: null
38
57
  });
39
58
  };
40
- const SelectedIcon = value ? value : null;
59
+ const SelectedIcon = value ? fIcons[value] : null;
41
60
  return /*#__PURE__*/_jsxs(_Fragment, {
42
61
  children: [/*#__PURE__*/_jsx(Grid, {
43
62
  item: true,
@@ -73,9 +92,7 @@ const Icons = props => {
73
92
  arrow: true,
74
93
  children: /*#__PURE__*/_jsx(IconButton, {
75
94
  onClick: onRemoveIcon,
76
- children: /*#__PURE__*/_jsx(MUIIcon, {
77
- iconName: value
78
- })
95
+ children: /*#__PURE__*/_jsx(SelectedIcon, {})
79
96
  })
80
97
  }) : ""
81
98
  })]
@@ -90,14 +107,13 @@ const Icons = props => {
90
107
  paddingTop: "5px"
91
108
  },
92
109
  children: list.map(m => {
110
+ const Ico = fIcons[m];
93
111
  return /*#__PURE__*/_jsx(Tooltip, {
94
112
  title: m,
95
113
  arrow: true,
96
114
  children: /*#__PURE__*/_jsx(IconButton, {
97
115
  onClick: onSelectIcon(m),
98
- children: /*#__PURE__*/_jsx(MUIIcon, {
99
- iconName: m
100
- })
116
+ children: /*#__PURE__*/_jsx(Ico, {})
101
117
  })
102
118
  }, `mui_ico_${m}`);
103
119
  })
@@ -243,7 +243,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
243
243
  const [page, section] = url?.split("#") || [];
244
244
  const sec = section ? `#${section}` : "";
245
245
  const currentUserPage = getCurrentUserPage();
246
- props.href = isHomePage(page) ? `./${currentUserPage}${sec}` : `./${url}`;
246
+ props.href = isCurrentPage(page) ? `./${currentUserPage}${sec}` : `./${url}`;
247
247
  if (openInNewTab) {
248
248
  if (isCurrentPage(page)) {
249
249
  // temp fix, if user is presented in current page, open in new tab option is restricted, we will scroll to the element in current page
@@ -1,34 +1,22 @@
1
1
  import { renderToString } from "react-dom/server";
2
- import { getBlock } from "./chatEditor/SlateUtilityFunctions";
2
+ import { getBlock } from "./SlateUtilityFunctions";
3
3
  const serializeToHTML = nodes => {
4
4
  try {
5
- const htmlString = nodes.map(node => {
6
- // Render function for each node
7
- const renderNode = node => {
5
+ const htmlString = nodes.map(n => {
6
+ if (n) {
8
7
  const props = {
9
- element: node,
10
- children: node.children?.map(child => {
11
- // Render each child node
12
- if (child.text !== undefined) {
13
- // For text nodes, return the text
14
- return child.text;
15
- }
16
- // For other nodes, render them recursively
17
- return renderNode(child);
18
- }) || []
8
+ element: n,
9
+ children: n?.children
19
10
  };
20
- return getBlock(props);
21
- };
22
-
23
- // Render root node to HTML string
24
- const reactElement = renderNode(node);
25
- return renderToString(reactElement);
26
- }).join(''); // Combine all HTML strings
27
-
28
- return htmlString;
11
+ const reactString = renderToString(getBlock(props));
12
+ return reactString;
13
+ } else {
14
+ return "";
15
+ }
16
+ });
17
+ console.log(htmlString);
29
18
  } catch (err) {
30
- console.error('Error serializing to HTML:', err);
31
- return '';
19
+ console.log(err);
32
20
  }
33
21
  };
34
22
  export default serializeToHTML;
package/dist/index.js CHANGED
@@ -2,11 +2,7 @@ import Collaborative from "./Editor/CollaborativeEditor";
2
2
  import CommonEditor from "./Editor/CommonEditor";
3
3
  import Mini from "./Editor/MiniEditor";
4
4
  import EditorInFrame from "./Editor/IframeEditor";
5
- import Chat from "./Editor/ChatEditor";
6
- import Emoji from "./Editor/Elements/Emoji/EmojiPicker";
7
5
  export const Editor = CommonEditor;
8
6
  export const MiniEditor = Mini;
9
7
  export const CollaborativeEditor = Collaborative;
10
- export const IframeEditor = EditorInFrame;
11
- export const ChatEditor = Chat;
12
- export const EmojiPicker = Emoji;
8
+ export const IframeEditor = EditorInFrame;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"
@@ -58,11 +58,11 @@
58
58
  "prepare": "husky install .husky",
59
59
  "lint": "./node_modules/.bin/eslint --ignore-path .gitignore .",
60
60
  "start": "craco start",
61
- "build": "NODE_OPTIONS='--max_old_space_size=4096' craco build",
61
+ "build": "craco build",
62
62
  "test": "craco test --passWithNoTests",
63
63
  "eject": "react-scripts eject",
64
- "storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook dev -p 6006",
65
- "build-storybook": "NODE_OPTIONS='--max_old_space_size=4096' storybook build",
64
+ "storybook": "storybook dev -p 6006",
65
+ "build-storybook": "storybook build",
66
66
  "publish:npm": "rm -rf dist && mkdir dist && babel src/components -d dist --copy-files",
67
67
  "publish:local": "rm -rf /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist && babel src/components -d /Users/agenciflow08/Documents/flozy/client/node_modules/@flozy/editor/dist --copy-files"
68
68
  },
@@ -1,195 +0,0 @@
1
- import React, { useCallback, useMemo, useRef, useState, useEffect, useImperativeHandle, forwardRef } from "react";
2
- import { Editable, Slate } from 'slate-react';
3
- import { createEditor } from 'slate';
4
- import { useDebounce } from "use-debounce";
5
- import withCommon from "./hooks/withCommon";
6
- import { getBlock, getMarked } from "./utils/chatEditor/SlateUtilityFunctions";
7
- import MiniTextFormat from "./Toolbar/PopupTool/MiniTextFormat";
8
- import { commands, mentionsEvent } from "./utils/events";
9
- import { insertEmoji } from "./utils/emoji";
10
- import { draftToSlate } from "./utils/draftToSlate";
11
- import MentionsPopup from "./common/MentionsPopup";
12
- import { serializeToText } from "./utils/serializeToText";
13
- import useMentions from "./hooks/useMentions";
14
- import Shorthands from "./common/Shorthands";
15
- import usePopupStyle from "./Toolbar/PopupTool/PopupToolStyle";
16
- import { EditorProvider } from "./hooks/useMouseMove";
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
- const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
20
- const {
21
- id,
22
- theme,
23
- content,
24
- readOnly,
25
- otherProps,
26
- needLayout = false,
27
- toolBar = true,
28
- onSave,
29
- onsubmit
30
- } = props;
31
- const classes = usePopupStyle(theme);
32
- const convertedContent = draftToSlate({
33
- data: content
34
- });
35
- const [isInteracted, setIsInteracted] = useState(false);
36
- const [value, setValue] = useState(convertedContent);
37
- const [loadedValue] = useState(value);
38
- const [deboundedValue] = useDebounce(value, 500);
39
- const editor = useMemo(() => {
40
- return withCommon(createEditor(), {
41
- needLayout
42
- });
43
- }, []);
44
- const isReadOnly = readOnly === "readonly";
45
- useImperativeHandle(ref, () => ({
46
- emojiClick: emoji => {
47
- insertEmoji(editor, emoji?.native, editor.selection);
48
- }
49
- }));
50
- useEffect(() => {
51
- setValue(draftToSlate({
52
- data: content
53
- }));
54
- }, [id, content]);
55
- useEffect(() => {
56
- if (JSON.stringify(loadedValue) !== JSON.stringify(deboundedValue) && isInteracted && onSave) {
57
- const {
58
- value: strVal,
59
- ...restVal
60
- } = getOnSaveData(deboundedValue);
61
- onSave(strVal, restVal);
62
- }
63
- }, [deboundedValue]);
64
- const getOnSaveData = val => {
65
- const text = serializeToText(val);
66
- const title = val?.find(f => f.type === "title");
67
- return {
68
- value: JSON.stringify(val),
69
- text: text,
70
- title: serializeToText(title?.children) || "Untitled"
71
- };
72
- };
73
- const {
74
- CHARACTERS = [],
75
- hideTools
76
- // needLayout = true,
77
- } = otherProps || {};
78
- const mentionsRef = useRef();
79
- const customProps = {
80
- ...(otherProps || {}),
81
- readOnly: isReadOnly,
82
- editorPlaceholder: "Write Something",
83
- page_id: 1
84
- };
85
- const [mentions, setMentions] = useMentions({
86
- editor,
87
- selection: editor?.selection
88
- });
89
- const {
90
- search,
91
- target,
92
- index
93
- } = mentions;
94
- let {
95
- type
96
- } = mentions;
97
- if (type && type === "elements" && hideTools.indexOf("slash") > -1) {
98
- type = null;
99
- }
100
- const chars = type ? Shorthands[type]({
101
- ...mentions,
102
- CHARACTERS,
103
- hideTools: hideTools
104
- }) : [];
105
- const Leaf = ({
106
- attributes,
107
- children,
108
- leaf
109
- }) => {
110
- children = getMarked(leaf, children);
111
- return /*#__PURE__*/_jsx("span", {
112
- ...attributes,
113
- children: children
114
- });
115
- };
116
- const handleEditorChange = newValue => {
117
- setValue(newValue);
118
- if (!isInteracted) {
119
- setIsInteracted(true);
120
- }
121
- };
122
- const Element = props => {
123
- return getBlock(props);
124
- };
125
- const renderElement = useCallback(props => {
126
- return /*#__PURE__*/_jsx(Element, {
127
- ...props,
128
- customProps: customProps
129
- });
130
- }, []);
131
- const renderLeaf = useCallback(props => {
132
- return /*#__PURE__*/_jsx(Leaf, {
133
- ...props,
134
- customProps: customProps
135
- });
136
- }, []);
137
- const onKeyDown = useCallback(event => {
138
- const isMetaKey = event.metaKey && event.keyCode >= 65 && event.keyCode <= 90;
139
- const isCtrlKey = event.ctrlKey || isMetaKey;
140
- if (target && chars.length > 0 && !isCtrlKey) {
141
- mentionsEvent({
142
- event,
143
- mentions,
144
- setMentions,
145
- chars,
146
- target,
147
- editor,
148
- type,
149
- mentionsRef
150
- });
151
- } else if (isCtrlKey) {
152
- commands({
153
- event,
154
- editor
155
- });
156
- } else if (event.key === "Enter") {
157
- onsubmit();
158
- }
159
- }, [chars, editor, target, mentions, setMentions, search, type, mentionsRef]);
160
- const handleClose = () => {};
161
- return /*#__PURE__*/_jsx(EditorProvider, {
162
- theme: theme,
163
- editor: editor,
164
- children: /*#__PURE__*/_jsxs(Slate, {
165
- editor: editor,
166
- initialValue: value,
167
- onChange: handleEditorChange,
168
- children: [toolBar && /*#__PURE__*/_jsx(MiniTextFormat, {
169
- classes: classes,
170
- editor: editor,
171
- closeMainPopup: handleClose
172
- }), /*#__PURE__*/_jsx(Editable, {
173
- className: "chatEditorRoot",
174
- renderElement: renderElement,
175
- renderLeaf: renderLeaf,
176
- placeholder: "Start typing ...",
177
- spellCheck: true,
178
- autoFocus: true,
179
- onKeyDown: onKeyDown
180
- }), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
181
- ref: mentionsRef,
182
- mentions: mentions,
183
- setMentions: setMentions,
184
- editor: editor,
185
- target: target,
186
- index: index,
187
- chars: chars,
188
- type: type,
189
- theme: theme
190
- }) : null]
191
- }, id)
192
- });
193
- });
194
- ChatEditor.displayName = "ChatEditor";
195
- export default ChatEditor;
@@ -1,49 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { Box } from "@mui/material";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- const iconLoader = async iconName => {
5
- const iconAPI = process.env.ICON_API;
6
- try {
7
- const iconResponse = await fetch(`${iconAPI}/${iconName}`);
8
- const icon = await iconResponse.text();
9
- return icon;
10
- } catch (error) {
11
- console.error(`Icon "${iconName}" could not be loaded.`, error);
12
- return null; // Or return a default fallback icon
13
- }
14
- };
15
-
16
- const DynamicIcon = ({
17
- iconName,
18
- ...props
19
- }) => {
20
- const [icon, setIcon] = useState("");
21
- useEffect(() => {
22
- let mounted = true;
23
- iconLoader(iconName).then(iconHTML => {
24
- if (mounted) {
25
- setIcon(iconHTML);
26
- }
27
- });
28
- return () => {
29
- mounted = false;
30
- };
31
- }, [iconName]);
32
- if (!icon) {
33
- return null; // Or return a placeholder/spinner
34
- }
35
-
36
- return /*#__PURE__*/_jsx(Box, {
37
- sx: {
38
- display: "flex",
39
- width: "auto",
40
- height: "auto",
41
- paddingLeft: "4px",
42
- paddingRight: "4px"
43
- },
44
- dangerouslySetInnerHTML: {
45
- __html: icon
46
- }
47
- });
48
- };
49
- export default DynamicIcon;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import DynamicIcon from "../../MUIIcon";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- const MUIIcon = ({
5
- iconName,
6
- ...rest
7
- }) => {
8
- return /*#__PURE__*/_jsx(DynamicIcon, {
9
- iconName: iconName,
10
- ...rest
11
- });
12
- };
13
- export default MUIIcon;
@@ -1,2 +0,0 @@
1
- const MUIFilledIcons = ["Abc", "AcUnit", "AccessAlarm", "AccessAlarms", "AccessTime", "AccessTimeFilled", "Accessibility", "AccessibilityNew", "Accessible", "AccessibleForward", "AccountBalance", "AccountBalanceWallet", "AccountBox", "AccountCircle", "AccountTree", "AdUnits", "Adb", "Add", "AddAPhoto", "AddAlarm", "AddAlert", "AddBox", "AddBusiness", "AddCard", "AddCircle", "AddCircleOutline", "AddComment", "AddHome", "AddHomeWork", "AddIcCall", "AddLink", "AddLocation", "AddLocationAlt", "AddModerator", "AddPhotoAlternate", "AddReaction", "AddRoad", "AddShoppingCart", "AddTask", "AddToDrive", "AddToHomeScreen", "AddToPhotos", "AddToQueue", "Addchart", "AdfScanner", "Adjust", "AdminPanelSettings", "AdsClick", "Agriculture", "Air", "AirlineSeatFlat", "AirlineSeatFlatAngled", "AirlineSeatIndividualSuite", "AirlineSeatLegroomExtra", "AirlineSeatLegroomNormal", "AirlineSeatLegroomReduced", "AirlineSeatReclineExtra", "AirlineSeatReclineNormal", "AirlineStops", "Airlines", "AirplaneTicket", "AirplanemodeActive", "AirplanemodeInactive", "Airplay", "AirportShuttle", "Alarm", "AlarmAdd", "AlarmOff", "AlarmOn", "Album", "AlignHorizontalCenter", "AlignHorizontalLeft", "AlignHorizontalRight", "AlignVerticalBottom", "AlignVerticalCenter", "AlignVerticalTop", "AllInbox", "AllInclusive", "AllOut", "AltRoute", "AlternateEmail", "Analytics", "Anchor", "Android", "Animation", "Announcement", "Aod", "Apartment", "Api", "AppBlocking", "AppRegistration", "AppSettingsAlt", "AppShortcut", "Apple", "Approval", "Apps", "AppsOutage", "Architecture", "Archive", "ArrowBack", "ArrowBackIos", "ArrowBackIosNew", "ArrowCircleDown", "ArrowCircleLeft", "ArrowCircleRight", "ArrowCircleUp", "ArrowDownward", "ArrowDropDown", "ArrowDropDownCircle", "ArrowDropUp", "ArrowForward", "ArrowForwardIos", "ArrowLeft", "ArrowOutward", "ArrowRight", "ArrowRightAlt", "ArrowUpward", "ArtTrack", "Article", "AspectRatio", "Assessment", "Assignment", "AssignmentInd", "AssignmentLate", "AssignmentReturn", "AssignmentReturned", "AssignmentTurnedIn", "AssistWalker", "Assistant", "AssistantDirection", "AssistantPhoto", "AssuredWorkload", "Atm", "AttachEmail", "AttachFile", "AttachMoney", "Attachment", "Attractions", "Attribution", "AudioFile", "Audiotrack", "AutoAwesome", "AutoAwesomeMosaic", "AutoAwesomeMotion", "AutoDelete", "AutoFixHigh", "AutoFixNormal", "AutoFixOff", "AutoGraph", "AutoMode", "AutoStories", "AutofpsSelect", "Autorenew", "AvTimer", "BabyChangingStation", "BackHand", "Backpack", "Backspace", "Backup", "BackupTable", "Badge", "BakeryDining", "Balance", "Balcony", "Ballot", "BarChart", "BatchPrediction", "Bathroom", "Bathtub", "Battery0Bar", "Battery1Bar", "Battery20", "Battery2Bar", "Battery30", "Battery3Bar", "Battery4Bar", "Battery50", "Battery5Bar", "Battery60", "Battery6Bar", "Battery80", "Battery90", "BatteryAlert", "BatteryCharging20", "BatteryCharging30", "BatteryCharging50", "BatteryCharging60", "BatteryCharging80", "BatteryCharging90", "BatteryChargingFull", "BatteryFull", "BatterySaver", "BatteryStd", "BatteryUnknown", "BeachAccess", "Bed", "BedroomBaby", "BedroomChild", "BedroomParent", "Bedtime", "BedtimeOff", "Beenhere", "Bento", "BikeScooter", "Biotech", "Blender", "Blind", "Blinds", "BlindsClosed", "Block", "Bloodtype", "Bluetooth", "BluetoothAudio", "BluetoothConnected", "BluetoothDisabled", "BluetoothDrive", "BluetoothSearching", "BlurCircular", "BlurLinear", "BlurOff", "BlurOn", "Bolt", "Book", "BookOnline", "Bookmark", "BookmarkAdd", "BookmarkAdded", "BookmarkBorder", "BookmarkRemove", "Bookmarks", "BorderAll", "BorderBottom", "BorderClear", "BorderColor", "BorderHorizontal", "BorderInner", "BorderLeft", "BorderOuter", "BorderRight", "BorderStyle", "BorderTop", "BorderVertical", "Boy", "BrandingWatermark", "BreakfastDining", "Brightness1", "Brightness2", "Brightness3", "Brightness4", "Brightness5", "Brightness6", "Brightness7", "BrightnessAuto", "BrightnessHigh", "BrightnessLow", "BrightnessMedium", "BroadcastOnHome", "BroadcastOnPersonal", "BrokenImage", "BrowseGallery", "BrowserNotSupported", "BrowserUpdated", "BrunchDining", "Brush", "BubbleChart", "BugReport", "Build", "BuildCircle", "Bungalow", "BurstMode", "BusAlert", "Business", "BusinessCenter", "Cabin", "Cable", "Cached", "Cake", "Calculate", "CalendarMonth", "CalendarToday", "CalendarViewDay", "CalendarViewMonth", "CalendarViewWeek", "Call", "CallEnd", "CallMade", "CallMerge", "CallMissed", "CallMissedOutgoing", "CallReceived", "CallSplit", "CallToAction", "Camera", "CameraAlt", "CameraEnhance", "CameraFront", "CameraIndoor", "CameraOutdoor", "CameraRear", "CameraRoll", "Cameraswitch", "Campaign", "Cancel", "CancelPresentation", "CancelScheduleSend", "CandlestickChart", "CarCrash", "CarRental", "CarRepair", "CardGiftcard", "CardMembership", "CardTravel", "Carpenter", "Cases", "Casino", "Cast", "CastConnected", "CastForEducation", "Castle", "CatchingPokemon", "Category", "Celebration", "CellTower", "CellWifi", "CenterFocusStrong", "CenterFocusWeak", "Chair", "ChairAlt", "Chalet", "ChangeCircle", "ChangeHistory", "ChargingStation", "Chat", "ChatBubble", "ChatBubbleOutline", "Check", "CheckBox", "CheckBoxOutlineBlank", "CheckCircle", "CheckCircleOutline", "Checklist", "ChecklistRtl", "Checkroom", "ChevronLeft", "ChevronRight", "ChildCare", "ChildFriendly", "ChromeReaderMode", "Church", "Circle", "CircleNotifications", "Class", "CleanHands", "CleaningServices", "Clear", "ClearAll", "Close", "CloseFullscreen", "ClosedCaption", "ClosedCaptionDisabled", "ClosedCaptionOff", "Cloud", "CloudCircle", "CloudDone", "CloudDownload", "CloudOff", "CloudQueue", "CloudSync", "CloudUpload", "Co2", "CoPresent", "Code", "CodeOff", "Coffee", "CoffeeMaker", "Collections", "CollectionsBookmark", "ColorLens", "Colorize", "Comment", "CommentBank", "CommentsDisabled", "Commit", "Commute", "Compare", "CompareArrows", "CompassCalibration", "Compress", "Computer", "ConfirmationNumber", "ConnectWithoutContact", "ConnectedTv", "ConnectingAirports", "Construction", "ContactEmergency", "ContactMail", "ContactPage", "ContactPhone", "ContactSupport", "Contactless", "Contacts", "ContentCopy", "ContentCut", "ContentPaste", "ContentPasteGo", "ContentPasteOff", "ContentPasteSearch", "Contrast", "ControlCamera", "ControlPoint", "ControlPointDuplicate", "Cookie", "CopyAll", "Copyright", "Coronavirus", "CorporateFare", "Cottage", "Countertops", "Create", "CreateNewFolder", "CreditCard", "CreditCardOff", "CreditScore", "Crib", "CrisisAlert", "Crop", "Crop169", "Crop32", "Crop54", "Crop75", "CropDin", "CropFree", "CropLandscape", "CropOriginal", "CropPortrait", "CropRotate", "CropSquare", "Css", "CurrencyBitcoin", "CurrencyExchange", "CurrencyFranc", "CurrencyLira", "CurrencyPound", "CurrencyRuble", "CurrencyRupee", "CurrencyYen", "CurrencyYuan", "Curtains", "CurtainsClosed", "Cyclone", "Dangerous", "DarkMode", "Dashboard", "DashboardCustomize", "DataArray", "DataObject", "DataSaverOff", "DataSaverOn", "DataThresholding", "DataUsage", "Dataset", "DatasetLinked", "DateRange", "Deblur", "Deck", "Dehaze", "Delete", "DeleteForever", "DeleteOutline", "DeleteSweep", "DeliveryDining", "DensityLarge", "DensityMedium", "DensitySmall", "DepartureBoard", "Description", "Deselect", "DesignServices", "Desk", "DesktopAccessDisabled", "DesktopMac", "DesktopWindows", "Details", "DeveloperBoard", "DeveloperBoardOff", "DeveloperMode", "DeviceHub", "DeviceThermostat", "DeviceUnknown", "Devices", "DevicesFold", "DevicesOther", "DialerSip", "Dialpad", "Diamond", "Difference", "Dining", "DinnerDining", "Directions", "DirectionsBike", "DirectionsBoat", "DirectionsBoatFilled", "DirectionsBus", "DirectionsBusFilled", "DirectionsCar", "DirectionsCarFilled", "DirectionsOff", "DirectionsRailway", "DirectionsRailwayFilled", "DirectionsRun", "DirectionsSubway", "DirectionsSubwayFilled", "DirectionsTransit", "DirectionsTransitFilled", "DirectionsWalk", "DirtyLens", "DisabledByDefault", "DiscFull", "Discount", "DisplaySettings", "Diversity1", "Diversity2", "Diversity3", "Dns", "DoDisturb", "DoDisturbAlt", "DoDisturbOff", "DoDisturbOn", "DoNotDisturb", "DoNotDisturbAlt", "DoNotDisturbOff", "DoNotDisturbOn", "DoNotDisturbOnTotalSilence", "DoNotStep", "DoNotTouch", "Dock", "DocumentScanner", "Domain", "DomainAdd", "DomainDisabled", "DomainVerification", "Done", "DoneAll", "DoneOutline", "DonutLarge", "DonutSmall", "DoorBack", "DoorFront", "DoorSliding", "Doorbell", "DoubleArrow", "DownhillSkiing", "Download", "DownloadDone", "DownloadForOffline", "Downloading", "Drafts", "DragHandle", "DragIndicator", "Draw", "DriveEta", "DriveFileMove", "DriveFileRenameOutline", "DriveFolderUpload", "Dry", "DryCleaning", "Duo", "Dvr", "DynamicFeed", "DynamicForm", "EMobiledata", "Earbuds", "EarbudsBattery", "East", "EdgesensorHigh", "EdgesensorLow", "Edit", "EditAttributes", "EditCalendar", "EditLocation", "EditLocationAlt", "EditNote", "EditNotifications", "EditOff", "EditRoad", "Egg", "EggAlt", "EightK", "EightKPlus", "EightMp", "EighteenMp", "EighteenUpRating", "EightteenMp", "Eject", "Elderly", "ElderlyWoman", "ElectricBike", "ElectricBolt", "ElectricCar", "ElectricMeter", "ElectricMoped", "ElectricRickshaw", "ElectricScooter", "ElectricalServices", "Elevator", "ElevenMp", "Email", "EmergencyRecording", "EmergencyShare", "EmojiEmotions", "EmojiEvents", "EmojiFlags", "EmojiFoodBeverage", "EmojiNature", "EmojiObjects", "EmojiPeople", "EmojiSymbols", "EmojiTransportation", "EnergySavingsLeaf", "Engineering", "EnhancedEncryption", "Equalizer", "Error", "ErrorOutline", "Escalator", "EscalatorWarning", "Euro", "EuroSymbol", "EvStation", "Event", "EventAvailable", "EventBusy", "EventNote", "EventRepeat", "EventSeat", "ExitToApp", "Expand", "ExpandCircleDown", "ExpandLess", "ExpandMore", "Explicit", "Explore", "ExploreOff", "Exposure", "Extension", "ExtensionOff", "Face", "Face2", "Face3", "Face4", "Face5", "Face6", "FaceRetouchingNatural", "FaceRetouchingOff", "Facebook", "FactCheck", "Factory", "FamilyRestroom", "FastForward", "FastRewind", "Fastfood", "Favorite", "FavoriteBorder", "Fax", "FeaturedPlayList", "FeaturedVideo", "Feed", "Feedback", "Female", "Fence", "Festival", "FiberDvr", "FiberManualRecord", "FiberNew", "FiberPin", "FiberSmartRecord", "FifteenMp", "FileCopy", "FileDownload", "FileDownloadDone", "FileDownloadOff", "FileOpen", "FilePresent", "FileUpload", "Filter", "Filter1", "Filter2", "Filter3", "Filter4", "Filter5", "Filter6", "Filter7", "Filter8", "Filter9", "Filter9Plus", "FilterAlt", "FilterAltOff", "FilterBAndW", "FilterCenterFocus", "FilterDrama", "FilterFrames", "FilterHdr", "FilterList", "FilterListOff", "FilterNone", "FilterTiltShift", "FilterVintage", "FindInPage", "FindReplace", "Fingerprint", "FireExtinguisher", "FireHydrantAlt", "FireTruck", "Fireplace", "FirstPage", "FitScreen", "Fitbit", "FitnessCenter", "FiveG", "FiveK", "FiveKPlus", "FiveMp", "FivteenMp", "Flag", "FlagCircle", "Flaky", "Flare", "FlashAuto", "FlashOff", "FlashOn", "FlashlightOff", "FlashlightOn", "Flatware", "Flight", "FlightClass", "FlightLand", "FlightTakeoff", "Flip", "FlipCameraAndroid", "FlipCameraIos", "FlipToBack", "FlipToFront", "Flood", "Fluorescent", "FlutterDash", "FmdBad", "FmdGood", "Folder", "FolderCopy", "FolderDelete", "FolderOff", "FolderOpen", "FolderShared", "FolderSpecial", "FolderZip", "FollowTheSigns", "FontDownload", "FontDownloadOff", "FoodBank", "Forest", "ForkLeft", "ForkRight", "FormatAlignCenter", "FormatAlignJustify", "FormatAlignLeft", "FormatAlignRight", "FormatBold", "FormatClear", "FormatColorFill", "FormatColorReset", "FormatColorText", "FormatIndentDecrease", "FormatIndentIncrease", "FormatItalic", "FormatLineSpacing", "FormatListBulleted", "FormatListNumbered", "FormatListNumberedRtl", "FormatOverline", "FormatPaint", "FormatQuote", "FormatShapes", "FormatSize", "FormatStrikethrough", "FormatTextdirectionLToR", "FormatTextdirectionRToL", "FormatUnderlined", "Fort", "Forum", "Forward", "Forward10", "Forward30", "Forward5", "ForwardToInbox", "Foundation", "FourGMobiledata", "FourGPlusMobiledata", "FourK", "FourKPlus", "FourMp", "FourteenMp", "FreeBreakfast", "Fullscreen", "FullscreenExit", "Functions", "GMobiledata", "GTranslate", "Gamepad", "Games", "Garage", "GasMeter", "Gavel", "Gesture", "GetApp", "Gif", "GifBox", "Girl", "GitHub", "Gite", "GolfCourse", "Google", "GppBad", "GppGood", "GppMaybe", "GpsFixed", "GpsNotFixed", "GpsOff", "Grade", "Gradient", "Grading", "Grain", "GraphicEq", "Grass", "Grid3x3", "Grid4x4", "GridGoldenratio", "GridOff", "GridOn", "GridView", "Group", "GroupAdd", "GroupRemove", "GroupWork", "Groups", "Groups2", "Groups3", "HMobiledata", "HPlusMobiledata", "Hail", "Handshake", "Handyman", "Hardware", "Hd", "HdrAuto", "HdrAutoSelect", "HdrEnhancedSelect", "HdrOff", "HdrOffSelect", "HdrOn", "HdrOnSelect", "HdrPlus", "HdrStrong", "HdrWeak", "Headphones", "HeadphonesBattery", "Headset", "HeadsetMic", "HeadsetOff", "Healing", "HealthAndSafety", "Hearing", "HearingDisabled", "HeartBroken", "HeatPump", "Height", "Help", "HelpCenter", "HelpOutline", "Hevc", "Hexagon", "HideImage", "HideSource", "HighQuality", "Highlight", "HighlightAlt", "HighlightOff", "Hiking", "History", "HistoryEdu", "HistoryToggleOff", "Hive", "Hls", "HlsOff", "HolidayVillage", "Home", "HomeMax", "HomeMini", "HomeRepairService", "HomeWork", "HorizontalRule", "HorizontalSplit", "HotTub", "Hotel", "HourglassBottom", "HourglassDisabled", "HourglassEmpty", "HourglassFull", "HourglassTop", "House", "HouseSiding", "Houseboat", "HowToReg", "HowToVote", "Html", "Http", "Https", "Hub", "Hvac", "IceSkating", "Icecream", "Image", "ImageAspectRatio", "ImageNotSupported", "ImageSearch", "ImagesearchRoller", "ImportContacts", "ImportExport", "ImportantDevices", "Inbox", "IndeterminateCheckBox", "Info", "Input", "InsertChart", "InsertComment", "InsertDriveFile", "InsertEmoticon", "InsertInvitation", "InsertLink", "InsertPageBreak", "InsertPhoto", "Insights", "Instagram", "InstallDesktop", "InstallMobile", "IntegrationInstructions", "Interests", "InterpreterMode", "Inventory", "Inventory2", "InvertColors", "InvertColorsOff", "IosShare", "Iron", "Iso", "Javascript", "JoinFull", "JoinInner", "JoinLeft", "JoinRight", "Kayaking", "KebabDining", "Key", "KeyOff", "Keyboard", "KeyboardAlt", "KeyboardArrowDown", "KeyboardArrowLeft", "KeyboardArrowRight", "KeyboardArrowUp", "KeyboardBackspace", "KeyboardCapslock", "KeyboardCommandKey", "KeyboardControlKey", "KeyboardDoubleArrowDown", "KeyboardDoubleArrowLeft", "KeyboardDoubleArrowRight", "KeyboardDoubleArrowUp", "KeyboardHide", "KeyboardOptionKey", "KeyboardReturn", "KeyboardTab", "KeyboardVoice", "KingBed", "Kitchen", "Kitesurfing", "Label", "LabelImportant", "LabelOff", "Lan", "Landscape", "Landslide", "Language", "Laptop", "LaptopChromebook", "LaptopMac", "LaptopWindows", "LastPage", "Launch", "Layers", "LayersClear", "Leaderboard", "LeakAdd", "LeakRemove", "LegendToggle", "Lens", "LensBlur", "LibraryAdd", "LibraryAddCheck", "LibraryBooks", "LibraryMusic", "Light", "LightMode", "Lightbulb", "LightbulbCircle", "LineAxis", "LineStyle", "LineWeight", "LinearScale", "Link", "LinkOff", "LinkedCamera", "LinkedIn", "Liquor", "List", "ListAlt", "LiveHelp", "LiveTv", "Living", "LocalActivity", "LocalAirport", "LocalAtm", "LocalBar", "LocalCafe", "LocalCarWash", "LocalConvenienceStore", "LocalDining", "LocalDrink", "LocalFireDepartment", "LocalFlorist", "LocalGasStation", "LocalGroceryStore", "LocalHospital", "LocalHotel", "LocalLaundryService", "LocalLibrary", "LocalMall", "LocalMovies", "LocalOffer", "LocalParking", "LocalPharmacy", "LocalPhone", "LocalPizza", "LocalPlay", "LocalPolice", "LocalPostOffice", "LocalPrintshop", "LocalSee", "LocalShipping", "LocalTaxi", "LocationCity", "LocationDisabled", "LocationOff", "LocationOn", "LocationSearching", "Lock", "LockClock", "LockOpen", "LockPerson", "LockReset", "Login", "LogoDev", "Logout", "Looks", "Looks3", "Looks4", "Looks5", "Looks6", "LooksOne", "LooksTwo", "Loop", "Loupe", "LowPriority", "Loyalty", "LteMobiledata", "LtePlusMobiledata", "Luggage", "LunchDining", "Lyrics", "MacroOff", "Mail", "MailLock", "MailOutline", "Male", "Man", "Man2", "Man3", "Man4", "ManageAccounts", "ManageHistory", "ManageSearch", "Map", "MapsHomeWork", "MapsUgc", "Margin", "MarkAsUnread", "MarkChatRead", "MarkChatUnread", "MarkEmailRead", "MarkEmailUnread", "MarkUnreadChatAlt", "Markunread", "MarkunreadMailbox", "Masks", "Maximize", "MediaBluetoothOff", "MediaBluetoothOn", "Mediation", "MedicalInformation", "MedicalServices", "Medication", "MedicationLiquid", "MeetingRoom", "Memory", "Menu", "MenuBook", "MenuOpen", "Merge", "MergeType", "Message", "Mic", "MicExternalOff", "MicExternalOn", "MicNone", "MicOff", "Microsoft", "Microwave", "MilitaryTech", "Minimize", "MinorCrash", "MiscellaneousServices", "MissedVideoCall", "Mms", "MobileFriendly", "MobileOff", "MobileScreenShare", "MobiledataOff", "Mode", "ModeComment", "ModeEdit", "ModeEditOutline", "ModeFanOff", "ModeNight", "ModeOfTravel", "ModeStandby", "ModelTraining", "MonetizationOn", "Money", "MoneyOff", "MoneyOffCsred", "Monitor", "MonitorHeart", "MonitorWeight", "MonochromePhotos", "Mood", "MoodBad", "Moped", "More", "MoreHoriz", "MoreTime", "MoreVert", "Mosque", "MotionPhotosAuto", "MotionPhotosOff", "Mouse", "MoveDown", "MoveToInbox", "MoveUp", "Movie", "MovieCreation", "MovieFilter", "Moving", "Mp", "MultilineChart", "MultipleStop", "Museum", "MusicNote", "MusicOff", "MusicVideo", "MyLocation", "Nat", "Nature", "NaturePeople", "NavigateBefore", "NavigateNext", "Navigation", "NearMe", "NearMeDisabled", "NearbyError", "NearbyOff", "NestCamWiredStand", "NetworkCell", "NetworkCheck", "NetworkLocked", "NetworkPing", "NetworkWifi", "NetworkWifi1Bar", "NetworkWifi2Bar", "NetworkWifi3Bar", "NewReleases", "Newspaper", "NextPlan", "NextWeek", "Nfc", "NightShelter", "Nightlife", "Nightlight", "NightlightRound", "NightsStay", "NineK", "NineKPlus", "NineMp", "NineteenMp", "NoAccounts", "NoAdultContent", "NoBackpack", "NoCell", "NoCrash", "NoDrinks", "NoEncryption", "NoEncryptionGmailerrorred", "NoFlash", "NoFood", "NoLuggage", "NoMeals", "NoMeetingRoom", "NoPhotography", "NoSim", "NoStroller", "NoTransfer", "NoiseAware", "NoiseControlOff", "NordicWalking", "North", "NorthEast", "NorthWest", "NotAccessible", "NotInterested", "NotListedLocation", "NotStarted", "Note", "NoteAdd", "NoteAlt", "Notes", "NotificationAdd", "NotificationImportant", "Notifications", "NotificationsActive", "NotificationsNone", "NotificationsOff", "NotificationsPaused", "Numbers", "OfflineBolt", "OfflinePin", "OfflineShare", "OilBarrel", "OnDeviceTraining", "OndemandVideo", "OneK", "OneKPlus", "OneKk", "OnlinePrediction", "Opacity", "OpenInBrowser", "OpenInFull", "OpenInNew", "OpenInNewOff", "OpenWith", "OtherHouses", "Outbound", "Outbox", "OutdoorGrill", "Outlet", "Output", "Padding", "Pages", "Pageview", "Paid", "Palette", "PanTool", "PanToolAlt", "Panorama", "PanoramaFishEye", "PanoramaHorizontal", "PanoramaHorizontalSelect", "PanoramaPhotosphere", "PanoramaPhotosphereSelect", "PanoramaVertical", "PanoramaVerticalSelect", "PanoramaWideAngle", "PanoramaWideAngleSelect", "Paragliding", "Park", "PartyMode", "Password", "Pattern", "Pause", "PauseCircle", "PauseCircleFilled", "PauseCircleOutline", "PausePresentation", "Payment", "Payments", "PedalBike", "Pending", "PendingActions", "Pentagon", "People", "PeopleAlt", "PeopleOutline", "Percent", "PermCameraMic", "PermContactCalendar", "PermDataSetting", "PermDeviceInformation", "PermIdentity", "PermMedia", "PermPhoneMsg", "PermScanWifi", "Person", "Person2", "Person3", "Person4", "PersonAdd", "PersonAddAlt", "PersonAddAlt1", "PersonAddDisabled", "PersonOff", "PersonOutline", "PersonPin", "PersonPinCircle", "PersonRemove", "PersonRemoveAlt1", "PersonSearch", "PersonalVideo", "PestControl", "PestControlRodent", "Pets", "Phishing", "Phone", "PhoneAndroid", "PhoneBluetoothSpeaker", "PhoneCallback", "PhoneDisabled", "PhoneEnabled", "PhoneForwarded", "PhoneInTalk", "PhoneIphone", "PhoneLocked", "PhoneMissed", "PhonePaused", "Phonelink", "PhonelinkErase", "PhonelinkLock", "PhonelinkOff", "PhonelinkRing", "PhonelinkSetup", "Photo", "PhotoAlbum", "PhotoCamera", "PhotoCameraBack", "PhotoCameraFront", "PhotoFilter", "PhotoLibrary", "PhotoSizeSelectActual", "PhotoSizeSelectLarge", "PhotoSizeSelectSmall", "Php", "Piano", "PianoOff", "PictureAsPdf", "PictureInPicture", "PictureInPictureAlt", "PieChart", "PieChartOutline", "Pin", "PinDrop", "Pinch", "Pinterest", "PivotTableChart", "Pix", "Place", "Plagiarism", "PlayArrow", "PlayCircle", "PlayCircleFilled", "PlayCircleFilledWhite", "PlayCircleOutline", "PlayDisabled", "PlayForWork", "PlayLesson", "PlaylistAdd", "PlaylistAddCheck", "PlaylistAddCheckCircle", "PlaylistAddCircle", "PlaylistPlay", "PlaylistRemove", "Plumbing", "PlusOne", "Podcasts", "PointOfSale", "Policy", "Poll", "Polyline", "Pool", "PortableWifiOff", "Portrait", "PostAdd", "Power", "PowerInput", "PowerOff", "PowerSettingsNew", "PrecisionManufacturing", "PregnantWoman", "PresentToAll", "Preview", "PriceChange", "PriceCheck", "Print", "PrintDisabled", "PriorityHigh", "PrivacyTip", "ProductionQuantityLimits", "Propane", "PropaneTank", "Psychology", "PsychologyAlt", "Public", "PublicOff", "Publish", "PublishedWithChanges", "PunchClock", "PushPin", "QrCode", "QrCode2", "QrCodeScanner", "QueryBuilder", "QueryStats", "QuestionAnswer", "QuestionMark", "Queue", "QueueMusic", "QueuePlayNext", "Quickreply", "Quiz", "RMobiledata", "Radar", "Radio", "RadioButtonChecked", "RadioButtonUnchecked", "RailwayAlert", "RamenDining", "RampLeft", "RampRight", "RateReview", "RawOff", "RawOn", "ReadMore", "Receipt", "ReceiptLong", "RecentActors", "Recommend", "RecordVoiceOver", "Rectangle", "Recycling", "Reddit", "Redeem", "Redo", "ReduceCapacity", "Refresh", "RememberMe", "Remove", "RemoveCircle", "RemoveCircleOutline", "RemoveDone", "RemoveFromQueue", "RemoveModerator", "RemoveRedEye", "RemoveRoad", "RemoveShoppingCart", "Reorder", "Repartition", "Repeat", "RepeatOn", "RepeatOne", "RepeatOneOn", "Replay", "Replay10", "Replay30", "Replay5", "ReplayCircleFilled", "Reply", "ReplyAll", "Report", "ReportGmailerrorred", "ReportOff", "ReportProblem", "RequestPage", "RequestQuote", "ResetTv", "RestartAlt", "Restaurant", "RestaurantMenu", "Restore", "RestoreFromTrash", "RestorePage", "Reviews", "RiceBowl", "RingVolume", "Rocket", "RocketLaunch", "RollerShades", "RollerShadesClosed", "RollerSkating", "Roofing", "Room", "RoomPreferences", "RoomService", "Rotate90DegreesCcw", "Rotate90DegreesCw", "RotateLeft", "RotateRight", "RoundaboutLeft", "RoundaboutRight", "Route", "Router", "Rowing", "RssFeed", "Rsvp", "Rtt", "Rule", "RuleFolder", "RunCircle", "RunningWithErrors", "RvHookup", "SafetyCheck", "SafetyDivider", "Sailing", "Sanitizer", "Satellite", "SatelliteAlt", "Save", "SaveAlt", "SaveAs", "SavedSearch", "Savings", "Scale", "Scanner", "ScatterPlot", "Schedule", "ScheduleSend", "Schema", "School", "Science", "Score", "Scoreboard", "ScreenLockLandscape", "ScreenLockPortrait", "ScreenLockRotation", "ScreenRotation", "ScreenRotationAlt", "ScreenSearchDesktop", "ScreenShare", "Screenshot", "ScreenshotMonitor", "ScubaDiving", "Sd", "SdCard", "SdCardAlert", "SdStorage", "Search", "SearchOff", "Security", "SecurityUpdate", "SecurityUpdateGood", "SecurityUpdateWarning", "Segment", "SelectAll", "SelfImprovement", "Sell", "Send", "SendAndArchive", "SendTimeExtension", "SendToMobile", "SensorDoor", "SensorOccupied", "SensorWindow", "Sensors", "SensorsOff", "SentimentDissatisfied", "SentimentNeutral", "SentimentSatisfied", "SentimentSatisfiedAlt", "SentimentVeryDissatisfied", "SentimentVerySatisfied", "SetMeal", "Settings", "SettingsAccessibility", "SettingsApplications", "SettingsBackupRestore", "SettingsBluetooth", "SettingsBrightness", "SettingsCell", "SettingsEthernet", "SettingsInputAntenna", "SettingsInputComponent", "SettingsInputComposite", "SettingsInputHdmi", "SettingsInputSvideo", "SettingsOverscan", "SettingsPhone", "SettingsPower", "SettingsRemote", "SettingsSuggest", "SettingsSystemDaydream", "SettingsVoice", "SevenK", "SevenKPlus", "SevenMp", "SeventeenMp", "SevereCold", "ShapeLine", "Share", "ShareLocation", "Shield", "ShieldMoon", "Shop", "Shop2", "ShopTwo", "ShoppingBag", "ShoppingBasket", "ShoppingCart", "ShoppingCartCheckout", "ShortText", "Shortcut", "ShowChart", "Shower", "Shuffle", "ShuffleOn", "ShutterSpeed", "Sick", "SignLanguage", "SignalCellular0Bar", "SignalCellular1Bar", "SignalCellular2Bar", "SignalCellular3Bar", "SignalCellular4Bar", "SignalCellularAlt", "SignalCellularAlt1Bar", "SignalCellularAlt2Bar", "SignalCellularConnectedNoInternet0Bar", "SignalCellularConnectedNoInternet1Bar", "SignalCellularConnectedNoInternet2Bar", "SignalCellularConnectedNoInternet3Bar", "SignalCellularConnectedNoInternet4Bar", "SignalCellularNoSim", "SignalCellularNodata", "SignalCellularNull", "SignalCellularOff", "SignalWifi0Bar", "SignalWifi1Bar", "SignalWifi1BarLock", "SignalWifi2Bar", "SignalWifi2BarLock", "SignalWifi3Bar", "SignalWifi3BarLock", "SignalWifi4Bar", "SignalWifi4BarLock", "SignalWifiBad", "SignalWifiConnectedNoInternet4", "SignalWifiOff", "SignalWifiStatusbar4Bar", "SignalWifiStatusbarConnectedNoInternet4", "SignalWifiStatusbarNull", "Signpost", "SimCard", "SimCardAlert", "SimCardDownload", "SingleBed", "Sip", "SixK", "SixKPlus", "SixMp", "SixteenMp", "SixtyFps", "SixtyFpsSelect", "Skateboarding", "SkipNext", "SkipPrevious", "Sledding", "Slideshow", "SlowMotionVideo", "SmartButton", "SmartDisplay", "SmartScreen", "SmartToy", "Smartphone", "SmokeFree", "SmokingRooms", "Sms", "SmsFailed", "SnippetFolder", "Snooze", "Snowboarding", "Snowmobile", "Snowshoeing", "Soap", "SocialDistance", "SolarPower", "Sort", "SortByAlpha", "Sos", "SoupKitchen", "Source", "South", "SouthAmerica", "SouthEast", "SouthWest", "Spa", "SpaceBar", "SpaceDashboard", "SpatialAudio", "SpatialAudioOff", "SpatialTracking", "Speaker", "SpeakerGroup", "SpeakerNotes", "SpeakerNotesOff", "SpeakerPhone", "Speed", "Spellcheck", "Splitscreen", "Spoke", "Sports", "SportsBar", "SportsBaseball", "SportsBasketball", "SportsCricket", "SportsEsports", "SportsFootball", "SportsGolf", "SportsGymnastics", "SportsHandball", "SportsHockey", "SportsKabaddi", "SportsMartialArts", "SportsMma", "SportsMotorsports", "SportsRugby", "SportsScore", "SportsSoccer", "SportsTennis", "SportsVolleyball", "Square", "SquareFoot", "SsidChart", "StackedBarChart", "StackedLineChart", "Stadium", "Stairs", "Star", "StarBorder", "StarBorderPurple500", "StarHalf", "StarOutline", "StarPurple500", "StarRate", "Stars", "Start", "StayCurrentLandscape", "StayCurrentPortrait", "StayPrimaryLandscape", "StayPrimaryPortrait", "StickyNote2", "Stop", "StopCircle", "StopScreenShare", "Storage", "Store", "StoreMallDirectory", "Storefront", "Storm", "Straight", "Straighten", "Stream", "Streetview", "StrikethroughS", "Stroller", "Style", "SubdirectoryArrowLeft", "SubdirectoryArrowRight", "Subject", "Subscript", "Subscriptions", "Subtitles", "SubtitlesOff", "Subway", "Summarize", "Superscript", "SupervisedUserCircle", "SupervisorAccount", "Support", "SupportAgent", "Surfing", "SurroundSound", "SwapCalls", "SwapHoriz", "SwapHorizontalCircle", "SwapVert", "SwapVerticalCircle", "Swipe", "SwipeDown", "SwipeDownAlt", "SwipeLeft", "SwipeLeftAlt", "SwipeRight", "SwipeRightAlt", "SwipeUp", "SwipeUpAlt", "SwipeVertical", "SwitchAccessShortcut", "SwitchAccessShortcutAdd", "SwitchAccount", "SwitchCamera", "SwitchLeft", "SwitchRight", "SwitchVideo", "Synagogue", "Sync", "SyncAlt", "SyncDisabled", "SyncLock", "SyncProblem", "SystemSecurityUpdate", "SystemSecurityUpdateGood", "SystemSecurityUpdateWarning", "SystemUpdate", "SystemUpdateAlt", "Tab", "TabUnselected", "TableBar", "TableChart", "TableRestaurant", "TableRows", "TableView", "Tablet", "TabletAndroid", "TabletMac", "Tag", "TagFaces", "TakeoutDining", "TapAndPlay", "Tapas", "Task", "TaskAlt", "TaxiAlert", "Telegram", "TempleBuddhist", "TempleHindu", "TenMp", "Terminal", "Terrain", "TextDecrease", "TextFields", "TextFormat", "TextIncrease", "TextRotateUp", "TextRotateVertical", "TextRotationAngledown", "TextRotationAngleup", "TextRotationDown", "TextRotationNone", "TextSnippet", "Textsms", "Texture", "TheaterComedy", "Theaters", "Thermostat", "ThermostatAuto", "ThirteenMp", "ThirtyFps", "ThirtyFpsSelect", "ThreeDRotation", "ThreeGMobiledata", "ThreeK", "ThreeKPlus", "ThreeMp", "ThreeP", "ThreeSixty", "ThumbDown", "ThumbDownAlt", "ThumbDownOffAlt", "ThumbUp", "ThumbUpAlt", "ThumbUpOffAlt", "ThumbsUpDown", "Thunderstorm", "TimeToLeave", "Timelapse", "Timeline", "Timer", "Timer10", "Timer10Select", "Timer3", "Timer3Select", "TimerOff", "TimesOneMobiledata", "TipsAndUpdates", "TireRepair", "Title", "Toc", "Today", "ToggleOff", "ToggleOn", "Token", "Toll", "Tonality", "Topic", "Tornado", "TouchApp", "Tour", "Toys", "TrackChanges", "Traffic", "Train", "Tram", "Transcribe", "TransferWithinAStation", "Transform", "Transgender", "TransitEnterexit", "Translate", "TravelExplore", "TrendingDown", "TrendingFlat", "TrendingUp", "TripOrigin", "Troubleshoot", "Try", "Tsunami", "Tty", "Tune", "Tungsten", "TurnLeft", "TurnRight", "TurnSlightLeft", "TurnSlightRight", "TurnedIn", "TurnedInNot", "Tv", "TvOff", "TwelveMp", "TwentyFourMp", "TwentyOneMp", "TwentyThreeMp", "TwentyTwoMp", "TwentyZeroMp", "Twitter", "TwoK", "TwoKPlus", "TwoMp", "TwoWheeler", "TypeSpecimen", "UTurnLeft", "UTurnRight", "Umbrella", "Unarchive", "Undo", "UnfoldLess", "UnfoldLessDouble", "UnfoldMore", "UnfoldMoreDouble", "Unpublished", "Unsubscribe", "Upcoming", "Update", "UpdateDisabled", "Upgrade", "Upload", "UploadFile", "Usb", "UsbOff", "Vaccines", "VapeFree", "VapingRooms", "Verified", "VerifiedUser", "VerticalAlignBottom", "VerticalAlignCenter", "VerticalAlignTop", "VerticalShades", "VerticalShadesClosed", "VerticalSplit", "Vibration", "VideoCall", "VideoCameraBack", "VideoCameraFront", "VideoChat", "VideoFile", "VideoLabel", "VideoLibrary", "VideoSettings", "VideoStable", "Videocam", "VideocamOff", "VideogameAsset", "VideogameAssetOff", "ViewAgenda", "ViewArray", "ViewCarousel", "ViewColumn", "ViewComfy", "ViewComfyAlt", "ViewCompact", "ViewCompactAlt", "ViewCozy", "ViewDay", "ViewHeadline", "ViewInAr", "ViewKanban", "ViewList", "ViewModule", "ViewQuilt", "ViewSidebar", "ViewStream", "ViewTimeline", "ViewWeek", "Vignette", "Villa", "Visibility", "VisibilityOff", "VoiceChat", "VoiceOverOff", "Voicemail", "Volcano", "VolumeDown", "VolumeMute", "VolumeOff", "VolumeUp", "VolunteerActivism", "VpnKey", "VpnKeyOff", "VpnLock", "Vrpano", "Wallet", "Wallpaper", "Warehouse", "Warning", "WarningAmber", "Wash", "Watch", "WatchLater", "WatchOff", "Water", "WaterDamage", "WaterDrop", "WaterfallChart", "Waves", "WavingHand", "WbAuto", "WbCloudy", "WbIncandescent", "WbIridescent", "WbShade", "WbSunny", "WbTwilight", "Wc", "Web", "WebAsset", "WebAssetOff", "WebStories", "Webhook", "Weekend", "West", "WhatsApp", "Whatshot", "WheelchairPickup", "WhereToVote", "Widgets", "WidthFull", "WidthNormal", "WidthWide", "Wifi", "Wifi1Bar", "Wifi2Bar", "WifiCalling", "WifiCalling3", "WifiChannel", "WifiFind", "WifiLock", "WifiOff", "WifiPassword", "WifiProtectedSetup", "WifiTethering", "WifiTetheringError", "WifiTetheringOff", "WindPower", "Window", "WineBar", "Woman", "Woman2", "Work", "WorkHistory", "WorkOff", "WorkOutline", "WorkspacePremium", "Workspaces", "WrapText", "WrongLocation", "Wysiwyg", "Yard", "YouTube", "YoutubeSearchedFor", "ZoomIn", "ZoomInMap", "ZoomOut", "ZoomOutMap"];
2
- export default MUIFilledIcons;
@@ -1,361 +0,0 @@
1
- import { Editor, Transforms, Element as SlateElement } from "slate";
2
- import { Box } from "@mui/material";
3
- import { fontFamilyMap, sizeMap } from "../font";
4
- import Table from "../../Elements/Table/Table";
5
- import TableRow from "../../Elements/Table/TableRow";
6
- import TableCell from "../../Elements/Table/TableCell";
7
- import Mentions from "../../Elements/Mentions/Mentions";
8
- import CheckList from "../../Elements/List/CheckList";
9
- import { isEmptyTextNode } from "../../helper";
10
- import { getBreakPointsValue } from "../../helper/theme";
11
- import insertNewLine from "../insertNewLine";
12
- import { getBorderColor } from "../helper";
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- const alignment = ["alignLeft", "alignRight", "alignCenter"];
15
- const list_types = ["orderedList", "unorderedList"];
16
- const LIST_FORMAT_TYPE = {
17
- orderedList: "list-item",
18
- unorderedList: "list-item"
19
- };
20
- const NEWLINESAFTER = ["headingOne", "headingTwo", "headingThree"];
21
- export const toggleBlock = (editor, format, selection = true, attr = {}) => {
22
- const isActive = isBlockActive(editor, format);
23
- const isList = list_types.includes(format);
24
- const isIndent = alignment.includes(format);
25
- const isAligned = alignment.some(alignmentType => isBlockActive(editor, alignmentType));
26
-
27
- /*If the node is already aligned and change in indent is called we should unwrap it first and split the node to prevent
28
- messy, nested DOM structure and bugs due to that.*/
29
- if (isAligned && isIndent) {
30
- Transforms.unwrapNodes(editor, {
31
- match: n => alignment.includes(!Editor.isEditor(n) && SlateElement.isElement(n) && n.type),
32
- split: true
33
- });
34
- }
35
-
36
- /* Wraping the nodes for alignment, to allow it to co-exist with other block level operations*/
37
- if (isIndent) {
38
- Transforms.wrapNodes(editor, {
39
- type: format,
40
- children: []
41
- });
42
- return;
43
- }
44
- Transforms.unwrapNodes(editor, {
45
- match: n => list_types.includes(!Editor.isEditor(n) && SlateElement.isElement(n) && n.type),
46
- split: true
47
- });
48
-
49
- // inserting blocks from "/"" commands remove searched word
50
- if (!selection) {
51
- Transforms.insertText(editor, "");
52
- }
53
- Transforms.setNodes(editor, {
54
- type: isActive ? "paragraph" : isList ? LIST_FORMAT_TYPE[format] : format,
55
- ...attr
56
- });
57
- if (isList && !isActive) {
58
- Transforms.wrapNodes(editor, {
59
- type: format,
60
- children: []
61
- });
62
- }
63
- if (NEWLINESAFTER.indexOf(format) > -1) {
64
- insertNewLine(editor);
65
- }
66
- };
67
- export const addMarkData = (editor, data) => {
68
- try {
69
- Editor.addMark(editor, data.format, data.value);
70
- } catch (err) {
71
- console.log(err);
72
- }
73
- };
74
- export const toggleMark = (editor, format) => {
75
- const isActive = isMarkActive(editor, format);
76
- if (isActive) {
77
- Editor.removeMark(editor, format);
78
- } else {
79
- Editor.addMark(editor, format, true);
80
- }
81
- };
82
- export const isMarkActive = (editor, format) => {
83
- try {
84
- const marks = Editor.marks(editor);
85
- return marks ? marks[format] === true : false;
86
- } catch (err) {
87
- console.log(err);
88
- return null;
89
- }
90
- };
91
- export const isBlockActive = (editor, format) => {
92
- const [match] = Editor.nodes(editor, {
93
- match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
94
- });
95
- return !!match;
96
- };
97
- export const getBlockActive = (editor, format) => {
98
- const [match] = Editor.nodes(editor, {
99
- match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
100
- });
101
- return {
102
- isActive: !!match,
103
- props: match && match[0]
104
- };
105
- };
106
- export const upateBlockActive = (editor, format, attr = {}) => {
107
- const [match] = Editor.nodes(editor, {
108
- match: n => !Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format
109
- });
110
- if (match && match[1] !== undefined) {
111
- Transforms.setNodes(editor, attr, {
112
- at: match[1]
113
- });
114
- }
115
- };
116
- export const activeMark = (editor, format) => {
117
- const defaultMarkData = {
118
- color: "#000000",
119
- bgColor: "#FFFFFF",
120
- fontSize: "normal",
121
- fontFamily: "PoppinsRegular",
122
- fontWeight: "normal"
123
- };
124
- try {
125
- const marks = Editor.marks(editor);
126
- const defaultValue = defaultMarkData[format];
127
- return marks?.[format] ?? defaultValue;
128
- } catch (err) {
129
- console.log(err);
130
- return null;
131
- }
132
- };
133
- export const getMarked = (leaf, children) => {
134
- const className = leaf?.doublequote ? "doublequote" : "";
135
- if (leaf.bold) {
136
- children = /*#__PURE__*/_jsx("strong", {
137
- children: children
138
- });
139
- }
140
- if (leaf.code) {
141
- children = /*#__PURE__*/_jsx("code", {
142
- children: children
143
- });
144
- }
145
- if (leaf.italic) {
146
- children = /*#__PURE__*/_jsx("em", {
147
- children: children
148
- });
149
- }
150
- if (leaf.strikethrough) {
151
- children = /*#__PURE__*/_jsx("span", {
152
- style: {
153
- textDecoration: "line-through"
154
- },
155
- children: children
156
- });
157
- }
158
- if (leaf.underline) {
159
- children = /*#__PURE__*/_jsx("u", {
160
- children: children
161
- });
162
- }
163
- if (leaf.superscript) {
164
- children = /*#__PURE__*/_jsx("sup", {
165
- children: children
166
- });
167
- }
168
- if (leaf.subscript) {
169
- children = /*#__PURE__*/_jsx("sub", {
170
- children: children
171
- });
172
- }
173
- // cover under single span
174
- if (leaf.color || leaf.bgColor || leaf.fontSize || leaf.fontFamily || leaf.fontWeight || className) {
175
- const family = fontFamilyMap[leaf?.fontFamily];
176
- const textStyles = leaf?.color?.indexOf("gradient") >= 0 ? {
177
- background: leaf?.color?.concat("text"),
178
- WebkitBackgroundClip: "text",
179
- WebkitTextFillColor: "transparent"
180
- } : {
181
- color: leaf.color
182
- };
183
- children = /*#__PURE__*/_jsx("span", {
184
- style: {
185
- background: leaf.bgColor
186
- },
187
- children: /*#__PURE__*/_jsx(Box, {
188
- className: className,
189
- component: "span",
190
- sx: {
191
- fontSize: {
192
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
193
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
194
- },
195
- ...textStyles,
196
- fontFamily: family,
197
- fontWeight: leaf.fontWeight
198
- },
199
- children: children
200
- })
201
- });
202
- }
203
- if (leaf.decoration === "link") {
204
- children = /*#__PURE__*/_jsx("a", {
205
- style: {
206
- cursor: "pointer"
207
- },
208
- rel: "noreferrer",
209
- target: "_blank",
210
- href: leaf.text,
211
- children: children
212
- });
213
- }
214
- return children;
215
- };
216
- export const getBlock = props => {
217
- const {
218
- element,
219
- children
220
- } = props;
221
- const attributes = props.attributes ?? {};
222
- const isEmpty = isEmptyTextNode(element);
223
- switch (element.type) {
224
- case "paragraph":
225
- return /*#__PURE__*/_jsx("p", {
226
- ...attributes,
227
- ...element.attr,
228
- className: `content-editable ${isEmpty ? "empty" : ""}`
229
- // placeholder="paragraph"
230
- ,
231
- children: children
232
- });
233
- case "headingOne":
234
- return /*#__PURE__*/_jsx("h1", {
235
- ...attributes,
236
- ...element.attr,
237
- className: `content-editable ${isEmpty ? "empty" : ""}`
238
- // placeholder="Heading 1"
239
- ,
240
- children: children
241
- });
242
- case "headingTwo":
243
- return /*#__PURE__*/_jsx("h2", {
244
- ...attributes,
245
- ...element.attr,
246
- className: `content-editable ${isEmpty ? "empty" : ""}`
247
- // placeholder="Heading 2"
248
- ,
249
- children: children
250
- });
251
- case "headingThree":
252
- return /*#__PURE__*/_jsx("h3", {
253
- ...attributes,
254
- ...element.attr,
255
- className: `content-editable ${isEmpty ? "empty" : ""}`
256
- // placeholder="Heading 3"
257
- ,
258
- children: children
259
- });
260
- case "blockquote":
261
- return /*#__PURE__*/_jsx("blockquote", {
262
- ...attributes,
263
- ...element.attr,
264
- style: {
265
- // borderColor: element?.color || "transparent",
266
- ...getBorderColor(element?.color || "transparent", 3),
267
- background: element?.bgColor || "none",
268
- padding: `${element?.bgColor ? "16px" : "0px"} 8px`,
269
- borderRadius: `${element?.color ? "0px" : "12px"} 12px 12px ${element?.color ? "0px" : "12px"}`,
270
- margin: `${element?.bgColor ? "16px" : "0px"} 0px`,
271
- width: element?.bgColor ? "calc(100% - 16px)" : "100%",
272
- borderWidth: element?.color ? "0px 0px 0px 3px" : "0px"
273
- },
274
- children: children
275
- });
276
- case "alignLeft":
277
- return /*#__PURE__*/_jsx("div", {
278
- ...attributes,
279
- ...element.attr,
280
- children: children
281
- });
282
- case "alignCenter":
283
- return /*#__PURE__*/_jsx("div", {
284
- style: {
285
- display: "flex",
286
- alignItems: "center",
287
- flexDirection: "column",
288
- textAlign: "center"
289
- },
290
- ...attributes,
291
- ...element.attr,
292
- children: children
293
- });
294
- case "alignRight":
295
- return /*#__PURE__*/_jsx("div", {
296
- style: {
297
- display: "flex",
298
- alignItems: "flex-end",
299
- flexDirection: "column",
300
- textAlign: "right"
301
- },
302
- ...attributes,
303
- ...element.attr,
304
- children: children
305
- });
306
- case "list-item":
307
- const firstChildren = element.children[0] || {};
308
- return /*#__PURE__*/_jsx("li", {
309
- ...attributes,
310
- ...element.attr,
311
- className: `content-editable ${isEmpty ? "empty" : ""}`,
312
- placeholder: "List",
313
- style: {
314
- color: firstChildren?.color
315
- },
316
- children: children
317
- });
318
- case "orderedList":
319
- return /*#__PURE__*/_jsx("ol", {
320
- type: "1",
321
- ...attributes,
322
- children: children
323
- });
324
- case "unorderedList":
325
- return /*#__PURE__*/_jsx("ul", {
326
- ...attributes,
327
- children: children
328
- });
329
- case "check-list-item":
330
- return /*#__PURE__*/_jsx(CheckList, {
331
- ...props,
332
- isEmpty: isEmpty
333
- });
334
- case "table":
335
- return /*#__PURE__*/_jsx(Table, {
336
- ...props
337
- });
338
- case "table-head":
339
- return /*#__PURE__*/_jsx("thead", {
340
- children: children
341
- });
342
- case "table-body":
343
- return /*#__PURE__*/_jsx("tbody", {
344
- children: children
345
- });
346
- case "table-row":
347
- return /*#__PURE__*/_jsx(TableRow, {
348
- ...props
349
- });
350
- case "table-cell":
351
- return /*#__PURE__*/_jsx(TableCell, {
352
- ...props
353
- });
354
- case "mention":
355
- return /*#__PURE__*/_jsx(Mentions, {
356
- ...props
357
- });
358
- default:
359
- return;
360
- }
361
- };