unlayer-types 1.46.0 → 1.52.0

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.
Files changed (2) hide show
  1. package/embed.d.ts +123 -14
  2. package/package.json +1 -1
package/embed.d.ts CHANGED
@@ -1,6 +1,90 @@
1
+ /// <reference types="dompurify" />
2
+ /// <reference types="lodash" />
1
3
  /// <reference types="react" />
2
4
  /// <reference types="react-modal" />
3
- /// <reference types="lodash" />
5
+ declare module "engine/config/editorSettings" {
6
+ export interface EditorSettings {
7
+ minHeaders?: number;
8
+ maxHeaders?: number;
9
+ minFooters?: number;
10
+ maxFooters?: number;
11
+ minRows?: number;
12
+ maxRows?: number;
13
+ contentType?: 'page' | 'block';
14
+ autoSelectOnDrop: boolean;
15
+ columns?: boolean;
16
+ confirmOnDelete?: boolean;
17
+ }
18
+ export function overrideEditorSettings(editorSettingsOverrides: EditorSettings): void;
19
+ export function getEditorSettings(): EditorSettings;
20
+ }
21
+ declare module "engine/config/features" {
22
+ export interface TextEditorCustomButton {
23
+ name: string;
24
+ icon: string;
25
+ text: string;
26
+ onSetup?: () => void;
27
+ onAction: (data: {
28
+ text: string;
29
+ }, callback: (text: string) => void) => void;
30
+ }
31
+ export interface Features {
32
+ audit?: boolean;
33
+ blocks?: boolean;
34
+ collaboration?: boolean;
35
+ preview?: boolean;
36
+ imageEditor?: {
37
+ enabled: boolean;
38
+ tools?: {
39
+ resize?: boolean;
40
+ };
41
+ } | boolean;
42
+ preheaderText?: boolean;
43
+ stockImages?: {
44
+ enabled: true;
45
+ safeSearch: true;
46
+ defaultSearchTerm: string;
47
+ } | boolean;
48
+ userUploads?: boolean | {
49
+ enabled: boolean;
50
+ search?: boolean;
51
+ };
52
+ undoRedo?: boolean;
53
+ textEditor?: {
54
+ spellChecker?: boolean;
55
+ tables?: boolean;
56
+ cleanPaste?: boolean | 'basic' | 'confirm';
57
+ emojis?: boolean;
58
+ textDirection?: boolean | null;
59
+ inlineFontControls?: boolean;
60
+ defaultFontSize?: string;
61
+ customButtons?: TextEditorCustomButton[];
62
+ };
63
+ colorPicker?: {
64
+ presets?: string[];
65
+ };
66
+ legacy?: {
67
+ disableHoverButtonColors?: boolean;
68
+ };
69
+ inboxPreviews?: boolean;
70
+ pageAnchors?: boolean;
71
+ svgImageUpload?: boolean;
72
+ smartMergeTags?: boolean;
73
+ ai?: boolean | {
74
+ smartHeadings?: boolean;
75
+ smartButtons?: boolean;
76
+ magicImage?: boolean;
77
+ smartText?: boolean;
78
+ };
79
+ sendTestEmail?: boolean;
80
+ }
81
+ export function setFeatures(newFeatures: Features): void;
82
+ export function setOverrideFeatures(overrideFeatures: Features): void;
83
+ export function overrideFeatures(newOverrideFeatures: Features): void;
84
+ export function getFeatures(): Features;
85
+ export function getFeature(path: string | string[]): any;
86
+ export function hasFeature(path: string | string[]): boolean;
87
+ }
4
88
  declare module "engine/config/offline" {
5
89
  export function enableOffline(): void;
6
90
  export function isOffline(): boolean;
@@ -61,6 +145,26 @@ declare module "engine/config/fonts" {
61
145
  export function getCustomFontsCount(): number;
62
146
  export const defaultFontWeights: number[];
63
147
  }
148
+ declare module "engine/config/safeHtml" {
149
+ import { Config } from 'dompurify';
150
+ export interface SafeHtmlOptions {
151
+ domPurifyOptions?: Config;
152
+ }
153
+ export function isSafeHtmlEnabled(): boolean;
154
+ export function enableSafeHtml(): void;
155
+ export function setSafeHtmlOptions(options?: SafeHtmlOptions): void;
156
+ function _toSafeHtmlInternal(html: string, { allowOnClick, force }?: {
157
+ allowOnClick?: boolean;
158
+ force?: boolean;
159
+ }): string;
160
+ export const toSafeHtmlInternal: typeof _toSafeHtmlInternal & import("lodash").MemoizedFunction;
161
+ function _toSafeHtml(html: string, { allowOnClick, force, domPurifyOptions, }?: {
162
+ allowOnClick?: boolean;
163
+ force?: boolean;
164
+ domPurifyOptions?: SafeHtmlOptions['domPurifyOptions'];
165
+ }): any;
166
+ export const toSafeHtml: typeof _toSafeHtml & import("lodash").MemoizedFunction;
167
+ }
64
168
  declare module "engine/translations/types" {
65
169
  import stockTranslations from '.';
66
170
  export type StockLocale = keyof typeof stockTranslations;
@@ -1405,9 +1509,8 @@ declare module "state/types/types" {
1405
1509
  actionBar?: {
1406
1510
  placement?: 'top' | 'bottom' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right' | undefined;
1407
1511
  };
1408
- features?: {
1409
- preview?: boolean;
1410
- };
1512
+ /** @deprecated Use unlayer.init({ features: { ... }}) instead */
1513
+ features?: object;
1411
1514
  loader?: {
1412
1515
  url?: string | undefined;
1413
1516
  html?: string | undefined;
@@ -1445,9 +1548,12 @@ declare module "state/types/types" {
1445
1548
  }
1446
1549
  declare module "embed/Config" {
1447
1550
  import { ValidationResult } from 'amphtml-validator';
1551
+ import { EditorSettings } from "engine/config/editorSettings";
1552
+ import { Features } from "engine/config/features";
1448
1553
  import { FontList } from "engine/config/fonts";
1554
+ import { SafeHtmlOptions } from "engine/config/safeHtml";
1449
1555
  import { TextDirection } from "engine/config/intl";
1450
- import { AppearanceConfig, Audit, Device, DisplayConditions, DisplayMode, Fonts, JSONTemplate, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, MergeTagsValues, SpecialLinks, Tabs, ToolsConfig, User } from "state/types/types";
1556
+ import { AppearanceConfig, Audit, DesignTags, DesignTagsConfig, Device, DisplayConditions, DisplayMode, Fonts, JSONTemplate, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, MergeTagsValues, SpecialLinks, Tabs, ToolsConfig, User } from "state/types/types";
1451
1557
  import { DeepPartial } from "editor/components/editors/types";
1452
1558
  export interface Config {
1453
1559
  id?: string;
@@ -1471,28 +1577,29 @@ declare module "embed/Config" {
1471
1577
  templateId?: number;
1472
1578
  stockTemplateId?: string;
1473
1579
  loadTimeout?: number;
1474
- safeHtml?: boolean | object;
1475
- safeHTML?: boolean | object;
1580
+ safeHtml?: boolean | SafeHtmlOptions;
1581
+ /** @deprecated use safeHtml instead */
1582
+ safeHTML?: boolean | SafeHtmlOptions;
1476
1583
  options?: object;
1477
1584
  tools?: ToolsConfig;
1478
1585
  excludeTools?: string[];
1479
1586
  blocks?: object[];
1480
- editor?: object;
1587
+ editor?: Partial<EditorSettings>;
1481
1588
  fonts?: Fonts;
1482
1589
  linkTypes?: LinkTypes;
1483
1590
  linkTypesSharedConfig?: LinkTypesSharedConfig;
1484
1591
  mergeTags?: MergeTags;
1485
1592
  displayConditions?: DisplayConditions;
1486
1593
  specialLinks?: SpecialLinks;
1487
- designTags?: object;
1594
+ designTags?: DesignTags;
1488
1595
  customCSS?: string | string[];
1489
1596
  customJS?: string | string[];
1490
1597
  locale?: string;
1491
1598
  textDirection?: TextDirection;
1492
- translations?: object;
1599
+ translations?: Record<string, Record<string, string>>;
1493
1600
  appearance?: DeepPartial<AppearanceConfig>;
1494
- features?: object;
1495
- designTagsConfig?: object;
1601
+ features?: Features;
1602
+ designTagsConfig?: DesignTagsConfig;
1496
1603
  mergeTagsConfig?: MergeTagsConfig;
1497
1604
  validator?: (info: {
1498
1605
  html: ExportHtmlResult;
@@ -1712,20 +1819,21 @@ declare module "editor/hooks/useDynamicRef" {
1712
1819
  declare module "editor/design-system/components/Input" {
1713
1820
  import React from 'react';
1714
1821
  import * as Ariakit from '@ariakit/react';
1715
- export interface InputProps extends Omit<Ariakit.FormInputProps, 'as'> {
1822
+ export interface InputProps extends Omit<Ariakit.FormInputProps, 'as' | 'onSubmit' | 'onSubmitCapture'> {
1716
1823
  formStore?: Ariakit.FormStore<{
1717
1824
  value: string;
1718
1825
  }>;
1719
1826
  label?: React.ReactNode;
1720
1827
  labelPosition?: 'top' | 'left' | 'right';
1721
1828
  name: string;
1829
+ onSubmit?: (value: string | number) => void;
1722
1830
  placeholder?: string;
1723
1831
  required?: boolean;
1724
1832
  type?: Ariakit.FormInputProps['type'] | 'textarea';
1725
1833
  validationDOMTarget?: HTMLDivElement | null;
1726
1834
  validationMessage?: string;
1727
1835
  validationStatus?: 'error' | 'warn' | 'success';
1728
- value: Ariakit.FormInputProps['value'];
1836
+ value: string | number;
1729
1837
  }
1730
1838
  export const Input: React.ForwardRefExoticComponent<Pick<InputProps, keyof InputProps> & React.RefAttributes<HTMLInputElement>>;
1731
1839
  export const S: {
@@ -2509,6 +2617,7 @@ declare module "embed/Editor" {
2509
2617
  import { DeepPartial } from "editor/components/editors/types";
2510
2618
  export const LATEST_VERSION: string;
2511
2619
  export const STABLE_VERSION: string;
2620
+ export const DEFAULT_VERSION: string;
2512
2621
  export class Editor {
2513
2622
  frame: Frame | null;
2514
2623
  constructor(config?: Config);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "unlayer-types",
3
- "version": "1.46.0",
3
+ "version": "1.52.0",
4
4
  "license": "MIT"
5
5
  }