Skip to main content
Version: 1.0.0

SDK Methods

Complete reference for all methods available on the Dragble editor instance. These methods are available across all framework wrappers and the vanilla JS SDK.

Design

MethodSignatureReturnDescription
loadDesign(design: DesignJson) => voidvoidReplace the current design with the provided JSON.
loadBlank(options?) => voidvoidLoad a blank (empty) design.
getDesign() => DesignJsonDesignJsonReturn the current design as JSON.
setBodyValues(values: Partial<BodyValues>) => voidvoidUpdate body-level values (background color, width, font family, etc.).
getBodyValues() => BodyValuesBodyValuesGet current body-level values.
triggerSave() => voidvoidTrigger the save event (equivalent to Ctrl+S / Cmd+S).

Export

MethodSignatureReturnDescription
exportHtml(title?: string) => stringstringExport the design as responsive HTML.
exportJson() => stringstringExport the design as a JSON string.
exportPlainText() => stringstringExport the design as plain text (no HTML tags).
exportImage(options?: ExportImageOptions) => Promise<ExportImageData>Promise<ExportImageData>Export the design as a PNG/JPEG image.
exportPdf(options?: ExportPdfOptions) => Promise<ExportPdfData>Promise<ExportPdfData>Export the design as a PDF.
exportZip(options?: ExportZipOptions) => Promise<ExportZipData>Promise<ExportZipData>Export the design as a ZIP file with images.

Merge Tags

MethodSignatureReturnDescription
setMergeTags(config: MergeTagConfig) => voidvoidReplace the merge tags available in the editor.
getMergeTags() => MergeTagsResultMergeTagsResultGet current merge tags (custom, default, combined).
MethodSignatureReturnDescription
setSpecialLinks(links: SpecialLink[], excludeDefaults?: boolean) => voidvoidReplace the special links available in the link picker.
getSpecialLinks() => SpecialLink[]SpecialLink[]Get current special links.

Modules

MethodSignatureReturnDescription
setModules(modules: Module[]) => voidvoidReplace all modules in the modules panel.
getModules() => Module[]Module[]Get current modules.
addModule(module: Module) => voidvoidAdd a single module.
removeModule(moduleId: string) => voidvoidRemove a module by ID.
updateModule(payload: { moduleId: string; updates: Partial<Module> }) => voidvoidUpdate an existing module.
getSyncedModulesInDesign() => string[]string[]Get IDs of synced modules currently used in the design.
unlinkSyncedModule(rowId: string) => voidvoidUnlink a synced module from a row.

Fonts

MethodSignatureReturnDescription
setFonts(config: FontsConfig) => voidvoidSet custom fonts configuration.
getFonts() => FontsConfigFontsConfigGet current fonts configuration.

Display Conditions

MethodSignatureReturnDescription
setDisplayConditions(config: DisplayConditionsConfig) => voidvoidReplace the display conditions available for rows.
getDisplayConditions() => DisplayConditionsConfigDisplayConditionsConfigGet current display conditions configuration.

Configuration

MethodSignatureReturnDescription
setLocale(locale: string, translations?: Record<string, string>) => voidvoidChange the editor UI language at runtime. Accepts 29 built-in locale codes. Optional translations object overrides specific keys.
setTextDirection(dir: 'ltr' | 'rtl') => voidvoidChange text direction at runtime.
getTextDirection() => 'ltr' | 'rtl'stringGet current text direction.
setEditorMode(mode: EditorMode) => voidvoidSwitch between 'email', 'web', and 'popup' editor modes.
setEditorBehaviorConfig(config: EditorBehaviorConfig) => voidvoidUpdate editor behavior (minRows, maxRows, contentType, etc.).
setLanguage(language: Language) => voidvoidSet the active language for multi-language designs.
getLanguage() => Language | nullLanguage | nullGet the active language.

Features

MethodSignatureReturnDescription
setFeatures(features: FeaturesConfig) => voidvoidUpdate feature flags at runtime.
getFeatures() => FeaturesConfigFeaturesConfigGet current feature flags.

Tools

MethodSignatureReturnDescription
setToolsConfig(config: ToolsConfig) => voidvoidShow/hide or configure content tools at runtime.
registerCustomTool(tool: CustomTool) => voidvoidRegister a custom tool at runtime.
unregisterCustomTool(toolId: string) => voidvoidRemove a previously registered custom tool.

Appearance

MethodSignatureReturnDescription
setAppearance(config: AppearanceConfig) => voidvoidUpdate appearance at runtime (theme, accent color, panels, etc.).
setSidePanelConfig(config: SidePanelConfig) => voidvoidUpdate side panel configuration at runtime.

Branding

MethodSignatureReturnDescription
setBrandingColors(config: BrandingColorsConfig) => voidvoidReplace brand color palette at runtime.
setLinkTypes(types: LinkTypeDefinition[]) => voidvoidSet custom link types.
registerColumns(columns: RegisteredColumnLayout[]) => voidvoidRegister custom column layouts.

Preview

MethodSignatureReturnDescription
showPreview(device?: 'desktop' | 'tablet' | 'mobile') => voidvoidOpen the design preview modal. Optionally specify device view.
hidePreview() => voidvoidClose the design preview modal.

Undo / Redo

MethodSignatureReturnDescription
undo() => voidvoidUndo the last action.
redo() => voidvoidRedo the last undone action.
isUndoRedoEnabled() => booleanbooleanWhether undo/redo is currently available.

Element Control

MethodSignatureReturnDescription
selectElement(target: { type: string; id: string }) => voidvoidProgrammatically select a content element.
highlightElement(target: { type: string; id: string } | null) => voidvoidHighlight an element (pass null to clear).
scrollToElement(target: { type: string; id: string }) => voidvoidScroll the canvas to bring an element into view.
execCommand(command: { action: string; target: { type: string; id: string } }) => voidvoidExecute an element command (highlight, scroll, focus, select).

Validation & Audit

MethodSignatureReturnDescription
setValidator(source: string | null) => voidvoidSet a global validator function (as a stringified function).
setToolValidator(tool: string, source: string | null) => voidvoidSet a tool-specific validator.
clearValidators(tool?: string) => voidvoidClear validators (optionally for a specific tool).
runAudit(options?: { includeHtml?: boolean }) => Promise<AuditResult>Promise<AuditResult>Run content quality audit and return results.

Asset Storage

MethodSignatureReturnDescription
setAssetStorageMode(mode: 'dragble' | 'external') => voidvoidSwitch between Dragble-managed and external storage at runtime.
getAssetStorageMode() => 'dragble' | 'external'stringGet current asset storage mode.

AI

MethodSignatureReturnDescription
setAIConfig(config: AIConfig | undefined) => voidvoidUpdate AI configuration at runtime. Pass undefined to disable.
getAIConfig() => AIConfig | undefinedAIConfig | undefinedGet current AI configuration.

Custom CSS / JS

MethodSignatureReturnDescription
setCustomCSS(css: string[]) => voidvoidLoad custom CSS files into the editor.
setCustomJS(js: string[]) => voidvoidLoad custom JS files into the editor.

Collaboration

MethodSignatureReturnDescription
addComment(payload: { threadId: string; targetId: string; text: string; type?: string }) => voidvoidAdd a collaboration comment.
resolveThread(payload: { threadId: string }) => voidvoidResolve a comment thread.

Lifecycle

MethodSignatureReturnDescription
isReady() => booleanbooleanWhether the editor is fully initialized.
destroy() => voidvoidDestroy the editor and clean up resources.
info

All Promise-returning methods reject with an EditorError if the operation fails. Wrap calls in try/catch for proper error handling.

warning

Calling methods before isReady() returns true (or before the ready event fires) will throw an error. Always wait for initialization to complete.