jodit 3.13.4 → 3.14.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 (116) hide show
  1. package/.idea/workspace.xml +170 -158
  2. package/CHANGELOG.MD +50 -5
  3. package/README.md +2 -2
  4. package/build/jodit.css +25 -18
  5. package/build/jodit.es2018.css +18 -14
  6. package/build/jodit.es2018.en.css +18 -14
  7. package/build/jodit.es2018.en.js +9160 -7960
  8. package/build/jodit.es2018.en.min.css +1 -1
  9. package/build/jodit.es2018.en.min.js +1 -1
  10. package/build/jodit.es2018.js +9149 -7944
  11. package/build/jodit.es2018.min.css +1 -1
  12. package/build/jodit.es2018.min.js +1 -1
  13. package/build/jodit.js +19550 -19348
  14. package/build/jodit.min.css +2 -2
  15. package/build/jodit.min.js +1 -1
  16. package/build/vdom.css +3012 -0
  17. package/build/vdom.es2018.css +3012 -0
  18. package/build/vdom.es2018.en.css +3012 -0
  19. package/build/vdom.es2018.en.js +14153 -0
  20. package/build/vdom.es2018.en.min.css +1 -0
  21. package/build/vdom.es2018.en.min.js +1 -0
  22. package/build/vdom.es2018.js +14153 -0
  23. package/build/vdom.es2018.min.css +1 -0
  24. package/build/vdom.es2018.min.js +1 -0
  25. package/build/vdom.js +17419 -0
  26. package/build/vdom.min.css +1 -0
  27. package/build/vdom.min.js +1 -0
  28. package/package.json +16 -16
  29. package/src/README.md +8 -7
  30. package/src/config.ts +17 -25
  31. package/src/core/component/README.md +41 -40
  32. package/src/core/create/README.md +2 -2
  33. package/src/core/decorators/cache/README.md +4 -4
  34. package/src/core/decorators/component/README.md +12 -11
  35. package/src/core/decorators/watch/README.md +22 -16
  36. package/src/core/dom/README.md +1 -1
  37. package/src/core/dom/dom.ts +1 -1
  38. package/src/core/event-emitter/README.md +13 -13
  39. package/src/core/helpers/README.md +16 -13
  40. package/src/core/helpers/utils/get.ts +9 -5
  41. package/src/core/plugin/README.md +2 -2
  42. package/src/core/plugin/plugin-system.ts +6 -0
  43. package/src/core/request/README.md +1 -1
  44. package/src/core/selection/README.md +4 -4
  45. package/src/core/ui/README.md +13 -12
  46. package/src/core/ui/button/button/button.less +2 -0
  47. package/src/core/vdom/README.md +1 -0
  48. package/src/core/vdom/helpers/index.ts +58 -0
  49. package/src/core/vdom/index.ts +14 -0
  50. package/src/core/vdom/interface.ts +61 -0
  51. package/src/core/vdom/render/index.ts +235 -0
  52. package/src/jodit.ts +2 -2
  53. package/src/langs/de.js +7 -2
  54. package/src/modules/dialog/README.md +18 -16
  55. package/src/modules/dialog/dialog.less +8 -4
  56. package/src/modules/dialog/dialog.ts +20 -8
  57. package/src/modules/image-editor/README.md +12 -0
  58. package/src/modules/image-editor/config.ts +30 -0
  59. package/src/modules/image-editor/image-editor.ts +34 -48
  60. package/src/modules/uploader/uploader.less +1 -1
  61. package/src/plugins/README.md +0 -2
  62. package/src/plugins/clipboard/config.ts +1 -1
  63. package/src/plugins/clipboard/drag-and-drop-element.ts +48 -20
  64. package/src/plugins/clipboard/paste/CHANGELOG.md +8 -8
  65. package/src/plugins/clipboard/paste/README.md +3 -2
  66. package/src/plugins/format-block/CHANGELOG.md +8 -8
  67. package/src/plugins/format-block/README.md +10 -10
  68. package/src/plugins/iframe/config.ts +169 -0
  69. package/src/plugins/iframe/iframe.ts +1 -145
  70. package/src/plugins/image/image-processor.ts +12 -16
  71. package/src/plugins/image/image-properties/config.ts +109 -0
  72. package/src/plugins/image/image-properties/image-properties.ts +2 -99
  73. package/src/plugins/inline-popup/inline-popup.ts +10 -8
  74. package/src/plugins/keyboard/tab/tab.ts +1 -1
  75. package/src/plugins/line-height/README.md +7 -7
  76. package/src/plugins/line-height/line-height.ts +1 -1
  77. package/src/plugins/mobile/config.ts +89 -0
  78. package/src/plugins/mobile/mobile.ts +11 -85
  79. package/src/plugins/print/helpers.ts +172 -0
  80. package/src/plugins/print/preview.ts +6 -94
  81. package/src/plugins/resizer/config.ts +54 -0
  82. package/src/plugins/resizer/resizer.less +4 -4
  83. package/src/plugins/resizer/resizer.ts +7 -50
  84. package/src/plugins/source/README.md +21 -23
  85. package/src/plugins/table/select-cells.ts +1 -1
  86. package/src/styles/icons/README.md +19 -13
  87. package/src/styles/jodit.less +4 -0
  88. package/src/types/events.d.ts +1 -4
  89. package/src/types/jodit.d.ts +1 -4
  90. package/src/types/observer.d.ts +6 -1
  91. package/src/types/ui.d.ts +7 -3
  92. package/src/types/uploader.d.ts +1 -1
  93. package/src/types/view.d.ts +13 -13
  94. package/tsdoc.json +5 -0
  95. package/types/config.d.ts +0 -13
  96. package/types/core/dom/dom.d.ts +1 -1
  97. package/types/modules/image-editor/config.d.ts +11 -0
  98. package/types/modules/image-editor/image-editor.d.ts +25 -20
  99. package/types/plugins/clipboard/drag-and-drop-element.d.ts +1 -1
  100. package/types/plugins/iframe/config.d.ts +82 -0
  101. package/types/plugins/iframe/iframe.d.ts +1 -11
  102. package/types/plugins/image/image-properties/config.d.ts +70 -0
  103. package/types/plugins/image/image-properties/image-properties.d.ts +1 -77
  104. package/types/plugins/inline-popup/inline-popup.d.ts +1 -0
  105. package/types/plugins/keyboard/tab/tab.d.ts +1 -1
  106. package/types/plugins/mobile/config.d.ts +18 -0
  107. package/types/plugins/mobile/mobile.d.ts +1 -12
  108. package/types/plugins/print/helpers.d.ts +16 -0
  109. package/types/plugins/resizer/config.d.ts +36 -0
  110. package/types/plugins/resizer/resizer.d.ts +1 -31
  111. package/types/types/events.d.ts +1 -4
  112. package/types/types/jodit.d.ts +1 -4
  113. package/types/types/observer.d.ts +6 -1
  114. package/types/types/ui.d.ts +7 -3
  115. package/types/types/uploader.d.ts +1 -1
  116. package/types/types/view.d.ts +13 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jodit",
3
- "version": "3.13.4",
3
+ "version": "3.14.2",
4
4
  "description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
5
5
  "main": "build/jodit.min.js",
6
6
  "types": "./types/index.d.ts",
@@ -57,32 +57,32 @@
57
57
  "homepage": "https://xdsoft.net/jodit/",
58
58
  "dependencies": {
59
59
  "autobind-decorator": "^2.4.0",
60
- "core-js": "^3.21.0"
60
+ "core-js": "^3.21.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/ace": "^0.0.48",
64
- "@types/node": "^17.0.15",
65
- "@typescript-eslint/eslint-plugin": "^5.10.2",
66
- "@typescript-eslint/parser": "^5.10.2",
64
+ "@types/node": "^17.0.18",
65
+ "@typescript-eslint/eslint-plugin": "^5.12.0",
66
+ "@typescript-eslint/parser": "^5.12.0",
67
67
  "autoprefixer": "^10.4.2",
68
- "axios": "^0.25.0",
68
+ "axios": "^0.26.0",
69
69
  "chai": "^4.3.6",
70
70
  "classlist-polyfill": "^1.2.0",
71
71
  "compression": "^1.7.4",
72
72
  "cross-env": "^7.0.3",
73
73
  "css-loader": "^6.6.0",
74
74
  "css-minimizer-webpack-plugin": "^3.4.1",
75
- "cssnano-preset-advanced": "^5.1.11",
75
+ "cssnano-preset-advanced": "^5.1.12",
76
76
  "es6-promise": "^4.2.8",
77
- "eslint": "^8.8.0",
78
- "eslint-config-prettier": "^8.3.0",
77
+ "eslint": "^8.9.0",
78
+ "eslint-config-prettier": "^8.4.0",
79
79
  "eslint-plugin-header": "^3.1.1",
80
80
  "eslint-plugin-prettier": "^4.0.0",
81
81
  "eslint-plugin-tsdoc": "^0.2.14",
82
- "express": "^4.17.2",
82
+ "express": "^4.17.3",
83
83
  "file-loader": "^6.2.0",
84
84
  "husky": "^7.0.4",
85
- "karma": "^6.3.15",
85
+ "karma": "^6.3.16",
86
86
  "karma-chai": "^0.1.0",
87
87
  "karma-chrome-launcher": "^3.1.0",
88
88
  "karma-firefox-launcher": "^2.1.2",
@@ -91,10 +91,10 @@
91
91
  "karma-webpack": "^5.0.0",
92
92
  "less": "^4.1.2",
93
93
  "less-loader": "^10.2.0",
94
- "lint-staged": "^12.3.3",
94
+ "lint-staged": "^12.3.4",
95
95
  "merge-stream": "^2.0.0",
96
96
  "mini-css-extract-plugin": "^2.5.3",
97
- "mocha": "^9.2.0",
97
+ "mocha": "^9.2.1",
98
98
  "open": "^8.4.0",
99
99
  "postcss": ">=8.4.6",
100
100
  "postcss-css-variables": "^0.18.0",
@@ -103,10 +103,10 @@
103
103
  "prettier": "^2.5.1",
104
104
  "raw-loader": "^4.0.2",
105
105
  "style-loader": "^3.3.1",
106
- "stylelint": "^14.3.0",
106
+ "stylelint": "^14.5.1",
107
107
  "stylelint-config-idiomatic-order": "v8.1.0",
108
108
  "stylelint-config-prettier": "^9.0.3",
109
- "stylelint-config-standard": "^24.0.0",
109
+ "stylelint-config-standard": "^25.0.0",
110
110
  "stylelint-prettier": "^2.0.0",
111
111
  "synchronous-promise": "^2.0.15",
112
112
  "terser-webpack-plugin": "^5.3.1",
@@ -115,7 +115,7 @@
115
115
  "tslib": "^2.3.1",
116
116
  "typescript": "^4.5.5",
117
117
  "url-loader": "^4.1.1",
118
- "webpack": "^5.68.0",
118
+ "webpack": "^5.69.1",
119
119
  "webpack-cli": "^4.9.2",
120
120
  "webpack-dev-middleware": "^5.3.1",
121
121
  "webpack-dev-server": "^4.7.4",
package/src/README.md CHANGED
@@ -6,6 +6,7 @@ The editor is initialized on a DOM element. It must already exist on the page:
6
6
  ```js
7
7
  Jodit.make('#editor');
8
8
  ```
9
+
9
10
  You can also set a DOM element right away.
10
11
 
11
12
  ```js
@@ -17,14 +18,14 @@ The [[Jodit.make]] method returns an instance of [[Jodit]].
17
18
 
18
19
  ```js
19
20
  const jodit = Jodit.make('#editor');
20
- console.log(jodit.isReady)
21
+ console.log(jodit.isReady);
21
22
  ```
22
23
 
23
24
  This is almost equivalent to
24
25
 
25
26
  ```js
26
27
  const jodit = new Jodit('#editor');
27
- console.log(jodit.isReady)
28
+ console.log(jodit.isReady);
28
29
  ```
29
30
 
30
31
  > But the `make` method is preferable.
@@ -41,15 +42,15 @@ Jodit instance has a module [[EventEmitter]]
41
42
 
42
43
  ```js
43
44
  const jodit = Jodit.make('#editor');
44
- jodit.events.on('keydown', (e) => {
45
- console.log(e.key)
46
- })
45
+ jodit.events.on('keydown', e => {
46
+ console.log(e.key);
47
+ });
47
48
  ```
48
49
 
49
50
  And the [[Select]] module, which allows you to manipulate the content of the editor through HTML insertion
50
51
 
51
52
  ```js
52
53
  const jodit = Jodit.make('#editor');
53
- jodit.s.focus()
54
- jodit.s.insertHTML('<p>test</p>')
54
+ jodit.s.focus();
55
+ jodit.s.insertHTML('<p>test</p>');
55
56
  ```
package/src/config.ts CHANGED
@@ -46,20 +46,6 @@ export class Config implements IViewOptions {
46
46
  */
47
47
  safePluginsList: string[] = ['about', 'enter', 'backspace'];
48
48
 
49
- /**
50
- * When this option is enabled, the editor's content will be placed in an iframe and isolated from the rest of the page.
51
- *
52
- * @example
53
- * ```javascript
54
- * new Jodit('#editor', {
55
- * iframe = true;
56
- * iframeStyle = 'html{margin: 0px;}body{padding:10px;background:transparent;color:#000;position:relative;z-index:2;\
57
- * user-select:auto;margin:0px;overflow:hidden;}body:after{content:"";clear:both;display:block}';
58
- * });
59
- * ```
60
- */
61
- iframe: boolean = false;
62
-
63
49
  commandToHotkeys!: IDictionary<string | string[]>;
64
50
 
65
51
  license: string = '';
@@ -653,18 +639,10 @@ export class Config implements IViewOptions {
653
639
  group: 'list',
654
640
  buttons: []
655
641
  },
656
- {
657
- group: 'indent',
658
- buttons: []
659
- },
660
642
  {
661
643
  group: 'font',
662
644
  buttons: []
663
645
  },
664
- {
665
- group: 'color',
666
- buttons: []
667
- },
668
646
  '---',
669
647
  {
670
648
  group: 'script',
@@ -687,6 +665,14 @@ export class Config implements IViewOptions {
687
665
  group: 'insert',
688
666
  buttons: []
689
667
  },
668
+ {
669
+ group: 'indent',
670
+ buttons: []
671
+ },
672
+ {
673
+ group: 'color',
674
+ buttons: []
675
+ },
690
676
  {
691
677
  group: 'form',
692
678
  buttons: []
@@ -727,15 +713,16 @@ export class Config implements IViewOptions {
727
713
  '|',
728
714
  'font',
729
715
  'fontsize',
730
- 'brush',
731
- 'paragraph',
732
- 'align',
733
716
  '---',
734
717
  'image',
735
718
  'table',
736
719
  '|',
737
720
  'link',
738
721
  '\n',
722
+ 'brush',
723
+ 'paragraph',
724
+ 'align',
725
+ '|',
739
726
  'hr',
740
727
  'copyformat',
741
728
  'fullsize',
@@ -785,12 +772,17 @@ export class Config implements IViewOptions {
785
772
  'brush',
786
773
  'paragraph',
787
774
  'eraser',
775
+ '|',
776
+ 'fontsize',
788
777
  '---',
789
778
  'image',
790
779
  '\n',
791
780
  'align',
792
781
  'undo',
793
782
  'redo',
783
+ '|',
784
+ 'link',
785
+ 'table',
794
786
  '---',
795
787
  'dots'
796
788
  ];
@@ -4,90 +4,91 @@ Such elements have a name
4
4
 
5
5
  ```js
6
6
  const jodit = Jodit.male('#editor');
7
- console.log(jodit.componentName)
8
- console.log(jodit.statusbar.componentName)
9
- console.log(jodit.filebrowser.componentName)
10
- console.log(jodit.uploader.componentName)
7
+ console.log(jodit.componentName);
8
+ console.log(jodit.statusbar.componentName);
9
+ console.log(jodit.filebrowser.componentName);
10
+ console.log(jodit.uploader.componentName);
11
11
  ```
12
12
 
13
13
  And also each component has its current [[STATUSES | status]]:
14
14
 
15
15
  ```js
16
16
  const jodit = Jodit.male('#editor');
17
- console.log(jodit.componentStatus)
17
+ console.log(jodit.componentStatus);
18
18
  ```
19
19
 
20
20
  You can work on changes in the status of a component through the decorator [[decorators/hook]]
21
21
  either through the method [[Component.hookStatus]]
22
22
 
23
23
  ```ts
24
- import { Component } from 'jodit/src/core/component'
24
+ import { Component } from 'jodit/src/core/component';
25
25
 
26
26
  export class SomeComponent extends Component {}
27
27
  const cmp = new SomeComponent();
28
28
 
29
29
  cmp.hookStatus('ready', () => {
30
- console.log('Hello world on ready = )')
31
- })
30
+ console.log('Hello world on ready = )');
31
+ });
32
32
  ```
33
33
 
34
34
  To set the status, it is enough to call the method [[Component.setStatus]]
35
35
 
36
36
  ```ts
37
- import { Component } from 'jodit/src/core/component'
37
+ import { Component } from 'jodit/src/core/component';
38
38
 
39
39
  export class SomeComponent extends Component {}
40
40
  const cmp = new SomeComponent();
41
- cmp.setStatus('ready')
41
+ cmp.setStatus('ready');
42
42
  ```
43
43
 
44
44
  The component itself can automatically set the ready status:
45
45
 
46
46
  ```ts
47
- import type { IJodit } from 'jodit/src/types'
48
- import { Component } from 'jodit/src/core/component'
47
+ import type { IJodit } from 'jodit/src/types';
48
+ import { Component } from 'jodit/src/core/component';
49
49
 
50
50
  export class SomeComponent extends Component {
51
- constructor(jodit: IJodit) {
52
- super(jodit);
53
- cmp.setStatus('ready')
54
- }
51
+ constructor(jodit: IJodit) {
52
+ super(jodit);
53
+ cmp.setStatus('ready');
54
+ }
55
55
  }
56
56
 
57
57
  const cmp = new SomeComponent();
58
- console.log(cmp.isReady)
58
+ console.log(cmp.isReady);
59
59
  ```
60
+
60
61
  But it’s better not to do this, because with inheritance, such a component will be “ready” ahead of time:
61
62
 
62
63
  ```ts
63
- import type { IJodit, IStatusBar } from 'jodit/src/types'
64
- import { Component } from 'jodit/src/core/component'
64
+ import type { IJodit, IStatusBar } from 'jodit/src/types';
65
+ import { Component } from 'jodit/src/core/component';
65
66
  import { StatusBar } from 'jodit/src/modules';
66
67
 
67
68
  export class SomeComponent extends Component {
68
- constructor(jodit: IJodit) {
69
- super(jodit);
70
- cmp.setStatus('ready')
71
- }
69
+ constructor(jodit: IJodit) {
70
+ super(jodit);
71
+ cmp.setStatus('ready');
72
+ }
72
73
  }
73
74
 
74
75
  export class SomeAnotherComponent extends SomeComponent {
75
- public status: IStatusBar;
76
-
77
- constructor(jodit: IJodit) {
78
- super(jodit);
79
- console.log(this.isReady) // true
80
- // Errors are possible here, since the status of the component is already 'ready' but you have not yet initialized its fields
81
- this.status = new StatusBar(jodit)
82
- }
76
+ public status: IStatusBar;
77
+
78
+ constructor(jodit: IJodit) {
79
+ super(jodit);
80
+ console.log(this.isReady); // true
81
+ // Errors are possible here, since the status of the component is already 'ready' but you have not yet initialized its fields
82
+ this.status = new StatusBar(jodit);
83
+ }
83
84
  }
84
85
  ```
85
86
 
86
87
  Therefore, it is better to use a decorator [[core/decorators/component]]
87
88
 
88
89
  ```ts
89
- import type { IJodit, IStatusBar } from 'jodit/src/types'
90
- import { Component } from 'jodit/src/core/component'
90
+ import type { IJodit, IStatusBar } from 'jodit/src/types';
91
+ import { Component } from 'jodit/src/core/component';
91
92
  import { StatusBar } from 'jodit/src/modules';
92
93
  import { component } from 'jodit/src/core/decorators';
93
94
 
@@ -96,15 +97,15 @@ export class SomeComponent extends Component {}
96
97
 
97
98
  @component()
98
99
  export class SomeAnotherComponent extends SomeComponent {
99
- public status: IStatusBar;
100
+ public status: IStatusBar;
100
101
 
101
- constructor(jodit: IJodit) {
102
- super(jodit);
103
- console.log(this.isReady) // false
104
- this.status = new StatusBar(jodit)
105
- }
102
+ constructor(jodit: IJodit) {
103
+ super(jodit);
104
+ console.log(this.isReady); // false
105
+ this.status = new StatusBar(jodit);
106
+ }
106
107
  }
107
108
 
108
109
  const cmp = new SomeAnotherComponent();
109
- console.log(cmp.isReady) // true
110
+ console.log(cmp.isReady); // true
110
111
  ```
@@ -43,10 +43,10 @@ const jodit = Jodit.make('#editor', {
43
43
  });
44
44
 
45
45
  const p = jodit.createInside.element('p');
46
- console.log(p.style.cssText) // color: red
46
+ console.log(p.style.cssText); // color: red
47
47
 
48
48
  const a = jodit.createInside.element('a');
49
- console.log(a.title) // Some title
49
+ console.log(a.title); // Some title
50
50
  ```
51
51
 
52
52
  To create DOM elements from text, you should also use this module:
@@ -3,10 +3,10 @@ The decorator allows you to cache the result of executing any method of the UI c
3
3
  ```typescript
4
4
  @component()
5
5
  class UIComponent extends UIElement {
6
- @cache()
7
- someHeavyMethod(param1, param2) {
8
- return someHeaveCalculation(param1, param2);
9
- }
6
+ @cache()
7
+ someHeavyMethod(param1, param2) {
8
+ return someHeaveCalculation(param1, param2);
9
+ }
10
10
  }
11
11
 
12
12
  const elm = new UIComponent(jodit);
@@ -7,11 +7,11 @@ All other decorators start their work only when the component is ready to work.
7
7
  class UIHeight extends UIElement {
8
8
  public state = {
9
9
  height: 10
10
- }
10
+ };
11
11
 
12
12
  @watch('state.height')
13
13
  protected onChangeHeight() {
14
- this.container.style.height = this.state.height + 'px'
14
+ this.container.style.height = this.state.height + 'px';
15
15
  }
16
16
  }
17
17
 
@@ -20,16 +20,16 @@ class UIWidth extends UIHeight {
20
20
  public state = {
21
21
  height: 10,
22
22
  width: 10
23
- }
23
+ };
24
24
 
25
25
  @watch('state.width')
26
26
  protected onChangeWidth() {
27
- this.container.style.width = this.state.width + 'px'
27
+ this.container.style.width = this.state.width + 'px';
28
28
  }
29
29
 
30
30
  constructor(jodit: IJodit) {
31
31
  super(jodit);
32
- console.log(this.componentStatus) // beforeReady
32
+ console.log(this.componentStatus); // beforeReady
33
33
  }
34
34
  }
35
35
 
@@ -39,11 +39,12 @@ elm.state.width = 100;
39
39
  ```
40
40
 
41
41
  You can choose not to use a decorator when you need to independently manage the readiness of a component to work.
42
+
42
43
  ```ts
43
44
  class UIData extends UIElement {
44
45
  public state = {
45
- data: {},
46
- }
46
+ data: {}
47
+ };
47
48
 
48
49
  @watch('state.data')
49
50
  protected onChangeWidth() {
@@ -52,14 +53,14 @@ class UIData extends UIElement {
52
53
 
53
54
  @hook('ready')
54
55
  protected onReady() {
55
- alert("I'm ready")
56
+ alert("I'm ready");
56
57
  }
57
58
  }
58
59
 
59
60
  const elm = new UIData(jodit);
60
61
 
61
- fetch('index.php').then((resp) => {
62
+ fetch('index.php').then(resp => {
62
63
  elm.state.data = resp.json();
63
- elm.setStatus('ready')
64
- })
64
+ elm.setStatus('ready');
65
+ });
65
66
  ```
@@ -11,18 +11,18 @@ import { UIElement } from 'jodit/src/ui';
11
11
  class UISomeReactElement extends UIElement {
12
12
  state = {
13
13
  color: 'red'
14
- }
14
+ };
15
15
 
16
16
  render(): string {
17
17
  return `<div>
18
18
  This text must be colored
19
- </div>`
19
+ </div>`;
20
20
  }
21
21
 
22
22
  @hook('ready')
23
23
  @watch('state.color')
24
24
  onChangeColor(): void {
25
- this.container.style.color = this.state.color;
25
+ this.container.style.color = this.state.color;
26
26
  }
27
27
  }
28
28
 
@@ -33,9 +33,10 @@ elm.state.color = 'yellow';
33
33
  The decorator can also be used to hang event handlers [[EventEmitter]]
34
34
 
35
35
  Then the call signature has its own syntax:
36
- - `:{EVENT}`
37
- - `{CONTEXT}:{EVENT}`
38
- - `{CONTEXT}:{EVENT.NAMESPACE}`
36
+
37
+ - `:{EVENT}`
38
+ - `{CONTEXT}:{EVENT}`
39
+ - `{CONTEXT}:{EVENT.NAMESPACE}`
39
40
 
40
41
  For example, this is how you can hang a click handler on the component container:
41
42
 
@@ -44,10 +45,10 @@ For example, this is how you can hang a click handler on the component container
44
45
  class UIButtonElement extends UIElement {
45
46
  state = {
46
47
  counter: 0
47
- }
48
+ };
48
49
 
49
50
  render(): string {
50
- return `<button>text</button>`
51
+ return `<button>text</button>`;
51
52
  }
52
53
 
53
54
  @watch('container:click') // Same this.j.e(this.container, 'click', this.onClick.bind(this))
@@ -57,7 +58,7 @@ class UIButtonElement extends UIElement {
57
58
 
58
59
  @watch('state.counter')
59
60
  onClick(): void {
60
- this.container.innerText = `Clicked ` + this.state.counter
61
+ this.container.innerText = `Clicked ` + this.state.counter;
61
62
  }
62
63
  }
63
64
  ```
@@ -69,13 +70,13 @@ The context can be specified as a path to an object, and even as the name of a B
69
70
  class UICard extends UIElement {
70
71
  state = {
71
72
  counter: 0
72
- }
73
+ };
73
74
 
74
75
  render(): string {
75
76
  return `<div>
76
77
  Clicked <span class="&__counter"></span>
77
78
  <button class="&__card-button">Click</button>
78
- </div>`
79
+ </div>`;
79
80
  }
80
81
 
81
82
  @watch('card-button:click') // As this.j.e.on(this.getElm('card-button'), 'click', this.onClick.bind(this))
@@ -85,17 +86,17 @@ class UICard extends UIElement {
85
86
 
86
87
  @watch('jodit.editor:focus') // As this.j.e.on(this.j.editor, 'focus', this.onJoditEditorFocus.bind(this))
87
88
  onJoditEditorFocus(): void {
88
- alert('Focused')
89
+ alert('Focused');
89
90
  }
90
91
 
91
92
  @watch(':afterSetMode') // As this.j.e.on('afterSetMode', this.onAfterSetMode.bind(this))
92
93
  onAfterSetMode(): void {
93
- alert(this.jodit.mode)
94
+ alert(this.jodit.mode);
94
95
  }
95
96
 
96
97
  @watch('state.counter')
97
98
  onClick(): void {
98
- this.getElm('counter').innerText = this.state.counter
99
+ this.getElm('counter').innerText = this.state.counter;
99
100
  }
100
101
  }
101
102
  ```
@@ -106,7 +107,7 @@ or by setting the function as the second parameter that will return the context
106
107
  ```ts
107
108
  @component()
108
109
  class UICardExt extends UICard {
109
- @watch(':click', (ctx) => ctx.getElm('card-button')) // As this.j.e.on(this.getElm('card-button'), 'click', this.onClick.bind(this))
110
+ @watch(':click', ctx => ctx.getElm('card-button')) // As this.j.e.on(this.getElm('card-button'), 'click', this.onClick.bind(this))
110
111
  onClick(): void {
111
112
  this.state.counter++;
112
113
  }
@@ -114,10 +115,15 @@ class UICardExt extends UICard {
114
115
  ```
115
116
 
116
117
  The first argument can be an array:
118
+
117
119
  ```ts
118
120
  @component()
119
121
  class UICardExt extends UICard {
120
- @watch(['card-button:click','card-button:mouseup','card-button:mousedown'])
122
+ @watch([
123
+ 'card-button:click',
124
+ 'card-button:mouseup',
125
+ 'card-button:mousedown'
126
+ ])
121
127
  onMouseEvents(e): void {
122
128
  e.preventDefault();
123
129
  }
@@ -2,7 +2,7 @@ A module for working with the DOM. All of its methods are static.
2
2
  For example, you can insert an element in front of another element:
3
3
 
4
4
  ```js
5
- import { Dom } from "jodit/src/core/dom";
5
+ import { Dom } from 'jodit/src/core/dom';
6
6
 
7
7
  const elm = document.getElementById('root');
8
8
  const div = document.createElement('div');
@@ -155,7 +155,7 @@ export class Dom {
155
155
  }
156
156
 
157
157
  /**
158
- * Call function for all nodes between `start` and `end`
158
+ * Call functions for all nodes between `start` and `end`
159
159
  */
160
160
  static between(
161
161
  start: Node,
@@ -2,9 +2,9 @@ This is the heart of Jodit. All processes inside Jodit mostly flow through event
2
2
 
3
3
  ```js
4
4
  const jodit = Jodit.make('#editor');
5
- jodit.e.on('someEvent', (param) => alert(`Some event fired for ${param}!!!`));
5
+ jodit.e.on('someEvent', param => alert(`Some event fired for ${param}!!!`));
6
6
  jodit.async.setTimeout(() => {
7
- jodit.e.fire('someEvent', 'you');
7
+ jodit.e.fire('someEvent', 'you');
8
8
  }, 1000);
9
9
  ```
10
10
 
@@ -18,22 +18,22 @@ If you don't want to listen to the event anymore, you can unsubscribe from it:
18
18
 
19
19
  ```js
20
20
  jodit.e
21
- .one('someEvent', (param) => alert(`Some event fired for ${param}!!!`))
22
- .one('someEvent', (param) => alert(`Some event fired for ${param}!!!`))
23
- .one('someEvent', (param) => alert(`Some event fired for ${param}!!!`));
21
+ .one('someEvent', param => alert(`Some event fired for ${param}!!!`))
22
+ .one('someEvent', param => alert(`Some event fired for ${param}!!!`))
23
+ .one('someEvent', param => alert(`Some event fired for ${param}!!!`));
24
24
 
25
- jodit.e.off('someEvent') // will unsubscribe from all handlers
25
+ jodit.e.off('someEvent'); // will unsubscribe from all handlers
26
26
  ```
27
27
 
28
28
  ```js
29
- const handler1 = (param) => alert(`Some event fired for ${param}!!!`);
30
- const handler2 = (param) => alert(`Some event fired for ${param}!!!`);
31
- const handler3 = (param) => alert(`Some event fired for ${param}!!!`);
29
+ const handler1 = param => alert(`Some event fired for ${param}!!!`);
30
+ const handler2 = param => alert(`Some event fired for ${param}!!!`);
31
+ const handler3 = param => alert(`Some event fired for ${param}!!!`);
32
32
 
33
33
  jodit.e
34
- .one('someEvent', handler1)
35
- .one('someEvent', handler2)
36
- .one('someEvent', handler3);
34
+ .one('someEvent', handler1)
35
+ .one('someEvent', handler2)
36
+ .one('someEvent', handler3);
37
37
 
38
- jodit.e.off('someEvent', handler1) // only handler1 will unsubscribe
38
+ jodit.e.off('someEvent', handler1); // only handler1 will unsubscribe
39
39
  ```