## Overview

This widget executes a cplaceJS script and renders the result as inline HTML content within a rich string widget.

The Low-Code Text widget enables dynamic, script-computed content to be embedded directly within rich text layouts. On page load, the widget evaluates a JavaScript script with access to contextual data (pages from search, connected tables, or explicit selections) and renders the returned value as HTML. When connected to a table widget, it reactively re-evaluates whenever the table's data or user selection changes, enabling live-updating computed content without page reload.

## Use Cases

### Dynamic Computed Values in Rich Text
Display calculated or derived information inline within formatted page content:
- Aggregated metrics (sums, averages, counts) from search results
- Conditional text based on page attributes or states
- Formatted summaries combining data from multiple sources

### Reactive Content Linked to Tables
Create text that updates when users interact with connected table widgets:
- Details about selected table rows
- Summary statistics that update as the table data changes
- Context-specific information based on the current table selection

### Data-Driven HTML Rendering
Generate custom HTML markup based on page data:
- Visual indicators (colored badges, progress bars) based on attribute values
- Mini-tables or formatted lists from search results
- Formatted dates, numbers, or computed expressions

### Internationalized Dynamic Content
Generate localized content using the `messages` binding to display status messages, computed text, or dynamic values in the user's language.

## Script Return Values

The script simply returns a value to display (no object structure required, unlike the Low-Code Button):
- **String**: Rendered as HTML (sanitized)
- **Number/Boolean/Date**: Converted to string
- **Localized object**: `{en: "Hello", de: "Hallo"}` -- resolved to user's language

## Data Source Options

The widget supports three data source modes (identical to the Low-Code Button):

**Search**: Define a search query whose results are passed as the `pages` binding. Most common mode.

**Connected Table**: Connect to a table widget on the same page. The widget re-evaluates when the table's data changes or when the user's selection changes (if "selection only" is enabled). Supports chained connected tables.

**Selection**: Manually select specific pages to provide as the `pages` binding.

Additionally, **Include All Search Results** can be enabled to provide raw search results (including non-page entities) via the `searchResults` binding.

## Embedding Constraint

This widget can **only** be embedded inside rich string widgets. It cannot be placed directly on a page layout. It renders without a frame and without padding, blending seamlessly into surrounding rich text content.

## Design Considerations

### When to Use This Widget
- You need scripted HTML output — this is the correct widget for rendering HTML from cplaceJS scripts (not `dynamicCodeBlockWidget`, which is text-only)
- You need dynamic, script-computed content within a rich text layout
- The content should update reactively based on connected table interactions
- You want inline computed values (metrics, status text, formatted data) mixed with static rich text

### When NOT to Use This Widget
- For user-triggered actions -- use the **Low-Code Button** instead
- For standalone chart visualizations -- use **cplaceJS Highcharts** or **cplaceJS Line Chart**
- For simple static text -- use the **Rich String** widget directly
- For a full custom widget with its own HTML/CSS/JS, client interactivity, and write-back -- build it in the **Low-Code Widget Builder** and embed it via the Embedded Widget (`cf.cplace.lowCodeWidgetBuilder.embeddedWidget`). Low-Code Text is read-only computed HTML inside a rich string; the Widget Builder is the right tool when you need an interactive, self-contained widget.

### Script Execution Considerations
- Scripts execute synchronously during page rendering and on every re-evaluation
- Keep scripts performant to avoid slow page loads
- Output HTML is sanitized via `RichStringUtilities.clean()` for security

## Testing Before Embedding

Before embedding a Low-Code Text widget into a rich string attribute, test your cplaceJS script independently to verify it produces the expected output.

**Recommended workflow:**
1. Write your cplaceJS script
2. Run it using `cplace_execute_script` with a representative page as the context page
3. Verify the returned HTML/text is correct
4. Only then embed the widget via `cplace_richstring_insert_widget` with the tested script in the properties

**Why this matters:** A script with errors or unexpected output will produce a broken or empty widget once embedded. Debugging scripts inside embedded widgets is significantly harder than debugging them standalone, because the embedded widget rendering does not surface script errors clearly.

## Related Widgets

### Low-Code Button (`cf.cplace.lowCodeWidgets.lowCodeButton`)
The imperative counterpart: executes user-triggered actions on click. Shares the same data source configuration and script bindings but uses a different script structure (`checkAccess()`/`call()` methods).

### Rich String (`cf.platform.richString`)
The typical host widget for Low-Code Text. The rich string provides the static layout structure; embedded Low-Code Text widgets provide dynamic content within it.

### Text without Widget Frame (`cf.cplace.demoWidgets.demoRichString`)
An alternative host widget -- a frameless rich string variant also capable of embedding Low-Code Text widgets.

### Embedded Search as Table (`cf.platform.embeddedSearchAsTable`)
Often used as the connected data source. The table widget provides data or selection events that trigger the Low-Code Text to re-evaluate.
