@flozy/editor 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -183,7 +183,7 @@ const Image = ({
183
183
  opacity: frame ? 0 : 1,
184
184
  cursor: webAddress ? "pointer" : "",
185
185
  border: `1px solid ${borderColor}`,
186
- borderWidth: borderWidth?.includes('px') ? borderWidth : `${borderWidth}px`
186
+ borderWidth: `${borderWidth}`?.includes('px') ? borderWidth : `${borderWidth}px`
187
187
  },
188
188
  alt: alt,
189
189
  src: url,
@@ -77,7 +77,6 @@ function SelectList({
77
77
  if (option.type === "block") {
78
78
  toggleBlock(editor, format);
79
79
  } else if (option.type === "accordion") {
80
- toggleBlock(editor, format);
81
80
  insertAccordion(editor);
82
81
  }
83
82
  };
@@ -540,7 +540,7 @@ const usePopupStyle = theme => ({
540
540
  lineHeight: "1.75 !important",
541
541
  fontWeight: 400,
542
542
  background: theme?.palette?.editor?.background,
543
- "& :hover": {
543
+ "&:hover": {
544
544
  background: `${theme?.palette?.action?.selected} !important`
545
545
  },
546
546
  "&.selected": {
@@ -10,6 +10,7 @@ import { TableUtil } from "../../utils/table";
10
10
  import Icon from "../Icon";
11
11
  import EmojiButton from "../../Elements/Emoji/EmojiButton";
12
12
  import { insertDivider } from "../../utils/divider";
13
+ import { Transforms } from "slate";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  const ELEMENTS_LIST = [{
15
16
  name: "Heading 1",
@@ -175,6 +176,7 @@ const ELEMENTS_LIST = [{
175
176
  icon: "accordion"
176
177
  }),
177
178
  onInsert: editor => {
179
+ Transforms.delete(editor, editor.selection); // remove text '/accordion' typed by user
178
180
  insertAccordion(editor);
179
181
  }
180
182
  }, {
@@ -20,7 +20,7 @@ const useDragDom = props => {
20
20
  removeListener();
21
21
  };
22
22
  }
23
- }, [refDom]);
23
+ }, [refDom, event]);
24
24
  const onMouseDown = e => {
25
25
  ePos.x = e.x;
26
26
  ePos.y = e.y;
@@ -39,16 +39,18 @@ const useDragDom = props => {
39
39
  }
40
40
  };
41
41
  const onMouseUp = e => {
42
- setEvent("end");
43
- ePos.x = 0;
44
- ePos.y = 0;
45
42
  if (event === "start") {
46
- setDelta({
47
- x: e.x - ePos.x,
48
- y: e.y - ePos.y
49
- });
43
+ setEvent("end");
44
+ ePos.x = 0;
45
+ ePos.y = 0;
46
+
47
+ // setDelta({
48
+ // x: e.x - ePos.x,
49
+ // y: e.y - ePos.y,
50
+ // });
50
51
  }
51
52
  };
53
+
52
54
  const onClear = () => {
53
55
  setDelta({
54
56
  x: 0,
@@ -211,20 +211,24 @@ export const getMarked = (leaf, children) => {
211
211
  } : {
212
212
  color: leaf.color
213
213
  };
214
- children = /*#__PURE__*/_jsx(Box, {
215
- className: className,
216
- component: "span",
217
- sx: {
218
- fontSize: {
219
- lg: sizeMap[leaf.fontSize] || leaf.fontSize,
220
- ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
221
- },
222
- background: leaf.bgColor,
223
- ...textStyles,
224
- fontFamily: family,
225
- fontWeight: leaf.fontWeight
214
+ children = /*#__PURE__*/_jsx("span", {
215
+ style: {
216
+ background: leaf.bgColor
226
217
  },
227
- children: children
218
+ children: /*#__PURE__*/_jsx(Box, {
219
+ className: className,
220
+ component: "span",
221
+ sx: {
222
+ fontSize: {
223
+ lg: sizeMap[leaf.fontSize] || leaf.fontSize,
224
+ ...getBreakPointsValue(leaf.fontSize, null, "overrideText")
225
+ },
226
+ ...textStyles,
227
+ fontFamily: family,
228
+ fontWeight: leaf.fontWeight
229
+ },
230
+ children: children
231
+ })
228
232
  });
229
233
  }
230
234
  if (leaf.decoration === "link") {
@@ -235,7 +235,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
235
235
  props.component = "a";
236
236
  const [page, section] = url.split("#");
237
237
  const sec = section ? `#${section}` : "";
238
- props.href = page === "home" ? sec : `/${url}`;
238
+ props.href = page === "home" ? `/${sec}` : `/${url}`;
239
239
  if (openInNewTab) {
240
240
  props.target = "_blank";
241
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"