@flozy/editor 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -107,7 +107,8 @@ const EditorButton = props => {
107
107
  break;
108
108
  case "page":
109
109
  props.component = "a";
110
- props.href = `/${url}`.replace("home", "");
110
+ const [page, section] = url.split("#");
111
+ props.href = page === "home" ? `#${section}` : `/${url}`;
111
112
  if (openInNewTab) {
112
113
  props.target = "_blank";
113
114
  }
@@ -180,7 +181,7 @@ const EditorButton = props => {
180
181
  onClick: onMenuClick("nav"),
181
182
  children: /*#__PURE__*/_jsx(LinkIcon, {})
182
183
  })
183
- }), /*#__PURE__*/_jsx(Tooltip, {
184
+ }), linkType === "page" ? null : /*#__PURE__*/_jsx(Tooltip, {
184
185
  title: "Open Link",
185
186
  arrow: true,
186
187
  children: /*#__PURE__*/_jsx(Box, {
@@ -5,7 +5,6 @@ import DownArrowIcon from "../../../assets/svg/DownArrowIcon";
5
5
  import useWindowResize from "../../../hooks/useWindowResize";
6
6
  import { BREAKPOINTS_DEVICES, getBreakPointsValue } from "../../../helper/theme";
7
7
  import { headingMap, sizeMap } from "../../../utils/font";
8
- import { useDebounce } from "use-debounce";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
10
  const fontSizeOptions = [16, 18, 20, 22, 26, 32, 36, 40, 48, 64, 96, 128];
@@ -21,7 +20,7 @@ function SelectFontSize({
21
20
  const [size] = useWindowResize();
22
21
  const val = activeMark(editor, format);
23
22
  const value = getBreakPointsValue(val, size?.device);
24
- const [deboundedValue] = useDebounce(fontSize, 500);
23
+ const timerRef = useRef();
25
24
  const updateMarkData = newVal => {
26
25
  let upData = {
27
26
  ...getBreakPointsValue(val),
@@ -52,11 +51,6 @@ function SelectFontSize({
52
51
  setFontSize(null);
53
52
  }
54
53
  };
55
- useEffect(() => {
56
- if (deboundedValue) {
57
- onChangeSize(deboundedValue);
58
- }
59
- }, [deboundedValue]);
60
54
  const getSizeVal = () => {
61
55
  try {
62
56
  let size = `${value}`?.indexOf("px") >= 0 ? value : sizeMap[value] || value;
@@ -73,6 +67,14 @@ function SelectFontSize({
73
67
  useEffect(() => {
74
68
  setFontSize(getSizeVal());
75
69
  }, [value]);
70
+ const onChange = e => {
71
+ clearTimeout(timerRef.current);
72
+ const value = e.target.value;
73
+ setFontSize(value);
74
+ timerRef.current = setTimeout(() => {
75
+ onChangeSize(value);
76
+ }, 500);
77
+ };
76
78
  return /*#__PURE__*/_jsxs("div", {
77
79
  ref: containerRef,
78
80
  style: {
@@ -82,7 +84,7 @@ function SelectFontSize({
82
84
  children: [/*#__PURE__*/_jsx(TextField, {
83
85
  sx: classes?.miniFontSizeInput,
84
86
  value: fontSize,
85
- onChange: e => setFontSize(e.target.value),
87
+ onChange: onChange,
86
88
  size: "small"
87
89
  }), /*#__PURE__*/_jsx(IconButton, {
88
90
  onClick: e => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"