@flozy/editor 3.4.4 → 3.4.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -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,
|
@@ -27,7 +27,8 @@ const Form = props => {
|
|
27
27
|
site_id,
|
28
28
|
page_id,
|
29
29
|
onFormSubmit = () => {},
|
30
|
-
tagName = "Pages"
|
30
|
+
tagName = "Pages",
|
31
|
+
isIframe = false
|
31
32
|
} = customProps;
|
32
33
|
const {
|
33
34
|
buttonProps,
|
@@ -131,7 +132,8 @@ const Form = props => {
|
|
131
132
|
fieldKey: pair[0],
|
132
133
|
[pair[0]]: pair[1],
|
133
134
|
placeholder: placeholder,
|
134
|
-
form_name: formName
|
135
|
+
form_name: formName,
|
136
|
+
tagName: tagName
|
135
137
|
});
|
136
138
|
}
|
137
139
|
let params = {
|
@@ -406,7 +408,7 @@ const Form = props => {
|
|
406
408
|
element: element,
|
407
409
|
closeWorkflow: closeWorkflow,
|
408
410
|
onSave: onSave
|
409
|
-
}), !readOnly ? /*#__PURE__*/_jsxs(Menu, {
|
411
|
+
}), !readOnly && !isIframe ? /*#__PURE__*/_jsxs(Menu, {
|
410
412
|
className: "editor-btn-options",
|
411
413
|
open: anchorEl !== null,
|
412
414
|
anchorEl: anchorEl,
|
@@ -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
|
+
};
|