@flozy/editor 1.5.8 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import React, { useRef, useCallback, useEffect, useMemo, useState, forwardRef, useImperativeHandle } from "react";
2
- import { createEditor } from "slate";
2
+ import { createEditor, Transforms } from "slate";
3
3
  import { Slate, Editable, ReactEditor } from "slate-react";
4
4
  import { DndContext, DragOverlay } from "@dnd-kit/core";
5
5
  import { useDebounce } from "use-debounce";
@@ -167,8 +167,20 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
167
167
  getContent() {
168
168
  return getOnSaveData(deboundedValue);
169
169
  },
170
- insertFragments(fragments) {
171
- editor.insertNode(fragments);
170
+ insertFragments(fragments, clearAll = false) {
171
+ if (!clearAll) {
172
+ editor.insertNode(fragments);
173
+ } else {
174
+ // loop delete all
175
+ editor.children.map(item => {
176
+ Transforms.delete(editor, {
177
+ at: [0]
178
+ });
179
+ });
180
+
181
+ // reset init
182
+ editor.children = fragments;
183
+ }
172
184
  },
173
185
  toggleFullscreen() {
174
186
  setFullScreen(!fullScreen);
@@ -16,7 +16,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
16
16
  import { Fragment as _Fragment } from "react/jsx-runtime";
17
17
  const EMBED_LABEL = {
18
18
  image: "Image",
19
- video: "Video"
19
+ video: "Video or Embed"
20
20
  };
21
21
  const Embed = ({
22
22
  editor,
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { useSlateStatic } from "slate-react";
3
3
  import { IconButton, Tooltip } from "@mui/material";
4
- import FeedIcon from "@mui/icons-material/Feed";
4
+ import { FormIcon } from "../../common/iconslist";
5
5
  import { insertForm } from "../../utils/form";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const FormButton = props => {
@@ -14,7 +14,7 @@ const FormButton = props => {
14
14
  arrow: true,
15
15
  children: /*#__PURE__*/_jsx(IconButton, {
16
16
  onClick: onClick,
17
- children: /*#__PURE__*/_jsx(FeedIcon, {})
17
+ children: /*#__PURE__*/_jsx(FormIcon, {})
18
18
  })
19
19
  });
20
20
  };
@@ -2,7 +2,7 @@ const accordionTitleBtnStyle = [{
2
2
  tab: "Colors",
3
3
  value: "colors",
4
4
  fields: [{
5
- label: "Text",
5
+ label: "Text Color",
6
6
  key: "textColor",
7
7
  type: "color",
8
8
  needPreview: true
@@ -11,11 +11,11 @@ const accordionTitleBtnStyle = [{
11
11
  key: "btnBg",
12
12
  type: "color"
13
13
  }, {
14
- label: "Background",
14
+ label: "Background Color",
15
15
  key: "bgColor",
16
16
  type: "color"
17
17
  }, {
18
- label: "Border",
18
+ label: "Border Color",
19
19
  key: "borderColor",
20
20
  type: "color"
21
21
  }]
@@ -18,16 +18,16 @@ const accordionTitleStyle = [{
18
18
  tab: "Colors",
19
19
  value: "colors",
20
20
  fields: [{
21
- label: "Text",
21
+ label: "Text Color",
22
22
  key: "textColor",
23
23
  type: "color",
24
24
  needPreview: true
25
25
  }, {
26
- label: "Background",
26
+ label: "Background Color",
27
27
  key: "bgColor",
28
28
  type: "color"
29
29
  }, {
30
- label: "Border",
30
+ label: "Border Color",
31
31
  key: "borderColor",
32
32
  type: "color"
33
33
  }]
@@ -121,16 +121,16 @@ const buttonStyle = [{
121
121
  tab: "Colors",
122
122
  value: "colors",
123
123
  fields: [{
124
- label: "Text",
124
+ label: "Text Color",
125
125
  key: "textColor",
126
126
  type: "color",
127
127
  needPreview: true
128
128
  }, {
129
- label: "Background",
129
+ label: "Background Color",
130
130
  key: "bgColor",
131
131
  type: "color"
132
132
  }, {
133
- label: "Border",
133
+ label: "Border Color",
134
134
  key: "borderColor",
135
135
  type: "color"
136
136
  }]
@@ -138,16 +138,16 @@ const buttonStyle = [{
138
138
  tab: "Hover Colors",
139
139
  value: "hoverColors",
140
140
  fields: [{
141
- label: "Text",
141
+ label: "Hover Text Color",
142
142
  key: "textColorHover",
143
143
  type: "color",
144
144
  needPreview: true
145
145
  }, {
146
- label: "Background",
146
+ label: "Hover Background Color",
147
147
  key: "bgColorHover",
148
148
  type: "color"
149
149
  }, {
150
- label: "Border",
150
+ label: "Hover Border Color",
151
151
  key: "borderColorHover",
152
152
  type: "color"
153
153
  }]
@@ -42,16 +42,16 @@ const chipTextStyle = [{
42
42
  tab: "Colors",
43
43
  value: "colors",
44
44
  fields: [{
45
- label: "Text",
45
+ label: "Text Color",
46
46
  key: "textColor",
47
47
  type: "color",
48
48
  needPreview: true
49
49
  }, {
50
- label: "Background",
50
+ label: "Background Color",
51
51
  key: "bgColor",
52
52
  type: "color"
53
53
  }, {
54
- label: "Border",
54
+ label: "Border Color",
55
55
  key: "borderColor",
56
56
  type: "color"
57
57
  }]
@@ -38,16 +38,16 @@ const embedImageStyle = [{
38
38
  tab: "Colors",
39
39
  value: "colors",
40
40
  fields: [{
41
- label: "Text",
41
+ label: "Text Color",
42
42
  key: "textColor",
43
43
  type: "color",
44
44
  needPreview: true
45
45
  }, {
46
- label: "Background",
46
+ label: "Background Color",
47
47
  key: "bgColor",
48
48
  type: "color"
49
49
  }, {
50
- label: "Border",
50
+ label: "Border Color",
51
51
  key: "borderColor",
52
52
  type: "color"
53
53
  }]
@@ -69,16 +69,16 @@ const fieldStyle = [{
69
69
  tab: "Colors",
70
70
  value: "colors",
71
71
  fields: [{
72
- label: "Text",
72
+ label: "Text Color",
73
73
  key: "textColor",
74
74
  type: "color",
75
75
  needPreview: true
76
76
  }, {
77
- label: "Background",
77
+ label: "Background Color",
78
78
  key: "bgColor",
79
79
  type: "color"
80
80
  }, {
81
- label: "Border",
81
+ label: "Border Color",
82
82
  key: "borderColor",
83
83
  type: "color"
84
84
  }]
@@ -72,16 +72,16 @@ const formButtonStyle = [{
72
72
  tab: "Colors",
73
73
  value: "colors",
74
74
  fields: [{
75
- label: "Text",
75
+ label: "Text Color",
76
76
  key: "textColor",
77
77
  type: "color",
78
78
  needPreview: true
79
79
  }, {
80
- label: "Background",
80
+ label: "Background Color",
81
81
  key: "bgColor",
82
82
  type: "color"
83
83
  }, {
84
- label: "Border",
84
+ label: "Border Color",
85
85
  key: "borderColor",
86
86
  type: "color"
87
87
  }]
@@ -96,16 +96,16 @@ const formStyle = [{
96
96
  tab: "Colors",
97
97
  value: "colors",
98
98
  fields: [{
99
- label: "Text",
99
+ label: "Text Color",
100
100
  key: "textColor",
101
101
  type: "color",
102
102
  needPreview: true
103
103
  }, {
104
- label: "Background",
104
+ label: "Background Color",
105
105
  key: "bgColor",
106
106
  type: "color"
107
107
  }, {
108
- label: "Border",
108
+ label: "Border Color",
109
109
  key: "borderColor",
110
110
  type: "color"
111
111
  }]
@@ -22,7 +22,7 @@ const pageSettingsStyle = [{
22
22
  tab: "Spacing",
23
23
  value: "spacing",
24
24
  fields: [{
25
- label: "bannerSpacing",
25
+ label: "Padding",
26
26
  key: "bannerSpacing",
27
27
  type: "bannerSpacing"
28
28
  }]
@@ -1381,4 +1381,29 @@ export const GridAddSectionIcon = props => /*#__PURE__*/_jsxs("svg", {
1381
1381
  strokeLinecap: "round",
1382
1382
  strokeLinejoin: "round"
1383
1383
  })]
1384
- });
1384
+ });
1385
+ export const FormIcon = () => {
1386
+ return /*#__PURE__*/_jsxs("svg", {
1387
+ xmlns: "http://www.w3.org/2000/svg",
1388
+ width: "22",
1389
+ height: "22",
1390
+ viewBox: "0 0 24 24",
1391
+ fill: "none",
1392
+ children: [/*#__PURE__*/_jsx("path", {
1393
+ d: "M17.6211 9.61914H12.3711C11.9611 9.61914 11.6211 9.27914 11.6211 8.86914C11.6211 8.45914 11.9611 8.11914 12.3711 8.11914H17.6211C18.0311 8.11914 18.3711 8.45914 18.3711 8.86914C18.3711 9.27914 18.0411 9.61914 17.6211 9.61914Z",
1394
+ fill: "#64748B"
1395
+ }), /*#__PURE__*/_jsx("path", {
1396
+ d: "M7.11859 10.3803C6.92859 10.3803 6.73859 10.3103 6.58859 10.1603L5.83859 9.41031C5.54859 9.12031 5.54859 8.64031 5.83859 8.35031C6.12859 8.06031 6.60859 8.06031 6.89859 8.35031L7.11859 8.57031L8.83859 6.85031C9.12859 6.56031 9.60859 6.56031 9.89859 6.85031C10.1886 7.14031 10.1886 7.62031 9.89859 7.91031L7.64859 10.1603C7.50859 10.3003 7.31859 10.3803 7.11859 10.3803Z",
1397
+ fill: "#64748B"
1398
+ }), /*#__PURE__*/_jsx("path", {
1399
+ d: "M17.6211 16.6191H12.3711C11.9611 16.6191 11.6211 16.2791 11.6211 15.8691C11.6211 15.4591 11.9611 15.1191 12.3711 15.1191H17.6211C18.0311 15.1191 18.3711 15.4591 18.3711 15.8691C18.3711 16.2791 18.0411 16.6191 17.6211 16.6191Z",
1400
+ fill: "#64748B"
1401
+ }), /*#__PURE__*/_jsx("path", {
1402
+ d: "M7.11859 17.3803C6.92859 17.3803 6.73859 17.3103 6.58859 17.1603L5.83859 16.4103C5.54859 16.1203 5.54859 15.6403 5.83859 15.3503C6.12859 15.0603 6.60859 15.0603 6.89859 15.3503L7.11859 15.5703L8.83859 13.8503C9.12859 13.5603 9.60859 13.5603 9.89859 13.8503C10.1886 14.1403 10.1886 14.6203 9.89859 14.9103L7.64859 17.1603C7.50859 17.3003 7.31859 17.3803 7.11859 17.3803Z",
1403
+ fill: "#64748B"
1404
+ }), /*#__PURE__*/_jsx("path", {
1405
+ d: "M15 22.75H9C3.57 22.75 1.25 20.43 1.25 15V9C1.25 3.57 3.57 1.25 9 1.25H15C20.43 1.25 22.75 3.57 22.75 9V15C22.75 20.43 20.43 22.75 15 22.75ZM9 2.75C4.39 2.75 2.75 4.39 2.75 9V15C2.75 19.61 4.39 21.25 9 21.25H15C19.61 21.25 21.25 19.61 21.25 15V9C21.25 4.39 19.61 2.75 15 2.75H9Z",
1406
+ fill: "#64748B"
1407
+ })]
1408
+ });
1409
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"