Appearance
Landing Page Editor Instance
Initialization
Load the editor script, then call the global LandingPageEditor factory. Options go under config; callbacks are top-level properties passed next to config.
html
<script
src="https://v1.page-assets.topol.io/loader/build.js"
type="text/javascript"
></script>The legacy https://v1.page-assets.topol.io/topol-lpe.js URL still serves the same file for existing integrations.
js
const editor = LandingPageEditor({
config: {
authorize: { apiKey: "YOUR_API_KEY", userId: "user-123" },
// ... other options
},
onSave({ json, html }) {
console.log("Saved:", json, html);
},
onInit() {
console.log("Editor is ready");
},
});
editor.render("#landing-page-editor");Methods Reference
render(selector: string) => voidRenders the editor into the specified DOM element. Learn more
load(json: Record<string, unknown>) => voidLoads a template JSON into the editor.
save() => voidRenders the current template server-side, then triggers the onSave({ json, html }) callback.
togglePreview() => voidToggles preview mode on or off.
setPreviewSize(index: number) => voidSwitches the preview device by numeric index (0 = mobile, 1 = mobile landscape, 2 = tablet, 3 = desktop). Any other value selects desktop.
undo() => voidUndoes the last change.
redo() => voidRedoes the last undone change.
chooseFile(url: string) => voidReturns the selected file URL to the editor (for custom file manager). Learn more
refreshSyncedSections() => voidRefreshes synced sections listing and reloads template with latest changes. Learn more
refreshComments(key: string) => voidRefreshes comments for a specific conversation. Learn more
openPremadeTemplatesSelection() => voidOpens the premade templates picker dialog.
setTemplateName(name: string) => voidSets the template name shown in the editor.
updateOptions(options: Partial<IPluginOptions>) => voidReconfigures a running editor. Accepts any editor options except authorize. Learn more
toggleSelectionPanel() => voidCollapses or expands the right-side selection panel (properties of the selected element).
createNotification(notification: INotification) => voidDisplays a custom notification in the editor. Learn more
close() => voidTears down the editor iframe completely. Comes from the underlying zoid iframe wrapper rather than the editor itself — there is no destroy() method on the instance.
Example Usage
js
// Load a template
editor.load(templateJson);
// Trigger save
editor.save();
// Update authorization header
editor.updateApiAuthorizationHeader("Bearer new_token");
// Refresh synced sections
editor.refreshSyncedSections();
// Reconfigure a running editor
editor.updateOptions({ hideSelectionPanel: true });
// Tear down the editor iframe
editor.close();TypeScript Interface
ts
interface ILandingPageEditor {
render: (selector: string) => void;
load: (json: Record<string, unknown>) => void;
save: () => void;
togglePreview: () => void;
setPreviewSize: (index: number) => void;
undo: () => void;
redo: () => void;
chooseFile: (url: string) => void;
refreshSyncedSections: () => void;
refreshComments: (key: string) => void;
openPremadeTemplatesSelection: () => void;
setTemplateName: (name: string) => void;
updateOptions: (options: Partial<IPluginOptions>) => void;
toggleSelectionPanel: () => void;
updateApiAuthorizationHeader: (
newAuthHeader: string | Record<string, string>
) => void;
createNotification: (notification: INotification) => void;
/** Provided by the zoid iframe wrapper */
close: () => void;
}