@capillarytech/creatives-library 8.0.236-alpha.2 → 8.0.236-alpha.3
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 +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +22 -108
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -62
- package/v2Components/TemplatePreview/_templatePreview.scss +9 -0
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/InApp/index.js +3 -54
package/package.json
CHANGED
|
@@ -43,7 +43,6 @@ const CodeEditorPaneComponent = ({
|
|
|
43
43
|
intl,
|
|
44
44
|
readOnly = false,
|
|
45
45
|
className = '',
|
|
46
|
-
isFullscreenMode = false,
|
|
47
46
|
onLabelInsert,
|
|
48
47
|
forwardedRef,
|
|
49
48
|
// Tags-related props
|
|
@@ -54,7 +53,7 @@ const CodeEditorPaneComponent = ({
|
|
|
54
53
|
onTagSelect = null,
|
|
55
54
|
onContextChange = null,
|
|
56
55
|
}) => {
|
|
57
|
-
const { content
|
|
56
|
+
const { content } = useEditorContext();
|
|
58
57
|
const { content: contentValue, updateContent } = content;
|
|
59
58
|
const editorRef = useRef(null);
|
|
60
59
|
const viewRef = useRef(null);
|
|
@@ -139,9 +138,7 @@ const CodeEditorPaneComponent = ({
|
|
|
139
138
|
if (typeof tagData === 'string') {
|
|
140
139
|
tagText = tagData;
|
|
141
140
|
} else if (tagData) {
|
|
142
|
-
const {
|
|
143
|
-
text, name, label, value,
|
|
144
|
-
} = tagData;
|
|
141
|
+
const { text, name, label, value } = tagData;
|
|
145
142
|
tagText = text || name || label || value || '';
|
|
146
143
|
}
|
|
147
144
|
const formattedTag = tagText ? `{{${tagText}}}` : '';
|
|
@@ -194,114 +191,31 @@ const CodeEditorPaneComponent = ({
|
|
|
194
191
|
// Initialize CodeMirror effect
|
|
195
192
|
useEffect(() => {
|
|
196
193
|
if (editorRef.current && !viewRef.current) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// Use the comprehensive extensions from properSyntaxHighlighting.js
|
|
209
|
-
// This includes: html(), syntaxHighlighting(comprehensiveVSCodeTheme), cleanEditorTheme
|
|
210
|
-
// Note: Webpack configuration ensures CodeMirror packages are in a single shared chunk
|
|
211
|
-
// to prevent multiple instances that break instanceof checks
|
|
212
|
-
const robustExtensions = createRobustExtensions();
|
|
213
|
-
|
|
214
|
-
console.log('[CodeEditorPane] Robust extensions created:', {
|
|
215
|
-
extensionsCount: robustExtensions.length,
|
|
216
|
-
extensions: robustExtensions.map((ext) => {
|
|
217
|
-
try {
|
|
218
|
-
return typeof ext === 'function' ? 'function' : (ext?.constructor?.name || typeof ext);
|
|
219
|
-
} catch (e) {
|
|
220
|
-
return 'unknown';
|
|
221
|
-
}
|
|
222
|
-
}),
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
// Add additional extensions for line numbers, active line, and update listener
|
|
226
|
-
// IMPORTANT: Ensure all extensions come from the same CodeMirror instance
|
|
227
|
-
const lineNumbersExt = lineNumbers();
|
|
228
|
-
const highlightActiveLineExt = highlightActiveLine();
|
|
229
|
-
const updateListenerExt = EditorView.updateListener.of((update) => {
|
|
194
|
+
// Use the comprehensive extensions from properSyntaxHighlighting.js
|
|
195
|
+
// This includes: html(), syntaxHighlighting(comprehensiveVSCodeTheme), cleanEditorTheme
|
|
196
|
+
const robustExtensions = createRobustExtensions();
|
|
197
|
+
|
|
198
|
+
// Add additional extensions for line numbers, active line, and update listener
|
|
199
|
+
const extensions = [
|
|
200
|
+
lineNumbers(),
|
|
201
|
+
highlightActiveLine(),
|
|
202
|
+
...robustExtensions, // Spread the robust extensions (html, syntax highlighting, theme)
|
|
203
|
+
EditorView.updateListener.of((update) => {
|
|
230
204
|
if (update.docChanged) {
|
|
231
205
|
updateContentRef.current(update.state.doc.toString());
|
|
232
206
|
}
|
|
233
|
-
})
|
|
234
|
-
|
|
235
|
-
// Flatten any nested arrays in robustExtensions (shouldn't happen, but be safe)
|
|
236
|
-
const flattenedRobustExtensions = robustExtensions.flat();
|
|
237
|
-
|
|
238
|
-
const extensions = [
|
|
239
|
-
lineNumbersExt,
|
|
240
|
-
highlightActiveLineExt,
|
|
241
|
-
...flattenedRobustExtensions, // Spread the robust extensions (html, syntax highlighting, theme)
|
|
242
|
-
updateListenerExt,
|
|
243
|
-
];
|
|
244
|
-
|
|
245
|
-
console.log('[CodeEditorPane] All extensions prepared:', {
|
|
246
|
-
totalExtensions: extensions.length,
|
|
247
|
-
extensionTypes: extensions.map((ext) => {
|
|
248
|
-
try {
|
|
249
|
-
return typeof ext === 'function' ? 'function' : (ext?.constructor?.name || typeof ext);
|
|
250
|
-
} catch (e) {
|
|
251
|
-
return 'unknown';
|
|
252
|
-
}
|
|
253
|
-
}),
|
|
254
|
-
extensionDetails: extensions.map((ext, idx) => {
|
|
255
|
-
try {
|
|
256
|
-
return {
|
|
257
|
-
index: idx,
|
|
258
|
-
type: typeof ext,
|
|
259
|
-
constructor: ext?.constructor?.name,
|
|
260
|
-
isArray: Array.isArray(ext),
|
|
261
|
-
isFunction: typeof ext === 'function',
|
|
262
|
-
hasTo: typeof ext?.to === 'function',
|
|
263
|
-
hasOf: typeof ext?.of === 'function',
|
|
264
|
-
// Check if it's a valid CodeMirror extension
|
|
265
|
-
isExtension: ext && (typeof ext === 'function' || typeof ext?.to === 'function' || typeof ext?.of === 'function'),
|
|
266
|
-
};
|
|
267
|
-
} catch (e) {
|
|
268
|
-
return { index: idx, error: e.message };
|
|
269
|
-
}
|
|
270
|
-
}),
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
// Validate extensions before creating EditorState
|
|
274
|
-
const invalidExtensions = extensions.filter((ext) => {
|
|
275
|
-
if (!ext) return true;
|
|
276
|
-
if (typeof ext === 'function') return false; // Functions are valid
|
|
277
|
-
if (typeof ext?.to === 'function') return false; // Extension objects with .to() are valid
|
|
278
|
-
if (typeof ext?.of === 'function') return false; // Extension objects with .of() are valid
|
|
279
|
-
if (Array.isArray(ext)) return true; // Arrays should be flattened
|
|
280
|
-
return true; // Unknown type
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
if (invalidExtensions.length > 0) {
|
|
284
|
-
console.error('[CodeEditorPane] Invalid extensions detected:', invalidExtensions);
|
|
285
|
-
throw new Error(`Invalid CodeMirror extensions detected. This usually means multiple instances of @codemirror packages are loaded.`);
|
|
286
|
-
}
|
|
207
|
+
}),
|
|
208
|
+
];
|
|
287
209
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
293
|
-
console.log('[CodeEditorPane] EditorState created successfully');
|
|
210
|
+
const state = EditorState.create({
|
|
211
|
+
doc: contentValue || '',
|
|
212
|
+
extensions,
|
|
213
|
+
});
|
|
294
214
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
} catch (error) {
|
|
300
|
-
// Log error for debugging - this should not happen if webpack config is correct
|
|
301
|
-
console.error('Error initializing CodeMirror editor:', error);
|
|
302
|
-
// Re-throw to prevent silent failures
|
|
303
|
-
throw error;
|
|
304
|
-
}
|
|
215
|
+
viewRef.current = new EditorView({
|
|
216
|
+
state,
|
|
217
|
+
parent: editorRef.current,
|
|
218
|
+
});
|
|
305
219
|
}
|
|
306
220
|
|
|
307
221
|
return () => {
|
|
@@ -76,7 +76,7 @@ export const comprehensiveVSCodeTheme = HighlightStyle.define([
|
|
|
76
76
|
{ tag: tags.link, color: '#4fc1ff', textDecoration: 'underline' },
|
|
77
77
|
{ tag: tags.heading, color: '#9cdcfe', fontWeight: 'bold' },
|
|
78
78
|
{ tag: tags.emphasis, fontStyle: 'italic' },
|
|
79
|
-
{ tag: tags.strong, fontWeight: 'bold' }
|
|
79
|
+
{ tag: tags.strong, fontWeight: 'bold' }
|
|
80
80
|
]);
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -88,7 +88,7 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
88
88
|
height: "500px",
|
|
89
89
|
backgroundColor: "#1e1e1e",
|
|
90
90
|
fontSize: "14px",
|
|
91
|
-
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
91
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
92
92
|
},
|
|
93
93
|
".cm-content": {
|
|
94
94
|
padding: "12px",
|
|
@@ -96,17 +96,17 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
96
96
|
fontSize: "14px",
|
|
97
97
|
lineHeight: "20px",
|
|
98
98
|
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",
|
|
99
|
-
color: "#d4d4d4"
|
|
99
|
+
color: "#d4d4d4" // Base text color for all content
|
|
100
100
|
},
|
|
101
101
|
".cm-focused": {
|
|
102
|
-
outline: "none"
|
|
102
|
+
outline: "none"
|
|
103
103
|
},
|
|
104
104
|
".cm-editor": {
|
|
105
105
|
borderRadius: "0",
|
|
106
|
-
border: "none"
|
|
106
|
+
border: "none"
|
|
107
107
|
},
|
|
108
108
|
".cm-scroller": {
|
|
109
|
-
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
109
|
+
fontFamily: "'DM Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace"
|
|
110
110
|
},
|
|
111
111
|
".cm-lineNumbers": {
|
|
112
112
|
fontSize: "14px",
|
|
@@ -117,25 +117,25 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
117
117
|
paddingLeft: "8px",
|
|
118
118
|
borderRight: "1px solid #3e3e3e",
|
|
119
119
|
minWidth: "45px",
|
|
120
|
-
textAlign: "right"
|
|
120
|
+
textAlign: "right"
|
|
121
121
|
},
|
|
122
122
|
".cm-gutters": {
|
|
123
123
|
backgroundColor: "#1e1e1e",
|
|
124
|
-
borderRight: "1px solid #3e3e3e"
|
|
124
|
+
borderRight: "1px solid #3e3e3e"
|
|
125
125
|
},
|
|
126
126
|
".cm-activeLine": {
|
|
127
|
-
backgroundColor: "#2a2d2e"
|
|
127
|
+
backgroundColor: "#2a2d2e"
|
|
128
128
|
},
|
|
129
129
|
".cm-selection": {
|
|
130
|
-
backgroundColor: "#264f78"
|
|
130
|
+
backgroundColor: "#264f78"
|
|
131
131
|
},
|
|
132
132
|
".cm-cursor": {
|
|
133
|
-
borderLeft: "2px solid #ffffff"
|
|
133
|
+
borderLeft: "2px solid #ffffff"
|
|
134
134
|
},
|
|
135
135
|
// Additional fallback for text nodes
|
|
136
136
|
".cm-line": {
|
|
137
|
-
color: "#d4d4d4"
|
|
138
|
-
}
|
|
137
|
+
color: "#d4d4d4"
|
|
138
|
+
}
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
/**
|
|
@@ -143,60 +143,21 @@ export const cleanEditorTheme = EditorView.theme({
|
|
|
143
143
|
* Uses only verified tags to avoid undefined errors
|
|
144
144
|
*/
|
|
145
145
|
export const createRobustExtensions = () => {
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
const highlighting = syntaxHighlighting(comprehensiveVSCodeTheme);
|
|
150
|
-
|
|
151
|
-
console.log('[createRobustExtensions] Extension instances:', {
|
|
152
|
-
htmlLang: typeof htmlLang,
|
|
153
|
-
highlighting: typeof highlighting,
|
|
154
|
-
cleanEditorTheme: typeof cleanEditorTheme,
|
|
155
|
-
htmlLangType: htmlLang?.constructor?.name,
|
|
156
|
-
highlightingType: highlighting?.constructor?.name,
|
|
157
|
-
highlightingIsArray: Array.isArray(highlighting),
|
|
158
|
-
comprehensiveVSCodeThemeType: comprehensiveVSCodeTheme?.constructor?.name,
|
|
159
|
-
// Check if highlighting needs to be spread
|
|
160
|
-
highlightingLength: Array.isArray(highlighting) ? highlighting.length : 'not array',
|
|
161
|
-
});
|
|
146
|
+
return [
|
|
147
|
+
// 1. HTML language support with proper parsing
|
|
148
|
+
html(),
|
|
162
149
|
|
|
163
|
-
//
|
|
164
|
-
|
|
150
|
+
// 2. SAFE syntax highlighting (using only confirmed tags)
|
|
151
|
+
syntaxHighlighting(comprehensiveVSCodeTheme),
|
|
165
152
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// 2. SAFE syntax highlighting (using only confirmed tags)
|
|
171
|
-
highlightingExtension,
|
|
172
|
-
|
|
173
|
-
// 3. Clean theme (structure only, no color conflicts)
|
|
174
|
-
cleanEditorTheme,
|
|
175
|
-
];
|
|
176
|
-
|
|
177
|
-
console.log('[createRobustExtensions] Extensions array created:', {
|
|
178
|
-
length: extensions.length,
|
|
179
|
-
allValid: extensions.every((ext) => ext !== null && ext !== undefined),
|
|
180
|
-
extensionDetails: extensions.map((ext, idx) => ({
|
|
181
|
-
index: idx,
|
|
182
|
-
type: typeof ext,
|
|
183
|
-
constructor: ext?.constructor?.name,
|
|
184
|
-
isArray: Array.isArray(ext),
|
|
185
|
-
hasTo: typeof ext?.to === 'function',
|
|
186
|
-
hasOf: typeof ext?.of === 'function',
|
|
187
|
-
})),
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
return extensions;
|
|
191
|
-
} catch (error) {
|
|
192
|
-
console.error('[createRobustExtensions] Error creating extensions:', error);
|
|
193
|
-
throw error;
|
|
194
|
-
}
|
|
153
|
+
// 3. Clean theme (structure only, no color conflicts)
|
|
154
|
+
cleanEditorTheme
|
|
155
|
+
];
|
|
195
156
|
};
|
|
196
157
|
|
|
197
158
|
// Export the main function
|
|
198
159
|
export default {
|
|
199
160
|
comprehensiveVSCodeTheme,
|
|
200
161
|
cleanEditorTheme,
|
|
201
|
-
createRobustExtensions
|
|
202
|
-
};
|
|
162
|
+
createRobustExtensions
|
|
163
|
+
};
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
display: flex;
|
|
22
22
|
width: 200px;
|
|
23
23
|
left: 28%;
|
|
24
|
+
background-color: $CAP_WHITE;
|
|
24
25
|
|
|
25
26
|
.inapp-title-POPUP-ANDROID {
|
|
26
27
|
margin: 10% $CAP_SPACE_08 $CAP_SPACE_08 $CAP_SPACE_08;
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
width: 17.571rem;
|
|
63
64
|
left: 18%;
|
|
64
65
|
top: 4.071rem;
|
|
66
|
+
background-color: $CAP_WHITE;
|
|
65
67
|
|
|
66
68
|
.inapp-title-HEADER-ANDROID {
|
|
67
69
|
left: 34%;
|
|
@@ -128,6 +130,7 @@
|
|
|
128
130
|
|
|
129
131
|
|
|
130
132
|
.inapp-message-container-FOOTER-ANDROID {
|
|
133
|
+
background-color: $CAP_WHITE;
|
|
131
134
|
position: absolute;
|
|
132
135
|
display: flex;
|
|
133
136
|
justify-content: center;
|
|
@@ -201,6 +204,7 @@
|
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
.inapp-message-container-FULLSCREEN-ANDROID {
|
|
207
|
+
background-color: $CAP_WHITE;
|
|
204
208
|
position: absolute;
|
|
205
209
|
top: 10%;
|
|
206
210
|
display: flex;
|
|
@@ -239,6 +243,7 @@
|
|
|
239
243
|
}
|
|
240
244
|
|
|
241
245
|
.inapp-message-container-POPUP-iOS {
|
|
246
|
+
background-color: $CAP_WHITE;
|
|
242
247
|
position: absolute;
|
|
243
248
|
top: 20%;
|
|
244
249
|
display: flex;
|
|
@@ -279,6 +284,7 @@
|
|
|
279
284
|
}
|
|
280
285
|
|
|
281
286
|
.inapp-message-container-HEADER-iOS {
|
|
287
|
+
background-color: $CAP_WHITE;
|
|
282
288
|
position: absolute;
|
|
283
289
|
display: flex;
|
|
284
290
|
width: 16.571rem;
|
|
@@ -348,6 +354,7 @@
|
|
|
348
354
|
}
|
|
349
355
|
|
|
350
356
|
.inapp-message-container-FOOTER-iOS {
|
|
357
|
+
background-color: $CAP_WHITE;
|
|
351
358
|
position: absolute;
|
|
352
359
|
display: flex;
|
|
353
360
|
justify-content: center;
|
|
@@ -421,6 +428,7 @@
|
|
|
421
428
|
}
|
|
422
429
|
|
|
423
430
|
.inapp-message-container-FULLSCREEN-iOS {
|
|
431
|
+
background-color: $CAP_WHITE;
|
|
424
432
|
position: absolute;
|
|
425
433
|
top: 10%;
|
|
426
434
|
display: flex;
|
|
@@ -459,6 +467,7 @@
|
|
|
459
467
|
}
|
|
460
468
|
|
|
461
469
|
.inapp-message-container-MODAL-ANDROID, .inapp-message-container-MODAL-iOS {
|
|
470
|
+
background-color: $CAP_WHITE;
|
|
462
471
|
position: absolute;
|
|
463
472
|
top: 30%;
|
|
464
473
|
display: flex;
|
|
@@ -24,24 +24,20 @@ const HTMLEditorTesting = () => {
|
|
|
24
24
|
// Show/Hide editor
|
|
25
25
|
show: () => {
|
|
26
26
|
setIsVisible(true);
|
|
27
|
-
console.log('✅ HTMLEditor test mode activated');
|
|
28
27
|
},
|
|
29
28
|
|
|
30
29
|
hide: () => {
|
|
31
30
|
setIsVisible(false);
|
|
32
|
-
console.log('✅ HTMLEditor test mode deactivated');
|
|
33
31
|
},
|
|
34
32
|
|
|
35
33
|
toggle: () => {
|
|
36
|
-
setIsVisible(prev => !prev);
|
|
37
|
-
console.log(`✅ HTMLEditor test mode ${!isVisible ? 'activated' : 'deactivated'}`);
|
|
34
|
+
setIsVisible((prev) => !prev);
|
|
38
35
|
},
|
|
39
36
|
|
|
40
37
|
// Variant control
|
|
41
38
|
setVariant: (newVariant) => {
|
|
42
39
|
if (['email', 'inapp'].includes(newVariant)) {
|
|
43
40
|
setVariant(newVariant);
|
|
44
|
-
console.log(`✅ Variant set to: ${newVariant}`);
|
|
45
41
|
} else {
|
|
46
42
|
console.error('❌ Invalid variant. Use: "email" or "inapp"');
|
|
47
43
|
}
|
|
@@ -52,7 +48,6 @@ const HTMLEditorTesting = () => {
|
|
|
52
48
|
const validLayouts = Object.values(LAYOUT_TYPES);
|
|
53
49
|
if (validLayouts.includes(layout)) {
|
|
54
50
|
setLayoutType(layout);
|
|
55
|
-
console.log(`✅ Layout set to: ${layout}`);
|
|
56
51
|
} else {
|
|
57
52
|
console.error(`❌ Invalid layout. Use: ${validLayouts.join(', ')}`);
|
|
58
53
|
}
|
|
@@ -61,58 +56,22 @@ const HTMLEditorTesting = () => {
|
|
|
61
56
|
// Content control
|
|
62
57
|
setContent: (newContent) => {
|
|
63
58
|
setContent(newContent);
|
|
64
|
-
console.log('✅ Content updated');
|
|
65
59
|
},
|
|
66
60
|
|
|
67
61
|
getContent: () => {
|
|
68
|
-
console.log('Current content:', content);
|
|
69
62
|
return content;
|
|
70
63
|
},
|
|
71
64
|
|
|
72
65
|
// Status
|
|
73
66
|
status: () => {
|
|
74
|
-
console.log('📊 HTMLEditor Test Status:');
|
|
75
|
-
console.log(` Visible: ${isVisible}`);
|
|
76
|
-
console.log(` Variant: ${variant}`);
|
|
77
|
-
console.log(` Layout: ${layoutType}`);
|
|
78
|
-
console.log(` Content size: ${content.length} chars`);
|
|
79
67
|
},
|
|
80
68
|
|
|
81
69
|
// Help
|
|
82
70
|
help: () => {
|
|
83
|
-
|
|
84
|
-
🚀 HTMLEditor Testing Console Commands:
|
|
85
|
-
|
|
86
|
-
📱 Basic Controls:
|
|
87
|
-
htmlEditorTest.show() - Show the editor
|
|
88
|
-
htmlEditorTest.hide() - Hide the editor
|
|
89
|
-
htmlEditorTest.toggle() - Toggle editor visibility
|
|
90
|
-
|
|
91
|
-
⚙️ Configuration:
|
|
92
|
-
htmlEditorTest.setVariant('email') - Set to email variant
|
|
93
|
-
htmlEditorTest.setVariant('inapp') - Set to inapp variant
|
|
94
|
-
htmlEditorTest.setLayout('POPUP') - Set layout (inapp only)
|
|
95
|
-
- Valid: POPUP, HEADER, FOOTER, FULLSCREEN
|
|
96
|
-
|
|
97
|
-
📝 Content:
|
|
98
|
-
htmlEditorTest.setContent('<h1>Test</h1>') - Set editor content
|
|
99
|
-
htmlEditorTest.getContent() - Get current content
|
|
100
|
-
|
|
101
|
-
📊 Status:
|
|
102
|
-
htmlEditorTest.status() - Show current status
|
|
103
|
-
htmlEditorTest.help() - Show this help
|
|
104
|
-
|
|
105
|
-
💡 Example Usage:
|
|
106
|
-
htmlEditorTest.show()
|
|
107
|
-
htmlEditorTest.setVariant('inapp')
|
|
108
|
-
htmlEditorTest.setLayout('HEADER') // Top banner
|
|
109
|
-
htmlEditorTest.setLayout('FOOTER') // Bottom banner
|
|
110
|
-
`);
|
|
111
|
-
}
|
|
71
|
+
},
|
|
112
72
|
};
|
|
113
73
|
|
|
114
74
|
// Show help on first load
|
|
115
|
-
console.log('🚀 HTMLEditor Testing Ready! Type htmlEditorTest.help() for commands');
|
|
116
75
|
|
|
117
76
|
// Cleanup on unmount
|
|
118
77
|
return () => {
|
|
@@ -128,32 +87,40 @@ const HTMLEditorTesting = () => {
|
|
|
128
87
|
}
|
|
129
88
|
|
|
130
89
|
return (
|
|
131
|
-
<div
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
flexDirection: 'column',
|
|
141
|
-
padding: '20px'
|
|
142
|
-
}}>
|
|
143
|
-
{/* Header */}
|
|
144
|
-
<div style={{
|
|
145
|
-
backgroundColor: '#fff',
|
|
146
|
-
padding: '10px 20px',
|
|
147
|
-
borderRadius: '8px 8px 0 0',
|
|
90
|
+
<div
|
|
91
|
+
style={{
|
|
92
|
+
position: 'fixed',
|
|
93
|
+
top: 0,
|
|
94
|
+
left: 0,
|
|
95
|
+
right: 0,
|
|
96
|
+
bottom: 0,
|
|
97
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
98
|
+
zIndex: 9999,
|
|
148
99
|
display: 'flex',
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
borderBottom: '1px solid #ddd'
|
|
100
|
+
flexDirection: 'column',
|
|
101
|
+
padding: '20px',
|
|
152
102
|
}}>
|
|
103
|
+
{/* Header */}
|
|
104
|
+
<div
|
|
105
|
+
style={{
|
|
106
|
+
backgroundColor: '#fff',
|
|
107
|
+
padding: '10px 20px',
|
|
108
|
+
borderRadius: '8px 8px 0 0',
|
|
109
|
+
display: 'flex',
|
|
110
|
+
justifyContent: 'space-between',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
borderBottom: '1px solid #ddd',
|
|
113
|
+
}}>
|
|
153
114
|
<div>
|
|
154
115
|
<strong>HTMLEditor Testing Mode</strong>
|
|
155
116
|
<span style={{ marginLeft: '20px', color: '#666' }}>
|
|
156
|
-
Variant:
|
|
117
|
+
Variant:
|
|
118
|
+
{' '}
|
|
119
|
+
{variant}
|
|
120
|
+
{' '}
|
|
121
|
+
| Layout:
|
|
122
|
+
{' '}
|
|
123
|
+
{layoutType}
|
|
157
124
|
</span>
|
|
158
125
|
</div>
|
|
159
126
|
<button
|
|
@@ -164,7 +131,7 @@ const HTMLEditorTesting = () => {
|
|
|
164
131
|
border: 'none',
|
|
165
132
|
padding: '5px 15px',
|
|
166
133
|
borderRadius: '4px',
|
|
167
|
-
cursor: 'pointer'
|
|
134
|
+
cursor: 'pointer',
|
|
168
135
|
}}
|
|
169
136
|
>
|
|
170
137
|
Close
|
|
@@ -172,12 +139,13 @@ const HTMLEditorTesting = () => {
|
|
|
172
139
|
</div>
|
|
173
140
|
|
|
174
141
|
{/* Editor Container */}
|
|
175
|
-
<div
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
142
|
+
<div
|
|
143
|
+
style={{
|
|
144
|
+
flex: 1,
|
|
145
|
+
backgroundColor: '#fff',
|
|
146
|
+
borderRadius: '0 0 8px 8px',
|
|
147
|
+
overflow: 'hidden',
|
|
148
|
+
}}>
|
|
181
149
|
<IntlProvider locale="en" messages={{}}>
|
|
182
150
|
<HTMLEditor
|
|
183
151
|
variant={variant}
|
|
@@ -185,10 +153,8 @@ const HTMLEditorTesting = () => {
|
|
|
185
153
|
initialContent={content}
|
|
186
154
|
onContentChange={(newContent) => {
|
|
187
155
|
setContent(newContent);
|
|
188
|
-
console.log('📝 Content changed:', newContent.substring(0, 100) + '...');
|
|
189
156
|
}}
|
|
190
|
-
onSave={(
|
|
191
|
-
console.log('💾 Content saved:', savedContent);
|
|
157
|
+
onSave={() => {
|
|
192
158
|
}}
|
|
193
159
|
/>
|
|
194
160
|
</IntlProvider>
|
|
@@ -264,21 +264,6 @@ export const InApp = (props) => {
|
|
|
264
264
|
},
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
|
-
// Check for editor-type in template metadata first (most reliable)
|
|
268
|
-
const storedEditorType = get(versions, `base['editor-type']`, null);
|
|
269
|
-
const isStoredHTMLTemplate = storedEditorType === INAPP_EDITOR_TYPES.HTML_EDITOR;
|
|
270
|
-
|
|
271
|
-
// Check if this is a Bee editor template - if so, it should NOT use HTML editor
|
|
272
|
-
const isBEEeditorTemplate = get(editContent, 'ANDROID.isBEEeditor') || get(editContent, 'IOS.isBEEeditor');
|
|
273
|
-
|
|
274
|
-
// Debug logging
|
|
275
|
-
console.log('[InApp] Editor type detection:', {
|
|
276
|
-
storedEditorType,
|
|
277
|
-
isStoredHTMLTemplate,
|
|
278
|
-
isBEEeditorTemplate,
|
|
279
|
-
editContentKeys: Object.keys(editContent || {}),
|
|
280
|
-
});
|
|
281
|
-
|
|
282
267
|
const androidContent = editContent?.ANDROID;
|
|
283
268
|
let androidIsHTML = false;
|
|
284
269
|
if (!isEmpty(androidContent)) {
|
|
@@ -297,22 +282,7 @@ export const InApp = (props) => {
|
|
|
297
282
|
const androidCtaLength = androidCtas?.length;
|
|
298
283
|
|
|
299
284
|
// Check if this is an HTML template
|
|
300
|
-
|
|
301
|
-
// If it's a Bee editor template, it should NOT be treated as HTML editor
|
|
302
|
-
androidIsHTML = !isBEEeditorTemplate && (
|
|
303
|
-
isStoredHTMLTemplate
|
|
304
|
-
|| androidType === INAPP_MEDIA_TYPES.HTML
|
|
305
|
-
|| androidStyle === BIG_HTML
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
console.log('[InApp] Android content check:', {
|
|
309
|
-
androidIsHTML,
|
|
310
|
-
isBEEeditorTemplate,
|
|
311
|
-
androidType,
|
|
312
|
-
androidStyle,
|
|
313
|
-
isStoredHTMLTemplate,
|
|
314
|
-
});
|
|
315
|
-
|
|
285
|
+
androidIsHTML = androidType === INAPP_MEDIA_TYPES.HTML || androidStyle === BIG_HTML;
|
|
316
286
|
setIsHTMLTemplate(androidIsHTML);
|
|
317
287
|
|
|
318
288
|
setTitleAndroid(androidTitle);
|
|
@@ -356,21 +326,7 @@ export const InApp = (props) => {
|
|
|
356
326
|
// Check if this is an HTML template (if Android wasn't HTML, check iOS)
|
|
357
327
|
// Note: androidIsHTML is in the outer scope from the Android content check above
|
|
358
328
|
if (!androidIsHTML) {
|
|
359
|
-
|
|
360
|
-
const iosIsHTML = !isBEEeditorTemplate && (
|
|
361
|
-
isStoredHTMLTemplate
|
|
362
|
-
|| iosType === INAPP_MEDIA_TYPES.HTML
|
|
363
|
-
|| iosStyle === BIG_HTML
|
|
364
|
-
);
|
|
365
|
-
|
|
366
|
-
console.log('[InApp] iOS content check:', {
|
|
367
|
-
iosIsHTML,
|
|
368
|
-
isBEEeditorTemplate,
|
|
369
|
-
iosType,
|
|
370
|
-
iosStyle,
|
|
371
|
-
isStoredHTMLTemplate,
|
|
372
|
-
});
|
|
373
|
-
|
|
329
|
+
const iosIsHTML = iosType === INAPP_MEDIA_TYPES.HTML || iosStyle === BIG_HTML;
|
|
374
330
|
setIsHTMLTemplate(iosIsHTML);
|
|
375
331
|
// Initialize HTML content for HTMLEditor if feature is enabled and it's an HTML template
|
|
376
332
|
if (iosIsHTML) {
|
|
@@ -387,12 +343,7 @@ export const InApp = (props) => {
|
|
|
387
343
|
setTemplateMessageIos(iosMessage);
|
|
388
344
|
// Update templateMediaType if iOS is HTML and Android wasn't
|
|
389
345
|
if (!androidIsHTML) {
|
|
390
|
-
|
|
391
|
-
const iosIsHTML = !isBEEeditorTemplate && (
|
|
392
|
-
isStoredHTMLTemplate
|
|
393
|
-
|| iosType === INAPP_MEDIA_TYPES.HTML
|
|
394
|
-
|| iosStyle === BIG_HTML
|
|
395
|
-
);
|
|
346
|
+
const iosIsHTML = iosType === INAPP_MEDIA_TYPES.HTML || iosStyle === BIG_HTML;
|
|
396
347
|
if (iosIsHTML) {
|
|
397
348
|
setTemplateMediaType(INAPP_MEDIA_TYPES.HTML);
|
|
398
349
|
} else {
|
|
@@ -828,8 +779,6 @@ export const InApp = (props) => {
|
|
|
828
779
|
ANDROID: androidContent,
|
|
829
780
|
IOS: iosContent,
|
|
830
781
|
},
|
|
831
|
-
// Store editor-type in template metadata for edit mode detection
|
|
832
|
-
...(isHTMLTemplate && { 'editor-type': INAPP_EDITOR_TYPES.HTML_EDITOR }),
|
|
833
782
|
},
|
|
834
783
|
},
|
|
835
784
|
type: INAPP,
|