@capillarytech/creatives-library 8.0.253 → 8.0.255-alpha.0

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.253",
4
+ "version": "8.0.255-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -26,6 +26,7 @@ import { injectIntl, intlShape } from 'react-intl';
26
26
 
27
27
  // Messages
28
28
  import CapRow from '@capillarytech/cap-ui-library/CapRow';
29
+ import { createRobustExtensions } from '../../utils/properSyntaxHighlighting';
29
30
  import messages from '../../messages';
30
31
 
31
32
  // Cap UI Components
@@ -208,15 +209,17 @@ const CodeEditorPaneComponent = ({
208
209
  placeholderText = intl.formatMessage(messages.editorPlaceholderInapp);
209
210
  }
210
211
 
211
- // Add additional extensions for line numbers, active line, placeholder, line wrapping, and update listener
212
+ // Use the comprehensive extensions from properSyntaxHighlighting.js
213
+ // This includes: html(), syntaxHighlighting(comprehensiveVSCodeTheme), cleanEditorTheme
214
+ const robustExtensions = createRobustExtensions();
215
+
216
+ // Add additional extensions for line numbers, active line, and update listener
212
217
  const extensions = [
213
218
  lineNumbers(),
214
219
  highlightActiveLine(),
215
220
  placeholder(placeholderText),
221
+ ...robustExtensions, // Spread the robust extensions (html, syntax highlighting, theme)
216
222
  EditorView.lineWrapping, // Enable soft-wrapping of long lines
217
- // html(), // 1. HTML language support - TEMPORARILY DISABLED due to version conflict
218
- // syntaxHighlighting(comprehensiveVSCodeTheme), // 2. Syntax highlighting - TEMPORARILY DISABLED
219
- // cleanEditorTheme, // 3. Theme - TEMPORARILY DISABLED
220
223
  EditorView.updateListener.of((update) => {
221
224
  if (update.docChanged) {
222
225
  updateContentRef.current(update.state.doc.toString());
@@ -11,13 +11,13 @@ import { useValidation } from '../useValidation';
11
11
 
12
12
  // Mock validation utilities
13
13
  jest.mock('../../utils/htmlValidator', () => ({
14
- validateHTML: jest.fn((content, variant, formatMessage) => ({
14
+ validateHTML: jest.fn(() => ({
15
15
  isValid: true,
16
16
  errors: [],
17
17
  warnings: [],
18
18
  info: [],
19
19
  })),
20
- extractAndValidateCSS: jest.fn((content, formatMessage) => ({
20
+ extractAndValidateCSS: jest.fn(() => ({
21
21
  isValid: true,
22
22
  errors: [],
23
23
  warnings: [],
@@ -26,12 +26,12 @@ jest.mock('../../utils/htmlValidator', () => ({
26
26
  }));
27
27
 
28
28
  jest.mock('../../utils/contentSanitizer', () => ({
29
- sanitizeHTML: jest.fn((content, variant, level, formatMessage) => ({
29
+ sanitizeHTML: jest.fn((content) => ({
30
30
  sanitized: content,
31
31
  warnings: [],
32
32
  })),
33
- isContentSafe: jest.fn((content) => true),
34
- findUnsafeContent: jest.fn((content) => []),
33
+ isContentSafe: jest.fn(() => true),
34
+ findUnsafeContent: jest.fn(() => []),
35
35
  }));
36
36
 
37
37
  // Test wrapper component
@@ -311,7 +311,6 @@ describe('useValidation - API Validation Errors', () => {
311
311
 
312
312
  // hasErrors should be false when no API errors and no validation errors
313
313
  // Note: This might be true if validation finds errors, so we check the condition
314
- const hasErrors = screen.getByTestId('has-errors').textContent === 'true';
315
314
  const allIssuesCount = parseInt(screen.getByTestId('all-issues-count').textContent, 10);
316
315
  // If there are no issues, hasErrors should be false
317
316
  if (allIssuesCount === 0) {
@@ -62,7 +62,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
62
62
  isEdit: false,
63
63
  schema: {},
64
64
  loading: false,
65
- isFormValid: true,
66
65
  injectedTags: {},
67
66
  checkValidation: false,
68
67
  saveEdmDataMode: 'save',
@@ -1069,9 +1068,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1069
1068
  return '';
1070
1069
  }
1071
1070
 
1072
- setFormValidity = (isFormValid) => {
1073
- this.setState({isFormValid});
1074
- }
1071
+ setFormValidity = () => {}
1075
1072
 
1076
1073
  setEditData(editData) {
1077
1074
  const isBEESupport = (this.props.location.query.isBEESupport !== "false") || false;
@@ -1309,7 +1306,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1309
1306
  isEdit: false,
1310
1307
  schema: {},
1311
1308
  loading: false,
1312
- isFormValid: true,
1313
1309
  injectedTags: {},
1314
1310
  checkValidation: false,
1315
1311
  tabKey: '',
@@ -2651,14 +2647,14 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
2651
2647
  }
2652
2648
 
2653
2649
  saveFormData = (passedData) => {
2654
- //saveFormData gets called only when validation result is true
2655
2650
  if (this.state.gettingFormData && !this.props.isFullMode) {
2656
2651
  const response = {
2657
2652
  action: "getFormData",
2658
2653
  postAction: this.state.getFormDataValue || 'next',
2659
2654
  id: _.get(this.props, 'Email.templateDetails._id', ''),
2660
2655
  value: this.transformFormData(passedData),
2661
- validity: this.state.isFormValid,
2656
+ //saveFormData gets called only when validation result is true
2657
+ validity: true,
2662
2658
  type: 'EMAIL',
2663
2659
  };
2664
2660