@flozy/editor 1.6.4 → 1.6.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.
@@ -855,4 +855,42 @@ blockquote {
855
855
  /** to avoid line space **/
856
856
  .page-settings {
857
857
  height: 0px;
858
+ }
859
+
860
+ /* HTML: <div class="loader"></div> */
861
+ .img-loader-wrapper {
862
+ width:28px;
863
+ aspect-ratio: 1;
864
+ border-radius: 50%;
865
+ background: #F10C49;
866
+ animation: l9 2s infinite;
867
+ }
868
+ @keyframes l9 {
869
+ 0% {box-shadow:
870
+ 0 -16px #F4DD51, calc(16px*0.707) calc(-16px*0.707) #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
871
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
872
+ 12.5% {box-shadow:
873
+ 0 0 #F4DD51, calc(16px*0.707) calc(-16px*0.707) #E3AAD6,16px 0 #F4DD51, 0 0 #E3AAD6,
874
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
875
+ 25% {box-shadow:
876
+ 0 0 #F4DD51, 0 0 #E3AAD6,16px 0 #F4DD51, calc(16px*0.707) calc(16px*0.707) #E3AAD6,
877
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
878
+ 37.5% {box-shadow:
879
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, calc(16px*0.707) calc(16px*0.707) #E3AAD6,
880
+ 0 16px #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
881
+ 50% {box-shadow:
882
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
883
+ 0 16px #F4DD51, calc(-16px*0.707) calc(16px*0.707) #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
884
+ 62.5% {box-shadow:
885
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
886
+ 0 0 #F4DD51, calc(-16px*0.707) calc(16px*0.707) #E3AAD6,-16px 0 #F4DD51, 0 0 #E3AAD6}
887
+ 75% {box-shadow:
888
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
889
+ 0 0 #F4DD51, 0 0 #E3AAD6,-16px 0 #F4DD51, calc(-16px*0.707) calc(-16px*0.707) #E3AAD6}
890
+ 87.5% {box-shadow:
891
+ 0 -16px #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
892
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, calc(-16px*0.707) calc(-16px*0.707) #E3AAD6}
893
+ 100% {box-shadow:
894
+ 0 -16px #F4DD51, calc(16px*0.707) calc(-16px*0.707) #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6,
895
+ 0 0 #F4DD51, 0 0 #E3AAD6,0 0 #F4DD51, 0 0 #E3AAD6}
858
896
  }
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { Grid, Tabs, Tab, Card, CardMedia, CardContent, Box } from "@mui/material";
2
+ import { Grid, Tabs, Tab, Card, CardMedia, CardContent, Box, CircularProgress } from "@mui/material";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { jsxs as _jsxs } from "react/jsx-runtime";
5
5
  const Categories = props => {
@@ -23,6 +23,24 @@ const Categories = props => {
23
23
  }, m))
24
24
  });
25
25
  };
26
+ const ProgressBar = ({
27
+ loading
28
+ }) => {
29
+ return loading ? /*#__PURE__*/_jsx(Grid, {
30
+ item: true,
31
+ xs: 12,
32
+ style: {
33
+ display: "flex",
34
+ justifyContent: "center",
35
+ alignItems: "center",
36
+ margin: 0,
37
+ padding: 0,
38
+ height: "50px",
39
+ overflow: "hidden"
40
+ },
41
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
42
+ }) : null;
43
+ };
26
44
  const AddTemplates = props => {
27
45
  const {
28
46
  classes,
@@ -33,6 +51,7 @@ const AddTemplates = props => {
33
51
  const {
34
52
  services
35
53
  } = customProps;
54
+ const [loading, setLoading] = useState(false);
36
55
  const [categories, setCategories] = useState([]);
37
56
  const [category, setCategory] = useState("");
38
57
  const [templates, setTemplates] = useState([]);
@@ -41,6 +60,7 @@ const AddTemplates = props => {
41
60
  getTemplatesList();
42
61
  }, []);
43
62
  const getTemplatesList = async () => {
63
+ setLoading(true);
44
64
  const result = await services("listTemplates", {});
45
65
  const tempList = result?.data?.filter(f => f.type === "Template");
46
66
  const lic = tempList?.reduce((a, b) => {
@@ -54,6 +74,7 @@ const AddTemplates = props => {
54
74
  setCategories(lic);
55
75
  setCategory(lic[0]);
56
76
  setFilteredTemplates(ft);
77
+ setLoading(false);
57
78
  };
58
79
  const handleChange = (event, newValue) => {
59
80
  setCategory(newValue);
@@ -79,27 +100,31 @@ const AddTemplates = props => {
79
100
  data: categories,
80
101
  handleChange: handleChange
81
102
  })
82
- }), /*#__PURE__*/_jsx(Grid, {
103
+ }), /*#__PURE__*/_jsxs(Grid, {
83
104
  container: true,
84
- spacing: 1,
105
+ spacing: 0,
85
106
  className: `${fullScreen ? "fullscreen" : ""}`,
86
107
  sx: classes.templateCardsWrpr,
87
- children: filteredTemplates.map(m => {
108
+ children: [/*#__PURE__*/_jsx(ProgressBar, {
109
+ loading: loading
110
+ }), filteredTemplates.map(m => {
88
111
  return /*#__PURE__*/_jsx(Grid, {
89
112
  item: true,
90
113
  xs: 4,
91
114
  children: /*#__PURE__*/_jsxs(Card, {
92
115
  sx: classes.templateCard,
93
116
  onClick: onSelectTemplate(m),
94
- children: [/*#__PURE__*/_jsx(Box, {
117
+ children: [/*#__PURE__*/_jsxs(Box, {
95
118
  sx: classes.templateCardMediaWrpr,
96
- children: /*#__PURE__*/_jsx(CardMedia, {
119
+ children: [/*#__PURE__*/_jsx("div", {
120
+ className: "img-loader-wrapper"
121
+ }), /*#__PURE__*/_jsx(CardMedia, {
97
122
  className: `template-card-media ${fullScreen ? "fullscreen" : ""}`,
98
123
  component: "div",
99
124
  image: m?.thumbnail,
100
125
  alt: m?.title,
101
126
  sx: classes.templateCardMedia
102
- })
127
+ })]
103
128
  }), /*#__PURE__*/_jsx(CardContent, {
104
129
  style: {
105
130
  height: "30px"
@@ -108,7 +133,7 @@ const AddTemplates = props => {
108
133
  })]
109
134
  })
110
135
  }, `template_${m.id}`);
111
- })
136
+ })]
112
137
  })]
113
138
  });
114
139
  };
@@ -21,7 +21,8 @@ const usePopupStyle = () => ({
21
21
  "&.templates": {
22
22
  width: "500px",
23
23
  "&.fullscreen": {
24
- width: "100%"
24
+ width: "100%",
25
+ maxHeight: "fit-content"
25
26
  }
26
27
  },
27
28
  "& .headerContainer": {},
@@ -130,18 +131,33 @@ const usePopupStyle = () => ({
130
131
  backgroundSize: "100% auto",
131
132
  borderRadius: "10px",
132
133
  boxShadow: "0px 1px 3px 3px rgba(0,0,0,0.12)",
134
+ zIndex: 1,
135
+ position: "relative",
133
136
  "&.fullscreen": {
134
137
  height: "280px"
135
138
  }
136
139
  },
137
140
  templateCardMediaWrpr: {
138
- padding: "8px",
141
+ position: "relative",
142
+ padding: "4px",
143
+ margin: "8px",
139
144
  border: "1px solid rgba(0, 0, 0, 0.1)",
140
145
  borderRadius: "10px",
141
- background: "#FEFEFE",
146
+ backgroundColor: "#FEFEFE",
142
147
  overflow: "hidden",
143
148
  "&:hover": {
144
149
  border: "1px solid #2563EB"
150
+ },
151
+ "& .img-loader-wrapper": {
152
+ position: "absolute",
153
+ width: "12px",
154
+ height: "12px",
155
+ left: 0,
156
+ right: 0,
157
+ top: 0,
158
+ bottom: 0,
159
+ margin: "auto",
160
+ zIndex: 0
145
161
  }
146
162
  },
147
163
  templateCardsWrpr: {
@@ -1,27 +1,33 @@
1
1
  import { Transforms } from "slate";
2
2
  import insertNewLine from "./insertNewLine";
3
3
  export const insertAccordion = editor => {
4
- const accordion = {
5
- type: "accordion",
6
- children: [{
7
- type: "accordion-summary",
4
+ try {
5
+ const accordion = {
6
+ type: "accordion",
8
7
  children: [{
9
- type: "paragraph",
8
+ type: "accordion-summary",
10
9
  children: [{
11
- text: ""
10
+ type: "paragraph",
11
+ children: [{
12
+ text: ""
13
+ }]
12
14
  }]
13
- }]
14
- }, {
15
- type: "accordion-details",
16
- children: [{
17
- type: "paragraph",
15
+ }, {
16
+ type: "accordion-details",
18
17
  children: [{
19
- text: ""
18
+ type: "paragraph",
19
+ children: [{
20
+ text: ""
21
+ }]
20
22
  }]
21
23
  }]
22
- }]
23
- };
24
- Transforms.insertNodes(editor, accordion);
25
- Transforms.move(editor);
26
- insertNewLine(editor);
24
+ };
25
+ Transforms.insertNodes(editor, accordion);
26
+ Transforms.move(editor, {
27
+ at: editor.selection.anchor.path
28
+ });
29
+ insertNewLine(editor);
30
+ } catch (err) {
31
+ console.log(err);
32
+ }
27
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"