dragble-angular-editor 1.0.1
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/LICENSE +21 -0
- package/README.md +302 -0
- package/dist/dragble-editor.component.d.ts +312 -0
- package/dist/dragble-editor.module.d.ts +8 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +649 -0
- package/dist/index.js.map +1 -0
- package/dist/out-tsc/dragble-editor.component.d.ts +312 -0
- package/dist/out-tsc/dragble-editor.component.d.ts.map +1 -0
- package/dist/out-tsc/dragble-editor.component.js +626 -0
- package/dist/out-tsc/dragble-editor.component.js.map +1 -0
- package/dist/out-tsc/dragble-editor.module.d.ts +8 -0
- package/dist/out-tsc/dragble-editor.module.d.ts.map +1 -0
- package/dist/out-tsc/dragble-editor.module.js +22 -0
- package/dist/out-tsc/dragble-editor.module.js.map +1 -0
- package/dist/out-tsc/index.d.ts +12 -0
- package/dist/out-tsc/index.d.ts.map +1 -0
- package/dist/out-tsc/index.js +14 -0
- package/dist/out-tsc/index.js.map +1 -0
- package/package.json +133 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dragble
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://dragble.com">
|
|
3
|
+
<img src="logo.png" alt="Dragble Email Editor - Angular Email Template Builder" width="300" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/dragble-angular-editor"><img src="https://img.shields.io/npm/v/dragble-angular-editor.svg" alt="npm version" /></a>
|
|
9
|
+
<a href="https://github.com/Dragble/dragble-angular-editor/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
# dragble-angular-editor
|
|
13
|
+
|
|
14
|
+
Angular component for building **email templates** with drag-and-drop. Embed a full-featured **email editor** into your Angular app — create responsive HTML emails, newsletters, transactional email templates, and email marketing campaigns visually without writing code.
|
|
15
|
+
|
|
16
|
+
[Dragble](https://dragble.com) is a modern **email builder** and **email template editor** that lets your users design professional emails with a visual drag-and-drop interface.
|
|
17
|
+
|
|
18
|
+
[Website](https://dragble.com) | [Documentation](https://docs.dragble.com) | [Dashboard](https://developers.dragble.com)
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="editor_image.png" alt="Dragble Angular Email Editor - Drag and Drop Email Template Builder" width="700" />
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- Drag-and-drop **email template builder** with 20+ content blocks
|
|
27
|
+
- Responsive **HTML email** output compatible with all major email clients
|
|
28
|
+
- **Newsletter editor** with merge tags, dynamic content, and display conditions
|
|
29
|
+
- Visual **email designer** — no HTML/CSS knowledge required for end users
|
|
30
|
+
- Export to HTML, JSON, image, PDF, or ZIP
|
|
31
|
+
- Built-in image editor, AI content generation, and collaboration tools
|
|
32
|
+
- Full TypeScript support
|
|
33
|
+
- Works with NgModule and standalone components (Angular 14+)
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
The SDK is loaded from CDN automatically — you only need to install the Angular package.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install dragble-angular-editor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn add dragble-angular-editor
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm add dragble-angular-editor
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Editor Key
|
|
52
|
+
|
|
53
|
+
An `editorKey` is required to use the editor. You can get one by creating a project on the [Dragble Developer Dashboard](https://developers.dragble.com).
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### NgModule
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { NgModule } from "@angular/core";
|
|
61
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
62
|
+
import { DragbleEditorModule } from "dragble-angular-editor";
|
|
63
|
+
import { AppComponent } from "./app.component";
|
|
64
|
+
|
|
65
|
+
@NgModule({
|
|
66
|
+
declarations: [AppComponent],
|
|
67
|
+
imports: [BrowserModule, DragbleEditorModule],
|
|
68
|
+
bootstrap: [AppComponent],
|
|
69
|
+
})
|
|
70
|
+
export class AppModule {}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { Component, ViewChild } from "@angular/core";
|
|
75
|
+
import {
|
|
76
|
+
DragbleEditorComponent,
|
|
77
|
+
DesignJson,
|
|
78
|
+
DragbleSDK,
|
|
79
|
+
} from "dragble-angular-editor";
|
|
80
|
+
|
|
81
|
+
@Component({
|
|
82
|
+
selector: "app-email-editor",
|
|
83
|
+
template: `
|
|
84
|
+
<div class="toolbar">
|
|
85
|
+
<button (click)="handleSave()">Save</button>
|
|
86
|
+
<button (click)="handleExport()">Export HTML</button>
|
|
87
|
+
</div>
|
|
88
|
+
<dragble-editor
|
|
89
|
+
#editor
|
|
90
|
+
[editorKey]="'YOUR_EDITOR_KEY'"
|
|
91
|
+
[editorMode]="'email'"
|
|
92
|
+
[height]="800"
|
|
93
|
+
(ready)="onReady($event)"
|
|
94
|
+
(change)="onChange($event)"
|
|
95
|
+
></dragble-editor>
|
|
96
|
+
`,
|
|
97
|
+
})
|
|
98
|
+
export class EmailEditorComponent {
|
|
99
|
+
@ViewChild("editor") editor!: DragbleEditorComponent;
|
|
100
|
+
|
|
101
|
+
onReady(sdk: DragbleSDK): void {
|
|
102
|
+
console.log("Editor ready!", sdk);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async onChange(data: { design: DesignJson; type: string }): Promise<void> {
|
|
106
|
+
// Design JSON is available directly from the callback
|
|
107
|
+
console.log("Design JSON:", data.design);
|
|
108
|
+
|
|
109
|
+
// To get HTML, call exportHtml on the editor
|
|
110
|
+
const html = await this.editor.exportHtml();
|
|
111
|
+
console.log("HTML:", html);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async handleSave(): Promise<void> {
|
|
115
|
+
const design = await this.editor.getDesign();
|
|
116
|
+
console.log("Design:", design);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async handleExport(): Promise<void> {
|
|
120
|
+
const html = await this.editor.exportHtml();
|
|
121
|
+
console.log("HTML:", html);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Standalone Component (Angular 15+)
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { Component, ViewChild } from "@angular/core";
|
|
130
|
+
import { DragbleEditorComponent } from "dragble-angular-editor";
|
|
131
|
+
|
|
132
|
+
@Component({
|
|
133
|
+
selector: "app-editor",
|
|
134
|
+
standalone: true,
|
|
135
|
+
imports: [DragbleEditorComponent],
|
|
136
|
+
template: `
|
|
137
|
+
<dragble-editor
|
|
138
|
+
#editor
|
|
139
|
+
[editorKey]="'YOUR_EDITOR_KEY'"
|
|
140
|
+
[editorMode]="'email'"
|
|
141
|
+
(ready)="onReady($event)"
|
|
142
|
+
></dragble-editor>
|
|
143
|
+
`,
|
|
144
|
+
})
|
|
145
|
+
export class EditorComponent {
|
|
146
|
+
@ViewChild("editor") editor!: DragbleEditorComponent;
|
|
147
|
+
|
|
148
|
+
onReady(): void {
|
|
149
|
+
console.log("Editor ready!");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Inputs
|
|
155
|
+
|
|
156
|
+
| Input | Type | Default | Description |
|
|
157
|
+
| ------------------- | ---------------------------------------- | ------------ | ------------------------------------- |
|
|
158
|
+
| `editorKey` | `string` | **required** | Editor key for authentication |
|
|
159
|
+
| `design` | `DesignJson \| ModuleData \| null` | `undefined` | Initial design to load |
|
|
160
|
+
| `editorMode` | `EditorMode` | `"email"` | `"email"`, `"web"`, or `"popup"` |
|
|
161
|
+
| `popup` | `PopupConfig` | `undefined` | Popup configuration |
|
|
162
|
+
| `contentType` | `EditorContentTypeValue` | `undefined` | Set to `"module"` for single-row mode |
|
|
163
|
+
| `ai` | `AIConfig` | `undefined` | AI features configuration |
|
|
164
|
+
| `locale` | `string` | `undefined` | UI locale |
|
|
165
|
+
| `translations` | `Record<string, Record<string, string>>` | `undefined` | Translation overrides |
|
|
166
|
+
| `textDirection` | `TextDirection` | `undefined` | `"ltr"` or `"rtl"` |
|
|
167
|
+
| `language` | `Language` | `undefined` | Template language |
|
|
168
|
+
| `appearance` | `AppearanceConfig` | `undefined` | Visual customization |
|
|
169
|
+
| `tools` | `ToolsConfig` | `undefined` | Tool enable/disable |
|
|
170
|
+
| `customTools` | `DragbleToolConfig[]` | `undefined` | Custom tool definitions |
|
|
171
|
+
| `features` | `FeaturesConfig` | `undefined` | Feature toggles |
|
|
172
|
+
| `fonts` | `FontsConfig` | `undefined` | Fonts configuration |
|
|
173
|
+
| `bodyValues` | `Record<string, unknown>` | `undefined` | Body-level values |
|
|
174
|
+
| `header` | `unknown` | `undefined` | Locked header row |
|
|
175
|
+
| `footer` | `unknown` | `undefined` | Locked footer row |
|
|
176
|
+
| `mergeTags` | `MergeTagsConfig` | `undefined` | Merge tags configuration |
|
|
177
|
+
| `specialLinks` | `SpecialLinksConfig` | `undefined` | Special links configuration |
|
|
178
|
+
| `modules` | `Module[]` | `undefined` | Custom modules |
|
|
179
|
+
| `displayConditions` | `DisplayConditionsConfig` | `undefined` | Display conditions |
|
|
180
|
+
| `editor` | `EditorBehaviorConfig` | `undefined` | Editor behavior settings |
|
|
181
|
+
| `customCSS` | `string[]` | `undefined` | Custom CSS URLs |
|
|
182
|
+
| `customJS` | `string[]` | `undefined` | Custom JS URLs |
|
|
183
|
+
| `height` | `string \| number` | `"600px"` | Editor height |
|
|
184
|
+
| `minHeight` | `string \| number` | `"600px"` | Minimum height |
|
|
185
|
+
| `options` | `Partial<EditorOptions>` | `undefined` | Additional editor options |
|
|
186
|
+
| `callbacks` | `Omit<DragbleCallbacks, ...>` | `undefined` | SDK callbacks |
|
|
187
|
+
|
|
188
|
+
| `collaboration` | `boolean \| CollaborationFeaturesConfig` | `undefined` | Collaboration settings |
|
|
189
|
+
| `user` | `UserInfo` | `undefined` | Current user info |
|
|
190
|
+
| `designMode` | `"edit" \| "live"` | `undefined` | Template permissions mode |
|
|
191
|
+
|
|
192
|
+
## Outputs
|
|
193
|
+
|
|
194
|
+
| Output | Payload Type | Description |
|
|
195
|
+
| --------------- | -------------------------------------- | -------------------------------- |
|
|
196
|
+
| `ready` | `DragbleSDK` | Emitted when the editor is ready |
|
|
197
|
+
| `load` | `unknown` | Emitted when a design is loaded |
|
|
198
|
+
| `change` | `{ design: DesignJson; type: string }` | Emitted on every design change |
|
|
199
|
+
| `error` | `Error` | Emitted when an error occurs |
|
|
200
|
+
| `commentAction` | `CommentAction` | Emitted on comment events |
|
|
201
|
+
|
|
202
|
+
## Methods
|
|
203
|
+
|
|
204
|
+
Access methods via `@ViewChild`:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
@ViewChild('editor') editor!: DragbleEditorComponent;
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Design
|
|
211
|
+
|
|
212
|
+
| Method | Returns | Description |
|
|
213
|
+
| ------------------------------ | --------- | ---------------------- |
|
|
214
|
+
| `loadDesign(design, options?)` | `void` | Load a design |
|
|
215
|
+
| `loadBlank(options?)` | `void` | Load a blank design |
|
|
216
|
+
| `getDesign()` | `Promise` | Get the current design |
|
|
217
|
+
|
|
218
|
+
### Export
|
|
219
|
+
|
|
220
|
+
| Method | Returns | Description |
|
|
221
|
+
| ----------------------- | -------------------------- | -------------------- |
|
|
222
|
+
| `exportHtml(options?)` | `Promise<string>` | Export as HTML |
|
|
223
|
+
| `exportJson()` | `Promise<DesignJson>` | Export as JSON |
|
|
224
|
+
| `exportPlainText()` | `Promise<string>` | Export as plain text |
|
|
225
|
+
| `exportImage(options?)` | `Promise<ExportImageData>` | Export as image |
|
|
226
|
+
| `exportPdf(options?)` | `Promise<ExportPdfData>` | Export as PDF |
|
|
227
|
+
| `exportZip(options?)` | `Promise<ExportZipData>` | Export as ZIP |
|
|
228
|
+
|
|
229
|
+
### Configuration
|
|
230
|
+
|
|
231
|
+
| Method | Returns | Description |
|
|
232
|
+
| ---------------------------------- | ------- | ------------------------- |
|
|
233
|
+
| `setMergeTags(config)` | `void` | Update merge tags |
|
|
234
|
+
| `setSpecialLinks(config)` | `void` | Update special links |
|
|
235
|
+
| `setModules(modules)` | `void` | Update custom modules |
|
|
236
|
+
| `setFonts(config)` | `void` | Update fonts |
|
|
237
|
+
| `setBodyValues(values)` | `void` | Update body values |
|
|
238
|
+
| `setToolsConfig(config)` | `void` | Update tools config |
|
|
239
|
+
| `setAppearance(config)` | `void` | Update appearance |
|
|
240
|
+
| `setEditorMode(mode)` | `void` | Change editor mode |
|
|
241
|
+
| `setEditorConfig(config)` | `void` | Update editor config |
|
|
242
|
+
| `setLocale(locale, translations?)` | `void` | Change locale |
|
|
243
|
+
| `setTextDirection(direction)` | `void` | Set text direction |
|
|
244
|
+
| `setLanguage(language)` | `void` | Set template language |
|
|
245
|
+
| `setDisplayConditions(config)` | `void` | Update display conditions |
|
|
246
|
+
| `setOptions(options)` | `void` | Update editor options |
|
|
247
|
+
| `setBrandingColors(config)` | `void` | Update branding colors |
|
|
248
|
+
|
|
249
|
+
### Editor Actions
|
|
250
|
+
|
|
251
|
+
| Method | Returns | Description |
|
|
252
|
+
| ---------------------- | ---------------------- | -------------------------- |
|
|
253
|
+
| `save()` | `void` | Trigger a save event |
|
|
254
|
+
| `undo()` | `void` | Undo last action |
|
|
255
|
+
| `redo()` | `void` | Redo last action |
|
|
256
|
+
| `canUndo()` | `Promise<boolean>` | Check if undo is available |
|
|
257
|
+
| `canRedo()` | `Promise<boolean>` | Check if redo is available |
|
|
258
|
+
| `showPreview(device?)` | `void` | Show design preview |
|
|
259
|
+
| `hidePreview()` | `void` | Hide preview |
|
|
260
|
+
| `audit(options?)` | `Promise<AuditResult>` | Run design audit |
|
|
261
|
+
|
|
262
|
+
### Tools & Widgets
|
|
263
|
+
|
|
264
|
+
| Method | Returns | Description |
|
|
265
|
+
| ---------------------- | --------- | ---------------------- |
|
|
266
|
+
| `registerTool(config)` | `Promise` | Register a custom tool |
|
|
267
|
+
| `unregisterTool(id)` | `Promise` | Unregister a tool |
|
|
268
|
+
| `getTools()` | `Promise` | Get registered tools |
|
|
269
|
+
| `createWidget(config)` | `Promise` | Create a widget |
|
|
270
|
+
| `removeWidget(name)` | `Promise` | Remove a widget |
|
|
271
|
+
|
|
272
|
+
### Events
|
|
273
|
+
|
|
274
|
+
| Method | Returns | Description |
|
|
275
|
+
| -------------------------------------- | ------------ | --------------------------------------------------- |
|
|
276
|
+
| `addEventListener(event, callback)` | `() => void` | Subscribe to an event; returns unsubscribe function |
|
|
277
|
+
| `removeEventListener(event, callback)` | `void` | Remove an event listener |
|
|
278
|
+
|
|
279
|
+
## TypeScript
|
|
280
|
+
|
|
281
|
+
All types are exported from `dragble-angular-editor`:
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
import type {
|
|
285
|
+
DesignJson,
|
|
286
|
+
EditorMode,
|
|
287
|
+
DragbleSDK,
|
|
288
|
+
MergeTagsConfig,
|
|
289
|
+
AppearanceConfig,
|
|
290
|
+
FeaturesConfig,
|
|
291
|
+
ToolsConfig,
|
|
292
|
+
FontsConfig,
|
|
293
|
+
} from "dragble-angular-editor";
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Contributing
|
|
297
|
+
|
|
298
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute to this project.
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dragble Editor Angular Component
|
|
3
|
+
*
|
|
4
|
+
* An Angular wrapper for the Dragble Editor SDK.
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges, AfterViewInit } from "@angular/core";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
type DragbleSDK = any;
|
|
9
|
+
type EditorOptions = any;
|
|
10
|
+
type DragbleCallbacks = any;
|
|
11
|
+
type DesignJson = any;
|
|
12
|
+
type ModuleData = any;
|
|
13
|
+
type Module = any;
|
|
14
|
+
type ExportHtmlOptions = any;
|
|
15
|
+
type ExportImageOptions = any;
|
|
16
|
+
type ExportImageData = any;
|
|
17
|
+
type ExportPdfOptions = any;
|
|
18
|
+
type ExportPdfData = any;
|
|
19
|
+
type ExportZipOptions = any;
|
|
20
|
+
type ExportZipData = any;
|
|
21
|
+
type PopupConfig = any;
|
|
22
|
+
type PopupValues = any;
|
|
23
|
+
type MergeTag = any;
|
|
24
|
+
type MergeTagGroup = any;
|
|
25
|
+
type MergeTagsConfig = any;
|
|
26
|
+
type SpecialLink = any;
|
|
27
|
+
type SpecialLinkGroup = any;
|
|
28
|
+
type SpecialLinksConfig = any;
|
|
29
|
+
type FontsConfig = any;
|
|
30
|
+
type Language = any;
|
|
31
|
+
type AppearanceConfig = any;
|
|
32
|
+
type ToolsConfig = any;
|
|
33
|
+
type FeaturesConfig = any;
|
|
34
|
+
type AIConfig = any;
|
|
35
|
+
type EditorBehaviorConfig = any;
|
|
36
|
+
type DisplayConditionsConfig = any;
|
|
37
|
+
type EditorMode = any;
|
|
38
|
+
type EditorEventName = any;
|
|
39
|
+
type ViewMode = any;
|
|
40
|
+
type TextDirection = any;
|
|
41
|
+
type DragbleToolConfig = any;
|
|
42
|
+
type DragbleWidgetConfig = any;
|
|
43
|
+
type AuditResult = any;
|
|
44
|
+
type AuditOptions = any;
|
|
45
|
+
type AuditCallback = any;
|
|
46
|
+
type CollaborationFeaturesConfig = any;
|
|
47
|
+
type UserInfo = any;
|
|
48
|
+
declare global {
|
|
49
|
+
interface Window {
|
|
50
|
+
dragble?: DragbleSDK;
|
|
51
|
+
createEditor?: () => DragbleSDK;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export type EditorContentTypeValue = "module";
|
|
55
|
+
/**
|
|
56
|
+
* DragbleEditorComponent
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```html
|
|
60
|
+
* <dragble-editor
|
|
61
|
+
* editorKey="your-editor-key"
|
|
62
|
+
* editorMode="email"
|
|
63
|
+
* (ready)="onReady($event)"
|
|
64
|
+
* (change)="onChange($event)"
|
|
65
|
+
* ></dragble-editor>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { Component, ViewChild } from '@angular/core';
|
|
71
|
+
* import { DragbleEditorComponent } from '@dragble/angular-editor';
|
|
72
|
+
*
|
|
73
|
+
* @Component({
|
|
74
|
+
* selector: 'app-editor',
|
|
75
|
+
* template: `
|
|
76
|
+
* <dragble-editor
|
|
77
|
+
* #editor
|
|
78
|
+
* editorKey="your-editor-key"
|
|
79
|
+
* (ready)="onReady($event)"
|
|
80
|
+
* ></dragble-editor>
|
|
81
|
+
* <button (click)="handleSave()">Save</button>
|
|
82
|
+
* `
|
|
83
|
+
* })
|
|
84
|
+
* export class EditorComponent {
|
|
85
|
+
* @ViewChild('editor') editor!: DragbleEditorComponent;
|
|
86
|
+
*
|
|
87
|
+
* onReady(sdk: DragbleSDK) {
|
|
88
|
+
* console.log('Editor ready!', sdk);
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* handleSave() {
|
|
92
|
+
* this.editor.saveDesign((design) => {
|
|
93
|
+
* console.log('Design:', design);
|
|
94
|
+
* });
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare class DragbleEditorComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
|
|
100
|
+
/** Editor key for authentication (required) */
|
|
101
|
+
editorKey: string;
|
|
102
|
+
/** Initial design to load */
|
|
103
|
+
design?: DesignJson | ModuleData | null;
|
|
104
|
+
/** Editor mode (email, web, popup) */
|
|
105
|
+
editorMode: EditorMode;
|
|
106
|
+
/** Popup builder configuration (only used when editorMode is 'popup') */
|
|
107
|
+
popup?: PopupConfig;
|
|
108
|
+
/** Content type: 'module' for single-row mode */
|
|
109
|
+
contentType?: EditorContentTypeValue;
|
|
110
|
+
/** AI features configuration */
|
|
111
|
+
ai?: AIConfig;
|
|
112
|
+
/** UI language/locale */
|
|
113
|
+
locale?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Custom translation overrides keyed by locale code.
|
|
116
|
+
* Each locale maps translation keys to translated strings,
|
|
117
|
+
* allowing partial or full override of the editor's built-in UI strings.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* translations: {
|
|
122
|
+
* 'en-US': { 'toolbar.save': 'Save Draft' },
|
|
123
|
+
* 'fr-FR': { 'toolbar.save': 'Enregistrer le brouillon' },
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
translations?: Record<string, Record<string, string>>;
|
|
128
|
+
/** Text direction (ltr, rtl) */
|
|
129
|
+
textDirection?: TextDirection;
|
|
130
|
+
/** Template language for multi-language support */
|
|
131
|
+
language?: Language;
|
|
132
|
+
/** Visual customization */
|
|
133
|
+
appearance?: AppearanceConfig;
|
|
134
|
+
/** Enable/disable tools */
|
|
135
|
+
tools?: ToolsConfig;
|
|
136
|
+
/** Custom tools to register (Dragble-style) */
|
|
137
|
+
customTools?: DragbleToolConfig[];
|
|
138
|
+
/** Feature toggles */
|
|
139
|
+
features?: FeaturesConfig;
|
|
140
|
+
/** Merge tags configuration */
|
|
141
|
+
mergeTags?: MergeTagsConfig;
|
|
142
|
+
/** Special links configuration */
|
|
143
|
+
specialLinks?: SpecialLinksConfig;
|
|
144
|
+
/** Custom modules */
|
|
145
|
+
modules?: Module[];
|
|
146
|
+
/** Display conditions configuration */
|
|
147
|
+
displayConditions?: DisplayConditionsConfig;
|
|
148
|
+
/** Editor behavior configuration */
|
|
149
|
+
editor?: EditorBehaviorConfig;
|
|
150
|
+
/** Fonts configuration */
|
|
151
|
+
fonts?: FontsConfig;
|
|
152
|
+
/** Default body/canvas values applied on init */
|
|
153
|
+
bodyValues?: Record<string, unknown>;
|
|
154
|
+
/** Header row JSON to inject as a locked, non-editable row at the top */
|
|
155
|
+
header?: unknown;
|
|
156
|
+
/** Footer row JSON to inject as a locked, non-editable row at the bottom */
|
|
157
|
+
footer?: unknown;
|
|
158
|
+
/** Custom CSS URLs or inline styles */
|
|
159
|
+
customCSS?: string[];
|
|
160
|
+
/** Custom JS URLs or inline scripts */
|
|
161
|
+
customJS?: string[];
|
|
162
|
+
/** Height of the editor */
|
|
163
|
+
height: string | number;
|
|
164
|
+
/** Minimum height for the editor */
|
|
165
|
+
minHeight: string | number;
|
|
166
|
+
/** Additional editor options (merged into options) */
|
|
167
|
+
options?: Partial<EditorOptions>;
|
|
168
|
+
/**
|
|
169
|
+
* Callbacks for editor events (minus onReady/onLoad/onChange/onError which use Angular outputs).
|
|
170
|
+
* Includes: linkClick, onModuleSave, onPreview, onHeaderRowClick, onFooterRowClick,
|
|
171
|
+
* onLockedRowClick, onContentDialog.
|
|
172
|
+
*/
|
|
173
|
+
callbacks?: Omit<DragbleCallbacks, "onReady" | "onLoad" | "onChange" | "onError">;
|
|
174
|
+
/**
|
|
175
|
+
* Custom SDK URL for loading the Dragble SDK script.
|
|
176
|
+
* Use this for enterprise self-hosted SDK or specific versions.
|
|
177
|
+
* @default "https://sdk.dragble.com/latest/dragble-sdk.min.js"
|
|
178
|
+
*/
|
|
179
|
+
sdkUrl?: string;
|
|
180
|
+
/**
|
|
181
|
+
* SDK version to load from the Dragble CDN.
|
|
182
|
+
* @default "latest"
|
|
183
|
+
*/
|
|
184
|
+
sdkVersion?: string;
|
|
185
|
+
/** Editor version forwarded to the SDK init config. */
|
|
186
|
+
editorVersion?: string;
|
|
187
|
+
/** Editor URL forwarded to the SDK init config. */
|
|
188
|
+
editorUrl?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Team collaboration features (commenting, reviewer role, etc.)
|
|
191
|
+
* Can be a simple boolean or detailed configuration object.
|
|
192
|
+
* Only works with editorMode 'email' or 'web'.
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
collaboration?: boolean | CollaborationFeaturesConfig;
|
|
196
|
+
/** User information for session identity and collaboration */
|
|
197
|
+
user?: UserInfo;
|
|
198
|
+
/**
|
|
199
|
+
* Design mode for template permissions.
|
|
200
|
+
* - 'edit': Admin mode - shows "Row Actions" for setting row permissions
|
|
201
|
+
* - 'live': End-user mode - enforces row permissions
|
|
202
|
+
* @default 'live'
|
|
203
|
+
*/
|
|
204
|
+
designMode?: "edit" | "live";
|
|
205
|
+
/** Emitted when the editor is ready */
|
|
206
|
+
ready: EventEmitter<any>;
|
|
207
|
+
/** Emitted when a design is loaded */
|
|
208
|
+
load: EventEmitter<unknown>;
|
|
209
|
+
/** Emitted when the design changes */
|
|
210
|
+
change: EventEmitter<{
|
|
211
|
+
design: DesignJson;
|
|
212
|
+
type: string;
|
|
213
|
+
}>;
|
|
214
|
+
/** Emitted when an error occurs */
|
|
215
|
+
error: EventEmitter<Error>;
|
|
216
|
+
/** Emitted when a comment event occurs (create, edit, delete, resolve, reopen) */
|
|
217
|
+
commentAction: EventEmitter<any>;
|
|
218
|
+
containerId: string;
|
|
219
|
+
private sdk;
|
|
220
|
+
private _isReady;
|
|
221
|
+
get isReady(): boolean;
|
|
222
|
+
get computedHeight(): string;
|
|
223
|
+
get computedMinHeight(): string;
|
|
224
|
+
ngOnInit(): void;
|
|
225
|
+
ngAfterViewInit(): void;
|
|
226
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
227
|
+
ngOnDestroy(): void;
|
|
228
|
+
private initializeEditor;
|
|
229
|
+
private buildConfig;
|
|
230
|
+
/** Get the underlying SDK instance */
|
|
231
|
+
getEditor(): DragbleSDK | null;
|
|
232
|
+
loadDesign(design: DesignJson, options?: {
|
|
233
|
+
preserveHistory?: boolean;
|
|
234
|
+
}): void;
|
|
235
|
+
loadBlank(): void;
|
|
236
|
+
saveDesign(callback: (design: DesignJson) => void): void;
|
|
237
|
+
getDesign(): Promise<{
|
|
238
|
+
html: string;
|
|
239
|
+
json: DesignJson;
|
|
240
|
+
}> | undefined;
|
|
241
|
+
exportHtml(options?: ExportHtmlOptions): Promise<string> | undefined;
|
|
242
|
+
exportPlainText(): Promise<string> | undefined;
|
|
243
|
+
exportJson(): Promise<DesignJson> | undefined;
|
|
244
|
+
exportImage(options?: ExportImageOptions): Promise<ExportImageData> | undefined;
|
|
245
|
+
exportPdf(options?: ExportPdfOptions): Promise<ExportPdfData> | undefined;
|
|
246
|
+
exportZip(options?: ExportZipOptions): Promise<ExportZipData> | undefined;
|
|
247
|
+
getPopupValues(): Promise<PopupValues | null> | undefined;
|
|
248
|
+
setMergeTags(config: MergeTagsConfig): void;
|
|
249
|
+
getMergeTags(): Promise<(MergeTag | MergeTagGroup)[]> | undefined;
|
|
250
|
+
setSpecialLinks(config: SpecialLinksConfig): void;
|
|
251
|
+
getSpecialLinks(): Promise<(SpecialLink | SpecialLinkGroup)[]> | undefined;
|
|
252
|
+
setModulesLoading(loading: boolean): void;
|
|
253
|
+
setModules(modules: Module[]): void;
|
|
254
|
+
getModules(): Promise<Module[]> | undefined;
|
|
255
|
+
setFonts(config: FontsConfig): void;
|
|
256
|
+
getFonts(): Promise<FontsConfig> | undefined;
|
|
257
|
+
setBodyValues(values: Record<string, unknown>): void;
|
|
258
|
+
getBodyValues(): Promise<Record<string, unknown>> | undefined;
|
|
259
|
+
setOptions(options: Partial<EditorOptions>): void;
|
|
260
|
+
setToolsConfig(config: ToolsConfig): void;
|
|
261
|
+
setEditorMode(mode: EditorMode): void;
|
|
262
|
+
setEditorConfig(config: EditorBehaviorConfig): void;
|
|
263
|
+
getEditorConfig(): Promise<EditorBehaviorConfig> | undefined;
|
|
264
|
+
setLocale(locale: string): void;
|
|
265
|
+
setTextDirection(direction: TextDirection): void;
|
|
266
|
+
setAppearance(config: AppearanceConfig): void;
|
|
267
|
+
setCustomCSS(css: string[]): void;
|
|
268
|
+
setCustomJS(js: string[]): void;
|
|
269
|
+
setLanguage(language: Language): void;
|
|
270
|
+
getLanguage(): Promise<Language | null> | undefined;
|
|
271
|
+
undo(): void;
|
|
272
|
+
redo(): void;
|
|
273
|
+
save(): void;
|
|
274
|
+
showPreview(device?: ViewMode): void;
|
|
275
|
+
hidePreview(): void;
|
|
276
|
+
registerTool(config: unknown): Promise<void> | undefined;
|
|
277
|
+
unregisterTool(toolId: string): Promise<void> | undefined;
|
|
278
|
+
getTools(): Promise<Array<{
|
|
279
|
+
id: string;
|
|
280
|
+
label: string;
|
|
281
|
+
baseToolType: string;
|
|
282
|
+
}>> | undefined;
|
|
283
|
+
setDisplayConditions(config: DisplayConditionsConfig): void;
|
|
284
|
+
audit(callback: AuditCallback): void;
|
|
285
|
+
audit(options: AuditOptions, callback: AuditCallback): void;
|
|
286
|
+
audit(options?: AuditOptions): Promise<AuditResult> | undefined;
|
|
287
|
+
showComment(commentId: string): void;
|
|
288
|
+
openCommentPanel(rowId: string): void;
|
|
289
|
+
addEventListener<T = unknown>(event: EditorEventName, callback: (data: T) => void): (() => void) | undefined;
|
|
290
|
+
removeEventListener<T = unknown>(event: EditorEventName, callback: (data: T) => void): void;
|
|
291
|
+
registerColumns(cells: number[]): void;
|
|
292
|
+
setBrandingColors(config: {
|
|
293
|
+
colors?: string[] | Array<{
|
|
294
|
+
id: string;
|
|
295
|
+
label?: string;
|
|
296
|
+
colors: string[];
|
|
297
|
+
default?: boolean;
|
|
298
|
+
}>;
|
|
299
|
+
recentColors?: boolean;
|
|
300
|
+
}): void;
|
|
301
|
+
createWidget(config: DragbleWidgetConfig | unknown): Promise<void> | undefined;
|
|
302
|
+
removeWidget(widgetName: string): Promise<void> | undefined;
|
|
303
|
+
canUndo(): Promise<boolean> | undefined;
|
|
304
|
+
canRedo(): Promise<boolean> | undefined;
|
|
305
|
+
updateTabs(tabs: Record<string, {
|
|
306
|
+
visible?: boolean;
|
|
307
|
+
}>): void;
|
|
308
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DragbleEditorComponent, never>;
|
|
309
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DragbleEditorComponent, "dragble-editor", never, { "editorKey": { "alias": "editorKey"; "required": false; }; "design": { "alias": "design"; "required": false; }; "editorMode": { "alias": "editorMode"; "required": false; }; "popup": { "alias": "popup"; "required": false; }; "contentType": { "alias": "contentType"; "required": false; }; "ai": { "alias": "ai"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "translations": { "alias": "translations"; "required": false; }; "textDirection": { "alias": "textDirection"; "required": false; }; "language": { "alias": "language"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "tools": { "alias": "tools"; "required": false; }; "customTools": { "alias": "customTools"; "required": false; }; "features": { "alias": "features"; "required": false; }; "mergeTags": { "alias": "mergeTags"; "required": false; }; "specialLinks": { "alias": "specialLinks"; "required": false; }; "modules": { "alias": "modules"; "required": false; }; "displayConditions": { "alias": "displayConditions"; "required": false; }; "editor": { "alias": "editor"; "required": false; }; "fonts": { "alias": "fonts"; "required": false; }; "bodyValues": { "alias": "bodyValues"; "required": false; }; "header": { "alias": "header"; "required": false; }; "footer": { "alias": "footer"; "required": false; }; "customCSS": { "alias": "customCSS"; "required": false; }; "customJS": { "alias": "customJS"; "required": false; }; "height": { "alias": "height"; "required": false; }; "minHeight": { "alias": "minHeight"; "required": false; }; "options": { "alias": "options"; "required": false; }; "callbacks": { "alias": "callbacks"; "required": false; }; "sdkUrl": { "alias": "sdkUrl"; "required": false; }; "sdkVersion": { "alias": "sdkVersion"; "required": false; }; "editorVersion": { "alias": "editorVersion"; "required": false; }; "editorUrl": { "alias": "editorUrl"; "required": false; }; "collaboration": { "alias": "collaboration"; "required": false; }; "user": { "alias": "user"; "required": false; }; "designMode": { "alias": "designMode"; "required": false; }; }, { "ready": "ready"; "load": "load"; "change": "change"; "error": "error"; "commentAction": "commentAction"; }, never, never, true, never>;
|
|
310
|
+
}
|
|
311
|
+
export {};
|
|
312
|
+
//# sourceMappingURL=dragble-editor.component.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./dragble-editor.component";
|
|
3
|
+
export declare class DragbleEditorModule {
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DragbleEditorModule, never>;
|
|
5
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DragbleEditorModule, never, [typeof i1.DragbleEditorComponent], [typeof i1.DragbleEditorComponent]>;
|
|
6
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DragbleEditorModule>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=dragble-editor.module.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dragble Angular Editor
|
|
3
|
+
*
|
|
4
|
+
* Angular wrapper for the Dragble Editor SDK.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { DragbleEditorComponent } from "./dragble-editor.component";
|
|
9
|
+
export type { EditorContentTypeValue } from "./dragble-editor.component";
|
|
10
|
+
export { DragbleEditorModule } from "./dragble-editor.module";
|
|
11
|
+
export * from "dragble-types";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|