dragble-vue-editor 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/README.md +534 -54
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,9 +11,9 @@
11
11
 
12
12
  # dragble-vue-editor
13
13
 
14
- AI-powered Vue 3 component for building **email templates** with drag-and-drop. Embed a full-featured **AI-powered email editor** into your Vue app create responsive HTML emails, newsletters, transactional email templates, and email marketing campaigns visually without writing code.
14
+ The **fully AI-powered** Vue 3 editor for **email templates** and **landing pages**. Your end-users design visually with drag-and-drop — or describe what they want and watch AI agents build it live on the canvas. Powered by the built-in **Model Context Protocol (MCP)** server, connect [Claude Code](https://claude.com/code), [OpenCode](https://opencode.ai), [Codex](https://github.com/openai/codex), [Cursor](https://cursor.com), or your own AI backend directly to the editor. Structured tool calls mean guaranteed-valid output no prompt engineering, no JSON hallucination, no broken layouts.
15
15
 
16
- [Dragble](https://dragble.com) is a modern **AI-powered email builder** and **email template editor** that lets your users design professional emails with a visual drag-and-drop interface.
16
+ [Dragble](https://dragble.com) brings two design experiences together in one Vue component: a polished visual editor for designers and a conversational AI surface for everyone else backed by structured tool calls that produce guaranteed-valid HTML emails and landing pages every time.
17
17
 
18
18
  [Website](https://dragble.com) | [Documentation](https://docs.dragble.com) | [Dashboard](https://developers.dragble.com)
19
19
 
@@ -24,6 +24,7 @@ AI-powered Vue 3 component for building **email templates** with drag-and-drop.
24
24
  ## Features
25
25
 
26
26
  - Drag-and-drop **email template builder** with 20+ content blocks
27
+ - **Fully AI-powered via MCP** — connect AI agents (Claude Code, OpenCode, Codex, Cursor) or your own AI backend to build designs live on the canvas. Structured tool calls mean guaranteed-valid output — no prompt engineering, no JSON hallucination
27
28
  - Responsive **HTML email** output compatible with all major email clients
28
29
  - **Newsletter editor** with merge tags, dynamic content, and display conditions
29
30
  - Visual **email designer** — no HTML/CSS knowledge required for end users
@@ -88,6 +89,300 @@ const onChange = async (data: { design: unknown; type: string }) => {
88
89
  </script>
89
90
  ```
90
91
 
92
+ ## Complete Example
93
+
94
+ ```vue
95
+ <template>
96
+ <div class="advanced-email-builder">
97
+ <div class="toolbar">
98
+ <button type="button" @click="editorRef?.undo()">Undo</button>
99
+ <button type="button" @click="editorRef?.redo()">Redo</button>
100
+ <button type="button" @click="editorRef?.showPreview('desktop')">
101
+ Preview
102
+ </button>
103
+ <button type="button" @click="handleExportHtml">Export HTML</button>
104
+ <button type="button" @click="handleExportImage">Export Image</button>
105
+ <span v-if="isDirty" class="dirty-indicator">Unsaved changes</span>
106
+ </div>
107
+
108
+ <DragbleEditor
109
+ ref="editorRef"
110
+ editor-key="your-editor-key"
111
+ editor-mode="email"
112
+ height="100%"
113
+ design-mode="live"
114
+ :options="editorOptions"
115
+ @ready="handleReady"
116
+ @change="handleChange"
117
+ @error="handleError"
118
+ />
119
+ </div>
120
+ </template>
121
+
122
+ <script setup lang="ts">
123
+ import { ref } from "vue";
124
+ import {
125
+ DragbleEditor,
126
+ type DesignJson,
127
+ type DragbleSDK,
128
+ type EditorOptions,
129
+ } from "dragble-vue-editor";
130
+
131
+ const editorRef = ref<InstanceType<typeof DragbleEditor> | null>(null);
132
+ const isDirty = ref(false);
133
+
134
+ const editorOptions: EditorOptions = {
135
+ appearance: { theme: "light" },
136
+ features: {
137
+ preview: true,
138
+ undoRedo: true,
139
+ imageEditor: true,
140
+ },
141
+ };
142
+
143
+ const handleReady = (editor: DragbleSDK) => {
144
+ // Set merge tags (must pass a MergeTagsConfig object)
145
+ editor.setMergeTags({
146
+ customMergeTags: [
147
+ { name: "First Name", value: "{{first_name}}" },
148
+ { name: "Last Name", value: "{{last_name}}" },
149
+ { name: "Company", value: "{{company}}" },
150
+ ],
151
+ excludeDefaults: false,
152
+ sort: true,
153
+ });
154
+
155
+ // Set custom fonts
156
+ editor.setFonts({
157
+ showDefaultFonts: true,
158
+ customFonts: [{ label: "Brand Font", value: "BrandFont, sans-serif" }],
159
+ });
160
+
161
+ // Load saved design if available
162
+ const savedDesign = localStorage.getItem("email-design");
163
+ if (savedDesign) {
164
+ editor.loadDesign(JSON.parse(savedDesign));
165
+ }
166
+ };
167
+
168
+ const handleChange = (data: { design: DesignJson; type: string }) => {
169
+ isDirty.value = true;
170
+ localStorage.setItem("email-design", JSON.stringify(data.design));
171
+ };
172
+
173
+ const handleExportHtml = async () => {
174
+ if (!editorRef.value) return;
175
+
176
+ const html = await editorRef.value.exportHtml();
177
+ const blob = new Blob([html], { type: "text/html" });
178
+ const url = URL.createObjectURL(blob);
179
+ const a = document.createElement("a");
180
+ a.href = url;
181
+ a.download = "email.html";
182
+ a.click();
183
+ URL.revokeObjectURL(url);
184
+ };
185
+
186
+ const handleExportImage = async () => {
187
+ if (!editorRef.value) return;
188
+
189
+ const data = await editorRef.value.exportImage();
190
+ window.open(data.url, "_blank");
191
+ };
192
+
193
+ const handleError = (error: Error) => {
194
+ console.error(error.message);
195
+ };
196
+ </script>
197
+
198
+ <style scoped>
199
+ .advanced-email-builder {
200
+ height: 100vh;
201
+ display: flex;
202
+ flex-direction: column;
203
+ }
204
+
205
+ .toolbar {
206
+ padding: 12px;
207
+ border-bottom: 1px solid #ddd;
208
+ display: flex;
209
+ gap: 8px;
210
+ align-items: center;
211
+ }
212
+
213
+ .dirty-indicator {
214
+ color: orange;
215
+ }
216
+ </style>
217
+ ```
218
+
219
+ ## MCP — AI Integration
220
+
221
+ Connect AI agents (Claude Code, OpenCode, Codex, Cursor, or your own AI backend) to the editor through the [Model Context Protocol](https://modelcontextprotocol.io). The AI calls structured tools — `add_row`, `add_heading`, `update_button`, `export_html` — that mutate design state live on the canvas. No prompt engineering, no JSON hallucination, no broken output.
222
+
223
+ ### Enabling MCP
224
+
225
+ MCP is off by default. Set `features: { mcp: true }` to opt in:
226
+
227
+ ```vue
228
+ <DragbleEditor
229
+ ref="editorRef"
230
+ editor-key="db_pxl81cxn92wignwx"
231
+ :options="{ features: { mcp: true } }"
232
+ />
233
+ ```
234
+
235
+ MCP also requires a **Starter plan or higher**. Both conditions must be true — plan allows it AND SDK enables it.
236
+
237
+ ### Quick example — your backend controls the AI
238
+
239
+ ```vue
240
+ <template>
241
+ <button @click="handleConnectAI">Connect AI</button>
242
+ <DragbleEditor
243
+ ref="editorRef"
244
+ editor-key="db_pxl81cxn92wignwx"
245
+ :options="{ features: { mcp: true } }"
246
+ />
247
+ </template>
248
+
249
+ <script setup lang="ts">
250
+ import { ref } from "vue";
251
+ import { DragbleEditor } from "dragble-vue-editor";
252
+
253
+ const editorRef = ref<InstanceType<typeof DragbleEditor> | null>(null);
254
+
255
+ const handleConnectAI = async () => {
256
+ // The id is YOUR identifier — derive it from your own database/session
257
+ // so the same user editing the same document always gets the same MCP
258
+ // session. Example: if your logged-in user is "alice123" and they're
259
+ // editing document "campaign-summer-2026", build an id like this:
260
+ //
261
+ // const id = "alice123-campaign-summer-2026";
262
+ //
263
+ // Format rules: 8-128 chars, only letters/digits/hyphens/underscores.
264
+ const userIdFromAuth = "alice123"; // from your auth/session
265
+ const docIdFromRoute = "campaign-summer"; // from your URL or DB row
266
+ const id = `${userIdFromAuth}-${docIdFromRoute}`;
267
+ const { sessionId } =
268
+ await editorRef.value!.editor!.connectMCP({ id });
269
+ // Pass sessionId to your backend — it calls MCP tools with your mcp_key
270
+ };
271
+ </script>
272
+ ```
273
+
274
+ ### Quick example — end-user pairs their own AI client
275
+
276
+ ```ts
277
+ const handleLetUserPair = async () => {
278
+ const editor = editorRef.value!.editor!;
279
+ // Same id you'd use anywhere else for this user+document combination.
280
+ // 8-128 chars, only letters/digits/hyphens/underscores.
281
+ const id = "alice123-campaign-summer-2026";
282
+ await editor.connectMCP({ id });
283
+
284
+ // Explicitly generate a pairing code (not auto-generated)
285
+ const { code, expiresAt } = await editor.getPairingCode();
286
+ alert(`Paste this into Claude Code: ${code}`);
287
+ };
288
+ ```
289
+
290
+ ### One controller per session
291
+
292
+ Each session can be controlled by **either** your backend **or** an end-user's AI client (Claude Code, OpenCode), never both at the same time:
293
+
294
+ - If your backend makes the first tool call → session is locked to **backend**. Pairing codes are rejected.
295
+ - If a user pairs via pairing code first → session is locked to **paired client**. Backend tool calls are rejected.
296
+
297
+ This prevents two AI controllers from conflicting on the same design.
298
+
299
+ ### How it works
300
+
301
+ 1. **Enable MCP** in the SDK config: `features: { mcp: true }`.
302
+ 2. **Generate an MCP key** in the Dragble dashboard: Project → MCP Key → Generate. Store it in your backend env vars — never in browser code.
303
+ 3. **Call `editor.connectMCP({ id })`** where `id` is a stable identifier you control (see below).
304
+ 4. **Choose your AI path**: either your backend calls MCP tools directly (using the mcp_key), or you generate a pairing code for the end-user to connect their own AI client.
305
+ 5. **Mutations stream live** onto the editor canvas as the AI works.
306
+
307
+ ### The `id` parameter — why it matters
308
+
309
+ The `id` you pass to `connectMCP()` is a **Bring Your Own ID (BYOI)** that maps to your domain entities. It is NOT a random token — it is how Dragble identifies the session across browser refreshes, server restarts, and device switches.
310
+
311
+ **Rules:**
312
+ - 8–128 characters long
313
+ - Only letters, numbers, hyphens, and underscores (`a-z A-Z 0-9 - _`)
314
+ - Must be deterministic — the same user editing the same document should always produce the same `id`
315
+
316
+ **Why these rules?**
317
+ - The `id` is used in database lookups, URL paths, and storage keys — special characters or extreme lengths would break routing
318
+ - Same `id` = resume the same session. Random UUIDs mean every page refresh creates a new session and loses AI context
319
+ - Short IDs (< 8 chars) are too easy to guess, long IDs (> 128 chars) waste storage
320
+
321
+ ```ts
322
+ // Recommended: derive from your domain — concrete examples
323
+ editor.connectMCP({ id: "alice123-campaign-summer-2026" }); // user + doc
324
+ editor.connectMCP({ id: "workspace_acme_template_welcome" }); // workspace + template
325
+ editor.connectMCP({ id: "org-uber-eats-promo-q4-2026" }); // org + campaign
326
+ editor.connectMCP({ id: "tenant_42_invoice_template_v3" }); // tenant + entity
327
+
328
+ // Valid but NOT recommended — random IDs break session continuity
329
+ // (every page refresh creates a brand new session, AI loses context)
330
+ editor.connectMCP({ id: crypto.randomUUID() });
331
+ ```
332
+
333
+ ### Storage modes (compliance)
334
+
335
+ Choose how much of the session lives on Dragble's servers:
336
+
337
+ | Mode | Persistence | Use case |
338
+ |---|---|---|
339
+ | `full` (default) | Metadata + design content | Standard SaaS; survives refresh, restart, device switch |
340
+ | `metadata-only` | Metadata only | Audit logs without storing customer content |
341
+ | `memory-only` | None — RAM only | HIPAA / SOC2 / strict data residency |
342
+
343
+ ```ts
344
+ editor.connectMCP({
345
+ id: "user-42-doc-99",
346
+ storage: "full", // default — best UX, refresh + cross-device resume
347
+ // "metadata-only" // audit metadata only, no design content persisted
348
+ // "memory-only" // nothing persisted (HIPAA / SOC2 / data residency)
349
+ });
350
+ ```
351
+
352
+ ### Disconnecting
353
+
354
+ `disconnectMCP()` permanently destroys the session — the database record is deleted and the session cannot be reopened:
355
+
356
+ ```ts
357
+ const { destroyed } = await editor.disconnectMCP();
358
+ ```
359
+
360
+ Your backend can also force-destroy a session server-side (e.g., when a user's subscription ends):
361
+
362
+ ```bash
363
+ curl -X DELETE https://mcp.dragble.io/sessions/user-42-doc-99 \
364
+ -H "X-API-Key: db_mcp_your_key_here"
365
+ ```
366
+
367
+ Idle sessions are reaped after 2 hours of inactivity. Active sessions never expire — each tool call resets the timer.
368
+
369
+ ### MCP method reference
370
+
371
+ | Method | Returns |
372
+ |---|---|
373
+ | `editor.connectMCP({ id, storage?, editorMode? })` | `{ sessionId, storageMode?, resumed? }` |
374
+ | `editor.disconnectMCP()` | `{ destroyed }` — permanently deletes session |
375
+ | `editor.getPairingCode()` | `{ code, expiresAt }` — generate a pairing code for end-user AI clients |
376
+ | `editor.endPairing()` | `{ revoked }` — invalidate the active pairing code |
377
+ | `editor.getMCPStatus()` | `{ paired: true, sessionId } \| { paired: false, reason? }` |
378
+ | `editor.onAIToolFired(cb)` | unsubscribe fn — fires when AI calls any tool |
379
+
380
+ ### Full documentation
381
+
382
+ - [MCP Overview](https://docs.dragble.com/mcp-server/overview)
383
+ - [Credentials & Security](https://docs.dragble.com/mcp-server/credentials)
384
+ - [AI Client Setup (OpenCode, Claude Code, Codex, etc.)](https://docs.dragble.com/mcp-server/ai-client-setup)
385
+
91
386
  ## Props
92
387
 
93
388
  | Prop | Type | Default | Description |
@@ -126,58 +421,6 @@ const onChange = async (data: { design: unknown; type: string }) => {
126
421
  | `user` | `UserInfo` | `undefined` | User info |
127
422
  | `designMode` | `"edit" \| "live"` | `undefined` | Template permissions |
128
423
 
129
- ## Events
130
-
131
- | Event | Description |
132
- | --------- | ------------------------------- |
133
- | `ready` | Editor is initialized and ready |
134
- | `load` | Design has been loaded |
135
- | `change` | Design has changed |
136
- | `error` | An error occurred |
137
- | `comment` | Comment event |
138
-
139
- ## Exposed Methods
140
-
141
- All SDK methods are accessible via a template ref. Key methods:
142
-
143
- | Method | Returns | Description |
144
- | ---------------------------------- | ---------------------- | ---------------------------------------- |
145
- | `loadDesign(design, options?)` | `void` | Load a design |
146
- | `loadBlank(options?)` | `void` | Load a blank design |
147
- | `getDesign()` | `Promise` | Get current design JSON |
148
- | `exportHtml(options?)` | `Promise<string>` | Export as HTML |
149
- | `exportJson()` | `Promise<DesignJson>` | Export design JSON |
150
- | `exportPlainText()` | `Promise<string>` | Export as plain text |
151
- | `exportImage(options?)` | `Promise` | Export as image |
152
- | `exportPdf(options?)` | `Promise` | Export as PDF |
153
- | `exportZip(options?)` | `Promise` | Export as ZIP |
154
- | `setMergeTags(config)` | `void` | Set merge tags config |
155
- | `getMergeTags()` | `Promise` | Get merge tags |
156
- | `setSpecialLinks(config)` | `void` | Set special links |
157
- | `setModules(modules)` | `void` | Set custom modules |
158
- | `setFonts(config)` | `void` | Set fonts config |
159
- | `setBodyValues(values)` | `void` | Set body values |
160
- | `setToolsConfig(config)` | `void` | Set tools config |
161
- | `setAppearance(config)` | `void` | Set appearance |
162
- | `setEditorMode(mode)` | `void` | Set editor mode |
163
- | `setLocale(locale, translations?)` | `void` | Set locale |
164
- | `setTextDirection(direction)` | `void` | Set text direction |
165
- | `setLanguage(language)` | `void` | Set language |
166
- | `setDisplayConditions(config)` | `void` | Set display conditions |
167
- | `setOptions(options)` | `void` | Set additional options |
168
- | `showPreview(device?)` | `void` | Show design preview |
169
- | `hidePreview()` | `void` | Hide preview |
170
- | `undo()` | `void` | Undo last action |
171
- | `redo()` | `void` | Redo last action |
172
- | `canUndo()` | `Promise<boolean>` | Check if undo available |
173
- | `canRedo()` | `Promise<boolean>` | Check if redo available |
174
- | `save()` | `void` | Trigger save |
175
- | `audit(options?)` | `Promise<AuditResult>` | Run design audit |
176
- | `registerTool(config)` | `Promise` | Register a custom tool |
177
- | `unregisterTool(id)` | `Promise` | Unregister a tool |
178
- | `addEventListener(event, cb)` | `() => void` | Subscribe to event (returns unsubscribe) |
179
- | `removeEventListener(event, cb)` | `void` | Unsubscribe from event |
180
-
181
424
  ## Composable
182
425
 
183
426
  For more control over the editor lifecycle, use the `useDragbleEditor` composable:
@@ -213,6 +456,243 @@ const exportHtml = async () => {
213
456
  | `isReady` | `Ref<boolean>` | Whether the editor is initialized |
214
457
  | `containerId` | `string` | DOM element ID to bind the editor to |
215
458
 
459
+ ## SDK Methods Reference
460
+
461
+ Access the SDK through the Vue component template ref (`editorRef.value`) or through the `editor` ref returned by `useDragbleEditor()`. The component exposes SDK methods directly, so calls such as `editorRef.value!.exportHtml()` work without reaching into framework internals. All export and getter methods return Promises.
462
+
463
+ ```ts
464
+ const html = await editorRef.value!.exportHtml();
465
+ const design = await editor.value!.exportJson();
466
+ ```
467
+
468
+ ### Design
469
+
470
+ ```ts
471
+ editorRef.value!.loadDesign(design, options?); // void
472
+ const result = await editorRef.value!.loadDesignAsync(design, options?);
473
+ // => { success, validRowsCount, invalidRowsCount, errors? }
474
+ editorRef.value!.loadBlank(options?); // void
475
+ const { html, json } = await editorRef.value!.getDesign(); // Promise
476
+ ```
477
+
478
+ ### Export
479
+
480
+ All export methods are **Promise-based**. There are no callback overloads.
481
+
482
+ ```ts
483
+ const html = await editorRef.value!.exportHtml(options?); // Promise<string>
484
+ const json = await editorRef.value!.exportJson(); // Promise<DesignJson>
485
+ const text = await editorRef.value!.exportPlainText(); // Promise<string>
486
+ const imageData = await editorRef.value!.exportImage(options?); // Promise<ExportImageData>
487
+ const pdfData = await editorRef.value!.exportPdf(options?); // Promise<ExportPdfData>
488
+ const zipData = await editorRef.value!.exportZip(options?); // Promise<ExportZipData>
489
+ const values = await editorRef.value!.getPopupValues(); // Promise<PopupValues | null>
490
+ ```
491
+
492
+ ### Merge Tags
493
+
494
+ `setMergeTags` accepts a `MergeTagsConfig` object, not a plain array.
495
+
496
+ ```ts
497
+ editorRef.value!.setMergeTags({
498
+ customMergeTags: [
499
+ { name: "First Name", value: "{{first_name}}" },
500
+ { name: "Company", value: "{{company}}" },
501
+ ],
502
+ excludeDefaults: false,
503
+ sort: true,
504
+ });
505
+ const tags = await editorRef.value!.getMergeTags(); // Promise<(MergeTag | MergeTagGroup)[]>
506
+ ```
507
+
508
+ ### Special Links
509
+
510
+ `setSpecialLinks` accepts a `SpecialLinksConfig` object.
511
+
512
+ ```ts
513
+ editorRef.value!.setSpecialLinks({
514
+ customSpecialLinks: [{ name: "Unsubscribe", href: "{{unsubscribe_url}}" }],
515
+ excludeDefaults: false,
516
+ });
517
+ const links = await editorRef.value!.getSpecialLinks(); // Promise<(SpecialLink | SpecialLinkGroup)[]>
518
+ ```
519
+
520
+ ### Modules
521
+
522
+ ```ts
523
+ editorRef.value!.setModules(modules); // void
524
+ editorRef.value!.setModulesLoading(loading); // void
525
+ const modules = await editorRef.value!.getModules(); // Promise<Module[]>
526
+ ```
527
+
528
+ ### Fonts
529
+
530
+ ```ts
531
+ editorRef.value!.setFonts(config); // void
532
+ const fonts = await editorRef.value!.getFonts(); // Promise<FontsConfig>
533
+ ```
534
+
535
+ ### Body Values
536
+
537
+ ```ts
538
+ editorRef.value!.setBodyValues({
539
+ backgroundColor: "#f5f5f5",
540
+ contentWidth: "600px",
541
+ });
542
+ const values = await editorRef.value!.getBodyValues(); // Promise<SetBodyValuesOptions>
543
+ ```
544
+
545
+ ### Editor Configuration
546
+
547
+ ```ts
548
+ editorRef.value!.setOptions(options); // void — Partial<EditorOptions>
549
+ editorRef.value!.setToolsConfig(toolsConfig); // void
550
+ editorRef.value!.setEditorMode(mode); // void
551
+ editorRef.value!.setEditorConfig(config); // void
552
+ const config = await editorRef.value!.getEditorConfig(); // Promise<EditorBehaviorConfig>
553
+ ```
554
+
555
+ ### Locale, Language & Text Direction
556
+
557
+ ```ts
558
+ editorRef.value!.setLocale(locale, translations?); // void
559
+ editorRef.value!.setLanguage(language); // void
560
+ const lang = await editorRef.value!.getLanguage(); // Promise<Language | null>
561
+ editorRef.value!.setTextDirection(direction); // void — 'ltr' | 'rtl'
562
+ const dir = await editorRef.value!.getTextDirection(); // Promise<TextDirection>
563
+ ```
564
+
565
+ ### Appearance
566
+
567
+ ```ts
568
+ editorRef.value!.setAppearance(appearance); // void
569
+ ```
570
+
571
+ ### Undo / Redo / Save
572
+
573
+ ```ts
574
+ editorRef.value!.undo(); // void
575
+ editorRef.value!.redo(); // void
576
+ const canUndo = await editorRef.value!.canUndo(); // Promise<boolean>
577
+ const canRedo = await editorRef.value!.canRedo(); // Promise<boolean>
578
+ editorRef.value!.save(); // void
579
+ ```
580
+
581
+ ### Preview
582
+
583
+ ```ts
584
+ editorRef.value!.showPreview(device?); // void — 'desktop' | 'tablet' | 'mobile'
585
+ editorRef.value!.hidePreview(); // void
586
+ ```
587
+
588
+ ### Custom Tools
589
+
590
+ ```ts
591
+ await editorRef.value!.registerTool(config); // Promise<void>
592
+ await editorRef.value!.unregisterTool(toolId); // Promise<void>
593
+ const tools = await editorRef.value!.getTools(); // Promise<Array<{ id, label, baseToolType }>>
594
+ ```
595
+
596
+ ### Custom Widgets
597
+
598
+ ```ts
599
+ await editorRef.value!.createWidget(config); // Promise<void>
600
+ await editorRef.value!.removeWidget(widgetName); // Promise<void>
601
+ ```
602
+
603
+ ### Collaboration & Comments
604
+
605
+ ```ts
606
+ editorRef.value!.showComment(commentId); // void
607
+ editorRef.value!.openCommentPanel(rowId); // void
608
+ ```
609
+
610
+ ### Tabs & Branding
611
+
612
+ ```ts
613
+ editorRef.value!.updateTabs(tabs); // void
614
+ editorRef.value!.setBrandingColors(config); // void
615
+ editorRef.value!.registerColumns(cells); // void
616
+ ```
617
+
618
+ ### Display Conditions
619
+
620
+ ```ts
621
+ editorRef.value!.setDisplayConditions(config); // void
622
+ ```
623
+
624
+ ### Audit
625
+
626
+ ```ts
627
+ const result = await editorRef.value!.audit(options?); // Promise<AuditResult>
628
+ ```
629
+
630
+ ### Asset Management
631
+
632
+ ```ts
633
+ const { success, url, error } = await editorRef.value!.uploadImage(file, options?);
634
+ const { assets, total } = await editorRef.value!.listAssets(options?);
635
+ const { success, error } = await editorRef.value!.deleteAsset(assetId);
636
+ const folders = await editorRef.value!.listAssetFolders(parentId?);
637
+ const folder = await editorRef.value!.createAssetFolder(name, parentId?);
638
+ const info = await editorRef.value!.getStorageInfo();
639
+ ```
640
+
641
+ ### Status & Lifecycle
642
+
643
+ ```ts
644
+ editorRef.value!.isReady(); // boolean
645
+ editorRef.value!.destroy(); // void
646
+ ```
647
+
648
+ ## Events
649
+
650
+ Component events (`@ready`, `@load`, `@change`, `@error`, `@comment`) cover the common Vue integration points. For lower-level SDK events, subscribe with `addEventListener` after the editor is ready:
651
+
652
+ ```ts
653
+ const unsubscribe = editorRef.value?.addEventListener("design:updated", (data) => {
654
+ console.log("Design changed:", data);
655
+ });
656
+
657
+ // Or remove manually
658
+ editorRef.value?.removeEventListener("design:updated", callback);
659
+ ```
660
+
661
+ ### Available Events
662
+
663
+ | Event | Description |
664
+ | -------------------------- | --------------------------- |
665
+ | `editor:ready` | Editor initialized |
666
+ | `design:loaded` | Design loaded |
667
+ | `design:updated` | Design changed |
668
+ | `design:saved` | Design saved |
669
+ | `row:selected` | Row selected |
670
+ | `row:unselected` | Row unselected |
671
+ | `column:selected` | Column selected |
672
+ | `column:unselected` | Column unselected |
673
+ | `content:selected` | Content block selected |
674
+ | `content:unselected` | Content block unselected |
675
+ | `content:modified` | Content block modified |
676
+ | `content:added` | Content block added |
677
+ | `content:deleted` | Content block deleted |
678
+ | `preview:shown` | Preview opened |
679
+ | `preview:hidden` | Preview closed |
680
+ | `image:uploaded` | Image uploaded successfully |
681
+ | `image:error` | Image upload error |
682
+ | `export:html` | HTML exported |
683
+ | `export:plainText` | Plain text exported |
684
+ | `export:image` | Image exported |
685
+ | `save` | Save triggered |
686
+ | `save:success` | Save succeeded |
687
+ | `save:error` | Save failed |
688
+ | `template:requested` | Template requested |
689
+ | `element:selected` | Element selected |
690
+ | `element:deselected` | Element deselected |
691
+ | `export` | Export triggered |
692
+ | `displayCondition:applied` | Display condition applied |
693
+ | `displayCondition:removed` | Display condition removed |
694
+ | `displayCondition:updated` | Display condition updated |
695
+
216
696
  ## TypeScript
217
697
 
218
698
  Full type definitions are included. Import types directly from the package:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragble-vue-editor",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "AI-powered Vue 3 email editor component. Drag-and-drop email builder for creating responsive email templates and newsletters. Build HTML emails visually with Dragble.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",