@flozy/editor 5.0.4 → 5.0.5

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.
@@ -17,6 +17,7 @@ import { useGrid, getChildCount } from "./Providers/GridProvider";
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
18
18
  import { Fragment as _Fragment } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
+ let TT = null;
20
21
  const Resizer = ({
21
22
  classes,
22
23
  onMouseDown,
@@ -138,7 +139,7 @@ const GridItem = props => {
138
139
  try {
139
140
  if (columnRef?.current && (!parentDOM?.parentDOM || !minWidth || lastChild)) {
140
141
  initDoms(lastChild);
141
- if (lastChild) {
142
+ if (lastChild && childCount <= 2) {
142
143
  Transforms.setNodes(editor, {
143
144
  minWidth: null
144
145
  }, {
@@ -41,13 +41,14 @@ const SearchAttachment = props => {
41
41
  justifyContent: "flex-start",
42
42
  alignItems: "flex-end",
43
43
  width: "fit-content",
44
- maxWidth: '194px',
44
+ maxWidth: '250px',
45
45
  padding: "0px 10px",
46
46
  boxShadow: "none",
47
47
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
48
48
  borderRadius: "7px !important",
49
49
  background: theme?.palette?.containers?.slashBrainCardBg,
50
50
  cursor: 'pointer',
51
+ margin: '4px 0px',
51
52
  "&.MuiPaper-root.MuiPaper-rounded": {
52
53
  borderRadius: "7px !important",
53
54
  paddingTop: '0px !important'
@@ -91,7 +92,7 @@ const SearchAttachment = props => {
91
92
  whiteSpace: 'nowrap',
92
93
  overflow: 'hidden',
93
94
  wordBreak: "break-word",
94
- maxWidth: '150px',
95
+ maxWidth: '210px',
95
96
  lineHeight: 1.43,
96
97
  "&::selection": {
97
98
  WebkitTextFillColor: "#000"
@@ -113,7 +113,7 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
113
113
  sx: {
114
114
  width: '100%',
115
115
  background: theme?.palette?.editor?.miniToolBarBackground,
116
- borderColor: theme?.palette?.type === 'dark' ? theme?.palette?.editor?.popUpBorderColor : 'transparent'
116
+ boxShadow: 'none'
117
117
  },
118
118
  children: /*#__PURE__*/_jsx(SearchAndDocList, {
119
119
  mapData: mapData,
@@ -149,8 +149,13 @@ const SearchButton = /*#__PURE__*/forwardRef((props, ref) => {
149
149
  border: '1px solid',
150
150
  borderColor: theme?.palette?.type === 'dark' ? theme?.palette?.editor?.popUpBorderColor : 'transparent',
151
151
  borderRadius: '12px',
152
+ boxShadow: theme?.palette?.type === 'dark' ? 'transparent' : '0px 4px 10px 0px #00000029',
152
153
  '&.MuiPaper-root-MuiPopover-paper': {
153
- borderRadius: '12px !important'
154
+ borderRadius: '12px !important',
155
+ boxShadow: theme?.palette?.type === 'dark' ? 'transparent' : '0px 4px 10px 0px #00000029'
156
+ },
157
+ '@media only screen and (min-width: 350px) and (max-width: 599px)': {
158
+ width: '100%'
154
159
  }
155
160
  },
156
161
  children: /*#__PURE__*/_jsx(SearchAndDocList, {
@@ -13,6 +13,7 @@ const SearchAndDocList = ({
13
13
  theme,
14
14
  handleClose
15
15
  }) => {
16
+ const isMobile = window.matchMedia("(max-width: 899px)")?.matches || false;
16
17
  return /*#__PURE__*/_jsxs(_Fragment, {
17
18
  children: [/*#__PURE__*/_jsxs(Box, {
18
19
  display: "flex",
@@ -28,25 +29,29 @@ const SearchAndDocList = ({
28
29
  color: theme?.palette?.primary?.main
29
30
  },
30
31
  children: "Brains"
31
- }), /*#__PURE__*/_jsx(IconButton, {
32
+ }), !isMobile ? /*#__PURE__*/_jsx(IconButton, {
32
33
  onClick: e => {
33
34
  e.stopPropagation();
34
35
  handleClose();
35
36
  },
36
37
  sx: {
37
38
  borderRadius: "6px",
38
- backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
39
- border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
40
- padding: "5px",
39
+ backgroundColor: theme?.palette.type === 'dark' ? theme?.palette?.editor?.sectionSettingIconHover : theme?.palette?.editor?.sectionSettingIconHover,
40
+ padding: "3px",
41
41
  "&:hover": {
42
42
  backgroundColor: theme?.palette?.editor?.sectionSettingIconHover,
43
43
  background: theme?.palette?.editor?.sectionSettingIconHover
44
+ },
45
+ '& svg': {
46
+ '& path': {
47
+ stroke: theme?.palette?.editor?.closeButtonSvgStroke
48
+ }
44
49
  }
45
50
  },
46
51
  children: /*#__PURE__*/_jsx(Icon, {
47
52
  icon: "closeIcon"
48
53
  })
49
- })]
54
+ }) : null]
50
55
  }), /*#__PURE__*/_jsx(Box, {
51
56
  sx: {
52
57
  padding: '0px 16px'
@@ -70,34 +75,48 @@ const SearchAndDocList = ({
70
75
  startAdornment: /*#__PURE__*/_jsx(InputAdornment, {
71
76
  position: "start",
72
77
  children: /*#__PURE__*/_jsx(SearchIcon, {})
73
- })
78
+ }),
79
+ sx: {
80
+ color: theme?.palette?.text?.secondary2,
81
+ fontSize: '14px'
82
+ }
74
83
  },
75
84
  sx: {
76
85
  borderRadius: "8px",
86
+ fontSize: '14px',
87
+ color: theme?.palette?.text?.secondary2,
77
88
  "& .MuiOutlinedInput-root": {
78
- color: theme?.palette?.primary?.main,
89
+ color: `${theme?.palette?.text?.secondary2} !important`,
79
90
  boxShadow: theme?.palette?.shadows?.shadow12,
80
- backgroundColor: theme?.palette?.editor?.miniToolBarBackground,
91
+ backgroundColor: theme?.palette?.editor?.inputFieldBgColor,
92
+ fontSize: '14px',
81
93
  "&:hover .MuiOutlinedInput-notchedOutline": {
82
94
  borderRadius: "8px",
83
95
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
84
96
  borderColor: theme?.palette?.primary?.slashBrainBorder
85
97
  },
86
98
  "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
99
+ color: theme?.palette?.text?.secondary2,
87
100
  borderRadius: "8px",
88
101
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
89
102
  borderColor: `${theme?.palette?.primary?.slashBrainBorder} !important`
90
103
  }
91
104
  },
92
105
  '& .MuiOutlinedInput-notchedOutline': {
106
+ color: theme?.palette?.text?.secondary2,
93
107
  borderRadius: "8px",
94
108
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
95
- borderColor: theme?.palette?.primary?.slashBrainBorder
109
+ borderColor: theme?.palette?.primary?.slashBrainBorder,
110
+ fontSize: '14px'
96
111
  },
97
112
  '& .MuiInputBase-root': {
98
- borderRadius: '8px'
113
+ color: theme?.palette?.text?.secondary2,
114
+ borderRadius: '8px',
115
+ fontSize: '14px'
99
116
  },
100
117
  "& svg": {
118
+ width: '16px',
119
+ height: '16px',
101
120
  "& path": {
102
121
  stroke: theme?.palette?.text?.text6
103
122
  }
@@ -116,23 +135,25 @@ const SearchAndDocList = ({
116
135
  padding: '0px 16px 8px',
117
136
  marginBottom: '20px',
118
137
  scrollbarWidth: "thin",
119
- scrollbarColor: `${theme?.palette?.primary?.slashBrainBorder} transparent`,
138
+ scrollbarColor: `${theme?.palette?.editor?.brainPopupScroll} transparent`,
120
139
  "&::-webkit-scrollbar": {
121
- width: "3px",
140
+ width: "3px !important",
122
141
  height: "3px !important",
123
142
  borderRadius: "10px !important"
124
143
  },
125
144
  "&::-webkit-scrollbar-thumb": {
126
- backgroundColor: theme?.palette?.primary?.slashBrainBorder,
145
+ backgroundColor: theme?.palette?.editor?.brainPopupScroll,
127
146
  borderRadius: "10px !important",
128
147
  width: "3px !important"
129
148
  },
130
149
  "&::-webkit-scrollbar-thumb:hover": {
131
- backgroundColor: theme?.palette?.primary?.slashBrainBorder
150
+ backgroundColor: theme?.palette?.editor?.brainPopupScroll,
151
+ width: "3px !important"
132
152
  },
133
153
  "&::-webkit-scrollbar-track": {
134
154
  background: "transparent",
135
- borderRadius: "10px !important"
155
+ borderRadius: "10px !important",
156
+ width: "3px !important"
136
157
  }
137
158
  },
138
159
  children: [mapData?.map((doc, index) => {
@@ -145,19 +166,29 @@ const SearchAndDocList = ({
145
166
  border: `1px solid ${theme?.palette?.primary?.slashBrainBorder}`,
146
167
  borderRadius: '8px',
147
168
  padding: '6px 10px',
148
- cursor: 'pointer'
169
+ cursor: 'pointer',
170
+ backgroundColor: theme?.palette?.editor?.inputFieldBgColor,
171
+ '@media only screen and (min-width: 350px) and (max-width: 599px)': {
172
+ overflow: 'hidden'
173
+ }
149
174
  },
150
175
  onClick: () => handleClick(doc),
151
176
  children: /*#__PURE__*/_jsxs(Grid, {
152
177
  container: true,
153
178
  alignItems: "center",
154
179
  justifyContent: 'space-between',
180
+ sx: {
181
+ flexWrap: 'nowrap'
182
+ },
155
183
  gap: 1,
156
184
  children: [/*#__PURE__*/_jsx(Grid, {
157
185
  item: true,
158
186
  children: /*#__PURE__*/_jsxs(Grid, {
159
187
  container: true,
160
188
  alignItems: "center",
189
+ sx: {
190
+ flexWrap: 'nowrap'
191
+ },
161
192
  gap: 1,
162
193
  children: [/*#__PURE__*/_jsx(Grid, {
163
194
  item: true,
@@ -184,7 +215,10 @@ const SearchAndDocList = ({
184
215
  overflow: 'hidden',
185
216
  wordBreak: "break-word",
186
217
  maxWidth: '230px',
187
- textAlign: 'left'
218
+ textAlign: 'left',
219
+ '@media only screen and (min-width: 350px) and (max-width: 899px)': {
220
+ maxWidth: '100%'
221
+ }
188
222
  },
189
223
  children: title
190
224
  })
@@ -13,13 +13,21 @@ const usePopupStyles = theme => ({
13
13
  "& .MuiBox-root": {
14
14
  "& .renderComp": {
15
15
  padding: "2px 0px 2px 1px",
16
- background: "transparent !important"
16
+ background: "transparent !important",
17
+ "&:hover": {
18
+ borderRadius: "10px",
19
+ background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
20
+ }
17
21
  },
18
22
  "& button": {
19
- padding: "0px 0px 0px 6px",
23
+ padding: "0px 0px 0px 4px !important",
20
24
  "& svg": {
21
- // width: "19px !important",
22
- paddingRight: "6px"
25
+ width: "18px !important",
26
+ margin: "5px 12px 6px 6px !important"
27
+ },
28
+ "&:hover": {
29
+ borderRadius: "10px",
30
+ background: `${theme?.palette?.editor?.menuOptionHoverBackground} !important`
23
31
  }
24
32
  },
25
33
  "& .active": {
@@ -6,7 +6,7 @@ const Styles = theme => ({
6
6
  "& .MuiDrawer-paper": {
7
7
  borderTopLeftRadius: 8,
8
8
  borderTopRightRadius: 8,
9
- backgroundColor: theme.palette.containers.card
9
+ backgroundColor: theme?.palette?.editor?.miniToolBarBackground
10
10
  }
11
11
  },
12
12
  childContainer: {
@@ -22,7 +22,7 @@ const withEmbeds = editor => {
22
22
  const parentNode = Node.get(editor, parentPath);
23
23
  const previousPath = Path.previous(parentPath);
24
24
  const previousNode = Node.get(editor, previousPath);
25
- if (BlockTypes.includes(previousNode?.children[0]?.type) && parentNode?.type?.indexOf("heading") >= 0) {
25
+ if (BlockTypes.includes(previousNode?.children[0]?.type) && parentNode?.type?.indexOf("heading") >= 0 && editor.selection.focus.offset === 0) {
26
26
  insertNodes(...[{
27
27
  type: "paragraph",
28
28
  children: [{
@@ -56,8 +56,55 @@ const withLayout = editor => {
56
56
  }]
57
57
  };
58
58
  Transforms.insertNodes(editor, paragraph, {
59
- at: path.concat(1)
59
+ at: [0]
60
60
  });
61
+ return;
62
+ }
63
+ const extractFirstText = node => {
64
+ if (node.text) {
65
+ return node.text;
66
+ }
67
+ if (node.children) {
68
+ for (const child of node.children) {
69
+ const text = extractFirstText(child);
70
+ if (text) {
71
+ return text;
72
+ }
73
+ }
74
+ }
75
+ return "";
76
+ };
77
+ const extractRemainingNodes = node => {
78
+ if (!node.children) {
79
+ return [];
80
+ }
81
+ const [, ...remainingChildren] = node.children;
82
+ return remainingChildren.map(child => ({
83
+ ...child
84
+ }));
85
+ };
86
+ const firstNode = editor.children[0];
87
+ const firstContent = extractFirstText(firstNode);
88
+ if (firstNode.type !== "title") {
89
+ const titleNode = {
90
+ type: "title",
91
+ children: [{
92
+ text: firstContent
93
+ }]
94
+ };
95
+ Transforms.removeNodes(editor, {
96
+ at: [0]
97
+ });
98
+ Transforms.insertNodes(editor, titleNode, {
99
+ at: [0],
100
+ select: true
101
+ });
102
+ const remainingNodes = extractRemainingNodes(firstNode);
103
+ if (remainingNodes.length > 0) {
104
+ Transforms.insertNodes(editor, remainingNodes, {
105
+ at: [1]
106
+ });
107
+ }
61
108
  }
62
109
  ORDERS_LAYOUT.forEach((enforce, index) => {
63
110
  if (index < editor.children.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"