@flozy/editor 3.4.5 → 3.4.7

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.
@@ -69,6 +69,7 @@ const Leaf = ({
69
69
  const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
70
70
  const {
71
71
  id,
72
+ agency_id,
72
73
  site_id,
73
74
  page_title,
74
75
  content,
@@ -277,6 +278,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
277
278
  ...(otherProps || {}),
278
279
  readOnly: isReadOnly,
279
280
  page_id: id,
281
+ agency_id: agency_id,
280
282
  site_id: site_id,
281
283
  page_title: page_title,
282
284
  isIframe: isIframe,
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from "react";
2
2
  import sanitizeHtml from "sanitize-html";
3
- import { allowedDomains } from "../../utils/helper";
3
+ import { allowedDomains, decodeString } from "../../utils/helper";
4
4
 
5
5
  // const sanitize = (input) => {
6
6
  // const doc = new DOMParser().parseFromString(input, "text/html");
@@ -23,11 +23,12 @@ const Code = props => {
23
23
  children
24
24
  } = props;
25
25
  const {
26
- embedData
26
+ embedData,
27
+ isEncoded
27
28
  } = element;
28
29
  useEffect(() => {
29
30
  if (codeRef?.current) {
30
- const clean = sanitizeHtml(embedData, {
31
+ const clean = sanitizeHtml(isEncoded ? decodeString(embedData) : embedData, {
31
32
  allowedTags: false,
32
33
  // Allow all tags
33
34
  allowedAttributes: false,
@@ -24,6 +24,7 @@ const Form = props => {
24
24
  } = props;
25
25
  const {
26
26
  readOnly,
27
+ agency_id,
27
28
  site_id,
28
29
  page_id,
29
30
  onFormSubmit = () => {},
@@ -132,15 +133,18 @@ const Form = props => {
132
133
  fieldKey: pair[0],
133
134
  [pair[0]]: pair[1],
134
135
  placeholder: placeholder,
135
- form_name: formName
136
+ form_name: formName,
137
+ tagName: tagName
136
138
  });
137
139
  }
138
140
  let params = {
139
141
  page_id: page_id,
142
+ agency_id: agency_id,
140
143
  site_id: site_id,
141
144
  form_id: `${formName}`,
142
145
  uid: `${page_id}_${uid ? uid : formName}`,
143
146
  response: response,
147
+ tagName: tagName,
144
148
  form_data: {
145
149
  user_email: user_email,
146
150
  email: element?.email,
@@ -71,11 +71,11 @@ const FormWorkflow = props => {
71
71
  children: [/*#__PURE__*/_jsx(Grid, {
72
72
  item: true,
73
73
  sx: classes.radioBtn,
74
- children: /*#__PURE__*/_jsxs(RadioGroup, {
74
+ children: /*#__PURE__*/_jsx(RadioGroup, {
75
75
  name: "set timing",
76
76
  value: schedule,
77
77
  defaultValue: 1,
78
- children: [/*#__PURE__*/_jsx(FormControlLabel, {
78
+ children: /*#__PURE__*/_jsx(FormControlLabel, {
79
79
  value: "immediately",
80
80
  label: "Immediately",
81
81
  onChange: () => {
@@ -84,16 +84,7 @@ const FormWorkflow = props => {
84
84
  control: /*#__PURE__*/_jsx(Radio, {
85
85
  size: "small"
86
86
  })
87
- }), /*#__PURE__*/_jsx(FormControlLabel, {
88
- value: "after",
89
- label: "After",
90
- onChange: () => {
91
- setSchedule("after");
92
- },
93
- control: /*#__PURE__*/_jsx(Radio, {
94
- size: "small"
95
- })
96
- })]
87
+ })
97
88
  })
98
89
  }), schedule === "after" && /*#__PURE__*/_jsx(Grid, {
99
90
  item: true,
@@ -36,7 +36,9 @@ const UserInputs = props => {
36
36
  miniEditorPlaceholder: `Hey {{ field_name }} \n\nThanks for attending the event called {{ Event Name }} at {{ Event Time }} on {{ Event Time }}.`,
37
37
  otherProps: {
38
38
  variableOptions: variables,
39
- fontStyleOptions: ['underline']
39
+ fontStyleOptions: ['underline'],
40
+ hideLink: true,
41
+ hideTextColor: true
40
42
  }
41
43
  })
42
44
  })
@@ -19,7 +19,9 @@ const BasicToolbar = props => {
19
19
  const {
20
20
  otherProps: {
21
21
  variableOptions,
22
- fontStyleOptions
22
+ fontStyleOptions,
23
+ hideLink = false,
24
+ hideTextColor = false
23
25
  }
24
26
  } = props;
25
27
 
@@ -57,13 +59,13 @@ const BasicToolbar = props => {
57
59
  ...m
58
60
  }, `pptool_mark_${i}_${m.id}`);
59
61
  })
60
- }), /*#__PURE__*/_jsx(Grid, {
62
+ }), !hideLink && /*#__PURE__*/_jsx(Grid, {
61
63
  item: true,
62
64
  children: /*#__PURE__*/_jsx(LinkButton, {
63
65
  active: isBlockActive(editor, link.format),
64
66
  editor: editor
65
67
  }, link.id)
66
- }), /*#__PURE__*/_jsx(Grid, {
68
+ }), !hideTextColor && /*#__PURE__*/_jsx(Grid, {
67
69
  item: true,
68
70
  children: /*#__PURE__*/_jsx(Tooltip, {
69
71
  title: "Font Color",
@@ -1,12 +1,15 @@
1
1
  import { Transforms } from "slate";
2
2
  import insertNewLine from "./insertNewLine";
3
+ import { encodeString } from "./helper";
3
4
  export const createEmbedScript = embedData => ({
4
5
  type: "embedScript",
5
- embedData: embedData,
6
+ embedData: encodeString(embedData),
6
7
  children: [{
7
8
  text: " "
8
- }]
9
+ }],
10
+ isEncoded: true // to handle the old code's that already inserted
9
11
  });
12
+
10
13
  export const insertEmbedScript = (editor, embedData) => {
11
14
  try {
12
15
  const embed = createEmbedScript(embedData);
@@ -321,4 +321,22 @@ export const getLinkType = (linkType, url) => {
321
321
  }
322
322
  return linkType;
323
323
  };
324
- export const allowedDomains = ["youtube.com", "lemcal.com", "facebook.com", "calendly.com"];
324
+ export const allowedDomains = ["youtube.com", "lemcal.com", "facebook.com", "calendly.com"];
325
+ export const encodeString = str => {
326
+ try {
327
+ if (str) {
328
+ return btoa(str);
329
+ }
330
+ } catch (err) {
331
+ console.log(err);
332
+ }
333
+ };
334
+ export const decodeString = str => {
335
+ try {
336
+ if (str) {
337
+ return atob(str);
338
+ }
339
+ } catch (err) {
340
+ console.log(err);
341
+ }
342
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"