tinymce-rails 5.10.4 → 6.0.3.1

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