react-edit-to-html 1.2.6 → 1.2.7
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/README.md +235 -140
- package/dist/index.cjs +20 -20
- package/dist/index.js +4694 -4679
- package/dist/react-edit-to-html.css +1 -1
- package/dist/site.webmanifest +16 -0
- package/dist/src/App.d.ts +1 -1
- package/dist/src/index.d.ts +11 -0
- package/dist/src/types.d.ts +3 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# react-edit-to-html
|
|
2
2
|
|
|
3
|
-
`react-edit-to-html` is a premium, highly customizable, responsive
|
|
3
|
+
`react-edit-to-html` is a premium, highly customizable, responsive HTML editor and visual template builder for creating dynamic HTML layouts. It is perfect for generating backend templates (invoices, shipping lists, email templates, billing letters, reports, PDF documents, etc.) populated with dynamic data.
|
|
4
|
+
|
|
5
|
+
---
|
|
4
6
|
|
|
5
7
|
## 🚀 Live Online Demo
|
|
6
8
|
|
|
@@ -8,25 +10,40 @@ Click the button below to try out `react-edit-to-html` live on CodeSandbox:
|
|
|
8
10
|
|
|
9
11
|
[](https://codesandbox.io/p/devbox/react-edit-to-html-forked-tfsm4n)
|
|
10
12
|
|
|
11
|
-
The editor allows you to structure tables, images, text, and barcodes, preview them in real time with custom mock values, configure loop templates for multiple template engines (Handlebars, Liquid, Scriban, .NET, C
|
|
13
|
+
The editor allows you to structure tables, images, text, and barcodes, preview them in real time with custom mock values, configure loop templates for multiple template engines (**TypeScript (`ts`)**, **JavaScript (`js`) ES6 Template Literals**, Handlebars, Liquid, Scriban, .NET, C#/Razor), and export clean, production-ready HTML files.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🌐 Multi-Framework & TypeScript/JavaScript Support
|
|
18
|
+
|
|
19
|
+
Yes! **`react-edit-to-html` is built with TypeScript (`.ts`/`.tsx`) and supports all JavaScript/TypeScript frameworks**:
|
|
20
|
+
- **React & Next.js** (Native TSX/JSX component)
|
|
21
|
+
- **Vue 3 & Vue 2** (via `mountHtmlEditor` helper)
|
|
22
|
+
- **Angular** (via `mountHtmlEditor` helper)
|
|
23
|
+
- **Svelte & SvelteKit** (via `mountHtmlEditor` helper)
|
|
24
|
+
- **Vanilla JavaScript / TypeScript** (plain HTML, jQuery, PHP, Laravel, Rails, ASP.NET)
|
|
25
|
+
|
|
26
|
+
The package includes full **TypeScript declaration files (`.d.ts`)** and exports `mountHtmlEditor(container, props)` and `unmountHtmlEditor(container)` for non-React or plain JS environments.
|
|
12
27
|
|
|
13
28
|
---
|
|
14
29
|
|
|
15
|
-
## Key Features
|
|
30
|
+
## 🌟 Key Features & Highlights
|
|
16
31
|
|
|
17
|
-
- 🛠 **Drag-and-Drop Canvas:** Select element blocks (headings, paragraphs, tables, images, barcodes) from the sidebar and drag them onto the paper canvas.
|
|
18
|
-
-
|
|
32
|
+
- 🛠 **Drag-and-Drop Canvas Editor:** Select element blocks (headings, paragraphs, tables, images, barcodes) from the sidebar and drag them onto the paper canvas.
|
|
33
|
+
- 🔷 **Full TypeScript & JavaScript Flexibility:** Built in TypeScript with full type definitions (`.d.ts`) + `mountHtmlEditor` helper for Vue, Angular, Svelte, and Vanilla JS.
|
|
34
|
+
- 🟨 **JS/TS ES6 Template Literals (`js` / `ts`):** Dynamic map looping (`${items.map(item => \`...\`).join('')}`) alongside Handlebars, Liquid, Scriban, and C#/Razor syntaxes.
|
|
35
|
+
- 🔄 **Multi-Syntax Loop Templates:** Toggle template engines (`templatingLanguage="js"`, `"ts"`, `"handlebars"`, `"liquid"`, `"scriban"`, `"csharp"`, `"dotnet"`) for dynamic table looping.
|
|
36
|
+
- 🖼 **Image Alignment & Position Controls:** Visual alignment controls (Left, Center, Right) for images and barcodes in both live canvas and exported HTML markup.
|
|
19
37
|
- 📊 **Dynamic Mock Visualizer:** View variables substituted instantly with mock data. Edit mock values for placeholders and raw JSON rows directly in the sidebar.
|
|
20
|
-
- 🎨 **Advanced Styles &
|
|
21
|
-
- 🔤 **Custom Typography:** Register custom font sizes and Google Fonts directly in the panel.
|
|
22
|
-
- 🖼 **Custom Image Types &
|
|
23
|
-
- 📱 **Fully Responsive Layout:** Automatically stacks vertically on smaller screens and side-by-side on
|
|
38
|
+
- 🎨 **Advanced Styles & Layouts:** Customize padding, margin, block widths, element sizing, and colors for a true WYSIWYG editing experience.
|
|
39
|
+
- 🔤 **Custom Typography:** Register custom font sizes, weights, and Google Fonts directly in the panel.
|
|
40
|
+
- 🖼 **Custom Image Types & SVG Barcodes:** Register custom graphic categories (e.g., Signature, Logo, Banner, Watermark, Barcode) on the fly with clean SVG base64 image placeholders.
|
|
41
|
+
- 📱 **Fully Responsive Layout:** Automatically stacks vertically on smaller screens and side-by-side on desktop screens.
|
|
24
42
|
- ⚡ **PDF & HTML Importing:** Import existing HTML templates or parse digital PDF text layers directly into editable canvas blocks.
|
|
25
|
-
- 💾 **Silent Callbacks:** Custom handlers for block changes and template exports instead of intrusive alerts.
|
|
26
43
|
|
|
27
44
|
---
|
|
28
45
|
|
|
29
|
-
## Installation
|
|
46
|
+
## 📦 Installation
|
|
30
47
|
|
|
31
48
|
Install the package via npm:
|
|
32
49
|
|
|
@@ -34,7 +51,7 @@ Install the package via npm:
|
|
|
34
51
|
npm install react-edit-to-html
|
|
35
52
|
```
|
|
36
53
|
|
|
37
|
-
Make sure to import the CSS stylesheet in your
|
|
54
|
+
Make sure to import the CSS stylesheet in your application:
|
|
38
55
|
|
|
39
56
|
```typescript
|
|
40
57
|
import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
@@ -42,50 +59,36 @@ import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
|
42
59
|
|
|
43
60
|
---
|
|
44
61
|
|
|
45
|
-
##
|
|
62
|
+
## 💻 Integration Examples Across Frameworks
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
### 1. React / Next.js Example (TypeScript & JavaScript)
|
|
48
65
|
|
|
49
66
|
```tsx
|
|
50
67
|
import React from 'react';
|
|
51
68
|
import HtmlEditor from 'react-edit-to-html';
|
|
69
|
+
import type { TableSchemaInfo, PlaceholderItem } from 'react-edit-to-html';
|
|
52
70
|
import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
53
71
|
|
|
54
|
-
export default function
|
|
55
|
-
const customTables = [
|
|
72
|
+
export default function ReactTemplateEditor() {
|
|
73
|
+
const customTables: TableSchemaInfo[] = [
|
|
56
74
|
{
|
|
57
75
|
tableName: 'order_items',
|
|
58
76
|
columns: [
|
|
59
|
-
{ columnName: 'Item Name', placeholder: '{
|
|
60
|
-
{ columnName: 'SKU', placeholder: '{
|
|
61
|
-
{ columnName: 'Price', placeholder: '{
|
|
77
|
+
{ columnName: 'Item Name', placeholder: '${item.name}', enabled: true },
|
|
78
|
+
{ columnName: 'SKU', placeholder: '${item.sku}', enabled: true },
|
|
79
|
+
{ columnName: 'Price', placeholder: '${item.price}', enabled: true }
|
|
62
80
|
],
|
|
63
|
-
loop: true
|
|
64
|
-
isNestable: false,
|
|
65
|
-
parentPath: 'order',
|
|
66
|
-
maxNestingDepth: 5,
|
|
67
|
-
nestingPrefix: ' ',
|
|
68
|
-
showNestingLevel: false
|
|
81
|
+
loop: true
|
|
69
82
|
}
|
|
70
83
|
];
|
|
71
84
|
|
|
72
|
-
const customPlaceholders = [
|
|
73
|
-
{ label: 'Invoice ID', placeholder: '{{invoice_id}}', category: 'General', mockValue: 'INV-2026-9021' },
|
|
74
|
-
{ label: 'Customer Name', placeholder: '{{customer_name}}', category: 'General', mockValue: 'Sophia Mueller' }
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
85
|
return (
|
|
80
86
|
<div style={{ height: '100vh', width: '100vw' }}>
|
|
81
87
|
<HtmlEditor
|
|
82
|
-
headerTitle="
|
|
83
|
-
headerSubtitle="Build invoices & export dynamic templates"
|
|
88
|
+
headerTitle="React Document Builder"
|
|
84
89
|
tableSchemas={customTables}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
loopSyntax="each"
|
|
88
|
-
|
|
90
|
+
templatingLanguage="ts"
|
|
91
|
+
onExport={(html: string) => console.log('Exported HTML:', html)}
|
|
89
92
|
/>
|
|
90
93
|
</div>
|
|
91
94
|
);
|
|
@@ -94,15 +97,135 @@ export default function MyBuilderPage() {
|
|
|
94
97
|
|
|
95
98
|
---
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
### 2. Vue 3 Example (Using `mountHtmlEditor`)
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<template>
|
|
104
|
+
<div ref="editorRef" style="height: 100vh; width: 100vw;"></div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import { ref, onMounted, onUnmounted } from 'vue';
|
|
109
|
+
import { mountHtmlEditor, unmountHtmlEditor } from 'react-edit-to-html';
|
|
110
|
+
import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
111
|
+
|
|
112
|
+
const editorRef = ref<HTMLDivElement | null>(null);
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
if (editorRef.value) {
|
|
116
|
+
mountHtmlEditor(editorRef.value, {
|
|
117
|
+
headerTitle: 'Vue 3 Template Designer',
|
|
118
|
+
templatingLanguage: 'js',
|
|
119
|
+
onExport: (html: string) => console.log('Exported HTML from Vue:', html)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
onUnmounted(() => {
|
|
125
|
+
if (editorRef.value) unmountHtmlEditor(editorRef.value);
|
|
126
|
+
});
|
|
127
|
+
</script>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### 3. Angular Example (Using `mountHtmlEditor`)
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { Component, ElementRef, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
|
|
136
|
+
import { mountHtmlEditor, unmountHtmlEditor } from 'react-edit-to-html';
|
|
137
|
+
import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
138
|
+
|
|
139
|
+
@Component({
|
|
140
|
+
selector: 'app-html-editor',
|
|
141
|
+
template: `<div #editorContainer style="height: 100vh; width: 100vw;"></div>`
|
|
142
|
+
})
|
|
143
|
+
export class HtmlEditorComponent implements AfterViewInit, OnDestroy {
|
|
144
|
+
@ViewChild('editorContainer') container!: ElementRef<HTMLDivElement>;
|
|
145
|
+
|
|
146
|
+
ngAfterViewInit() {
|
|
147
|
+
mountHtmlEditor(this.container.nativeElement, {
|
|
148
|
+
headerTitle: 'Angular Template Designer',
|
|
149
|
+
templatingLanguage: 'ts',
|
|
150
|
+
onExport: (html: string) => console.log('Exported HTML from Angular:', html)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
ngOnDestroy() {
|
|
155
|
+
unmountHtmlEditor(this.container.nativeElement);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### 4. Svelte Example (Using `mountHtmlEditor`)
|
|
163
|
+
|
|
164
|
+
```svelte
|
|
165
|
+
<script lang="ts">
|
|
166
|
+
import { onMounted, onDestroy } from 'svelte';
|
|
167
|
+
import { mountHtmlEditor, unmountHtmlEditor } from 'react-edit-to-html';
|
|
168
|
+
import 'react-edit-to-html/dist/react-edit-to-html.css';
|
|
169
|
+
|
|
170
|
+
let container: HTMLDivElement;
|
|
171
|
+
|
|
172
|
+
onMounted(() => {
|
|
173
|
+
mountHtmlEditor(container, {
|
|
174
|
+
headerTitle: 'Svelte Document Builder',
|
|
175
|
+
templatingLanguage: 'js',
|
|
176
|
+
onExport: (html: string) => console.log('Exported HTML from Svelte:', html)
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
onDestroy(() => {
|
|
181
|
+
if (container) unmountHtmlEditor(container);
|
|
182
|
+
});
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<div bind:this={container} style="height: 100vh; width: 100vw;"></div>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### 5. Vanilla JavaScript / Plain HTML Example
|
|
191
|
+
|
|
192
|
+
```html
|
|
193
|
+
<!DOCTYPE html>
|
|
194
|
+
<html lang="en">
|
|
195
|
+
<head>
|
|
196
|
+
<meta charset="UTF-8">
|
|
197
|
+
<title>Vanilla JS HTML Editor</title>
|
|
198
|
+
<link rel="stylesheet" href="node_modules/react-edit-to-html/dist/react-edit-to-html.css">
|
|
199
|
+
</head>
|
|
200
|
+
<body style="margin: 0;">
|
|
201
|
+
<div id="editor-root" style="height: 100vh; width: 100vw;"></div>
|
|
202
|
+
|
|
203
|
+
<script type="module">
|
|
204
|
+
import { mountHtmlEditor } from './node_modules/react-edit-to-html/dist/index.js';
|
|
205
|
+
|
|
206
|
+
mountHtmlEditor(document.getElementById('editor-root'), {
|
|
207
|
+
headerTitle: 'Vanilla JavaScript Editor',
|
|
208
|
+
templatingLanguage: 'js',
|
|
209
|
+
onExport: function(html) {
|
|
210
|
+
console.log('Exported HTML:', html);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
</script>
|
|
214
|
+
</body>
|
|
215
|
+
</html>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 📋 Props Reference
|
|
98
221
|
|
|
99
222
|
```ts
|
|
100
223
|
type TableColumn = {
|
|
101
224
|
columnName: string;
|
|
102
225
|
placeholder: string;
|
|
103
226
|
enabled?: boolean;
|
|
104
|
-
loop?: boolean;
|
|
105
|
-
columns?: TableColumn[];
|
|
227
|
+
loop?: boolean;
|
|
228
|
+
columns?: TableColumn[];
|
|
106
229
|
};
|
|
107
230
|
|
|
108
231
|
type TableSchemaInfo = {
|
|
@@ -133,7 +256,7 @@ interface HtmlEditorProps {
|
|
|
133
256
|
headerTitle?: string;
|
|
134
257
|
headerSubtitle?: string;
|
|
135
258
|
headerLogo?: React.ReactNode;
|
|
136
|
-
templatingLanguage?: '
|
|
259
|
+
templatingLanguage?: 'js' | 'ts' | 'handlebars' | 'liquid' | 'scriban' | 'dotnet' | 'csharp' | 'custom';
|
|
137
260
|
loopSyntax?: 'for' | 'foreach' | 'each';
|
|
138
261
|
onChange?: (blocks: CanvasBlock[]) => void;
|
|
139
262
|
onExport?: (html: string) => void;
|
|
@@ -146,11 +269,10 @@ interface HtmlEditorProps {
|
|
|
146
269
|
showPreview?: boolean;
|
|
147
270
|
showExport?: boolean;
|
|
148
271
|
showExportPdf?: boolean;
|
|
149
|
-
/**
|
|
272
|
+
/** Position of the sidebar panel ('left' | 'right'). Defaults to 'left' */
|
|
273
|
+
sidebarPosition?: 'left' | 'right';
|
|
150
274
|
customButtonStyles?: Record<string, React.CSSProperties>;
|
|
151
|
-
/** Allows passing custom CSS class names dynamically to customize/override button class sheets for header actions */
|
|
152
275
|
customButtonClassNames?: Record<string, string>;
|
|
153
|
-
/** Allows passing completely custom React components for header actions. Receives an onClick prop to trigger the action. */
|
|
154
276
|
customActionComponents?: {
|
|
155
277
|
importHtml?: (props: { onClick: () => void }) => React.ReactNode;
|
|
156
278
|
importPdf?: (props: { onClick: () => void }) => React.ReactNode;
|
|
@@ -163,117 +285,90 @@ interface HtmlEditorProps {
|
|
|
163
285
|
|
|
164
286
|
| Prop | Type | Default | Details |
|
|
165
287
|
| :--- | :--- | :--- | :--- |
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `initialBlocks` | `CanvasBlock[]` | `[]` | Pass preloaded blocks to initialize the layout canvas.<br/>**Example:** `initialBlocks={[{ id: 'b1', type: 'h1', content: 'Title', style: { fontSize: '24px' } }]}` |
|
|
182
|
-
| `defaultStyles` | `Record<string, Partial<TextStyle>>` | `{}` | Key-value dictionary providing pre-defined styling configurations for elements dropped or created in the canvas.<br/>**Example:** `defaultStyles={{ h1: { fontSize: '24px', fontWeight: 'bold' } }}` |
|
|
183
|
-
| `showHeader` | `boolean` | `true` | Show or hide the top header bar branding. Visible by default (`true`).<br/>**Example:** `showHeader={false}` |
|
|
184
|
-
| `isTablesLoading` | `boolean` | `false` | Displays an animated skeleton loader inside the Dynamic Tables sidebar tab.<br/>**Example:** `isTablesLoading={true}` |
|
|
185
|
-
| `isPlaceholdersLoading` | `boolean` | `false` | Displays an animated skeleton loader inside the Variables Palette sidebar tab.<br/>**Example:** `isPlaceholdersLoading={true}` |
|
|
186
|
-
| `showImportHtml` | `boolean` | `true` | Show/hide the "Import HTML" action button in the toolbar.<br/>**Example:** `showImportHtml={true}` |
|
|
187
|
-
| `showImportPdf` | `boolean` | `true` | Show/hide the "Import PDF" action button in the toolbar.<br/>**Example:** `showImportPdf={false}` |
|
|
188
|
-
| `showClearCanvas` | `boolean` | `true` | Show/hide the "Clear Canvas" utility button in the canvas toolbar.<br/>**Example:** `showClearCanvas={true}` |
|
|
189
|
-
| `showPreview` | `boolean` | `true` | Show/hide the "Live Preview" action button in the toolbar.<br/>**Example:** `showPreview={true}` |
|
|
190
|
-
| `showExport` | `boolean` | `true` | Show/hide the "Export Template" action button in the toolbar.<br/>**Example:** `showExport={true}` |
|
|
191
|
-
| `showExportPdf` | `boolean` | `true` | Show/hide the "Download PDF" action button in the toolbar.<br/>**Example:** `showExportPdf={true}` |
|
|
192
|
-
| `customButtonStyles` | `object` | `{}` | Allows passing custom CSS inline style properties dynamically to any of the header/toolbar actions.<br/>**Example:** `customButtonStyles={{ export: { backgroundColor: '#10b981' } }}` |
|
|
193
|
-
| `customButtonClassNames` | `object` | `{}` | Allows passing custom CSS Tailwind class names dynamically to customize/override button class sheets.<br/>**Example:** `customButtonClassNames={{ export: 'bg-emerald-600 hover:bg-emerald-700' }}` |
|
|
194
|
-
| `customActionComponents` | `object` | `undefined` | Pass custom React components for toolbar actions (`importHtml`, `importPdf`, `preview`, `exportPdf`, `export`). Render prop receives `{ onClick }`.<br/>**Example:** `customActionComponents={{ export: ({ onClick }) => <button onClick={onClick}>Save</button> }}` |
|
|
195
|
-
|
|
196
|
-
### Notes on Table & Sub-Table Types
|
|
197
|
-
|
|
198
|
-
- `TableSchemaInfo` and `TableColumn` are exported from the package (`export * from './types'`).
|
|
199
|
-
- **Sub-Tables:** Define `loop: true` and specify a `columns: TableColumn[]` array on any column item. In both editor canvas and exported HTML, sub-tables render with nested headers (`<thead>`) and body rows (`<tbody>`).
|
|
200
|
-
- **Column & Sub-Column Management:** In the Formatting Panel (**Styles Tab**), click the Pencil (`Edit`) icon next to any column or sub-column to edit header names and placeholders inline, add new sub-columns, or delete sub-columns.
|
|
288
|
+
| `sidebarPosition` | `'left' \| 'right'` | `'left'` | Controls the sidebar panel position. Defaults to `'left'` (sidebar on left, canvas on right). Set to `'right'` to position the sidebar on the right side. |
|
|
289
|
+
| `templatingLanguage` | `'js' \| 'ts' \| 'handlebars' \| 'liquid' \| 'scriban' \| 'dotnet' \| 'csharp' \| 'custom'` | `'js'` | Configures loop-tag syntax mode for exported HTML tables. Supports JavaScript/TypeScript Template Literals (`js`/`ts`), Handlebars (`handlebars`), Liquid (`liquid`), Scriban (`scriban`), and C# Razor (`csharp`). |
|
|
290
|
+
| `tableSchemas` | `TableSchemaInfo[]` | `[]` | Configures dynamic table schemas. Supports top-level loop tables and nested sub-tables. |
|
|
291
|
+
| `placeholders` | `PlaceholderItem[]` | `[]` | Controls variables shown in the Placeholders tab. |
|
|
292
|
+
| `defaultLogo` | `string` | Neutral SVG | Default image source for logo blocks. |
|
|
293
|
+
| `defaultBanner` | `string` | Neutral SVG | Default image source for banner blocks. |
|
|
294
|
+
| `headerTitle` | `string` | `'Layout Designer'` | Header title text displayed at top of editor. |
|
|
295
|
+
| `headerSubtitle` | `string` | `'Interactive Document HTML Builder'` | Header subtitle text. |
|
|
296
|
+
| `onExport` | `(html: string) => void` | `undefined` | Called when user exports template. |
|
|
297
|
+
| `onExportPdf` | `(html: string) => void` | `undefined` | Called when user downloads PDF. |
|
|
298
|
+
|
|
299
|
+
| Exported Helper Function | Parameters | Description |
|
|
300
|
+
| :--- | :--- | :--- |
|
|
301
|
+
| `mountHtmlEditor` | `(container: HTMLElement, props?: HtmlEditorProps)` | Mounts the full editor into any DOM element container. Perfect for Vue, Angular, Svelte, and Vanilla JS applications. |
|
|
302
|
+
| `unmountHtmlEditor` | `(container: HTMLElement)` | Unmounts the editor component and cleans up internal DOM nodes. |
|
|
201
303
|
|
|
202
304
|
---
|
|
203
305
|
|
|
204
|
-
##
|
|
205
|
-
|
|
206
|
-
The sidebar contains 4 main tabs for configuring elements and settings:
|
|
207
|
-
|
|
208
|
-
### 1. Typography Elements (Text Tab)
|
|
209
|
-
Contains Heading styles, Paragraphs, Titles, and Captions.
|
|
210
|
-
- **How to add:** Drag any element block onto the canvas or click "Insert at End".
|
|
211
|
-
- **How to edit:** Click directly on the text block on the canvas to type text. Highlight text to trigger the inline **Rich Text Selection Bubble** (bold, italics, underline, or colors).
|
|
212
|
-
|
|
213
|
-
### 2. Dynamic Tables (Tables Tab)
|
|
214
|
-
Loads your configured table schemas.
|
|
215
|
-
- **How to add:** Drag a table card from the sidebar onto the canvas or click "Insert at End" to append.
|
|
216
|
-
- **Toggling Columns:** Click checkboxes in the sidebar schema card to enable/disable columns.
|
|
217
|
-
- **Custom Tables:** Input a Table Name, choose loop start/end tags, and click "Add Custom Loop Table" to dynamically register new tables.
|
|
218
|
-
|
|
219
|
-
### 3. Image & Barcode Elements (Images Tab)
|
|
220
|
-
- **Logos & Banners:** Drag logos or banners onto the canvas. Upload custom files (converted to base64) under settings properties.
|
|
221
|
-
- **Dynamic Barcodes:** Drag a barcode block. Change the mock value (e.g. `SHIP-99201`) or backend template tag (e.g. `{{barcode}}`) in block settings configurations.
|
|
222
|
-
- **Custom Image Types:** Register custom graphics categories (e.g., Signature) by typing a label and clicking "Add Image Type".
|
|
223
|
-
|
|
224
|
-
### 4. Variables Palette (Placeholders Tab)
|
|
225
|
-
- **Inserting Placeholders:** Highlight any text block or table cell and drag a placeholder variable chip onto it. Alternatively, select a block, and click a variable in the palette to insert it at the cursor position.
|
|
226
|
-
- **Custom Mock Values:** Next to each variable in the palette, type a mock value. This will instantly replace placeholders in the canvas for layout testing.
|
|
227
|
-
|
|
228
|
-
### 5. Formatting Styles Panel (Styles Tab)
|
|
229
|
-
Applies when a canvas block is selected:
|
|
230
|
-
- **Typography & Layout:** Adjust alignment, font size, font family, and font weight.
|
|
231
|
-
- **Visual Colors:** Adjust text color and background color using interactive selectors.
|
|
232
|
-
- **Sizing & Spacing:** Control block margins, padding, widths, and heights using range sliders.
|
|
233
|
-
- **Typography Variants:** Register custom sizes (e.g. `17px`) and Google fonts dynamically.
|
|
234
|
-
- **Table Columns Editor:** Add columns, delete columns, or edit raw JSON records for tables.
|
|
235
|
-
- **Global template settings:** Choose template syntaxes (Handlebars, Liquid, Scriban, Razor) and toggle HTML comment wraps.
|
|
306
|
+
## ⚡ Templating Language Output Comparison
|
|
236
307
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
308
|
+
### TypeScript / JavaScript ES6 Template Literals (`templatingLanguage="ts"` or `"js"`)
|
|
309
|
+
```html
|
|
310
|
+
<table>
|
|
311
|
+
<thead>
|
|
312
|
+
<tr>
|
|
313
|
+
<th>SKU</th>
|
|
314
|
+
<th>Product Name</th>
|
|
315
|
+
<th>Price</th>
|
|
316
|
+
</tr>
|
|
317
|
+
</thead>
|
|
318
|
+
<tbody>
|
|
319
|
+
<!-- ${items.map(item => ` --><tr>
|
|
320
|
+
<td>${item.sku}</td>
|
|
321
|
+
<td>${item.name}</td>
|
|
322
|
+
<td>${item.price}</td>
|
|
323
|
+
</tr><!-- `).join('')} -->
|
|
324
|
+
</tbody>
|
|
325
|
+
</table>
|
|
326
|
+
```
|
|
251
327
|
|
|
328
|
+
### Handlebars / Mustache (`templatingLanguage="handlebars"`)
|
|
252
329
|
```html
|
|
253
|
-
<table
|
|
330
|
+
<table>
|
|
254
331
|
<thead>
|
|
255
332
|
<tr>
|
|
256
|
-
<th>
|
|
257
|
-
<th>
|
|
258
|
-
<th>
|
|
259
|
-
<th>Package Gross Weight</th>
|
|
260
|
-
<th>Package Content</th>
|
|
333
|
+
<th>SKU</th>
|
|
334
|
+
<th>Product Name</th>
|
|
335
|
+
<th>Price</th>
|
|
261
336
|
</tr>
|
|
262
337
|
</thead>
|
|
263
338
|
<tbody>
|
|
264
|
-
<!-- {{#each
|
|
265
|
-
<td>{{
|
|
266
|
-
<td>{{
|
|
267
|
-
<td>{{
|
|
268
|
-
<td>{{package.gross_weight}}</td>
|
|
269
|
-
<td>{{package_content}}</td>
|
|
339
|
+
<!-- {{#each items}} --><tr>
|
|
340
|
+
<td>{{sku}}</td>
|
|
341
|
+
<td>{{name}}</td>
|
|
342
|
+
<td>{{price}}</td>
|
|
270
343
|
</tr><!-- {{/each}} -->
|
|
271
344
|
</tbody>
|
|
272
345
|
</table>
|
|
273
346
|
```
|
|
274
347
|
|
|
275
|
-
|
|
348
|
+
### C# / Razor (`templatingLanguage="csharp"`)
|
|
349
|
+
```html
|
|
350
|
+
<table>
|
|
351
|
+
<thead>
|
|
352
|
+
<tr>
|
|
353
|
+
<th>SKU</th>
|
|
354
|
+
<th>Product Name</th>
|
|
355
|
+
<th>Price</th>
|
|
356
|
+
</tr>
|
|
357
|
+
</thead>
|
|
358
|
+
<tbody>
|
|
359
|
+
<!-- @foreach (var item in items) { --><tr>
|
|
360
|
+
<td>@item.Sku</td>
|
|
361
|
+
<td>@item.Name</td>
|
|
362
|
+
<td>@item.Price</td>
|
|
363
|
+
</tr><!-- } -->
|
|
364
|
+
</tbody>
|
|
365
|
+
</table>
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## 📄 License
|
|
276
371
|
|
|
277
|
-
Proprietary & Commercial License © 2026 [BEO Software Pvt. Ltd.](https://beo-software.in/)
|
|
372
|
+
Proprietary & Commercial License © 2026 [BEO Software Pvt. Ltd.](https://beo-software.in/)
|
|
278
373
|
|
|
279
374
|
All rights reserved. Unauthorized copying, distribution, or commercial use is strictly prohibited. For licensing inquiries, please visit [beo-software.in](https://beo-software.in/).
|