dragble-vue-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 +235 -0
- package/dist/index.d.ts +776 -0
- package/dist/index.js +741 -0
- package/dist/index.js.map +1 -0
- package/package.json +128 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
import * as dragble_types from 'dragble-types';
|
|
2
|
+
import { DragbleSDK, DesignJson, ModuleData, EditorMode, PopupConfig, AIConfig, TextDirection, AppearanceConfig, ToolsConfig, FeaturesConfig, MergeTag, MergeTagGroup, SpecialLink, SpecialLinkGroup, Module, DisplayConditionsConfig, Language, FontsConfig, DragbleToolConfig, EditorBehaviorConfig, EditorOptions, DragbleCallbacks, CollaborationFeaturesConfig, UserInfo, DragbleConfig, ExportHtmlOptions, ExportImageOptions, ExportImageData, ExportPdfOptions, ExportPdfData, ExportZipOptions, ExportZipData, MergeTagsConfig, SpecialLinksConfig, ViewMode, AuditCallback, AuditOptions, EditorEventName } from 'dragble-types';
|
|
3
|
+
export * from 'dragble-types';
|
|
4
|
+
import * as vue from 'vue';
|
|
5
|
+
import { PropType } from 'vue';
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
dragble?: DragbleSDK;
|
|
10
|
+
createEditor?: () => DragbleSDK;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
type EditorContentTypeValue = "module";
|
|
14
|
+
/**
|
|
15
|
+
* DragbleEditor Vue 3 Component
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```vue
|
|
19
|
+
* <template>
|
|
20
|
+
* <DragbleEditor
|
|
21
|
+
* ref="editorRef"
|
|
22
|
+
* editor-key="your-editor-key"
|
|
23
|
+
* editor-mode="email"
|
|
24
|
+
* @ready="onReady"
|
|
25
|
+
* @change="onChange"
|
|
26
|
+
* />
|
|
27
|
+
* </template>
|
|
28
|
+
*
|
|
29
|
+
* <script setup lang="ts">
|
|
30
|
+
* import { ref } from 'vue';
|
|
31
|
+
* import { DragbleEditor } from '@dragble/vue-editor';
|
|
32
|
+
*
|
|
33
|
+
* const editorRef = ref<InstanceType<typeof DragbleEditor>>();
|
|
34
|
+
*
|
|
35
|
+
* const onReady = (editor) => console.log('Ready!', editor);
|
|
36
|
+
* const onChange = (data) => console.log('Changed:', data);
|
|
37
|
+
*
|
|
38
|
+
* const handleSave = () => {
|
|
39
|
+
* editorRef.value?.saveDesign((design) => {
|
|
40
|
+
* console.log('Design:', design);
|
|
41
|
+
* });
|
|
42
|
+
* };
|
|
43
|
+
* </script>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const DragbleEditor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
47
|
+
/** Editor key for authentication (required) */
|
|
48
|
+
editorKey: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
/** Initial design to load */
|
|
53
|
+
design: {
|
|
54
|
+
type: PropType<DesignJson | ModuleData | null>;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
/** Editor mode (email, web, popup) */
|
|
58
|
+
editorMode: {
|
|
59
|
+
type: PropType<EditorMode>;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
/** Popup builder configuration (only used when editorMode is 'popup') */
|
|
63
|
+
popup: {
|
|
64
|
+
type: PropType<PopupConfig>;
|
|
65
|
+
default: undefined;
|
|
66
|
+
};
|
|
67
|
+
/** Content type: 'module' for single-row module editor */
|
|
68
|
+
contentType: {
|
|
69
|
+
type: PropType<"module">;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
/** AI features configuration */
|
|
73
|
+
ai: {
|
|
74
|
+
type: PropType<AIConfig>;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
/** UI language/locale */
|
|
78
|
+
locale: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Custom translation overrides keyed by locale code.
|
|
84
|
+
* Each locale maps translation keys to translated strings,
|
|
85
|
+
* allowing partial or full override of the editor's built-in UI strings.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* translations: {
|
|
90
|
+
* 'en-US': { 'toolbar.save': 'Save Draft' },
|
|
91
|
+
* 'fr-FR': { 'toolbar.save': 'Enregistrer le brouillon' },
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
translations: {
|
|
96
|
+
type: PropType<Record<string, Record<string, string>>>;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
/** Text direction (ltr, rtl) */
|
|
100
|
+
textDirection: {
|
|
101
|
+
type: PropType<TextDirection>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
/** Visual customization */
|
|
105
|
+
appearance: {
|
|
106
|
+
type: PropType<AppearanceConfig>;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
109
|
+
/** Enable/disable tools */
|
|
110
|
+
tools: {
|
|
111
|
+
type: PropType<ToolsConfig>;
|
|
112
|
+
default: undefined;
|
|
113
|
+
};
|
|
114
|
+
/** Feature toggles */
|
|
115
|
+
features: {
|
|
116
|
+
type: PropType<FeaturesConfig>;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
/** Merge tags for personalization */
|
|
120
|
+
mergeTags: {
|
|
121
|
+
type: PropType<(MergeTag | MergeTagGroup)[]>;
|
|
122
|
+
default: undefined;
|
|
123
|
+
};
|
|
124
|
+
/** Special link categories */
|
|
125
|
+
specialLinks: {
|
|
126
|
+
type: PropType<(SpecialLink | SpecialLinkGroup)[]>;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
129
|
+
/** Custom modules */
|
|
130
|
+
modules: {
|
|
131
|
+
type: PropType<Module[]>;
|
|
132
|
+
default: undefined;
|
|
133
|
+
};
|
|
134
|
+
/** Display conditions configuration */
|
|
135
|
+
displayConditions: {
|
|
136
|
+
type: PropType<DisplayConditionsConfig>;
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
/** Template language for multi-language support */
|
|
140
|
+
language: {
|
|
141
|
+
type: PropType<Language>;
|
|
142
|
+
default: undefined;
|
|
143
|
+
};
|
|
144
|
+
/** Fonts configuration */
|
|
145
|
+
fonts: {
|
|
146
|
+
type: PropType<FontsConfig>;
|
|
147
|
+
default: undefined;
|
|
148
|
+
};
|
|
149
|
+
/** Custom tools to register (Dragble-style) */
|
|
150
|
+
customTools: {
|
|
151
|
+
type: PropType<DragbleToolConfig[]>;
|
|
152
|
+
default: undefined;
|
|
153
|
+
};
|
|
154
|
+
/** Default body/canvas values applied on init */
|
|
155
|
+
bodyValues: {
|
|
156
|
+
type: PropType<Record<string, unknown>>;
|
|
157
|
+
default: undefined;
|
|
158
|
+
};
|
|
159
|
+
/** Header row JSON to inject as a locked, non-editable row at the top */
|
|
160
|
+
header: {
|
|
161
|
+
type: PropType<unknown>;
|
|
162
|
+
default: undefined;
|
|
163
|
+
};
|
|
164
|
+
/** Footer row JSON to inject as a locked, non-editable row at the bottom */
|
|
165
|
+
footer: {
|
|
166
|
+
type: PropType<unknown>;
|
|
167
|
+
default: undefined;
|
|
168
|
+
};
|
|
169
|
+
/** Editor behavior configuration */
|
|
170
|
+
editor: {
|
|
171
|
+
type: PropType<EditorBehaviorConfig>;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
174
|
+
/** Custom CSS URLs or inline styles */
|
|
175
|
+
customCSS: {
|
|
176
|
+
type: PropType<string[]>;
|
|
177
|
+
default: undefined;
|
|
178
|
+
};
|
|
179
|
+
/** Custom JS URLs or inline scripts */
|
|
180
|
+
customJS: {
|
|
181
|
+
type: PropType<string[]>;
|
|
182
|
+
default: undefined;
|
|
183
|
+
};
|
|
184
|
+
/** Height of the editor */
|
|
185
|
+
height: {
|
|
186
|
+
type: PropType<string | number>;
|
|
187
|
+
default: string;
|
|
188
|
+
};
|
|
189
|
+
/** Minimum height for the editor */
|
|
190
|
+
minHeight: {
|
|
191
|
+
type: PropType<string | number>;
|
|
192
|
+
default: string;
|
|
193
|
+
};
|
|
194
|
+
/** Additional editor options (appearance, tools, features, AI, etc.) */
|
|
195
|
+
options: {
|
|
196
|
+
type: PropType<EditorOptions>;
|
|
197
|
+
default: undefined;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* SDK callbacks (onModuleSave, onContentDialog, onPreview, onHeaderRowClick, etc.)
|
|
201
|
+
* Note: onReady/onLoad/onChange/onError are handled via Vue emits, not this prop.
|
|
202
|
+
*/
|
|
203
|
+
callbacks: {
|
|
204
|
+
type: PropType<Omit<DragbleCallbacks, "onReady" | "onLoad" | "onChange" | "onError">>;
|
|
205
|
+
default: undefined;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Custom SDK URL for loading the Dragble SDK script.
|
|
209
|
+
* Use this for enterprise self-hosted SDK or specific versions.
|
|
210
|
+
* @default "https://sdk.dragble.com/latest/dragble-sdk.min.js"
|
|
211
|
+
*/
|
|
212
|
+
sdkUrl: {
|
|
213
|
+
type: StringConstructor;
|
|
214
|
+
default: undefined;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* SDK version to load from the Dragble CDN.
|
|
218
|
+
* @default "latest"
|
|
219
|
+
*/
|
|
220
|
+
sdkVersion: {
|
|
221
|
+
type: StringConstructor;
|
|
222
|
+
default: undefined;
|
|
223
|
+
};
|
|
224
|
+
/** Editor version forwarded to the SDK init config. */
|
|
225
|
+
editorVersion: {
|
|
226
|
+
type: StringConstructor;
|
|
227
|
+
default: undefined;
|
|
228
|
+
};
|
|
229
|
+
/** Editor URL forwarded to the SDK init config. */
|
|
230
|
+
editorUrl: {
|
|
231
|
+
type: StringConstructor;
|
|
232
|
+
default: undefined;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Team collaboration features (commenting, reviewer role, etc.)
|
|
236
|
+
* Can be a simple boolean or detailed configuration object.
|
|
237
|
+
* Only works with editorMode 'email' or 'web'.
|
|
238
|
+
* @default false
|
|
239
|
+
*/
|
|
240
|
+
collaboration: {
|
|
241
|
+
type: PropType<boolean | CollaborationFeaturesConfig>;
|
|
242
|
+
default: undefined;
|
|
243
|
+
};
|
|
244
|
+
/** User information for session identity and collaboration */
|
|
245
|
+
user: {
|
|
246
|
+
type: PropType<UserInfo>;
|
|
247
|
+
default: undefined;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Design mode for template permissions.
|
|
251
|
+
* - 'edit': Admin mode - shows "Row Actions" for setting row permissions
|
|
252
|
+
* - 'live': End-user mode - enforces row permissions
|
|
253
|
+
* @default 'live'
|
|
254
|
+
*/
|
|
255
|
+
designMode: {
|
|
256
|
+
type: PropType<"edit" | "live">;
|
|
257
|
+
default: undefined;
|
|
258
|
+
};
|
|
259
|
+
}>, {
|
|
260
|
+
containerId: string;
|
|
261
|
+
isReady: vue.Ref<boolean, boolean>;
|
|
262
|
+
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("ready" | "load" | "change" | "error" | "comment")[], "ready" | "load" | "change" | "error" | "comment", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
263
|
+
/** Editor key for authentication (required) */
|
|
264
|
+
editorKey: {
|
|
265
|
+
type: StringConstructor;
|
|
266
|
+
required: true;
|
|
267
|
+
};
|
|
268
|
+
/** Initial design to load */
|
|
269
|
+
design: {
|
|
270
|
+
type: PropType<DesignJson | ModuleData | null>;
|
|
271
|
+
default: undefined;
|
|
272
|
+
};
|
|
273
|
+
/** Editor mode (email, web, popup) */
|
|
274
|
+
editorMode: {
|
|
275
|
+
type: PropType<EditorMode>;
|
|
276
|
+
default: string;
|
|
277
|
+
};
|
|
278
|
+
/** Popup builder configuration (only used when editorMode is 'popup') */
|
|
279
|
+
popup: {
|
|
280
|
+
type: PropType<PopupConfig>;
|
|
281
|
+
default: undefined;
|
|
282
|
+
};
|
|
283
|
+
/** Content type: 'module' for single-row module editor */
|
|
284
|
+
contentType: {
|
|
285
|
+
type: PropType<"module">;
|
|
286
|
+
default: undefined;
|
|
287
|
+
};
|
|
288
|
+
/** AI features configuration */
|
|
289
|
+
ai: {
|
|
290
|
+
type: PropType<AIConfig>;
|
|
291
|
+
default: undefined;
|
|
292
|
+
};
|
|
293
|
+
/** UI language/locale */
|
|
294
|
+
locale: {
|
|
295
|
+
type: StringConstructor;
|
|
296
|
+
default: undefined;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Custom translation overrides keyed by locale code.
|
|
300
|
+
* Each locale maps translation keys to translated strings,
|
|
301
|
+
* allowing partial or full override of the editor's built-in UI strings.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* translations: {
|
|
306
|
+
* 'en-US': { 'toolbar.save': 'Save Draft' },
|
|
307
|
+
* 'fr-FR': { 'toolbar.save': 'Enregistrer le brouillon' },
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
translations: {
|
|
312
|
+
type: PropType<Record<string, Record<string, string>>>;
|
|
313
|
+
default: undefined;
|
|
314
|
+
};
|
|
315
|
+
/** Text direction (ltr, rtl) */
|
|
316
|
+
textDirection: {
|
|
317
|
+
type: PropType<TextDirection>;
|
|
318
|
+
default: undefined;
|
|
319
|
+
};
|
|
320
|
+
/** Visual customization */
|
|
321
|
+
appearance: {
|
|
322
|
+
type: PropType<AppearanceConfig>;
|
|
323
|
+
default: undefined;
|
|
324
|
+
};
|
|
325
|
+
/** Enable/disable tools */
|
|
326
|
+
tools: {
|
|
327
|
+
type: PropType<ToolsConfig>;
|
|
328
|
+
default: undefined;
|
|
329
|
+
};
|
|
330
|
+
/** Feature toggles */
|
|
331
|
+
features: {
|
|
332
|
+
type: PropType<FeaturesConfig>;
|
|
333
|
+
default: undefined;
|
|
334
|
+
};
|
|
335
|
+
/** Merge tags for personalization */
|
|
336
|
+
mergeTags: {
|
|
337
|
+
type: PropType<(MergeTag | MergeTagGroup)[]>;
|
|
338
|
+
default: undefined;
|
|
339
|
+
};
|
|
340
|
+
/** Special link categories */
|
|
341
|
+
specialLinks: {
|
|
342
|
+
type: PropType<(SpecialLink | SpecialLinkGroup)[]>;
|
|
343
|
+
default: undefined;
|
|
344
|
+
};
|
|
345
|
+
/** Custom modules */
|
|
346
|
+
modules: {
|
|
347
|
+
type: PropType<Module[]>;
|
|
348
|
+
default: undefined;
|
|
349
|
+
};
|
|
350
|
+
/** Display conditions configuration */
|
|
351
|
+
displayConditions: {
|
|
352
|
+
type: PropType<DisplayConditionsConfig>;
|
|
353
|
+
default: undefined;
|
|
354
|
+
};
|
|
355
|
+
/** Template language for multi-language support */
|
|
356
|
+
language: {
|
|
357
|
+
type: PropType<Language>;
|
|
358
|
+
default: undefined;
|
|
359
|
+
};
|
|
360
|
+
/** Fonts configuration */
|
|
361
|
+
fonts: {
|
|
362
|
+
type: PropType<FontsConfig>;
|
|
363
|
+
default: undefined;
|
|
364
|
+
};
|
|
365
|
+
/** Custom tools to register (Dragble-style) */
|
|
366
|
+
customTools: {
|
|
367
|
+
type: PropType<DragbleToolConfig[]>;
|
|
368
|
+
default: undefined;
|
|
369
|
+
};
|
|
370
|
+
/** Default body/canvas values applied on init */
|
|
371
|
+
bodyValues: {
|
|
372
|
+
type: PropType<Record<string, unknown>>;
|
|
373
|
+
default: undefined;
|
|
374
|
+
};
|
|
375
|
+
/** Header row JSON to inject as a locked, non-editable row at the top */
|
|
376
|
+
header: {
|
|
377
|
+
type: PropType<unknown>;
|
|
378
|
+
default: undefined;
|
|
379
|
+
};
|
|
380
|
+
/** Footer row JSON to inject as a locked, non-editable row at the bottom */
|
|
381
|
+
footer: {
|
|
382
|
+
type: PropType<unknown>;
|
|
383
|
+
default: undefined;
|
|
384
|
+
};
|
|
385
|
+
/** Editor behavior configuration */
|
|
386
|
+
editor: {
|
|
387
|
+
type: PropType<EditorBehaviorConfig>;
|
|
388
|
+
default: undefined;
|
|
389
|
+
};
|
|
390
|
+
/** Custom CSS URLs or inline styles */
|
|
391
|
+
customCSS: {
|
|
392
|
+
type: PropType<string[]>;
|
|
393
|
+
default: undefined;
|
|
394
|
+
};
|
|
395
|
+
/** Custom JS URLs or inline scripts */
|
|
396
|
+
customJS: {
|
|
397
|
+
type: PropType<string[]>;
|
|
398
|
+
default: undefined;
|
|
399
|
+
};
|
|
400
|
+
/** Height of the editor */
|
|
401
|
+
height: {
|
|
402
|
+
type: PropType<string | number>;
|
|
403
|
+
default: string;
|
|
404
|
+
};
|
|
405
|
+
/** Minimum height for the editor */
|
|
406
|
+
minHeight: {
|
|
407
|
+
type: PropType<string | number>;
|
|
408
|
+
default: string;
|
|
409
|
+
};
|
|
410
|
+
/** Additional editor options (appearance, tools, features, AI, etc.) */
|
|
411
|
+
options: {
|
|
412
|
+
type: PropType<EditorOptions>;
|
|
413
|
+
default: undefined;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* SDK callbacks (onModuleSave, onContentDialog, onPreview, onHeaderRowClick, etc.)
|
|
417
|
+
* Note: onReady/onLoad/onChange/onError are handled via Vue emits, not this prop.
|
|
418
|
+
*/
|
|
419
|
+
callbacks: {
|
|
420
|
+
type: PropType<Omit<DragbleCallbacks, "onReady" | "onLoad" | "onChange" | "onError">>;
|
|
421
|
+
default: undefined;
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Custom SDK URL for loading the Dragble SDK script.
|
|
425
|
+
* Use this for enterprise self-hosted SDK or specific versions.
|
|
426
|
+
* @default "https://sdk.dragble.com/latest/dragble-sdk.min.js"
|
|
427
|
+
*/
|
|
428
|
+
sdkUrl: {
|
|
429
|
+
type: StringConstructor;
|
|
430
|
+
default: undefined;
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* SDK version to load from the Dragble CDN.
|
|
434
|
+
* @default "latest"
|
|
435
|
+
*/
|
|
436
|
+
sdkVersion: {
|
|
437
|
+
type: StringConstructor;
|
|
438
|
+
default: undefined;
|
|
439
|
+
};
|
|
440
|
+
/** Editor version forwarded to the SDK init config. */
|
|
441
|
+
editorVersion: {
|
|
442
|
+
type: StringConstructor;
|
|
443
|
+
default: undefined;
|
|
444
|
+
};
|
|
445
|
+
/** Editor URL forwarded to the SDK init config. */
|
|
446
|
+
editorUrl: {
|
|
447
|
+
type: StringConstructor;
|
|
448
|
+
default: undefined;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Team collaboration features (commenting, reviewer role, etc.)
|
|
452
|
+
* Can be a simple boolean or detailed configuration object.
|
|
453
|
+
* Only works with editorMode 'email' or 'web'.
|
|
454
|
+
* @default false
|
|
455
|
+
*/
|
|
456
|
+
collaboration: {
|
|
457
|
+
type: PropType<boolean | CollaborationFeaturesConfig>;
|
|
458
|
+
default: undefined;
|
|
459
|
+
};
|
|
460
|
+
/** User information for session identity and collaboration */
|
|
461
|
+
user: {
|
|
462
|
+
type: PropType<UserInfo>;
|
|
463
|
+
default: undefined;
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* Design mode for template permissions.
|
|
467
|
+
* - 'edit': Admin mode - shows "Row Actions" for setting row permissions
|
|
468
|
+
* - 'live': End-user mode - enforces row permissions
|
|
469
|
+
* @default 'live'
|
|
470
|
+
*/
|
|
471
|
+
designMode: {
|
|
472
|
+
type: PropType<"edit" | "live">;
|
|
473
|
+
default: undefined;
|
|
474
|
+
};
|
|
475
|
+
}>> & Readonly<{
|
|
476
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
477
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
478
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
479
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
480
|
+
onComment?: ((...args: any[]) => any) | undefined;
|
|
481
|
+
}>, {
|
|
482
|
+
popup: PopupConfig;
|
|
483
|
+
design: DesignJson | ModuleData | null;
|
|
484
|
+
editorMode: EditorMode;
|
|
485
|
+
contentType: "module";
|
|
486
|
+
ai: AIConfig;
|
|
487
|
+
locale: string;
|
|
488
|
+
translations: Record<string, Record<string, string>>;
|
|
489
|
+
textDirection: TextDirection;
|
|
490
|
+
appearance: AppearanceConfig;
|
|
491
|
+
tools: ToolsConfig;
|
|
492
|
+
features: FeaturesConfig;
|
|
493
|
+
mergeTags: (MergeTag | MergeTagGroup)[];
|
|
494
|
+
specialLinks: (SpecialLink | SpecialLinkGroup)[];
|
|
495
|
+
modules: Module[];
|
|
496
|
+
displayConditions: DisplayConditionsConfig;
|
|
497
|
+
language: Language;
|
|
498
|
+
fonts: FontsConfig;
|
|
499
|
+
customTools: dragble_types.PexelizeToolConfig[];
|
|
500
|
+
bodyValues: Record<string, unknown>;
|
|
501
|
+
header: undefined;
|
|
502
|
+
footer: undefined;
|
|
503
|
+
editor: EditorBehaviorConfig;
|
|
504
|
+
customCSS: string[];
|
|
505
|
+
customJS: string[];
|
|
506
|
+
height: string | number;
|
|
507
|
+
minHeight: string | number;
|
|
508
|
+
options: EditorOptions;
|
|
509
|
+
callbacks: Omit<dragble_types.PexelizeCallbacks, "onReady" | "onLoad" | "onChange" | "onError">;
|
|
510
|
+
sdkUrl: string;
|
|
511
|
+
sdkVersion: string;
|
|
512
|
+
editorVersion: string;
|
|
513
|
+
editorUrl: string;
|
|
514
|
+
collaboration: boolean | CollaborationFeaturesConfig;
|
|
515
|
+
user: UserInfo;
|
|
516
|
+
designMode: "edit" | "live";
|
|
517
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
518
|
+
/**
|
|
519
|
+
* Composable to use the Dragble SDK directly
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* ```vue
|
|
523
|
+
* <script setup lang="ts">
|
|
524
|
+
* import { useDragbleEditor } from 'dragble-vue-editor';
|
|
525
|
+
*
|
|
526
|
+
* const { editor, isReady, containerId } = useDragbleEditor({
|
|
527
|
+
* editorKey: 'your-editor-key',
|
|
528
|
+
* editorMode: 'email',
|
|
529
|
+
* });
|
|
530
|
+
*
|
|
531
|
+
* const handleExport = async () => {
|
|
532
|
+
* if (isReady.value && editor.value) {
|
|
533
|
+
* const html = await editor.value.exportHtml();
|
|
534
|
+
* console.log(html);
|
|
535
|
+
* }
|
|
536
|
+
* };
|
|
537
|
+
* </script>
|
|
538
|
+
*
|
|
539
|
+
* <template>
|
|
540
|
+
* <div :id="containerId" style="height: 600px" />
|
|
541
|
+
* <button @click="handleExport" :disabled="!isReady">Export</button>
|
|
542
|
+
* </template>
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
declare function useDragbleEditor(config: Omit<DragbleConfig, "containerId">, sdkUrl?: string, sdkVersion?: string): {
|
|
546
|
+
editor: vue.Ref<{
|
|
547
|
+
init: (config: dragble_types.PexelizeConfig) => void;
|
|
548
|
+
destroy: () => void;
|
|
549
|
+
isReady: () => boolean;
|
|
550
|
+
loadDesign: (design: DesignJson, options?: {
|
|
551
|
+
preserveHistory?: boolean;
|
|
552
|
+
}) => void;
|
|
553
|
+
loadDesignAsync: (design: DesignJson, options?: {
|
|
554
|
+
preserveHistory?: boolean;
|
|
555
|
+
}) => Promise<void>;
|
|
556
|
+
loadBlank: (options?: dragble_types.BlankDesignOptions) => void;
|
|
557
|
+
saveDesign: (callback: (design: DesignJson) => void) => void;
|
|
558
|
+
getDesign: () => Promise<{
|
|
559
|
+
html: string;
|
|
560
|
+
json: DesignJson;
|
|
561
|
+
}>;
|
|
562
|
+
exportHtml: (options?: ExportHtmlOptions) => Promise<string>;
|
|
563
|
+
exportJson: () => Promise<DesignJson>;
|
|
564
|
+
exportPlainText: () => Promise<string>;
|
|
565
|
+
exportImage: (options?: ExportImageOptions) => Promise<ExportImageData>;
|
|
566
|
+
exportPdf: (options?: ExportPdfOptions) => Promise<ExportPdfData>;
|
|
567
|
+
exportZip: (options?: ExportZipOptions) => Promise<ExportZipData>;
|
|
568
|
+
getPopupValues: () => Promise<dragble_types.PopupValues | null>;
|
|
569
|
+
setMergeTags: (config: MergeTagsConfig) => void;
|
|
570
|
+
getMergeTags: () => Promise<(MergeTag | MergeTagGroup)[]>;
|
|
571
|
+
setSpecialLinks: (config: SpecialLinksConfig) => void;
|
|
572
|
+
getSpecialLinks: () => Promise<(SpecialLink | SpecialLinkGroup)[]>;
|
|
573
|
+
setFonts: (config: FontsConfig) => void;
|
|
574
|
+
getFonts: () => Promise<FontsConfig>;
|
|
575
|
+
setBodyValues: (values: Record<string, unknown>) => void;
|
|
576
|
+
getBodyValues: () => Promise<Record<string, unknown>>;
|
|
577
|
+
setOptions: (options: Partial<EditorOptions>) => void;
|
|
578
|
+
setAppearance: (config: AppearanceConfig) => void;
|
|
579
|
+
setToolsConfig: (toolsConfig: ToolsConfig) => void;
|
|
580
|
+
setEditorMode: (mode: EditorMode) => void;
|
|
581
|
+
setEditorConfig: (config: EditorBehaviorConfig) => void;
|
|
582
|
+
getEditorConfig: () => Promise<EditorBehaviorConfig>;
|
|
583
|
+
setLocale: (locale: dragble_types.LocaleCode, translations?: Record<string, string>) => void;
|
|
584
|
+
setTextDirection: (direction: TextDirection) => void;
|
|
585
|
+
getTextDirection: () => Promise<TextDirection>;
|
|
586
|
+
setCustomCSS: (css: string[]) => void;
|
|
587
|
+
setCustomJS: (js: string[]) => void;
|
|
588
|
+
setLanguage: (language: Language) => void;
|
|
589
|
+
getLanguage: () => Promise<Language | null>;
|
|
590
|
+
setBrandingColors: (config: {
|
|
591
|
+
colors?: string[] | Array<{
|
|
592
|
+
id: string;
|
|
593
|
+
label?: string;
|
|
594
|
+
colors: string[];
|
|
595
|
+
default?: boolean;
|
|
596
|
+
}>;
|
|
597
|
+
defaultColors?: boolean;
|
|
598
|
+
}) => void;
|
|
599
|
+
setModules: (modules: Module[]) => void;
|
|
600
|
+
setModulesLoading: (loading: boolean) => void;
|
|
601
|
+
getModules: () => Promise<Module[]>;
|
|
602
|
+
updateTabs: (tabs: Record<string, {
|
|
603
|
+
visible?: boolean;
|
|
604
|
+
}>) => void;
|
|
605
|
+
setDisplayConditions: (config: DisplayConditionsConfig) => void;
|
|
606
|
+
undo: () => void;
|
|
607
|
+
redo: () => void;
|
|
608
|
+
canUndo: () => Promise<boolean>;
|
|
609
|
+
canRedo: () => Promise<boolean>;
|
|
610
|
+
showPreview: (device?: ViewMode) => void;
|
|
611
|
+
hidePreview: () => void;
|
|
612
|
+
save: () => void;
|
|
613
|
+
registerTool: (config: dragble_types.PexelizeToolConfig | unknown) => Promise<void>;
|
|
614
|
+
unregisterTool: (toolId: string) => Promise<void>;
|
|
615
|
+
getTools: () => Promise<Array<{
|
|
616
|
+
id: string;
|
|
617
|
+
label: string;
|
|
618
|
+
baseToolType: string;
|
|
619
|
+
}>>;
|
|
620
|
+
createWidget: (config: dragble_types.PexelizeWidgetConfig | unknown) => Promise<void>;
|
|
621
|
+
removeWidget: (widgetName: string) => Promise<void>;
|
|
622
|
+
registerColumns: (cells: number[]) => void;
|
|
623
|
+
showComment: (commentId: string) => void;
|
|
624
|
+
openCommentPanel: (rowId: string) => void;
|
|
625
|
+
audit: {
|
|
626
|
+
(callback: AuditCallback): void;
|
|
627
|
+
(options: AuditOptions, callback: AuditCallback): void;
|
|
628
|
+
(options?: AuditOptions): Promise<dragble_types.AuditResult>;
|
|
629
|
+
};
|
|
630
|
+
uploadImage: (file: File, options?: {
|
|
631
|
+
folderId?: string;
|
|
632
|
+
altText?: string;
|
|
633
|
+
onProgress?: (progress: {
|
|
634
|
+
percent: number;
|
|
635
|
+
loaded: number;
|
|
636
|
+
total: number;
|
|
637
|
+
state: string;
|
|
638
|
+
error?: string;
|
|
639
|
+
}) => void;
|
|
640
|
+
}) => Promise<{
|
|
641
|
+
success: boolean;
|
|
642
|
+
url?: string;
|
|
643
|
+
error?: string;
|
|
644
|
+
}>;
|
|
645
|
+
listAssets: (options?: Record<string, unknown>) => Promise<{
|
|
646
|
+
assets: Array<Record<string, unknown>>;
|
|
647
|
+
total: number;
|
|
648
|
+
}>;
|
|
649
|
+
deleteAsset: (assetId: string) => Promise<{
|
|
650
|
+
success: boolean;
|
|
651
|
+
error?: string;
|
|
652
|
+
}>;
|
|
653
|
+
listAssetFolders: (parentId?: string) => Promise<Array<Record<string, unknown>>>;
|
|
654
|
+
createAssetFolder: (name: string, parentId?: string) => Promise<Record<string, unknown>>;
|
|
655
|
+
getStorageInfo: () => Promise<Record<string, unknown>>;
|
|
656
|
+
addEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => () => void;
|
|
657
|
+
removeEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => void;
|
|
658
|
+
} | null, DragbleSDK | {
|
|
659
|
+
init: (config: dragble_types.PexelizeConfig) => void;
|
|
660
|
+
destroy: () => void;
|
|
661
|
+
isReady: () => boolean;
|
|
662
|
+
loadDesign: (design: DesignJson, options?: {
|
|
663
|
+
preserveHistory?: boolean;
|
|
664
|
+
}) => void;
|
|
665
|
+
loadDesignAsync: (design: DesignJson, options?: {
|
|
666
|
+
preserveHistory?: boolean;
|
|
667
|
+
}) => Promise<void>;
|
|
668
|
+
loadBlank: (options?: dragble_types.BlankDesignOptions) => void;
|
|
669
|
+
saveDesign: (callback: (design: DesignJson) => void) => void;
|
|
670
|
+
getDesign: () => Promise<{
|
|
671
|
+
html: string;
|
|
672
|
+
json: DesignJson;
|
|
673
|
+
}>;
|
|
674
|
+
exportHtml: (options?: ExportHtmlOptions) => Promise<string>;
|
|
675
|
+
exportJson: () => Promise<DesignJson>;
|
|
676
|
+
exportPlainText: () => Promise<string>;
|
|
677
|
+
exportImage: (options?: ExportImageOptions) => Promise<ExportImageData>;
|
|
678
|
+
exportPdf: (options?: ExportPdfOptions) => Promise<ExportPdfData>;
|
|
679
|
+
exportZip: (options?: ExportZipOptions) => Promise<ExportZipData>;
|
|
680
|
+
getPopupValues: () => Promise<dragble_types.PopupValues | null>;
|
|
681
|
+
setMergeTags: (config: MergeTagsConfig) => void;
|
|
682
|
+
getMergeTags: () => Promise<(MergeTag | MergeTagGroup)[]>;
|
|
683
|
+
setSpecialLinks: (config: SpecialLinksConfig) => void;
|
|
684
|
+
getSpecialLinks: () => Promise<(SpecialLink | SpecialLinkGroup)[]>;
|
|
685
|
+
setFonts: (config: FontsConfig) => void;
|
|
686
|
+
getFonts: () => Promise<FontsConfig>;
|
|
687
|
+
setBodyValues: (values: Record<string, unknown>) => void;
|
|
688
|
+
getBodyValues: () => Promise<Record<string, unknown>>;
|
|
689
|
+
setOptions: (options: Partial<EditorOptions>) => void;
|
|
690
|
+
setAppearance: (config: AppearanceConfig) => void;
|
|
691
|
+
setToolsConfig: (toolsConfig: ToolsConfig) => void;
|
|
692
|
+
setEditorMode: (mode: EditorMode) => void;
|
|
693
|
+
setEditorConfig: (config: EditorBehaviorConfig) => void;
|
|
694
|
+
getEditorConfig: () => Promise<EditorBehaviorConfig>;
|
|
695
|
+
setLocale: (locale: dragble_types.LocaleCode, translations?: Record<string, string>) => void;
|
|
696
|
+
setTextDirection: (direction: TextDirection) => void;
|
|
697
|
+
getTextDirection: () => Promise<TextDirection>;
|
|
698
|
+
setCustomCSS: (css: string[]) => void;
|
|
699
|
+
setCustomJS: (js: string[]) => void;
|
|
700
|
+
setLanguage: (language: Language) => void;
|
|
701
|
+
getLanguage: () => Promise<Language | null>;
|
|
702
|
+
setBrandingColors: (config: {
|
|
703
|
+
colors?: string[] | Array<{
|
|
704
|
+
id: string;
|
|
705
|
+
label?: string;
|
|
706
|
+
colors: string[];
|
|
707
|
+
default?: boolean;
|
|
708
|
+
}>;
|
|
709
|
+
defaultColors?: boolean;
|
|
710
|
+
}) => void;
|
|
711
|
+
setModules: (modules: Module[]) => void;
|
|
712
|
+
setModulesLoading: (loading: boolean) => void;
|
|
713
|
+
getModules: () => Promise<Module[]>;
|
|
714
|
+
updateTabs: (tabs: Record<string, {
|
|
715
|
+
visible?: boolean;
|
|
716
|
+
}>) => void;
|
|
717
|
+
setDisplayConditions: (config: DisplayConditionsConfig) => void;
|
|
718
|
+
undo: () => void;
|
|
719
|
+
redo: () => void;
|
|
720
|
+
canUndo: () => Promise<boolean>;
|
|
721
|
+
canRedo: () => Promise<boolean>;
|
|
722
|
+
showPreview: (device?: ViewMode) => void;
|
|
723
|
+
hidePreview: () => void;
|
|
724
|
+
save: () => void;
|
|
725
|
+
registerTool: (config: dragble_types.PexelizeToolConfig | unknown) => Promise<void>;
|
|
726
|
+
unregisterTool: (toolId: string) => Promise<void>;
|
|
727
|
+
getTools: () => Promise<Array<{
|
|
728
|
+
id: string;
|
|
729
|
+
label: string;
|
|
730
|
+
baseToolType: string;
|
|
731
|
+
}>>;
|
|
732
|
+
createWidget: (config: dragble_types.PexelizeWidgetConfig | unknown) => Promise<void>;
|
|
733
|
+
removeWidget: (widgetName: string) => Promise<void>;
|
|
734
|
+
registerColumns: (cells: number[]) => void;
|
|
735
|
+
showComment: (commentId: string) => void;
|
|
736
|
+
openCommentPanel: (rowId: string) => void;
|
|
737
|
+
audit: {
|
|
738
|
+
(callback: AuditCallback): void;
|
|
739
|
+
(options: AuditOptions, callback: AuditCallback): void;
|
|
740
|
+
(options?: AuditOptions): Promise<dragble_types.AuditResult>;
|
|
741
|
+
};
|
|
742
|
+
uploadImage: (file: File, options?: {
|
|
743
|
+
folderId?: string;
|
|
744
|
+
altText?: string;
|
|
745
|
+
onProgress?: (progress: {
|
|
746
|
+
percent: number;
|
|
747
|
+
loaded: number;
|
|
748
|
+
total: number;
|
|
749
|
+
state: string;
|
|
750
|
+
error?: string;
|
|
751
|
+
}) => void;
|
|
752
|
+
}) => Promise<{
|
|
753
|
+
success: boolean;
|
|
754
|
+
url?: string;
|
|
755
|
+
error?: string;
|
|
756
|
+
}>;
|
|
757
|
+
listAssets: (options?: Record<string, unknown>) => Promise<{
|
|
758
|
+
assets: Array<Record<string, unknown>>;
|
|
759
|
+
total: number;
|
|
760
|
+
}>;
|
|
761
|
+
deleteAsset: (assetId: string) => Promise<{
|
|
762
|
+
success: boolean;
|
|
763
|
+
error?: string;
|
|
764
|
+
}>;
|
|
765
|
+
listAssetFolders: (parentId?: string) => Promise<Array<Record<string, unknown>>>;
|
|
766
|
+
createAssetFolder: (name: string, parentId?: string) => Promise<Record<string, unknown>>;
|
|
767
|
+
getStorageInfo: () => Promise<Record<string, unknown>>;
|
|
768
|
+
addEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => () => void;
|
|
769
|
+
removeEventListener: <T = unknown>(event: EditorEventName, callback: (data: T) => void) => void;
|
|
770
|
+
} | null>;
|
|
771
|
+
isReady: vue.Ref<boolean, boolean>;
|
|
772
|
+
containerId: string;
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
export { DragbleEditor, DragbleEditor as default, useDragbleEditor };
|
|
776
|
+
export type { EditorContentTypeValue };
|