Appearance
NPM Packages: Upgrading to v1
Version 1 of the @topol.io/editor packages embeds Email Editor v4 and adds the Landing Page Editor. Moving to v4 changes how you initialize the editor, how callbacks receive data, and several option names. This guide lists every change from 0.3 and how to fix it.
This is the upgrade path for integrations that install the editor from npm. If your page loads the editor with a <script> tag instead, follow Script Tag: Upgrading from v3 to v4. For what's new in v4, see Migrating to Email Editor v4.
Install v1 with:
bash
npm install @topol.io/editor@^1bash
npm install @topol.io/editor-react@^1bash
npm install @topol.io/editor-vue@^1bash
npm install @topol.io/editor-svelte@^1Option and callback reference
The options and callbacks in the rest of the Email Editor guide are the v4 ones and apply to the packages unchanged. Framework components take the config object as their options prop. Package-specific details are on this page and in each package's npm README.
Let an AI agent do the upgrade
TOPOL-io/skills has two skills for coding agents, written as plain markdown. topol-editors-integration sets up either editor in a new project and topol-editors-upgrade-v1 moves an existing integration to v1. They install as a Claude Code plugin (/plugin marketplace add TOPOL-io/skills) or into any agent with npx skills@latest add TOPOL-io/skills.
Who needs to change what
| Integration | After upgrading | Sections to apply |
|---|---|---|
Email Editor via core EmailEditor / TopolPlugin | init() throws on the old shape; module-level methods are gone | All sections |
| Email Editor via React, Vue or Svelte component | The TopolEditor import no longer resolves; once renamed, callbacks receive different arguments and some stop firing | Callbacks, Options, Framework packages, Types, Checklist |
| Landing Page Editor | New in v1, nothing to migrate | Landing Page Editor |
Email Editor via @topol.io/editor-angular | The Angular package is deprecated and has no v1 | Replace it with the core @topol.io/editor package, then apply all sections |
Package names are the same. The default exports and the TopolPlugin / TopolEditor names are gone, so every import becomes the named EmailEditor. @topol.io/editor-svelte now requires Svelte 5, and @topol.io/editor-react declares React 18 or 19 as a peer dependency; Vue still needs 3.2.25 or later. Renamed types fail the type-check. Renamed options and callbacks do not: they are ignored at runtime without a warning.
Upgrading from a 1.0.0 alpha
The 1.0.0-alpha.1 to 1.0.0-alpha.9 builds (React up to 1.0.0-alpha.10) embedded Email Editor v3 with the 0.3 API, so follow this guide as if you were on 0.3.
Later alphas already embed v4, but they still accepted names that 1.0.0 removes. Go through Methods, Configuration options, Framework packages and Types: the TopolPlugin and TopolEditor exports, the pre-rename type names, authorize.userId, the control panel names, and the Svelte on: events and callbacks prop are all gone.
If you used the Landing Page Editor on an alpha:
- Up to
1.0.0-alpha.8, callbacks took positional arguments. They now receive a single object:onSave({ json, html })instead ofonSave(json, html), with errors and closing reported throughonEditorErrorandonEditorClose. - The React types
LandingPageEditorRefandLandingPageEditorPropsare nowILandingPageEditorRefandILandingPageEditorProps, and theTopolSectiontype is no longer exported. - The React component is no longer absolutely positioned and has no fixed
id.
Landing Page Editor
v1 adds the Landing Page Editor to the same packages, as a named LandingPageEditor export in core, React and Vue. The Svelte package does not include a Landing Page Editor component yet.
Initialization and lifecycle
init() now takes { config, ...callbacks } and resolves to an editor instance. It no longer mounts anything: call render() on the instance. Every method lives on the instance and returns a promise.
ts
import TopolPlugin from "@topol.io/editor";
await TopolPlugin.init({
id: "#editor",
authorize: { apiKey: "YOUR_API_KEY", entityId: "user-123" },
savedBlocks: blocks,
callbacks: {
onSave(json, html) {
persist(json, html);
},
onError(type, message) {
report(type, message);
},
},
});
TopolPlugin.save("en");
TopolPlugin.destroy();ts
import { EmailEditor } from "@topol.io/editor";
const editor = await EmailEditor.init({
config: {
authorize: { apiKey: "YOUR_API_KEY", entityId: "user-123" },
savedSections: blocks,
},
async onSave({ json, html }) {
await persist(json, html);
},
onEditorError({ source, message }) {
report(source, message);
},
});
await editor.render("#editor");
await editor.save({ langCode: "en" });
await editor.destroy();| Area | Before | After | How to fix |
|---|---|---|---|
| Init call | init({ id, authorize, ...options, callbacks }) | init({ config: { authorize, ...options }, ...callbacks }, { stage, loaderUrl }) | Move options under config, spread callbacks at the top level, drop id |
| Mounting | init() mounted into id | await editor.render(container) with a selector or an element | Call render() after init() resolves; the container needs a height |
| Methods | TopolPlugin.save(), EmailEditor.destroy(), … | editor.save(), editor.destroy(), … | Call them on the instance. The old module-level methods are undefined |
| Return values | Methods returned nothing | Every method returns a promise | await where order matters, e.g. await editor.save() |
| Instances | One editor per page, on window | Each init() creates an independent instance | Keep a reference per editor |
entityId | Any string or number | Non-negative integer, or a string matching [A-Za-z0-9_-]+; anything else makes init() throw | Map emails and other IDs to a URL-safe value |
| Authentication errors | Reported through onError | Reported through onEditorError; the instance has no working methods afterwards | Destroy and re-init after fixing credentials |
onInit | Editor loaded | Editor loaded and authenticated | Wait for onInit before calling methods |
Recommended: nonce authentication
authorize.apiKey keeps working on its own in v4, but the setup we recommend is nonce authentication. Pass a getNonce callback: the editor then runs on short-lived nonces that your backend signs for each signed-in user with the Secret key. You can add it now or after the upgrade. See Nonce Authentication.
Methods
| Before | After |
|---|---|
save(lang?) | save({ langCode? }), resolves after your onSave settles |
setSavedBlocks(blocks) | setSavedSections(sections) |
refreshSyncedRows() | refreshSyncedSections() |
getMutations() returned nothing, result came through onGetMutations | getMutations() resolves to { code, primary }[] and still fires onGetMutations |
updateOptions(options) | updateOptions(options), without authorize |
createLanguage, deleteLanguage, selectLanguage, setPrimaryLanguage(lang) | Same names; the argument is the language code |
toggleBlocksAndStructuresVisibility() | toggleHiddenElementsVisibility() |
toggleControlPanel() | toggleSelectionPanel() |
Every other method keeps its name: load, togglePreview, togglePreviewSize, toggleDarkMode, chooseFile, undo, redo, setPreviewHTML, createNotification, setActiveMembers, changeEmailToMobile, changeEmailToDesktop, updateCustomBlockContent, refreshComments, openPremadeTemplatesSelection, updateApiAuthorizationHeader, setTemplateName, setMergeTags, toggleChatAI, toggleAutosaves, toggleComments, updateTemplate. A method called under its old name throws "not a function". New: translateLanguage(code, sourceCode?) and translateAllLanguages().
Callbacks
Every callback now receives either no arguments or a single object. Seven callbacks are renamed.
| Before | After | How to fix |
|---|---|---|
onSave(json, html, mutations, syncedSections) | onSave({ json, html, mutations, syncedSections }); may return a promise the editor waits for | Destructure; return the promise when you persist asynchronously |
onSaveAndClose(json, html, …) | onSaveAndClose({ json, html, mutations, syncedSections }) | Destructure |
onTestSend(email, json, html) | onTestSend({ email, json, html }); email is string | string[] | Destructure; handle an array of addresses |
onBannerClick(json, html) | onBannerClick({ json, html }) | Destructure |
onUndoChange(count), onRedoChange(count) | ({ count }) | Destructure |
onPreview(html) | onPreview({ html }) | Destructure |
onAlert(notification) | onAlert({ notification }) | Destructure |
onEdittedWithoutSaveChanged(hasUnsavedChanges) | onUnsavedChangesChange({ hasUnsavedChanges }) | Rename and destructure |
onOpenCustomBlockDialog(block) | onOpenCustomBlockDialog({ block }) | Destructure |
onTemplateRename(title) | onTemplateRename({ name }) | Read name |
updateTestingEmailAddresses(emails) | onTestingEmailsChange({ emails }) | Rename and destructure |
onLanguageCreated, onLanguageDeleted, onPrimaryLanguageChanged(lang, mutations) | ({ code, mutations }) | Read code |
onLanguageSelected(lang) | onLanguageSelected({ code }) | Read code |
onGetMutations(mutations) | onGetMutations({ mutations }) | Destructure |
onError(type, message, responseBody) | onEditorError({ source, message, detail }) | Rename; type → source, responseBody → detail |
onClose() | onEditorClose() | Rename |
onBlockSave(block) | onSavedSectionSave({ section }) | Rename and destructure |
onBlockRemove(id) | onSavedSectionRemove({ id }) | Rename; id can be a number or a string |
onBlockEdit(id) | onSavedSectionEdit({ id }) | Rename; id can be a number or a string |
onInit(), onLoaded(), onOpenFileManager() | Unchanged | — |
Language mutations use { code, primary } everywhere: save payloads, language callbacks, onGetMutations and getMutations().
onClose and onError are dropped before they reach the editor. A handler left under either name never runs, and nothing warns you.
New callbacks: onPreviewClose(), onImageDelete({ items }), onHiddenElementsVisibilityChange({ visible }), onTemplateUpdated(), and the optional getNonce() for nonce authentication.
Configuration options
Saved and premade blocks are now called sections. A renamed option left under its old name is ignored without an error.
| Before | After | How to fix |
|---|---|---|
id | Removed | Pass the container to render(); the framework components own it |
callbacks: { … } | Removed | Put callbacks next to config |
authorize.userId | authorize.entityId | Rename |
savedBlocks | savedSections | Rename; items keep the { id, name, definition, img? } shape |
premadeBlocks, premadeBlocksNoOverwrite | premadeSections: false, your groups, or { blocks, override } | Rename; drop premadeBlocksNoOverwrite and use override: false to keep Topol's default groups next to yours |
syncedRowsEnable | syncedSectionsEnabled | Rename |
topBarOptions (controls to show) | hideTopbarControls (controls to hide) | Invert the list |
hideControlPanel | hideSelectionPanel | Rename |
showControlPanelExpand | hideSelectionPanelExpand | Rename and invert the value: showControlPanelExpand: false becomes hideSelectionPanelExpand: true |
productMergetagTags | productMergeTags | Rename |
dynamicMergetags on an API block | dynamicMergeTags | Rename |
defaultTemplateSettings.langs[].key | defaultTemplateSettings.langs[].code | Rename the key |
defaultTemplateSettings: blockBackgroundColor, "structure-margin", "line-height", "stack-columns" | sectionBackgroundColor, sectionPadding, lineHeight, stackColumns | Rename the top-level keys; "line-height" inside the block-level defaults (text, button, …) stays |
api.SAVED_BLOCKS | api.SAVED_SECTIONS | Rename |
api.PREMADE_TEMPLATES_KEYWORDS | api.PREMADE_TEMPLATE_KEYWORDS | Rename |
api.SAVE, api.LOAD, api.PREVIEW | Removed | Persist through onSave; load with editor.load() |
api.AUTOSAVE, api.GET_AUTOSAVE, api.SYNCED_ROWS | Removed | Serve autosaves from api.AUTOSAVES |
api.IMAGE_EDITOR_UPLOAD | Removed | Images saved from the Image Editor upload through api.IMAGE_UPLOAD; see Self-hosted Storage |
googleApiKey | Removed | Drop it; the Image Editor takes its fonts from customFonts |
textOverride keys for blocks and rows, and misspelled keys | Section names and corrected spelling | Rename the keys you override; see the script tag guide for both lists |
All other options keep their names. v4 also adds optional ones such as permissions, enableSubjectLine, and loop and rating blocks.
Framework packages
In all three packages the component is now the named export EmailEditor; the TopolEditor name and the default exports are gone. The options and stage props stay. The components follow the callback changes above, plus these:
| Change | Before | After | How to fix |
|---|---|---|---|
| Container | Fixed id (#editor, #topol-editor-id or #topol-email-editor-id) and position: absolute | No fixed id, no position: absolute; still width: 100%; height: 100vh | Stop targeting the ids; size and position the parent yourself |
| Editor access | Global TopolPlugin methods | The component's instance: React ref.current.getEditor() or onReady, Vue template ref getEditor() or @ready, Svelte bind:this + getEditor() or onReady | Call methods on that instance |
| Init failures | onError (React, Vue) or nothing (Svelte) | onEditorError with source: "integration" | Listen to onEditorError |
| Reconfiguring | Options read once on mount | Options and which handlers exist are captured on mount | Remount (React key, Vue key, Svelte {#key}) to change them |
| New props | — | loaderUrl; React className, style, onReady; Vue callbacks and the ready event; Svelte class, style, onReady | Optional |
React. @topol.io/editor-react has no default export: import { EmailEditor } from "@topol.io/editor-react" instead of TopolEditor. Callback props follow the core table, so positional handlers now receive one object, and a promise returned from onSave is awaited. In Next.js, load the component with SSR disabled; see Next.js integration.
Vue. Event listeners are notifications and their return value is not awaited. Pass handlers the editor must wait for, such as an async onSave, through the callbacks prop. Vue events already sent objects for onSave, onSaveAndClose, onTestSend, onBannerClick and onGetMutations; those keep their shape. The other events change as in the callbacks table, and language events carry { code, … } instead of { lang, … }.
Svelte. v1 requires Svelte 5; a Svelte 4 project stays on @topol.io/editor-svelte@0.3 until it upgrades Svelte. Every callback is now a prop that receives the payload object directly, so the on: events and event.detail are gone, and on:ready becomes onReady. A callback prop may return a promise, and the editor waits for onSave, onSaveAndClose, onEditorClose and getNonce. Type the options prop as ISvelteEmailOptions.
svelte
<!-- Before (0.3) -->
<TopolEditor {options} on:onSave={(event) => persist(event.detail)} />
<!-- After (v1) -->
<EmailEditor {options} onSave={({ json, html }) => persist(json, html)} />Loader and environments
- The packages load the v4 loader,
https://v4.email-assets.topol.io/loader/build.js. Your API key must work with Email Editor v4. - Let
init()load the script. A loader<script>tag you add to the page yourself makesinit()reject. - Use one loader URL per page. Switching stages needs a page reload.
- The
devandstagingstages resolve to the production v4 loader. Use theloaderUrloption for preview or local builds. - If you rebuild the packages yourself, the build-time overrides are
VITE_TOPOL_V4_URL,VITE_TOPOL_V4_DEV_URLandVITE_TOPOL_V4_STAGING_URL. The oldVITE_TOPOL_*variables are ignored.
Backend and security policy
If you host api.* endpoints, they need the v4 CORS origin and the merged autosave endpoint. If your page sets a Content Security Policy, it needs the v4 loader domain. Both changes are the same for script-tag integrations, so they're described once in Backend and security policy.
Types
The exported types follow one naming scheme in v1. The old names are removed, not aliased, so TypeScript reports each one.
| Before | After | Notes |
|---|---|---|
ITopolOptions | IEmailConfig | The options object. IEmailOptions is the whole init() argument: { config, ...callbacks } |
ITopolPlugin | IEmailEditorInstance | The instance init() resolves to |
ISavedBlock | ISavedSection | Same shape |
ISaveData | IEmailSavePayload | mutations are { code, primary }[] |
IErrorData | IEmailErrorPayload | { source, message, detail? } instead of type and responseBody |
ISendTestData | IEmailTestSendPayload | email is string | string[] |
React IReactTopolOptions, TopolEditorProps | IReactEmailOptions, IEmailEditorProps | IEmailEditorRef types the component ref |
Vue IVueOptions | IVueEmailOptions | — |
Svelte ISvelteOptions | ISvelteEmailOptions | IEmailEditorProps types all props |
IEmailCallbacks holds the callback signatures. The framework packages re-export the core types, so one import source is enough.
Upgrade checklist
These changes raise no error in plain JavaScript. Check each one before you ship the upgrade.
- [ ]
onErroris renamed toonEditorError, so editor and init errors still reach you. - [ ]
onCloseis renamed toonEditorClose, so closing the editor still works. - [ ] Save handlers read
jsonandhtmlfrom one object. A two-argument handler would store the payload object as JSON andundefinedas HTML. - [ ]
savedBlocks,setSavedBlocksand theonBlock*callbacks are renamed, so saved sections still appear and persist. - [ ]
premadeBlocks,syncedRowsEnableandapi.SAVED_BLOCKSare renamed. - [ ]
hideControlPanelandshowControlPanelExpandare renamed, the latter with its value inverted, andtoggleControlPanel()calls are nowtoggleSelectionPanel(). - [ ]
productMergetagTags,dynamicMergetags,api.PREMADE_TEMPLATES_KEYWORDSand the fourdefaultTemplateSettingskeys are renamed. - [ ]
textOverridekeys you set use the section names and the corrected spelling. - [ ]
topBarOptionsis converted tohideTopbarControlswith the list inverted. - [ ] Multilingual code reads
codeinstead ofkeyorlang. - [ ] Unsaved-changes guards read
{ hasUnsavedChanges }, undo/redo buttons read{ count }. - [ ] The page layout works without the component's fixed
idandposition: absolute. - [ ]
authorize.userIdis renamed toauthorize.entityId. - [ ] Svelte handlers are callback props, not
on:listeners readingevent.detail. - [ ] Every
entityIdpasses the new format check. - [ ] Existing templates open and save in Email Editor v4 with your API key.
INFO
Running into trouble while upgrading? Contact our support team here and we'll help you get it working.
