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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "3.6.16",
3
+ "version": "3.7.2",
4
4
  "description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
5
5
  "main": "build/jodit.min.js",
6
6
  "types": "index.d.ts",
@@ -47,43 +47,43 @@
47
47
  "autobind-decorator": "^2.4.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/ace": "^0.0.45",
51
- "@types/node": "^15.3.0",
52
- "@typescript-eslint/eslint-plugin": "^4.23.0",
53
- "@typescript-eslint/parser": "^4.23.0",
54
- "autoprefixer": "^10.2.5",
50
+ "@types/ace": "^0.0.46",
51
+ "@types/node": "^15.12.2",
52
+ "@typescript-eslint/eslint-plugin": "^4.27.0",
53
+ "@typescript-eslint/parser": "^4.27.0",
54
+ "autoprefixer": "^10.2.6",
55
55
  "chai": "^4.3.4",
56
56
  "classlist-polyfill": "^1.2.0",
57
57
  "compression": "^1.7.4",
58
58
  "cross-env": "^7.0.3",
59
- "css-loader": "^5.2.4",
60
- "css-minimizer-webpack-plugin": "^3.0.0",
61
- "cssnano-preset-advanced": "^5.0.1",
59
+ "css-loader": "^5.2.6",
60
+ "css-minimizer-webpack-plugin": "^3.0.1",
61
+ "cssnano-preset-advanced": "^5.1.3",
62
62
  "es6-promise": "^4.2.8",
63
- "eslint": "^7.26.0",
63
+ "eslint": "^7.28.0",
64
64
  "eslint-config-prettier": "^8.3.0",
65
65
  "eslint-plugin-header": "^3.1.1",
66
66
  "eslint-plugin-prettier": "^3.4.0",
67
67
  "express": "^4.17.1",
68
68
  "file-loader": "^6.2.0",
69
69
  "husky": "^6.0.0",
70
- "karma": "^6.3.2",
70
+ "karma": "^6.3.4",
71
71
  "karma-chai": "^0.1.0",
72
72
  "karma-chrome-launcher": "^3.1.0",
73
- "karma-firefox-launcher": "^2.1.0",
73
+ "karma-firefox-launcher": "^2.1.1",
74
74
  "karma-mocha": "^2.0.1",
75
75
  "karma-sourcemap-loader": "^0.3.8",
76
76
  "karma-webpack": "^5.0.0",
77
77
  "less": "^4.1.1",
78
- "less-loader": "^9.0.0",
78
+ "less-loader": "^9.1.0",
79
79
  "lint-staged": "^11.0.0",
80
80
  "merge-stream": "^2.0.0",
81
81
  "mini-css-extract-plugin": "^1.6.0",
82
- "mocha": "^8.4.0",
83
- "postcss": "^8.2.15",
82
+ "mocha": "^9.0.0",
83
+ "postcss": "^8.3.4",
84
84
  "postcss-css-variables": "^0.18.0",
85
- "postcss-loader": "^5.3.0",
86
- "prettier": "^2.3.0",
85
+ "postcss-loader": "^6.1.0",
86
+ "prettier": "^2.3.1",
87
87
  "raw-loader": "^4.0.2",
88
88
  "style-loader": "^2.0.0",
89
89
  "stylelint": "^13.13.1",
@@ -92,15 +92,15 @@
92
92
  "stylelint-config-standard": "^22.0.0",
93
93
  "stylelint-prettier": "^1.2.0",
94
94
  "synchronous-promise": "^2.0.15",
95
- "terser-webpack-plugin": "^5.1.2",
96
- "ts-loader": "^9.1.2",
95
+ "terser-webpack-plugin": "^5.1.3",
96
+ "ts-loader": "^9.2.3",
97
97
  "ts-private-uglifier": "^1.0.2",
98
- "tslib": "^2.2.0",
99
- "typescript": "^4.2.4",
98
+ "tslib": "^2.3.0",
99
+ "typescript": "^4.3.2",
100
100
  "url-loader": "^4.1.1",
101
- "webpack": "^5.37.0",
102
- "webpack-cli": "^4.7.0",
103
- "webpack-dev-middleware": "^4.2.0",
101
+ "webpack": "^5.39.0",
102
+ "webpack-cli": "^4.7.2",
103
+ "webpack-dev-middleware": "^5.0.0",
104
104
  "webpack-dev-server": "^3.11.2",
105
105
  "webpack-hot-middleware": "^2.25.0",
106
106
  "webpack-stream": "^6.1.2",
package/src/core/async.ts CHANGED
@@ -16,7 +16,9 @@ import {
16
16
  clearTimeout,
17
17
  isFunction,
18
18
  isPlainObject,
19
- isPromise
19
+ isPromise,
20
+ isString,
21
+ isNumber
20
22
  } from './helpers/';
21
23
 
22
24
  export class Async implements IAsync {
@@ -33,14 +35,13 @@ export class Async implements IAsync {
33
35
 
34
36
  let options: IAsyncParams = {};
35
37
 
36
- if (typeof timeout !== 'number') {
38
+ if (!isNumber(timeout)) {
37
39
  options = timeout;
38
40
  timeout = options.timeout || 0;
39
41
  }
40
42
 
41
- if (options.label && this.timers.has(options.label)) {
42
- clearTimeout(this.timers.get(options.label) as number);
43
- this.timers.delete(options.label);
43
+ if (options.label) {
44
+ this.clearLabel(options.label);
44
45
  }
45
46
 
46
47
  const timer = setTimeout(callback, timeout, ...args),
@@ -51,10 +52,22 @@ export class Async implements IAsync {
51
52
  return timer;
52
53
  }
53
54
 
54
- clearTimeout(timer: number): void {
55
- clearTimeout(timer);
55
+ private clearLabel(label: string) {
56
+ if (label && this.timers.has(label)) {
57
+ clearTimeout(this.timers.get(label) as number);
58
+ this.timers.delete(label);
59
+ }
60
+ }
56
61
 
57
- this.timers.delete(timer);
62
+ clearTimeout(timer: number): void;
63
+ clearTimeout(label: string): void;
64
+ clearTimeout(timerOrLabel: number | string): void {
65
+ if (isString(timerOrLabel)) {
66
+ return this.clearLabel(timerOrLabel);
67
+ }
68
+
69
+ clearTimeout(timerOrLabel);
70
+ this.timers.delete(timerOrLabel);
58
71
  }
59
72
 
60
73
  /**
@@ -321,6 +334,7 @@ export class Async implements IAsync {
321
334
  }
322
335
 
323
336
  isDestructed: boolean = false;
337
+
324
338
  destruct(): any {
325
339
  this.clear();
326
340
  this.isDestructed = true;
@@ -16,8 +16,10 @@ import { kebabCase, get, getClassName, isFunction, isVoid } from '../helpers';
16
16
  import { uniqueUid } from '../global';
17
17
  import { STATUSES } from './statuses';
18
18
 
19
- const StatusListHandlers: Map<Component, IDictionary<CallableFunction[]>> =
20
- new Map();
19
+ const StatusListHandlers: Map<
20
+ Component,
21
+ IDictionary<CallableFunction[]>
22
+ > = new Map();
21
23
 
22
24
  export abstract class Component implements IComponent {
23
25
  static STATUSES = STATUSES;
@@ -49,7 +49,7 @@ export abstract class ViewComponent<T extends IViewBased = IViewBased>
49
49
  }
50
50
 
51
51
  /** @override */
52
- destruct(): any {
52
+ override destruct(): any {
53
53
  this.j.components.delete(this);
54
54
  return super.destruct();
55
55
  }
@@ -12,7 +12,7 @@ export interface CachePropertyDescriptor<T, R> extends PropertyDescriptor {
12
12
  }
13
13
 
14
14
  export function cache<T, R>(
15
- target: any,
15
+ target: object,
16
16
  name: PropertyKey,
17
17
  descriptor: CachePropertyDescriptor<T, R>
18
18
  ): void {
@@ -25,7 +25,7 @@ const cn = (elm: ComponentCompatible): string | number => {
25
25
  */
26
26
  export function component<T extends ComponentCompatible>(
27
27
  constructorFunction: T
28
- ) {
28
+ ): T {
29
29
  class newConstructorFunction extends constructorFunction {
30
30
  constructor(...args: any[]) {
31
31
  super(...args);
@@ -8,7 +8,8 @@ import type {
8
8
  IDictionary,
9
9
  IViewBased,
10
10
  IViewComponent,
11
- IAsyncParams
11
+ IAsyncParams,
12
+ DecoratorHandler
12
13
  } from '../../types';
13
14
  import {
14
15
  error,
@@ -30,7 +31,7 @@ export function debounce<V = IViewComponent | IViewBased>(
30
31
  timeout?: number | ((ctx: V) => number | IAsyncParams) | IAsyncParams,
31
32
  firstCallImmediately: boolean = false,
32
33
  method: 'debounce' | 'throttle' = 'debounce'
33
- ) {
34
+ ): DecoratorHandler {
34
35
  return <T extends Component & IDictionary>(
35
36
  target: IDictionary,
36
37
  propertyKey: string
@@ -67,8 +68,8 @@ export function debounce<V = IViewComponent | IViewBased>(
67
68
  * @param method
68
69
  */
69
70
  export function throttle<V = IViewComponent | IViewBased>(
70
- timeout?: number | ((ctx: V) => number),
71
+ timeout?: number | ((ctx: V) => number | IAsyncParams) | IAsyncParams,
71
72
  firstCallImmediately: boolean = false
72
- ) {
73
+ ): DecoratorHandler {
73
74
  return debounce<V>(timeout, firstCallImmediately, 'throttle');
74
75
  }
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Jodit Editor (https://xdsoft.net/jodit/)
3
+ * Released under MIT see LICENSE.txt in the project root for license information.
4
+ * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import type {
7
+ DecoratorHandler,
8
+ IDictionary,
9
+ IViewBased,
10
+ IViewComponent
11
+ } from '../../types';
12
+ import { Component, STATUSES } from '../component';
13
+ import { error, isFunction, isViewObject } from '../helpers';
14
+
15
+ /**
16
+ * Wrap function in requestIdleCallback wrapper*
17
+ */
18
+ export function idle<V = IViewComponent | IViewBased>(): DecoratorHandler {
19
+ return <T extends Component & IDictionary>(
20
+ target: IDictionary,
21
+ propertyKey: string
22
+ ): void => {
23
+ if (!isFunction(target[propertyKey])) {
24
+ throw error('Handler must be a Function');
25
+ }
26
+
27
+ target.hookStatus(STATUSES.ready, (component: V) => {
28
+ const view = isViewObject(component)
29
+ ? component
30
+ : (component as unknown as IViewComponent).jodit;
31
+
32
+ const originalMethod = (component as any)[propertyKey];
33
+
34
+ (component as any)[propertyKey] = (...args: unknown[]) =>
35
+ view.async.requestIdleCallback(
36
+ originalMethod.bind(component, ...args)
37
+ );
38
+ });
39
+ };
40
+ }
@@ -7,6 +7,7 @@
7
7
  export * from './cache';
8
8
  export * from './component';
9
9
  export * from './debounce';
10
+ export * from './idle';
10
11
  export * from './hook';
11
12
  export * from './nonenumerable';
12
13
  export * from './persistent';
@@ -8,7 +8,7 @@
8
8
  * @enumerable decorator that sets the enumerable property of a class field to false.
9
9
  * @param value true|false
10
10
  */
11
- export const nonenumerable = (target: any, propertyKey: string) => {
11
+ export const nonenumerable = (target: object, propertyKey: string): void => {
12
12
  const descriptor =
13
13
  Object.getOwnPropertyDescriptor(target, propertyKey) || {};
14
14
 
@@ -11,13 +11,12 @@ import {
11
11
  isString
12
12
  } from '../helpers/checker';
13
13
  import { getClassName } from '../helpers/utils';
14
- import { type } from '../helpers';
15
14
 
16
15
  /**
17
16
  * Allow spy for the class
18
17
  * @param target
19
18
  */
20
- export const spy = function spy(target: Function) {
19
+ export const spy = function spy(target: Function): void {
21
20
  const methods = Reflect.ownKeys(target.prototype);
22
21
 
23
22
  methods.forEach(key => {
@@ -46,7 +45,7 @@ export const spy = function spy(target: Function) {
46
45
  isBoolean(a) ||
47
46
  isNumber(a)
48
47
  ? JSON.stringify(a)
49
- : `[${type(a)}]`
48
+ : {}.toString.call(a)
50
49
  )})`
51
50
  );
52
51
 
@@ -6,6 +6,7 @@
6
6
 
7
7
  import type {
8
8
  CanUndef,
9
+ DecoratorHandler,
9
10
  IComponent,
10
11
  IDictionary,
11
12
  IViewComponent
@@ -21,7 +22,7 @@ import { ObserveObject } from '../events';
21
22
  import { Component, STATUSES } from '../component';
22
23
 
23
24
  export function getPropertyDescriptor(
24
- obj: any,
25
+ obj: unknown,
25
26
  prop: string
26
27
  ): CanUndef<PropertyDescriptor> {
27
28
  let desc;
@@ -41,7 +42,7 @@ export function getPropertyDescriptor(
41
42
  export function watch(
42
43
  observeFields: string[] | string,
43
44
  context?: object | ((c: IDictionary) => object)
44
- ) {
45
+ ): DecoratorHandler {
45
46
  return <T extends Component & IDictionary>(
46
47
  target: T,
47
48
  propertyKey: string
@@ -60,6 +61,7 @@ export function watch(
60
61
  splitArray(observeFields).forEach(field => {
61
62
  if (/:/.test(field)) {
62
63
  const [objectPath, eventName] = field.split(':');
64
+
63
65
  const view = isViewObject(component)
64
66
  ? component
65
67
  : (component as unknown as IViewComponent).jodit;
@@ -73,9 +75,11 @@ export function watch(
73
75
  context = context(component);
74
76
  }
75
77
 
76
- view.events
77
- .on(context || component, eventName, callback)
78
- .on(eventName, callback);
78
+ view.events.on(context || component, eventName, callback);
79
+
80
+ if (!context) {
81
+ view.events.on(eventName, callback);
82
+ }
79
83
 
80
84
  view.hookStatus('beforeDestruct', () => {
81
85
  view.events
@@ -546,7 +546,7 @@ export class EventsNative implements IEventsNative {
546
546
  * ```
547
547
  *
548
548
  */
549
- fire(subjectOrEvents: string, eventsList?: any, ...args: any[]): any;
549
+ fire(subjectOrEvents: string, ...args: any[]): any;
550
550
  fire(
551
551
  subjectOrEvents: object,
552
552
  eventsList: string | Event,
@@ -43,7 +43,7 @@ export const pluginSystem = new PluginSystem();
43
43
  export const modules: IDictionary<Function> = {};
44
44
 
45
45
  export const lang: IDictionary<IDictionary<string>> = {};
46
- export const extendLang = (langs: IDictionary) => {
46
+ export const extendLang = (langs: IDictionary): void => {
47
47
  Object.keys(langs).forEach(key => {
48
48
  if (lang[key]) {
49
49
  Object.assign(lang[key], langs[key]);
@@ -66,7 +66,7 @@ export function getContainer<T extends HTMLTagNames = HTMLTagNames>(
66
66
  jodit: IViewBased | IViewComponent,
67
67
  classFunc: Function,
68
68
  tag: T = 'div' as T,
69
- inside: boolean = false
69
+ createInsideEditor: boolean = false
70
70
  ): HTMLElementTagNameMap[T] {
71
71
  const name = getClassName(classFunc.prototype);
72
72
 
@@ -79,7 +79,11 @@ export function getContainer<T extends HTMLTagNames = HTMLTagNames>(
79
79
  let c = view.c,
80
80
  body = jodit.od.body;
81
81
 
82
- if (inside && isJoditObject(jodit) && jodit.od !== jodit.ed) {
82
+ if (
83
+ createInsideEditor &&
84
+ isJoditObject(jodit) &&
85
+ jodit.od !== jodit.ed
86
+ ) {
83
87
  c = jodit.createInside;
84
88
  body = tag === 'style' ? jodit.ed.head : jodit.ed.body;
85
89
  }
@@ -6,7 +6,6 @@
6
6
 
7
7
  import type { IDictionary } from '../../../types';
8
8
  import { isWindow } from './is-window';
9
- import { hasOwn } from '../type';
10
9
 
11
10
  /**
12
11
  * Check if element is simple plaint object
@@ -21,6 +20,6 @@ export function isPlainObject<T>(
21
20
 
22
21
  return !(
23
22
  obj.constructor &&
24
- !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')
23
+ !{}.hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf')
25
24
  );
26
25
  }
@@ -19,7 +19,10 @@ export function isURL(str: string): boolean {
19
19
  if (typeof URL !== 'undefined') {
20
20
  try {
21
21
  const url = new URL(str);
22
- return ['https:', 'http:', 'ftp:', 'file:'].includes(url.protocol);
22
+
23
+ return ['https:', 'http:', 'ftp:', 'file:', 'rtmp:'].includes(
24
+ url.protocol
25
+ );
23
26
  } catch (e) {
24
27
  return false;
25
28
  }
@@ -39,7 +39,7 @@ export const scrollIntoViewIfNeeded = (
39
39
  elm: HTMLElement,
40
40
  root: HTMLElement,
41
41
  doc: Document
42
- ) => {
42
+ ): void => {
43
43
  if (!inView(elm, root, doc)) {
44
44
  if (root.clientHeight !== root.scrollHeight) {
45
45
  root.scrollTop = elm.offsetTop;
@@ -27,29 +27,8 @@ export function position(
27
27
  jodit?: IViewBased,
28
28
  recurse: boolean = false
29
29
  ): IBound {
30
- // let xPos = 0,
31
- // yPos = 0,
32
- // el: HTMLElement | null = elm;
33
- //
34
- // const doc: Document = elm.ownerDocument || jodit?.od || document;
35
- //
36
- // while (el) {
37
- // if (el.tagName == 'BODY') {
38
- // // deal with browser quirks with body/window/document and page scroll
39
- // const xScroll = el.scrollLeft || doc.documentElement.scrollLeft,
40
- // yScroll = el.scrollTop || doc.documentElement.scrollTop;
41
- //
42
- // xPos += el.offsetLeft - xScroll + el.clientLeft;
43
- // yPos += el.offsetTop - yScroll + el.clientTop;
44
- // } else {
45
- // // for all other non-BODY elements
46
- // xPos += el.offsetLeft - el.scrollLeft + el.clientLeft;
47
- // yPos += el.offsetTop - el.scrollTop + el.clientTop;
48
- // }
49
- //
50
- // el = el.offsetParent as HTMLElement;
51
- // }
52
30
  const rect = elm.getBoundingClientRect();
31
+
53
32
  let xPos = rect.left,
54
33
  yPos = rect.top;
55
34
 
@@ -13,14 +13,14 @@ import type { CanUndef } from '../../../types';
13
13
  * @param options
14
14
  */
15
15
  export function stringify(
16
- value: any,
16
+ value: unknown,
17
17
  options: {
18
18
  excludeKeys?: string[];
19
19
  prettify?: string;
20
20
  } = {}
21
21
  ): string {
22
22
  if (typeof value !== 'object') {
23
- return value.toString ? value.toString() : value;
23
+ return String(value);
24
24
  }
25
25
 
26
26
  const excludeKeys = new Set(options.excludeKeys);
@@ -4,50 +4,6 @@
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
 
7
- import type { IDictionary } from '../../types';
8
-
9
- const class2type: IDictionary<string> = {};
10
- const toString = class2type.toString;
11
- export const hasOwn = class2type.hasOwnProperty;
12
-
13
- [
14
- 'Boolean',
15
- 'Number',
16
- 'String',
17
- 'Function',
18
- 'Array',
19
- 'Date',
20
- 'RegExp',
21
- 'Object',
22
- 'Error',
23
- 'Symbol',
24
- 'HTMLDocument',
25
- 'Window',
26
- 'HTMLElement',
27
- 'HTMLBodyElement',
28
- 'Text',
29
- 'DocumentFragment',
30
- 'DOMStringList',
31
- 'HTMLCollection'
32
- ].forEach(name => {
33
- class2type['[object ' + name + ']'] = name.toLowerCase();
34
- });
35
-
36
- /**
37
- * Get name object's type
38
- * @param obj
39
- */
40
- export const type = (obj: any): string => {
41
- // eslint-disable-next-line eqeqeq
42
- if (obj === null) {
43
- return 'null';
44
- }
45
-
46
- return typeof obj === 'object' || typeof obj === 'function'
47
- ? class2type[toString.call(obj)] || 'object'
48
- : typeof obj;
49
- };
50
-
51
7
  /**
52
8
  * Helper for create Error object
53
9
  * @param message
@@ -181,7 +181,7 @@ export const keys = (obj: object, own: boolean = true): string[] => {
181
181
  return Object.keys(obj);
182
182
  }
183
183
 
184
- const props = [];
184
+ const props: string[] = [];
185
185
 
186
186
  for (const key in obj) {
187
187
  props.push(key);
@@ -13,6 +13,8 @@ export abstract class Plugin<T extends IViewBased = IJodit>
13
13
  extends ViewComponent<T>
14
14
  implements IPlugin<T>
15
15
  {
16
+ requires: string[] = [];
17
+
16
18
  /** @override */
17
19
  buttons: IPlugin['buttons'] = [];
18
20
 
@@ -52,7 +54,7 @@ export abstract class Plugin<T extends IViewBased = IJodit>
52
54
  }
53
55
 
54
56
  @autobind
55
- destruct(): void {
57
+ override destruct(): void {
56
58
  if (!this.isInDestruct) {
57
59
  this.setStatus(STATUSES.beforeDestruct);
58
60
 
@@ -184,7 +184,7 @@ export class UIButton extends UIElement implements IUIButton {
184
184
  }
185
185
 
186
186
  /** @override */
187
- protected createContainer(): HTMLElement {
187
+ protected override createContainer(): HTMLElement {
188
188
  const cn = this.componentName;
189
189
 
190
190
  const button = this.j.c.element('button', {
@@ -219,7 +219,7 @@ export class UIButton extends UIElement implements IUIButton {
219
219
  }
220
220
  }
221
221
 
222
- destruct(): any {
222
+ override destruct(): any {
223
223
  this.j.e.off(this.container);
224
224
  return super.destruct();
225
225
  }
@@ -18,15 +18,15 @@ import { UIButton } from '../button/button';
18
18
 
19
19
  @component
20
20
  export class UIButtonGroup extends UIGroup {
21
- elements!: IUIButton[];
21
+ override elements!: IUIButton[];
22
22
 
23
23
  /** @override */
24
- className(): string {
24
+ override className(): string {
25
25
  return 'UIButtonGroup';
26
26
  }
27
27
 
28
28
  /** @override */
29
- protected render(options: IDictionary): string {
29
+ protected override render(options: IDictionary): string {
30
30
  return `<div>
31
31
  <div class="&__label">~${options.label}~</div>
32
32
  <div class="&__options"></div>
@@ -34,7 +34,9 @@ export class UIButtonGroup extends UIGroup {
34
34
  }
35
35
 
36
36
  /** @override */
37
- protected appendChildToContainer(childContainer: HTMLElement): void {
37
+ protected override appendChildToContainer(
38
+ childContainer: HTMLElement
39
+ ): void {
38
40
  this.getElm('options').appendChild(childContainer);
39
41
  }
40
42
 
@@ -55,7 +55,7 @@ export abstract class UIElement<T extends IViewBased = IViewBased>
55
55
  }
56
56
 
57
57
  /** @override */
58
- get<T>(chain: string, obj?: IDictionary): Nullable<T> {
58
+ override get<T>(chain: string, obj?: IDictionary): Nullable<T> {
59
59
  return super.get(chain, obj) || (this.getElm(chain) as unknown as T);
60
60
  }
61
61
 
@@ -198,7 +198,7 @@ export abstract class UIElement<T extends IViewBased = IViewBased>
198
198
  }
199
199
 
200
200
  /** @override */
201
- destruct(): any {
201
+ override destruct(): any {
202
202
  Dom.safeRemove(this.container);
203
203
  this.parentElement = null;
204
204
  return super.destruct();
@@ -14,7 +14,7 @@ import { component } from '../../../decorators';
14
14
  @component
15
15
  export class UIBlock extends UIGroup {
16
16
  /** @override */
17
- className(): string {
17
+ override className(): string {
18
18
  return 'UIBlock';
19
19
  }
20
20