react-email-editor
Advanced tools
Comparing version 1.7.3 to 1.7.4
@@ -1,17 +0,3 @@ | ||
import React from 'react'; | ||
import { EditorOptions, EditorRef } from 'types'; | ||
declare type Props = { | ||
minHeight?: number; | ||
scriptUrl?: string; | ||
onReady?: Function; | ||
onLoad?: Function; | ||
editorId?: string; | ||
projectId?: number; | ||
options?: EditorOptions; | ||
tools?: object; | ||
locale?: string; | ||
appearance?: string; | ||
style?: React.CSSProperties; | ||
}; | ||
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<EditorRef>>; | ||
export default _default; | ||
import { EmailEditor } from './EmailEditor'; | ||
export * from './types'; | ||
export default EmailEditor; |
@@ -26,3 +26,3 @@ 'use strict'; | ||
var name = "react-email-editor"; | ||
var version = "1.7.3"; | ||
var version = "1.7.4"; | ||
var description = "Unlayer's Email Editor Component for React.js"; | ||
@@ -138,3 +138,3 @@ var main = "dist/index.js"; | ||
var lastEditorId = 0; | ||
var EmailEditor = function EmailEditor(props, ref) { | ||
var EmailEditor = /*#__PURE__*/React__default.forwardRef(function (props, ref) { | ||
var onLoad = props.onLoad, | ||
@@ -181,4 +181,4 @@ onReady = props.onReady, | ||
}, [editor]); | ||
var exportHtml = React.useCallback(function (callback) { | ||
editor == null ? void 0 : editor.exportHtml(callback); | ||
var exportHtml = React.useCallback(function (callback, options) { | ||
editor == null ? void 0 : editor.exportHtml(callback, options); | ||
}, [editor]); | ||
@@ -188,2 +188,5 @@ var setMergeTags = React.useCallback(function (mergeTags) { | ||
}, [editor]); | ||
var loadBlank = React.useCallback(function (options) { | ||
editor == null ? void 0 : editor.loadBlank(options); | ||
}, [editor]); | ||
React.useEffect(function () { | ||
@@ -215,5 +218,6 @@ loadScript(loadEditor, scriptUrl); | ||
registerCallback: registerCallback, | ||
addEventListener: addEventListener | ||
addEventListener: addEventListener, | ||
loadBlank: loadBlank | ||
}; | ||
}, [saveDesign, exportHtml, setMergeTags, editor, loadDesign, registerCallback, addEventListener]); | ||
}, [saveDesign, exportHtml, setMergeTags, editor, loadDesign, registerCallback, addEventListener, loadBlank]); | ||
return React__default.createElement("div", { | ||
@@ -231,6 +235,5 @@ style: { | ||
})); | ||
}; | ||
var index = /*#__PURE__*/React__default.forwardRef(EmailEditor); | ||
}); | ||
exports.default = index; | ||
exports.default = EmailEditor; | ||
//# sourceMappingURL=react-email-editor.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=[],o=!1,l=function(){if(o)for(var e;e=a.shift();)e()},i=0,c=function(e,c){var s=e.onLoad,u=e.onReady,d=e.scriptUrl,f=e.minHeight,p=void 0===f?500:f,v=e.style,b=void 0===v?{}:v,g=t.useRef(e.editorId||"editor-"+ ++i),m=t.useRef(!1),y=t.useState(null),h=y[0],j=y[1],C=t.useCallback((function(){if(!m.current){m.current=!0;var t=e.options||{};e.projectId&&(t.projectId=e.projectId),e.tools&&(t.tools=e.tools),e.appearance&&(t.appearance=e.appearance),e.locale&&(t.locale=e.locale),j(unlayer.createEditor(r({},t,{id:g.current,displayMode:"email",source:{name:"react-email-editor",version:"1.7.3"}})))}}),[g.current,e.appearance,e.locale,e.options,e.projectId,e.tools]),E=t.useCallback((function(e,t){null==h||h.addEventListener(e,t)}),[h]),k=t.useCallback((function(e,t){null==h||h.registerCallback(e,t)}),[h]),x=t.useCallback((function(e){null==h||h.loadDesign(e)}),[h]),I=t.useCallback((function(e){null==h||h.saveDesign(e)}),[h]),O=t.useCallback((function(e){null==h||h.exportHtml(e)}),[h]),H=t.useCallback((function(e){null==h||h.setMergeTags(e)}),[h]);return t.useEffect((function(){!function(e,t){if(void 0===t&&(t="https://editor.unlayer.com/embed.js?2"),function(e){a.push(e)}(e),function(e){var t=document.querySelectorAll("script"),n=!1;return t.forEach((function(t){t.src.includes(e)&&(n=!0)})),n}(t))l();else{var n=document.createElement("script");n.setAttribute("src",t),n.onload=function(){o=!0,l()},document.head.appendChild(n)}}(C,d)}),[C,d]),t.useEffect((function(){if(h){for(var t=0,n=Object.entries(e);t<n.length;t++){var r=n[t],a=r[0],o=r[1];/^on/.test(a)&&"onLoad"!==a&&"onReady"!==a&&E(a,o)}s&&s(),u&&h.addEventListener("editor:ready",u)}}),[h,E,s,u,e]),t.useImperativeHandle(c,(function(){return{saveDesign:I,exportHtml:O,setMergeTags:H,editor:h,loadDesign:x,registerCallback:k,addEventListener:E}}),[I,O,H,h,x,k,E]),n.createElement("div",{style:{flex:1,display:"flex",minHeight:p}},n.createElement("div",{id:g.current,style:r({},b,{flex:1})}))};exports.default=n.forwardRef(c); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(){return(r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var a=[],l=!1,o=function(){if(l)for(var e;e=a.shift();)e()},c=0;exports.default=n.forwardRef((function(e,i){var u=e.onLoad,s=e.onReady,d=e.scriptUrl,f=e.minHeight,p=void 0===f?500:f,v=e.style,b=void 0===v?{}:v,g=t.useRef(e.editorId||"editor-"+ ++c),m=t.useRef(!1),y=t.useState(null),h=y[0],k=y[1],j=t.useCallback((function(){if(!m.current){m.current=!0;var t=e.options||{};e.projectId&&(t.projectId=e.projectId),e.tools&&(t.tools=e.tools),e.appearance&&(t.appearance=e.appearance),e.locale&&(t.locale=e.locale),k(unlayer.createEditor(r({},t,{id:g.current,displayMode:"email",source:{name:"react-email-editor",version:"1.7.4"}})))}}),[g.current,e.appearance,e.locale,e.options,e.projectId,e.tools]),C=t.useCallback((function(e,t){null==h||h.addEventListener(e,t)}),[h]),E=t.useCallback((function(e,t){null==h||h.registerCallback(e,t)}),[h]),x=t.useCallback((function(e){null==h||h.loadDesign(e)}),[h]),I=t.useCallback((function(e){null==h||h.saveDesign(e)}),[h]),O=t.useCallback((function(e,t){null==h||h.exportHtml(e,t)}),[h]),H=t.useCallback((function(e){null==h||h.setMergeTags(e)}),[h]),L=t.useCallback((function(e){null==h||h.loadBlank(e)}),[h]);return t.useEffect((function(){!function(e,t){if(void 0===t&&(t="https://editor.unlayer.com/embed.js?2"),function(e){a.push(e)}(e),function(e){var t=document.querySelectorAll("script"),n=!1;return t.forEach((function(t){t.src.includes(e)&&(n=!0)})),n}(t))o();else{var n=document.createElement("script");n.setAttribute("src",t),n.onload=function(){l=!0,o()},document.head.appendChild(n)}}(j,d)}),[j,d]),t.useEffect((function(){if(h){for(var t=0,n=Object.entries(e);t<n.length;t++){var r=n[t],a=r[0],l=r[1];/^on/.test(a)&&"onLoad"!==a&&"onReady"!==a&&C(a,l)}u&&u(),s&&h.addEventListener("editor:ready",s)}}),[h,C,u,s,e]),t.useImperativeHandle(i,(function(){return{saveDesign:I,exportHtml:O,setMergeTags:H,editor:h,loadDesign:x,registerCallback:E,addEventListener:C,loadBlank:L}}),[I,O,H,h,x,E,C,L]),n.createElement("div",{style:{flex:1,display:"flex",minHeight:p}},n.createElement("div",{id:g.current,style:r({},b,{flex:1})}))})); | ||
//# sourceMappingURL=react-email-editor.cjs.production.min.js.map |
@@ -19,3 +19,3 @@ import React, { useRef, useState, useCallback, useEffect, useImperativeHandle } from 'react'; | ||
var name = "react-email-editor"; | ||
var version = "1.7.3"; | ||
var version = "1.7.4"; | ||
var description = "Unlayer's Email Editor Component for React.js"; | ||
@@ -131,3 +131,3 @@ var main = "dist/index.js"; | ||
var lastEditorId = 0; | ||
var EmailEditor = function EmailEditor(props, ref) { | ||
var EmailEditor = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
var onLoad = props.onLoad, | ||
@@ -174,4 +174,4 @@ onReady = props.onReady, | ||
}, [editor]); | ||
var exportHtml = useCallback(function (callback) { | ||
editor == null ? void 0 : editor.exportHtml(callback); | ||
var exportHtml = useCallback(function (callback, options) { | ||
editor == null ? void 0 : editor.exportHtml(callback, options); | ||
}, [editor]); | ||
@@ -181,2 +181,5 @@ var setMergeTags = useCallback(function (mergeTags) { | ||
}, [editor]); | ||
var loadBlank = useCallback(function (options) { | ||
editor == null ? void 0 : editor.loadBlank(options); | ||
}, [editor]); | ||
useEffect(function () { | ||
@@ -208,5 +211,6 @@ loadScript(loadEditor, scriptUrl); | ||
registerCallback: registerCallback, | ||
addEventListener: addEventListener | ||
addEventListener: addEventListener, | ||
loadBlank: loadBlank | ||
}; | ||
}, [saveDesign, exportHtml, setMergeTags, editor, loadDesign, registerCallback, addEventListener]); | ||
}, [saveDesign, exportHtml, setMergeTags, editor, loadDesign, registerCallback, addEventListener, loadBlank]); | ||
return React.createElement("div", { | ||
@@ -224,6 +228,5 @@ style: { | ||
})); | ||
}; | ||
var index = /*#__PURE__*/React.forwardRef(EmailEditor); | ||
}); | ||
export default index; | ||
export default EmailEditor; | ||
//# sourceMappingURL=react-email-editor.esm.js.map |
@@ -1,35 +0,190 @@ | ||
export declare type EditorOptions = { | ||
projectId?: number; | ||
appearance?: string; | ||
locale?: string; | ||
[name: string]: any; | ||
import { CSSProperties } from 'react'; | ||
export declare type ThemeColor = 'light' | 'dark'; | ||
export declare type DockPosition = 'right' | 'left'; | ||
export declare type Device = 'desktop' | 'tablet' | 'mobile'; | ||
export interface AppearanceConfig { | ||
theme?: ThemeColor | undefined; | ||
panels?: { | ||
tools?: { | ||
dock: DockPosition; | ||
} | undefined; | ||
} | undefined; | ||
} | ||
export interface User { | ||
id?: number | undefined; | ||
name?: string | undefined; | ||
email?: string | undefined; | ||
} | ||
export interface GroupedSpecialLink { | ||
name: string; | ||
specialLinks: Array<SimpleSpecialLink | GroupedSpecialLink>; | ||
} | ||
export interface SimpleSpecialLink { | ||
name: string; | ||
href: string; | ||
target: string; | ||
} | ||
export declare type SpecialLink = SimpleSpecialLink | GroupedSpecialLink; | ||
export interface GroupedMergeTag { | ||
name: string; | ||
mergeTags: Array<SimpleMergeTag | GroupedMergeTag>; | ||
} | ||
export interface SimpleMergeTag { | ||
name: string; | ||
value: string; | ||
sample?: string; | ||
} | ||
export interface ConditionalMergeTagRule { | ||
name: string; | ||
before: string; | ||
after: string; | ||
} | ||
export interface ConditionalMergeTag { | ||
name: string; | ||
rules: ConditionalMergeTagRule[]; | ||
mergeTags?: SimpleMergeTag[] | undefined; | ||
} | ||
export declare type MergeTag = SimpleMergeTag | ConditionalMergeTag | GroupedMergeTag; | ||
export interface DesignTagConfig { | ||
delimiter: [string, string]; | ||
} | ||
export interface DisplayCondition { | ||
type: string; | ||
label: string; | ||
description: string; | ||
before: string; | ||
after: string; | ||
} | ||
export declare type EmptyDisplayCondition = object; | ||
export interface ToolPropertiesConfig { | ||
[key: string]: { | ||
value: string; | ||
}; | ||
} | ||
export interface ToolConfig { | ||
enabled?: boolean | undefined; | ||
position?: number | undefined; | ||
properties?: ToolPropertiesConfig | StringList | undefined; | ||
} | ||
export interface ToolsConfig { | ||
[key: string]: ToolConfig; | ||
} | ||
export interface EditorConfig { | ||
minRows?: number | undefined; | ||
maxRows?: number | undefined; | ||
} | ||
export interface Features { | ||
audit?: boolean | undefined; | ||
preview?: boolean | undefined; | ||
imageEditor?: boolean | undefined; | ||
undoRedo?: boolean | undefined; | ||
stockImages?: boolean | undefined; | ||
textEditor?: TextEditor | undefined; | ||
} | ||
export interface TextEditor { | ||
spellChecker?: boolean | undefined; | ||
tables?: boolean | undefined; | ||
cleanPaste?: boolean | undefined; | ||
emojis?: boolean | undefined; | ||
} | ||
export declare type Translations = Record<string, Record<string, string>>; | ||
export declare type DisplayMode = 'email' | 'web'; | ||
export interface UnlayerOptions { | ||
id?: string | undefined; | ||
displayMode?: DisplayMode | undefined; | ||
projectId?: number | undefined; | ||
locale?: string | undefined; | ||
appearance?: AppearanceConfig | undefined; | ||
user?: User | undefined; | ||
mergeTags?: MergeTag[] | undefined; | ||
specialLinks?: SpecialLink[] | undefined; | ||
designTags?: StringList | undefined; | ||
designTagsConfig?: DesignTagConfig | undefined; | ||
tools?: ToolsConfig | undefined; | ||
blocks?: object[] | undefined; | ||
editor?: EditorConfig | undefined; | ||
safeHtml?: boolean | undefined; | ||
customJS?: string[] | undefined; | ||
customCSS?: string[] | undefined; | ||
features?: Features | undefined; | ||
translations?: Translations | undefined; | ||
displayConditions?: DisplayCondition[] | undefined; | ||
} | ||
export interface EmailEditorProps { | ||
editorId?: string | undefined; | ||
style?: CSSProperties | undefined; | ||
minHeight?: number | string | undefined; | ||
options?: UnlayerOptions | undefined; | ||
tools?: ToolsConfig | undefined; | ||
appearance?: AppearanceConfig | undefined; | ||
projectId?: number | undefined; | ||
scriptUrl?: string | undefined; | ||
locale?: string | undefined; | ||
/** @deprecated Use **onReady** instead */ | ||
onLoad?(): void; | ||
onReady?(): void; | ||
} | ||
export interface HtmlExport { | ||
design: Design; | ||
html: string; | ||
} | ||
export interface HtmlOptions { | ||
cleanup: boolean; | ||
minify: boolean; | ||
} | ||
export interface FileInfo { | ||
accepted: File[]; | ||
attachments: File[]; | ||
} | ||
export interface FileUploadDoneData { | ||
progress: number; | ||
url?: string | undefined; | ||
} | ||
export interface Design { | ||
counters?: object | undefined; | ||
body: { | ||
rows: object[]; | ||
values?: object | undefined; | ||
}; | ||
} | ||
export declare type SaveDesignCallback = (data: Design) => void; | ||
export declare type ExportHtmlCallback = (data: HtmlExport) => void; | ||
export declare type EventCallback = (data: object) => void; | ||
export declare type FileUploadCallback = (file: FileInfo, done: FileUploadDoneCallback) => void; | ||
export declare type FileUploadDoneCallback = (data: FileUploadDoneData) => void; | ||
export declare type DisplayConditionDoneCallback = (data: DisplayCondition | null) => void; | ||
export declare type DisplayConditionCallback = (data: DisplayCondition | EmptyDisplayCondition, done: DisplayConditionDoneCallback) => void; | ||
export declare type RegisterCallback = { | ||
(type: 'image', callback: FileUploadCallback): void; | ||
(type: 'displayCondition', callback: DisplayConditionCallback): void; | ||
}; | ||
export declare type MergeTag = Record<string, any>; | ||
export declare type Editor = { | ||
destroy: () => void; | ||
id: number; | ||
ready: boolean; | ||
iframe: HTMLIFrameElement; | ||
addEventListener: (type: string, callback: Function) => void; | ||
registerCallback: (type: string, callback: Function) => void; | ||
loadDesign: (design: object) => void; | ||
saveDesign: (callback: Function) => void; | ||
exportHtml: (callback: Function) => void; | ||
showPreview: (device: string) => void; | ||
export declare type AddEventListener = (type: string, callback: EventCallback) => void; | ||
export declare type LoadBlank = (options: object) => void; | ||
export declare type LoadDesign = (design: Design) => void; | ||
export declare type SaveDesign = (callback: SaveDesignCallback) => void; | ||
export declare type ExportHtml = (callback: ExportHtmlCallback, options?: HtmlOptions) => void; | ||
export declare type SetMergeTags = (mergeTags: Array<MergeTag>) => void; | ||
export interface EditorMethods { | ||
saveDesign: SaveDesign; | ||
exportHtml: ExportHtml; | ||
setMergeTags: SetMergeTags; | ||
loadDesign: LoadDesign; | ||
registerCallback: RegisterCallback; | ||
addEventListener: AddEventListener; | ||
loadBlank: LoadBlank; | ||
} | ||
export interface Editor extends EditorMethods { | ||
hidePreview: () => void; | ||
setMergeTags: (mergeTags: MergeTag[]) => void; | ||
}; | ||
export declare type EditorRef = { | ||
saveDesign: (callback: Function) => void; | ||
exportHtml: (callback: Function) => void; | ||
setMergeTags: (mergeTags: MergeTag[]) => void; | ||
showPreview: (device: Device) => void; | ||
} | ||
export interface EditorRef extends EditorMethods { | ||
editor: Editor | null; | ||
loadDesign: (design: object) => void; | ||
registerCallback: (type: string, callback: Function) => void; | ||
}; | ||
} | ||
export {}; | ||
interface StringList { | ||
[key: string]: string; | ||
} | ||
declare global { | ||
const unlayer: { | ||
createEditor: (options: { | ||
id: string; | ||
displayMode: string; | ||
createEditor: (options: UnlayerOptions & { | ||
source: { | ||
@@ -39,4 +194,4 @@ name: string; | ||
}; | ||
} & EditorOptions) => Editor; | ||
}) => Editor; | ||
}; | ||
} |
{ | ||
"name": "react-email-editor", | ||
"version": "1.7.3", | ||
"version": "1.7.4", | ||
"description": "Unlayer's Email Editor Component for React.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
265
src/types.ts
@@ -1,44 +0,247 @@ | ||
export type EditorOptions = { | ||
projectId?: number; | ||
appearance?: string; | ||
locale?: string; | ||
[name: string]: any; | ||
import { CSSProperties } from 'react'; | ||
export type ThemeColor = 'light' | 'dark'; | ||
export type DockPosition = 'right' | 'left'; | ||
export type Device = 'desktop' | 'tablet' | 'mobile'; | ||
export interface AppearanceConfig { | ||
theme?: ThemeColor | undefined; | ||
panels?: | ||
| { | ||
tools?: | ||
| { | ||
dock: DockPosition; | ||
} | ||
| undefined; | ||
} | ||
| undefined; | ||
} | ||
export interface User { | ||
id?: number | undefined; | ||
name?: string | undefined; | ||
email?: string | undefined; | ||
} | ||
export interface GroupedSpecialLink { | ||
name: string; | ||
specialLinks: Array<SimpleSpecialLink | GroupedSpecialLink>; | ||
} | ||
export interface SimpleSpecialLink { | ||
name: string; | ||
href: string; | ||
target: string; | ||
} | ||
export type SpecialLink = SimpleSpecialLink | GroupedSpecialLink; | ||
export interface GroupedMergeTag { | ||
name: string; | ||
mergeTags: Array<SimpleMergeTag | GroupedMergeTag>; | ||
} | ||
export interface SimpleMergeTag { | ||
name: string; | ||
value: string; | ||
sample?: string; | ||
} | ||
export interface ConditionalMergeTagRule { | ||
name: string; | ||
before: string; | ||
after: string; | ||
} | ||
export interface ConditionalMergeTag { | ||
name: string; | ||
rules: ConditionalMergeTagRule[]; | ||
mergeTags?: SimpleMergeTag[] | undefined; | ||
} | ||
export type MergeTag = SimpleMergeTag | ConditionalMergeTag | GroupedMergeTag; | ||
export interface DesignTagConfig { | ||
delimiter: [string, string]; | ||
} | ||
export interface DisplayCondition { | ||
type: string; | ||
label: string; | ||
description: string; | ||
before: string; | ||
after: string; | ||
} | ||
export type EmptyDisplayCondition = object; | ||
export interface ToolPropertiesConfig { | ||
[key: string]: { value: string }; | ||
} | ||
export interface ToolConfig { | ||
enabled?: boolean | undefined; | ||
position?: number | undefined; | ||
properties?: ToolPropertiesConfig | StringList | undefined; | ||
} | ||
export interface ToolsConfig { | ||
[key: string]: ToolConfig; | ||
} | ||
export interface EditorConfig { | ||
minRows?: number | undefined; | ||
maxRows?: number | undefined; | ||
} | ||
export interface Features { | ||
audit?: boolean | undefined; | ||
preview?: boolean | undefined; | ||
imageEditor?: boolean | undefined; | ||
undoRedo?: boolean | undefined; | ||
stockImages?: boolean | undefined; | ||
textEditor?: TextEditor | undefined; | ||
} | ||
export interface TextEditor { | ||
spellChecker?: boolean | undefined; | ||
tables?: boolean | undefined; | ||
cleanPaste?: boolean | undefined; | ||
emojis?: boolean | undefined; | ||
} | ||
export type Translations = Record<string, Record<string, string>>; | ||
export type DisplayMode = 'email' | 'web'; | ||
export interface UnlayerOptions { | ||
id?: string | undefined; | ||
displayMode?: DisplayMode | undefined; | ||
projectId?: number | undefined; | ||
locale?: string | undefined; | ||
appearance?: AppearanceConfig | undefined; | ||
user?: User | undefined; | ||
mergeTags?: MergeTag[] | undefined; | ||
specialLinks?: SpecialLink[] | undefined; | ||
designTags?: StringList | undefined; | ||
designTagsConfig?: DesignTagConfig | undefined; | ||
tools?: ToolsConfig | undefined; | ||
blocks?: object[] | undefined; | ||
editor?: EditorConfig | undefined; | ||
safeHtml?: boolean | undefined; | ||
customJS?: string[] | undefined; | ||
customCSS?: string[] | undefined; | ||
features?: Features | undefined; | ||
translations?: Translations | undefined; | ||
displayConditions?: DisplayCondition[] | undefined; | ||
} | ||
export interface EmailEditorProps { | ||
editorId?: string | undefined; | ||
style?: CSSProperties | undefined; | ||
minHeight?: number | string | undefined; | ||
options?: UnlayerOptions | undefined; | ||
tools?: ToolsConfig | undefined; | ||
appearance?: AppearanceConfig | undefined; | ||
projectId?: number | undefined; | ||
scriptUrl?: string | undefined; | ||
locale?: string | undefined; | ||
/** @deprecated Use **onReady** instead */ | ||
onLoad?(): void; | ||
onReady?(): void; | ||
} | ||
export interface HtmlExport { | ||
design: Design; | ||
html: string; | ||
} | ||
export interface HtmlOptions { | ||
cleanup: boolean; | ||
minify: boolean; | ||
} | ||
export interface FileInfo { | ||
accepted: File[]; | ||
attachments: File[]; | ||
} | ||
export interface FileUploadDoneData { | ||
progress: number; | ||
url?: string | undefined; | ||
} | ||
export interface Design { | ||
counters?: object | undefined; | ||
body: { | ||
rows: object[]; | ||
values?: object | undefined; | ||
}; | ||
} | ||
export type SaveDesignCallback = (data: Design) => void; | ||
export type ExportHtmlCallback = (data: HtmlExport) => void; | ||
export type EventCallback = (data: object) => void; | ||
export type FileUploadCallback = ( | ||
file: FileInfo, | ||
done: FileUploadDoneCallback | ||
) => void; | ||
export type FileUploadDoneCallback = (data: FileUploadDoneData) => void; | ||
export type DisplayConditionDoneCallback = ( | ||
data: DisplayCondition | null | ||
) => void; | ||
export type DisplayConditionCallback = ( | ||
data: DisplayCondition | EmptyDisplayCondition, | ||
done: DisplayConditionDoneCallback | ||
) => void; | ||
export type RegisterCallback = { | ||
(type: 'image', callback: FileUploadCallback): void; | ||
(type: 'displayCondition', callback: DisplayConditionCallback): void; | ||
}; | ||
export type AddEventListener = (type: string, callback: EventCallback) => void; | ||
export type LoadBlank = (options: object) => void; | ||
export type LoadDesign = (design: Design) => void; | ||
export type SaveDesign = (callback: SaveDesignCallback) => void; | ||
export type ExportHtml = ( | ||
callback: ExportHtmlCallback, | ||
options?: HtmlOptions | ||
) => void; | ||
export type SetMergeTags = (mergeTags: Array<MergeTag>) => void; | ||
export type MergeTag = Record<string, any>; | ||
export interface EditorMethods { | ||
saveDesign: SaveDesign; | ||
exportHtml: ExportHtml; | ||
setMergeTags: SetMergeTags; | ||
loadDesign: LoadDesign; | ||
registerCallback: RegisterCallback; | ||
addEventListener: AddEventListener; | ||
loadBlank: LoadBlank; | ||
} | ||
export type Editor = { | ||
destroy: () => void; | ||
id: number; | ||
ready: boolean; | ||
iframe: HTMLIFrameElement; | ||
addEventListener: (type: string, callback: Function) => void; | ||
registerCallback: (type: string, callback: Function) => void; | ||
loadDesign: (design: object) => void; | ||
saveDesign: (callback: Function) => void; | ||
exportHtml: (callback: Function) => void; | ||
showPreview: (device: string) => void; | ||
export interface Editor extends EditorMethods { | ||
hidePreview: () => void; | ||
setMergeTags: (mergeTags: MergeTag[]) => void; | ||
}; | ||
showPreview: (device: Device) => void; | ||
} | ||
export type EditorRef = { | ||
saveDesign: (callback: Function) => void; | ||
exportHtml: (callback: Function) => void; | ||
setMergeTags: (mergeTags: MergeTag[]) => void; | ||
export interface EditorRef extends EditorMethods { | ||
editor: Editor | null; | ||
loadDesign: (design: object) => void; | ||
registerCallback: (type: string, callback: Function) => void; | ||
}; | ||
} | ||
export {}; | ||
interface StringList { | ||
[key: string]: string; | ||
} | ||
declare global { | ||
const unlayer: { | ||
createEditor: ( | ||
options: { | ||
id: string; | ||
displayMode: string; | ||
source: { name: string; version: string }; | ||
} & EditorOptions | ||
options: UnlayerOptions & { | ||
source: { | ||
name: string; | ||
version: string; | ||
}; | ||
} | ||
) => Editor; | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70816
18
1069