@flozy/editor 3.3.0 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1803,4 +1803,182 @@ export const CalendarIconNew = ({
1803
1803
  strokeLinecap: "round",
1804
1804
  strokeLinejoin: "round"
1805
1805
  })]
1806
+ });
1807
+ export const InfinityIcon = () => /*#__PURE__*/_jsxs("svg", {
1808
+ width: "22",
1809
+ height: "14",
1810
+ viewBox: "0 0 22 14",
1811
+ fill: "none",
1812
+ xmlns: "http://www.w3.org/2000/svg",
1813
+ children: [/*#__PURE__*/_jsx("path", {
1814
+ d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.8662C2.78347 8.77337 3.81871 9.29633 4.81127 9.60583C5.60531 9.85344 6.3588 9.80861 6.63628 9.75525C6.89243 9.76592 6.67063 10.0044 5.73978 10.3422C4.71521 10.7158 3.59459 10.8118 2.66607 10.2889C1.73755 9.76592 0.659613 8.89077 0.915756 6.95902Z",
1815
+ fill: "url(#paint0_linear_3_7)"
1816
+ }), /*#__PURE__*/_jsx("path", {
1817
+ d: "M0.915756 6.95902C1.12067 5.41363 1.86206 4.92055 2.20714 4.86719C2.08975 5.03795 1.83787 5.44564 1.76957 5.71032C1.68419 6.04118 1.63082 6.95902 2.20714 7.86619C2.46246 8.26809 2.80785 8.59457 3.1997 8.8605C3.37046 8.9548 3.4345 9.01884 3.4345 9.01884C3.16768 9.0722 2.75145 9.13624 2.20714 9.01884C1.66284 8.90144 1.13988 8.59193 0.930734 8.12234C0.868272 7.78378 0.857446 7.39878 0.915756 6.95902Z",
1818
+ fill: "url(#paint1_linear_3_7)"
1819
+ }), /*#__PURE__*/_jsx("path", {
1820
+ d: "M2.15304 9.10612C1.64075 8.44442 1.13537 7.33708 1.77573 5.71484C1.63699 6.18444 1.83445 7.07297 2.01589 7.52122C2.19732 7.96947 2.89531 8.8014 4.05821 9.35159C5.05076 9.82119 6.23709 9.82119 6.79562 9.7785C6.50746 9.91368 5.69208 10.1862 4.73581 10.1947C3.54047 10.2054 2.74003 9.69312 2.15304 9.10612Z",
1821
+ fill: "url(#paint2_linear_3_7)"
1822
+ }), /*#__PURE__*/_jsx("path", {
1823
+ d: "M16.4362 12.7797C18.4637 12.4072 19.9581 11.4316 21.144 9.00646C20.8404 9.27254 20.1806 9.908 19.6785 10.2241C19.0509 10.6192 17.887 11.0693 17.4547 11.5271C16.6737 12.2487 15.4362 12.6472 14.9104 12.7027C14.3846 12.7582 14.6598 13.0473 16.4362 12.7797Z",
1824
+ fill: "url(#paint3_linear_3_7)"
1825
+ }), /*#__PURE__*/_jsx("path", {
1826
+ d: "M2.48878 3.38168C0.992124 4.16676 0.598877 5.99203 0.70329 7.17193C0.807704 8.35183 1.11378 8.54174 1.05295 8.43731C0.854563 7.0486 1.11051 5.49084 2.22774 5.08363C3.34498 4.67641 4.43089 5.58482 5.38106 6.50366C6.33123 7.42251 8.16893 9.05138 8.87895 9.7614C9.58897 10.4714 12.3107 12.7602 14.3781 12.8751C16.2993 12.9818 17.3539 11.9667 18.151 10.9726C18.6301 10.3751 19.0072 8.91564 18.8192 9.09315C18.6313 9.27065 18.1196 9.75096 17.159 10.012C16.1984 10.273 14.9454 10.1477 13.8595 9.81361C12.7736 9.47948 11.364 8.50842 10.4765 7.69399C9.58897 6.87956 7.43803 4.71818 6.44609 3.97684C5.45415 3.2355 3.92934 2.62603 2.48878 3.38168Z",
1827
+ fill: "url(#paint4_linear_3_7)"
1828
+ }), /*#__PURE__*/_jsx("path", {
1829
+ d: "M6.45603 3.95461C5.46409 3.21327 3.91876 2.5659 2.49872 3.35945C1.47193 3.95461 1.20045 4.64584 1.35708 4.46834C1.5137 4.29083 2.63093 2.78726 4.46863 3.7792C6.30632 4.77114 8.20667 7.35018 9.72068 8.77022C11.2347 10.1903 12.2754 11.0256 13.8695 11.4954C15.4635 11.9653 17.4927 11.6583 18.1609 10.9504C18.6401 10.3528 19.0171 8.89341 18.8292 9.07092C18.6412 9.24842 18.1296 9.72873 17.169 9.98976C16.2083 10.2508 14.9554 10.1255 13.8695 9.79138C12.7836 9.45725 11.374 8.48619 10.4864 7.67176C9.59891 6.85733 7.44797 4.69595 6.45603 3.95461Z",
1830
+ fill: "url(#paint5_linear_3_7)"
1831
+ }), /*#__PURE__*/_jsx("path", {
1832
+ d: "M17.9698 11.1279C17.8237 11.2845 19.0573 10.8051 20.2477 9.87581C20.6099 9.593 20.7786 9.48856 21.0188 9.21708C21.2432 8.96331 21.699 7.3072 21.699 6.5241C21.6573 4.937 21.2393 3.94621 21.1456 3.74576C21.0187 3.47416 20.977 3.35945 21.0188 4.16344C21.0605 4.96743 20.9561 6.05334 20.5071 6.99307C19.9328 7.9328 19.5778 8.18338 18.9618 8.83075C18.826 8.97693 18.8783 9.24843 18.7634 9.593C18.6381 10.0002 18.116 10.9712 17.9698 11.1279Z",
1833
+ fill: "url(#paint6_linear_3_7)"
1834
+ }), /*#__PURE__*/_jsx("path", {
1835
+ d: "M3.44581 9.00993C3.27874 9.06005 3.70684 9.34419 4.91804 9.72008C5.40879 9.82449 6.45294 10.1167 6.92281 9.78272C7.58062 9.47317 9.08419 8.04944 9.72112 7.40207C10.2571 6.89044 11.5713 5.72935 12.5403 5.17804C13.7515 4.48891 15.5579 3.68491 16.9362 4.1339C18.3144 4.58288 18.8574 6.31616 18.8783 7.04706C18.8992 7.77797 18.8783 8.7177 18.8783 8.95785C18.8748 9.0205 18.943 9.05809 19.2437 8.70725C19.6196 8.26871 20.0686 8.04944 20.6429 6.71294C20.8622 6.16302 21.227 4.63509 21.0814 3.78933C20.9556 3.05843 20.6528 2.67209 20.079 2.02472C19.5052 1.37735 18.2309 0.448066 16.696 0.437625C15.1611 0.427183 13.9603 1.07455 13.3025 1.3878C12.1957 1.89943 10.3894 3.26726 9.41832 4.23831C8.43682 5.13628 7.44488 6.13866 6.82884 6.75471C6.336 7.24754 5.60022 7.96243 5.29394 8.25827C4.67789 8.73858 3.68596 8.93789 3.44581 9.00993Z",
1836
+ fill: "url(#paint7_linear_3_7)"
1837
+ }), /*#__PURE__*/_jsx("path", {
1838
+ d: "M6.93299 9.79053C6.50698 9.991 5.41897 9.8323 4.92822 9.72788C5.11809 9.65819 5.74215 9.30791 6.71947 8.46434C7.94112 7.40988 9.69528 5.78076 11.2719 4.78895C13.1618 3.62995 14.9672 3.09756 16.9463 4.1417C15.5681 3.69272 13.7617 4.49671 12.5505 5.18585C11.5815 5.73715 10.2673 6.89824 9.7313 7.40988C9.09437 8.05724 7.5908 9.48097 6.93299 9.79053Z",
1839
+ fill: "url(#paint8_linear_3_7)"
1840
+ }), /*#__PURE__*/_jsx("path", {
1841
+ d: "M19.2123 2.0471C18.3519 1.23685 16.682 1.20831 15.9546 1.29532L20.4235 4.72012C20.4235 4.72012 20.2878 3.05993 19.2123 2.0471Z",
1842
+ fill: "url(#paint9_linear_3_7)"
1843
+ }), /*#__PURE__*/_jsxs("defs", {
1844
+ children: [/*#__PURE__*/_jsxs("linearGradient", {
1845
+ id: "paint0_linear_3_7",
1846
+ x1: "5.86156",
1847
+ y1: "8.09032",
1848
+ x2: "3.80393",
1849
+ y2: "10.6519",
1850
+ gradientUnits: "userSpaceOnUse",
1851
+ children: [/*#__PURE__*/_jsx("stop", {
1852
+ stopColor: "#8D2EB0"
1853
+ }), /*#__PURE__*/_jsx("stop", {
1854
+ offset: "0.932292",
1855
+ stopColor: "#6E11B8"
1856
+ })]
1857
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1858
+ id: "paint1_linear_3_7",
1859
+ x1: "0.621298",
1860
+ y1: "4.69643",
1861
+ x2: "2.46766",
1862
+ y2: "9.49911",
1863
+ gradientUnits: "userSpaceOnUse",
1864
+ children: [/*#__PURE__*/_jsx("stop", {
1865
+ stopColor: "#2563EB"
1866
+ }), /*#__PURE__*/_jsx("stop", {
1867
+ offset: "1",
1868
+ stopColor: "#BA6CD9"
1869
+ })]
1870
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1871
+ id: "paint2_linear_3_7",
1872
+ x1: "0.333462",
1873
+ y1: "7.80406",
1874
+ x2: "4.71991",
1875
+ y2: "9.23419",
1876
+ gradientUnits: "userSpaceOnUse",
1877
+ children: [/*#__PURE__*/_jsx("stop", {
1878
+ stopColor: "#D9D9D9",
1879
+ stopOpacity: "0.59"
1880
+ }), /*#__PURE__*/_jsx("stop", {
1881
+ offset: "1",
1882
+ stopColor: "#D9D9D9",
1883
+ stopOpacity: "0"
1884
+ })]
1885
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1886
+ id: "paint3_linear_3_7",
1887
+ x1: "18.5807",
1888
+ y1: "9.83068",
1889
+ x2: "16.6663",
1890
+ y2: "13.7539",
1891
+ gradientUnits: "userSpaceOnUse",
1892
+ children: [/*#__PURE__*/_jsx("stop", {
1893
+ stopColor: "#615EFF"
1894
+ }), /*#__PURE__*/_jsx("stop", {
1895
+ offset: "1",
1896
+ stopColor: "#FF5EB0"
1897
+ })]
1898
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1899
+ id: "paint4_linear_3_7",
1900
+ x1: "21.6488",
1901
+ y1: "6.62897",
1902
+ x2: "0.692848",
1903
+ y2: "7.11972",
1904
+ gradientUnits: "userSpaceOnUse",
1905
+ children: [/*#__PURE__*/_jsx("stop", {
1906
+ stopColor: "#8360FD"
1907
+ }), /*#__PURE__*/_jsx("stop", {
1908
+ offset: "1",
1909
+ stopColor: "#A037D9"
1910
+ })]
1911
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1912
+ id: "paint5_linear_3_7",
1913
+ x1: "16.2785",
1914
+ y1: "8.55095",
1915
+ x2: "3.48774",
1916
+ y2: "7.62166",
1917
+ gradientUnits: "userSpaceOnUse",
1918
+ children: [/*#__PURE__*/_jsx("stop", {
1919
+ stopColor: "#CFB9FE"
1920
+ }), /*#__PURE__*/_jsx("stop", {
1921
+ offset: "1",
1922
+ stopColor: "#0029FF"
1923
+ })]
1924
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1925
+ id: "paint6_linear_3_7",
1926
+ x1: "21.887",
1927
+ y1: "3.69445",
1928
+ x2: "17.4494",
1929
+ y2: "12.5906",
1930
+ gradientUnits: "userSpaceOnUse",
1931
+ children: [/*#__PURE__*/_jsx("stop", {
1932
+ stopColor: "#2C92FF"
1933
+ }), /*#__PURE__*/_jsx("stop", {
1934
+ offset: "1",
1935
+ stopColor: "#0001C5"
1936
+ })]
1937
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1938
+ id: "paint7_linear_3_7",
1939
+ x1: "22.8982",
1940
+ y1: "-0.522987",
1941
+ x2: "14.0648",
1942
+ y2: "13.7922",
1943
+ gradientUnits: "userSpaceOnUse",
1944
+ children: [/*#__PURE__*/_jsx("stop", {
1945
+ stopColor: "#2563EB"
1946
+ }), /*#__PURE__*/_jsx("stop", {
1947
+ offset: "0.308321",
1948
+ stopColor: "#4C60FF"
1949
+ }), /*#__PURE__*/_jsx("stop", {
1950
+ offset: "0.802083",
1951
+ stopColor: "#925FFF"
1952
+ })]
1953
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1954
+ id: "paint8_linear_3_7",
1955
+ x1: "14.5506",
1956
+ y1: "1.99065",
1957
+ x2: "9.83102",
1958
+ y2: "9.71732",
1959
+ gradientUnits: "userSpaceOnUse",
1960
+ children: [/*#__PURE__*/_jsx("stop", {
1961
+ stopColor: "#D9D9D9"
1962
+ }), /*#__PURE__*/_jsx("stop", {
1963
+ offset: "1",
1964
+ stopColor: "#D9D9D9",
1965
+ stopOpacity: "0"
1966
+ })]
1967
+ }), /*#__PURE__*/_jsxs("linearGradient", {
1968
+ id: "paint9_linear_3_7",
1969
+ x1: "19.9015",
1970
+ y1: "0.564425",
1971
+ x2: "17.4582",
1972
+ y2: "3.45671",
1973
+ gradientUnits: "userSpaceOnUse",
1974
+ children: [/*#__PURE__*/_jsx("stop", {
1975
+ offset: "0.295908",
1976
+ stopColor: "#D9D9D9"
1977
+ }), /*#__PURE__*/_jsx("stop", {
1978
+ offset: "0.667869",
1979
+ stopColor: "#D9D9D9",
1980
+ stopOpacity: "0"
1981
+ })]
1982
+ })]
1983
+ })]
1806
1984
  });
@@ -0,0 +1,35 @@
1
+ import React, { useEffect, useRef } from "react";
2
+ const useClickOutside = ({
3
+ onClickOutside,
4
+ omitIds = [],
5
+ omitClass = [],
6
+ refCount = 1
7
+ }) => {
8
+ const refs = useRef([...Array(refCount)].map(() => /*#__PURE__*/React.createRef()));
9
+ useEffect(() => {
10
+ const handleClickOutside = event => {
11
+ let isClickedInside = false;
12
+ for (let ref of refs.current) {
13
+ if (ref.current && ref.current.contains(event.target)) {
14
+ isClickedInside = true;
15
+ break;
16
+ }
17
+ }
18
+ if (!isClickedInside) {
19
+ if (omitIds.includes(event.target.id)) {
20
+ return;
21
+ }
22
+ if (omitClass.some(c => event.target.className.includes(c))) {
23
+ return;
24
+ }
25
+ onClickOutside();
26
+ }
27
+ };
28
+ document.addEventListener("mousedown", handleClickOutside);
29
+ return () => {
30
+ document.removeEventListener("mousedown", handleClickOutside);
31
+ };
32
+ }, [onClickOutside, omitIds, omitClass]);
33
+ return refs.current;
34
+ };
35
+ export default useClickOutside;
@@ -27,7 +27,7 @@ export const EditorProvider = ({
27
27
  const [selectedPath, setSelectedPath] = useState(null);
28
28
  const path = event?.target?.getAttribute("data-path");
29
29
  const [popupType, setPopupType] = useState(""); // opened popup name in the editor will be stored
30
-
30
+ const [openAI, setOpenAI] = useState("");
31
31
  const onDrop = () => {
32
32
  setDrop(drop + 1);
33
33
  };
@@ -52,7 +52,9 @@ export const EditorProvider = ({
52
52
  selectedPath: selectedPath,
53
53
  setSelectedPath: setSelectedPath,
54
54
  popupType,
55
- setPopupType
55
+ setPopupType,
56
+ openAI,
57
+ setOpenAI
56
58
  },
57
59
  children: children
58
60
  });
@@ -204,7 +204,7 @@ export const decodeAndParseBase64 = encodedString => {
204
204
  const jsonData = JSON.parse(decodedURLString);
205
205
  return jsonData;
206
206
  };
207
- const hasVerticalScrollbar = (element = {}) => {
207
+ export const hasVerticalScrollbar = (element = {}) => {
208
208
  return element.scrollHeight > element.clientHeight;
209
209
  };
210
210
  export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
@@ -214,6 +214,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
214
214
  component: "button"
215
215
  };
216
216
  }
217
+ if (!linkType && url) {
218
+ if (url?.includes("http")) {
219
+ linkType = "webAddress";
220
+ } else {
221
+ linkType = "page";
222
+ }
223
+ }
217
224
  switch (linkType) {
218
225
  case "webAddress":
219
226
  const refUrl = url ? url.includes("http") ? url : `//${url}` : "Link";
@@ -236,7 +243,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
236
243
  break;
237
244
  case "page":
238
245
  props.component = "a";
239
- const [page, section] = url.split("#");
246
+ const [page, section] = url?.split("#") || [];
240
247
  const sec = section ? `#${section}` : "";
241
248
  const isHome = page === "home" || !page;
242
249
  props.href = isHome ? `${sec}` : `/${url}`;
@@ -0,0 +1,23 @@
1
+ import { Node, Path, Transforms } from "slate";
2
+ export const insertInfinityAI = editor => {
3
+ Transforms.delete(editor, editor.selection);
4
+ const {
5
+ path
6
+ } = editor.selection.anchor;
7
+ const {
8
+ text
9
+ } = Node.get(editor, path);
10
+ const currentPath = Path.parent(editor.selection.focus.path);
11
+ const nextPath = Path.next(currentPath);
12
+ if (text?.length) {
13
+ Transforms.insertNodes(editor, {
14
+ type: "paragraph",
15
+ children: [{
16
+ text: ""
17
+ }]
18
+ }, {
19
+ at: nextPath,
20
+ select: true
21
+ });
22
+ }
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"