@capillarytech/creatives-library 8.0.14 → 8.0.17
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.
package/package.json
CHANGED
package/utils/tagValidations.js
CHANGED
|
@@ -253,5 +253,16 @@ export const preprocessHtml = (content) => {
|
|
|
253
253
|
"\n": "", // Handling newlines by replacing them with an empty string
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
|
|
257
|
+
const styleTagRegex = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
258
|
+
|
|
259
|
+
const contentWithStyleFixes = content?.replace(styleTagRegex, (match, styleContent) => {
|
|
260
|
+
// Replace all occurrences of %} with % } within the style content
|
|
261
|
+
const modifiedStyleContent = styleContent?.replace(/%}/g, '% }');
|
|
262
|
+
// Reconstruct the <style> tag with the modified content
|
|
263
|
+
return match.replace(styleContent, modifiedStyleContent);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// Step 2: Perform the standard replacements on the entire content
|
|
267
|
+
return contentWithStyleFixes?.replace(/'|"|&|<|>|"|\n/g, match => replacements[match]);
|
|
257
268
|
};
|
|
@@ -415,5 +415,10 @@ describe('preprocessHtml', () => {
|
|
|
415
415
|
const expectedOutput = "This is &lt; not an entity.";
|
|
416
416
|
expect(preprocessHtml(input)).toEqual(expectedOutput);
|
|
417
417
|
});
|
|
418
|
+
it('Should handle style tags with %}', () => {
|
|
419
|
+
const input = "<style {line-height:0;font-size:75%} >sup{line-height:0;font-size:75%}</style> ";
|
|
420
|
+
const expectedOutput = "<style {line-height:0;font-size:75%} >sup{line-height:0;font-size:75% }</style> ";
|
|
421
|
+
expect(preprocessHtml(input)).toEqual(expectedOutput);
|
|
422
|
+
});
|
|
418
423
|
|
|
419
424
|
});
|
|
@@ -19,8 +19,9 @@ import './style.scss';
|
|
|
19
19
|
const loadScript = require('load-script');
|
|
20
20
|
|
|
21
21
|
const defaultScriptUrl = `${window.location.origin}/arya/ui/library/ckeditor/ckeditor.js`;
|
|
22
|
-
//
|
|
23
|
-
|
|
22
|
+
//const defaultScriptUrl = 'https://nightly.intouch.capillarytech.com/arya/ui/library/ckeditor/ckeditor.js';
|
|
23
|
+
/*Uncomment the above line to use CKEDITOR in local
|
|
24
|
+
*/
|
|
24
25
|
const user = localStorage.getItem('user');
|
|
25
26
|
let locale = 'en';
|
|
26
27
|
if (user && JSON.parse(user).lang) {
|
|
@@ -1062,6 +1062,26 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1062
1062
|
continueSaveForm = (id) => {
|
|
1063
1063
|
|
|
1064
1064
|
};
|
|
1065
|
+
handleLiquidTemplateSubmit =(templateContent) => {
|
|
1066
|
+
if(templateContent){this.setState((prevState) => {
|
|
1067
|
+
return {
|
|
1068
|
+
formData: {
|
|
1069
|
+
...prevState?.formData,
|
|
1070
|
+
base: {
|
|
1071
|
+
...prevState?.formData?.base,
|
|
1072
|
+
en: {
|
|
1073
|
+
...prevState?.formData?.base?.en,
|
|
1074
|
+
"template-content": preprocessHtml(templateContent)
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}, () => {
|
|
1080
|
+
if (this.props.onSubmit) {
|
|
1081
|
+
this.props.onSubmit(this.state.formData);
|
|
1082
|
+
}
|
|
1083
|
+
});}
|
|
1084
|
+
}
|
|
1065
1085
|
saveForm(saveForm) {
|
|
1066
1086
|
if (this.props.isNewVersionFlow && !saveForm) {
|
|
1067
1087
|
this.props.getValidationData();
|
|
@@ -1069,9 +1089,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1069
1089
|
}
|
|
1070
1090
|
if ( this.state.isFormValid ) {
|
|
1071
1091
|
if (this.liquidFlow) {
|
|
1092
|
+
const templateContent = this.state.formData?.base?.en?.["template-content"] || "";
|
|
1072
1093
|
//Converts given HTML content to plain text string.
|
|
1073
1094
|
const content = convert(
|
|
1074
|
-
|
|
1095
|
+
templateContent
|
|
1075
1096
|
);
|
|
1076
1097
|
/*
|
|
1077
1098
|
The `handleResult` function is used as a callback for `getLiquidTags` to handle the results post-processing.
|
|
@@ -1124,7 +1145,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1124
1145
|
this.props.stopValidation();
|
|
1125
1146
|
return;
|
|
1126
1147
|
}
|
|
1127
|
-
this.
|
|
1148
|
+
this.handleLiquidTemplateSubmit(templateContent);
|
|
1128
1149
|
}
|
|
1129
1150
|
};
|
|
1130
1151
|
this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);
|
|
@@ -259,6 +259,7 @@ export default [
|
|
|
259
259
|
export function* capSagaForFetchSchemaForEntity() {
|
|
260
260
|
yield all([
|
|
261
261
|
watchFetchSchemaForEntity(),
|
|
262
|
+
watchLiquidEntity(),
|
|
262
263
|
])
|
|
263
264
|
}
|
|
264
265
|
|
|
@@ -270,5 +271,6 @@ export function* v2CapSagas() {
|
|
|
270
271
|
watchForFetchUserInfo(),
|
|
271
272
|
watchGetTopbarMenuData(),
|
|
272
273
|
watchForGetVideosConfig(),
|
|
274
|
+
watchLiquidEntity(),
|
|
273
275
|
])
|
|
274
276
|
}
|