tinymce-rails 5.10.4 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -18
  3. data/Rakefile +1 -2
  4. data/app/assets/javascripts/tinymce/rails.js +1 -1
  5. data/app/assets/source/tinymce/tinymce.js +18828 -19841
  6. data/lib/tinymce/rails/configuration.rb +1 -1
  7. data/lib/tinymce/rails/version.rb +2 -2
  8. data/vendor/assets/javascripts/tinymce/license.txt +21 -504
  9. data/vendor/assets/javascripts/tinymce/models/dom/model.js +4 -0
  10. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -7
  11. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -7
  12. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -7
  13. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -7
  14. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +2 -7
  15. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -7
  16. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +2 -7
  17. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -7
  18. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +2 -7
  19. data/vendor/assets/javascripts/tinymce/plugins/emoticons/js/emojiimages.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/emoticons/js/emojis.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -7
  22. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -7
  23. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -7
  24. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -7
  25. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -7
  26. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -7
  27. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -7
  28. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -7
  29. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -7
  30. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +2 -7
  31. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -7
  32. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +2 -7
  33. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -7
  34. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +2 -7
  35. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -7
  36. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -7
  37. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +2 -7
  38. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +2 -7
  39. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -7
  40. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -7
  41. data/vendor/assets/javascripts/tinymce/skins/content/dark/content.css +1 -7
  42. data/vendor/assets/javascripts/tinymce/skins/content/dark/content.min.css +1 -7
  43. data/vendor/assets/javascripts/tinymce/skins/content/default/content.css +0 -6
  44. data/vendor/assets/javascripts/tinymce/skins/content/default/content.min.css +0 -6
  45. data/vendor/assets/javascripts/tinymce/skins/content/document/content.css +0 -6
  46. data/vendor/assets/javascripts/tinymce/skins/content/document/content.min.css +0 -6
  47. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5/content.css +1 -0
  48. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5/content.min.css +1 -0
  49. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5-dark/content.css +1 -0
  50. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5-dark/content.min.css +1 -0
  51. data/vendor/assets/javascripts/tinymce/skins/content/writer/content.css +0 -6
  52. data/vendor/assets/javascripts/tinymce/skins/content/writer/content.min.css +0 -6
  53. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -7
  54. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -7
  55. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -7
  56. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -7
  57. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -7
  58. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -7
  59. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.css +1 -7
  60. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -7
  61. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -7
  62. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -7
  63. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -7
  64. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -7
  65. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -7
  66. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -7
  67. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +1 -7
  68. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -7
  69. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -0
  70. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -0
  71. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -0
  72. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -0
  73. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -0
  74. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
  75. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +1 -0
  76. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  77. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -0
  78. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -0
  79. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  80. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -0
  81. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -0
  82. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  83. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +1 -0
  84. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  85. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -7
  86. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +967 -1127
  87. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -7
  88. metadata +22 -30
  89. data/app/assets/javascripts/tinymce-jquery.js +0 -2
  90. data/vendor/assets/config/tinymce-rails.manifest.js +0 -3
  91. data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +0 -91
  92. data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +0 -9
  93. data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +0 -9
  94. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +0 -9
  95. data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +0 -9
  96. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +0 -9
  97. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +0 -9
  98. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +0 -9
  99. data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +0 -9
  100. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +0 -9
  101. data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +0 -9
  102. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +0 -9
  103. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +0 -9
  104. data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +0 -9
  105. data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +0 -9
  106. data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +0 -9
  107. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.mobile.css +0 -7
  108. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.mobile.min.css +0 -7
  109. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
  110. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.mobile.css +0 -7
  111. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.mobile.min.css +0 -7
  112. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.mobile.css +0 -7
  113. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.mobile.min.css +0 -7
  114. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/fonts/tinymce-mobile.woff +0 -0
  115. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.mobile.css +0 -7
  116. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.mobile.min.css +0 -7
  117. data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +0 -9
@@ -91,6 +91,7 @@ declare class EventDispatcher<T> {
91
91
  private bindings;
92
92
  constructor(settings?: Record<string, any>);
93
93
  fire<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
94
+ dispatch<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
94
95
  on<K extends string>(name: K, callback: false | ((event: EditorEvent<MappedEvent<T, K>>) => void), prepend?: boolean, extra?: {}): this;
95
96
  off<K extends string>(name?: K, callback?: (event: EditorEvent<MappedEvent<T, K>>) => void): this;
96
97
  once<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void, prepend?: boolean): this;
@@ -122,213 +123,24 @@ interface UndoManager {
122
123
  ignore: (callback: () => void) => void;
123
124
  extra: (callback1: () => void, callback2: () => void) => void;
124
125
  }
125
- declare type ArrayCallback$1<T, R> = (x: T, i: number, xs: ReadonlyArray<T>) => R;
126
- declare type ObjCallback$1<T, R> = (value: T, key: string, obj: Record<string, T>) => R;
127
- declare type ArrayCallback<T, R> = ArrayCallback$1<T, R>;
128
- declare type ObjCallback<T, R> = ObjCallback$1<T, R>;
129
- interface Tools {
130
- is: (obj: any, type: string) => boolean;
131
- isArray: <T>(arr: any) => arr is Array<T>;
132
- inArray: <T>(arr: ArrayLike<T>, value: T) => number;
133
- grep: {
134
- <T>(arr: ArrayLike<T> | null | undefined, pred?: ArrayCallback<T, boolean>): T[];
135
- <T>(arr: Record<string, T> | null | undefined, pred?: ObjCallback<T, boolean>): T[];
136
- };
137
- trim: (str: string) => string;
138
- toArray: <T>(obj: ArrayLike<T>) => T[];
139
- hasOwn: (obj: any, name: string) => boolean;
140
- makeMap: <T>(items: ArrayLike<T> | string, delim?: string | RegExp, map?: Record<string, T | string>) => Record<string, T | string>;
141
- each: {
142
- <T>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, void | boolean>, scope?: any): boolean;
143
- <T>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, void | boolean>, scope?: any): boolean;
144
- };
145
- map: {
146
- <T, R>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, R>): R[];
147
- <T, R>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, R>): R[];
148
- };
149
- extend: (obj: Object, ext: Object, ...objs: Object[]) => any;
150
- create: (name: string, p: Object, root?: Object) => void;
151
- walk: <T = any>(obj: T, f: Function, n?: keyof T, scope?: any) => void;
152
- createNS: (name: string, o?: Object) => any;
153
- resolve: (path: string, o?: Object) => any;
154
- explode: (s: string, d?: string | RegExp) => string[];
155
- _addCacheSuffix: (url: string) => string;
156
- }
157
- declare type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void;
158
- declare type EventUtilsEvent<T> = NormalizedEvent<T> & {
159
- metaKey: boolean;
160
- };
161
- interface EventUtilsConstructor {
162
- readonly prototype: EventUtils;
163
- new (): EventUtils;
164
- Event: EventUtils;
165
- }
166
- declare class EventUtils {
167
- static Event: EventUtils;
168
- domLoaded: boolean;
169
- events: Record<string, any>;
170
- private readonly expando;
171
- private hasFocusIn;
172
- private hasMouseEnterLeave;
173
- private mouseEnterLeave;
174
- private count;
175
- constructor();
176
- bind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback: EventUtilsCallback<HTMLElementEventMap[K]>, scope?: any): EventUtilsCallback<HTMLElementEventMap[K]>;
177
- bind<T = any>(target: any, names: string, callback: EventUtilsCallback<T>, scope?: any): EventUtilsCallback<T>;
178
- unbind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback?: EventUtilsCallback<HTMLElementEventMap[K]>): this;
179
- unbind<T = any>(target: any, names: string, callback?: EventUtilsCallback<T>): this;
180
- unbind(target: any): this;
181
- fire(target: any, name: string, args?: {}): this;
182
- clean(target: any): this;
183
- destroy(): void;
184
- cancel<T = any>(e: EventUtilsEvent<T>): boolean;
185
- private executeHandlers;
186
- }
187
- declare type DomQuerySelector<T extends Node> = string | T | T[] | DomQuery<T>;
188
- declare type DomQueryInitSelector<T extends Node> = DomQuerySelector<T> | Window;
189
- interface Hook {
190
- get: <T extends Node>(elm: T) => string;
191
- set: <T extends Node>($elm: DomQuery<T>, value: string | null) => void;
192
- }
193
- interface DomQueryConstructor {
194
- readonly prototype: DomQuery;
195
- attrHooks: Record<string, Hook>;
196
- cssHooks: Record<string, Hook>;
197
- fn: DomQuery;
198
- find: any;
199
- expr: {
200
- cacheLength: number;
201
- createPseudo: Function;
202
- match: Record<string, RegExp>;
203
- attrHandle: {};
204
- find: Record<string, Function>;
205
- relative: Record<string, {
206
- dir: string;
207
- first?: boolean;
208
- }>;
209
- preFilter: Record<string, Function>;
210
- filter: Record<string, Function>;
211
- pseudos: Record<string, Function>;
212
- };
213
- extend: Tools['extend'];
214
- isArray: Tools['isArray'];
215
- new <T extends Node = Node>(selector?: DomQueryInitSelector<T>, context?: Node): DomQuery<T>;
216
- <T extends Node = Node>(selector?: DomQueryInitSelector<T>, context?: Node): DomQuery<T>;
217
- overrideDefaults(callback: () => {
218
- context: Node;
219
- element: Element;
220
- }): DomQueryConstructor;
221
- makeArray<T>(object: T): T[];
222
- inArray<T>(item: {}, array: T[]): number;
223
- each<T>(obj: T[], callback: (i: number, value: T) => void): void;
224
- each<T>(obj: T, callback: (key: string, obj: T[keyof T]) => void): void;
225
- trim(str: string): string;
226
- grep<T>(array: T[], callback: (item: any, i: number) => boolean): T[];
227
- unique<T>(results: T[]): T[];
228
- text(elem: Node): string;
229
- contains(context: any, elem: Node): boolean;
230
- filter(expr: string, elems: Node[], not?: boolean): any;
231
- }
232
- interface DomQuery<T extends Node = Node> extends ArrayLike<T> {
233
- init: (selector?: DomQueryInitSelector<T>, context?: Node) => void;
234
- context: T;
235
- length: number;
236
- selector: string;
237
- add(items: Array<string | T> | DomQuery<T>, sort?: boolean): this;
238
- addClass(className: string): this;
239
- after(content: DomQuerySelector<T>): this;
240
- append(content: DomQuerySelector<T>): this;
241
- appendTo(val: DomQuerySelector<T>): this;
242
- attr(name: string, value: string | boolean | number | null): this;
243
- attr(attrs: Record<string, string | boolean | number | null>): this;
244
- attr(name: string): string;
245
- before(content: DomQuerySelector<T>): this;
246
- children(selector?: string): DomQuery<Node & ChildNode>;
247
- clone(): this;
248
- closest(selector: DomQuerySelector<T>): this;
249
- contents(selector?: string): DomQuery<Node & ChildNode>;
250
- css(name: string, value: string | number | null): this;
251
- css(styles: Record<string, string | number | null>): this;
252
- css(name: string): string;
253
- each(callback: (i: number, value: T) => void): this;
254
- empty(): this;
255
- eq(index: number): this;
256
- filter(selector: string | ((i: number, item: any) => boolean)): this;
257
- find<K extends keyof HTMLElementTagNameMap>(selector: K): DomQuery<HTMLElementTagNameMap[K]>;
258
- find<T extends Node>(selector: string): DomQuery<T>;
259
- first(): this;
260
- hasClass(className: string): boolean;
261
- hide(): this;
262
- html(value: string): this;
263
- html(): string;
264
- is(selector: string | ((i: number, item: any) => boolean)): boolean;
265
- last(): this;
266
- next(selector?: string): DomQuery<Node & ChildNode>;
267
- nextUntil(selector: DomQuerySelector<T>, until?: string): DomQuery<Node & ChildNode>;
268
- off<K extends keyof HTMLElementEventMap>(name: K, callback?: EventUtilsCallback<HTMLElementEventMap[K]>): this;
269
- off<U>(name?: string, callback?: EventUtilsCallback<U>): this;
270
- offset(offset?: {}): {} | this;
271
- on<K extends keyof HTMLElementEventMap>(name: K, callback: EventUtilsCallback<HTMLElementEventMap[K]>): this;
272
- on<U>(name: string, callback: EventUtilsCallback<U>): this;
273
- parent(selector?: string): DomQuery<Node>;
274
- parents(selector?: string): DomQuery<Node>;
275
- parentsUntil(selector: DomQuerySelector<T>, filter?: string): DomQuery<Node>;
276
- prepend(content: DomQuerySelector<T>): this;
277
- prependTo(val: DomQuerySelector<T>): this;
278
- prev(selector?: string): DomQuery<Node & ChildNode>;
279
- prevUntil(selector: DomQuerySelector<T>, filter?: string): DomQuery<Node & ChildNode>;
280
- prop(name: string, value: string): this;
281
- prop(props: Record<string, string | number>): this;
282
- prop(name: string): string;
283
- push(...items: T[]): number;
284
- remove(): this;
285
- removeAttr(name: string): this;
286
- removeClass(className: string): this;
287
- replaceWith(content: DomQuerySelector<T>): this;
288
- show(): this;
289
- slice(start: number, end?: number): this;
290
- splice(start: number, deleteCount?: number): T[];
291
- sort(compareFn?: (a: T, b: T) => number): T[];
292
- text(value: string): DomQuery;
293
- text(): string;
294
- toArray(): T[];
295
- toggleClass(className: string, state?: boolean): this;
296
- trigger(name: string | {
297
- type: string;
298
- }): this;
299
- unwrap(): this;
300
- wrap(content: DomQuerySelector<T>): this;
301
- wrapAll(content: DomQuerySelector<T>): this;
302
- wrapInner(content: string): this;
303
- }
304
126
  declare type SchemaType = 'html4' | 'html5' | 'html5-strict';
305
127
  interface SchemaSettings {
306
- block_elements?: string;
307
- boolean_attributes?: string;
308
128
  custom_elements?: string;
309
129
  extended_valid_elements?: string;
310
130
  invalid_elements?: string;
311
131
  invalid_styles?: string | Record<string, string>;
312
- move_caret_before_on_enter_elements?: string;
313
- non_empty_elements?: string;
314
132
  schema?: SchemaType;
315
- self_closing_elements?: string;
316
- short_ended_elements?: string;
317
- special?: string;
318
- text_block_elements?: string;
319
- text_inline_elements?: string;
320
133
  valid_children?: string;
321
134
  valid_classes?: string | Record<string, string>;
322
135
  valid_elements?: string;
323
136
  valid_styles?: string | Record<string, string>;
324
137
  verify_html?: boolean;
325
- whitespace_elements?: string;
326
138
  }
327
139
  interface Attribute {
328
140
  required?: boolean;
329
141
  defaultValue?: string;
330
142
  forcedValue?: string;
331
- validValues?: any;
143
+ validValues?: Record<string, {}>;
332
144
  }
333
145
  interface DefaultAttribute {
334
146
  name: string;
@@ -339,7 +151,7 @@ interface AttributePattern {
339
151
  forcedValue?: string;
340
152
  pattern: RegExp;
341
153
  required?: boolean;
342
- validValues?: Record<string, string>;
154
+ validValues?: Record<string, {}>;
343
155
  }
344
156
  interface ElementRule {
345
157
  attributes: Record<string, Attribute>;
@@ -364,13 +176,14 @@ interface SchemaRegExpMap {
364
176
  [name: string]: RegExp;
365
177
  }
366
178
  interface Schema {
179
+ type: SchemaType;
367
180
  children: Record<string, SchemaMap>;
368
181
  elements: Record<string, SchemaElement>;
369
182
  getValidStyles: () => Record<string, string[]> | undefined;
370
183
  getValidClasses: () => Record<string, SchemaMap> | undefined;
371
184
  getBlockElements: () => SchemaMap;
372
185
  getInvalidStyles: () => Record<string, SchemaMap> | undefined;
373
- getShortEndedElements: () => SchemaMap;
186
+ getVoidElements: () => SchemaMap;
374
187
  getTextBlockElements: () => SchemaMap;
375
188
  getTextInlineElements: () => SchemaMap;
376
189
  getBoolAttrs: () => SchemaMap;
@@ -378,7 +191,7 @@ interface Schema {
378
191
  getSelfClosingElements: () => SchemaMap;
379
192
  getNonEmptyElements: () => SchemaMap;
380
193
  getMoveCaretBeforeOnEnterElements: () => SchemaMap;
381
- getWhiteSpaceElements: () => SchemaMap;
194
+ getWhitespaceElements: () => SchemaMap;
382
195
  getSpecialElements: () => SchemaRegExpMap;
383
196
  isValidChild: (name: string, child: string) => boolean;
384
197
  isValid: (name: string, attr?: string) => boolean;
@@ -405,14 +218,12 @@ declare class AstNode {
405
218
  type: number;
406
219
  attributes?: Attributes$1;
407
220
  value?: string;
408
- shortEnded?: boolean;
409
221
  parent?: AstNode;
410
222
  firstChild?: AstNode;
411
223
  lastChild?: AstNode;
412
224
  next?: AstNode;
413
225
  prev?: AstNode;
414
226
  raw?: boolean;
415
- fixed?: boolean;
416
227
  constructor(name: string, type: number);
417
228
  replace(node: AstNode): AstNode;
418
229
  attr(name: string, value: string | null): AstNode | undefined;
@@ -433,19 +244,29 @@ declare class AstNode {
433
244
  declare type Content = string | AstNode;
434
245
  declare type ContentFormat = 'raw' | 'text' | 'html' | 'tree';
435
246
  interface GetContentArgs {
436
- format?: ContentFormat;
437
- get?: boolean;
438
- content?: string;
439
- getInner?: boolean;
247
+ format: ContentFormat;
248
+ get: boolean;
249
+ getInner: boolean;
440
250
  no_events?: boolean;
251
+ save?: boolean;
252
+ source_view?: boolean;
441
253
  [key: string]: any;
442
254
  }
443
255
  interface SetContentArgs {
444
- format?: string;
445
- set?: boolean;
446
- content?: string;
256
+ format: string;
257
+ set: boolean;
258
+ content: Content;
447
259
  no_events?: boolean;
448
260
  no_selection?: boolean;
261
+ paste?: boolean;
262
+ }
263
+ interface GetSelectionContentArgs extends GetContentArgs {
264
+ selection?: boolean;
265
+ contextual?: boolean;
266
+ }
267
+ interface SetSelectionContentArgs extends SetContentArgs {
268
+ content: string;
269
+ selection?: boolean;
449
270
  }
450
271
  interface BlobInfoData {
451
272
  id?: string;
@@ -475,10 +296,67 @@ interface BlobCache {
475
296
  removeByUri: (blobUri: string) => void;
476
297
  destroy: () => void;
477
298
  }
299
+ interface BlobInfoImagePair {
300
+ image: HTMLImageElement;
301
+ blobInfo: BlobInfo;
302
+ }
303
+ declare class NodeChange {
304
+ private readonly editor;
305
+ private lastPath;
306
+ constructor(editor: Editor);
307
+ nodeChanged(args?: any): void;
308
+ private isSameElementPath;
309
+ }
310
+ interface SelectionOverrides {
311
+ showCaret: (direction: number, node: Element, before: boolean, scrollIntoView?: boolean) => Range | null;
312
+ showBlockCaretContainer: (blockCaretContainer: Element) => void;
313
+ hideFakeCaret: () => void;
314
+ destroy: () => void;
315
+ }
316
+ interface Quirks {
317
+ refreshContentEditable(): void;
318
+ isHidden(): boolean;
319
+ }
320
+ declare type DecoratorData = Record<string, any>;
321
+ declare type Decorator = (uid: string, data: DecoratorData) => {
322
+ attributes?: {};
323
+ classes?: string[];
324
+ };
325
+ declare type AnnotationListener = (state: boolean, name: string, data?: {
326
+ uid: string;
327
+ nodes: any[];
328
+ }) => void;
329
+ declare type AnnotationListenerApi = AnnotationListener;
330
+ interface AnnotatorSettings {
331
+ decorate: Decorator;
332
+ persistent?: boolean;
333
+ }
334
+ interface Annotator {
335
+ register: (name: string, settings: AnnotatorSettings) => void;
336
+ annotate: (name: string, data: DecoratorData) => void;
337
+ annotationChanged: (name: string, f: AnnotationListenerApi) => void;
338
+ remove: (name: string) => void;
339
+ removeAll: (name: string) => void;
340
+ getAll: (name: string) => Record<string, Element[]>;
341
+ }
342
+ interface GeomRect {
343
+ readonly x: number;
344
+ readonly y: number;
345
+ readonly w: number;
346
+ readonly h: number;
347
+ }
348
+ interface Rect {
349
+ inflate: (rect: GeomRect, w: number, h: number) => GeomRect;
350
+ relativePosition: (rect: GeomRect, targetRect: GeomRect, rel: string) => GeomRect;
351
+ findBestRelativePosition: (rect: GeomRect, targetRect: GeomRect, constrainRect: GeomRect, rels: string[]) => string | null;
352
+ intersect: (rect: GeomRect, cropRect: GeomRect) => GeomRect | null;
353
+ clamp: (rect: GeomRect, clampRect: GeomRect, fixedSize?: boolean) => GeomRect;
354
+ create: (x: number, y: number, w: number, h: number) => GeomRect;
355
+ fromClientRect: (clientRect: DOMRect) => GeomRect;
356
+ }
478
357
  interface NotificationManagerImpl {
479
358
  open: (spec: NotificationSpec, closeCallback?: () => void) => NotificationApi;
480
359
  close: <T extends NotificationApi>(notification: T) => void;
481
- reposition: <T extends NotificationApi>(notifications: T[]) => void;
482
360
  getArgs: <T extends NotificationApi>(notification: T) => NotificationSpec;
483
361
  }
484
362
  interface NotificationSpec {
@@ -495,8 +373,7 @@ interface NotificationApi {
495
373
  value: (percent: number) => void;
496
374
  };
497
375
  text: (text: string) => void;
498
- moveTo: (x: number, y: number) => void;
499
- moveRel: (element: Element, rel: 'tc-tc' | 'bc-bc' | 'bc-tc' | 'tc-bc' | 'banner') => void;
376
+ reposition: () => void;
500
377
  getEl: () => HTMLElement;
501
378
  settings: NotificationSpec;
502
379
  }
@@ -505,124 +382,54 @@ interface NotificationManager {
505
382
  close: () => void;
506
383
  getNotifications: () => NotificationApi[];
507
384
  }
508
- interface UploadFailureOptions {
385
+ interface UploadFailure {
386
+ message: string;
509
387
  remove?: boolean;
510
388
  }
511
- declare type UploadHandler = (blobInfo: BlobInfo, success: (url: string) => void, failure: (err: string, options?: UploadFailureOptions) => void, progress?: (percent: number) => void) => void;
389
+ declare type ProgressFn = (percent: number) => void;
390
+ declare type UploadHandler = (blobInfo: BlobInfo, progress: ProgressFn) => Promise<string>;
512
391
  interface UploadResult$2 {
513
392
  url: string;
514
393
  blobInfo: BlobInfo;
515
394
  status: boolean;
516
- error?: {
517
- options: UploadFailureOptions;
518
- message: string;
519
- };
520
- }
521
- interface RangeLikeObject {
522
- startContainer: Node;
523
- startOffset: number;
524
- endContainer: Node;
525
- endOffset: number;
526
- }
527
- declare type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat;
528
- declare type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat;
529
- declare type Format = ApplyFormat | RemoveFormat;
530
- declare type Formats = Record<string, Format | Format[]>;
531
- declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string);
532
- declare type FormatVars = Record<string, string | null>;
533
- interface BaseFormat<T> {
534
- ceFalseOverride?: boolean;
535
- classes?: string | string[];
536
- collapsed?: boolean;
537
- exact?: boolean;
538
- expand?: boolean;
539
- links?: boolean;
540
- mixed?: boolean;
541
- block_expand?: boolean;
542
- onmatch?: (node: Node, fmt: T, itemName: string) => boolean;
543
- remove?: 'none' | 'empty' | 'all';
544
- remove_similar?: boolean;
545
- split?: boolean;
546
- deep?: boolean;
547
- preserve_attributes?: string[];
548
- }
549
- interface Block {
550
- block: string;
551
- list_block?: string;
552
- wrapper?: boolean;
553
- }
554
- interface Inline {
555
- inline: string;
556
- }
557
- interface Selector {
558
- selector: string;
559
- inherit?: boolean;
560
- }
561
- interface CommonFormat<T> extends BaseFormat<T> {
562
- attributes?: Record<string, FormatAttrOrStyleValue>;
563
- styles?: Record<string, FormatAttrOrStyleValue>;
564
- toggle?: boolean;
565
- preview?: string | false;
566
- onformat?: (elm: Node, fmt: T, vars?: FormatVars, node?: Node | RangeLikeObject) => void;
567
- clear_child_styles?: boolean;
568
- merge_siblings?: boolean;
569
- merge_with_parents?: boolean;
570
- defaultBlock?: string;
571
- }
572
- interface BlockFormat extends Block, CommonFormat<BlockFormat> {
573
- }
574
- interface InlineFormat extends Inline, CommonFormat<InlineFormat> {
575
- }
576
- interface SelectorFormat extends Selector, CommonFormat<SelectorFormat> {
395
+ error?: UploadFailure;
577
396
  }
578
- interface CommonRemoveFormat<T> extends BaseFormat<T> {
579
- attributes?: string[] | Record<string, FormatAttrOrStyleValue>;
580
- styles?: string[] | Record<string, FormatAttrOrStyleValue>;
581
- }
582
- interface RemoveBlockFormat extends Block, CommonRemoveFormat<RemoveBlockFormat> {
583
- }
584
- interface RemoveInlineFormat extends Inline, CommonRemoveFormat<RemoveInlineFormat> {
585
- }
586
- interface RemoveSelectorFormat extends Selector, CommonRemoveFormat<RemoveSelectorFormat> {
587
- }
588
- type Format_d_Formats = Formats;
589
- type Format_d_Format = Format;
590
- type Format_d_ApplyFormat = ApplyFormat;
591
- type Format_d_BlockFormat = BlockFormat;
592
- type Format_d_InlineFormat = InlineFormat;
593
- type Format_d_SelectorFormat = SelectorFormat;
594
- type Format_d_RemoveFormat = RemoveFormat;
595
- type Format_d_RemoveBlockFormat = RemoveBlockFormat;
596
- type Format_d_RemoveInlineFormat = RemoveInlineFormat;
597
- type Format_d_RemoveSelectorFormat = RemoveSelectorFormat;
598
- declare namespace Format_d {
599
- export { Format_d_Formats as Formats, Format_d_Format as Format, Format_d_ApplyFormat as ApplyFormat, Format_d_BlockFormat as BlockFormat, Format_d_InlineFormat as InlineFormat, Format_d_SelectorFormat as SelectorFormat, Format_d_RemoveFormat as RemoveFormat, Format_d_RemoveBlockFormat as RemoveBlockFormat, Format_d_RemoveInlineFormat as RemoveInlineFormat, Format_d_RemoveSelectorFormat as RemoveSelectorFormat, };
600
- }
601
- declare type StyleFormat = BlockStyleFormat | InlineStyleFormat | SelectorStyleFormat;
602
- declare type AllowedFormat = Separator | FormatReference | StyleFormat | NestedFormatting;
603
- interface Separator {
604
- title: string;
397
+ interface RawPattern {
398
+ start?: any;
399
+ end?: any;
400
+ format?: any;
401
+ cmd?: any;
402
+ value?: any;
403
+ replacement?: any;
605
404
  }
606
- interface FormatReference {
607
- title: string;
608
- format: string;
609
- icon?: string;
405
+ interface InlineBasePattern {
406
+ readonly start: string;
407
+ readonly end: string;
610
408
  }
611
- interface NestedFormatting {
612
- title: string;
613
- items: Array<FormatReference | StyleFormat>;
409
+ interface InlineFormatPattern extends InlineBasePattern {
410
+ readonly type: 'inline-format';
411
+ readonly format: string[];
614
412
  }
615
- interface CommonStyleFormat {
616
- name?: string;
617
- title: string;
618
- icon?: string;
413
+ interface InlineCmdPattern extends InlineBasePattern {
414
+ readonly type: 'inline-command';
415
+ readonly cmd: string;
416
+ readonly value?: any;
619
417
  }
620
- interface BlockStyleFormat extends BlockFormat, CommonStyleFormat {
418
+ declare type InlinePattern = InlineFormatPattern | InlineCmdPattern;
419
+ interface BlockBasePattern {
420
+ readonly start: string;
621
421
  }
622
- interface InlineStyleFormat extends InlineFormat, CommonStyleFormat {
422
+ interface BlockFormatPattern extends BlockBasePattern {
423
+ readonly type: 'block-format';
424
+ readonly format: string;
623
425
  }
624
- interface SelectorStyleFormat extends SelectorFormat, CommonStyleFormat {
426
+ interface BlockCmdPattern extends BlockBasePattern {
427
+ readonly type: 'block-command';
428
+ readonly cmd: string;
429
+ readonly value?: any;
625
430
  }
431
+ declare type BlockPattern = BlockFormatPattern | BlockCmdPattern;
432
+ declare type Pattern = InlinePattern | BlockPattern;
626
433
  interface AlertBannerSpec {
627
434
  type: 'alertbanner';
628
435
  level: 'info' | 'warn' | 'error' | 'success';
@@ -633,17 +440,12 @@ interface AlertBannerSpec {
633
440
  interface ButtonSpec {
634
441
  type: 'button';
635
442
  text: string;
636
- disabled?: boolean;
443
+ enabled?: boolean;
637
444
  primary?: boolean;
638
445
  name?: string;
639
446
  icon?: string;
640
447
  borderless?: boolean;
641
- }
642
- interface CheckboxSpec {
643
- name: string;
644
- type: 'checkbox';
645
- label: string;
646
- disabled?: boolean;
448
+ buttonType?: 'primary' | 'secondary' | 'toolbar';
647
449
  }
648
450
  interface FormComponentSpec {
649
451
  type: string;
@@ -652,9 +454,19 @@ interface FormComponentSpec {
652
454
  interface FormComponentWithLabelSpec extends FormComponentSpec {
653
455
  label?: string;
654
456
  }
457
+ interface CheckboxSpec extends FormComponentSpec {
458
+ type: 'checkbox';
459
+ label: string;
460
+ enabled?: boolean;
461
+ }
655
462
  interface CollectionSpec extends FormComponentWithLabelSpec {
656
463
  type: 'collection';
657
464
  }
465
+ interface CollectionItem {
466
+ value: string;
467
+ text: string;
468
+ icon: string;
469
+ }
658
470
  interface ColorInputSpec extends FormComponentWithLabelSpec {
659
471
  type: 'colorinput';
660
472
  }
@@ -697,20 +509,16 @@ interface IframeSpec extends FormComponentWithLabelSpec {
697
509
  type: 'iframe';
698
510
  sandboxed?: boolean;
699
511
  }
700
- interface ImageToolsState {
701
- blob: Blob;
702
- url: string;
703
- }
704
- interface ImageToolsSpec extends FormComponentWithLabelSpec {
705
- type: 'imagetools';
706
- currentState: ImageToolsState;
512
+ interface ImagePreviewSpec extends FormComponentSpec {
513
+ type: 'imagepreview';
514
+ height?: string;
707
515
  }
708
516
  interface InputSpec extends FormComponentWithLabelSpec {
709
517
  type: 'input';
710
518
  inputMode?: string;
711
519
  placeholder?: string;
712
520
  maximized?: boolean;
713
- disabled?: boolean;
521
+ enabled?: boolean;
714
522
  }
715
523
  interface LabelSpec {
716
524
  type: 'label';
@@ -744,12 +552,18 @@ interface SelectBoxSpec extends FormComponentWithLabelSpec {
744
552
  type: 'selectbox';
745
553
  items: SelectBoxItemSpec[];
746
554
  size?: number;
747
- disabled?: boolean;
555
+ enabled?: boolean;
748
556
  }
749
557
  interface SizeInputSpec extends FormComponentWithLabelSpec {
750
558
  type: 'sizeinput';
751
559
  constrain?: boolean;
752
- disabled?: boolean;
560
+ enabled?: boolean;
561
+ }
562
+ interface SliderSpec extends FormComponentSpec {
563
+ type: 'slider';
564
+ label: string;
565
+ min?: number;
566
+ max?: number;
753
567
  }
754
568
  interface TableSpec {
755
569
  type: 'table';
@@ -760,28 +574,34 @@ interface TextAreaSpec extends FormComponentWithLabelSpec {
760
574
  type: 'textarea';
761
575
  placeholder?: string;
762
576
  maximized?: boolean;
763
- disabled?: boolean;
577
+ enabled?: boolean;
764
578
  }
765
579
  interface UrlInputSpec extends FormComponentWithLabelSpec {
766
580
  type: 'urlinput';
767
581
  filetype?: 'image' | 'media' | 'file';
768
- disabled?: boolean;
582
+ enabled?: boolean;
583
+ }
584
+ interface UrlInputData {
585
+ value: string;
586
+ meta: {
587
+ text?: string;
588
+ };
769
589
  }
770
- declare type BodyComponentSpec = BarSpec | ButtonSpec | CheckboxSpec | TextAreaSpec | InputSpec | ListBoxSpec | SelectBoxSpec | SizeInputSpec | IframeSpec | HtmlPanelSpec | UrlInputSpec | DropZoneSpec | ColorInputSpec | GridSpec | ColorPickerSpec | ImageToolsSpec | AlertBannerSpec | CollectionSpec | LabelSpec | TableSpec | PanelSpec | CustomEditorSpec;
590
+ declare type BodyComponentSpec = BarSpec | ButtonSpec | CheckboxSpec | TextAreaSpec | InputSpec | ListBoxSpec | SelectBoxSpec | SizeInputSpec | SliderSpec | IframeSpec | HtmlPanelSpec | UrlInputSpec | DropZoneSpec | ColorInputSpec | GridSpec | ColorPickerSpec | ImagePreviewSpec | AlertBannerSpec | CollectionSpec | LabelSpec | TableSpec | PanelSpec | CustomEditorSpec;
771
591
  interface BarSpec {
772
592
  type: 'bar';
773
593
  items: BodyComponentSpec[];
774
594
  }
775
595
  interface CommonMenuItemSpec {
776
- disabled?: boolean;
596
+ enabled?: boolean;
777
597
  text?: string;
778
598
  value?: string;
779
599
  meta?: Record<string, any>;
780
600
  shortcut?: string;
781
601
  }
782
602
  interface CommonMenuItemInstanceApi {
783
- isDisabled: () => boolean;
784
- setDisabled: (state: boolean) => void;
603
+ isEnabled: () => boolean;
604
+ setEnabled: (state: boolean) => void;
785
605
  }
786
606
  interface DialogToggleMenuItemSpec extends CommonMenuItemSpec {
787
607
  type?: 'togglemenuitem';
@@ -792,8 +612,9 @@ interface BaseDialogFooterButtonSpec {
792
612
  name?: string;
793
613
  align?: 'start' | 'end';
794
614
  primary?: boolean;
795
- disabled?: boolean;
615
+ enabled?: boolean;
796
616
  icon?: string;
617
+ buttonType?: 'primary' | 'secondary';
797
618
  }
798
619
  interface DialogFooterNormalButtonSpec extends BaseDialogFooterButtonSpec {
799
620
  type: 'submit' | 'cancel' | 'custom';
@@ -821,11 +642,10 @@ declare type DialogData = Record<string, DialogDataItem>;
821
642
  interface DialogInstanceApi<T extends DialogData> {
822
643
  getData: () => T;
823
644
  setData: (data: Partial<T>) => void;
824
- disable: (name: string) => void;
645
+ setEnabled: (name: string, state: boolean) => void;
825
646
  focus: (name: string) => void;
826
647
  showTab: (name: string) => void;
827
648
  redial: (nu: DialogSpec<T>) => void;
828
- enable: (name: string) => void;
829
649
  block: (msg: string) => void;
830
650
  unblock: () => void;
831
651
  close: () => void;
@@ -853,7 +673,7 @@ interface DialogSpec<T extends DialogData> {
853
673
  size?: DialogSize;
854
674
  body: TabPanelSpec | PanelSpec;
855
675
  buttons: DialogFooterButtonSpec[];
856
- initialData?: T;
676
+ initialData?: Partial<T>;
857
677
  onAction?: DialogActionHandler<T>;
858
678
  onChange?: DialogChangeHandler<T>;
859
679
  onSubmit?: DialogSubmitHandler<T>;
@@ -962,15 +782,15 @@ interface ContextBarSpec {
962
782
  scope?: ContextScope;
963
783
  }
964
784
  interface BaseToolbarButtonSpec<I extends BaseToolbarButtonInstanceApi> {
965
- disabled?: boolean;
785
+ enabled?: boolean;
966
786
  tooltip?: string;
967
787
  icon?: string;
968
788
  text?: string;
969
789
  onSetup?: (api: I) => (api: I) => void;
970
790
  }
971
791
  interface BaseToolbarButtonInstanceApi {
972
- isDisabled: () => boolean;
973
- setDisabled: (state: boolean) => void;
792
+ isEnabled: () => boolean;
793
+ setEnabled: (state: boolean) => void;
974
794
  }
975
795
  interface ToolbarButtonSpec extends BaseToolbarButtonSpec<ToolbarButtonInstanceApi> {
976
796
  type?: 'button';
@@ -1110,6 +930,7 @@ type PublicDialog_d_BarSpec = BarSpec;
1110
930
  type PublicDialog_d_BodyComponentSpec = BodyComponentSpec;
1111
931
  type PublicDialog_d_ButtonSpec = ButtonSpec;
1112
932
  type PublicDialog_d_CheckboxSpec = CheckboxSpec;
933
+ type PublicDialog_d_CollectionItem = CollectionItem;
1113
934
  type PublicDialog_d_CollectionSpec = CollectionSpec;
1114
935
  type PublicDialog_d_ColorInputSpec = ColorInputSpec;
1115
936
  type PublicDialog_d_ColorPickerSpec = ColorPickerSpec;
@@ -1128,7 +949,7 @@ type PublicDialog_d_DropZoneSpec = DropZoneSpec;
1128
949
  type PublicDialog_d_GridSpec = GridSpec;
1129
950
  type PublicDialog_d_HtmlPanelSpec = HtmlPanelSpec;
1130
951
  type PublicDialog_d_IframeSpec = IframeSpec;
1131
- type PublicDialog_d_ImageToolsSpec = ImageToolsSpec;
952
+ type PublicDialog_d_ImagePreviewSpec = ImagePreviewSpec;
1132
953
  type PublicDialog_d_InputSpec = InputSpec;
1133
954
  type PublicDialog_d_LabelSpec = LabelSpec;
1134
955
  type PublicDialog_d_ListBoxSpec = ListBoxSpec;
@@ -1139,10 +960,12 @@ type PublicDialog_d_PanelSpec = PanelSpec;
1139
960
  type PublicDialog_d_SelectBoxSpec = SelectBoxSpec;
1140
961
  type PublicDialog_d_SelectBoxItemSpec = SelectBoxItemSpec;
1141
962
  type PublicDialog_d_SizeInputSpec = SizeInputSpec;
963
+ type PublicDialog_d_SliderSpec = SliderSpec;
1142
964
  type PublicDialog_d_TableSpec = TableSpec;
1143
965
  type PublicDialog_d_TabSpec = TabSpec;
1144
966
  type PublicDialog_d_TabPanelSpec = TabPanelSpec;
1145
967
  type PublicDialog_d_TextAreaSpec = TextAreaSpec;
968
+ type PublicDialog_d_UrlInputData = UrlInputData;
1146
969
  type PublicDialog_d_UrlInputSpec = UrlInputSpec;
1147
970
  type PublicDialog_d_UrlDialogSpec = UrlDialogSpec;
1148
971
  type PublicDialog_d_UrlDialogFooterButtonSpec = UrlDialogFooterButtonSpec;
@@ -1150,7 +973,7 @@ type PublicDialog_d_UrlDialogInstanceApi = UrlDialogInstanceApi;
1150
973
  type PublicDialog_d_UrlDialogActionDetails = UrlDialogActionDetails;
1151
974
  type PublicDialog_d_UrlDialogMessage = UrlDialogMessage;
1152
975
  declare namespace PublicDialog_d {
1153
- export { PublicDialog_d_AlertBannerSpec as AlertBannerSpec, PublicDialog_d_BarSpec as BarSpec, PublicDialog_d_BodyComponentSpec as BodyComponentSpec, PublicDialog_d_ButtonSpec as ButtonSpec, PublicDialog_d_CheckboxSpec as CheckboxSpec, PublicDialog_d_CollectionSpec as CollectionSpec, PublicDialog_d_ColorInputSpec as ColorInputSpec, PublicDialog_d_ColorPickerSpec as ColorPickerSpec, PublicDialog_d_CustomEditorSpec as CustomEditorSpec, PublicDialog_d_CustomEditorInit as CustomEditorInit, PublicDialog_d_CustomEditorInitFn as CustomEditorInitFn, PublicDialog_d_DialogData as DialogData, PublicDialog_d_DialogSize as DialogSize, PublicDialog_d_DialogSpec as DialogSpec, PublicDialog_d_DialogInstanceApi as DialogInstanceApi, PublicDialog_d_DialogFooterButtonSpec as DialogFooterButtonSpec, PublicDialog_d_DialogActionDetails as DialogActionDetails, PublicDialog_d_DialogChangeDetails as DialogChangeDetails, PublicDialog_d_DialogTabChangeDetails as DialogTabChangeDetails, PublicDialog_d_DropZoneSpec as DropZoneSpec, PublicDialog_d_GridSpec as GridSpec, PublicDialog_d_HtmlPanelSpec as HtmlPanelSpec, PublicDialog_d_IframeSpec as IframeSpec, PublicDialog_d_ImageToolsSpec as ImageToolsSpec, PublicDialog_d_InputSpec as InputSpec, PublicDialog_d_LabelSpec as LabelSpec, PublicDialog_d_ListBoxSpec as ListBoxSpec, PublicDialog_d_ListBoxItemSpec as ListBoxItemSpec, PublicDialog_d_ListBoxNestedItemSpec as ListBoxNestedItemSpec, PublicDialog_d_ListBoxSingleItemSpec as ListBoxSingleItemSpec, PublicDialog_d_PanelSpec as PanelSpec, PublicDialog_d_SelectBoxSpec as SelectBoxSpec, PublicDialog_d_SelectBoxItemSpec as SelectBoxItemSpec, PublicDialog_d_SizeInputSpec as SizeInputSpec, PublicDialog_d_TableSpec as TableSpec, PublicDialog_d_TabSpec as TabSpec, PublicDialog_d_TabPanelSpec as TabPanelSpec, PublicDialog_d_TextAreaSpec as TextAreaSpec, PublicDialog_d_UrlInputSpec as UrlInputSpec, PublicDialog_d_UrlDialogSpec as UrlDialogSpec, PublicDialog_d_UrlDialogFooterButtonSpec as UrlDialogFooterButtonSpec, PublicDialog_d_UrlDialogInstanceApi as UrlDialogInstanceApi, PublicDialog_d_UrlDialogActionDetails as UrlDialogActionDetails, PublicDialog_d_UrlDialogMessage as UrlDialogMessage, };
976
+ export { PublicDialog_d_AlertBannerSpec as AlertBannerSpec, PublicDialog_d_BarSpec as BarSpec, PublicDialog_d_BodyComponentSpec as BodyComponentSpec, PublicDialog_d_ButtonSpec as ButtonSpec, PublicDialog_d_CheckboxSpec as CheckboxSpec, PublicDialog_d_CollectionItem as CollectionItem, PublicDialog_d_CollectionSpec as CollectionSpec, PublicDialog_d_ColorInputSpec as ColorInputSpec, PublicDialog_d_ColorPickerSpec as ColorPickerSpec, PublicDialog_d_CustomEditorSpec as CustomEditorSpec, PublicDialog_d_CustomEditorInit as CustomEditorInit, PublicDialog_d_CustomEditorInitFn as CustomEditorInitFn, PublicDialog_d_DialogData as DialogData, PublicDialog_d_DialogSize as DialogSize, PublicDialog_d_DialogSpec as DialogSpec, PublicDialog_d_DialogInstanceApi as DialogInstanceApi, PublicDialog_d_DialogFooterButtonSpec as DialogFooterButtonSpec, PublicDialog_d_DialogActionDetails as DialogActionDetails, PublicDialog_d_DialogChangeDetails as DialogChangeDetails, PublicDialog_d_DialogTabChangeDetails as DialogTabChangeDetails, PublicDialog_d_DropZoneSpec as DropZoneSpec, PublicDialog_d_GridSpec as GridSpec, PublicDialog_d_HtmlPanelSpec as HtmlPanelSpec, PublicDialog_d_IframeSpec as IframeSpec, PublicDialog_d_ImagePreviewSpec as ImagePreviewSpec, PublicDialog_d_InputSpec as InputSpec, PublicDialog_d_LabelSpec as LabelSpec, PublicDialog_d_ListBoxSpec as ListBoxSpec, PublicDialog_d_ListBoxItemSpec as ListBoxItemSpec, PublicDialog_d_ListBoxNestedItemSpec as ListBoxNestedItemSpec, PublicDialog_d_ListBoxSingleItemSpec as ListBoxSingleItemSpec, PublicDialog_d_PanelSpec as PanelSpec, PublicDialog_d_SelectBoxSpec as SelectBoxSpec, PublicDialog_d_SelectBoxItemSpec as SelectBoxItemSpec, PublicDialog_d_SizeInputSpec as SizeInputSpec, PublicDialog_d_SliderSpec as SliderSpec, PublicDialog_d_TableSpec as TableSpec, PublicDialog_d_TabSpec as TabSpec, PublicDialog_d_TabPanelSpec as TabPanelSpec, PublicDialog_d_TextAreaSpec as TextAreaSpec, PublicDialog_d_UrlInputData as UrlInputData, PublicDialog_d_UrlInputSpec as UrlInputSpec, PublicDialog_d_UrlDialogSpec as UrlDialogSpec, PublicDialog_d_UrlDialogFooterButtonSpec as UrlDialogFooterButtonSpec, PublicDialog_d_UrlDialogInstanceApi as UrlDialogInstanceApi, PublicDialog_d_UrlDialogActionDetails as UrlDialogActionDetails, PublicDialog_d_UrlDialogMessage as UrlDialogMessage, };
1154
977
  }
1155
978
  type PublicInlineContent_d_AutocompleterSpec = AutocompleterSpec;
1156
979
  type PublicInlineContent_d_AutocompleterItemSpec = AutocompleterItemSpec;
@@ -1231,8 +1054,8 @@ interface BaseMenuButtonSpec {
1231
1054
  onSetup?: (api: BaseMenuButtonInstanceApi) => (api: BaseMenuButtonInstanceApi) => void;
1232
1055
  }
1233
1056
  interface BaseMenuButtonInstanceApi {
1234
- isDisabled: () => boolean;
1235
- setDisabled: (state: boolean) => void;
1057
+ isEnabled: () => boolean;
1058
+ setEnabled: (state: boolean) => void;
1236
1059
  isActive: () => boolean;
1237
1060
  setActive: (state: boolean) => void;
1238
1061
  }
@@ -1261,10 +1084,9 @@ interface ToolbarSplitButtonSpec {
1261
1084
  onItemAction: (api: ToolbarSplitButtonInstanceApi, value: string) => void;
1262
1085
  }
1263
1086
  interface ToolbarSplitButtonInstanceApi {
1264
- isDisabled: () => boolean;
1265
- setDisabled: (state: boolean) => void;
1087
+ isEnabled: () => boolean;
1088
+ setEnabled: (state: boolean) => void;
1266
1089
  setIconFill: (id: string, value: string) => void;
1267
- setIconStroke: (id: string, value: string) => void;
1268
1090
  isActive: () => boolean;
1269
1091
  setActive: (state: boolean) => void;
1270
1092
  }
@@ -1306,14 +1128,133 @@ interface Registry$1 {
1306
1128
  sidebars: Record<string, SidebarSpec>;
1307
1129
  };
1308
1130
  }
1131
+ interface AutocompleteLookupData {
1132
+ readonly matchText: string;
1133
+ readonly items: AutocompleterContents[];
1134
+ readonly columns: ColumnTypes$1;
1135
+ readonly onAction: (autoApi: AutocompleterInstanceApi, rng: Range, value: string, meta: Record<string, any>) => void;
1136
+ readonly highlightOn: string[];
1137
+ }
1138
+ interface AutocompleterEventArgs {
1139
+ readonly lookupData: AutocompleteLookupData[];
1140
+ }
1141
+ interface RangeLikeObject {
1142
+ startContainer: Node;
1143
+ startOffset: number;
1144
+ endContainer: Node;
1145
+ endOffset: number;
1146
+ }
1147
+ declare type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat;
1148
+ declare type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat;
1149
+ declare type Format = ApplyFormat | RemoveFormat;
1150
+ declare type Formats = Record<string, Format | Format[]>;
1151
+ declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string);
1152
+ declare type FormatVars = Record<string, string | null>;
1153
+ interface BaseFormat<T> {
1154
+ ceFalseOverride?: boolean;
1155
+ classes?: string | string[];
1156
+ collapsed?: boolean;
1157
+ exact?: boolean;
1158
+ expand?: boolean;
1159
+ links?: boolean;
1160
+ mixed?: boolean;
1161
+ block_expand?: boolean;
1162
+ onmatch?: (node: Node, fmt: T, itemName: string) => boolean;
1163
+ remove?: 'none' | 'empty' | 'all';
1164
+ remove_similar?: boolean;
1165
+ split?: boolean;
1166
+ deep?: boolean;
1167
+ preserve_attributes?: string[];
1168
+ }
1169
+ interface Block {
1170
+ block: string;
1171
+ list_block?: string;
1172
+ wrapper?: boolean;
1173
+ }
1174
+ interface Inline {
1175
+ inline: string;
1176
+ }
1177
+ interface Selector {
1178
+ selector: string;
1179
+ inherit?: boolean;
1180
+ }
1181
+ interface CommonFormat<T> extends BaseFormat<T> {
1182
+ attributes?: Record<string, FormatAttrOrStyleValue>;
1183
+ styles?: Record<string, FormatAttrOrStyleValue>;
1184
+ toggle?: boolean;
1185
+ preview?: string | false;
1186
+ onformat?: (elm: Node, fmt: T, vars?: FormatVars, node?: Node | RangeLikeObject) => void;
1187
+ clear_child_styles?: boolean;
1188
+ merge_siblings?: boolean;
1189
+ merge_with_parents?: boolean;
1190
+ }
1191
+ interface BlockFormat extends Block, CommonFormat<BlockFormat> {
1192
+ }
1193
+ interface InlineFormat extends Inline, CommonFormat<InlineFormat> {
1194
+ }
1195
+ interface SelectorFormat extends Selector, CommonFormat<SelectorFormat> {
1196
+ }
1197
+ interface CommonRemoveFormat<T> extends BaseFormat<T> {
1198
+ attributes?: string[] | Record<string, FormatAttrOrStyleValue>;
1199
+ styles?: string[] | Record<string, FormatAttrOrStyleValue>;
1200
+ }
1201
+ interface RemoveBlockFormat extends Block, CommonRemoveFormat<RemoveBlockFormat> {
1202
+ }
1203
+ interface RemoveInlineFormat extends Inline, CommonRemoveFormat<RemoveInlineFormat> {
1204
+ }
1205
+ interface RemoveSelectorFormat extends Selector, CommonRemoveFormat<RemoveSelectorFormat> {
1206
+ }
1207
+ interface ParserArgs {
1208
+ getInner?: boolean | number;
1209
+ forced_root_block?: boolean | string;
1210
+ context?: string;
1211
+ isRootContent?: boolean;
1212
+ format?: string;
1213
+ invalid?: boolean;
1214
+ no_events?: boolean;
1215
+ [key: string]: any;
1216
+ }
1217
+ declare type ParserFilterCallback = (nodes: AstNode[], name: string, args: ParserArgs) => void;
1218
+ interface ParserFilter {
1219
+ name: string;
1220
+ callbacks: ParserFilterCallback[];
1221
+ }
1222
+ interface DomParserSettings {
1223
+ allow_html_data_urls?: boolean;
1224
+ allow_svg_data_urls?: boolean;
1225
+ allow_conditional_comments?: boolean;
1226
+ allow_html_in_named_anchor?: boolean;
1227
+ allow_script_urls?: boolean;
1228
+ allow_unsafe_link_target?: boolean;
1229
+ convert_fonts_to_spans?: boolean;
1230
+ fix_list_elements?: boolean;
1231
+ font_size_legacy_values?: string;
1232
+ forced_root_block?: boolean | string;
1233
+ forced_root_block_attrs?: Record<string, string>;
1234
+ preserve_cdata?: boolean;
1235
+ remove_trailing_brs?: boolean;
1236
+ root_name?: string;
1237
+ validate?: boolean;
1238
+ inline_styles?: boolean;
1239
+ blob_cache?: BlobCache;
1240
+ document?: Document;
1241
+ }
1242
+ interface DomParser {
1243
+ schema: Schema;
1244
+ addAttributeFilter: (name: string, callback: (nodes: AstNode[], name: string, args: ParserArgs) => void) => void;
1245
+ getAttributeFilters: () => ParserFilter[];
1246
+ addNodeFilter: (name: string, callback: (nodes: AstNode[], name: string, args: ParserArgs) => void) => void;
1247
+ getNodeFilters: () => ParserFilter[];
1248
+ parse: (html: string, args?: ParserArgs) => AstNode;
1249
+ }
1309
1250
  interface StyleSheetLoaderSettings {
1310
1251
  maxLoadTime?: number;
1311
1252
  contentCssCors?: boolean;
1312
1253
  referrerPolicy?: ReferrerPolicy;
1313
1254
  }
1314
1255
  interface StyleSheetLoader {
1315
- load: (url: string, success: () => void, failure?: () => void) => void;
1316
- loadAll: (urls: string[], success: (urls: string[]) => void, failure: (urls: string[]) => void) => void;
1256
+ load: (url: string) => Promise<void>;
1257
+ loadAll: (urls: string[]) => Promise<string[]>;
1317
1258
  unload: (url: string) => void;
1318
1259
  unloadAll: (urls: string[]) => void;
1319
1260
  _setReferrerPolicy: (referrerPolicy: ReferrerPolicy) => void;
@@ -1322,9 +1263,8 @@ declare type Registry = Registry$1;
1322
1263
  interface EditorUiApi {
1323
1264
  show: () => void;
1324
1265
  hide: () => void;
1325
- enable: () => void;
1326
- disable: () => void;
1327
- isDisabled: () => boolean;
1266
+ setEnabled: (state: boolean) => void;
1267
+ isEnabled: () => boolean;
1328
1268
  }
1329
1269
  interface EditorUi extends EditorUiApi {
1330
1270
  registry: Registry;
@@ -1336,55 +1276,356 @@ type Ui_d_EditorUi = EditorUi;
1336
1276
  declare namespace Ui_d {
1337
1277
  export { Ui_d_Registry as Registry, PublicDialog_d as Dialog, PublicInlineContent_d as InlineContent, PublicMenu_d as Menu, PublicSidebar_d as Sidebar, PublicToolbar_d as Toolbar, Ui_d_EditorUiApi as EditorUiApi, Ui_d_EditorUi as EditorUi, };
1338
1278
  }
1339
- declare type EntityEncoding = 'named' | 'numeric' | 'raw' | 'named,numeric' | 'named+numeric' | 'numeric,named' | 'numeric+named';
1340
- interface ContentLanguage {
1341
- readonly title: string;
1342
- readonly code: string;
1343
- readonly customCode?: string;
1279
+ interface WindowParams {
1280
+ readonly inline?: 'cursor' | 'toolbar';
1281
+ readonly ariaAttrs?: boolean;
1344
1282
  }
1345
- declare type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => {
1346
- editorContainer: HTMLElement;
1347
- iframeContainer: HTMLElement;
1348
- height?: number;
1349
- iframeHeight?: number;
1350
- api?: EditorUiApi;
1351
- };
1352
- declare type SetupCallback = (editor: Editor) => void;
1353
- declare type FilePickerCallback = (callback: Function, value: any, meta: Record<string, any>) => void;
1354
- declare type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none';
1355
- declare type FilePickerValidationCallback = (info: {
1356
- type: string;
1357
- url: string;
1358
- }, callback: (validation: {
1359
- status: FilePickerValidationStatus;
1283
+ declare type InstanceApi<T> = UrlDialogInstanceApi | DialogInstanceApi<T>;
1284
+ interface WindowManagerImpl {
1285
+ open: <T>(config: DialogSpec<T>, params: WindowParams, closeWindow: (dialog: DialogInstanceApi<T>) => void) => DialogInstanceApi<T>;
1286
+ openUrl: (config: UrlDialogSpec, closeWindow: (dialog: UrlDialogInstanceApi) => void) => UrlDialogInstanceApi;
1287
+ alert: (message: string, callback: () => void) => void;
1288
+ confirm: (message: string, callback: (state: boolean) => void) => void;
1289
+ close: (dialog: InstanceApi<any>) => void;
1290
+ }
1291
+ interface WindowManager {
1292
+ open: <T>(config: DialogSpec<T>, params?: WindowParams) => DialogInstanceApi<T>;
1293
+ openUrl: (config: UrlDialogSpec) => UrlDialogInstanceApi;
1294
+ alert: (message: string, callback?: () => void, scope?: any) => void;
1295
+ confirm: (message: string, callback?: (state: boolean) => void, scope?: any) => void;
1296
+ close: () => void;
1297
+ }
1298
+ interface ExecCommandEvent {
1299
+ command: string;
1300
+ ui?: boolean;
1301
+ value?: any;
1302
+ }
1303
+ interface BeforeGetContentEvent extends GetContentArgs {
1304
+ selection?: boolean;
1305
+ }
1306
+ interface GetContentEvent extends BeforeGetContentEvent {
1307
+ content: string;
1308
+ }
1309
+ interface BeforeSetContentEvent extends SetContentArgs {
1310
+ content: string;
1311
+ selection?: boolean;
1312
+ }
1313
+ interface SetContentEvent extends BeforeSetContentEvent {
1314
+ content: string;
1315
+ }
1316
+ interface NewBlockEvent {
1317
+ newBlock: Element;
1318
+ }
1319
+ interface NodeChangeEvent {
1320
+ element: Element;
1321
+ parents: Node[];
1322
+ selectionChange?: boolean;
1323
+ initial?: boolean;
1324
+ }
1325
+ interface FormatEvent {
1326
+ format: string;
1327
+ vars?: FormatVars;
1328
+ node?: Node | RangeLikeObject;
1329
+ }
1330
+ interface ObjectResizeEvent {
1331
+ target: HTMLElement;
1332
+ width: number;
1333
+ height: number;
1334
+ origin: string;
1335
+ }
1336
+ interface ObjectSelectedEvent {
1337
+ target: Node;
1338
+ targetClone?: Node;
1339
+ }
1340
+ interface ScrollIntoViewEvent {
1341
+ elm: HTMLElement;
1342
+ alignToTop: boolean;
1343
+ }
1344
+ interface SetSelectionRangeEvent {
1345
+ range: Range;
1346
+ forward: boolean;
1347
+ }
1348
+ interface ShowCaretEvent {
1349
+ target: Node;
1350
+ direction: number;
1351
+ before: boolean;
1352
+ }
1353
+ interface SwitchModeEvent {
1354
+ mode: string;
1355
+ }
1356
+ interface AddUndoEvent {
1357
+ level: UndoLevel;
1358
+ lastLevel: UndoLevel;
1359
+ originalEvent: Event;
1360
+ }
1361
+ interface UndoRedoEvent {
1362
+ level: UndoLevel;
1363
+ }
1364
+ interface WindowEvent<T extends DialogData> {
1365
+ dialog: InstanceApi<T>;
1366
+ }
1367
+ interface ProgressStateEvent {
1368
+ state: boolean;
1369
+ time?: number;
1370
+ }
1371
+ interface AfterProgressStateEvent {
1372
+ state: boolean;
1373
+ }
1374
+ interface PlaceholderToggleEvent {
1375
+ state: boolean;
1376
+ }
1377
+ interface LoadErrorEvent {
1360
1378
  message: string;
1361
- }) => void) => void;
1362
- declare type URLConverter = (url: string, name: string, elm?: HTMLElement) => string;
1363
- declare type URLConverterCallback = (url: string, node: Node, on_save: boolean, name: string) => void;
1364
- interface ToolbarGroup {
1365
- name?: string;
1366
- items: string[];
1367
1379
  }
1368
- declare type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
1369
- interface BaseEditorSettings {
1370
- add_form_submit_trigger?: boolean;
1371
- add_unload_trigger?: boolean;
1372
- allow_conditional_comments?: boolean;
1373
- allow_html_data_urls?: boolean;
1374
- allow_html_in_named_anchor?: boolean;
1375
- allow_script_urls?: boolean;
1376
- allow_svg_data_urls?: boolean;
1377
- allow_unsafe_link_target?: boolean;
1378
- anchor_bottom?: false | string;
1379
- anchor_top?: false | string;
1380
- auto_focus?: string | true;
1381
- automatic_uploads?: boolean;
1382
- base_url?: string;
1383
- block_formats?: string;
1384
- block_unsupported_drop?: boolean;
1385
- body_id?: string;
1386
- body_class?: string;
1387
- br_in_pre?: boolean;
1380
+ interface PreProcessEvent extends ParserArgs {
1381
+ node: Element;
1382
+ }
1383
+ interface PostProcessEvent extends ParserArgs {
1384
+ content: string;
1385
+ }
1386
+ interface PastePlainTextToggleEvent {
1387
+ state: boolean;
1388
+ }
1389
+ interface PastePreProcessEvent {
1390
+ content: string;
1391
+ readonly internal: boolean;
1392
+ }
1393
+ interface PastePostProcessEvent {
1394
+ node: HTMLElement;
1395
+ readonly internal: boolean;
1396
+ }
1397
+ interface NewTableRowEvent {
1398
+ node: HTMLTableRowElement;
1399
+ }
1400
+ interface NewTableCellEvent {
1401
+ node: HTMLTableCellElement;
1402
+ }
1403
+ interface TableEventData {
1404
+ readonly structure: boolean;
1405
+ readonly style: boolean;
1406
+ }
1407
+ interface TableModifiedEvent extends TableEventData {
1408
+ readonly table: HTMLTableElement;
1409
+ }
1410
+ interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1411
+ 'activate': {
1412
+ relatedTarget: Editor;
1413
+ };
1414
+ 'deactivate': {
1415
+ relatedTarget: Editor;
1416
+ };
1417
+ 'focus': {
1418
+ blurredEditor: Editor;
1419
+ };
1420
+ 'blur': {
1421
+ focusedEditor: Editor;
1422
+ };
1423
+ 'resize': UIEvent;
1424
+ 'scroll': UIEvent;
1425
+ 'detach': {};
1426
+ 'remove': {};
1427
+ 'init': {};
1428
+ 'ScrollIntoView': ScrollIntoViewEvent;
1429
+ 'AfterScrollIntoView': ScrollIntoViewEvent;
1430
+ 'ObjectResized': ObjectResizeEvent;
1431
+ 'ObjectResizeStart': ObjectResizeEvent;
1432
+ 'SwitchMode': SwitchModeEvent;
1433
+ 'ScrollWindow': UIEvent;
1434
+ 'ResizeWindow': UIEvent;
1435
+ 'SkinLoaded': {};
1436
+ 'SkinLoadError': LoadErrorEvent;
1437
+ 'PluginLoadError': LoadErrorEvent;
1438
+ 'ModelLoadError': LoadErrorEvent;
1439
+ 'IconsLoadError': LoadErrorEvent;
1440
+ 'ThemeLoadError': LoadErrorEvent;
1441
+ 'LanguageLoadError': LoadErrorEvent;
1442
+ 'BeforeExecCommand': ExecCommandEvent;
1443
+ 'ExecCommand': ExecCommandEvent;
1444
+ 'NodeChange': NodeChangeEvent;
1445
+ 'FormatApply': FormatEvent;
1446
+ 'FormatRemove': FormatEvent;
1447
+ 'ShowCaret': ShowCaretEvent;
1448
+ 'SelectionChange': {};
1449
+ 'ObjectSelected': ObjectSelectedEvent;
1450
+ 'BeforeObjectSelected': ObjectSelectedEvent;
1451
+ 'GetSelectionRange': {
1452
+ range: Range;
1453
+ };
1454
+ 'SetSelectionRange': SetSelectionRangeEvent;
1455
+ 'AfterSetSelectionRange': SetSelectionRangeEvent;
1456
+ 'BeforeGetContent': BeforeGetContentEvent;
1457
+ 'GetContent': GetContentEvent;
1458
+ 'BeforeSetContent': BeforeSetContentEvent;
1459
+ 'SetContent': SetContentEvent;
1460
+ 'LoadContent': {};
1461
+ 'PreviewFormats': {};
1462
+ 'AfterPreviewFormats': {};
1463
+ 'ScriptsLoaded': {};
1464
+ 'PreInit': {};
1465
+ 'PostRender': {};
1466
+ 'NewBlock': NewBlockEvent;
1467
+ 'ClearUndos': {};
1468
+ 'TypingUndo': {};
1469
+ 'Redo': UndoRedoEvent;
1470
+ 'Undo': UndoRedoEvent;
1471
+ 'BeforeAddUndo': AddUndoEvent;
1472
+ 'AddUndo': AddUndoEvent;
1473
+ 'CloseWindow': WindowEvent<any>;
1474
+ 'OpenWindow': WindowEvent<any>;
1475
+ 'ProgressState': ProgressStateEvent;
1476
+ 'AfterProgressState': AfterProgressStateEvent;
1477
+ 'PlaceholderToggle': PlaceholderToggleEvent;
1478
+ 'tap': TouchEvent;
1479
+ 'longpress': TouchEvent;
1480
+ 'longpresscancel': {};
1481
+ 'PreProcess': PreProcessEvent;
1482
+ 'PostProcess': PostProcessEvent;
1483
+ 'AutocompleterStart': AutocompleterEventArgs;
1484
+ 'AutocompleterUpdate': AutocompleterEventArgs;
1485
+ 'AutocompleterEnd': {};
1486
+ 'PastePlainTextToggle': PastePlainTextToggleEvent;
1487
+ 'PastePreProcess': PastePreProcessEvent;
1488
+ 'PastePostProcess': PastePostProcessEvent;
1489
+ 'TableModified': TableModifiedEvent;
1490
+ 'NewRow': NewTableRowEvent;
1491
+ 'NewCell': NewTableCellEvent;
1492
+ }
1493
+ interface EditorManagerEventMap {
1494
+ 'AddEditor': {
1495
+ editor: Editor;
1496
+ };
1497
+ 'RemoveEditor': {
1498
+ editor: Editor;
1499
+ };
1500
+ 'BeforeUnload': {
1501
+ returnValue: any;
1502
+ };
1503
+ }
1504
+ type EventTypes_d_ExecCommandEvent = ExecCommandEvent;
1505
+ type EventTypes_d_BeforeGetContentEvent = BeforeGetContentEvent;
1506
+ type EventTypes_d_GetContentEvent = GetContentEvent;
1507
+ type EventTypes_d_BeforeSetContentEvent = BeforeSetContentEvent;
1508
+ type EventTypes_d_SetContentEvent = SetContentEvent;
1509
+ type EventTypes_d_NewBlockEvent = NewBlockEvent;
1510
+ type EventTypes_d_NodeChangeEvent = NodeChangeEvent;
1511
+ type EventTypes_d_FormatEvent = FormatEvent;
1512
+ type EventTypes_d_ObjectResizeEvent = ObjectResizeEvent;
1513
+ type EventTypes_d_ObjectSelectedEvent = ObjectSelectedEvent;
1514
+ type EventTypes_d_ScrollIntoViewEvent = ScrollIntoViewEvent;
1515
+ type EventTypes_d_SetSelectionRangeEvent = SetSelectionRangeEvent;
1516
+ type EventTypes_d_ShowCaretEvent = ShowCaretEvent;
1517
+ type EventTypes_d_SwitchModeEvent = SwitchModeEvent;
1518
+ type EventTypes_d_AddUndoEvent = AddUndoEvent;
1519
+ type EventTypes_d_UndoRedoEvent = UndoRedoEvent;
1520
+ type EventTypes_d_WindowEvent<_0> = WindowEvent<_0>;
1521
+ type EventTypes_d_ProgressStateEvent = ProgressStateEvent;
1522
+ type EventTypes_d_AfterProgressStateEvent = AfterProgressStateEvent;
1523
+ type EventTypes_d_PlaceholderToggleEvent = PlaceholderToggleEvent;
1524
+ type EventTypes_d_LoadErrorEvent = LoadErrorEvent;
1525
+ type EventTypes_d_PreProcessEvent = PreProcessEvent;
1526
+ type EventTypes_d_PostProcessEvent = PostProcessEvent;
1527
+ type EventTypes_d_PastePlainTextToggleEvent = PastePlainTextToggleEvent;
1528
+ type EventTypes_d_PastePreProcessEvent = PastePreProcessEvent;
1529
+ type EventTypes_d_PastePostProcessEvent = PastePostProcessEvent;
1530
+ type EventTypes_d_NewTableRowEvent = NewTableRowEvent;
1531
+ type EventTypes_d_NewTableCellEvent = NewTableCellEvent;
1532
+ type EventTypes_d_TableEventData = TableEventData;
1533
+ type EventTypes_d_TableModifiedEvent = TableModifiedEvent;
1534
+ type EventTypes_d_EditorEventMap = EditorEventMap;
1535
+ type EventTypes_d_EditorManagerEventMap = EditorManagerEventMap;
1536
+ declare namespace EventTypes_d {
1537
+ export { EventTypes_d_ExecCommandEvent as ExecCommandEvent, EventTypes_d_BeforeGetContentEvent as BeforeGetContentEvent, EventTypes_d_GetContentEvent as GetContentEvent, EventTypes_d_BeforeSetContentEvent as BeforeSetContentEvent, EventTypes_d_SetContentEvent as SetContentEvent, EventTypes_d_NewBlockEvent as NewBlockEvent, EventTypes_d_NodeChangeEvent as NodeChangeEvent, EventTypes_d_FormatEvent as FormatEvent, EventTypes_d_ObjectResizeEvent as ObjectResizeEvent, EventTypes_d_ObjectSelectedEvent as ObjectSelectedEvent, EventTypes_d_ScrollIntoViewEvent as ScrollIntoViewEvent, EventTypes_d_SetSelectionRangeEvent as SetSelectionRangeEvent, EventTypes_d_ShowCaretEvent as ShowCaretEvent, EventTypes_d_SwitchModeEvent as SwitchModeEvent, EventTypes_d_AddUndoEvent as AddUndoEvent, EventTypes_d_UndoRedoEvent as UndoRedoEvent, EventTypes_d_WindowEvent as WindowEvent, EventTypes_d_ProgressStateEvent as ProgressStateEvent, EventTypes_d_AfterProgressStateEvent as AfterProgressStateEvent, EventTypes_d_PlaceholderToggleEvent as PlaceholderToggleEvent, EventTypes_d_LoadErrorEvent as LoadErrorEvent, EventTypes_d_PreProcessEvent as PreProcessEvent, EventTypes_d_PostProcessEvent as PostProcessEvent, EventTypes_d_PastePlainTextToggleEvent as PastePlainTextToggleEvent, EventTypes_d_PastePreProcessEvent as PastePreProcessEvent, EventTypes_d_PastePostProcessEvent as PastePostProcessEvent, EventTypes_d_NewTableRowEvent as NewTableRowEvent, EventTypes_d_NewTableCellEvent as NewTableCellEvent, EventTypes_d_TableEventData as TableEventData, EventTypes_d_TableModifiedEvent as TableModifiedEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, };
1538
+ }
1539
+ type Format_d_Formats = Formats;
1540
+ type Format_d_Format = Format;
1541
+ type Format_d_ApplyFormat = ApplyFormat;
1542
+ type Format_d_BlockFormat = BlockFormat;
1543
+ type Format_d_InlineFormat = InlineFormat;
1544
+ type Format_d_SelectorFormat = SelectorFormat;
1545
+ type Format_d_RemoveFormat = RemoveFormat;
1546
+ type Format_d_RemoveBlockFormat = RemoveBlockFormat;
1547
+ type Format_d_RemoveInlineFormat = RemoveInlineFormat;
1548
+ type Format_d_RemoveSelectorFormat = RemoveSelectorFormat;
1549
+ declare namespace Format_d {
1550
+ export { Format_d_Formats as Formats, Format_d_Format as Format, Format_d_ApplyFormat as ApplyFormat, Format_d_BlockFormat as BlockFormat, Format_d_InlineFormat as InlineFormat, Format_d_SelectorFormat as SelectorFormat, Format_d_RemoveFormat as RemoveFormat, Format_d_RemoveBlockFormat as RemoveBlockFormat, Format_d_RemoveInlineFormat as RemoveInlineFormat, Format_d_RemoveSelectorFormat as RemoveSelectorFormat, };
1551
+ }
1552
+ declare type StyleFormat = BlockStyleFormat | InlineStyleFormat | SelectorStyleFormat;
1553
+ declare type AllowedFormat = Separator | FormatReference | StyleFormat | NestedFormatting;
1554
+ interface Separator {
1555
+ title: string;
1556
+ }
1557
+ interface FormatReference {
1558
+ title: string;
1559
+ format: string;
1560
+ icon?: string;
1561
+ }
1562
+ interface NestedFormatting {
1563
+ title: string;
1564
+ items: Array<FormatReference | StyleFormat>;
1565
+ }
1566
+ interface CommonStyleFormat {
1567
+ name?: string;
1568
+ title: string;
1569
+ icon?: string;
1570
+ }
1571
+ interface BlockStyleFormat extends BlockFormat, CommonStyleFormat {
1572
+ }
1573
+ interface InlineStyleFormat extends InlineFormat, CommonStyleFormat {
1574
+ }
1575
+ interface SelectorStyleFormat extends SelectorFormat, CommonStyleFormat {
1576
+ }
1577
+ declare type EntityEncoding = 'named' | 'numeric' | 'raw' | 'named,numeric' | 'named+numeric' | 'numeric,named' | 'numeric+named';
1578
+ interface ContentLanguage {
1579
+ readonly title: string;
1580
+ readonly code: string;
1581
+ readonly customCode?: string;
1582
+ }
1583
+ declare type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => {
1584
+ editorContainer: HTMLElement;
1585
+ iframeContainer: HTMLElement;
1586
+ height?: number;
1587
+ iframeHeight?: number;
1588
+ api?: EditorUiApi;
1589
+ };
1590
+ declare type SetupCallback = (editor: Editor) => void;
1591
+ declare type FilePickerCallback = (callback: Function, value: any, meta: Record<string, any>) => void;
1592
+ declare type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none';
1593
+ declare type FilePickerValidationCallback = (info: {
1594
+ type: string;
1595
+ url: string;
1596
+ }, callback: (validation: {
1597
+ status: FilePickerValidationStatus;
1598
+ message: string;
1599
+ }) => void) => void;
1600
+ declare type PastePreProcessFn = (editor: Editor, args: PastePreProcessEvent) => void;
1601
+ declare type PastePostProcessFn = (editor: Editor, args: PastePostProcessEvent) => void;
1602
+ declare type URLConverter = (url: string, name: string, elm?: HTMLElement) => string;
1603
+ declare type URLConverterCallback = (url: string, node: Node, on_save: boolean, name: string) => string;
1604
+ interface ToolbarGroup {
1605
+ name?: string;
1606
+ items: string[];
1607
+ }
1608
+ declare type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
1609
+ interface BaseEditorOptions {
1610
+ a11y_advanced_options?: boolean;
1611
+ add_form_submit_trigger?: boolean;
1612
+ add_unload_trigger?: boolean;
1613
+ allow_conditional_comments?: boolean;
1614
+ allow_html_data_urls?: boolean;
1615
+ allow_html_in_named_anchor?: boolean;
1616
+ allow_script_urls?: boolean;
1617
+ allow_svg_data_urls?: boolean;
1618
+ allow_unsafe_link_target?: boolean;
1619
+ anchor_bottom?: false | string;
1620
+ anchor_top?: false | string;
1621
+ auto_focus?: string | true;
1622
+ automatic_uploads?: boolean;
1623
+ base_url?: string;
1624
+ block_formats?: string;
1625
+ block_unsupported_drop?: boolean;
1626
+ body_id?: string;
1627
+ body_class?: string;
1628
+ br_in_pre?: boolean;
1388
1629
  br_newline_selector?: string;
1389
1630
  browser_spellcheck?: boolean;
1390
1631
  branding?: boolean;
@@ -1395,10 +1636,8 @@ interface BaseEditorSettings {
1395
1636
  content_css_cors?: boolean;
1396
1637
  content_security_policy?: string;
1397
1638
  content_style?: string;
1398
- deprecation_warnings?: boolean;
1399
- font_css?: string | string[];
1400
1639
  content_langs?: ContentLanguage[];
1401
- contextmenu?: string | false;
1640
+ contextmenu?: string | string[] | false;
1402
1641
  contextmenu_never_use_native?: boolean;
1403
1642
  convert_fonts_to_spans?: boolean;
1404
1643
  convert_urls?: boolean;
@@ -1406,9 +1645,11 @@ interface BaseEditorSettings {
1406
1645
  custom_elements?: string;
1407
1646
  custom_ui_selector?: string;
1408
1647
  custom_undo_redo_levels?: number;
1648
+ deprecation_warnings?: boolean;
1409
1649
  directionality?: 'ltr' | 'rtl';
1410
1650
  doctype?: string;
1411
1651
  document_base_url?: string;
1652
+ editable_class?: string;
1412
1653
  element_format?: 'xhtml' | 'html';
1413
1654
  elementpath?: boolean;
1414
1655
  encoding?: string;
@@ -1423,23 +1664,22 @@ interface BaseEditorSettings {
1423
1664
  fix_list_elements?: boolean;
1424
1665
  fixed_toolbar_container?: string;
1425
1666
  fixed_toolbar_container_target?: HTMLElement;
1426
- font_formats?: string;
1667
+ font_css?: string | string[];
1668
+ font_family_formats?: string;
1427
1669
  font_size_classes?: string;
1428
1670
  font_size_legacy_values?: string;
1429
1671
  font_size_style_values?: string;
1430
- fontsize_formats?: string;
1431
- force_hex_style_colors?: boolean;
1432
- forced_root_block?: boolean | string;
1672
+ font_size_formats?: string;
1673
+ forced_root_block?: string;
1433
1674
  forced_root_block_attrs?: Record<string, string>;
1434
1675
  formats?: Formats;
1435
- gecko_spellcheck?: boolean;
1436
1676
  height?: number | string;
1437
1677
  hidden_input?: boolean;
1438
1678
  icons?: string;
1439
1679
  icons_url?: string;
1440
1680
  id?: string;
1441
1681
  iframe_aria_text?: string;
1442
- images_dataimg_filter?: (imgElm: HTMLImageElement) => boolean;
1682
+ iframe_attrs?: Record<string, string>;
1443
1683
  images_file_types?: string;
1444
1684
  images_replace_blob_uris?: boolean;
1445
1685
  images_reuse_filename?: boolean;
@@ -1463,7 +1703,7 @@ interface BaseEditorSettings {
1463
1703
  language?: string;
1464
1704
  language_load?: boolean;
1465
1705
  language_url?: string;
1466
- lineheight_formats?: string;
1706
+ line_height_formats?: string;
1467
1707
  max_height?: number;
1468
1708
  max_width?: number;
1469
1709
  menu?: Record<string, {
@@ -1473,13 +1713,25 @@ interface BaseEditorSettings {
1473
1713
  menubar?: boolean | string;
1474
1714
  min_height?: number;
1475
1715
  min_width?: number;
1716
+ model?: string;
1717
+ model_url?: string;
1476
1718
  no_newline_selector?: string;
1719
+ noneditable_class?: string;
1720
+ noneditable_regexp?: RegExp | RegExp[];
1477
1721
  nowrap?: boolean;
1478
1722
  object_resizing?: boolean | string;
1479
- padd_empty_with_br?: boolean;
1723
+ paste_as_text?: boolean;
1724
+ paste_block_drop?: boolean;
1725
+ paste_data_images?: boolean;
1726
+ paste_merge_formats?: boolean;
1727
+ paste_postprocess?: PastePostProcessFn;
1728
+ paste_preprocess?: PastePreProcessFn;
1729
+ paste_remove_styles_if_webkit?: boolean;
1730
+ paste_tab_spaces?: number;
1731
+ paste_webkit_styles?: string;
1480
1732
  placeholder?: string;
1481
1733
  preserve_cdata?: boolean;
1482
- preview_styles?: boolean | string;
1734
+ preview_styles?: false | string;
1483
1735
  protect?: RegExp[];
1484
1736
  readonly?: boolean;
1485
1737
  referrer_policy?: ReferrerPolicy;
@@ -1495,14 +1747,17 @@ interface BaseEditorSettings {
1495
1747
  setup?: SetupCallback;
1496
1748
  skin?: boolean | string;
1497
1749
  skin_url?: string;
1750
+ smart_paste?: boolean;
1498
1751
  statusbar?: boolean;
1499
1752
  style_formats?: AllowedFormat[];
1500
1753
  style_formats_autohide?: boolean;
1501
1754
  style_formats_merge?: boolean;
1502
1755
  submit_patch?: boolean;
1503
1756
  suffix?: string;
1757
+ table_tab_navigation?: boolean;
1504
1758
  target?: HTMLElement;
1505
- theme?: string | ThemeInitFunc;
1759
+ text_patterns?: RawPattern[] | false;
1760
+ theme?: string | ThemeInitFunc | false;
1506
1761
  theme_url?: string;
1507
1762
  toolbar?: boolean | string | string[] | Array<ToolbarGroup>;
1508
1763
  toolbar1?: string;
@@ -1515,10 +1770,12 @@ interface BaseEditorSettings {
1515
1770
  toolbar8?: string;
1516
1771
  toolbar9?: string;
1517
1772
  toolbar_mode?: ToolbarMode;
1773
+ toolbar_sticky?: boolean;
1774
+ toolbar_sticky_offset?: number;
1518
1775
  typeahead_urls?: boolean;
1519
1776
  url_converter?: URLConverter;
1520
1777
  url_converter_scope?: any;
1521
- urlconverter_callback?: string | URLConverterCallback;
1778
+ urlconverter_callback?: URLConverterCallback;
1522
1779
  valid_children?: string;
1523
1780
  valid_classes?: string | Record<string, string>;
1524
1781
  valid_elements?: string;
@@ -1528,107 +1785,34 @@ interface BaseEditorSettings {
1528
1785
  visual_anchor_class?: string;
1529
1786
  visual_table_class?: string;
1530
1787
  width?: number | string;
1531
- toolbar_drawer?: false | 'floating' | 'sliding' | 'scrolling';
1532
- editor_deselector?: string;
1533
- editor_selector?: string;
1534
- elements?: string;
1535
- filepicker_validator_handler?: FilePickerValidationCallback;
1536
- mode?: 'exact' | 'textareas' | 'specific_textareas';
1537
- types?: Record<string, any>[];
1538
- block_elements?: string;
1539
- boolean_attributes?: string;
1540
- move_caret_before_on_enter_elements?: string;
1541
- non_empty_elements?: string;
1542
- self_closing_elements?: string;
1543
- short_ended_elements?: string;
1544
- text_block_elements?: string;
1545
- text_inline_elements?: string;
1546
- whitespace_elements?: string;
1547
- special?: string;
1548
1788
  disable_nodechange?: boolean;
1549
1789
  forced_plugins?: string | string[];
1550
1790
  plugin_base_urls?: Record<string, string>;
1551
1791
  service_message?: string;
1552
- validate?: boolean;
1553
1792
  [key: string]: any;
1554
1793
  }
1555
- interface RawEditorSettings extends BaseEditorSettings {
1794
+ interface RawEditorOptions extends BaseEditorOptions {
1556
1795
  external_plugins?: Record<string, string>;
1557
- mobile?: RawEditorSettings;
1796
+ mobile?: RawEditorOptions;
1558
1797
  plugins?: string | string[];
1559
1798
  }
1560
- interface EditorSettings extends BaseEditorSettings {
1799
+ interface NormalizedEditorOptions extends BaseEditorOptions {
1561
1800
  external_plugins: Record<string, string>;
1562
- plugins: string;
1563
- }
1564
- interface ParamTypeMap {
1565
- 'hash': Record<string, string>;
1566
- 'string': string;
1567
- 'number': number;
1568
- 'boolean': boolean;
1569
- 'string[]': string[];
1570
- 'array': any[];
1571
- }
1572
- interface BlobInfoImagePair {
1573
- image: HTMLImageElement;
1574
- blobInfo: BlobInfo;
1575
- }
1576
- declare class NodeChange {
1577
- private readonly editor;
1578
- private lastPath;
1579
- constructor(editor: Editor);
1580
- nodeChanged(args?: any): void;
1581
- private isSameElementPath;
1582
- }
1583
- interface SelectionOverrides {
1584
- showCaret: (direction: number, node: Element, before: boolean, scrollIntoView?: boolean) => Range | null;
1585
- showBlockCaretContainer: (blockCaretContainer: Element) => void;
1586
- hideFakeCaret: () => void;
1587
- destroy: () => void;
1588
- }
1589
- interface Quirks {
1590
- refreshContentEditable(): void;
1591
- isHidden(): boolean;
1592
- }
1593
- declare type DecoratorData = Record<string, any>;
1594
- declare type Decorator = (uid: string, data: DecoratorData) => {
1595
- attributes?: {};
1596
- classes?: string[];
1597
- };
1598
- declare type AnnotationListener = (state: boolean, name: string, data?: {
1599
- uid: string;
1600
- nodes: any[];
1601
- }) => void;
1602
- declare type AnnotationListenerApi = AnnotationListener;
1603
- interface AnnotatorSettings {
1604
- decorate: Decorator;
1605
- persistent?: boolean;
1606
- }
1607
- interface Annotator {
1608
- register: (name: string, settings: AnnotatorSettings) => void;
1609
- annotate: (name: string, data: DecoratorData) => void;
1610
- annotationChanged: (name: string, f: AnnotationListenerApi) => void;
1611
- remove: (name: string) => void;
1612
- getAll: (name: string) => Record<string, Element[]>;
1613
- }
1614
- interface GeomRect {
1615
- readonly x: number;
1616
- readonly y: number;
1617
- readonly w: number;
1618
- readonly h: number;
1619
- }
1620
- interface Rect {
1621
- inflate: (rect: GeomRect, w: number, h: number) => GeomRect;
1622
- relativePosition: (rect: GeomRect, targetRect: GeomRect, rel: string) => GeomRect;
1623
- findBestRelativePosition: (rect: GeomRect, targetRect: GeomRect, constrainRect: GeomRect, rels: string[]) => string | null;
1624
- intersect: (rect: GeomRect, cropRect: GeomRect) => GeomRect | null;
1625
- clamp: (rect: GeomRect, clampRect: GeomRect, fixedSize?: boolean) => GeomRect;
1626
- create: (x: number, y: number, w: number, h: number) => GeomRect;
1627
- fromClientRect: (clientRect: DOMRect) => GeomRect;
1628
- }
1629
- interface StyleMap {
1630
- [s: string]: string | number;
1631
- }
1801
+ forced_plugins: string[];
1802
+ plugins: string[];
1803
+ }
1804
+ interface EditorOptions extends NormalizedEditorOptions {
1805
+ content_css: string[];
1806
+ contextmenu: string[];
1807
+ font_css: string[];
1808
+ forced_root_block: string;
1809
+ forced_root_block_attrs: Record<string, string>;
1810
+ noneditable_regexp: RegExp[];
1811
+ object_resizing?: string;
1812
+ preview_styles?: string;
1813
+ text_patterns?: Pattern[];
1814
+ }
1815
+ declare type StyleMap = Record<string, string | number>;
1632
1816
  interface StylesSettings {
1633
1817
  allow_script_urls?: boolean;
1634
1818
  allow_svg_data_urls?: boolean;
@@ -1636,17 +1820,46 @@ interface StylesSettings {
1636
1820
  url_converter_scope?: any;
1637
1821
  }
1638
1822
  interface Styles {
1639
- toHex: (color: string) => string;
1640
1823
  parse: (css: string) => Record<string, string>;
1641
1824
  serialize: (styles: StyleMap, elementName?: string) => string;
1642
1825
  }
1826
+ declare type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void;
1827
+ declare type EventUtilsEvent<T> = NormalizedEvent<T> & {
1828
+ metaKey: boolean;
1829
+ };
1830
+ interface EventUtilsConstructor {
1831
+ readonly prototype: EventUtils;
1832
+ new (): EventUtils;
1833
+ Event: EventUtils;
1834
+ }
1835
+ declare class EventUtils {
1836
+ static Event: EventUtils;
1837
+ domLoaded: boolean;
1838
+ events: Record<string, any>;
1839
+ private readonly expando;
1840
+ private hasFocusIn;
1841
+ private hasMouseEnterLeave;
1842
+ private mouseEnterLeave;
1843
+ private count;
1844
+ constructor();
1845
+ bind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback: EventUtilsCallback<HTMLElementEventMap[K]>, scope?: any): EventUtilsCallback<HTMLElementEventMap[K]>;
1846
+ bind<T = any>(target: any, names: string, callback: EventUtilsCallback<T>, scope?: any): EventUtilsCallback<T>;
1847
+ unbind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback?: EventUtilsCallback<HTMLElementEventMap[K]>): this;
1848
+ unbind<T = any>(target: any, names: string, callback?: EventUtilsCallback<T>): this;
1849
+ unbind(target: any): this;
1850
+ fire(target: any, name: string, args?: {}): this;
1851
+ dispatch(target: any, name: string, args?: {}): this;
1852
+ clean(target: any): this;
1853
+ destroy(): void;
1854
+ cancel<T = any>(e: EventUtilsEvent<T>): boolean;
1855
+ private executeHandlers;
1856
+ }
1643
1857
  interface DOMUtilsSettings {
1644
1858
  schema: Schema;
1645
1859
  url_converter: URLConverter;
1646
1860
  url_converter_scope: any;
1647
1861
  ownEvents: boolean;
1648
1862
  keep_values: boolean;
1649
- hex_colors: boolean;
1650
1863
  update_styles: boolean;
1651
1864
  root_element: HTMLElement;
1652
1865
  collect: Function;
@@ -1663,6 +1876,7 @@ declare type BoundEvent = [
1663
1876
  any
1664
1877
  ];
1665
1878
  declare type Callback<K extends string> = EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>;
1879
+ declare type RunResult<T, R> = T extends Array<any> ? false | R[] : false | R;
1666
1880
  interface DOMUtils {
1667
1881
  doc: Document;
1668
1882
  settings: Partial<DOMUtilsSettings>;
@@ -1676,11 +1890,6 @@ interface DOMUtils {
1676
1890
  schema: Schema;
1677
1891
  events: EventUtils;
1678
1892
  root: Node;
1679
- $: DomQueryConstructor;
1680
- $$: {
1681
- <T extends Node>(elm: T | T[] | DomQuery<T>): DomQuery<T>;
1682
- (elm: string): DomQuery<Node>;
1683
- };
1684
1893
  isBlock: (node: string | Node) => boolean;
1685
1894
  clone: (node: Node, deep: boolean) => Node;
1686
1895
  getRoot: () => HTMLElement;
@@ -1715,12 +1924,9 @@ interface DOMUtils {
1715
1924
  };
1716
1925
  createHTML: (name: string, attrs?: Record<string, string>, html?: string) => string;
1717
1926
  createFragment: (html?: string) => DocumentFragment;
1718
- remove: <T extends Node>(node: string | T | T[] | DomQuery<T>, keepChildren?: boolean) => T | T[];
1719
- setStyle: {
1720
- (elm: string | Node | Node[], name: string, value: string | number | null): void;
1721
- (elm: string | Node | Node[], styles: StyleMap): void;
1722
- };
1723
- getStyle: (elm: string | Node, name: string, computed?: boolean) => string;
1927
+ remove: <T extends Node>(node: string | T | T[], keepChildren?: boolean) => RunResult<typeof node, T>;
1928
+ setStyle: (elm: string | Node | Node[], name: string, value: string | number | null) => void;
1929
+ getStyle: (elm: string | Node, name: string, computed?: boolean) => string | undefined;
1724
1930
  setStyles: (elm: string | Node | Node[], stylesArg: StyleMap) => void;
1725
1931
  removeAllAttribs: (e: RunArguments<Element>) => void;
1726
1932
  setAttrib: (elm: string | Node | Node[], name: string, value: string | boolean | number | null) => void;
@@ -1749,7 +1955,7 @@ interface DOMUtils {
1749
1955
  encode: (text: string) => string;
1750
1956
  insertAfter: {
1751
1957
  <T extends Node>(node: T | T[], reference: string | Node): T;
1752
- <T extends Node>(node: RunArguments<T>, reference: string | Node): false | T;
1958
+ <T extends Node>(node: RunArguments<T>, reference: string | Node): RunResult<typeof node, T>;
1753
1959
  };
1754
1960
  replace: {
1755
1961
  <T extends Node>(newElm: Node, oldElm: T | T[], keepChildren?: boolean): T;
@@ -1760,9 +1966,8 @@ interface DOMUtils {
1760
1966
  (elm: Element, name: string): Element;
1761
1967
  };
1762
1968
  findCommonAncestor: (a: Node, b: Node) => Node;
1763
- toHex: (rgbVal: string) => string;
1764
- run<R, T extends Node>(this: DOMUtils, elm: T | T[], func: (node: T) => R, scope?: any): R;
1765
- run<R, T extends Node>(this: DOMUtils, elm: RunArguments<T>, func: (node: T) => R, scope?: any): false | R;
1969
+ run<R, T extends Node>(this: DOMUtils, elm: T | T[], func: (node: T) => R, scope?: any): typeof elm extends Array<any> ? R[] : R;
1970
+ run<R, T extends Node>(this: DOMUtils, elm: RunArguments<T>, func: (node: T) => R, scope?: any): RunResult<typeof elm, R>;
1766
1971
  getAttribs: (elm: string | Node) => NamedNodeMap | Attr[];
1767
1972
  isEmpty: (node: Node, elements?: Record<string, any>) => boolean;
1768
1973
  createRng: () => Range;
@@ -1780,6 +1985,7 @@ interface DOMUtils {
1780
1985
  <K extends string>(target: Target[], name?: K, func?: EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>): EventUtils[];
1781
1986
  };
1782
1987
  fire: (target: Node | Window, name: string, evt?: {}) => EventUtils;
1988
+ dispatch: (target: Node | Window, name: string, evt?: {}) => EventUtils;
1783
1989
  getContentEditable: (node: Node) => string | null;
1784
1990
  getContentEditableParent: (node: Node) => string | null;
1785
1991
  destroy: () => void;
@@ -1794,13 +2000,6 @@ interface ClientRect {
1794
2000
  width: number;
1795
2001
  height: number;
1796
2002
  }
1797
- interface GetSelectionContentArgs extends GetContentArgs {
1798
- selection?: boolean;
1799
- contextual?: boolean;
1800
- }
1801
- interface SelectionSetContentArgs extends SetContentArgs {
1802
- selection?: boolean;
1803
- }
1804
2003
  interface BookmarkManager {
1805
2004
  getBookmark: (type: number, normalized?: boolean) => Bookmark;
1806
2005
  moveToBookmark: (bookmark: Bookmark) => void;
@@ -1812,52 +2011,6 @@ interface ControlSelection {
1812
2011
  updateResizeRect: (evt: EditorEvent<any>) => void;
1813
2012
  destroy: () => void;
1814
2013
  }
1815
- interface ParserArgs {
1816
- getInner?: boolean | number;
1817
- forced_root_block?: boolean | string;
1818
- context?: string;
1819
- isRootContent?: boolean;
1820
- format?: string;
1821
- invalid?: boolean;
1822
- no_events?: boolean;
1823
- [key: string]: any;
1824
- }
1825
- declare type ParserFilterCallback = (nodes: AstNode[], name: string, args: ParserArgs) => void;
1826
- interface ParserFilter {
1827
- name: string;
1828
- callbacks: ParserFilterCallback[];
1829
- }
1830
- interface DomParserSettings {
1831
- allow_html_data_urls?: boolean;
1832
- allow_svg_data_urls?: boolean;
1833
- allow_conditional_comments?: boolean;
1834
- allow_html_in_named_anchor?: boolean;
1835
- allow_script_urls?: boolean;
1836
- allow_unsafe_link_target?: boolean;
1837
- convert_fonts_to_spans?: boolean;
1838
- fix_list_elements?: boolean;
1839
- font_size_legacy_values?: string;
1840
- forced_root_block?: boolean | string;
1841
- forced_root_block_attrs?: Record<string, string>;
1842
- padd_empty_with_br?: boolean;
1843
- preserve_cdata?: boolean;
1844
- remove_trailing_brs?: boolean;
1845
- root_name?: string;
1846
- validate?: boolean;
1847
- inline_styles?: boolean;
1848
- blob_cache?: BlobCache;
1849
- document?: Document;
1850
- images_dataimg_filter?: (img: HTMLImageElement) => boolean;
1851
- }
1852
- interface DomParser {
1853
- schema: Schema;
1854
- addAttributeFilter: (name: string, callback: (nodes: AstNode[], name: string, args: ParserArgs) => void) => void;
1855
- getAttributeFilters: () => ParserFilter[];
1856
- addNodeFilter: (name: string, callback: (nodes: AstNode[], name: string, args: ParserArgs) => void) => void;
1857
- getNodeFilters: () => ParserFilter[];
1858
- filterNode: (node: AstNode) => AstNode;
1859
- parse: (html: string, args?: ParserArgs) => AstNode;
1860
- }
1861
2014
  interface WriterSettings {
1862
2015
  element_format?: 'xhtml' | 'html';
1863
2016
  entities?: string;
@@ -1904,309 +2057,91 @@ interface DomSerializerImpl {
1904
2057
  } & ParserArgs): AstNode;
1905
2058
  (node: Element, parserArgs?: ParserArgs): string;
1906
2059
  };
1907
- addRules: (rules: string) => void;
1908
- setRules: (rules: string) => void;
1909
- addTempAttr: (name: string) => void;
1910
- getTempAttrs: () => string[];
1911
- }
1912
- interface DomSerializer extends DomSerializerImpl {
1913
- }
1914
- interface EditorSelection {
1915
- bookmarkManager: BookmarkManager;
1916
- controlSelection: ControlSelection;
1917
- dom: DOMUtils;
1918
- win: Window;
1919
- serializer: DomSerializer;
1920
- editor: Editor;
1921
- collapse: (toStart?: boolean) => void;
1922
- setCursorLocation: {
1923
- (node: Node, offset: number): void;
1924
- (): void;
1925
- };
1926
- getContent: {
1927
- (args: {
1928
- format: 'tree';
1929
- } & GetSelectionContentArgs): AstNode;
1930
- (args?: GetSelectionContentArgs): string;
1931
- };
1932
- setContent: (content: string, args?: SelectionSetContentArgs) => void;
1933
- getBookmark: (type?: number, normalized?: boolean) => Bookmark;
1934
- moveToBookmark: (bookmark: Bookmark) => void;
1935
- select: (node: Node, content?: boolean) => Node;
1936
- isCollapsed: () => boolean;
1937
- isForward: () => boolean;
1938
- setNode: (elm: Element) => Element;
1939
- getNode: () => Element;
1940
- getSel: () => Selection | null;
1941
- setRng: (rng: Range, forward?: boolean) => void;
1942
- getRng: () => Range;
1943
- getStart: (real?: boolean) => Element;
1944
- getEnd: (real?: boolean) => Element;
1945
- getSelectedBlocks: (startElm?: Element, endElm?: Element) => Element[];
1946
- normalize: () => Range;
1947
- selectorChanged: (selector: string, callback: (active: boolean, args: {
1948
- node: Node;
1949
- selector: String;
1950
- parents: Element[];
1951
- }) => void) => EditorSelection;
1952
- selectorChangedWithUnbind: (selector: string, callback: (active: boolean, args: {
1953
- node: Node;
1954
- selector: String;
1955
- parents: Element[];
1956
- }) => void) => {
1957
- unbind: () => void;
1958
- };
1959
- getScrollContainer: () => HTMLElement;
1960
- scrollIntoView: (elm?: HTMLElement, alignToTop?: boolean) => void;
1961
- placeCaretAt: (clientX: number, clientY: number) => void;
1962
- getBoundingClientRect: () => ClientRect | DOMRect;
1963
- destroy: () => void;
1964
- }
1965
- declare type EditorCommandCallback = (ui: boolean, value: any, args: any) => void;
1966
- declare type EditorCommandsCallback = (command: string, ui: boolean, value: any, args: any) => void;
1967
- interface Commands {
1968
- state: Record<string, (command: string) => boolean>;
1969
- exec: Record<string, EditorCommandsCallback>;
1970
- value: Record<string, (command: string) => string>;
1971
- }
1972
- interface EditorCommandsConstructor {
1973
- readonly prototype: EditorCommands;
1974
- new (editor: Editor): EditorCommands;
1975
- }
1976
- declare class EditorCommands {
1977
- private readonly editor;
1978
- private selectionBookmark;
1979
- private commands;
1980
- constructor(editor: Editor);
1981
- execCommand(command: string, ui?: boolean, value?: any, args?: any): boolean;
1982
- queryCommandState(command: string): boolean;
1983
- queryCommandValue(command: string): string;
1984
- addCommands<K extends keyof Commands>(commandList: Commands[K], type: K): void;
1985
- addCommands(commandList: Record<string, EditorCommandsCallback>): void;
1986
- addCommand(command: string, callback: EditorCommandCallback, scope?: any): void;
1987
- queryCommandSupported(command: string): boolean;
1988
- addQueryStateHandler(command: string, callback: () => boolean, scope?: any): void;
1989
- addQueryValueHandler(command: string, callback: () => string, scope?: any): void;
1990
- hasCustomCommand(command: string): boolean;
1991
- private execNativeCommand;
1992
- private isFormatMatch;
1993
- private toggleFormat;
1994
- private storeSelection;
1995
- private restoreSelection;
1996
- private setupCommands;
1997
- }
1998
- interface WindowParams {
1999
- readonly inline?: 'cursor' | 'toolbar';
2000
- readonly ariaAttrs?: boolean;
2001
- }
2002
- declare type InstanceApi<T> = UrlDialogInstanceApi | DialogInstanceApi<T>;
2003
- interface WindowManagerImpl {
2004
- open: <T>(config: DialogSpec<T>, params: WindowParams, closeWindow: (dialog: DialogInstanceApi<T>) => void) => DialogInstanceApi<T>;
2005
- openUrl: (config: UrlDialogSpec, closeWindow: (dialog: UrlDialogInstanceApi) => void) => UrlDialogInstanceApi;
2006
- alert: (message: string, callback: () => void) => void;
2007
- confirm: (message: string, callback: (state: boolean) => void) => void;
2008
- close: (dialog: InstanceApi<any>) => void;
2009
- }
2010
- interface WindowManager {
2011
- open: <T>(config: DialogSpec<T>, params?: WindowParams) => DialogInstanceApi<T>;
2012
- openUrl: (config: UrlDialogSpec) => UrlDialogInstanceApi;
2013
- alert: (message: string, callback?: () => void, scope?: any) => void;
2014
- confirm: (message: string, callback?: (state: boolean) => void, scope?: any) => void;
2015
- close: () => void;
2016
- }
2017
- interface ExecCommandEvent {
2018
- command: string;
2019
- ui?: boolean;
2020
- value?: any;
2021
- }
2022
- declare type GetContentEvent = GetContentArgs & {
2023
- source_view?: boolean;
2024
- selection?: boolean;
2025
- save?: boolean;
2026
- };
2027
- declare type SetContentEvent = SetContentArgs & {
2028
- source_view?: boolean;
2029
- paste?: boolean;
2030
- selection?: boolean;
2031
- };
2032
- interface NewBlockEvent {
2033
- newBlock: Element;
2034
- }
2035
- interface NodeChangeEvent {
2036
- element: Element;
2037
- parents: Node[];
2038
- selectionChange?: boolean;
2039
- initial?: boolean;
2040
- }
2041
- interface FormatEvent {
2042
- format: string;
2043
- vars?: FormatVars;
2044
- node?: Node | RangeLikeObject;
2045
- }
2046
- interface ObjectResizeEvent {
2047
- target: HTMLElement;
2048
- width: number;
2049
- height: number;
2050
- origin: string;
2051
- }
2052
- interface ObjectSelectedEvent {
2053
- target: Node;
2054
- targetClone?: Node;
2055
- }
2056
- interface ScrollIntoViewEvent {
2057
- elm: HTMLElement;
2058
- alignToTop: boolean;
2059
- }
2060
- interface SetSelectionRangeEvent {
2061
- range: Range;
2062
- forward: boolean;
2063
- }
2064
- interface ShowCaretEvent {
2065
- target: Node;
2066
- direction: number;
2067
- before: boolean;
2068
- }
2069
- interface SwitchModeEvent {
2070
- mode: string;
2071
- }
2072
- interface AddUndoEvent {
2073
- level: UndoLevel;
2074
- lastLevel: UndoLevel;
2075
- originalEvent: Event;
2076
- }
2077
- interface UndoRedoEvent {
2078
- level: UndoLevel;
2079
- }
2080
- interface WindowEvent<T extends DialogData> {
2081
- dialog: InstanceApi<T>;
2082
- }
2083
- interface ProgressStateEvent {
2084
- state: boolean;
2085
- time?: number;
2086
- }
2087
- interface AfterProgressStateEvent {
2088
- state: boolean;
2089
- }
2090
- interface PlaceholderToggleEvent {
2091
- state: boolean;
2092
- }
2093
- interface LoadErrorEvent {
2094
- message: string;
2095
- }
2096
- interface PreProcessEvent extends ParserArgs {
2097
- node: Element;
2060
+ addRules: (rules: string) => void;
2061
+ setRules: (rules: string) => void;
2062
+ addTempAttr: (name: string) => void;
2063
+ getTempAttrs: () => string[];
2098
2064
  }
2099
- interface PostProcessEvent extends ParserArgs {
2100
- content: string;
2065
+ interface DomSerializer extends DomSerializerImpl {
2101
2066
  }
2102
- interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
2103
- 'activate': {
2104
- relatedTarget: Editor;
2105
- };
2106
- 'deactivate': {
2107
- relatedTarget: Editor;
2108
- };
2109
- 'focus': {
2110
- blurredEditor: Editor;
2067
+ interface EditorSelection {
2068
+ bookmarkManager: BookmarkManager;
2069
+ controlSelection: ControlSelection;
2070
+ dom: DOMUtils;
2071
+ win: Window;
2072
+ serializer: DomSerializer;
2073
+ editor: Editor;
2074
+ collapse: (toStart?: boolean) => void;
2075
+ setCursorLocation: {
2076
+ (node: Node, offset: number): void;
2077
+ (): void;
2111
2078
  };
2112
- 'blur': {
2113
- focusedEditor: Editor;
2079
+ getContent: {
2080
+ (args: {
2081
+ format: 'tree';
2082
+ } & Partial<GetSelectionContentArgs>): AstNode;
2083
+ (args?: Partial<GetSelectionContentArgs>): string;
2114
2084
  };
2115
- 'resize': UIEvent;
2116
- 'scroll': UIEvent;
2117
- 'detach': {};
2118
- 'remove': {};
2119
- 'init': {};
2120
- 'ScrollIntoView': ScrollIntoViewEvent;
2121
- 'AfterScrollIntoView': ScrollIntoViewEvent;
2122
- 'ObjectResized': ObjectResizeEvent;
2123
- 'ObjectResizeStart': ObjectResizeEvent;
2124
- 'SwitchMode': SwitchModeEvent;
2125
- 'ScrollWindow': UIEvent;
2126
- 'ResizeWindow': UIEvent;
2127
- 'SkinLoaded': {};
2128
- 'SkinLoadError': LoadErrorEvent;
2129
- 'PluginLoadError': LoadErrorEvent;
2130
- 'IconsLoadError': LoadErrorEvent;
2131
- 'LanguageLoadError': LoadErrorEvent;
2132
- 'BeforeExecCommand': ExecCommandEvent;
2133
- 'ExecCommand': ExecCommandEvent;
2134
- 'NodeChange': NodeChangeEvent;
2135
- 'FormatApply': FormatEvent;
2136
- 'FormatRemove': FormatEvent;
2137
- 'ShowCaret': ShowCaretEvent;
2138
- 'SelectionChange': {};
2139
- 'ObjectSelected': ObjectSelectedEvent;
2140
- 'BeforeObjectSelected': ObjectSelectedEvent;
2141
- 'GetSelectionRange': {
2142
- range: Range;
2085
+ setContent: (content: string, args?: Partial<SetSelectionContentArgs>) => void;
2086
+ getBookmark: (type?: number, normalized?: boolean) => Bookmark;
2087
+ moveToBookmark: (bookmark: Bookmark) => void;
2088
+ select: (node: Node, content?: boolean) => Node;
2089
+ isCollapsed: () => boolean;
2090
+ isForward: () => boolean;
2091
+ setNode: (elm: Element) => Element;
2092
+ getNode: () => Element;
2093
+ getSel: () => Selection | null;
2094
+ setRng: (rng: Range, forward?: boolean) => void;
2095
+ getRng: () => Range;
2096
+ getStart: (real?: boolean) => Element;
2097
+ getEnd: (real?: boolean) => Element;
2098
+ getSelectedBlocks: (startElm?: Element, endElm?: Element) => Element[];
2099
+ normalize: () => Range;
2100
+ selectorChanged: (selector: string, callback: (active: boolean, args: {
2101
+ node: Node;
2102
+ selector: String;
2103
+ parents: Element[];
2104
+ }) => void) => EditorSelection;
2105
+ selectorChangedWithUnbind: (selector: string, callback: (active: boolean, args: {
2106
+ node: Node;
2107
+ selector: String;
2108
+ parents: Element[];
2109
+ }) => void) => {
2110
+ unbind: () => void;
2143
2111
  };
2144
- 'SetSelectionRange': SetSelectionRangeEvent;
2145
- 'AfterSetSelectionRange': SetSelectionRangeEvent;
2146
- 'BeforeGetContent': GetContentEvent;
2147
- 'GetContent': GetContentEvent;
2148
- 'BeforeSetContent': SetContentEvent;
2149
- 'SetContent': SetContentEvent;
2150
- 'LoadContent': {};
2151
- 'PreviewFormats': {};
2152
- 'AfterPreviewFormats': {};
2153
- 'ScriptsLoaded': {};
2154
- 'PreInit': {};
2155
- 'PostRender': {};
2156
- 'NewBlock': NewBlockEvent;
2157
- 'ClearUndos': {};
2158
- 'TypingUndo': {};
2159
- 'Redo': UndoRedoEvent;
2160
- 'Undo': UndoRedoEvent;
2161
- 'BeforeAddUndo': AddUndoEvent;
2162
- 'AddUndo': AddUndoEvent;
2163
- 'CloseWindow': WindowEvent<any>;
2164
- 'OpenWindow': WindowEvent<any>;
2165
- 'ProgressState': ProgressStateEvent;
2166
- 'AfterProgressState': AfterProgressStateEvent;
2167
- 'PlaceholderToggle': PlaceholderToggleEvent;
2168
- 'tap': TouchEvent;
2169
- 'longpress': TouchEvent;
2170
- 'longpresscancel': {};
2171
- 'PreProcess': PreProcessEvent;
2172
- 'PostProcess': PostProcessEvent;
2112
+ getScrollContainer: () => HTMLElement;
2113
+ scrollIntoView: (elm?: HTMLElement, alignToTop?: boolean) => void;
2114
+ placeCaretAt: (clientX: number, clientY: number) => void;
2115
+ getBoundingClientRect: () => ClientRect | DOMRect;
2116
+ destroy: () => void;
2173
2117
  }
2174
- interface EditorManagerEventMap {
2175
- 'AddEditor': {
2176
- editor: Editor;
2177
- };
2178
- 'RemoveEditor': {
2179
- editor: Editor;
2180
- };
2181
- 'BeforeUnload': {
2182
- returnValue: any;
2183
- };
2118
+ declare type EditorCommandCallback = (ui: boolean, value: any) => void;
2119
+ declare type EditorCommandsCallback = (command: string, ui: boolean, value: any) => void;
2120
+ interface Commands {
2121
+ state: Record<string, (command: string) => boolean>;
2122
+ exec: Record<string, EditorCommandsCallback>;
2123
+ value: Record<string, (command: string) => string>;
2184
2124
  }
2185
- type EventTypes_d_ExecCommandEvent = ExecCommandEvent;
2186
- type EventTypes_d_GetContentEvent = GetContentEvent;
2187
- type EventTypes_d_SetContentEvent = SetContentEvent;
2188
- type EventTypes_d_NewBlockEvent = NewBlockEvent;
2189
- type EventTypes_d_NodeChangeEvent = NodeChangeEvent;
2190
- type EventTypes_d_FormatEvent = FormatEvent;
2191
- type EventTypes_d_ObjectResizeEvent = ObjectResizeEvent;
2192
- type EventTypes_d_ObjectSelectedEvent = ObjectSelectedEvent;
2193
- type EventTypes_d_ScrollIntoViewEvent = ScrollIntoViewEvent;
2194
- type EventTypes_d_SetSelectionRangeEvent = SetSelectionRangeEvent;
2195
- type EventTypes_d_ShowCaretEvent = ShowCaretEvent;
2196
- type EventTypes_d_SwitchModeEvent = SwitchModeEvent;
2197
- type EventTypes_d_AddUndoEvent = AddUndoEvent;
2198
- type EventTypes_d_UndoRedoEvent = UndoRedoEvent;
2199
- type EventTypes_d_WindowEvent<_0> = WindowEvent<_0>;
2200
- type EventTypes_d_ProgressStateEvent = ProgressStateEvent;
2201
- type EventTypes_d_AfterProgressStateEvent = AfterProgressStateEvent;
2202
- type EventTypes_d_PlaceholderToggleEvent = PlaceholderToggleEvent;
2203
- type EventTypes_d_LoadErrorEvent = LoadErrorEvent;
2204
- type EventTypes_d_PreProcessEvent = PreProcessEvent;
2205
- type EventTypes_d_PostProcessEvent = PostProcessEvent;
2206
- type EventTypes_d_EditorEventMap = EditorEventMap;
2207
- type EventTypes_d_EditorManagerEventMap = EditorManagerEventMap;
2208
- declare namespace EventTypes_d {
2209
- export { EventTypes_d_ExecCommandEvent as ExecCommandEvent, EventTypes_d_GetContentEvent as GetContentEvent, EventTypes_d_SetContentEvent as SetContentEvent, EventTypes_d_NewBlockEvent as NewBlockEvent, EventTypes_d_NodeChangeEvent as NodeChangeEvent, EventTypes_d_FormatEvent as FormatEvent, EventTypes_d_ObjectResizeEvent as ObjectResizeEvent, EventTypes_d_ObjectSelectedEvent as ObjectSelectedEvent, EventTypes_d_ScrollIntoViewEvent as ScrollIntoViewEvent, EventTypes_d_SetSelectionRangeEvent as SetSelectionRangeEvent, EventTypes_d_ShowCaretEvent as ShowCaretEvent, EventTypes_d_SwitchModeEvent as SwitchModeEvent, EventTypes_d_AddUndoEvent as AddUndoEvent, EventTypes_d_UndoRedoEvent as UndoRedoEvent, EventTypes_d_WindowEvent as WindowEvent, EventTypes_d_ProgressStateEvent as ProgressStateEvent, EventTypes_d_AfterProgressStateEvent as AfterProgressStateEvent, EventTypes_d_PlaceholderToggleEvent as PlaceholderToggleEvent, EventTypes_d_LoadErrorEvent as LoadErrorEvent, EventTypes_d_PreProcessEvent as PreProcessEvent, EventTypes_d_PostProcessEvent as PostProcessEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, };
2125
+ interface ExecCommandArgs {
2126
+ skip_focus?: boolean;
2127
+ }
2128
+ interface EditorCommandsConstructor {
2129
+ readonly prototype: EditorCommands;
2130
+ new (editor: Editor): EditorCommands;
2131
+ }
2132
+ declare class EditorCommands {
2133
+ private readonly editor;
2134
+ private commands;
2135
+ constructor(editor: Editor);
2136
+ execCommand(command: string, ui?: boolean, value?: any, args?: ExecCommandArgs): boolean;
2137
+ queryCommandState(command: string): boolean;
2138
+ queryCommandValue(command: string): string;
2139
+ addCommands<K extends keyof Commands>(commandList: Commands[K], type: K): void;
2140
+ addCommands(commandList: Record<string, EditorCommandsCallback>): void;
2141
+ addCommand(command: string, callback: EditorCommandCallback, scope?: any): void;
2142
+ queryCommandSupported(command: string): boolean;
2143
+ addQueryStateHandler(command: string, callback: () => boolean, scope?: any): void;
2144
+ addQueryValueHandler(command: string, callback: () => string, scope?: any): void;
2210
2145
  }
2211
2146
  interface RawString {
2212
2147
  raw: string;
@@ -2229,6 +2164,7 @@ interface I18n {
2229
2164
  }
2230
2165
  interface Observable<T> {
2231
2166
  fire<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U, bubble?: boolean): EditorEvent<U>;
2167
+ dispatch<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U, bubble?: boolean): EditorEvent<U>;
2232
2168
  on<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void, prepend?: boolean): EventDispatcher<T>;
2233
2169
  off<K extends string>(name?: K, callback?: (event: EditorEvent<MappedEvent<T, K>>) => void): EventDispatcher<T>;
2234
2170
  once<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void): EventDispatcher<T>;
@@ -2293,15 +2229,12 @@ declare class URI {
2293
2229
  getURI(noProtoHost?: boolean): string;
2294
2230
  }
2295
2231
  interface EditorManager extends Observable<EditorManagerEventMap> {
2296
- $: DomQueryConstructor;
2297
- defaultSettings: RawEditorSettings;
2232
+ defaultOptions: RawEditorOptions;
2298
2233
  majorVersion: string;
2299
2234
  minorVersion: string;
2300
2235
  releaseDate: string;
2301
- editors: Editor[];
2302
2236
  activeEditor: Editor;
2303
2237
  focusedEditor: Editor;
2304
- settings: RawEditorSettings;
2305
2238
  baseURI: URI;
2306
2239
  baseURL: string;
2307
2240
  documentBaseURL: string;
@@ -2309,12 +2242,12 @@ interface EditorManager extends Observable<EditorManagerEventMap> {
2309
2242
  suffix: string;
2310
2243
  add(this: EditorManager, editor: Editor): Editor;
2311
2244
  addI18n: (code: string, item: Record<string, string>) => void;
2312
- createEditor(this: EditorManager, id: string, settings: RawEditorSettings): Editor;
2245
+ createEditor(this: EditorManager, id: string, options: RawEditorOptions): Editor;
2313
2246
  execCommand(this: EditorManager, cmd: string, ui: boolean, value: any): boolean;
2314
2247
  get(this: EditorManager): Editor[];
2315
2248
  get(this: EditorManager, id: number | string): Editor;
2316
- init(this: EditorManager, settings: RawEditorSettings): Promise<Editor[]>;
2317
- overrideDefaults(this: EditorManager, defaultSettings: Partial<RawEditorSettings>): void;
2249
+ init(this: EditorManager, options: RawEditorOptions): Promise<Editor[]>;
2250
+ overrideDefaults(this: EditorManager, defaultOptions: Partial<RawEditorOptions>): void;
2318
2251
  remove(this: EditorManager): void;
2319
2252
  remove(this: EditorManager, selector: string | Editor): Editor | void;
2320
2253
  setActive(this: EditorManager, editor: Editor): void;
@@ -2328,18 +2261,73 @@ interface EditorObservable extends Observable<EditorEventMap> {
2328
2261
  toggleNativeEvent(this: Editor, name: string, state: boolean): any;
2329
2262
  unbindAllNativeEvents(this: Editor): void;
2330
2263
  }
2264
+ interface ProcessorSuccess<T> {
2265
+ valid: true;
2266
+ value: T;
2267
+ }
2268
+ interface ProcessorError {
2269
+ valid: false;
2270
+ message: string;
2271
+ }
2272
+ declare type SimpleProcessor = (value: unknown) => boolean;
2273
+ declare type Processor<T> = (value: unknown) => ProcessorSuccess<T> | ProcessorError;
2274
+ interface BuiltInOptionTypeMap {
2275
+ 'string': string;
2276
+ 'number': number;
2277
+ 'boolean': boolean;
2278
+ 'array': any[];
2279
+ 'function': Function;
2280
+ 'object': any;
2281
+ 'string[]': string[];
2282
+ 'object[]': any[];
2283
+ 'regexp': RegExp;
2284
+ }
2285
+ declare type BuiltInOptionType = keyof BuiltInOptionTypeMap;
2286
+ interface BaseOptionSpec {
2287
+ immutable?: boolean;
2288
+ deprecated?: boolean;
2289
+ docsUrl?: string;
2290
+ }
2291
+ interface BuiltInOptionSpec<K extends BuiltInOptionType> extends BaseOptionSpec {
2292
+ processor: K;
2293
+ default?: BuiltInOptionTypeMap[K];
2294
+ }
2295
+ interface SimpleOptionSpec<T> extends BaseOptionSpec {
2296
+ processor: SimpleProcessor;
2297
+ default?: T;
2298
+ }
2299
+ interface OptionSpec<T, U> extends BaseOptionSpec {
2300
+ processor: Processor<U>;
2301
+ default?: T;
2302
+ }
2303
+ interface Options {
2304
+ register: {
2305
+ <K extends BuiltInOptionType>(name: string, spec: BuiltInOptionSpec<K>): void;
2306
+ <K extends keyof NormalizedEditorOptions>(name: K, spec: OptionSpec<NormalizedEditorOptions[K], EditorOptions[K]> | SimpleOptionSpec<NormalizedEditorOptions[K]>): void;
2307
+ <T, U>(name: string, spec: OptionSpec<T, U>): void;
2308
+ <T>(name: string, spec: SimpleOptionSpec<T>): void;
2309
+ };
2310
+ isRegistered: (name: string) => boolean;
2311
+ get: {
2312
+ <K extends keyof EditorOptions>(name: K): EditorOptions[K] | undefined;
2313
+ <T>(name: string): T | undefined;
2314
+ };
2315
+ set: <K extends string, T>(name: K, value: K extends keyof NormalizedEditorOptions ? NormalizedEditorOptions[K] : T) => boolean;
2316
+ unset: (name: string) => boolean;
2317
+ isSet: (name: string) => boolean;
2318
+ }
2331
2319
  interface UploadResult$1 {
2332
2320
  element: HTMLImageElement;
2333
2321
  status: boolean;
2334
2322
  blobInfo: BlobInfo;
2335
2323
  uploadUri: string;
2324
+ removed: boolean;
2336
2325
  }
2337
- declare type UploadCallback = (results: UploadResult$1[]) => void;
2338
2326
  interface EditorUpload {
2339
2327
  blobCache: BlobCache;
2340
2328
  addFilter: (filter: (img: HTMLImageElement) => boolean) => void;
2341
- uploadImages: (callback?: UploadCallback) => Promise<UploadResult$1[]>;
2342
- uploadImagesAuto: (callback?: UploadCallback) => void | Promise<UploadResult$1[]>;
2329
+ uploadImages: () => Promise<UploadResult$1[]>;
2330
+ uploadImagesAuto: () => Promise<UploadResult$1[]>;
2343
2331
  scanForImages: () => Promise<BlobInfoImagePair[]>;
2344
2332
  destroy: () => void;
2345
2333
  }
@@ -2382,14 +2370,22 @@ interface EditorModeApi {
2382
2370
  deactivate: () => void;
2383
2371
  editorReadOnly: boolean;
2384
2372
  }
2373
+ interface Model {
2374
+ readonly table: {
2375
+ readonly getSelectedCells: () => HTMLTableCellElement[];
2376
+ readonly clearSelectedCells: (container: Node) => void;
2377
+ };
2378
+ }
2379
+ declare type ModelManager = AddOnManager<Model>;
2385
2380
  interface Plugin {
2386
2381
  getMetadata?: () => {
2387
2382
  name: string;
2388
2383
  url: string;
2389
2384
  };
2385
+ init?: (editor: Editor, url: string) => void;
2390
2386
  [key: string]: any;
2391
2387
  }
2392
- declare type PluginManager = AddOnManager<Plugin>;
2388
+ declare type PluginManager = AddOnManager<void | Plugin>;
2393
2389
  interface ShortcutsConstructor {
2394
2390
  readonly prototype: Shortcuts;
2395
2391
  new (editor: Editor): Shortcuts;
@@ -2418,7 +2414,7 @@ interface Theme {
2418
2414
  inline?: any;
2419
2415
  execCommand?: (command: string, ui?: boolean, value?: any) => boolean;
2420
2416
  destroy?: () => void;
2421
- init?: (editor: Editor, url: string, $: DomQueryConstructor) => void;
2417
+ init?: (editor: Editor, url: string) => void;
2422
2418
  renderUI?: () => {
2423
2419
  iframeContainer?: HTMLIFrameElement;
2424
2420
  editorContainer: HTMLElement;
@@ -2427,15 +2423,14 @@ interface Theme {
2427
2423
  getNotificationManagerImpl?: () => NotificationManagerImpl;
2428
2424
  getWindowManagerImpl?: () => WindowManagerImpl;
2429
2425
  }
2430
- declare type ThemeManager = AddOnManager<Theme>;
2426
+ declare type ThemeManager = AddOnManager<void | Theme>;
2431
2427
  interface EditorConstructor {
2432
2428
  readonly prototype: Editor;
2433
- new (id: string, settings: RawEditorSettings, editorManager: EditorManager): Editor;
2429
+ new (id: string, options: RawEditorOptions, editorManager: EditorManager): Editor;
2434
2430
  }
2435
2431
  declare class Editor implements EditorObservable {
2436
2432
  documentBaseUrl: string;
2437
2433
  baseUri: URI;
2438
- settings: EditorSettings;
2439
2434
  id: string;
2440
2435
  plugins: Record<string, Plugin>;
2441
2436
  documentBaseURI: URI;
@@ -2444,8 +2439,7 @@ declare class Editor implements EditorObservable {
2444
2439
  contentStyles: string[];
2445
2440
  ui: EditorUi;
2446
2441
  mode: EditorMode;
2447
- setMode: (mode: string) => void;
2448
- $: DomQueryConstructor;
2442
+ options: Options;
2449
2443
  shortcuts: Shortcuts;
2450
2444
  loadedCSS: Record<string, any>;
2451
2445
  editorCommands: EditorCommands;
@@ -2453,9 +2447,6 @@ declare class Editor implements EditorObservable {
2453
2447
  editorManager: EditorManager;
2454
2448
  inline: boolean;
2455
2449
  isNotDirty: boolean;
2456
- callbackLookup: any;
2457
- _nodeChangeDispatcher: NodeChange;
2458
- editorUpload: EditorUpload;
2459
2450
  annotator: Annotator;
2460
2451
  bodyElement: HTMLElement;
2461
2452
  bookmark: any;
@@ -2468,6 +2459,7 @@ declare class Editor implements EditorObservable {
2468
2459
  destroyed: boolean;
2469
2460
  dom: DOMUtils;
2470
2461
  editorContainer: HTMLElement;
2462
+ editorUpload: EditorUpload;
2471
2463
  eventRoot?: Element;
2472
2464
  formatter: Formatter;
2473
2465
  formElement: HTMLElement;
@@ -2491,12 +2483,12 @@ declare class Editor implements EditorObservable {
2491
2483
  startContent: string;
2492
2484
  targetElm: HTMLElement;
2493
2485
  theme: Theme;
2486
+ model: Model;
2494
2487
  undoManager: UndoManager;
2495
- validate: boolean;
2496
2488
  windowManager: WindowManager;
2497
2489
  _beforeUnload: () => void;
2498
2490
  _eventDispatcher: EventDispatcher<NativeEventMap>;
2499
- _mceOldSubmit: any;
2491
+ _nodeChangeDispatcher: NodeChange;
2500
2492
  _pendingNativeEvents: string[];
2501
2493
  _selectionOverrides: SelectionOverrides;
2502
2494
  _skinLoaded: boolean;
@@ -2504,19 +2496,19 @@ declare class Editor implements EditorObservable {
2504
2496
  toggleNativeEvent: EditorObservable['toggleNativeEvent'];
2505
2497
  unbindAllNativeEvents: EditorObservable['unbindAllNativeEvents'];
2506
2498
  fire: EditorObservable['fire'];
2499
+ dispatch: EditorObservable['dispatch'];
2507
2500
  on: EditorObservable['on'];
2508
2501
  off: EditorObservable['off'];
2509
2502
  once: EditorObservable['once'];
2510
2503
  hasEventListeners: EditorObservable['hasEventListeners'];
2511
- constructor(id: string, settings: RawEditorSettings, editorManager: EditorManager);
2504
+ constructor(id: string, options: RawEditorOptions, editorManager: EditorManager);
2512
2505
  render(): void;
2513
2506
  focus(skipFocus?: boolean): void;
2514
2507
  hasFocus(): boolean;
2515
- execCallback(name: string, ...x: any[]): any;
2516
2508
  translate(text: Untranslated): TranslatedString;
2517
- getParam<K extends keyof ParamTypeMap>(name: string, defaultVal: ParamTypeMap[K], type: K): ParamTypeMap[K];
2518
- getParam<K extends keyof EditorSettings>(name: K, defaultVal?: EditorSettings[K], type?: string): EditorSettings[K];
2519
- getParam<T>(name: string, defaultVal: T, type?: string): T;
2509
+ getParam<K extends BuiltInOptionType>(name: string, defaultVal: BuiltInOptionTypeMap[K], type: K): BuiltInOptionTypeMap[K];
2510
+ getParam<K extends keyof NormalizedEditorOptions>(name: K, defaultVal?: NormalizedEditorOptions[K], type?: BuiltInOptionType): NormalizedEditorOptions[K];
2511
+ getParam<T>(name: string, defaultVal: T, type?: BuiltInOptionType): T;
2520
2512
  hasPlugin(name: string, loaded?: boolean): boolean;
2521
2513
  nodeChanged(args?: any): void;
2522
2514
  addCommand(name: string, callback: EditorCommandCallback, scope?: object): void;
@@ -2527,7 +2519,7 @@ declare class Editor implements EditorObservable {
2527
2519
  boolean,
2528
2520
  any
2529
2521
  ] | (() => void), scope?: any): void;
2530
- execCommand(cmd: string, ui?: boolean, value?: any, args?: any): boolean;
2522
+ execCommand(cmd: string, ui?: boolean, value?: any, args?: ExecCommandArgs): boolean;
2531
2523
  queryCommandState(cmd: string): boolean;
2532
2524
  queryCommandValue(cmd: string): string;
2533
2525
  queryCommandSupported(cmd: string): boolean;
@@ -2537,13 +2529,13 @@ declare class Editor implements EditorObservable {
2537
2529
  setProgressState(state: boolean, time?: number): void;
2538
2530
  load(args?: any): string;
2539
2531
  save(args?: any): string;
2540
- setContent(content: string, args?: SetContentArgs): string;
2541
- setContent(content: AstNode, args?: SetContentArgs): AstNode;
2542
- setContent(content: Content, args?: SetContentArgs): Content;
2532
+ setContent(content: string, args?: Partial<SetContentArgs>): string;
2533
+ setContent(content: AstNode, args?: Partial<SetContentArgs>): AstNode;
2534
+ setContent(content: Content, args?: Partial<SetContentArgs>): Content;
2543
2535
  getContent(args: {
2544
2536
  format: 'tree';
2545
- } & GetContentArgs): AstNode;
2546
- getContent(args?: GetContentArgs): string;
2537
+ } & Partial<GetContentArgs>): AstNode;
2538
+ getContent(args?: Partial<GetContentArgs>): string;
2547
2539
  insertContent(content: string, args?: any): void;
2548
2540
  resetContent(initialContent?: string): void;
2549
2541
  isDirty(): boolean;
@@ -2558,12 +2550,8 @@ declare class Editor implements EditorObservable {
2558
2550
  addVisual(elm?: HTMLElement): void;
2559
2551
  remove(): void;
2560
2552
  destroy(automatic?: boolean): void;
2561
- uploadImages(callback?: UploadCallback): Promise<UploadResult$1[]>;
2553
+ uploadImages(): Promise<UploadResult$1[]>;
2562
2554
  _scanForImages(): Promise<BlobInfoImagePair[]>;
2563
- addButton(): void;
2564
- addSidebar(): void;
2565
- addMenuItem(): void;
2566
- addContextToolbar(): void;
2567
2555
  }
2568
2556
  interface UrlObject {
2569
2557
  prefix: string;
@@ -2571,29 +2559,20 @@ interface UrlObject {
2571
2559
  suffix: string;
2572
2560
  }
2573
2561
  declare type WaitState = 'added' | 'loaded';
2574
- declare type AddOnCallback<T> = (editor: Editor, url: string, $?: DomQueryConstructor) => void | T;
2575
- declare type AddOnConstructor<T> = new (editor: Editor, url: string, $?: DomQueryConstructor) => T;
2562
+ declare type AddOnConstructor<T> = (editor: Editor, url: string) => T;
2576
2563
  interface AddOnManager<T> {
2577
2564
  items: AddOnConstructor<T>[];
2578
2565
  urls: Record<string, string>;
2579
2566
  lookup: Record<string, {
2580
2567
  instance: AddOnConstructor<T>;
2581
- dependencies?: string[];
2582
2568
  }>;
2583
- _listeners: {
2584
- name: string;
2585
- state: WaitState;
2586
- callback: () => void;
2587
- }[];
2588
2569
  get: (name: string) => AddOnConstructor<T>;
2589
- dependencies: (name: string) => string[];
2590
2570
  requireLangPack: (name: string, languages: string) => void;
2591
- add: (id: string, addOn: AddOnCallback<T>, dependencies?: string[]) => AddOnConstructor<T>;
2571
+ add: (id: string, addOn: AddOnConstructor<T>) => AddOnConstructor<T>;
2592
2572
  remove: (name: string) => void;
2593
2573
  createUrl: (baseUrl: UrlObject, dep: string | UrlObject) => UrlObject;
2594
- addComponents: (pluginName: string, scripts: string[]) => void;
2595
- load: (name: string, addOnUrl: string | UrlObject, success?: () => void, scope?: any, failure?: () => void) => void;
2596
- waitFor: (name: string, callback: () => void, state?: WaitState) => void;
2574
+ load: (name: string, addOnUrl: string | UrlObject) => Promise<void>;
2575
+ waitFor: (name: string, state?: WaitState) => Promise<void>;
2597
2576
  }
2598
2577
  interface RangeUtils {
2599
2578
  walk: (rng: Range, callback: (nodes: Node[]) => void) => void;
@@ -2618,14 +2597,14 @@ declare class ScriptLoader {
2618
2597
  private loading;
2619
2598
  constructor(settings?: ScriptLoaderSettings);
2620
2599
  _setReferrerPolicy(referrerPolicy: ReferrerPolicy): void;
2621
- loadScript(url: string, success?: () => void, failure?: () => void): void;
2600
+ loadScript(url: string): Promise<void>;
2622
2601
  isDone(url: string): boolean;
2623
2602
  markDone(url: string): void;
2624
- add(url: string, success?: () => void, scope?: any, failure?: () => void): void;
2625
- load(url: string, success?: () => void, scope?: any, failure?: () => void): void;
2603
+ add(url: string): Promise<void>;
2604
+ load(url: string): Promise<void>;
2626
2605
  remove(url: string): void;
2627
- loadQueue(success?: () => void, scope?: any, failure?: (urls: string[]) => void): void;
2628
- loadScripts(scripts: string[], success?: () => void, scope?: any, failure?: (urls: string[]) => void): void;
2606
+ loadQueue(): Promise<void>;
2607
+ loadScripts(scripts: string[]): Promise<void>;
2629
2608
  }
2630
2609
  declare type TextProcessCallback = (node: Text, offset: number, text: string) => number;
2631
2610
  interface Spot {
@@ -2656,31 +2635,17 @@ interface Version {
2656
2635
  minor: number;
2657
2636
  }
2658
2637
  interface Env {
2659
- opera: boolean;
2660
- webkit: boolean;
2661
- ie: false | number;
2662
- gecko: boolean;
2663
- mac: boolean;
2664
- iOS: boolean;
2665
- android: boolean;
2666
- contentEditable: boolean;
2667
2638
  transparentSrc: string;
2668
- caretAfter: boolean;
2669
- range: boolean;
2670
2639
  documentMode: number;
2671
- fileApi: boolean;
2672
- ceFalse: boolean;
2673
2640
  cacheSuffix: any;
2674
2641
  container: any;
2675
- experimentalShadowDom: boolean;
2676
2642
  canHaveCSP: boolean;
2677
- desktop: boolean;
2678
2643
  windowsPhone: boolean;
2679
2644
  browser: {
2680
2645
  current: string | undefined;
2681
2646
  version: Version;
2682
2647
  isEdge: () => boolean;
2683
- isChrome: () => boolean;
2648
+ isChromium: () => boolean;
2684
2649
  isIE: () => boolean;
2685
2650
  isOpera: () => boolean;
2686
2651
  isFirefox: () => boolean;
@@ -2692,7 +2657,7 @@ interface Env {
2692
2657
  isWindows: () => boolean;
2693
2658
  isiOS: () => boolean;
2694
2659
  isAndroid: () => boolean;
2695
- isOSX: () => boolean;
2660
+ isMacOS: () => boolean;
2696
2661
  isLinux: () => boolean;
2697
2662
  isSolaris: () => boolean;
2698
2663
  isFreeBSD: () => boolean;
@@ -2708,6 +2673,17 @@ interface Env {
2708
2673
  isDesktop: () => boolean;
2709
2674
  };
2710
2675
  }
2676
+ interface FakeClipboardItem {
2677
+ readonly items: Record<string, any>;
2678
+ readonly types: ReadonlyArray<string>;
2679
+ readonly getType: <D = any>(type: string) => D | undefined;
2680
+ }
2681
+ interface FakeClipboard {
2682
+ readonly FakeClipboardItem: (items: Record<string, any>) => FakeClipboardItem;
2683
+ readonly write: (data: FakeClipboardItem[]) => void;
2684
+ readonly read: () => FakeClipboardItem[] | undefined;
2685
+ readonly clear: () => void;
2686
+ }
2711
2687
  interface FocusManager {
2712
2688
  isEditorUIElement: (elm: Element) => boolean;
2713
2689
  }
@@ -2722,35 +2698,6 @@ interface Entities {
2722
2698
  getEncodeFunc: (name: string, entities?: EntitiesMap | string) => (text: string, attr?: boolean) => string;
2723
2699
  decode: (text: string) => string;
2724
2700
  }
2725
- declare type AttrList = Array<{
2726
- name: string;
2727
- value: string;
2728
- }> & {
2729
- map: Record<string, string>;
2730
- };
2731
- interface SaxParserSettings {
2732
- allow_conditional_comments?: boolean;
2733
- allow_html_data_urls?: boolean;
2734
- allow_script_urls?: boolean;
2735
- allow_svg_data_urls?: boolean;
2736
- fix_self_closing?: boolean;
2737
- preserve_cdata?: boolean;
2738
- remove_internals?: boolean;
2739
- self_closing_elements?: Record<string, {}>;
2740
- validate?: boolean;
2741
- document?: Document;
2742
- cdata?: (text: string) => void;
2743
- comment?: (text: string) => void;
2744
- doctype?: (text: string) => void;
2745
- end?: (name: string) => void;
2746
- pi?: (name: string, text: string) => void;
2747
- start?: (name: string, attrs: AttrList, empty: boolean) => void;
2748
- text?: (text: string, raw?: boolean) => void;
2749
- }
2750
- declare type ParserFormat = 'html' | 'xhtml' | 'xml';
2751
- interface SaxParser {
2752
- parse: (html: string, format?: ParserFormat) => void;
2753
- }
2754
2701
  interface IconPack {
2755
2702
  icons: Record<string, string>;
2756
2703
  }
@@ -2762,104 +2709,45 @@ interface IconManager {
2762
2709
  interface Resource {
2763
2710
  load: <T = any>(id: string, url: string) => Promise<T>;
2764
2711
  add: (id: string, data: any) => void;
2765
- }
2766
- declare type WithSubItems<T, K extends keyof T> = T[K] extends Array<any> ? (T & T[K][number]) : T;
2767
- interface Props<A extends any[] = any[]> {
2768
- Mixins?: Array<Record<string, any>>;
2769
- Methods?: string;
2770
- Properties?: string;
2771
- Statics?: Record<string, any>;
2772
- Defaults?: Record<string, any>;
2773
- init?: (...args: A) => void;
2774
- }
2775
- declare type ExtendedClass<T extends Props<A>, A extends any[]> = WithSubItems<T, 'Mixins'>;
2776
- interface ExtendedClassConstructor<T extends Props<A>, A extends any[] = any[]> extends Class {
2777
- readonly prototype: ExtendedClass<T, A>;
2778
- new (...args: A): ExtendedClass<T, A>;
2779
- [key: string]: T['Statics'];
2780
- }
2781
- interface Class {
2782
- extend<T extends Props<A>, A extends any[] = any[]>(props: T): ExtendedClassConstructor<T, A>;
2783
- }
2784
- interface RGB {
2785
- r: number;
2786
- g: number;
2787
- b: number;
2788
- }
2789
- interface HSV {
2790
- h: number;
2791
- s: number;
2792
- v: number;
2793
- }
2794
- declare type ColorConstructor = new (value?: string | RGB | HSV) => Color;
2795
- interface Color {
2796
- toRgb: () => RGB;
2797
- toHsv: () => HSV;
2798
- toHex: () => string;
2799
- parse: (value: string | RGB | HSV) => Color;
2800
- }
2801
- interface DebounceFunc<T extends (...args: any[]) => void> {
2802
- (...args: Parameters<T>): void;
2803
- stop: () => void;
2712
+ unload: (id: string) => void;
2804
2713
  }
2805
2714
  interface Delay {
2806
- requestAnimationFrame: (callback: () => void, element?: HTMLElement) => void;
2807
2715
  setEditorInterval: (editor: Editor, callback: () => void, time?: number) => number;
2808
2716
  setEditorTimeout: (editor: Editor, callback: () => void, time?: number) => number;
2809
- setInterval: (callback: () => void, time?: number) => number;
2810
- setTimeout: (callback: () => void, time?: number) => number;
2811
- clearInterval: (id?: number) => void;
2812
- clearTimeout: (id?: number) => void;
2813
- debounce: <T extends (...args: any[]) => any>(callback: T, time?: number) => DebounceFunc<T>;
2814
- throttle: <T extends (...args: any[]) => any>(callback: T, time?: number) => DebounceFunc<T>;
2815
2717
  }
2816
2718
  declare type UploadResult = UploadResult$2;
2817
2719
  interface ImageUploader {
2818
2720
  upload: (blobInfos: BlobInfo[], showNotification?: boolean) => Promise<UploadResult[]>;
2819
2721
  }
2820
- interface JSONUtils {
2821
- serialize: (obj: any) => string;
2822
- parse: (text: string) => any;
2823
- }
2824
- interface JSONPSettings {
2825
- count?: number;
2826
- url: string;
2827
- callback: (json: string) => void;
2828
- }
2829
- interface JSONP {
2830
- callbacks: {};
2831
- count: number;
2832
- send(this: JSONP, settings: JSONPSettings): void;
2833
- }
2834
- interface JSONRequestSettings {
2835
- crossDomain?: boolean;
2836
- requestheaders?: Record<string, {
2837
- key: string;
2838
- value: string;
2839
- }>;
2840
- type?: string;
2841
- url?: string;
2842
- error_scope?: any;
2843
- success_scope?: any;
2844
- success?: (data: any) => void;
2845
- error?: (error: any, xhr: XMLHttpRequest) => void;
2846
- }
2847
- interface JSONRequestArgs extends JSONRequestSettings {
2848
- id?: string;
2849
- method?: string;
2850
- params?: string;
2851
- }
2852
- interface JSONRequestConstructor {
2853
- readonly prototype: JSONRequest;
2854
- new (settings?: JSONRequestSettings): JSONRequest;
2855
- sendRPC: (o: JSONRequestArgs) => void;
2856
- }
2857
- declare class JSONRequest {
2858
- static sendRPC(o: JSONRequestArgs): void;
2859
- settings: JSONRequestSettings;
2860
- count: number;
2861
- constructor(settings?: JSONRequestSettings);
2862
- send(args: JSONRequestArgs): void;
2722
+ declare type ArrayCallback$1<T, R> = (x: T, i: number, xs: ReadonlyArray<T>) => R;
2723
+ declare type ObjCallback$1<T, R> = (value: T, key: string, obj: Record<string, T>) => R;
2724
+ declare type ArrayCallback<T, R> = ArrayCallback$1<T, R>;
2725
+ declare type ObjCallback<T, R> = ObjCallback$1<T, R>;
2726
+ interface Tools {
2727
+ is: (obj: any, type: string) => boolean;
2728
+ isArray: <T>(arr: any) => arr is Array<T>;
2729
+ inArray: <T>(arr: ArrayLike<T>, value: T) => number;
2730
+ grep: {
2731
+ <T>(arr: ArrayLike<T> | null | undefined, pred?: ArrayCallback<T, boolean>): T[];
2732
+ <T>(arr: Record<string, T> | null | undefined, pred?: ObjCallback<T, boolean>): T[];
2733
+ };
2734
+ trim: (str: string | null | undefined) => string;
2735
+ toArray: <T>(obj: ArrayLike<T>) => T[];
2736
+ hasOwn: (obj: any, name: string) => boolean;
2737
+ makeMap: <T>(items: ArrayLike<T> | string, delim?: string | RegExp, map?: Record<string, T | string>) => Record<string, T | string>;
2738
+ each: {
2739
+ <T>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, void | boolean>, scope?: any): boolean;
2740
+ <T>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, void | boolean>, scope?: any): boolean;
2741
+ };
2742
+ map: {
2743
+ <T, R>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, R>): R[];
2744
+ <T, R>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, R>): R[];
2745
+ };
2746
+ extend: (obj: Object, ext: Object, ...objs: Object[]) => any;
2747
+ walk: <T = any>(obj: T, f: Function, n?: keyof T, scope?: any) => void;
2748
+ resolve: (path: string, o?: Object) => any;
2749
+ explode: (s: string, d?: string | RegExp) => string[];
2750
+ _addCacheSuffix: (url: string) => string;
2863
2751
  }
2864
2752
  interface KeyboardLikeEvent {
2865
2753
  shiftKey: boolean;
@@ -2885,130 +2773,90 @@ interface VK {
2885
2773
  modifierPressed: (e: KeyboardLikeEvent) => boolean;
2886
2774
  metaKeyPressed: (e: KeyboardLikeEvent) => boolean;
2887
2775
  }
2888
- interface XHRSettings {
2889
- async?: boolean;
2890
- content_type?: string;
2891
- crossDomain?: boolean;
2892
- data?: Document | BodyInit;
2893
- requestheaders?: Record<string, {
2894
- key: string;
2895
- value: string;
2896
- }>;
2897
- scope?: any;
2898
- type?: string;
2899
- url: string;
2900
- error_scope?: any;
2901
- success_scope?: any;
2902
- error?: (message: 'TIMED_OUT' | 'GENERAL', xhr: XMLHttpRequest, settings: XHRSettings) => void;
2903
- success?: (text: string, xhr: XMLHttpRequest, settings: XHRSettings) => void;
2904
- }
2905
- interface XHREventMap {
2906
- beforeInitialize: {
2907
- settings: XHRSettings;
2908
- };
2909
- beforeSend: {
2910
- xhr: XMLHttpRequest;
2911
- settings: XHRSettings;
2912
- };
2913
- }
2914
- interface XHR extends Observable<XHREventMap> {
2915
- send(this: XHR, settings: XHRSettings): void;
2916
- }
2917
2776
  interface DOMUtilsNamespace {
2918
- new (doc: Document, settings: Partial<DOMUtilsSettings>): DOMUtils;
2777
+ (doc: Document, settings: Partial<DOMUtilsSettings>): DOMUtils;
2919
2778
  DOM: DOMUtils;
2920
2779
  nodeIndex: (node: Node, normalized?: boolean) => number;
2921
2780
  }
2922
2781
  interface RangeUtilsNamespace {
2923
- new (dom: DOMUtils): RangeUtils;
2782
+ (dom: DOMUtils): RangeUtils;
2924
2783
  compareRanges: (rng1: RangeLikeObject, rng2: RangeLikeObject) => boolean;
2925
2784
  getCaretRangeFromPoint: (clientX: number, clientY: number, doc: Document) => Range;
2926
2785
  getSelectedNode: (range: Range) => Node;
2927
2786
  getNode: (container: Node, offset: number) => Node;
2928
2787
  }
2929
2788
  interface AddOnManagerNamespace {
2930
- new <T>(): AddOnManager<T>;
2789
+ <T>(): AddOnManager<T>;
2931
2790
  language: string | undefined;
2932
2791
  languageLoad: boolean;
2933
2792
  baseURL: string;
2934
2793
  PluginManager: PluginManager;
2935
2794
  ThemeManager: ThemeManager;
2795
+ ModelManager: ModelManager;
2936
2796
  }
2937
2797
  interface BookmarkManagerNamespace {
2938
2798
  (selection: EditorSelection): BookmarkManager;
2939
2799
  isBookmarkNode: (node: Node) => boolean;
2940
2800
  }
2941
- interface SaxParserNamespace {
2942
- new (settings?: SaxParserSettings, schema?: Schema): SaxParser;
2943
- findEndTag: (schema: Schema, html: string, startIndex: number) => number;
2944
- }
2945
2801
  interface TinyMCE extends EditorManager {
2946
2802
  geom: {
2947
2803
  Rect: Rect;
2948
2804
  };
2949
2805
  util: {
2950
- Promise: PromiseConstructor;
2951
2806
  Delay: Delay;
2952
2807
  Tools: Tools;
2953
2808
  VK: VK;
2954
2809
  URI: URIConstructor;
2955
- Class: Class;
2956
2810
  EventDispatcher: EventDispatcherConstructor<any>;
2957
2811
  Observable: Observable<any>;
2958
2812
  I18n: I18n;
2959
- XHR: XHR;
2960
- JSON: JSONUtils;
2961
- JSONRequest: JSONRequestConstructor;
2962
- JSONP: JSONP;
2963
2813
  LocalStorage: Storage;
2964
- Color: ColorConstructor;
2965
2814
  ImageUploader: ImageUploader;
2966
2815
  };
2967
2816
  dom: {
2968
2817
  EventUtils: EventUtilsConstructor;
2969
- Sizzle: any;
2970
- DomQuery: DomQueryConstructor;
2971
2818
  TreeWalker: DomTreeWalkerConstructor;
2972
- TextSeeker: new (dom: DOMUtils, isBlockBoundary?: (node: Node) => boolean) => TextSeeker;
2819
+ TextSeeker: (dom: DOMUtils, isBlockBoundary?: (node: Node) => boolean) => TextSeeker;
2973
2820
  DOMUtils: DOMUtilsNamespace;
2974
2821
  ScriptLoader: ScriptLoaderConstructor;
2975
2822
  RangeUtils: RangeUtilsNamespace;
2976
- Serializer: new (settings: DomSerializerSettings, editor?: Editor) => DomSerializer;
2823
+ Serializer: (settings: DomSerializerSettings, editor?: Editor) => DomSerializer;
2977
2824
  ControlSelection: (selection: EditorSelection, editor: Editor) => ControlSelection;
2978
2825
  BookmarkManager: BookmarkManagerNamespace;
2979
- Selection: new (dom: DOMUtils, win: Window, serializer: DomSerializer, editor: Editor) => EditorSelection;
2980
- StyleSheetLoader: new (documentOrShadowRoot: Document | ShadowRoot, settings: StyleSheetLoaderSettings) => StyleSheetLoader;
2826
+ Selection: (dom: DOMUtils, win: Window, serializer: DomSerializer, editor: Editor) => EditorSelection;
2827
+ StyleSheetLoader: (documentOrShadowRoot: Document | ShadowRoot, settings: StyleSheetLoaderSettings) => StyleSheetLoader;
2981
2828
  Event: EventUtils;
2982
2829
  };
2983
2830
  html: {
2984
- Styles: new (settings?: StylesSettings, schema?: Schema) => Styles;
2831
+ Styles: (settings?: StylesSettings, schema?: Schema) => Styles;
2985
2832
  Entities: Entities;
2986
2833
  Node: AstNodeConstructor;
2987
- Schema: new (settings?: SchemaSettings) => Schema;
2988
- SaxParser: SaxParserNamespace;
2989
- DomParser: new (settings?: DomParserSettings, schema?: Schema) => DomParser;
2990
- Writer: new (settings?: WriterSettings) => Writer;
2991
- Serializer: new (settings?: HtmlSerializerSettings, schema?: Schema) => HtmlSerializer;
2834
+ Schema: (settings?: SchemaSettings) => Schema;
2835
+ DomParser: (settings?: DomParserSettings, schema?: Schema) => DomParser;
2836
+ Writer: (settings?: WriterSettings) => Writer;
2837
+ Serializer: (settings?: HtmlSerializerSettings, schema?: Schema) => HtmlSerializer;
2992
2838
  };
2993
2839
  AddOnManager: AddOnManagerNamespace;
2994
- Annotator: new (editor: Editor) => Annotator;
2840
+ Annotator: (editor: Editor) => Annotator;
2995
2841
  Editor: EditorConstructor;
2996
2842
  EditorCommands: EditorCommandsConstructor;
2997
2843
  EditorManager: EditorManager;
2998
2844
  EditorObservable: EditorObservable;
2999
2845
  Env: Env;
3000
2846
  FocusManager: FocusManager;
3001
- Formatter: new (editor: Editor) => Formatter;
3002
- NotificationManager: new (editor: Editor) => NotificationManager;
2847
+ Formatter: (editor: Editor) => Formatter;
2848
+ NotificationManager: (editor: Editor) => NotificationManager;
3003
2849
  Shortcuts: ShortcutsConstructor;
3004
- UndoManager: new (editor: Editor) => UndoManager;
3005
- WindowManager: new (editor: Editor) => WindowManager;
2850
+ UndoManager: (editor: Editor) => UndoManager;
2851
+ WindowManager: (editor: Editor) => WindowManager;
3006
2852
  DOM: DOMUtils;
3007
2853
  ScriptLoader: ScriptLoader;
3008
2854
  PluginManager: PluginManager;
3009
2855
  ThemeManager: ThemeManager;
2856
+ ModelManager: ModelManager;
3010
2857
  IconManager: IconManager;
3011
2858
  Resource: Resource;
2859
+ FakeClipboard: FakeClipboard;
3012
2860
  trim: Tools['trim'];
3013
2861
  isArray: Tools['isArray'];
3014
2862
  is: Tools['is'];
@@ -3019,18 +2867,10 @@ interface TinyMCE extends EditorManager {
3019
2867
  grep: Tools['grep'];
3020
2868
  inArray: Tools['inArray'];
3021
2869
  extend: Tools['extend'];
3022
- create: Tools['create'];
3023
2870
  walk: Tools['walk'];
3024
- createNS: Tools['createNS'];
3025
2871
  resolve: Tools['resolve'];
3026
2872
  explode: Tools['explode'];
3027
2873
  _addCacheSuffix: Tools['_addCacheSuffix'];
3028
- isOpera: boolean;
3029
- isWebKit: boolean;
3030
- isIE: false | number;
3031
- isGecko: boolean;
3032
- isMac: boolean;
3033
2874
  }
3034
2875
  declare const tinymce: TinyMCE;
3035
- export default tinymce;
3036
- export { AddOnManager, Annotator, AstNode, Bookmark, BookmarkManager, Class, Color, ControlSelection, DOMUtils, Delay, DomParser, DomParserSettings, DomQuery, DomSerializer, DomSerializerSettings, DomTreeWalker, Editor, EditorCommands, EditorEvent, EditorManager, EditorModeApi, EditorObservable, EditorSelection, EditorSettings, Entities, Env, EventDispatcher, EventUtils, EventTypes_d as Events, FocusManager, Format_d as Formats, Formatter, GeomRect, HtmlSerializer, HtmlSerializerSettings, I18n, IconManager, JSONUtils as JSON, JSONP, JSONRequest, JSONRequestArgs, JSONRequestSettings, NotificationApi, NotificationManager, NotificationSpec, Observable, Plugin, PluginManager, RangeUtils, RawEditorSettings, Rect, Resource, SaxParser, SaxParserSettings, Schema, SchemaSettings, ScriptLoader, Shortcuts, StyleSheetLoader, Styles, TextSeeker, Theme, ThemeManager, TinyMCE, Tools, URI, Ui_d as Ui, UndoManager, VK, WindowManager, Writer, WriterSettings, XHR, XHRSettings };
2876
+ export { AddOnManager, Annotator, AstNode, Bookmark, BookmarkManager, ControlSelection, DOMUtils, Delay, DomParser, DomParserSettings, DomSerializer, DomSerializerSettings, DomTreeWalker, Editor, EditorCommands, EditorEvent, EditorManager, EditorModeApi, EditorObservable, EditorOptions, EditorSelection, Entities, Env, EventDispatcher, EventUtils, EventTypes_d as Events, FakeClipboard, FocusManager, Format_d as Formats, Formatter, GeomRect, HtmlSerializer, HtmlSerializerSettings, I18n, IconManager, Model, ModelManager, NotificationApi, NotificationManager, NotificationSpec, Observable, Plugin, PluginManager, RangeUtils, RawEditorOptions, Rect, Resource, Schema, SchemaSettings, ScriptLoader, Shortcuts, StyleSheetLoader, Styles, TextSeeker, Theme, ThemeManager, TinyMCE, Tools, URI, Ui_d as Ui, UndoManager, VK, WindowManager, Writer, WriterSettings, tinymce as default };