tinymce-rails 6.1.2 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +2988 -2392
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
  6. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  7. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -2
  8. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  9. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  10. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +2 -2
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -2
  12. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  14. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  16. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  17. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  18. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -2
  20. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -2
  21. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  23. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -2
  26. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  31. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +2 -2
  32. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  35. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  36. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  37. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  38. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  39. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  40. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  41. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  42. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  43. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  44. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  45. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  46. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  47. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  48. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  49. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  50. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  51. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  53. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  54. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  55. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  56. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  57. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  58. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  59. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  60. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +345 -169
  61. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  62. metadata +2 -2
@@ -93,10 +93,10 @@ declare class EventDispatcher<T> {
93
93
  private readonly scope;
94
94
  private readonly toggleEvent;
95
95
  private bindings;
96
- constructor(settings?: Record<string, any>);
96
+ constructor(settings?: EventDispatcherSettings);
97
97
  fire<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
98
98
  dispatch<K extends string, U extends MappedEvent<T, K>>(name: K, args?: U): EditorEvent<U>;
99
- on<K extends string>(name: K, callback: false | ((event: EditorEvent<MappedEvent<T, K>>) => void), prepend?: boolean, extra?: {}): this;
99
+ on<K extends string>(name: K, callback: false | ((event: EditorEvent<MappedEvent<T, K>>) => void | boolean), prepend?: boolean, extra?: {}): this;
100
100
  off<K extends string>(name?: K, callback?: (event: EditorEvent<MappedEvent<T, K>>) => void): this;
101
101
  once<K extends string>(name: K, callback: (event: EditorEvent<MappedEvent<T, K>>) => void, prepend?: boolean): this;
102
102
  has(name: string): boolean;
@@ -105,31 +105,54 @@ declare const enum UndoLevelType {
105
105
  Fragmented = "fragmented",
106
106
  Complete = "complete"
107
107
  }
108
- interface UndoLevel {
108
+ interface BaseUndoLevel {
109
109
  type: UndoLevelType;
110
+ bookmark: Bookmark | null;
111
+ beforeBookmark: Bookmark | null;
112
+ }
113
+ interface FragmentedUndoLevel extends BaseUndoLevel {
114
+ type: UndoLevelType.Fragmented;
110
115
  fragments: string[];
116
+ content: '';
117
+ }
118
+ interface CompleteUndoLevel extends BaseUndoLevel {
119
+ type: UndoLevelType.Complete;
120
+ fragments: null;
111
121
  content: string;
112
- bookmark: Bookmark;
113
- beforeBookmark: Bookmark;
114
122
  }
123
+ declare type NewUndoLevel = CompleteUndoLevel | FragmentedUndoLevel;
124
+ declare type UndoLevel = NewUndoLevel & {
125
+ bookmark: Bookmark;
126
+ };
115
127
  interface UndoManager {
116
128
  data: UndoLevel[];
117
129
  typing: boolean;
118
- add: (level?: UndoLevel, event?: EditorEvent<any>) => UndoLevel;
130
+ add: (level?: Partial<UndoLevel>, event?: EditorEvent<any>) => UndoLevel | null;
119
131
  dispatchChange: () => void;
120
132
  beforeChange: () => void;
121
- undo: () => UndoLevel;
122
- redo: () => UndoLevel;
133
+ undo: () => UndoLevel | undefined;
134
+ redo: () => UndoLevel | undefined;
123
135
  clear: () => void;
124
136
  reset: () => void;
125
137
  hasUndo: () => boolean;
126
138
  hasRedo: () => boolean;
127
- transact: (callback: () => void) => UndoLevel;
139
+ transact: (callback: () => void) => UndoLevel | null;
128
140
  ignore: (callback: () => void) => void;
129
141
  extra: (callback1: () => void, callback2: () => void) => void;
130
142
  }
131
143
  declare type SchemaType = 'html4' | 'html5' | 'html5-strict';
132
- interface SchemaSettings {
144
+ interface ElementSettings {
145
+ block_elements?: string;
146
+ boolean_attributes?: string;
147
+ move_caret_before_on_enter_elements?: string;
148
+ non_empty_elements?: string;
149
+ self_closing_elements?: string;
150
+ text_block_elements?: string;
151
+ text_inline_elements?: string;
152
+ void_elements?: string;
153
+ whitespace_elements?: string;
154
+ }
155
+ interface SchemaSettings extends ElementSettings {
133
156
  custom_elements?: string;
134
157
  extended_valid_elements?: string;
135
158
  invalid_elements?: string;
@@ -152,12 +175,8 @@ interface DefaultAttribute {
152
175
  name: string;
153
176
  value: string;
154
177
  }
155
- interface AttributePattern {
156
- defaultValue?: string;
157
- forcedValue?: string;
178
+ interface AttributePattern extends Attribute {
158
179
  pattern: RegExp;
159
- required?: boolean;
160
- validValues?: Record<string, {}>;
161
180
  }
162
181
  interface ElementRule {
163
182
  attributes: Record<string, Attribute>;
@@ -225,16 +244,16 @@ declare class AstNode {
225
244
  type: number;
226
245
  attributes?: Attributes$1;
227
246
  value?: string;
228
- parent?: AstNode;
229
- firstChild?: AstNode;
230
- lastChild?: AstNode;
231
- next?: AstNode;
232
- prev?: AstNode;
247
+ parent?: AstNode | null;
248
+ firstChild?: AstNode | null;
249
+ lastChild?: AstNode | null;
250
+ next?: AstNode | null;
251
+ prev?: AstNode | null;
233
252
  raw?: boolean;
234
253
  constructor(name: string, type: number);
235
254
  replace(node: AstNode): AstNode;
236
- attr(name: string, value: string | null): AstNode | undefined;
237
- attr(name: Record<string, string | null>): AstNode | undefined;
255
+ attr(name: string, value: string | null | undefined): AstNode | undefined;
256
+ attr(name: Record<string, string | null | undefined> | undefined): AstNode | undefined;
238
257
  attr(name: string): string | undefined;
239
258
  clone(): AstNode;
240
259
  wrap(wrapper: AstNode): AstNode;
@@ -246,7 +265,7 @@ declare class AstNode {
246
265
  children(): AstNode[];
247
266
  empty(): AstNode;
248
267
  isEmpty(elements: SchemaMap, whitespace?: SchemaMap, predicate?: (node: AstNode) => boolean): boolean;
249
- walk(prev?: boolean): AstNode;
268
+ walk(prev?: boolean): AstNode | null | undefined;
250
269
  }
251
270
  declare type Content = string | AstNode;
252
271
  declare type ContentFormat = 'raw' | 'text' | 'html' | 'tree';
@@ -266,6 +285,8 @@ interface SetContentArgs {
266
285
  no_events?: boolean;
267
286
  no_selection?: boolean;
268
287
  paste?: boolean;
288
+ load?: boolean;
289
+ initial?: boolean;
269
290
  }
270
291
  interface GetSelectionContentArgs extends GetContentArgs {
271
292
  selection?: boolean;
@@ -314,12 +335,12 @@ declare class NodeChange {
314
335
  private readonly editor;
315
336
  private lastPath;
316
337
  constructor(editor: Editor);
317
- nodeChanged(args?: any): void;
338
+ nodeChanged(args?: Record<string, any>): void;
318
339
  private isSameElementPath;
319
340
  }
320
341
  interface SelectionOverrides {
321
- showCaret: (direction: number, node: Element, before: boolean, scrollIntoView?: boolean) => Range | null;
322
- showBlockCaretContainer: (blockCaretContainer: Element) => void;
342
+ showCaret: (direction: number, node: HTMLElement, before: boolean, scrollIntoView?: boolean) => Range | null;
343
+ showBlockCaretContainer: (blockCaretContainer: HTMLElement) => void;
323
344
  hideFakeCaret: () => void;
324
345
  destroy: () => void;
325
346
  }
@@ -365,7 +386,7 @@ interface Rect {
365
386
  fromClientRect: (clientRect: DOMRect) => GeomRect;
366
387
  }
367
388
  interface NotificationManagerImpl {
368
- open: (spec: NotificationSpec, closeCallback?: () => void) => NotificationApi;
389
+ open: (spec: NotificationSpec, closeCallback: () => void) => NotificationApi;
369
390
  close: <T extends NotificationApi>(notification: T) => void;
370
391
  getArgs: <T extends NotificationApi>(notification: T) => NotificationSpec;
371
392
  }
@@ -440,6 +461,12 @@ interface BlockCmdPattern extends BlockBasePattern {
440
461
  }
441
462
  declare type BlockPattern = BlockFormatPattern | BlockCmdPattern;
442
463
  declare type Pattern = InlinePattern | BlockPattern;
464
+ interface DynamicPatternContext {
465
+ readonly text: string;
466
+ readonly block: Element;
467
+ }
468
+ declare type DynamicPatternsLookup = (ctx: DynamicPatternContext) => Pattern[];
469
+ declare type RawDynamicPatternsLookup = (ctx: DynamicPatternContext) => RawPattern[];
443
470
  interface AlertBannerSpec {
444
471
  type: 'alertbanner';
445
472
  level: 'info' | 'warn' | 'error' | 'success';
@@ -772,7 +799,8 @@ interface AutocompleterItemSpec {
772
799
  declare type AutocompleterContents = SeparatorItemSpec | AutocompleterItemSpec | CardMenuItemSpec;
773
800
  interface AutocompleterSpec {
774
801
  type?: 'autocompleter';
775
- ch: string;
802
+ ch?: string;
803
+ trigger?: string;
776
804
  minChars?: number;
777
805
  columns?: ColumnTypes$1;
778
806
  matches?: (rng: Range, text: string, pattern: string) => boolean;
@@ -904,7 +932,7 @@ interface ColorSwatchMenuItemSpec extends BaseFancyMenuItemSpec<'colorswatch'> {
904
932
  fancytype: 'colorswatch';
905
933
  initData?: {
906
934
  allowCustomColors?: boolean;
907
- colors: ChoiceMenuItemSpec[];
935
+ colors?: ChoiceMenuItemSpec[];
908
936
  };
909
937
  }
910
938
  declare type FancyMenuItemSpec = InsertTableMenuItemSpec | ColorSwatchMenuItemSpec;
@@ -1057,11 +1085,17 @@ interface GroupToolbarButtonSpec extends BaseToolbarButtonSpec<GroupToolbarButto
1057
1085
  }
1058
1086
  declare type MenuButtonItemTypes = NestedMenuItemContents;
1059
1087
  declare type SuccessCallback$1 = (menu: string | MenuButtonItemTypes[]) => void;
1088
+ interface MenuButtonFetchContext {
1089
+ pattern: string;
1090
+ }
1060
1091
  interface BaseMenuButtonSpec {
1061
1092
  text?: string;
1062
1093
  tooltip?: string;
1063
1094
  icon?: string;
1064
- fetch: (success: SuccessCallback$1) => void;
1095
+ search?: boolean | {
1096
+ placeholder?: string;
1097
+ };
1098
+ fetch: (success: SuccessCallback$1, fetchContext: MenuButtonFetchContext) => void;
1065
1099
  onSetup?: (api: BaseMenuButtonInstanceApi) => (api: BaseMenuButtonInstanceApi) => void;
1066
1100
  }
1067
1101
  interface BaseMenuButtonInstanceApi {
@@ -1159,7 +1193,7 @@ declare type ApplyFormat = BlockFormat | InlineFormat | SelectorFormat;
1159
1193
  declare type RemoveFormat = RemoveBlockFormat | RemoveInlineFormat | RemoveSelectorFormat;
1160
1194
  declare type Format = ApplyFormat | RemoveFormat;
1161
1195
  declare type Formats = Record<string, Format | Format[]>;
1162
- declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string);
1196
+ declare type FormatAttrOrStyleValue = string | ((vars?: FormatVars) => string | null);
1163
1197
  declare type FormatVars = Record<string, string | null>;
1164
1198
  interface BaseFormat<T> {
1165
1199
  ceFalseOverride?: boolean;
@@ -1170,7 +1204,7 @@ interface BaseFormat<T> {
1170
1204
  links?: boolean;
1171
1205
  mixed?: boolean;
1172
1206
  block_expand?: boolean;
1173
- onmatch?: (node: Node, fmt: T, itemName: string) => boolean;
1207
+ onmatch?: (node: Element, fmt: T, itemName: string) => boolean;
1174
1208
  remove?: 'none' | 'empty' | 'all';
1175
1209
  remove_similar?: boolean;
1176
1210
  split?: boolean;
@@ -1194,7 +1228,7 @@ interface CommonFormat<T> extends BaseFormat<T> {
1194
1228
  styles?: Record<string, FormatAttrOrStyleValue>;
1195
1229
  toggle?: boolean;
1196
1230
  preview?: string | false;
1197
- onformat?: (elm: Node, fmt: T, vars?: FormatVars, node?: Node | RangeLikeObject) => void;
1231
+ onformat?: (elm: Element, fmt: T, vars?: FormatVars, node?: Node | RangeLikeObject | null) => void;
1198
1232
  clear_child_styles?: boolean;
1199
1233
  merge_siblings?: boolean;
1200
1234
  merge_with_parents?: boolean;
@@ -1297,7 +1331,7 @@ interface WindowParams {
1297
1331
  }
1298
1332
  declare type InstanceApi<T> = UrlDialogInstanceApi | DialogInstanceApi<T>;
1299
1333
  interface WindowManagerImpl {
1300
- open: <T>(config: DialogSpec<T>, params: WindowParams, closeWindow: (dialog: DialogInstanceApi<T>) => void) => DialogInstanceApi<T>;
1334
+ open: <T>(config: DialogSpec<T>, params: WindowParams | undefined, closeWindow: (dialog: DialogInstanceApi<T>) => void) => DialogInstanceApi<T>;
1301
1335
  openUrl: (config: UrlDialogSpec, closeWindow: (dialog: UrlDialogInstanceApi) => void) => UrlDialogInstanceApi;
1302
1336
  alert: (message: string, callback: () => void) => void;
1303
1337
  confirm: (message: string, callback: (state: boolean) => void) => void;
@@ -1312,7 +1346,7 @@ interface WindowManager {
1312
1346
  }
1313
1347
  interface ExecCommandEvent {
1314
1348
  command: string;
1315
- ui?: boolean;
1349
+ ui: boolean;
1316
1350
  value?: any;
1317
1351
  }
1318
1352
  interface BeforeGetContentEvent extends GetContentArgs {
@@ -1328,6 +1362,9 @@ interface BeforeSetContentEvent extends SetContentArgs {
1328
1362
  interface SetContentEvent extends BeforeSetContentEvent {
1329
1363
  content: string;
1330
1364
  }
1365
+ interface SaveContentEvent extends GetContentEvent {
1366
+ save: boolean;
1367
+ }
1331
1368
  interface NewBlockEvent {
1332
1369
  newBlock: Element;
1333
1370
  }
@@ -1340,7 +1377,7 @@ interface NodeChangeEvent {
1340
1377
  interface FormatEvent {
1341
1378
  format: string;
1342
1379
  vars?: FormatVars;
1343
- node?: Node | RangeLikeObject;
1380
+ node?: Node | RangeLikeObject | null;
1344
1381
  }
1345
1382
  interface ObjectResizeEvent {
1346
1383
  target: HTMLElement;
@@ -1354,11 +1391,11 @@ interface ObjectSelectedEvent {
1354
1391
  }
1355
1392
  interface ScrollIntoViewEvent {
1356
1393
  elm: HTMLElement;
1357
- alignToTop: boolean;
1394
+ alignToTop: boolean | undefined;
1358
1395
  }
1359
1396
  interface SetSelectionRangeEvent {
1360
1397
  range: Range;
1361
- forward: boolean;
1398
+ forward: boolean | undefined;
1362
1399
  }
1363
1400
  interface ShowCaretEvent {
1364
1401
  target: Node;
@@ -1368,10 +1405,12 @@ interface ShowCaretEvent {
1368
1405
  interface SwitchModeEvent {
1369
1406
  mode: string;
1370
1407
  }
1371
- interface AddUndoEvent {
1408
+ interface ChangeEvent {
1372
1409
  level: UndoLevel;
1373
- lastLevel: UndoLevel;
1374
- originalEvent: Event;
1410
+ lastLevel: UndoLevel | undefined;
1411
+ }
1412
+ interface AddUndoEvent extends ChangeEvent {
1413
+ originalEvent: Event | undefined;
1375
1414
  }
1376
1415
  interface UndoRedoEvent {
1377
1416
  level: UndoLevel;
@@ -1422,18 +1461,24 @@ interface TableEventData {
1422
1461
  interface TableModifiedEvent extends TableEventData {
1423
1462
  readonly table: HTMLTableElement;
1424
1463
  }
1464
+ interface BeforeOpenNotificationEvent {
1465
+ notification: NotificationSpec;
1466
+ }
1467
+ interface OpenNotificationEvent {
1468
+ notification: NotificationApi;
1469
+ }
1425
1470
  interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1426
1471
  'activate': {
1427
- relatedTarget: Editor;
1472
+ relatedTarget: Editor | null;
1428
1473
  };
1429
1474
  'deactivate': {
1430
1475
  relatedTarget: Editor;
1431
1476
  };
1432
1477
  'focus': {
1433
- blurredEditor: Editor;
1478
+ blurredEditor: Editor | null;
1434
1479
  };
1435
1480
  'blur': {
1436
- focusedEditor: Editor;
1481
+ focusedEditor: Editor | null;
1437
1482
  };
1438
1483
  'resize': UIEvent;
1439
1484
  'scroll': UIEvent;
@@ -1445,7 +1490,7 @@ interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1445
1490
  'ObjectResized': ObjectResizeEvent;
1446
1491
  'ObjectResizeStart': ObjectResizeEvent;
1447
1492
  'SwitchMode': SwitchModeEvent;
1448
- 'ScrollWindow': UIEvent;
1493
+ 'ScrollWindow': Event;
1449
1494
  'ResizeWindow': UIEvent;
1450
1495
  'SkinLoaded': {};
1451
1496
  'SkinLoadError': LoadErrorEvent;
@@ -1472,7 +1517,12 @@ interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1472
1517
  'GetContent': GetContentEvent;
1473
1518
  'BeforeSetContent': BeforeSetContentEvent;
1474
1519
  'SetContent': SetContentEvent;
1475
- 'LoadContent': {};
1520
+ 'SaveContent': SaveContentEvent;
1521
+ 'RawSaveContent': SaveContentEvent;
1522
+ 'LoadContent': {
1523
+ load: boolean;
1524
+ element: HTMLElement;
1525
+ };
1476
1526
  'PreviewFormats': {};
1477
1527
  'AfterPreviewFormats': {};
1478
1528
  'ScriptsLoaded': {};
@@ -1485,6 +1535,7 @@ interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1485
1535
  'Undo': UndoRedoEvent;
1486
1536
  'BeforeAddUndo': AddUndoEvent;
1487
1537
  'AddUndo': AddUndoEvent;
1538
+ 'change': ChangeEvent;
1488
1539
  'CloseWindow': WindowEvent<any>;
1489
1540
  'OpenWindow': WindowEvent<any>;
1490
1541
  'ProgressState': ProgressStateEvent;
@@ -1504,6 +1555,12 @@ interface EditorEventMap extends Omit<NativeEventMap, 'blur' | 'focus'> {
1504
1555
  'TableModified': TableModifiedEvent;
1505
1556
  'NewRow': NewTableRowEvent;
1506
1557
  'NewCell': NewTableCellEvent;
1558
+ 'SetAttrib': SetAttribEvent;
1559
+ 'hide': {};
1560
+ 'show': {};
1561
+ 'dirty': {};
1562
+ 'BeforeOpenNotification': BeforeOpenNotificationEvent;
1563
+ 'OpenNotification': OpenNotificationEvent;
1507
1564
  }
1508
1565
  interface EditorManagerEventMap {
1509
1566
  'AddEditor': {
@@ -1521,6 +1578,7 @@ type EventTypes_d_BeforeGetContentEvent = BeforeGetContentEvent;
1521
1578
  type EventTypes_d_GetContentEvent = GetContentEvent;
1522
1579
  type EventTypes_d_BeforeSetContentEvent = BeforeSetContentEvent;
1523
1580
  type EventTypes_d_SetContentEvent = SetContentEvent;
1581
+ type EventTypes_d_SaveContentEvent = SaveContentEvent;
1524
1582
  type EventTypes_d_NewBlockEvent = NewBlockEvent;
1525
1583
  type EventTypes_d_NodeChangeEvent = NodeChangeEvent;
1526
1584
  type EventTypes_d_FormatEvent = FormatEvent;
@@ -1530,6 +1588,7 @@ type EventTypes_d_ScrollIntoViewEvent = ScrollIntoViewEvent;
1530
1588
  type EventTypes_d_SetSelectionRangeEvent = SetSelectionRangeEvent;
1531
1589
  type EventTypes_d_ShowCaretEvent = ShowCaretEvent;
1532
1590
  type EventTypes_d_SwitchModeEvent = SwitchModeEvent;
1591
+ type EventTypes_d_ChangeEvent = ChangeEvent;
1533
1592
  type EventTypes_d_AddUndoEvent = AddUndoEvent;
1534
1593
  type EventTypes_d_UndoRedoEvent = UndoRedoEvent;
1535
1594
  type EventTypes_d_WindowEvent<_0> = WindowEvent<_0>;
@@ -1546,10 +1605,12 @@ type EventTypes_d_NewTableRowEvent = NewTableRowEvent;
1546
1605
  type EventTypes_d_NewTableCellEvent = NewTableCellEvent;
1547
1606
  type EventTypes_d_TableEventData = TableEventData;
1548
1607
  type EventTypes_d_TableModifiedEvent = TableModifiedEvent;
1608
+ type EventTypes_d_BeforeOpenNotificationEvent = BeforeOpenNotificationEvent;
1609
+ type EventTypes_d_OpenNotificationEvent = OpenNotificationEvent;
1549
1610
  type EventTypes_d_EditorEventMap = EditorEventMap;
1550
1611
  type EventTypes_d_EditorManagerEventMap = EditorManagerEventMap;
1551
1612
  declare namespace EventTypes_d {
1552
- 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, };
1613
+ 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_SaveContentEvent as SaveContentEvent, 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_ChangeEvent as ChangeEvent, 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_BeforeOpenNotificationEvent as BeforeOpenNotificationEvent, EventTypes_d_OpenNotificationEvent as OpenNotificationEvent, EventTypes_d_EditorEventMap as EditorEventMap, EventTypes_d_EditorManagerEventMap as EditorManagerEventMap, };
1553
1614
  }
1554
1615
  type Format_d_Formats = Formats;
1555
1616
  type Format_d_Format = Format;
@@ -1603,7 +1664,7 @@ declare type ThemeInitFunc = (editor: Editor, elm: HTMLElement) => {
1603
1664
  api?: EditorUiApi;
1604
1665
  };
1605
1666
  declare type SetupCallback = (editor: Editor) => void;
1606
- declare type FilePickerCallback = (callback: Function, value: any, meta: Record<string, any>) => void;
1667
+ declare type FilePickerCallback = (callback: (value: string, meta?: Record<string, any>) => void, value: string, meta: Record<string, any>) => void;
1607
1668
  declare type FilePickerValidationStatus = 'valid' | 'unknown' | 'invalid' | 'none';
1608
1669
  declare type FilePickerValidationCallback = (info: {
1609
1670
  type: string;
@@ -1614,13 +1675,14 @@ declare type FilePickerValidationCallback = (info: {
1614
1675
  }) => void) => void;
1615
1676
  declare type PastePreProcessFn = (editor: Editor, args: PastePreProcessEvent) => void;
1616
1677
  declare type PastePostProcessFn = (editor: Editor, args: PastePostProcessEvent) => void;
1617
- declare type URLConverter = (url: string, name: string, elm?: HTMLElement) => string;
1618
- declare type URLConverterCallback = (url: string, node: Node, on_save: boolean, name: string) => string;
1678
+ declare type URLConverter = (url: string, name: string, elm?: string | Element) => string;
1679
+ declare type URLConverterCallback = (url: string, node: Node | string | undefined, on_save: boolean, name: string) => string;
1619
1680
  interface ToolbarGroup {
1620
1681
  name?: string;
1621
1682
  items: string[];
1622
1683
  }
1623
1684
  declare type ToolbarMode = 'floating' | 'sliding' | 'scrolling' | 'wrap';
1685
+ declare type ToolbarLocation = 'top' | 'bottom' | 'auto';
1624
1686
  interface BaseEditorOptions {
1625
1687
  a11y_advanced_options?: boolean;
1626
1688
  add_form_submit_trigger?: boolean;
@@ -1664,6 +1726,7 @@ interface BaseEditorOptions {
1664
1726
  directionality?: 'ltr' | 'rtl';
1665
1727
  doctype?: string;
1666
1728
  document_base_url?: string;
1729
+ draggable_modal?: boolean;
1667
1730
  editable_class?: string;
1668
1731
  element_format?: 'xhtml' | 'html';
1669
1732
  elementpath?: boolean;
@@ -1688,6 +1751,7 @@ interface BaseEditorOptions {
1688
1751
  forced_root_block?: string;
1689
1752
  forced_root_block_attrs?: Record<string, string>;
1690
1753
  formats?: Formats;
1754
+ format_noneditable_selector?: string;
1691
1755
  height?: number | string;
1692
1756
  hidden_input?: boolean;
1693
1757
  icons?: string;
@@ -1748,6 +1812,7 @@ interface BaseEditorOptions {
1748
1812
  placeholder?: string;
1749
1813
  preserve_cdata?: boolean;
1750
1814
  preview_styles?: false | string;
1815
+ promotion?: boolean;
1751
1816
  protect?: RegExp[];
1752
1817
  readonly?: boolean;
1753
1818
  referrer_policy?: ReferrerPolicy;
@@ -1774,6 +1839,7 @@ interface BaseEditorOptions {
1774
1839
  table_tab_navigation?: boolean;
1775
1840
  target?: HTMLElement;
1776
1841
  text_patterns?: RawPattern[] | false;
1842
+ text_patterns_lookup?: RawDynamicPatternsLookup;
1777
1843
  theme?: string | ThemeInitFunc | false;
1778
1844
  theme_url?: string;
1779
1845
  toolbar?: boolean | string | string[] | Array<ToolbarGroup>;
@@ -1786,6 +1852,8 @@ interface BaseEditorOptions {
1786
1852
  toolbar7?: string;
1787
1853
  toolbar8?: string;
1788
1854
  toolbar9?: string;
1855
+ toolbar_groups?: Record<string, GroupToolbarButtonSpec>;
1856
+ toolbar_location?: ToolbarLocation;
1789
1857
  toolbar_mode?: ToolbarMode;
1790
1858
  toolbar_sticky?: boolean;
1791
1859
  toolbar_sticky_offset?: number;
@@ -1819,15 +1887,73 @@ interface NormalizedEditorOptions extends BaseEditorOptions {
1819
1887
  plugins: string[];
1820
1888
  }
1821
1889
  interface EditorOptions extends NormalizedEditorOptions {
1890
+ a11y_advanced_options: boolean;
1891
+ allow_unsafe_link_target: boolean;
1892
+ anchor_bottom: string;
1893
+ anchor_top: string;
1894
+ automatic_uploads: boolean;
1895
+ block_formats: string;
1896
+ body_class: string;
1897
+ body_id: string;
1898
+ br_newline_selector: string;
1899
+ color_cols: number;
1822
1900
  content_css: string[];
1823
1901
  contextmenu: string[];
1902
+ custom_colors: boolean;
1903
+ document_base_url: string;
1904
+ draggable_modal: boolean;
1905
+ editable_class: string;
1824
1906
  font_css: string[];
1907
+ font_family_formats: string;
1908
+ font_size_classes: string;
1909
+ font_size_formats: string;
1910
+ font_size_legacy_values: string;
1911
+ font_size_style_values: string;
1825
1912
  forced_root_block: string;
1826
1913
  forced_root_block_attrs: Record<string, string>;
1914
+ format_noneditable_selector: string;
1915
+ height: number | string;
1916
+ iframe_attrs: Record<string, string>;
1917
+ images_file_types: string;
1918
+ images_upload_base_path: string;
1919
+ images_upload_credentials: boolean;
1920
+ images_upload_url: string;
1921
+ indent_use_margin: boolean;
1922
+ indentation: string;
1923
+ inline: boolean;
1924
+ inline_boundaries_selector: string;
1925
+ language: string;
1926
+ language_load: boolean;
1927
+ language_url: string;
1928
+ line_height_formats: string;
1929
+ menu: Record<string, {
1930
+ title: string;
1931
+ items: string;
1932
+ }>;
1933
+ menubar: boolean | string;
1934
+ model: string;
1935
+ no_newline_selector: string;
1936
+ noneditable_class: string;
1827
1937
  noneditable_regexp: RegExp[];
1828
- object_resizing?: string;
1829
- preview_styles?: string;
1830
- text_patterns?: Pattern[];
1938
+ object_resizing: string;
1939
+ paste_as_text: boolean;
1940
+ preview_styles: string;
1941
+ promotion: boolean;
1942
+ readonly: boolean;
1943
+ removed_menuitems: string;
1944
+ toolbar: boolean | string | string[] | Array<ToolbarGroup>;
1945
+ toolbar_groups: Record<string, GroupToolbarButtonSpec>;
1946
+ toolbar_location: ToolbarLocation;
1947
+ toolbar_mode: ToolbarMode;
1948
+ toolbar_persist: boolean;
1949
+ toolbar_sticky: boolean;
1950
+ toolbar_sticky_offset: number;
1951
+ text_patterns: Pattern[];
1952
+ text_patterns_lookup: DynamicPatternsLookup;
1953
+ visual: boolean;
1954
+ visual_anchor_class: string;
1955
+ visual_table_class: string;
1956
+ width: number | string;
1831
1957
  }
1832
1958
  declare type StyleMap = Record<string, string | number>;
1833
1959
  interface StylesSettings {
@@ -1837,13 +1963,22 @@ interface StylesSettings {
1837
1963
  url_converter_scope?: any;
1838
1964
  }
1839
1965
  interface Styles {
1840
- parse: (css: string) => Record<string, string>;
1966
+ parse: (css: string | undefined) => Record<string, string>;
1841
1967
  serialize: (styles: StyleMap, elementName?: string) => string;
1842
1968
  }
1843
- declare type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void;
1969
+ declare type EventUtilsCallback<T> = (event: EventUtilsEvent<T>) => void | boolean;
1844
1970
  declare type EventUtilsEvent<T> = NormalizedEvent<T> & {
1845
1971
  metaKey: boolean;
1846
1972
  };
1973
+ interface Callback$1<T> {
1974
+ func: EventUtilsCallback<T>;
1975
+ scope: any;
1976
+ }
1977
+ interface CallbackList<T> extends Array<Callback$1<T>> {
1978
+ fakeName: string | false;
1979
+ capture: boolean;
1980
+ nativeHandler: EventListener;
1981
+ }
1847
1982
  interface EventUtilsConstructor {
1848
1983
  readonly prototype: EventUtils;
1849
1984
  new (): EventUtils;
@@ -1852,11 +1987,9 @@ interface EventUtilsConstructor {
1852
1987
  declare class EventUtils {
1853
1988
  static Event: EventUtils;
1854
1989
  domLoaded: boolean;
1855
- events: Record<string, any>;
1990
+ events: Record<number, Record<string, CallbackList<any>>>;
1856
1991
  private readonly expando;
1857
1992
  private hasFocusIn;
1858
- private hasMouseEnterLeave;
1859
- private mouseEnterLeave;
1860
1993
  private count;
1861
1994
  constructor();
1862
1995
  bind<K extends keyof HTMLElementEventMap>(target: any, name: K, callback: EventUtilsCallback<HTMLElementEventMap[K]>, scope?: any): EventUtilsCallback<HTMLElementEventMap[K]>;
@@ -1868,9 +2001,14 @@ declare class EventUtils {
1868
2001
  dispatch(target: any, name: string, args?: {}): this;
1869
2002
  clean(target: any): this;
1870
2003
  destroy(): void;
1871
- cancel<T = any>(e: EventUtilsEvent<T>): boolean;
2004
+ cancel<T>(e: EventUtilsEvent<T>): boolean;
1872
2005
  private executeHandlers;
1873
2006
  }
2007
+ interface SetAttribEvent {
2008
+ attrElm: HTMLElement;
2009
+ attrName: string;
2010
+ attrValue: string | boolean | number | null;
2011
+ }
1874
2012
  interface DOMUtilsSettings {
1875
2013
  schema: Schema;
1876
2014
  url_converter: URLConverter;
@@ -1878,14 +2016,14 @@ interface DOMUtilsSettings {
1878
2016
  ownEvents: boolean;
1879
2017
  keep_values: boolean;
1880
2018
  update_styles: boolean;
1881
- root_element: HTMLElement;
1882
- collect: Function;
1883
- onSetAttrib: Function;
2019
+ root_element: HTMLElement | null;
2020
+ collect: boolean;
2021
+ onSetAttrib: (event: SetAttribEvent) => void;
1884
2022
  contentCssCors: boolean;
1885
2023
  referrerPolicy: ReferrerPolicy;
1886
2024
  }
1887
2025
  declare type Target = Node | Window;
1888
- declare type RunArguments<T extends Node = Node> = string | T | Array<string | T>;
2026
+ declare type RunArguments<T extends Node = Node> = string | T | Array<string | T> | null;
1889
2027
  declare type BoundEvent = [
1890
2028
  Target,
1891
2029
  string,
@@ -1893,7 +2031,7 @@ declare type BoundEvent = [
1893
2031
  any
1894
2032
  ];
1895
2033
  declare type Callback<K extends string> = EventUtilsCallback<MappedEvent<HTMLElementEventMap, K>>;
1896
- declare type RunResult<T, R> = T extends Array<any> ? false | R[] : false | R;
2034
+ declare type RunResult<T, R> = T extends Array<any> ? R[] : false | R;
1897
2035
  interface DOMUtils {
1898
2036
  doc: Document;
1899
2037
  settings: Partial<DOMUtilsSettings>;
@@ -1906,8 +2044,11 @@ interface DOMUtils {
1906
2044
  styles: Styles;
1907
2045
  schema: Schema;
1908
2046
  events: EventUtils;
1909
- root: Node;
1910
- isBlock: (node: string | Node) => boolean;
2047
+ root: Node | null;
2048
+ isBlock: {
2049
+ (node: Node | null): node is HTMLElement;
2050
+ (node: string): boolean;
2051
+ };
1911
2052
  clone: (node: Node, deep: boolean) => Node;
1912
2053
  getRoot: () => HTMLElement;
1913
2054
  getViewPort: (argWin?: Window) => GeomRect;
@@ -1917,39 +2058,52 @@ interface DOMUtils {
1917
2058
  h: number;
1918
2059
  };
1919
2060
  getParent: {
1920
- <K extends keyof HTMLElementTagNameMap>(node: string | Node, selector: K, root?: Node): HTMLElementTagNameMap[K] | null;
1921
- <T extends HTMLElement>(node: string | Node, selector: (node: HTMLElement) => node is T, root?: Node): T | null;
1922
- <T extends Element = Element>(node: string | Node, selector?: string | ((node: HTMLElement) => boolean | void), root?: Node): T | null;
2061
+ <K extends keyof HTMLElementTagNameMap>(node: string | Node | null, selector: K, root?: Node): HTMLElementTagNameMap[K] | null;
2062
+ <T extends Element>(node: string | Node | null, selector: string | ((node: Node) => node is T), root?: Node): T | null;
2063
+ (node: string | Node | null, selector?: string | ((node: Node) => boolean | void), root?: Node): Node | null;
1923
2064
  };
1924
2065
  getParents: {
1925
- <K extends keyof HTMLElementTagNameMap>(elm: string | Node, selector: K, root?: Node, collect?: boolean): Array<HTMLElementTagNameMap[K]>;
1926
- <T extends HTMLElement>(node: string | Node, selector: (node: HTMLElement) => node is T, root?: Node): T[];
1927
- <T extends Element = Element>(elm: string | Node, selector?: string | ((node: HTMLElement) => boolean | void), root?: Node, collect?: boolean): T[];
2066
+ <K extends keyof HTMLElementTagNameMap>(elm: string | HTMLElementTagNameMap[K] | null, selector: K, root?: Node, collect?: boolean): Array<HTMLElementTagNameMap[K]>;
2067
+ <T extends Element>(node: string | Node | null, selector: string | ((node: Node) => node is T), root?: Node, collect?: boolean): T[];
2068
+ (elm: string | Node | null, selector?: string | ((node: Node) => boolean | void), root?: Node, collect?: boolean): Node[];
2069
+ };
2070
+ get: {
2071
+ <T extends Node>(elm: T): T;
2072
+ (elm: string): HTMLElement | null;
1928
2073
  };
1929
- get: (elm: string | Node) => HTMLElement | null;
1930
- getNext: (node: Node, selector: string | ((node: Node) => boolean)) => Node | null;
1931
- getPrev: (node: Node, selector: string | ((node: Node) => boolean)) => Node | null;
2074
+ getNext: (node: Node | null, selector: string | ((node: Node) => boolean)) => Node | null;
2075
+ getPrev: (node: Node | null, selector: string | ((node: Node) => boolean)) => Node | null;
1932
2076
  select: {
1933
2077
  <K extends keyof HTMLElementTagNameMap>(selector: K, scope?: string | Node): Array<HTMLElementTagNameMap[K]>;
1934
2078
  <T extends HTMLElement = HTMLElement>(selector: string, scope?: string | Node): T[];
1935
2079
  };
1936
- is: (elm: Node | Node[], selector: string) => boolean;
1937
- add: (parentElm: RunArguments, name: string | Node, attrs?: Record<string, string | boolean | number>, html?: string | Node, create?: boolean) => HTMLElement;
2080
+ is: {
2081
+ <T extends Element>(elm: Node | Node[] | null, selector: string): elm is T;
2082
+ (elm: Node | Node[] | null, selector: string): boolean;
2083
+ };
2084
+ add: (parentElm: RunArguments, name: string | Element, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null, create?: boolean) => HTMLElement;
1938
2085
  create: {
1939
- <K extends keyof HTMLElementTagNameMap>(name: K, attrs?: Record<string, string | boolean | number>, html?: string | Node): HTMLElementTagNameMap[K];
1940
- (name: string, attrs?: Record<string, string | boolean | number>, html?: string | Node): HTMLElement;
2086
+ <K extends keyof HTMLElementTagNameMap>(name: K, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null): HTMLElementTagNameMap[K];
2087
+ (name: string, attrs?: Record<string, string | boolean | number | null>, html?: string | Node | null): HTMLElement;
1941
2088
  };
1942
- createHTML: (name: string, attrs?: Record<string, string>, html?: string) => string;
2089
+ createHTML: (name: string, attrs?: Record<string, string | null>, html?: string) => string;
1943
2090
  createFragment: (html?: string) => DocumentFragment;
1944
- remove: <T extends Node>(node: string | T | T[], keepChildren?: boolean) => RunResult<typeof node, T>;
1945
- setStyle: (elm: string | Node | Node[], name: string, value: string | number | null) => void;
1946
- getStyle: (elm: string | Node, name: string, computed?: boolean) => string | undefined;
1947
- setStyles: (elm: string | Node | Node[], stylesArg: StyleMap) => void;
2091
+ remove: {
2092
+ <T extends Node>(node: T | T[], keepChildren?: boolean): typeof node extends Array<any> ? T[] : T;
2093
+ <T extends Node>(node: string, keepChildren?: boolean): T | false;
2094
+ };
2095
+ getStyle: {
2096
+ (elm: Element, name: string, computed: true): string;
2097
+ (elm: string | Element | null, name: string, computed?: boolean): string | undefined;
2098
+ };
2099
+ setStyle: (elm: string | Element | Element[], name: string, value: string | number | null) => void;
2100
+ setStyles: (elm: string | Element | Element[], stylesArg: StyleMap) => void;
1948
2101
  removeAllAttribs: (e: RunArguments<Element>) => void;
1949
- setAttrib: (elm: string | Node | Node[], name: string, value: string | boolean | number | null) => void;
1950
- setAttribs: (elm: string | Node | Node[], attrs: Record<string, string | boolean | number | null>) => void;
1951
- getAttrib: (elm: string | Node, name: string, defaultVal?: string) => string;
1952
- getPos: (elm: string | Node, rootElm?: Node) => {
2102
+ setAttrib: (elm: RunArguments<Element>, name: string, value: string | boolean | number | null) => void;
2103
+ setAttribs: (elm: RunArguments<Element>, attrs: Record<string, string | boolean | number | null>) => void;
2104
+ getAttrib: (elm: string | Element | null, name: string, defaultVal?: string) => string;
2105
+ getAttribs: (elm: string | Element) => NamedNodeMap | Attr[];
2106
+ getPos: (elm: string | Element, rootElm?: Node) => {
1953
2107
  x: number;
1954
2108
  y: number;
1955
2109
  };
@@ -1957,15 +2111,15 @@ interface DOMUtils {
1957
2111
  serializeStyle: (stylesArg: StyleMap, name?: string) => string;
1958
2112
  addStyle: (cssText: string) => void;
1959
2113
  loadCSS: (url: string) => void;
1960
- addClass: (elm: string | Node | Node[], cls: string) => void;
1961
- removeClass: (elm: string | Node | Node[], cls: string) => void;
1962
- hasClass: (elm: string | Node, cls: string) => boolean;
1963
- toggleClass: (elm: string | Node | Node[], cls: string, state?: boolean) => void;
2114
+ hasClass: (elm: string | Element, cls: string) => boolean;
2115
+ addClass: (elm: RunArguments<Element>, cls: string) => void;
2116
+ removeClass: (elm: RunArguments<Element>, cls: string) => void;
2117
+ toggleClass: (elm: RunArguments<Element>, cls: string, state?: boolean) => void;
1964
2118
  show: (elm: string | Node | Node[]) => void;
1965
2119
  hide: (elm: string | Node | Node[]) => void;
1966
2120
  isHidden: (elm: string | Node) => boolean;
1967
2121
  uniqueId: (prefix?: string) => string;
1968
- setHTML: (elm: string | Node | Node[], html: string) => void;
2122
+ setHTML: (elm: RunArguments<Element>, html: string) => void;
1969
2123
  getOuterHTML: (elm: string | Node) => string;
1970
2124
  setOuterHTML: (elm: string | Node | Node[], html: string) => void;
1971
2125
  decode: (text: string) => string;
@@ -1982,16 +2136,15 @@ interface DOMUtils {
1982
2136
  <K extends keyof HTMLElementTagNameMap>(elm: Element, name: K): HTMLElementTagNameMap[K];
1983
2137
  (elm: Element, name: string): Element;
1984
2138
  };
1985
- findCommonAncestor: (a: Node, b: Node) => Node;
2139
+ findCommonAncestor: (a: Node, b: Node) => Node | null;
1986
2140
  run<R, T extends Node>(this: DOMUtils, elm: T | T[], func: (node: T) => R, scope?: any): typeof elm extends Array<any> ? R[] : R;
1987
2141
  run<R, T extends Node>(this: DOMUtils, elm: RunArguments<T>, func: (node: T) => R, scope?: any): RunResult<typeof elm, R>;
1988
- getAttribs: (elm: string | Node) => NamedNodeMap | Attr[];
1989
2142
  isEmpty: (node: Node, elements?: Record<string, any>) => boolean;
1990
2143
  createRng: () => Range;
1991
2144
  nodeIndex: (node: Node, normalized?: boolean) => number;
1992
2145
  split: {
1993
- <T extends Node>(parentElm: Node, splitElm: Node, replacementElm: T): T;
1994
- <T extends Node>(parentElm: Node, splitElm: T): T;
2146
+ <T extends Node>(parentElm: Node, splitElm: Node, replacementElm: T): T | undefined;
2147
+ <T extends Node>(parentElm: Node, splitElm: T): T | undefined;
1995
2148
  };
1996
2149
  bind: {
1997
2150
  <K extends string>(target: Target, name: K, func: Callback<K>, scope?: any): Callback<K>;
@@ -2018,12 +2171,12 @@ interface ClientRect {
2018
2171
  height: number;
2019
2172
  }
2020
2173
  interface BookmarkManager {
2021
- getBookmark: (type: number, normalized?: boolean) => Bookmark;
2174
+ getBookmark: (type?: number, normalized?: boolean) => Bookmark;
2022
2175
  moveToBookmark: (bookmark: Bookmark) => void;
2023
2176
  }
2024
2177
  interface ControlSelection {
2025
2178
  isResizable: (elm: Element) => boolean;
2026
- showResizeRect: (elm: Element) => void;
2179
+ showResizeRect: (elm: HTMLElement) => void;
2027
2180
  hideResizeRect: () => void;
2028
2181
  updateResizeRect: (evt: EditorEvent<any>) => void;
2029
2182
  destroy: () => void;
@@ -2048,7 +2201,7 @@ interface Writer {
2048
2201
  getContent: () => string;
2049
2202
  pi: (name: string, text?: string) => void;
2050
2203
  reset: () => void;
2051
- start: (name: string, attrs?: Attributes, empty?: boolean) => void;
2204
+ start: (name: string, attrs?: Attributes | null, empty?: boolean) => void;
2052
2205
  text: (text: string, raw?: boolean) => void;
2053
2206
  }
2054
2207
  interface HtmlSerializerSettings extends WriterSettings {
@@ -2108,7 +2261,7 @@ interface EditorSelection {
2108
2261
  isCollapsed: () => boolean;
2109
2262
  isForward: () => boolean;
2110
2263
  setNode: (elm: Element) => Element;
2111
- getNode: () => Element;
2264
+ getNode: () => HTMLElement;
2112
2265
  getSel: () => Selection | null;
2113
2266
  setRng: (rng: Range, forward?: boolean) => void;
2114
2267
  getRng: () => Range;
@@ -2119,23 +2272,23 @@ interface EditorSelection {
2119
2272
  selectorChanged: (selector: string, callback: (active: boolean, args: {
2120
2273
  node: Node;
2121
2274
  selector: String;
2122
- parents: Element[];
2275
+ parents: Node[];
2123
2276
  }) => void) => EditorSelection;
2124
2277
  selectorChangedWithUnbind: (selector: string, callback: (active: boolean, args: {
2125
2278
  node: Node;
2126
2279
  selector: String;
2127
- parents: Element[];
2280
+ parents: Node[];
2128
2281
  }) => void) => {
2129
2282
  unbind: () => void;
2130
2283
  };
2131
- getScrollContainer: () => HTMLElement;
2284
+ getScrollContainer: () => HTMLElement | undefined;
2132
2285
  scrollIntoView: (elm?: HTMLElement, alignToTop?: boolean) => void;
2133
2286
  placeCaretAt: (clientX: number, clientY: number) => void;
2134
2287
  getBoundingClientRect: () => ClientRect | DOMRect;
2135
2288
  destroy: () => void;
2136
2289
  }
2137
- declare type EditorCommandCallback = (ui: boolean, value: any) => void;
2138
- declare type EditorCommandsCallback = (command: string, ui: boolean, value: any) => void;
2290
+ declare type EditorCommandCallback<S> = (this: S, ui: boolean, value: any) => void;
2291
+ declare type EditorCommandsCallback = (command: string, ui: boolean, value?: any) => void;
2139
2292
  interface Commands {
2140
2293
  state: Record<string, (command: string) => boolean>;
2141
2294
  exec: Record<string, EditorCommandsCallback>;
@@ -2157,10 +2310,13 @@ declare class EditorCommands {
2157
2310
  queryCommandValue(command: string): string;
2158
2311
  addCommands<K extends keyof Commands>(commandList: Commands[K], type: K): void;
2159
2312
  addCommands(commandList: Record<string, EditorCommandsCallback>): void;
2160
- addCommand(command: string, callback: EditorCommandCallback, scope?: any): void;
2313
+ addCommand<S>(command: string, callback: EditorCommandCallback<S>, scope: S): void;
2314
+ addCommand(command: string, callback: EditorCommandCallback<Editor>): void;
2161
2315
  queryCommandSupported(command: string): boolean;
2162
- addQueryStateHandler(command: string, callback: () => boolean, scope?: any): void;
2163
- addQueryValueHandler(command: string, callback: () => string, scope?: any): void;
2316
+ addQueryStateHandler<S>(command: string, callback: (this: S) => boolean, scope: S): void;
2317
+ addQueryStateHandler(command: string, callback: (this: Editor) => boolean): void;
2318
+ addQueryValueHandler<S>(command: string, callback: (this: S) => string, scope: S): void;
2319
+ addQueryValueHandler(command: string, callback: (this: Editor) => string): void;
2164
2320
  }
2165
2321
  interface RawString {
2166
2322
  raw: string;
@@ -2170,7 +2326,7 @@ declare type TokenisedString = [
2170
2326
  string,
2171
2327
  ...Primitive[]
2172
2328
  ];
2173
- declare type Untranslated = Primitive | TokenisedString | RawString;
2329
+ declare type Untranslated = Primitive | TokenisedString | RawString | null | undefined;
2174
2330
  declare type TranslatedString = string;
2175
2331
  interface I18n {
2176
2332
  getData: () => Record<string, Record<string, string>>;
@@ -2213,7 +2369,7 @@ interface SafeUriOptions {
2213
2369
  }
2214
2370
  declare class URI {
2215
2371
  static parseDataUri(uri: string): {
2216
- type: string;
2372
+ type: string | undefined;
2217
2373
  data: string;
2218
2374
  };
2219
2375
  static isDomSafe(uri: string, context?: string, options?: SafeUriOptions): boolean;
@@ -2224,19 +2380,19 @@ declare class URI {
2224
2380
  pathname?: string;
2225
2381
  }): string;
2226
2382
  source: string;
2227
- protocol: string;
2228
- authority: string;
2229
- userInfo: string;
2230
- user: string;
2231
- password: string;
2232
- host: string;
2233
- port: string;
2234
- relative: string;
2383
+ protocol: string | undefined;
2384
+ authority: string | undefined;
2385
+ userInfo: string | undefined;
2386
+ user: string | undefined;
2387
+ password: string | undefined;
2388
+ host: string | undefined;
2389
+ port: string | undefined;
2390
+ relative: string | undefined;
2235
2391
  path: string;
2236
2392
  directory: string;
2237
- file: string;
2238
- query: string;
2239
- anchor: string;
2393
+ file: string | undefined;
2394
+ query: string | undefined;
2395
+ anchor: string | undefined;
2240
2396
  settings: URISettings;
2241
2397
  constructor(url: string, settings?: URISettings);
2242
2398
  setPath(path: string): void;
@@ -2252,8 +2408,8 @@ interface EditorManager extends Observable<EditorManagerEventMap> {
2252
2408
  majorVersion: string;
2253
2409
  minorVersion: string;
2254
2410
  releaseDate: string;
2255
- activeEditor: Editor;
2256
- focusedEditor: Editor;
2411
+ activeEditor: Editor | null;
2412
+ focusedEditor: Editor | null;
2257
2413
  baseURI: URI;
2258
2414
  baseURL: string;
2259
2415
  documentBaseURL: string;
@@ -2264,11 +2420,12 @@ interface EditorManager extends Observable<EditorManagerEventMap> {
2264
2420
  createEditor(this: EditorManager, id: string, options: RawEditorOptions): Editor;
2265
2421
  execCommand(this: EditorManager, cmd: string, ui: boolean, value: any): boolean;
2266
2422
  get(this: EditorManager): Editor[];
2267
- get(this: EditorManager, id: number | string): Editor;
2423
+ get(this: EditorManager, id: number | string): Editor | null;
2268
2424
  init(this: EditorManager, options: RawEditorOptions): Promise<Editor[]>;
2269
2425
  overrideDefaults(this: EditorManager, defaultOptions: Partial<RawEditorOptions>): void;
2270
2426
  remove(this: EditorManager): void;
2271
- remove(this: EditorManager, selector: string | Editor): Editor | void;
2427
+ remove(this: EditorManager, selector: string): void;
2428
+ remove(this: EditorManager, editor: Editor): Editor | null;
2272
2429
  setActive(this: EditorManager, editor: Editor): void;
2273
2430
  setup(this: EditorManager): void;
2274
2431
  translate: (text: Untranslated) => TranslatedString;
@@ -2277,7 +2434,7 @@ interface EditorManager extends Observable<EditorManagerEventMap> {
2277
2434
  }
2278
2435
  interface EditorObservable extends Observable<EditorEventMap> {
2279
2436
  bindPendingEventDelegates(this: Editor): void;
2280
- toggleNativeEvent(this: Editor, name: string, state: boolean): any;
2437
+ toggleNativeEvent(this: Editor, name: string, state: boolean): void;
2281
2438
  unbindAllNativeEvents(this: Editor): void;
2282
2439
  }
2283
2440
  interface ProcessorSuccess<T> {
@@ -2328,7 +2485,7 @@ interface Options {
2328
2485
  };
2329
2486
  isRegistered: (name: string) => boolean;
2330
2487
  get: {
2331
- <K extends keyof EditorOptions>(name: K): EditorOptions[K] | undefined;
2488
+ <K extends keyof EditorOptions>(name: K): EditorOptions[K];
2332
2489
  <T>(name: string): T | undefined;
2333
2490
  };
2334
2491
  set: <K extends string, T>(name: K, value: K extends keyof NormalizedEditorOptions ? NormalizedEditorOptions[K] : T) => boolean;
@@ -2353,7 +2510,7 @@ interface EditorUpload {
2353
2510
  declare type FormatChangeCallback = (state: boolean, data: {
2354
2511
  node: Node;
2355
2512
  format: string;
2356
- parents: any;
2513
+ parents: Element[];
2357
2514
  }) => void;
2358
2515
  interface FormatRegistry {
2359
2516
  get: {
@@ -2365,18 +2522,18 @@ interface FormatRegistry {
2365
2522
  unregister: (name: string) => Formats;
2366
2523
  }
2367
2524
  interface Formatter extends FormatRegistry {
2368
- apply: (name: string, vars?: FormatVars, node?: Node | RangeLikeObject) => void;
2525
+ apply: (name: string, vars?: FormatVars, node?: Node | RangeLikeObject | null) => void;
2369
2526
  remove: (name: string, vars?: FormatVars, node?: Node | Range, similar?: boolean) => void;
2370
2527
  toggle: (name: string, vars?: FormatVars, node?: Node) => void;
2371
2528
  match: (name: string, vars?: FormatVars, node?: Node, similar?: boolean) => boolean;
2372
2529
  closest: (names: string[]) => string | null;
2373
2530
  matchAll: (names: string[], vars?: FormatVars) => string[];
2374
- matchNode: (node: Node, name: string, vars?: FormatVars, similar?: boolean) => Format | undefined;
2531
+ matchNode: (node: Node | null, name: string, vars?: FormatVars, similar?: boolean) => Format | undefined;
2375
2532
  canApply: (name: string) => boolean;
2376
2533
  formatChanged: (names: string, callback: FormatChangeCallback, similar?: boolean, vars?: FormatVars) => {
2377
2534
  unbind: () => void;
2378
2535
  };
2379
- getCssText: (format: string | Format) => string;
2536
+ getCssText: (format: string | ApplyFormat) => string;
2380
2537
  }
2381
2538
  interface EditorMode {
2382
2539
  isReadOnly: () => boolean;
@@ -2419,7 +2576,7 @@ declare class Shortcuts {
2419
2576
  private readonly shortcuts;
2420
2577
  private pendingPatterns;
2421
2578
  constructor(editor: Editor);
2422
- add(pattern: string, desc: string, cmdFunc: CommandFunc, scope?: any): boolean;
2579
+ add(pattern: string, desc: string | null, cmdFunc: CommandFunc, scope?: any): boolean;
2423
2580
  remove(pattern: string): boolean;
2424
2581
  private normalizeCommandFunc;
2425
2582
  private createShortcut;
@@ -2428,17 +2585,18 @@ declare class Shortcuts {
2428
2585
  private matchShortcut;
2429
2586
  private executeShortcutAction;
2430
2587
  }
2588
+ interface RenderResult {
2589
+ iframeContainer?: HTMLElement;
2590
+ editorContainer: HTMLElement;
2591
+ api?: Partial<EditorUiApi>;
2592
+ }
2431
2593
  interface Theme {
2432
2594
  ui?: any;
2433
2595
  inline?: any;
2434
2596
  execCommand?: (command: string, ui?: boolean, value?: any) => boolean;
2435
2597
  destroy?: () => void;
2436
2598
  init?: (editor: Editor, url: string) => void;
2437
- renderUI?: () => {
2438
- iframeContainer?: HTMLIFrameElement;
2439
- editorContainer: HTMLElement;
2440
- api?: Partial<EditorUiApi>;
2441
- };
2599
+ renderUI?: () => RenderResult;
2442
2600
  getNotificationManagerImpl?: () => NotificationManagerImpl;
2443
2601
  getWindowManagerImpl?: () => WindowManagerImpl;
2444
2602
  }
@@ -2464,34 +2622,34 @@ declare class Editor implements EditorObservable {
2464
2622
  editorCommands: EditorCommands;
2465
2623
  suffix: string;
2466
2624
  editorManager: EditorManager;
2625
+ hidden: boolean;
2467
2626
  inline: boolean;
2627
+ hasVisual: boolean;
2468
2628
  isNotDirty: boolean;
2469
2629
  annotator: Annotator;
2470
- bodyElement: HTMLElement;
2630
+ bodyElement: HTMLElement | undefined;
2471
2631
  bookmark: any;
2472
2632
  composing: boolean;
2473
2633
  container: HTMLElement;
2474
2634
  contentAreaContainer: HTMLElement;
2475
2635
  contentDocument: Document;
2476
2636
  contentWindow: Window;
2477
- delegates: Record<string, (event: any) => void>;
2637
+ delegates: Record<string, EventUtilsCallback<any>> | undefined;
2478
2638
  destroyed: boolean;
2479
2639
  dom: DOMUtils;
2480
2640
  editorContainer: HTMLElement;
2481
2641
  editorUpload: EditorUpload;
2482
- eventRoot?: Element;
2642
+ eventRoot: Element | undefined;
2483
2643
  formatter: Formatter;
2484
- formElement: HTMLElement;
2485
- formEventDelegate: (e: Event) => void;
2644
+ formElement: HTMLElement | undefined;
2645
+ formEventDelegate: ((e: Event) => void) | undefined;
2486
2646
  hasHiddenInput: boolean;
2487
- hasVisual: boolean;
2488
- hidden: boolean;
2489
2647
  iframeElement: HTMLIFrameElement | null;
2490
- iframeHTML: string;
2648
+ iframeHTML: string | undefined;
2491
2649
  initialized: boolean;
2492
2650
  notificationManager: NotificationManager;
2493
2651
  orgDisplay: string;
2494
- orgVisibility: string;
2652
+ orgVisibility: string | undefined;
2495
2653
  parser: DomParser;
2496
2654
  quirks: Quirks;
2497
2655
  readonly: boolean;
@@ -2505,8 +2663,8 @@ declare class Editor implements EditorObservable {
2505
2663
  model: Model;
2506
2664
  undoManager: UndoManager;
2507
2665
  windowManager: WindowManager;
2508
- _beforeUnload: () => void;
2509
- _eventDispatcher: EventDispatcher<NativeEventMap>;
2666
+ _beforeUnload: (() => void) | undefined;
2667
+ _eventDispatcher: EventDispatcher<NativeEventMap> | undefined;
2510
2668
  _nodeChangeDispatcher: NodeChange;
2511
2669
  _pendingNativeEvents: string[];
2512
2670
  _selectionOverrides: SelectionOverrides;
@@ -2530,9 +2688,12 @@ declare class Editor implements EditorObservable {
2530
2688
  getParam<T>(name: string, defaultVal: T, type?: BuiltInOptionType): T;
2531
2689
  hasPlugin(name: string, loaded?: boolean): boolean;
2532
2690
  nodeChanged(args?: any): void;
2533
- addCommand(name: string, callback: EditorCommandCallback, scope?: object): void;
2534
- addQueryStateHandler(name: string, callback: () => boolean, scope?: any): void;
2535
- addQueryValueHandler(name: string, callback: () => string, scope?: any): void;
2691
+ addCommand<S>(name: string, callback: EditorCommandCallback<S>, scope: S): void;
2692
+ addCommand(name: string, callback: EditorCommandCallback<Editor>): void;
2693
+ addQueryStateHandler<S>(name: string, callback: (this: S) => boolean, scope?: S): void;
2694
+ addQueryStateHandler(name: string, callback: (this: Editor) => boolean): void;
2695
+ addQueryValueHandler<S>(name: string, callback: (this: S) => string, scope: S): void;
2696
+ addQueryValueHandler(name: string, callback: (this: Editor) => string): void;
2536
2697
  addShortcut(pattern: string, desc: string, cmdFunc: string | [
2537
2698
  string,
2538
2699
  boolean,
@@ -2546,8 +2707,8 @@ declare class Editor implements EditorObservable {
2546
2707
  hide(): void;
2547
2708
  isHidden(): boolean;
2548
2709
  setProgressState(state: boolean, time?: number): void;
2549
- load(args?: any): string;
2550
- save(args?: any): string;
2710
+ load(args?: Partial<SetContentArgs>): string;
2711
+ save(args?: Partial<GetContentArgs>): string;
2551
2712
  setContent(content: string, args?: Partial<SetContentArgs>): string;
2552
2713
  setContent(content: AstNode, args?: Partial<SetContentArgs>): AstNode;
2553
2714
  setContent(content: Content, args?: Partial<SetContentArgs>): Content;
@@ -2565,7 +2726,7 @@ declare class Editor implements EditorObservable {
2565
2726
  getWin(): Window;
2566
2727
  getDoc(): Document;
2567
2728
  getBody(): HTMLElement;
2568
- convertURL(url: string, name: string, elm?: any): string;
2729
+ convertURL(url: string, name: string, elm?: string | Element): string;
2569
2730
  addVisual(elm?: HTMLElement): void;
2570
2731
  remove(): void;
2571
2732
  destroy(automatic?: boolean): void;
@@ -2585,8 +2746,8 @@ interface AddOnManager<T> {
2585
2746
  lookup: Record<string, {
2586
2747
  instance: AddOnConstructor<T>;
2587
2748
  }>;
2588
- get: (name: string) => AddOnConstructor<T>;
2589
- requireLangPack: (name: string, languages: string) => void;
2749
+ get: (name: string) => AddOnConstructor<T> | undefined;
2750
+ requireLangPack: (name: string, languages?: string) => void;
2590
2751
  add: (id: string, addOn: AddOnConstructor<T>) => AddOnConstructor<T>;
2591
2752
  remove: (name: string) => void;
2592
2753
  createUrl: (baseUrl: UrlObject, dep: string | UrlObject) => UrlObject;
@@ -2642,10 +2803,10 @@ declare class DomTreeWalker {
2642
2803
  private readonly rootNode;
2643
2804
  private node;
2644
2805
  constructor(startNode: Node, rootNode: Node);
2645
- current(): Node | undefined;
2646
- next(shallow?: boolean): Node | undefined;
2647
- prev(shallow?: boolean): Node | undefined;
2648
- prev2(shallow?: boolean): Node | undefined;
2806
+ current(): Node | null | undefined;
2807
+ next(shallow?: boolean): Node | null | undefined;
2808
+ prev(shallow?: boolean): Node | null | undefined;
2809
+ prev2(shallow?: boolean): Node | null | undefined;
2649
2810
  private findSibling;
2650
2811
  private findPreviousNode;
2651
2812
  }
@@ -2714,7 +2875,7 @@ interface Entities {
2714
2875
  encodeAllRaw: (text: string) => string;
2715
2876
  encodeNumeric: (text: string, attr?: boolean) => string;
2716
2877
  encodeNamed: (text: string, attr?: boolean, entities?: EntitiesMap) => string;
2717
- getEncodeFunc: (name: string, entities?: EntitiesMap | string) => (text: string, attr?: boolean) => string;
2878
+ getEncodeFunc: (name: string, entities?: string) => (text: string, attr?: boolean) => string;
2718
2879
  decode: (text: string) => string;
2719
2880
  }
2720
2881
  interface IconPack {
@@ -2730,6 +2891,20 @@ interface Resource {
2730
2891
  add: (id: string, data: any) => void;
2731
2892
  unload: (id: string) => void;
2732
2893
  }
2894
+ type TextPatterns_d_Pattern = Pattern;
2895
+ type TextPatterns_d_RawPattern = RawPattern;
2896
+ type TextPatterns_d_DynamicPatternsLookup = DynamicPatternsLookup;
2897
+ type TextPatterns_d_RawDynamicPatternsLookup = RawDynamicPatternsLookup;
2898
+ type TextPatterns_d_DynamicPatternContext = DynamicPatternContext;
2899
+ type TextPatterns_d_BlockCmdPattern = BlockCmdPattern;
2900
+ type TextPatterns_d_BlockPattern = BlockPattern;
2901
+ type TextPatterns_d_BlockFormatPattern = BlockFormatPattern;
2902
+ type TextPatterns_d_InlineCmdPattern = InlineCmdPattern;
2903
+ type TextPatterns_d_InlinePattern = InlinePattern;
2904
+ type TextPatterns_d_InlineFormatPattern = InlineFormatPattern;
2905
+ declare namespace TextPatterns_d {
2906
+ export { TextPatterns_d_Pattern as Pattern, TextPatterns_d_RawPattern as RawPattern, TextPatterns_d_DynamicPatternsLookup as DynamicPatternsLookup, TextPatterns_d_RawDynamicPatternsLookup as RawDynamicPatternsLookup, TextPatterns_d_DynamicPatternContext as DynamicPatternContext, TextPatterns_d_BlockCmdPattern as BlockCmdPattern, TextPatterns_d_BlockPattern as BlockPattern, TextPatterns_d_BlockFormatPattern as BlockFormatPattern, TextPatterns_d_InlineCmdPattern as InlineCmdPattern, TextPatterns_d_InlinePattern as InlinePattern, TextPatterns_d_InlineFormatPattern as InlineFormatPattern, };
2907
+ }
2733
2908
  interface Delay {
2734
2909
  setEditorInterval: (editor: Editor, callback: () => void, time?: number) => number;
2735
2910
  setEditorTimeout: (editor: Editor, callback: () => void, time?: number) => number;
@@ -2738,12 +2913,13 @@ declare type UploadResult = UploadResult$2;
2738
2913
  interface ImageUploader {
2739
2914
  upload: (blobInfos: BlobInfo[], showNotification?: boolean) => Promise<UploadResult[]>;
2740
2915
  }
2741
- declare type ArrayCallback$1<T, R> = (x: T, i: number, xs: ReadonlyArray<T>) => R;
2742
- declare type ObjCallback$1<T, R> = (value: T, key: string, obj: Record<string, T>) => R;
2916
+ declare type ArrayCallback$1<T, R> = (this: any, x: T, i: number, xs: ArrayLike<T>) => R;
2917
+ declare type ObjCallback$1<T, R> = (this: any, value: T, key: string, obj: Record<string, T>) => R;
2743
2918
  declare type ArrayCallback<T, R> = ArrayCallback$1<T, R>;
2744
2919
  declare type ObjCallback<T, R> = ObjCallback$1<T, R>;
2920
+ declare type WalkCallback<T> = (this: any, o: T, i: string, n: keyof T | undefined) => boolean | void;
2745
2921
  interface Tools {
2746
- is: (obj: any, type: string) => boolean;
2922
+ is: (obj: any, type?: string) => boolean;
2747
2923
  isArray: <T>(arr: any) => arr is Array<T>;
2748
2924
  inArray: <T>(arr: ArrayLike<T>, value: T) => number;
2749
2925
  grep: {
@@ -2753,7 +2929,7 @@ interface Tools {
2753
2929
  trim: (str: string | null | undefined) => string;
2754
2930
  toArray: <T>(obj: ArrayLike<T>) => T[];
2755
2931
  hasOwn: (obj: any, name: string) => boolean;
2756
- makeMap: <T>(items: ArrayLike<T> | string, delim?: string | RegExp, map?: Record<string, T | string>) => Record<string, T | string>;
2932
+ makeMap: (items: ArrayLike<string> | string | undefined, delim?: string | RegExp, map?: Record<string, {}>) => Record<string, {}>;
2757
2933
  each: {
2758
2934
  <T>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, void | boolean>, scope?: any): boolean;
2759
2935
  <T>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, void | boolean>, scope?: any): boolean;
@@ -2763,9 +2939,9 @@ interface Tools {
2763
2939
  <T, R>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, R>): R[];
2764
2940
  };
2765
2941
  extend: (obj: Object, ext: Object, ...objs: Object[]) => any;
2766
- walk: <T = any>(obj: T, f: Function, n?: keyof T, scope?: any) => void;
2942
+ walk: <T extends Record<string, any>>(obj: T, f: WalkCallback<T>, n?: keyof T, scope?: any) => void;
2767
2943
  resolve: (path: string, o?: Object) => any;
2768
- explode: (s: string, d?: string | RegExp) => string[];
2944
+ explode: (s: string | string[], d?: string | RegExp) => string[];
2769
2945
  _addCacheSuffix: (url: string) => string;
2770
2946
  }
2771
2947
  interface KeyboardLikeEvent {
@@ -2892,4 +3068,4 @@ interface TinyMCE extends EditorManager {
2892
3068
  _addCacheSuffix: Tools['_addCacheSuffix'];
2893
3069
  }
2894
3070
  declare const tinymce: TinyMCE;
2895
- 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 };
3071
+ 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, TextPatterns_d as TextPatterns, TextSeeker, Theme, ThemeManager, TinyMCE, Tools, URI, Ui_d as Ui, UndoManager, VK, WindowManager, Writer, WriterSettings, tinymce as default };