jodit 3.6.16 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/.eslintrc.js +1 -1
  2. package/{ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md} +0 -0
  3. package/{PULL_REQUEST_TEMPLATE.md → .github/PULL_REQUEST_TEMPLATE.md} +0 -0
  4. package/CHANGELOG.MD +76 -5
  5. package/build/jodit.css +23 -19
  6. package/build/jodit.es2018.css +22 -18
  7. package/build/jodit.es2018.en.css +22 -18
  8. package/build/jodit.es2018.en.js +153 -99
  9. package/build/jodit.es2018.en.min.css +1 -1
  10. package/build/jodit.es2018.en.min.js +2 -2
  11. package/build/jodit.es2018.js +153 -99
  12. package/build/jodit.es2018.min.css +1 -1
  13. package/build/jodit.es2018.min.js +2 -2
  14. package/build/jodit.js +884 -809
  15. package/build/jodit.min.css +2 -2
  16. package/build/jodit.min.js +2 -2
  17. package/package.json +24 -24
  18. package/src/core/async.ts +22 -8
  19. package/src/core/component/component.ts +4 -2
  20. package/src/core/component/view-component.ts +1 -1
  21. package/src/core/decorators/cache.ts +1 -1
  22. package/src/core/decorators/component.ts +1 -1
  23. package/src/core/decorators/debounce.ts +5 -4
  24. package/src/core/decorators/idle.ts +40 -0
  25. package/src/core/decorators/index.ts +1 -0
  26. package/src/core/decorators/nonenumerable.ts +1 -1
  27. package/src/core/decorators/spy.ts +2 -3
  28. package/src/core/decorators/watch.ts +9 -5
  29. package/src/core/events/events-native.ts +1 -1
  30. package/src/core/global.ts +7 -3
  31. package/src/core/helpers/checker/is-plain-object.ts +1 -2
  32. package/src/core/helpers/checker/is-url.ts +4 -1
  33. package/src/core/helpers/scroll-into-view.ts +1 -1
  34. package/src/core/helpers/size/position.ts +1 -22
  35. package/src/core/helpers/string/stringify.ts +2 -2
  36. package/src/core/helpers/type.ts +0 -44
  37. package/src/core/helpers/utils/utils.ts +1 -1
  38. package/src/core/plugin.ts +3 -1
  39. package/src/core/ui/button/button/button.ts +2 -2
  40. package/src/core/ui/button/group/group.ts +6 -4
  41. package/src/core/ui/element.ts +2 -2
  42. package/src/core/ui/form/block/block.ts +1 -1
  43. package/src/core/ui/form/form.ts +5 -5
  44. package/src/core/ui/form/inputs/area/area.ts +3 -3
  45. package/src/core/ui/form/inputs/checkbox/checkbox.ts +2 -2
  46. package/src/core/ui/form/inputs/file/file.ts +6 -4
  47. package/src/core/ui/form/inputs/input/input.ts +7 -5
  48. package/src/core/ui/form/inputs/select/select.ts +9 -7
  49. package/src/core/ui/list/group.ts +4 -4
  50. package/src/core/ui/list/list.ts +2 -2
  51. package/src/core/ui/popup/popup.ts +3 -3
  52. package/src/core/ui/progress-bar/progress-bar.ts +3 -3
  53. package/src/core/view/view-with-toolbar.ts +5 -2
  54. package/src/core/view/view.ts +2 -2
  55. package/src/jodit.ts +37 -15
  56. package/src/modules/context-menu/context-menu.ts +1 -1
  57. package/src/modules/dialog/dialog.ts +4 -4
  58. package/src/modules/file-browser/builders/context-menu.ts +1 -1
  59. package/src/modules/file-browser/data-provider.ts +1 -1
  60. package/src/modules/file-browser/file-browser.ts +3 -3
  61. package/src/modules/image-editor/image-editor.ts +1 -1
  62. package/src/modules/observer/observer.ts +1 -1
  63. package/src/modules/observer/snapshot.ts +1 -1
  64. package/src/modules/status-bar/status-bar.ts +1 -1
  65. package/src/modules/table.ts +3 -1
  66. package/src/modules/toolbar/button/button.ts +13 -10
  67. package/src/modules/toolbar/button/content.ts +3 -3
  68. package/src/modules/toolbar/collection/collection.ts +9 -6
  69. package/src/modules/toolbar/collection/editor-collection.ts +26 -4
  70. package/src/modules/uploader/uploader.ts +1 -1
  71. package/src/modules/widget/file-selector/file-selector.ts +1 -1
  72. package/src/plugins/about/about.ts +1 -1
  73. package/src/plugins/class-span/class-span.ts +3 -3
  74. package/src/plugins/clipboard/clipboard.ts +28 -24
  75. package/src/plugins/clipboard/paste/helpers.ts +5 -8
  76. package/src/plugins/clipboard/paste/paste.ts +3 -3
  77. package/src/plugins/fix/clean-html.ts +3 -3
  78. package/src/plugins/image/helpers.ts +1 -1
  79. package/src/plugins/inline-popup/inline-popup.ts +1 -1
  80. package/src/plugins/keyboard/delete.ts +1 -1
  81. package/src/plugins/keyboard/enter.ts +26 -26
  82. package/src/plugins/limit.ts +2 -2
  83. package/src/plugins/link/link.ts +3 -3
  84. package/src/plugins/media/video/index.ts +1 -1
  85. package/src/plugins/ordered-list.ts +64 -61
  86. package/src/plugins/redo-undo.ts +3 -3
  87. package/src/plugins/search/search.ts +2 -2
  88. package/src/plugins/select.ts +3 -2
  89. package/src/plugins/size/resize-handler.ts +2 -2
  90. package/src/plugins/size/size.ts +2 -2
  91. package/src/plugins/source/editor/engines/ace.ts +8 -8
  92. package/src/plugins/source/editor/engines/area.ts +15 -13
  93. package/src/plugins/source/source.ts +1 -1
  94. package/src/plugins/symbols/symbols.ts +3 -3
  95. package/src/plugins/table/config.ts +3 -1
  96. package/src/plugins/table/resize-cells.ts +21 -16
  97. package/src/plugins/table/select-cells.ts +44 -6
  98. package/src/plugins/table/table-keyboard-navigation.ts +134 -131
  99. package/src/plugins/table/table.less +24 -17
  100. package/src/types/async.d.ts +2 -0
  101. package/src/types/core.ts +13 -0
  102. package/src/types/index.d.ts +1 -0
  103. package/src/types/jodit.d.ts +2 -0
  104. package/test/tests/acceptance/editorTest.js +37 -0
  105. package/test/tests/acceptance/tableTest.js +23 -14
  106. package/tsconfig.json +1 -0
  107. package/webpack.config.js +1 -0
@@ -43,11 +43,11 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
43
43
  implements IToolbarButton
44
44
  {
45
45
  /** @override */
46
- className(): string {
46
+ override className(): string {
47
47
  return 'ToolbarButton';
48
48
  }
49
49
 
50
- state = {
50
+ override state = {
51
51
  ...UIButtonState(),
52
52
  theme: 'toolbar',
53
53
  currentValue: '',
@@ -73,7 +73,7 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
73
73
  }
74
74
 
75
75
  /** @override **/
76
- update(): void {
76
+ override update(): void {
77
77
  const { control, state } = this,
78
78
  tc = this.closest(ToolbarCollection) as ToolbarCollection;
79
79
 
@@ -90,13 +90,13 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
90
90
  }
91
91
 
92
92
  /** @override */
93
- protected onChangeActivated(): void {
93
+ protected override onChangeActivated(): void {
94
94
  attr(this.button, 'aria-pressed', this.state.activated);
95
95
  super.onChangeActivated();
96
96
  }
97
97
 
98
98
  /** @override */
99
- protected onChangeText(): void {
99
+ protected override onChangeText(): void {
100
100
  if (isFunction(this.control.template)) {
101
101
  this.text.innerHTML = this.control.template(
102
102
  this.j,
@@ -111,12 +111,12 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
111
111
  }
112
112
 
113
113
  /** @override */
114
- onChangeTabIndex(): void {
114
+ override onChangeTabIndex(): void {
115
115
  attr(this.button, 'tabIndex', this.state.tabIndex);
116
116
  }
117
117
 
118
118
  /** @override */
119
- protected createContainer(): HTMLElement {
119
+ protected override createContainer(): HTMLElement {
120
120
  const cn = this.componentName;
121
121
  const container = this.j.c.span(cn),
122
122
  button = super.createContainer();
@@ -144,7 +144,7 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
144
144
  }
145
145
 
146
146
  /** @override */
147
- focus(): void {
147
+ override focus(): void {
148
148
  this.container.querySelector('button')?.focus();
149
149
  }
150
150
 
@@ -160,7 +160,7 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
160
160
  }
161
161
 
162
162
  /** @override */
163
- protected onChangeDisabled(): void {
163
+ protected override onChangeDisabled(): void {
164
164
  const dsb = this.state.disabled ? 'disabled' : null;
165
165
 
166
166
  attr(this.trigger, 'disabled', dsb);
@@ -413,7 +413,8 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
413
413
  button: this
414
414
  });
415
415
 
416
- if (result !== false) {
416
+ // For memorise exec
417
+ if (result !== false && result !== true) {
417
418
  this.j?.e?.fire('synchro');
418
419
 
419
420
  if (this.parentElement) {
@@ -425,7 +426,9 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
425
426
  * @event afterExec
426
427
  */
427
428
  this.j?.e?.fire('closeAllPopups afterExec');
429
+ }
428
430
 
431
+ if (result !== false) {
429
432
  return;
430
433
  }
431
434
  }
@@ -23,12 +23,12 @@ export class ToolbarContent<T extends IViewBased = IViewBased>
23
23
  implements IToolbarButton
24
24
  {
25
25
  /** @override */
26
- className(): string {
26
+ override className(): string {
27
27
  return 'ToolbarContent';
28
28
  }
29
29
 
30
30
  /** @override */
31
- update(): void {
31
+ override update(): void {
32
32
  const content = this.control.getContent(this.j, this.control, this);
33
33
 
34
34
  if (isString(content) || content.parentNode !== this.container) {
@@ -43,7 +43,7 @@ export class ToolbarContent<T extends IViewBased = IViewBased>
43
43
  }
44
44
 
45
45
  /** @override */
46
- protected createContainer(): HTMLElement {
46
+ protected override createContainer(): HTMLElement {
47
47
  return this.j.c.span(this.componentName);
48
48
  }
49
49
 
@@ -29,11 +29,11 @@ export class ToolbarCollection<T extends IViewBased = IViewBased>
29
29
  implements IToolbarCollection
30
30
  {
31
31
  /** @override */
32
- className(): string {
32
+ override className(): string {
33
33
  return 'ToolbarCollection';
34
34
  }
35
35
 
36
- jodit!: T;
36
+ override jodit!: T;
37
37
 
38
38
  readonly listenEvents =
39
39
  'updateToolbar changeStack mousedown mouseup keydown change afterInit readonly afterResize ' +
@@ -47,7 +47,7 @@ export class ToolbarCollection<T extends IViewBased = IViewBased>
47
47
  return button || null;
48
48
  }
49
49
 
50
- protected makeButton(
50
+ protected override makeButton(
51
51
  control: IControlTypeStrong,
52
52
  target: Nullable<HTMLElement> = null
53
53
  ): IUIButton {
@@ -116,7 +116,7 @@ export class ToolbarCollection<T extends IViewBased = IViewBased>
116
116
  this.j.e.fire('afterUpdateToolbar');
117
117
  }
118
118
 
119
- update = this.j.async.debounce(
119
+ override update = this.j.async.debounce(
120
120
  this.immediateUpdate,
121
121
  () => this.j.defaultTimeout
122
122
  );
@@ -143,7 +143,10 @@ export class ToolbarCollection<T extends IViewBased = IViewBased>
143
143
  }
144
144
 
145
145
  /** @override **/
146
- build(items: ButtonsGroups, target: Nullable<HTMLElement> = null): this {
146
+ override build(
147
+ items: ButtonsGroups,
148
+ target: Nullable<HTMLElement> = null
149
+ ): this {
147
150
  const itemsWithGroupps = this.j.e.fire(
148
151
  'beforeToolbarBuild',
149
152
  items
@@ -158,7 +161,7 @@ export class ToolbarCollection<T extends IViewBased = IViewBased>
158
161
  }
159
162
 
160
163
  /** @override **/
161
- destruct(): void {
164
+ override destruct(): void {
162
165
  if (this.isDestructed) {
163
166
  return;
164
167
  }
@@ -19,12 +19,12 @@ import { component } from '../../../core/decorators';
19
19
  @component
20
20
  export class ToolbarEditorCollection extends ToolbarCollection<IJodit> {
21
21
  /** @override */
22
- className(): string {
22
+ override className(): string {
23
23
  return 'ToolbarEditorCollection';
24
24
  }
25
25
 
26
26
  /** @override */
27
- shouldBeDisabled(button: IToolbarButton): boolean {
27
+ override shouldBeDisabled(button: IToolbarButton): boolean {
28
28
  const disabled = super.shouldBeDisabled(button);
29
29
 
30
30
  if (disabled !== undefined) {
@@ -40,7 +40,7 @@ export class ToolbarEditorCollection extends ToolbarCollection<IJodit> {
40
40
  }
41
41
 
42
42
  /** @override */
43
- shouldBeActive(button: IToolbarButton): boolean {
43
+ override shouldBeActive(button: IToolbarButton): boolean {
44
44
  const active = super.shouldBeActive(button);
45
45
 
46
46
  if (active !== undefined) {
@@ -135,7 +135,29 @@ export class ToolbarEditorCollection extends ToolbarCollection<IJodit> {
135
135
  };
136
136
 
137
137
  /** @override */
138
- getTarget(button: IToolbarButton): Node | null {
138
+ override getTarget(button: IToolbarButton): Node | null {
139
139
  return button.target || this.j.s.current() || null;
140
140
  }
141
+
142
+ /** @override */
143
+ constructor(jodit: IJodit) {
144
+ super(jodit);
145
+ this.prependInvisibleInput(this.container);
146
+ }
147
+
148
+ /**
149
+ * Adds an invisible element to the container that can handle the
150
+ * situation when the editor is inside the <label>
151
+ *
152
+ * @see https://github.com/jodit/jodit-react/issues/138
153
+ * @param container
154
+ */
155
+ private prependInvisibleInput(container: HTMLElement): void {
156
+ const input = this.j.create.element('input', {
157
+ tabIndex: -1,
158
+ style: 'width: 0; height:0; position: absolute; visibility: hidden;'
159
+ });
160
+
161
+ Dom.appendChildFirst(container, input);
162
+ }
141
163
  }
@@ -774,7 +774,7 @@ export class Uploader extends ViewComponent implements IUploader {
774
774
  ) as IUploaderOptions<Uploader>;
775
775
  }
776
776
 
777
- destruct(): any {
777
+ override destruct(): any {
778
778
  this.setStatus(STATUSES.beforeDestruct);
779
779
 
780
780
  this.ajaxInstances.forEach(ajax => {
@@ -145,7 +145,7 @@ export const FileSelectorWidget = (
145
145
  required: true,
146
146
  label: 'URL',
147
147
  name: 'url',
148
- type: 'url',
148
+ type: 'text',
149
149
  placeholder: 'https://'
150
150
  }),
151
151
  new UIInput(editor, {
@@ -32,7 +32,7 @@ Config.prototype.controls.about = {
32
32
  : normalizeLicense(editor.o.license)
33
33
  )}</div>
34
34
  <div>
35
- <a href="https://xdsoft.net/jodit/" target="_blank">http://xdsoft.net/jodit/</a>
35
+ <a href="${process.env.HOMEPAGE}" target="_blank">${process.env.HOMEPAGE}</a>
36
36
  </div>
37
37
  <div>
38
38
  <a href="https://xdsoft.net/jodit/doc/" target="_blank">${i18n(
@@ -115,7 +115,7 @@ Config.prototype.controls.classSpan = {
115
115
  */
116
116
  export class classSpan extends Plugin {
117
117
  /** @override */
118
- buttons: Plugin['buttons'] = [
118
+ override buttons: Plugin['buttons'] = [
119
119
  {
120
120
  name: 'classSpan',
121
121
  group: 'font'
@@ -123,7 +123,7 @@ export class classSpan extends Plugin {
123
123
  ];
124
124
 
125
125
  /** @override */
126
- protected afterInit(jodit: IJodit): void {
126
+ protected override afterInit(jodit: IJodit): void {
127
127
  jodit.registerCommand(
128
128
  'applyClassName',
129
129
  (command: string, second: string, third: string): false => {
@@ -136,5 +136,5 @@ export class classSpan extends Plugin {
136
136
  );
137
137
  }
138
138
 
139
- protected beforeDestruct(jodit: IJodit): void {}
139
+ protected override beforeDestruct(jodit: IJodit): void {}
140
140
  }
@@ -43,36 +43,40 @@ export class clipboard implements IPlugin {
43
43
 
44
44
  editor.e
45
45
  .off(`copy.${pluginKey} cut.${pluginKey}`)
46
- .on(`copy.${pluginKey} cut.${pluginKey}`, (event: ClipboardEvent):
47
- | false
48
- | void => {
49
- const selectedText = editor.s.html;
46
+ .on(
47
+ `copy.${pluginKey} cut.${pluginKey}`,
48
+ (event: ClipboardEvent): false | void => {
49
+ const selectedText = editor.s.html;
50
50
 
51
- const clipboardData =
52
- getDataTransfer(event) ||
53
- getDataTransfer(editor.ew as any) ||
54
- getDataTransfer((event as any).originalEvent);
51
+ const clipboardData =
52
+ getDataTransfer(event) ||
53
+ getDataTransfer(editor.ew as any) ||
54
+ getDataTransfer((event as any).originalEvent);
55
55
 
56
- if (clipboardData) {
57
- clipboardData.setData(TEXT_PLAIN, stripTags(selectedText));
58
- clipboardData.setData(TEXT_HTML, selectedText);
59
- }
56
+ if (clipboardData) {
57
+ clipboardData.setData(
58
+ TEXT_PLAIN,
59
+ stripTags(selectedText)
60
+ );
61
+ clipboardData.setData(TEXT_HTML, selectedText);
62
+ }
60
63
 
61
- editor.buffer.set(pluginKey, selectedText);
62
- editor.e.fire('pasteStack', {
63
- html: selectedText,
64
- action: editor.o.defaultActionOnPaste
65
- });
64
+ editor.buffer.set(pluginKey, selectedText);
65
+ editor.e.fire('pasteStack', {
66
+ html: selectedText,
67
+ action: editor.o.defaultActionOnPaste
68
+ });
66
69
 
67
- if (event.type === 'cut') {
68
- editor.s.remove();
69
- editor.s.focus();
70
- }
70
+ if (event.type === 'cut') {
71
+ editor.s.remove();
72
+ editor.s.focus();
73
+ }
71
74
 
72
- event.preventDefault();
75
+ event.preventDefault();
73
76
 
74
- editor?.events?.fire('afterCopy', selectedText);
75
- });
77
+ editor?.events?.fire('afterCopy', selectedText);
78
+ }
79
+ );
76
80
  }
77
81
 
78
82
  /** @override */
@@ -6,13 +6,7 @@
6
6
 
7
7
  import type { IJodit, Nullable } from '../../../types';
8
8
  import type { PasteEvent } from '../config';
9
- import {
10
- isArray,
11
- isNumber,
12
- isString,
13
- isVoid,
14
- type
15
- } from '../../../core/helpers';
9
+ import { isArray, isNumber, isString, isVoid } from '../../../core/helpers';
16
10
  import { Dom } from '../../../core/dom';
17
11
  import { TEXT_PLAIN } from '../../../core/constants';
18
12
 
@@ -104,7 +98,10 @@ export function getAllTypes(dt: DataTransfer): string {
104
98
 
105
99
  let types_str: string = '';
106
100
 
107
- if (isArray(types) || type(types) === 'domstringlist') {
101
+ if (
102
+ isArray(types) ||
103
+ {}.toString.call(types) === '[object DOMStringList]'
104
+ ) {
108
105
  for (let i = 0; i < types.length; i += 1) {
109
106
  types_str += types[i] + ';';
110
107
  }
@@ -50,7 +50,7 @@ export class paste extends Plugin {
50
50
  pasteStack: LimitedStack<PastedValue> = new LimitedStack(20);
51
51
 
52
52
  /** @override **/
53
- protected afterInit(jodit: IJodit) {
53
+ protected afterInit(jodit: IJodit): void {
54
54
  jodit.e
55
55
  .on('paste.paste', this.onPaste)
56
56
  .on('pasteStack.paste', (item: PastedValue) =>
@@ -395,7 +395,7 @@ export class paste extends Plugin {
395
395
  * TODO: need check all browser, now not used
396
396
  * @param event
397
397
  */
398
- useFakeDivBox(event: PasteEvent) {
398
+ useFakeDivBox(event: PasteEvent): void {
399
399
  const div = this.j.c.div('', {
400
400
  tabindex: -1,
401
401
  contenteditable: true,
@@ -446,7 +446,7 @@ export class paste extends Plugin {
446
446
  }
447
447
 
448
448
  /** @override **/
449
- protected beforeDestruct(jodit: IJodit) {
449
+ protected beforeDestruct(jodit: IJodit): void {
450
450
  jodit.e.off('paste.paste', this.onPaste);
451
451
  }
452
452
  }
@@ -107,7 +107,7 @@ Config.prototype.controls.eraser = {
107
107
  */
108
108
  export class cleanHtml extends Plugin<IJodit> {
109
109
  /** @override */
110
- buttons: Plugin['buttons'] = [
110
+ override buttons: Plugin['buttons'] = [
111
111
  {
112
112
  name: 'eraser',
113
113
  group: 'font-style'
@@ -115,7 +115,7 @@ export class cleanHtml extends Plugin<IJodit> {
115
115
  ];
116
116
 
117
117
  /** @override */
118
- protected afterInit(jodit: IJodit): void {
118
+ protected override afterInit(jodit: IJodit): void {
119
119
  jodit.e
120
120
  .off('.cleanHtml')
121
121
  .on(
@@ -536,7 +536,7 @@ export class cleanHtml extends Plugin<IJodit> {
536
536
  }
537
537
 
538
538
  /** @override */
539
- protected beforeDestruct(): void {
539
+ protected override beforeDestruct(): void {
540
540
  this.j.e.off('.cleanHtml');
541
541
  }
542
542
  }
@@ -15,7 +15,7 @@ import { clearCenterAlign, css } from '../../core/helpers';
15
15
  export const hAlignElement = (
16
16
  image: HTMLElement,
17
17
  align: 'normal' | 'left' | 'right' | 'center' | ''
18
- ) => {
18
+ ): void => {
19
19
  if (align && align !== 'normal') {
20
20
  if (align !== 'center') {
21
21
  css(image, 'float', align);
@@ -37,7 +37,7 @@ import { debounce, wait, autobind, watch } from '../../core/decorators';
37
37
  * Plugin for show inline popup dialog
38
38
  */
39
39
  export class inlinePopup extends Plugin {
40
- requires = ['select'];
40
+ override requires = ['select'];
41
41
 
42
42
  private type: Nullable<string> = null;
43
43
 
@@ -47,7 +47,7 @@ Config.prototype.delete = {
47
47
 
48
48
  export class Delete extends Plugin {
49
49
  /** @override */
50
- requires = ['hotkeys'];
50
+ override requires = ['hotkeys'];
51
51
 
52
52
  /**
53
53
  * Shortcut for jodit.editor
@@ -74,33 +74,33 @@ export class enter extends Plugin {
74
74
  : (this.defaultTag as 'p' | 'div');
75
75
  }
76
76
 
77
- editor.e.off('.enter').on('keydown.enter', (event: KeyboardEvent):
78
- | false
79
- | void => {
80
- if (event.key === consts.KEY_ENTER) {
81
- /**
82
- * Fired on processing `Enter` key. If return some value, plugin `enter` will do nothing.
83
- * if return false - prevent default Enter behavior
84
- *
85
- * @event beforeEnter
86
- */
87
- const beforeEnter = editor.e.fire('beforeEnter', event);
88
-
89
- if (beforeEnter !== undefined) {
90
- return beforeEnter;
77
+ editor.e
78
+ .off('.enter')
79
+ .on('keydown.enter', (event: KeyboardEvent): false | void => {
80
+ if (event.key === consts.KEY_ENTER) {
81
+ /**
82
+ * Fired on processing `Enter` key. If return some value, plugin `enter` will do nothing.
83
+ * if return false - prevent default Enter behavior
84
+ *
85
+ * @event beforeEnter
86
+ */
87
+ const beforeEnter = editor.e.fire('beforeEnter', event);
88
+
89
+ if (beforeEnter !== undefined) {
90
+ return beforeEnter;
91
+ }
92
+
93
+ if (!editor.s.isCollapsed()) {
94
+ editor.execCommand('Delete');
95
+ }
96
+
97
+ editor.s.focus();
98
+
99
+ this.onEnter(event);
100
+
101
+ return false;
91
102
  }
92
-
93
- if (!editor.s.isCollapsed()) {
94
- editor.execCommand('Delete');
95
- }
96
-
97
- editor.s.focus();
98
-
99
- this.onEnter(event);
100
-
101
- return false;
102
- }
103
- });
103
+ });
104
104
  }
105
105
 
106
106
  private onEnter(event: KeyboardEvent): false | void {
@@ -43,7 +43,7 @@ Config.prototype.limitHTML = false;
43
43
  */
44
44
  export class limit extends Plugin {
45
45
  /** @override **/
46
- protected afterInit(jodit: IJodit) {
46
+ protected afterInit(jodit: IJodit): void {
47
47
  const { limitWords, limitChars } = jodit.o;
48
48
 
49
49
  if (jodit && (limitWords || limitChars)) {
@@ -142,7 +142,7 @@ export class limit extends Plugin {
142
142
  }
143
143
 
144
144
  /** @override **/
145
- protected beforeDestruct(jodit: IJodit) {
145
+ protected beforeDestruct(jodit: IJodit): void {
146
146
  jodit.e.off('.limit');
147
147
  }
148
148
  }
@@ -141,7 +141,7 @@ Config.prototype.controls.link = {
141
141
  */
142
142
  export class link extends Plugin {
143
143
  /** @override */
144
- buttons: Plugin['buttons'] = [
144
+ override buttons: Plugin['buttons'] = [
145
145
  {
146
146
  name: 'link',
147
147
  group: 'insert'
@@ -149,7 +149,7 @@ export class link extends Plugin {
149
149
  ];
150
150
 
151
151
  /** @override */
152
- protected afterInit(jodit: IJodit): void {
152
+ protected override afterInit(jodit: IJodit): void {
153
153
  if (jodit.o.link.followOnDblClick) {
154
154
  jodit.e.on('dblclick.link', this.onDblClickOnLink);
155
155
  }
@@ -496,7 +496,7 @@ export class link extends Plugin {
496
496
  }
497
497
 
498
498
  /** @override */
499
- protected beforeDestruct(jodit: IJodit): void {
499
+ protected override beforeDestruct(jodit: IJodit): void {
500
500
  jodit.e
501
501
  .off('generateLinkForm.link', this.generateForm)
502
502
  .off('dblclick.link', this.onDblClickOnLink)
@@ -7,7 +7,7 @@
7
7
  import type { IJodit } from '../../../types';
8
8
  import './config';
9
9
 
10
- export function video(editor: IJodit) {
10
+ export function video(editor: IJodit): void {
11
11
  editor.registerButton({
12
12
  name: 'video',
13
13
  group: 'media'