@flozy/editor 1.8.8 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -118,7 +118,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
118
118
  pageBgImage,
119
119
  pageColor,
120
120
  color: pageTextColor,
121
- pageWidth
121
+ pageWidth,
122
+ maxWidth: pageMaxWidth
122
123
  } = pageSt?.pageProps || {
123
124
  bannerSpacing: {
124
125
  left: 0,
@@ -355,13 +356,16 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
355
356
  className: `${hasTopBanner() ? "has-topbanner" : ""}`,
356
357
  sx: classes.slateWrapper,
357
358
  id: "slate-wrapper-scroll-container",
359
+ style: {
360
+ background: pageColor || "#FFF"
361
+ },
358
362
  children: /*#__PURE__*/_jsxs(Box, {
359
363
  component: "div",
360
364
  className: "max-content",
361
365
  children: [renderTopBanner(), /*#__PURE__*/_jsx("div", {
362
366
  className: "scroll-area",
363
367
  style: {
364
- background: pageColor || "#FFF",
368
+ // background: pageColor || "#FFF",
365
369
  color: pageTextColor || "#000000"
366
370
  },
367
371
  children: /*#__PURE__*/_jsxs(Box, {
@@ -378,7 +382,8 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
378
382
  alignSelf: "center",
379
383
  transformOrigin: "left top",
380
384
  transition: "all 0.3s",
381
- minHeight: "87%"
385
+ minHeight: "87%",
386
+ maxWidth: pageMaxWidth ? `${parseInt(pageMaxWidth)}px !important` : "auto"
382
387
  },
383
388
  children: [!readOnly ? /*#__PURE__*/_jsx(PopupTool, {
384
389
  onDrawerOpen: onDrawerOpen
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import ToolbarIcon from "../../common/ToolbarIcon";
3
+ import Icon from "../../common/Icon";
4
+ import { toggleBlock } from "../../utils/SlateUtilityFunctions";
5
+ import { useSlateStatic } from "slate-react";
6
+ import insertNewLine from "../../utils/insertNewLine";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ const ColorboxButton = props => {
10
+ const editor = useSlateStatic();
11
+ const {
12
+ icoBtnType
13
+ } = props;
14
+ const onClick = () => {
15
+ toggleBlock(editor, "blockquote", false, {
16
+ bgColor: "rgb(227, 236, 255)"
17
+ });
18
+ insertNewLine(editor);
19
+ };
20
+ return /*#__PURE__*/_jsx(_Fragment, {
21
+ children: /*#__PURE__*/_jsx(ToolbarIcon, {
22
+ title: "Colorbox",
23
+ onClick: onClick,
24
+ icon: /*#__PURE__*/_jsx(Icon, {
25
+ icon: "colorbox"
26
+ }),
27
+ icoBtnType: icoBtnType
28
+ })
29
+ });
30
+ };
31
+ export default ColorboxButton;
@@ -18,7 +18,7 @@ const SimpleTextStyle = ({
18
18
  position: "absolute",
19
19
  zIndex: -1,
20
20
  left: "0px",
21
- top: "-1px",
21
+ top: "0px",
22
22
  bottom: 0,
23
23
  margin: "auto",
24
24
  pointerEvents: "none",
@@ -8,7 +8,8 @@ const Title = props => {
8
8
  return /*#__PURE__*/_jsx("div", {
9
9
  ...attributes,
10
10
  style: {
11
- fontWeight: "bold"
11
+ fontWeight: "bold",
12
+ fontSize: "20px"
12
13
  },
13
14
  children: children
14
15
  });
@@ -107,7 +107,7 @@ const editorStyles = ({
107
107
  width: "fit-content",
108
108
  "& button": {
109
109
  boxShadow: "none",
110
- color: "rgb(85, 85, 85)",
110
+ color: "#D7D7D6",
111
111
  background: "rgb(221, 221, 221, 0.1)",
112
112
  "&:hover": {
113
113
  background: "rgb(221, 221, 221, 0.8)"
@@ -28,6 +28,7 @@ import EmojiButton from "../Elements/Emoji/EmojiButton.js";
28
28
  import "./styles.css";
29
29
  import TopBannerButton from "../Elements/TopBanner/TopBannerButton.js";
30
30
  import AttachmentsButton from "../Elements/Attachments/AttachmentsButton";
31
+ import ColorboxButton from "../Elements/Colorbox/ColorboxButton.js";
31
32
  import { jsx as _jsx } from "react/jsx-runtime";
32
33
  import { jsxs as _jsxs } from "react/jsx-runtime";
33
34
  export const RenderToolbarIcon = props => {
@@ -186,6 +187,12 @@ export const RenderToolbarIcon = props => {
186
187
  customProps: customProps,
187
188
  icoBtnType: icoBtnType
188
189
  }, element.id);
190
+ case "colorbox":
191
+ return /*#__PURE__*/_jsx(ColorboxButton, {
192
+ editor: editor,
193
+ customProps: customProps,
194
+ icoBtnType: icoBtnType
195
+ }, element.id);
189
196
  case "docsUpload":
190
197
  return /*#__PURE__*/_jsx(AttachmentsButton, {
191
198
  editor: editor,
@@ -170,6 +170,12 @@ export const toolbarGroups = [[{
170
170
  format: "topbanner",
171
171
  type: "topbanner",
172
172
  group: "elements"
173
+ }, {
174
+ id: 47,
175
+ format: "colorbox",
176
+ type: "colorbox",
177
+ title: "Colorbox",
178
+ group: "elements"
173
179
  }, {
174
180
  id: 42,
175
181
  type: "table",
@@ -7,13 +7,13 @@ import { useEditorContext } from "../../hooks/useMouseMove";
7
7
  import { Transforms } from "slate";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
10
- const DRAGGABLE_TYPES = ["paragraph", "headingOne", "headinTwo", "headingThree", "grid"];
10
+ const DRAGGABLE_TYPES = ["paragraph", "headingOne", "headingTwo", "headingThree", "grid"];
11
11
  const DragHandleStyle = () => ({
12
12
  dragHandle: {
13
13
  opacity: 0,
14
14
  content: '" "',
15
15
  position: "absolute",
16
- top: "2px",
16
+ top: "0px",
17
17
  left: "-52px",
18
18
  borderRadius: "0px",
19
19
  padding: "0px",
@@ -24,7 +24,7 @@ const DragHandleStyle = () => ({
24
24
  alignItems: "center",
25
25
  justifyContent: "center",
26
26
  cursor: "grab",
27
- color: "rgb(85, 85, 85)",
27
+ color: "#D7D7D6",
28
28
  background: "rgb(221, 221, 221, 0.1)",
29
29
  "& svg": {
30
30
  width: "20px"
@@ -44,11 +44,17 @@ const DragHandleStyle = () => ({
44
44
  top: 0,
45
45
  width: "100%",
46
46
  height: "100%",
47
+ pointerEvents: "none",
48
+ zIndex: -1,
47
49
  "&.dragging": {
48
50
  backgroundColor: "#def4ff"
49
51
  }
50
52
  },
51
53
  dropAreaOver: {
54
+ position: "absolute",
55
+ left: 0,
56
+ top: 0,
57
+ width: "100%",
52
58
  height: "4px"
53
59
  }
54
60
  });
@@ -84,8 +90,9 @@ const DragHandle = props => {
84
90
  setDragging(isDragging);
85
91
  };
86
92
  return canDraggable ? /*#__PURE__*/_jsxs("div", {
93
+ contentEditable: false,
87
94
  children: [/*#__PURE__*/_jsx(Box, {
88
- className: dragging ? "dragging" : "",
95
+ className: `drag-alert ${dragging ? "dragging" : ""}`,
89
96
  sx: classes.dropArea
90
97
  }), /*#__PURE__*/_jsx(Droppable, {
91
98
  id: id,
@@ -99,7 +99,7 @@ const Section = props => {
99
99
  backgroundImage: `url(${sectionBackgroundImage})`
100
100
  } : {};
101
101
  return path.length === 1 ? /*#__PURE__*/_jsxs(Box, {
102
- component: "section",
102
+ component: "div",
103
103
  className: `ed-section-wrapper ${readOnly ? "" : "hselect"} ${needHover}`,
104
104
  sx: {
105
105
  ...classes.root,
@@ -121,9 +121,9 @@ const Section = props => {
121
121
  ...getBreakPointsValue(sectionGridSize || 8, null, "overrideGridSize", true)
122
122
  }
123
123
  },
124
- children: [/*#__PURE__*/_jsx(DragHandle, {
124
+ children: [!readOnly ? /*#__PURE__*/_jsx(DragHandle, {
125
125
  ...props
126
- }), children, /*#__PURE__*/_jsx(Toolbar, {})]
126
+ }) : null, children, /*#__PURE__*/_jsx(Toolbar, {})]
127
127
  }), openSetttings ? /*#__PURE__*/_jsx(SectionPopup, {
128
128
  element: {
129
129
  ...element,
@@ -32,7 +32,7 @@ const SaveAsTemplate = props => {
32
32
  const file = e.target.files[0];
33
33
  const strImage = await convertBase64(file);
34
34
  setBase64(strImage);
35
- doUpload(strImage);
35
+ doUpload(e.target.files[0]);
36
36
  };
37
37
  const onChange = e => {
38
38
  setTemplate({
@@ -40,11 +40,13 @@ const SaveAsTemplate = props => {
40
40
  [e.target.name]: e.target.value
41
41
  });
42
42
  };
43
- const doUpload = async strImage => {
43
+ const doUpload = async file => {
44
44
  setUploading(true);
45
- const result = await uploadFile({
46
- image: strImage
47
- }, customProps);
45
+ const formData = new FormData();
46
+ formData.set("file", file);
47
+ formData.set("resource_type", "pages");
48
+ formData.set("resource_id", customProps?.page_id);
49
+ const result = await uploadFile(formData, customProps);
48
50
  setUploading(false);
49
51
  if (result && result?.imageURL) {
50
52
  setTemplate({
@@ -26,5 +26,14 @@ const pageSettingsStyle = [{
26
26
  key: "bannerSpacing",
27
27
  type: "bannerSpacing"
28
28
  }]
29
+ }, {
30
+ tab: "Max Width",
31
+ value: "maxWidth",
32
+ fields: [{
33
+ label: "Max Width",
34
+ key: "maxWidth",
35
+ type: "text",
36
+ placeholder: "Maximum width of page in px"
37
+ }]
29
38
  }];
30
39
  export default pageSettingsStyle;
@@ -28,7 +28,6 @@ const Uploader = props => {
28
28
  const doUpload = async (strImage, file) => {
29
29
  setUploading(true);
30
30
  const formData = new FormData();
31
- // formData.set("image", strImage);
32
31
  formData.set("file", file);
33
32
  formData.set("resource_type", "pages");
34
33
  formData.set("resource_id", customProps?.page_id);
@@ -1586,8 +1586,8 @@ export const CheckListButton = () => /*#__PURE__*/_jsx("svg", {
1586
1586
  width: "23",
1587
1587
  height: "23",
1588
1588
  rx: "11.5",
1589
- fill: "#F4F6F9",
1590
- stroke: "#E0E0E0"
1589
+ fill: "none",
1590
+ stroke: "#CCCCCC"
1591
1591
  })
1592
1592
  });
1593
1593
  export const CheckListButtonActive = () => /*#__PURE__*/_jsxs("svg", {
@@ -1596,13 +1596,24 @@ export const CheckListButtonActive = () => /*#__PURE__*/_jsxs("svg", {
1596
1596
  viewBox: "0 0 24 24",
1597
1597
  fill: "none",
1598
1598
  xmlns: "http://www.w3.org/2000/svg",
1599
- children: [/*#__PURE__*/_jsx("rect", {
1599
+ children: [/*#__PURE__*/_jsx("defs", {
1600
+ children: /*#__PURE__*/_jsxs("linearGradient", {
1601
+ id: "Gradient1",
1602
+ children: [/*#__PURE__*/_jsx("stop", {
1603
+ offset: "0%",
1604
+ stopColor: "#5351FC"
1605
+ }), /*#__PURE__*/_jsx("stop", {
1606
+ offset: "50%",
1607
+ stopColor: "#19A9FC"
1608
+ })]
1609
+ })
1610
+ }), /*#__PURE__*/_jsx("rect", {
1600
1611
  x: "0.5",
1601
1612
  y: "0.5",
1602
1613
  width: "23",
1603
1614
  height: "23",
1604
1615
  rx: "11.5",
1605
- fill: "#2563EB"
1616
+ fill: "url(#Gradient1)"
1606
1617
  }), /*#__PURE__*/_jsx("path", {
1607
1618
  d: "M7.0625 12.0896L10.6849 15.7105L17.9267 8.46875",
1608
1619
  stroke: "white",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.8.8",
3
+ "version": "1.9.0",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"