@@ -437,7 +437,7 @@ function injectGitcassoScript(key: keyof typeof PAGES, html: string) {
437
437
'position: fixed;' +
438
438
'top: 80px;' +
439
439
'right: 20px;' +
440
- 'width: 300px ;' +
440
+ 'width: 400px ;' +
441
441
'max-height: 400px;' +
442
442
'background: rgba(255, 255, 255, 0.95);' +
443
443
'border: 1px solid #ddd;' +
@@ -463,46 +463,30 @@ function injectGitcassoScript(key: keyof typeof PAGES, html: string) {
463
463
empty: 'color: #666; font-style: italic;'
464
464
};
465
465
466
- function formatSpot(enhanced, index) {
467
- const { textarea, spot } = enhanced;
468
- const rect = textarea.getBoundingClientRect();
469
- const textareaInfo = {
470
- id: textarea.id || '',
471
- name: textarea.name || '',
472
- className: textarea.className || '',
473
- tagName: textarea.tagName,
474
- placeholder: textarea.placeholder || '',
475
- value: textarea.value ? textarea.value.substring(0, 50) + '...' : '',
476
- parentElement: textarea.parentElement ? textarea.parentElement.tagName + (textarea.parentElement.className ? '.' + textarea.parentElement.className : '') : '',
477
- position: {
478
- top: rect.top,
479
- left: rect.left,
480
- width: rect.width,
481
- height: rect.height
482
- }
483
- };
484
-
485
- return '<div style="' + styles.spotContainer + '">' +
486
- '<div style="' + styles.spotTitle + '">Spot ' + (index + 1) + ':</div>' +
487
- '<pre style="' + styles.jsonPre + '">' + JSON.stringify(spot, null, 2) + '</pre>' +
488
- '<div style="' + styles.textareaHeader + '">Textarea Info:</div>' +
489
- '<pre style="' + styles.textareaPre + '">' + JSON.stringify(textareaInfo, null, 2) + '</pre>' +
490
- '</div>';
491
- }
492
-
493
466
function updateCommentSpotDisplay() {
494
- const enhanced = window.gitcassoTextareaRegistry ? window.gitcassoTextareaRegistry.getAllEnhanced() : [];
495
-
496
- console.log('Enhanced textareas:', enhanced.length);
497
- console.log('All textareas on page:', document.querySelectorAll('textarea').length);
498
-
499
- const content = enhanced.length > 0
500
- ? '<div style="' + styles.header + '">CommentSpots (' + enhanced.length + '):</div>' +
501
- '<div style="font-size: 10px; color: #666; margin-bottom: 8px; word-break: break-all;">URL: ${ urlParts . href } </div>' +
502
- enhanced.map(formatSpot).join('')
503
- : '<div style="' + styles.empty + '">No CommentSpots detected yet...<br><small>Textareas found: ' + document.querySelectorAll('textarea').length + '</small><br><small>URL: ${ urlParts . href } </small></div>';
467
+ const textareas = document.querySelectorAll('textarea');
468
+ const spotsFound = [];
469
+
470
+ for (const textarea of textareas) {
471
+ const forValue = 'id=' + textarea.id + ' name=' + textarea.name + ' className=' + textarea.className;
472
+ const enhancedItem = window.gitcassoTextareaRegistry ? window.gitcassoTextareaRegistry.get(textarea) : undefined;
473
+ if (enhancedItem) {
474
+ spotsFound.push({
475
+ for: forValue,
476
+ spot: enhancedItem.spot,
477
+ title: enhancedItem.enhancer.tableTitle(enhancedItem.spot),
478
+ });
479
+ } else {
480
+ spotsFound.push({
481
+ for: forValue,
482
+ spot: 'NO_SPOT',
483
+ });
484
+ }
485
+ }
504
486
505
- commentSpotDisplay.innerHTML = content;
487
+ console.log('Enhanced textareas:', spotsFound.filter(s => s.spot !== 'NO_SPOT').length);
488
+ console.log('All textareas on page:', textareas.length);
489
+ commentSpotDisplay.innerHTML = '<div style="' + styles.header + '"><pre>${ urlParts . href } \\n' + JSON.stringify(spotsFound, null, 2) + '</pre></div>';
506
490
}
507
491
508
492
// Initial update
0 commit comments