Plugin Directory

Changeset 3423014


Ignore:
Timestamp:
12/18/2025 02:56:01 PM (3 months ago)
Author:
talkgenai
Message:

Initial release v2.4.0

Location:
talkgenai/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • talkgenai/trunk/admin/js/admin.js

    r3413653 r3423014  
    135135        bindPreviewActions(); // Ensure Save App button works on edit page
    136136        bindAdditionalActions(); // Bind new Generate Articles and Get App Ideas buttons
     137        bindErrorOverlayDismiss(); // Make "Keep Calculator" always dismissable (preview sanitizer strips onclick)
    137138       
    138139        // If edit page preloaded app into window.currentAppData, adopt it here
     
    237238        console.log('TalkGenAI Admin initialized');
    238239    }
     240
     241    /**
     242     * Dismiss the preserved-calculator error overlay.
     243     *
     244     * IMPORTANT: showPreview() runs sanitizeHtml(), which removes ALL "on*" attributes (onclick, etc).
     245     * So overlay dismissal must be implemented in admin.js via event delegation.
     246     */
     247    function bindErrorOverlayDismiss() {
     248        try {
     249            if (window.__talkgenai_overlay_dismiss_bound) return;
     250            window.__talkgenai_overlay_dismiss_bound = true;
     251
     252            // Button click: dismiss overlay
     253            $(document).on('click', '#talkgenai-dismiss-btn', function(e) {
     254                try {
     255                    e.preventDefault();
     256                    e.stopPropagation();
     257                } catch (_) {}
     258                $('#talkgenai-error-overlay').remove();
     259                return false;
     260            });
     261
     262            // Click backdrop (outside modal): dismiss overlay
     263            $(document).on('click', '#talkgenai-error-overlay', function(e) {
     264                if (e && e.target === this) {
     265                    $('#talkgenai-error-overlay').remove();
     266                }
     267            });
     268
     269            // Prevent clicks inside the modal from bubbling to the overlay
     270            $(document).on('click', '#talkgenai-error-modal', function(e) {
     271                try {
     272                    e.stopPropagation();
     273                } catch (_) {}
     274            });
     275        } catch (e) {
     276            console.error('TalkGenAI: Failed to bind overlay dismiss handlers:', e);
     277        }
     278    }
    239279   
    240280    /**
     
    391431                $input.val('');
    392432
    393                 // Use existing generate/modify flow with compact prompt
    394                 const compactPrompt = (tgaiChat.messages || []).map(m => (m.role === 'user' ? 'User: ' : 'AI: ') + m.content).join('\n').slice(0, tgaiChat.maxChars || 2000);
     433                // Use existing generate/modify flow with SAFE prompt
     434                // IMPORTANT: Never send the full chat transcript to the backend.
     435                // The transcript can include AI HTML (upgrade prompts, overlays) which pollutes the AI request.
     436                const cleanText = String(text)
     437                    // Strip HTML tags if user pasted HTML
     438                    .replace(/<\/?[a-z][^>]*>/gi, ' ')
     439                    // Collapse whitespace
     440                    .replace(/\s+/g, ' ')
     441                    .trim();
     442                const compactPrompt = ('User: ' + cleanText).slice(0, tgaiChat.maxChars || 2000);
    395443
    396444                // DEBUG: Check what we have
  • talkgenai/trunk/talkgenai.php

    r3416221 r3423014  
    11<?php
    22/**
    3  * Plugin Name: TalkGenAI: AI Calculator Builder, Countdown Timer & To-Do List
     3 * Plugin Name: TalkGenAI – AI App Builder: Calculator, Timer, Todo List, ROI Tool & Custom Widgets
    44 * Plugin URI: https://app.talkgen.ai
    55 * Description: Generate complete web applications using AI. Connect to TalkGenAI server for intelligent app generation with WordPress integration.
Note: See TracChangeset for help on using the changeset viewer.