@flozy/editor 3.6.3 → 3.6.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +195 -0
- package/dist/Editor/Elements/AppHeader/AppHeader.js +12 -14
- package/dist/Editor/Elements/Button/EditorButton.js +9 -4
- package/dist/Editor/Elements/ChipText/ChipText.js +3 -3
- package/dist/Editor/Elements/Embed/Frames/ImageFrame.js +1 -0
- package/dist/Editor/Elements/Emoji/EmojiButton.js +2 -2
- package/dist/Editor/Elements/Emoji/EmojiPicker.js +16 -0
- package/dist/Editor/Elements/Form/Workflow/UserInputs.js +2 -1
- package/dist/Editor/Elements/Grid/Grid.js +1 -1
- package/dist/Editor/Elements/Grid/GridItem.js +1 -1
- package/dist/Editor/Elements/InlineIcon/InlineIcon.js +2 -3
- 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/List/CheckList.js +6 -2
- package/dist/Editor/Elements/Table/TableCell.js +1 -1
- package/dist/Editor/MiniEditor.js +3 -1
- package/dist/Editor/Styles/EditorStyles.js +3 -2
- package/dist/Editor/Toolbar/Basic/index.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/MiniTextFormat/index.js +4 -2
- package/dist/Editor/Toolbar/PopupTool/index.js +9 -2
- package/dist/Editor/common/LinkSettings/NavComponents.js +20 -54
- package/dist/Editor/common/MUIIcon/index.js +49 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/icons.js +12 -28
- package/dist/Editor/common/StyleBuilder/fieldTypes/loadIcon.js +13 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/mui_filled_icons.js +2 -0
- package/dist/Editor/helper/index.js +15 -0
- package/dist/Editor/hooks/useMouseMove.js +12 -5
- package/dist/Editor/utils/chatEditor/SlateUtilityFunctions.js +361 -0
- package/dist/Editor/utils/helper.js +10 -33
- package/dist/Editor/utils/serializeToHTML.js +25 -13
- package/dist/index.js +5 -1
- package/package.json +4 -4
@@ -0,0 +1,195 @@
|
|
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;
|
@@ -146,21 +146,19 @@ function AppHeader(props) {
|
|
146
146
|
src: appLogo
|
147
147
|
}) : appTitle
|
148
148
|
}), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(List, {
|
149
|
-
children: menus.map((item, i) => {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
primary: item.text
|
160
|
-
})
|
149
|
+
children: menus.map((item, i) => /*#__PURE__*/_jsx(ListItem, {
|
150
|
+
disablePadding: true,
|
151
|
+
children: /*#__PURE__*/_jsx(ListItemButton, {
|
152
|
+
component: "a",
|
153
|
+
href: item.url,
|
154
|
+
sx: {
|
155
|
+
textAlign: "center"
|
156
|
+
},
|
157
|
+
children: /*#__PURE__*/_jsx(ListItemText, {
|
158
|
+
primary: item.text
|
161
159
|
})
|
162
|
-
}
|
163
|
-
})
|
160
|
+
})
|
161
|
+
}, `${item.text}_${i}`))
|
164
162
|
})]
|
165
163
|
});
|
166
164
|
const container = window !== undefined ? () => window().document.body : undefined;
|
@@ -2,7 +2,8 @@ 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";
|
5
|
+
// import * as fIcons from "@mui/icons-material";
|
6
|
+
import MUIIcon from "../../common/StyleBuilder/fieldTypes/loadIcon";
|
6
7
|
import SettingsIcon from "@mui/icons-material/Settings";
|
7
8
|
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
8
9
|
import LinkIcon from "@mui/icons-material/Link";
|
@@ -63,7 +64,7 @@ const EditorButton = props => {
|
|
63
64
|
};
|
64
65
|
const isTrigger = linkType === "actionTrigger";
|
65
66
|
const refURl = isTrigger ? buttonLink?.url : url;
|
66
|
-
const BtnIcon = buttonIcon ?
|
67
|
+
const BtnIcon = buttonIcon ? buttonIcon : null;
|
67
68
|
windowVar.lastButtonProps = element;
|
68
69
|
const handleTrigger = async () => {
|
69
70
|
if (metadata?.buttonLink?.handler) {
|
@@ -80,6 +81,7 @@ const EditorButton = props => {
|
|
80
81
|
}
|
81
82
|
};
|
82
83
|
const buttonProps = handleLinkType(refURl, linkType, readOnly, openInNewTab, handleTrigger);
|
84
|
+
console.log(openInNewTab);
|
83
85
|
const onMenuClick = val => () => {
|
84
86
|
switch (val) {
|
85
87
|
case "edit":
|
@@ -131,6 +133,7 @@ const EditorButton = props => {
|
|
131
133
|
color: "rgba(0, 0, 0, 0.54)"
|
132
134
|
},
|
133
135
|
...btnProps,
|
136
|
+
target: openInNewTab ? "_blank" : "_self",
|
134
137
|
children: /*#__PURE__*/_jsx(OpenInNewIcon, {})
|
135
138
|
})
|
136
139
|
})]
|
@@ -212,12 +215,14 @@ const EditorButton = props => {
|
|
212
215
|
}
|
213
216
|
},
|
214
217
|
...buttonProps,
|
215
|
-
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(
|
218
|
+
children: [BtnIcon && iconPosition === "start" && /*#__PURE__*/_jsx(MUIIcon, {
|
219
|
+
iconName: buttonIcon,
|
216
220
|
style: {
|
217
221
|
paddingLeft: "4px",
|
218
222
|
paddingRight: "4px"
|
219
223
|
}
|
220
|
-
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(
|
224
|
+
}), label || "My Button", BtnIcon && iconPosition === "end" && /*#__PURE__*/_jsx(MUIIcon, {
|
225
|
+
iconName: buttonIcon,
|
221
226
|
style: {
|
222
227
|
paddingLeft: "4px",
|
223
228
|
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";
|
5
4
|
import { Box } from "@mui/material";
|
6
5
|
import ChipTextPopup from "./ChipTextPopup";
|
7
6
|
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,7 +26,6 @@ const ChipText = props => {
|
|
26
26
|
buttonIcon,
|
27
27
|
textSize
|
28
28
|
} = element;
|
29
|
-
const BtnIcon = buttonIcon ? fIcons[buttonIcon] : fIcons["Check"];
|
30
29
|
const [openSetttings, setOpenSettings] = useState(false);
|
31
30
|
const editor = useSlateStatic();
|
32
31
|
const path = ReactEditor.findPath(editor, element);
|
@@ -82,7 +81,8 @@ const ChipText = props => {
|
|
82
81
|
background: bgColor || "#CCC",
|
83
82
|
color: textColor
|
84
83
|
},
|
85
|
-
children: [/*#__PURE__*/_jsx(
|
84
|
+
children: [/*#__PURE__*/_jsx(MUIIcon, {
|
85
|
+
iconName: buttonIcon || "Check",
|
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";
|
6
5
|
import { insertEmoji } from "../../utils/emoji";
|
7
6
|
import ToolbarIcon from "../../common/ToolbarIcon";
|
8
7
|
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(
|
64
|
+
children: /*#__PURE__*/_jsx(EmojiPicker, {
|
65
65
|
data: data,
|
66
66
|
onEmojiSelect: onEmojiSelect
|
67
67
|
})
|
@@ -0,0 +1,16 @@
|
|
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;
|
@@ -277,7 +277,7 @@ const Grid = props => {
|
|
277
277
|
} = getBreakPointsValue(borderRadius, size?.device) || {};
|
278
278
|
return /*#__PURE__*/_jsxs(GridContainer, {
|
279
279
|
container: true,
|
280
|
-
className: `grid-container ${grid} has-hover element-root`,
|
280
|
+
className: `grid-container ${grid} has-hover element-root dpath`,
|
281
281
|
...attributes,
|
282
282
|
...sectionId,
|
283
283
|
sx: {
|
@@ -105,7 +105,7 @@ const GridItem = props => {
|
|
105
105
|
return /*#__PURE__*/_jsxs(Item, {
|
106
106
|
item: true,
|
107
107
|
component: "div",
|
108
|
-
className: `grid-item element-root gi-top-wrpr`,
|
108
|
+
className: `grid-item element-root gi-top-wrpr dpath`,
|
109
109
|
...attributes,
|
110
110
|
sx: {
|
111
111
|
width: {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import * as fIcons from "@mui/icons-material";
|
3
2
|
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,7 +23,6 @@ const InlineIcon = props => {
|
|
23
23
|
right,
|
24
24
|
bottom
|
25
25
|
} = bannerSpacing || {};
|
26
|
-
const BtnIcon = fIcons["Check"];
|
27
26
|
return /*#__PURE__*/_jsxs(Box, {
|
28
27
|
...attributes,
|
29
28
|
className: "editor-icon-text",
|
@@ -42,7 +41,7 @@ const InlineIcon = props => {
|
|
42
41
|
background: bgColor || "#CCC",
|
43
42
|
color: textColor
|
44
43
|
},
|
45
|
-
children: [/*#__PURE__*/_jsx(
|
44
|
+
children: [/*#__PURE__*/_jsx(Check, {}), /*#__PURE__*/_jsx("div", {
|
46
45
|
contentEditable: true,
|
47
46
|
children: children
|
48
47
|
})]
|
@@ -9,6 +9,7 @@ import { removeLink } from "../../utils/link";
|
|
9
9
|
import LinkPopup from "./LinkPopup";
|
10
10
|
import "./styles.css";
|
11
11
|
import { absoluteLink } from "../../utils/helper";
|
12
|
+
import { useEditorContext } from "../../hooks/useMouseMove";
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
13
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
14
15
|
const Link = props => {
|
@@ -29,6 +30,9 @@ const Link = props => {
|
|
29
30
|
const path = ReactEditor.findPath(editor, element);
|
30
31
|
const urlPath = element.url || element.href;
|
31
32
|
const absLink = absoluteLink(urlPath);
|
33
|
+
const {
|
34
|
+
theme
|
35
|
+
} = useEditorContext();
|
32
36
|
const updateLink = () => {
|
33
37
|
Transforms.setNodes(editor, {
|
34
38
|
href: linkData?.url,
|
@@ -107,7 +111,8 @@ const Link = props => {
|
|
107
111
|
linkData: linkData,
|
108
112
|
handleClose: handleClose,
|
109
113
|
handleInputChange: handleInputChange,
|
110
|
-
handleInsertLink: updateLink
|
114
|
+
handleInsertLink: updateLink,
|
115
|
+
theme: theme
|
111
116
|
})]
|
112
117
|
});
|
113
118
|
};
|
@@ -9,7 +9,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const LinkButton = props => {
|
11
11
|
const {
|
12
|
-
editor
|
12
|
+
editor,
|
13
|
+
theme
|
13
14
|
} = props;
|
14
15
|
const linkInputRef = useRef(null);
|
15
16
|
const [showInput, setShowInput] = useState(false);
|
@@ -77,7 +78,8 @@ const LinkButton = props => {
|
|
77
78
|
linkData: linkData,
|
78
79
|
handleClose: handleClose,
|
79
80
|
handleInputChange: handleInputChange,
|
80
|
-
handleInsertLink: handleInsertLink
|
81
|
+
handleInsertLink: handleInsertLink,
|
82
|
+
theme: theme
|
81
83
|
})]
|
82
84
|
});
|
83
85
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Dialog, DialogActions, DialogContent, DialogTitle, FormControl, FormControlLabel, Grid, TextField, Button, IconButton, Typography, Checkbox } from "@mui/material";
|
3
3
|
import CloseIcon from "@mui/icons-material/Close";
|
4
|
+
import LinkPopupStyles from "./LinkPopupStyles";
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
7
|
const LinkPopup = props => {
|
@@ -9,8 +10,10 @@ const LinkPopup = props => {
|
|
9
10
|
handleClose,
|
10
11
|
linkData,
|
11
12
|
handleInputChange,
|
12
|
-
handleInsertLink
|
13
|
+
handleInsertLink,
|
14
|
+
theme
|
13
15
|
} = props;
|
16
|
+
const classes = LinkPopupStyles(theme);
|
14
17
|
return /*#__PURE__*/_jsxs(Dialog, {
|
15
18
|
fullWidth: true,
|
16
19
|
open: open,
|
@@ -44,13 +47,16 @@ const LinkPopup = props => {
|
|
44
47
|
style: {
|
45
48
|
paddingTop: "12px"
|
46
49
|
},
|
50
|
+
className: classes.titleTypo,
|
47
51
|
children: /*#__PURE__*/_jsx(TextField, {
|
48
52
|
size: "small",
|
49
53
|
fullWidth: true,
|
50
54
|
value: linkData?.name,
|
51
55
|
name: "name",
|
52
56
|
placeholder: "Link Title",
|
53
|
-
onChange: handleInputChange
|
57
|
+
onChange: handleInputChange,
|
58
|
+
sx: classes.addLinkField,
|
59
|
+
className: classes.addLinkField
|
54
60
|
})
|
55
61
|
}), /*#__PURE__*/_jsx(Grid, {
|
56
62
|
item: true,
|
@@ -64,7 +70,9 @@ const LinkPopup = props => {
|
|
64
70
|
name: "url",
|
65
71
|
value: linkData?.url,
|
66
72
|
placeholder: "https://google.com",
|
67
|
-
onChange: handleInputChange
|
73
|
+
onChange: handleInputChange,
|
74
|
+
sx: classes.addLinkField,
|
75
|
+
className: classes.addLinkField
|
68
76
|
})
|
69
77
|
}), /*#__PURE__*/_jsx(Grid, {
|
70
78
|
item: true,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const LinkPopupStyles = theme => ({
|
2
|
+
addLinkField: {
|
3
|
+
"& .MuiOutlinedInput-input": {
|
4
|
+
fontSize: "12px",
|
5
|
+
fontWeight: 500,
|
6
|
+
color: `${theme?.palette?.editor?.textColor} !important`
|
7
|
+
},
|
8
|
+
"& .MuiFormHelperText-root": {
|
9
|
+
color: `${theme?.palette?.editor?.textColor} !important`
|
10
|
+
},
|
11
|
+
"& .MuiOutlinedInput-root": {
|
12
|
+
boxShadow: "0px 4px 10px rgba(0, 0, 0, 0.16)",
|
13
|
+
color: `${theme?.palette?.editor?.textColor} !important`,
|
14
|
+
borderRadius: "7px",
|
15
|
+
"& fieldset": {
|
16
|
+
borderColor: "#D8DDE1"
|
17
|
+
},
|
18
|
+
"&:hover fieldset": {
|
19
|
+
borderColor: "#64748B"
|
20
|
+
},
|
21
|
+
"&.Mui-focused fieldset": {
|
22
|
+
borderColor: "#2563EB"
|
23
|
+
},
|
24
|
+
"& .MuiFormLabel-root": {}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
});
|
28
|
+
export default LinkPopupStyles;
|
@@ -11,7 +11,9 @@ const CheckList = ({
|
|
11
11
|
attributes,
|
12
12
|
children,
|
13
13
|
element,
|
14
|
-
isEmpty
|
14
|
+
isEmpty,
|
15
|
+
className,
|
16
|
+
style
|
15
17
|
}) => {
|
16
18
|
const editor = useSlateStatic();
|
17
19
|
const readOnly = useReadOnly();
|
@@ -30,12 +32,14 @@ const CheckList = ({
|
|
30
32
|
const nestedCheckList = element?.children?.length && element.children[0].type === "check-list-item";
|
31
33
|
return /*#__PURE__*/_jsx(_Fragment, {
|
32
34
|
children: /*#__PURE__*/_jsxs("div", {
|
35
|
+
className: className || "",
|
33
36
|
...attributes,
|
34
37
|
style: {
|
35
38
|
textAlign: element.alignment || "left",
|
36
39
|
display: "flex",
|
37
40
|
justifyContent: "center",
|
38
|
-
alignItems: "center"
|
41
|
+
alignItems: "center",
|
42
|
+
...(style || {})
|
39
43
|
},
|
40
44
|
children: [/*#__PURE__*/_jsxs("div", {
|
41
45
|
contentEditable: false,
|
@@ -117,7 +117,7 @@ const TableCell = props => {
|
|
117
117
|
className: `editor-table-cell ${hasSelected ? "selection" : ""}`,
|
118
118
|
style: {
|
119
119
|
position: "relative",
|
120
|
-
|
120
|
+
background: bgColor || entireBgColor,
|
121
121
|
border: `3px solid ${cellBorderColor}`,
|
122
122
|
...(sizeProps || {})
|
123
123
|
},
|
@@ -23,7 +23,8 @@ const MiniEditor = props => {
|
|
23
23
|
miniEditorPlaceholder,
|
24
24
|
className,
|
25
25
|
otherProps,
|
26
|
-
onSave
|
26
|
+
onSave,
|
27
|
+
theme
|
27
28
|
} = props;
|
28
29
|
const {
|
29
30
|
CHARACTERS = []
|
@@ -132,6 +133,7 @@ const MiniEditor = props => {
|
|
132
133
|
editor: editor,
|
133
134
|
initialValue: content,
|
134
135
|
onChange: onChange,
|
136
|
+
theme: theme,
|
135
137
|
children: [/*#__PURE__*/_jsx(BasicToolbar, {
|
136
138
|
...props
|
137
139
|
}), /*#__PURE__*/_jsx(Editable, {
|
@@ -188,6 +188,7 @@ const editorStyles = ({
|
|
188
188
|
}
|
189
189
|
},
|
190
190
|
"& .checkbox-edit": {
|
191
|
+
alignSelf: "flex-start",
|
191
192
|
"& .MuiFormControlLabel-root": {
|
192
193
|
marginRight: "0px"
|
193
194
|
},
|
@@ -212,7 +213,7 @@ const editorStyles = ({
|
|
212
213
|
"& svg": {
|
213
214
|
width: "17px",
|
214
215
|
height: "18px",
|
215
|
-
marginTop:
|
216
|
+
marginTop: "-1px"
|
216
217
|
}
|
217
218
|
}
|
218
219
|
},
|
@@ -273,7 +274,7 @@ const editorStyles = ({
|
|
273
274
|
},
|
274
275
|
cardsTypo: {
|
275
276
|
color: theme?.palette?.editor?.textColor,
|
276
|
-
fontSize:
|
277
|
+
fontSize: "14px !important"
|
277
278
|
}
|
278
279
|
});
|
279
280
|
export default editorStyles;
|
@@ -25,7 +25,8 @@ const BasicToolbar = props => {
|
|
25
25
|
hideTextColor = false,
|
26
26
|
hideResetIcon = true,
|
27
27
|
onResetClick = () => {}
|
28
|
-
}
|
28
|
+
},
|
29
|
+
theme
|
29
30
|
} = props;
|
30
31
|
// state
|
31
32
|
const [activeColor, setActiveColor] = useState("#000000");
|
@@ -65,7 +66,8 @@ const BasicToolbar = props => {
|
|
65
66
|
item: true,
|
66
67
|
children: /*#__PURE__*/_jsx(LinkButton, {
|
67
68
|
active: isBlockActive(editor, link.format),
|
68
|
-
editor: editor
|
69
|
+
editor: editor,
|
70
|
+
theme: theme
|
69
71
|
}, link.id)
|
70
72
|
}), !hideTextColor && /*#__PURE__*/_jsx(Grid, {
|
71
73
|
item: true,
|
@@ -28,7 +28,8 @@ const MiniTextFormat = props => {
|
|
28
28
|
classes,
|
29
29
|
editor,
|
30
30
|
closeMainPopup,
|
31
|
-
customProps
|
31
|
+
customProps,
|
32
|
+
theme
|
32
33
|
} = props;
|
33
34
|
const [anchorEl, setAnchorEl] = useState(null);
|
34
35
|
const open = Boolean(anchorEl);
|
@@ -93,7 +94,8 @@ const MiniTextFormat = props => {
|
|
93
94
|
className: "verticalLine ml-1 mr-1"
|
94
95
|
}), /*#__PURE__*/_jsx(LinkButton, {
|
95
96
|
active: isBlockActive(editor, link.format),
|
96
|
-
editor: editor
|
97
|
+
editor: editor,
|
98
|
+
theme: theme
|
97
99
|
}, link.id), /*#__PURE__*/_jsx(Button, {
|
98
100
|
onClick: e => setAnchorEl(document.getElementById("mini-text-editor-wrapper")),
|
99
101
|
className: "textSettingsIcon",
|