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/dist/index.js
ADDED
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Output, Input, Component, EventEmitter, NgModule } from '@angular/core';
|
|
3
|
+
export * from 'dragble-types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Dragble Editor Angular Component
|
|
7
|
+
*
|
|
8
|
+
* An Angular wrapper for the Dragble Editor SDK.
|
|
9
|
+
*/
|
|
10
|
+
const SDK_CDN_URL = "https://sdk.dragble.com/latest/dragble-sdk.min.js";
|
|
11
|
+
// Map of URL -> Promise for caching SDK loads per URL
|
|
12
|
+
const sdkLoadPromises = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* Get the SDK URL to use.
|
|
15
|
+
* @param customUrl - Optional custom SDK URL
|
|
16
|
+
* @returns The SDK URL to load
|
|
17
|
+
*/
|
|
18
|
+
function getSDKUrl(customUrl, sdkVersion) {
|
|
19
|
+
if (customUrl && sdkVersion !== undefined) {
|
|
20
|
+
console.warn("[DragbleEditor] sdkVersion is ignored when sdkUrl is provided.");
|
|
21
|
+
}
|
|
22
|
+
return customUrl ?? `https://sdk.dragble.com/${sdkVersion ?? "latest"}/dragble-sdk.min.js`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create an SDK module from the global dragble object.
|
|
26
|
+
*/
|
|
27
|
+
function createSDKModuleFromGlobal() {
|
|
28
|
+
return {
|
|
29
|
+
dragble: window.dragble,
|
|
30
|
+
createEditor: (config) => {
|
|
31
|
+
const instance = new window.dragble.constructor();
|
|
32
|
+
instance.init(config);
|
|
33
|
+
return instance;
|
|
34
|
+
},
|
|
35
|
+
DragbleSDK: window.dragble.constructor,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Load the SDK from a URL.
|
|
40
|
+
* Supports custom SDK URLs for enterprise self-hosted or specific versions.
|
|
41
|
+
* @param customUrl - Optional custom SDK URL
|
|
42
|
+
*/
|
|
43
|
+
function loadSDK(customUrl) {
|
|
44
|
+
const sdkUrl = getSDKUrl(customUrl);
|
|
45
|
+
// Check cache for this specific URL
|
|
46
|
+
const cachedPromise = sdkLoadPromises.get(sdkUrl);
|
|
47
|
+
if (cachedPromise)
|
|
48
|
+
return cachedPromise;
|
|
49
|
+
// Check if already loaded globally (only for default URL to avoid conflicts)
|
|
50
|
+
if (sdkUrl === SDK_CDN_URL && typeof window !== "undefined" && window.dragble) {
|
|
51
|
+
return Promise.resolve(createSDKModuleFromGlobal());
|
|
52
|
+
}
|
|
53
|
+
return loadSDKScript(sdkUrl);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Load the SDK script from a specific URL.
|
|
57
|
+
* Each unique URL is cached separately to support multiple SDK sources.
|
|
58
|
+
* @param sdkUrl - The SDK URL to load
|
|
59
|
+
*/
|
|
60
|
+
function loadSDKScript(sdkUrl) {
|
|
61
|
+
// Check cache for this specific URL
|
|
62
|
+
const cachedPromise = sdkLoadPromises.get(sdkUrl);
|
|
63
|
+
if (cachedPromise)
|
|
64
|
+
return cachedPromise;
|
|
65
|
+
const loadPromise = new Promise((resolve, reject) => {
|
|
66
|
+
const script = document.createElement("script");
|
|
67
|
+
script.src = sdkUrl;
|
|
68
|
+
script.async = true;
|
|
69
|
+
script.onload = () => {
|
|
70
|
+
if (window.dragble) {
|
|
71
|
+
// Resolve with SDK module interface
|
|
72
|
+
resolve(createSDKModuleFromGlobal());
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
sdkLoadPromises.delete(sdkUrl);
|
|
76
|
+
reject(new Error("Failed to load Dragble SDK - createEditor not found"));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
script.onerror = () => {
|
|
80
|
+
sdkLoadPromises.delete(sdkUrl);
|
|
81
|
+
reject(new Error(`Failed to load Dragble SDK from ${sdkUrl}`));
|
|
82
|
+
};
|
|
83
|
+
document.head.appendChild(script);
|
|
84
|
+
});
|
|
85
|
+
// Cache the promise for this URL
|
|
86
|
+
sdkLoadPromises.set(sdkUrl, loadPromise);
|
|
87
|
+
return loadPromise;
|
|
88
|
+
}
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// Component
|
|
91
|
+
// ============================================================================
|
|
92
|
+
/**
|
|
93
|
+
* DragbleEditorComponent
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```html
|
|
97
|
+
* <dragble-editor
|
|
98
|
+
* editorKey="your-editor-key"
|
|
99
|
+
* editorMode="email"
|
|
100
|
+
* (ready)="onReady($event)"
|
|
101
|
+
* (change)="onChange($event)"
|
|
102
|
+
* ></dragble-editor>
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* import { Component, ViewChild } from '@angular/core';
|
|
108
|
+
* import { DragbleEditorComponent } from '@dragble/angular-editor';
|
|
109
|
+
*
|
|
110
|
+
* @Component({
|
|
111
|
+
* selector: 'app-editor',
|
|
112
|
+
* template: `
|
|
113
|
+
* <dragble-editor
|
|
114
|
+
* #editor
|
|
115
|
+
* editorKey="your-editor-key"
|
|
116
|
+
* (ready)="onReady($event)"
|
|
117
|
+
* ></dragble-editor>
|
|
118
|
+
* <button (click)="handleSave()">Save</button>
|
|
119
|
+
* `
|
|
120
|
+
* })
|
|
121
|
+
* export class EditorComponent {
|
|
122
|
+
* @ViewChild('editor') editor!: DragbleEditorComponent;
|
|
123
|
+
*
|
|
124
|
+
* onReady(sdk: DragbleSDK) {
|
|
125
|
+
* console.log('Editor ready!', sdk);
|
|
126
|
+
* }
|
|
127
|
+
*
|
|
128
|
+
* handleSave() {
|
|
129
|
+
* this.editor.saveDesign((design) => {
|
|
130
|
+
* console.log('Design:', design);
|
|
131
|
+
* });
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
class DragbleEditorComponent {
|
|
137
|
+
constructor() {
|
|
138
|
+
/** Editor mode (email, web, popup) */
|
|
139
|
+
this.editorMode = "email";
|
|
140
|
+
/** Height of the editor */
|
|
141
|
+
this.height = "600px";
|
|
142
|
+
/** Minimum height for the editor */
|
|
143
|
+
this.minHeight = "600px";
|
|
144
|
+
// ========================================================================
|
|
145
|
+
// Outputs
|
|
146
|
+
// ========================================================================
|
|
147
|
+
/** Emitted when the editor is ready */
|
|
148
|
+
this.ready = new EventEmitter();
|
|
149
|
+
/** Emitted when a design is loaded */
|
|
150
|
+
this.load = new EventEmitter();
|
|
151
|
+
/** Emitted when the design changes */
|
|
152
|
+
this.change = new EventEmitter();
|
|
153
|
+
/** Emitted when an error occurs */
|
|
154
|
+
this.error = new EventEmitter();
|
|
155
|
+
/** Emitted when a comment event occurs (create, edit, delete, resolve, reopen) */
|
|
156
|
+
this.commentAction = new EventEmitter();
|
|
157
|
+
// ========================================================================
|
|
158
|
+
// Internal State
|
|
159
|
+
// ========================================================================
|
|
160
|
+
this.containerId = `dragble-editor-${Math.random().toString(36).substr(2, 9)}`;
|
|
161
|
+
this.sdk = null;
|
|
162
|
+
this._isReady = false;
|
|
163
|
+
}
|
|
164
|
+
get isReady() {
|
|
165
|
+
return this._isReady;
|
|
166
|
+
}
|
|
167
|
+
get computedHeight() {
|
|
168
|
+
return typeof this.height === "number" ? `${this.height}px` : this.height;
|
|
169
|
+
}
|
|
170
|
+
get computedMinHeight() {
|
|
171
|
+
return typeof this.minHeight === "number"
|
|
172
|
+
? `${this.minHeight}px`
|
|
173
|
+
: this.minHeight;
|
|
174
|
+
}
|
|
175
|
+
// ========================================================================
|
|
176
|
+
// Lifecycle
|
|
177
|
+
// ========================================================================
|
|
178
|
+
ngOnInit() {
|
|
179
|
+
// Initialization happens in ngAfterViewInit
|
|
180
|
+
}
|
|
181
|
+
ngAfterViewInit() {
|
|
182
|
+
this.initializeEditor();
|
|
183
|
+
}
|
|
184
|
+
ngOnChanges(changes) {
|
|
185
|
+
if (!this.sdk || !this._isReady)
|
|
186
|
+
return;
|
|
187
|
+
// Watch for design changes
|
|
188
|
+
if (changes["design"] && !changes["design"].firstChange) {
|
|
189
|
+
const newDesign = changes["design"].currentValue;
|
|
190
|
+
if (newDesign) {
|
|
191
|
+
this.sdk.loadDesign(newDesign);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// Watch for merge tags changes
|
|
195
|
+
if (changes["mergeTags"] && !changes["mergeTags"].firstChange) {
|
|
196
|
+
const newTags = changes["mergeTags"].currentValue;
|
|
197
|
+
if (newTags) {
|
|
198
|
+
this.sdk.setMergeTags(newTags);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Watch for modules changes
|
|
202
|
+
if (changes["modules"] && !changes["modules"].firstChange) {
|
|
203
|
+
const newModules = changes["modules"].currentValue;
|
|
204
|
+
if (newModules) {
|
|
205
|
+
this.sdk.setModules(newModules);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Watch for display conditions changes
|
|
209
|
+
if (changes["displayConditions"] &&
|
|
210
|
+
!changes["displayConditions"].firstChange) {
|
|
211
|
+
const newConditions = changes["displayConditions"].currentValue;
|
|
212
|
+
if (newConditions) {
|
|
213
|
+
this.sdk.setDisplayConditions(newConditions);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
ngOnDestroy() {
|
|
218
|
+
if (this.sdk) {
|
|
219
|
+
this.sdk.destroy();
|
|
220
|
+
this.sdk = null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// ========================================================================
|
|
224
|
+
// Initialization
|
|
225
|
+
// ========================================================================
|
|
226
|
+
async initializeEditor() {
|
|
227
|
+
try {
|
|
228
|
+
const resolvedSdkUrl = getSDKUrl(this.sdkUrl, this.sdkVersion);
|
|
229
|
+
const { createEditor } = await loadSDK(resolvedSdkUrl);
|
|
230
|
+
const config = this.buildConfig();
|
|
231
|
+
const sdk = createEditor(config);
|
|
232
|
+
this.sdk = sdk;
|
|
233
|
+
// Set up event listeners
|
|
234
|
+
sdk.addEventListener("editor:ready", () => {
|
|
235
|
+
this._isReady = true;
|
|
236
|
+
this.ready.emit(sdk);
|
|
237
|
+
});
|
|
238
|
+
sdk.addEventListener("design:loaded", (data) => {
|
|
239
|
+
this.load.emit(data);
|
|
240
|
+
});
|
|
241
|
+
sdk.addEventListener("design:updated", (data) => {
|
|
242
|
+
this.change.emit(data);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
247
|
+
console.error("Initialization error:", error.message);
|
|
248
|
+
this.error.emit(error);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
buildConfig() {
|
|
252
|
+
const editorConfig = this.contentType === "module"
|
|
253
|
+
? {
|
|
254
|
+
...this.editor,
|
|
255
|
+
contentType: this.contentType,
|
|
256
|
+
minRows: 1,
|
|
257
|
+
maxRows: 1,
|
|
258
|
+
}
|
|
259
|
+
: this.editor;
|
|
260
|
+
// Build collaboration feature config
|
|
261
|
+
let featuresConfig = this.features;
|
|
262
|
+
if (this.collaboration !== undefined) {
|
|
263
|
+
const collaborationConfig = typeof this.collaboration === "object"
|
|
264
|
+
? {
|
|
265
|
+
...this.collaboration,
|
|
266
|
+
onComment: (action) => {
|
|
267
|
+
this.commentAction.emit(action);
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
: this.collaboration;
|
|
271
|
+
featuresConfig = {
|
|
272
|
+
...featuresConfig,
|
|
273
|
+
collaboration: collaborationConfig,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
// Build callbacks (merge Angular outputs with user-provided callbacks)
|
|
277
|
+
const callbacks = {
|
|
278
|
+
...this.callbacks,
|
|
279
|
+
};
|
|
280
|
+
// Build nested options object
|
|
281
|
+
const editorOptions = {
|
|
282
|
+
...(this.user !== undefined && { user: this.user }),
|
|
283
|
+
...(this.locale !== undefined && { locale: this.locale }),
|
|
284
|
+
...(this.translations !== undefined && {
|
|
285
|
+
translations: this.translations,
|
|
286
|
+
}),
|
|
287
|
+
...(this.textDirection !== undefined && {
|
|
288
|
+
textDirection: this.textDirection,
|
|
289
|
+
}),
|
|
290
|
+
...(this.language !== undefined && { language: this.language }),
|
|
291
|
+
height: this.height,
|
|
292
|
+
minHeight: this.minHeight,
|
|
293
|
+
...(this.mergeTags !== undefined && { mergeTags: this.mergeTags }),
|
|
294
|
+
...(this.specialLinks !== undefined && {
|
|
295
|
+
specialLinks: this.specialLinks,
|
|
296
|
+
}),
|
|
297
|
+
...(this.modules !== undefined && { modules: this.modules }),
|
|
298
|
+
...(this.displayConditions !== undefined && {
|
|
299
|
+
displayConditions: this.displayConditions,
|
|
300
|
+
}),
|
|
301
|
+
...(this.appearance !== undefined && { appearance: this.appearance }),
|
|
302
|
+
...(this.tools !== undefined && { tools: this.tools }),
|
|
303
|
+
...(this.customTools !== undefined && { customTools: this.customTools }),
|
|
304
|
+
...(this.fonts !== undefined && { fonts: this.fonts }),
|
|
305
|
+
...(this.bodyValues !== undefined && { bodyValues: this.bodyValues }),
|
|
306
|
+
...(this.header !== undefined && { header: this.header }),
|
|
307
|
+
...(this.footer !== undefined && { footer: this.footer }),
|
|
308
|
+
...(editorConfig !== undefined && { editor: editorConfig }),
|
|
309
|
+
...(this.customCSS !== undefined && { customCSS: this.customCSS }),
|
|
310
|
+
...(this.customJS !== undefined && { customJS: this.customJS }),
|
|
311
|
+
...(featuresConfig !== undefined && { features: featuresConfig }),
|
|
312
|
+
...(this.ai !== undefined && { ai: this.ai }),
|
|
313
|
+
...this.options,
|
|
314
|
+
};
|
|
315
|
+
return {
|
|
316
|
+
containerId: this.containerId,
|
|
317
|
+
editorKey: this.editorKey,
|
|
318
|
+
...(this.editorMode !== undefined && { editorMode: this.editorMode }),
|
|
319
|
+
...(this.designMode !== undefined && { designMode: this.designMode }),
|
|
320
|
+
...(this.design !== undefined && { design: this.design }),
|
|
321
|
+
...(this.popup !== undefined && { popup: this.popup }),
|
|
322
|
+
...(this.editorVersion !== undefined && {
|
|
323
|
+
editorVersion: this.editorVersion,
|
|
324
|
+
}),
|
|
325
|
+
...(this.editorUrl !== undefined && { editorUrl: this.editorUrl }),
|
|
326
|
+
callbacks,
|
|
327
|
+
options: editorOptions,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
// ========================================================================
|
|
331
|
+
// Public Methods - Full SDK pass-through
|
|
332
|
+
// ========================================================================
|
|
333
|
+
/** Get the underlying SDK instance */
|
|
334
|
+
getEditor() {
|
|
335
|
+
return this.sdk;
|
|
336
|
+
}
|
|
337
|
+
// Design methods
|
|
338
|
+
loadDesign(design, options) {
|
|
339
|
+
this.sdk?.loadDesign(design, options);
|
|
340
|
+
}
|
|
341
|
+
loadBlank() {
|
|
342
|
+
this.sdk?.loadBlank();
|
|
343
|
+
}
|
|
344
|
+
saveDesign(callback) {
|
|
345
|
+
this.sdk?.saveDesign(callback);
|
|
346
|
+
}
|
|
347
|
+
getDesign() {
|
|
348
|
+
return this.sdk?.getDesign();
|
|
349
|
+
}
|
|
350
|
+
// Export methods (async-only)
|
|
351
|
+
exportHtml(options) {
|
|
352
|
+
return this.sdk?.exportHtml(options);
|
|
353
|
+
}
|
|
354
|
+
exportPlainText() {
|
|
355
|
+
return this.sdk?.exportPlainText();
|
|
356
|
+
}
|
|
357
|
+
exportJson() {
|
|
358
|
+
return this.sdk?.exportJson();
|
|
359
|
+
}
|
|
360
|
+
exportImage(options) {
|
|
361
|
+
return this.sdk?.exportImage(options);
|
|
362
|
+
}
|
|
363
|
+
exportPdf(options) {
|
|
364
|
+
return this.sdk?.exportPdf(options);
|
|
365
|
+
}
|
|
366
|
+
exportZip(options) {
|
|
367
|
+
return this.sdk?.exportZip(options);
|
|
368
|
+
}
|
|
369
|
+
getPopupValues() {
|
|
370
|
+
return this.sdk?.getPopupValues();
|
|
371
|
+
}
|
|
372
|
+
// Merge tags
|
|
373
|
+
setMergeTags(config) {
|
|
374
|
+
this.sdk?.setMergeTags(config);
|
|
375
|
+
}
|
|
376
|
+
getMergeTags() {
|
|
377
|
+
return this.sdk?.getMergeTags();
|
|
378
|
+
}
|
|
379
|
+
// Special links
|
|
380
|
+
setSpecialLinks(config) {
|
|
381
|
+
this.sdk?.setSpecialLinks(config);
|
|
382
|
+
}
|
|
383
|
+
getSpecialLinks() {
|
|
384
|
+
return this.sdk?.getSpecialLinks();
|
|
385
|
+
}
|
|
386
|
+
// Modules
|
|
387
|
+
setModulesLoading(loading) {
|
|
388
|
+
this.sdk?.setModulesLoading(loading);
|
|
389
|
+
}
|
|
390
|
+
setModules(modules) {
|
|
391
|
+
this.sdk?.setModules(modules);
|
|
392
|
+
}
|
|
393
|
+
getModules() {
|
|
394
|
+
return this.sdk?.getModules();
|
|
395
|
+
}
|
|
396
|
+
// Fonts
|
|
397
|
+
setFonts(config) {
|
|
398
|
+
this.sdk?.setFonts(config);
|
|
399
|
+
}
|
|
400
|
+
getFonts() {
|
|
401
|
+
return this.sdk?.getFonts();
|
|
402
|
+
}
|
|
403
|
+
// Body values
|
|
404
|
+
setBodyValues(values) {
|
|
405
|
+
this.sdk?.setBodyValues(values);
|
|
406
|
+
}
|
|
407
|
+
getBodyValues() {
|
|
408
|
+
return this.sdk?.getBodyValues();
|
|
409
|
+
}
|
|
410
|
+
// Configuration
|
|
411
|
+
setOptions(options) {
|
|
412
|
+
this.sdk?.setOptions(options);
|
|
413
|
+
}
|
|
414
|
+
setToolsConfig(config) {
|
|
415
|
+
this.sdk?.setToolsConfig(config);
|
|
416
|
+
}
|
|
417
|
+
setEditorMode(mode) {
|
|
418
|
+
this.sdk?.setEditorMode(mode);
|
|
419
|
+
}
|
|
420
|
+
setEditorConfig(config) {
|
|
421
|
+
this.sdk?.setEditorConfig(config);
|
|
422
|
+
}
|
|
423
|
+
getEditorConfig() {
|
|
424
|
+
return this.sdk?.getEditorConfig();
|
|
425
|
+
}
|
|
426
|
+
setLocale(locale) {
|
|
427
|
+
this.sdk?.setLocale(locale);
|
|
428
|
+
}
|
|
429
|
+
setTextDirection(direction) {
|
|
430
|
+
this.sdk?.setTextDirection(direction);
|
|
431
|
+
}
|
|
432
|
+
setAppearance(config) {
|
|
433
|
+
this.sdk?.setAppearance(config);
|
|
434
|
+
}
|
|
435
|
+
setCustomCSS(css) {
|
|
436
|
+
this.sdk?.setCustomCSS(css);
|
|
437
|
+
}
|
|
438
|
+
setCustomJS(js) {
|
|
439
|
+
this.sdk?.setCustomJS(js);
|
|
440
|
+
}
|
|
441
|
+
// Multi-language
|
|
442
|
+
setLanguage(language) {
|
|
443
|
+
this.sdk?.setLanguage(language);
|
|
444
|
+
}
|
|
445
|
+
getLanguage() {
|
|
446
|
+
return this.sdk?.getLanguage();
|
|
447
|
+
}
|
|
448
|
+
// Undo/Redo
|
|
449
|
+
undo() {
|
|
450
|
+
this.sdk?.undo();
|
|
451
|
+
}
|
|
452
|
+
redo() {
|
|
453
|
+
this.sdk?.redo();
|
|
454
|
+
}
|
|
455
|
+
save() {
|
|
456
|
+
this.sdk?.save();
|
|
457
|
+
}
|
|
458
|
+
// Preview
|
|
459
|
+
showPreview(device) {
|
|
460
|
+
this.sdk?.showPreview(device);
|
|
461
|
+
}
|
|
462
|
+
hidePreview() {
|
|
463
|
+
this.sdk?.hidePreview();
|
|
464
|
+
}
|
|
465
|
+
// Tools
|
|
466
|
+
registerTool(config) {
|
|
467
|
+
return this.sdk?.registerTool(config);
|
|
468
|
+
}
|
|
469
|
+
unregisterTool(toolId) {
|
|
470
|
+
return this.sdk?.unregisterTool(toolId);
|
|
471
|
+
}
|
|
472
|
+
getTools() {
|
|
473
|
+
return this.sdk?.getTools();
|
|
474
|
+
}
|
|
475
|
+
// Display conditions
|
|
476
|
+
setDisplayConditions(config) {
|
|
477
|
+
this.sdk?.setDisplayConditions(config);
|
|
478
|
+
}
|
|
479
|
+
audit(optionsOrCallback, callback) {
|
|
480
|
+
if (typeof optionsOrCallback === "function") {
|
|
481
|
+
return this.sdk?.audit(optionsOrCallback);
|
|
482
|
+
}
|
|
483
|
+
if (callback) {
|
|
484
|
+
return this.sdk?.audit(optionsOrCallback, callback);
|
|
485
|
+
}
|
|
486
|
+
return this.sdk?.audit(optionsOrCallback);
|
|
487
|
+
}
|
|
488
|
+
// Collaboration
|
|
489
|
+
showComment(commentId) {
|
|
490
|
+
this.sdk?.showComment(commentId);
|
|
491
|
+
}
|
|
492
|
+
openCommentPanel(rowId) {
|
|
493
|
+
this.sdk?.openCommentPanel(rowId);
|
|
494
|
+
}
|
|
495
|
+
// Events
|
|
496
|
+
addEventListener(event, callback) {
|
|
497
|
+
return this.sdk?.addEventListener(event, callback);
|
|
498
|
+
}
|
|
499
|
+
removeEventListener(event, callback) {
|
|
500
|
+
this.sdk?.removeEventListener(event, callback);
|
|
501
|
+
}
|
|
502
|
+
// Advanced
|
|
503
|
+
registerColumns(cells) {
|
|
504
|
+
this.sdk?.registerColumns(cells);
|
|
505
|
+
}
|
|
506
|
+
setBrandingColors(config) {
|
|
507
|
+
this.sdk?.setBrandingColors(config);
|
|
508
|
+
}
|
|
509
|
+
// Custom widgets
|
|
510
|
+
createWidget(config) {
|
|
511
|
+
return this.sdk?.createWidget(config);
|
|
512
|
+
}
|
|
513
|
+
removeWidget(widgetName) {
|
|
514
|
+
return this.sdk?.removeWidget(widgetName);
|
|
515
|
+
}
|
|
516
|
+
// Undo/Redo state
|
|
517
|
+
canUndo() {
|
|
518
|
+
return this.sdk?.canUndo();
|
|
519
|
+
}
|
|
520
|
+
canRedo() {
|
|
521
|
+
return this.sdk?.canRedo();
|
|
522
|
+
}
|
|
523
|
+
// Tabs
|
|
524
|
+
updateTabs(tabs) {
|
|
525
|
+
this.sdk?.updateTabs(tabs);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
DragbleEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
529
|
+
DragbleEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: DragbleEditorComponent, isStandalone: true, selector: "dragble-editor", inputs: { editorKey: "editorKey", design: "design", editorMode: "editorMode", popup: "popup", contentType: "contentType", ai: "ai", locale: "locale", translations: "translations", textDirection: "textDirection", language: "language", appearance: "appearance", tools: "tools", customTools: "customTools", features: "features", mergeTags: "mergeTags", specialLinks: "specialLinks", modules: "modules", displayConditions: "displayConditions", editor: "editor", fonts: "fonts", bodyValues: "bodyValues", header: "header", footer: "footer", customCSS: "customCSS", customJS: "customJS", height: "height", minHeight: "minHeight", options: "options", callbacks: "callbacks", sdkUrl: "sdkUrl", sdkVersion: "sdkVersion", editorVersion: "editorVersion", editorUrl: "editorUrl", collaboration: "collaboration", user: "user", designMode: "designMode" }, outputs: { ready: "ready", load: "load", change: "change", error: "error", commentAction: "commentAction" }, usesOnChanges: true, ngImport: i0, template: `<div
|
|
530
|
+
#container
|
|
531
|
+
[id]="containerId"
|
|
532
|
+
[style.width]="'100%'"
|
|
533
|
+
[style.height]="computedHeight"
|
|
534
|
+
[style.minHeight]="computedMinHeight"
|
|
535
|
+
></div>`, isInline: true, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n "] });
|
|
536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorComponent, decorators: [{
|
|
537
|
+
type: Component,
|
|
538
|
+
args: [{ selector: "dragble-editor", template: `<div
|
|
539
|
+
#container
|
|
540
|
+
[id]="containerId"
|
|
541
|
+
[style.width]="'100%'"
|
|
542
|
+
[style.height]="computedHeight"
|
|
543
|
+
[style.minHeight]="computedMinHeight"
|
|
544
|
+
></div>`, standalone: true, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n "] }]
|
|
545
|
+
}], propDecorators: { editorKey: [{
|
|
546
|
+
type: Input
|
|
547
|
+
}], design: [{
|
|
548
|
+
type: Input
|
|
549
|
+
}], editorMode: [{
|
|
550
|
+
type: Input
|
|
551
|
+
}], popup: [{
|
|
552
|
+
type: Input
|
|
553
|
+
}], contentType: [{
|
|
554
|
+
type: Input
|
|
555
|
+
}], ai: [{
|
|
556
|
+
type: Input
|
|
557
|
+
}], locale: [{
|
|
558
|
+
type: Input
|
|
559
|
+
}], translations: [{
|
|
560
|
+
type: Input
|
|
561
|
+
}], textDirection: [{
|
|
562
|
+
type: Input
|
|
563
|
+
}], language: [{
|
|
564
|
+
type: Input
|
|
565
|
+
}], appearance: [{
|
|
566
|
+
type: Input
|
|
567
|
+
}], tools: [{
|
|
568
|
+
type: Input
|
|
569
|
+
}], customTools: [{
|
|
570
|
+
type: Input
|
|
571
|
+
}], features: [{
|
|
572
|
+
type: Input
|
|
573
|
+
}], mergeTags: [{
|
|
574
|
+
type: Input
|
|
575
|
+
}], specialLinks: [{
|
|
576
|
+
type: Input
|
|
577
|
+
}], modules: [{
|
|
578
|
+
type: Input
|
|
579
|
+
}], displayConditions: [{
|
|
580
|
+
type: Input
|
|
581
|
+
}], editor: [{
|
|
582
|
+
type: Input
|
|
583
|
+
}], fonts: [{
|
|
584
|
+
type: Input
|
|
585
|
+
}], bodyValues: [{
|
|
586
|
+
type: Input
|
|
587
|
+
}], header: [{
|
|
588
|
+
type: Input
|
|
589
|
+
}], footer: [{
|
|
590
|
+
type: Input
|
|
591
|
+
}], customCSS: [{
|
|
592
|
+
type: Input
|
|
593
|
+
}], customJS: [{
|
|
594
|
+
type: Input
|
|
595
|
+
}], height: [{
|
|
596
|
+
type: Input
|
|
597
|
+
}], minHeight: [{
|
|
598
|
+
type: Input
|
|
599
|
+
}], options: [{
|
|
600
|
+
type: Input
|
|
601
|
+
}], callbacks: [{
|
|
602
|
+
type: Input
|
|
603
|
+
}], sdkUrl: [{
|
|
604
|
+
type: Input
|
|
605
|
+
}], sdkVersion: [{
|
|
606
|
+
type: Input
|
|
607
|
+
}], editorVersion: [{
|
|
608
|
+
type: Input
|
|
609
|
+
}], editorUrl: [{
|
|
610
|
+
type: Input
|
|
611
|
+
}], collaboration: [{
|
|
612
|
+
type: Input
|
|
613
|
+
}], user: [{
|
|
614
|
+
type: Input
|
|
615
|
+
}], designMode: [{
|
|
616
|
+
type: Input
|
|
617
|
+
}], ready: [{
|
|
618
|
+
type: Output
|
|
619
|
+
}], load: [{
|
|
620
|
+
type: Output
|
|
621
|
+
}], change: [{
|
|
622
|
+
type: Output
|
|
623
|
+
}], error: [{
|
|
624
|
+
type: Output
|
|
625
|
+
}], commentAction: [{
|
|
626
|
+
type: Output
|
|
627
|
+
}] } });
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Dragble Editor Angular Module
|
|
631
|
+
*
|
|
632
|
+
* This module is provided for backwards compatibility with non-standalone Angular apps.
|
|
633
|
+
* For Angular 14+ apps using standalone components, you can import DragbleEditorComponent directly.
|
|
634
|
+
*/
|
|
635
|
+
class DragbleEditorModule {
|
|
636
|
+
}
|
|
637
|
+
DragbleEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
638
|
+
DragbleEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorModule, imports: [DragbleEditorComponent], exports: [DragbleEditorComponent] });
|
|
639
|
+
DragbleEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorModule });
|
|
640
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DragbleEditorModule, decorators: [{
|
|
641
|
+
type: NgModule,
|
|
642
|
+
args: [{
|
|
643
|
+
imports: [DragbleEditorComponent],
|
|
644
|
+
exports: [DragbleEditorComponent],
|
|
645
|
+
}]
|
|
646
|
+
}] });
|
|
647
|
+
|
|
648
|
+
export { DragbleEditorComponent, DragbleEditorModule };
|
|
649
|
+
//# sourceMappingURL=index.js.map
|