jodit 3.9.3 → 3.10.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 (214) hide show
  1. package/.idea/workspace.xml +306 -295
  2. package/CHANGELOG.MD +349 -119
  3. package/build/jodit.css +675 -538
  4. package/build/jodit.es2018.css +536 -436
  5. package/build/jodit.es2018.en.css +536 -436
  6. package/build/jodit.es2018.en.js +1529 -738
  7. package/build/jodit.es2018.en.min.css +1 -1
  8. package/build/jodit.es2018.en.min.js +1 -1
  9. package/build/jodit.es2018.js +1533 -742
  10. package/build/jodit.es2018.min.css +1 -1
  11. package/build/jodit.es2018.min.js +1 -1
  12. package/build/jodit.js +2598 -1680
  13. package/build/jodit.min.css +2 -2
  14. package/build/jodit.min.js +1 -1
  15. package/index.d.ts +10 -0
  16. package/package.json +10 -10
  17. package/src/config.ts +19 -20
  18. package/src/core/component/component.ts +16 -15
  19. package/src/core/component/statuses.ts +6 -6
  20. package/src/core/dom.ts +16 -4
  21. package/src/core/events/event-emitter.ts +4 -2
  22. package/src/core/global.ts +13 -2
  23. package/src/core/helpers/append-script.ts +14 -0
  24. package/src/core/helpers/selector.ts +8 -3
  25. package/src/core/helpers/size/index.ts +1 -0
  26. package/src/core/helpers/size/object-size.ts +22 -0
  27. package/src/core/selection/select.ts +1 -0
  28. package/src/core/selection/style/api/{get-closest-wrapper.ts → extract.ts} +26 -43
  29. package/src/core/selection/style/api/finite-state-machine.ts +66 -0
  30. package/src/core/selection/style/api/index.ts +12 -5
  31. package/src/core/selection/style/api/{check-special-elements.ts → is-inside-invisible-element.ts} +1 -1
  32. package/src/core/selection/style/api/is-suit-element.ts +12 -1
  33. package/src/core/selection/style/api/toggle/toggle-css.ts +134 -0
  34. package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +49 -0
  35. package/src/core/selection/style/api/toggle-commit-styles.ts +27 -0
  36. package/src/core/selection/style/api/wrap-and-commit-style.ts +68 -0
  37. package/src/core/selection/style/api/wrap-ordered-list.ts +37 -0
  38. package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -4
  39. package/src/core/selection/style/apply-style.ts +161 -97
  40. package/src/core/selection/style/commit-style.ts +13 -0
  41. package/src/core/storage/engines/local-storage-provider.ts +9 -3
  42. package/src/core/storage/engines/memory-storage-provider.ts +6 -3
  43. package/src/core/storage/storage.ts +7 -4
  44. package/src/core/ui/button/button/button.less +10 -8
  45. package/src/core/ui/button/button/button.ts +9 -9
  46. package/src/core/ui/button/group/group.ts +2 -2
  47. package/src/core/ui/element.ts +4 -3
  48. package/src/core/ui/form/block/block.ts +1 -1
  49. package/src/core/ui/form/form.ts +8 -0
  50. package/src/core/ui/form/inputs/area/area.less +5 -0
  51. package/src/core/ui/form/inputs/area/area.ts +22 -1
  52. package/src/core/ui/form/inputs/checkbox/checkbox.less +50 -0
  53. package/src/core/ui/form/inputs/checkbox/checkbox.ts +48 -4
  54. package/src/core/ui/form/inputs/input/input.less +1 -1
  55. package/src/core/ui/form/inputs/input/input.ts +14 -4
  56. package/src/core/ui/helpers/buttons.ts +14 -6
  57. package/src/core/ui/icon.ts +3 -1
  58. package/src/core/ui/index.ts +1 -3
  59. package/src/core/ui/list/group.less +8 -2
  60. package/src/core/ui/list/group.ts +2 -2
  61. package/src/{modules/file-browser/consts.ts → core/ui/list/index.ts} +4 -4
  62. package/src/core/ui/list/list.less +10 -1
  63. package/src/core/ui/list/list.ts +20 -3
  64. package/src/core/ui/{separator.ts → list/separator.ts} +2 -2
  65. package/src/core/ui/list/spacer.ts +15 -0
  66. package/src/core/ui/popup/popup.less +5 -3
  67. package/src/core/ui/popup/popup.ts +53 -1
  68. package/src/core/view/view-with-toolbar.ts +6 -1
  69. package/src/jodit.ts +17 -14
  70. package/src/modules/dialog/dialog.less +1 -16
  71. package/src/modules/dialog/dialog.ts +10 -3
  72. package/src/modules/file-browser/builders/context-menu.ts +29 -22
  73. package/src/modules/file-browser/config.ts +10 -2
  74. package/src/modules/file-browser/file-browser.ts +50 -29
  75. package/src/modules/file-browser/listeners/native-listeners.ts +37 -19
  76. package/src/modules/file-browser/listeners/state-listeners.ts +48 -22
  77. package/src/modules/file-browser/styles/file-browser.less +4 -291
  78. package/src/modules/file-browser/styles/preview.less +11 -8
  79. package/src/modules/file-browser/ui/files/files.less +174 -0
  80. package/src/modules/file-browser/ui/files/files.ts +14 -0
  81. package/src/modules/file-browser/ui/index.ts +8 -0
  82. package/src/modules/file-browser/ui/tree/tree.less +118 -0
  83. package/src/modules/file-browser/ui/tree/tree.ts +14 -0
  84. package/src/modules/status-bar/status-bar.less +27 -1
  85. package/src/modules/status-bar/status-bar.ts +15 -1
  86. package/src/modules/toolbar/collection/collection.ts +17 -8
  87. package/src/modules/toolbar/collection/editor-collection.ts +27 -2
  88. package/src/modules/widget/file-selector/file-selector.ts +1 -1
  89. package/src/modules/widget/tabs/tabs.less +2 -1
  90. package/src/modules/widget/tabs/tabs.ts +5 -3
  91. package/src/plugins/add-new-line/add-new-line.ts +1 -0
  92. package/src/plugins/bold.ts +2 -2
  93. package/src/plugins/clipboard/drag-and-drop.ts +4 -1
  94. package/src/plugins/clipboard/paste/paste.ts +1 -1
  95. package/src/plugins/font.ts +11 -1
  96. package/src/plugins/image/image-properties/image-properties.ts +7 -0
  97. package/src/plugins/index.ts +1 -0
  98. package/src/plugins/inline-popup/config/config.ts +1 -0
  99. package/src/plugins/inline-popup/config/items/toolbar.ts +33 -0
  100. package/src/plugins/inline-popup/inline-popup.ts +17 -0
  101. package/src/plugins/keyboard/delete.ts +30 -8
  102. package/src/plugins/link/template.ts +2 -2
  103. package/src/plugins/mobile.ts +10 -14
  104. package/src/plugins/ordered-list.ts +40 -1
  105. package/src/plugins/powered-by-jodit.ts +39 -0
  106. package/src/plugins/print/preview.ts +103 -48
  107. package/src/plugins/resizer/resizer.less +10 -7
  108. package/src/plugins/resizer/resizer.ts +12 -14
  109. package/src/plugins/size/resize-handler.ts +4 -1
  110. package/src/plugins/size/size.less +2 -19
  111. package/src/plugins/size/size.ts +6 -1
  112. package/src/plugins/source/const.ts +7 -0
  113. package/src/plugins/source/editor/engines/ace.ts +5 -0
  114. package/src/plugins/source/source.ts +33 -7
  115. package/src/plugins/sticky/sticky.ts +2 -0
  116. package/src/styles/icons/index.ts +2 -0
  117. package/src/styles/icons/resize-handler.svg +4 -0
  118. package/src/styles/jodit.less +6 -0
  119. package/src/styles/mixins.less +20 -0
  120. package/src/styles/themes/dark.less +11 -1
  121. package/src/types/ajax.d.ts +0 -1
  122. package/src/types/file-browser.d.ts +13 -1
  123. package/src/types/jodit.d.ts +4 -1
  124. package/src/types/popup.d.ts +1 -0
  125. package/src/types/select.d.ts +2 -0
  126. package/src/types/storage.ts +3 -3
  127. package/src/types/style.d.ts +8 -0
  128. package/src/types/toolbar.d.ts +9 -2
  129. package/src/types/types.d.ts +1 -1
  130. package/src/types/ui.d.ts +23 -4
  131. package/src/types/view.d.ts +1 -0
  132. package/types/core/component/component.d.ts +10 -5
  133. package/types/core/component/statuses.d.ts +6 -6
  134. package/types/core/dom.d.ts +3 -2
  135. package/types/core/helpers/append-script.d.ts +1 -0
  136. package/types/core/helpers/selector.d.ts +2 -3
  137. package/types/core/helpers/size/index.d.ts +1 -0
  138. package/types/core/helpers/size/object-size.d.ts +7 -0
  139. package/types/core/selection/style/api/{get-closest-wrapper.d.ts → extract.d.ts} +6 -5
  140. package/types/core/selection/style/api/finite-state-machine.d.ts +21 -0
  141. package/types/core/selection/style/api/index.d.ts +12 -5
  142. package/types/core/selection/style/api/{check-special-elements.d.ts → is-inside-invisible-element.d.ts} +1 -1
  143. package/types/core/selection/style/api/is-suit-element.d.ts +9 -0
  144. package/types/core/selection/style/api/toggle/toggle-css.d.ts +11 -0
  145. package/types/core/selection/style/api/toggle/toggle-ordered-list.d.ts +11 -0
  146. package/types/core/selection/style/api/{toggle-styles.d.ts → toggle-commit-styles.d.ts} +1 -3
  147. package/types/core/selection/style/api/{post-process-list-element.d.ts → wrap-and-commit-style.d.ts} +3 -3
  148. package/types/core/selection/style/api/wrap-ordered-list.d.ts +12 -0
  149. package/types/core/selection/style/apply-style.d.ts +1 -4
  150. package/types/core/selection/style/commit-style.d.ts +7 -0
  151. package/types/core/storage/engines/local-storage-provider.d.ts +3 -3
  152. package/types/core/storage/engines/memory-storage-provider.d.ts +3 -3
  153. package/types/core/storage/storage.d.ts +3 -3
  154. package/types/core/ui/button/button/button.d.ts +3 -3
  155. package/types/core/ui/form/form.d.ts +1 -0
  156. package/types/core/ui/form/inputs/area/area.d.ts +7 -1
  157. package/types/core/ui/form/inputs/checkbox/checkbox.d.ts +10 -3
  158. package/types/core/ui/helpers/buttons.d.ts +2 -2
  159. package/types/core/ui/icon.d.ts +1 -1
  160. package/types/core/ui/index.d.ts +1 -3
  161. package/types/core/ui/list/group.d.ts +2 -1
  162. package/types/core/ui/list/index.d.ts +9 -0
  163. package/types/core/ui/{separator.d.ts → list/separator.d.ts} +1 -1
  164. package/types/core/ui/list/spacer.d.ts +9 -0
  165. package/types/core/ui/popup/popup.d.ts +2 -1
  166. package/types/core/view/view-with-toolbar.d.ts +4 -2
  167. package/types/jodit.d.ts +6 -6
  168. package/types/modules/file-browser/file-browser.d.ts +3 -2
  169. package/types/modules/file-browser/listeners/native-listeners.d.ts +5 -1
  170. package/types/modules/file-browser/ui/files/files.d.ts +10 -0
  171. package/types/modules/file-browser/ui/index.d.ts +7 -0
  172. package/types/modules/file-browser/ui/tree/tree.d.ts +10 -0
  173. package/types/modules/status-bar/status-bar.d.ts +6 -1
  174. package/types/modules/toolbar/button/button.d.ts +1 -1
  175. package/types/modules/toolbar/collection/collection.d.ts +5 -2
  176. package/types/modules/toolbar/collection/editor-collection.d.ts +9 -1
  177. package/types/modules/widget/tabs/tabs.d.ts +2 -1
  178. package/types/plugins/index.d.ts +1 -0
  179. package/types/plugins/inline-popup/inline-popup.d.ts +4 -0
  180. package/types/plugins/keyboard/delete.d.ts +2 -0
  181. package/types/plugins/ordered-list.d.ts +8 -1
  182. package/types/plugins/powered-by-jodit.d.ts +12 -0
  183. package/types/plugins/source/const.d.ts +6 -0
  184. package/types/plugins/source/editor/engines/ace.d.ts +1 -0
  185. package/types/plugins/source/source.d.ts +1 -0
  186. package/types/styles/icons/index.d.ts +2 -1
  187. package/types/types/storage.d.ts +3 -3
  188. package/types/types/{ajax.d.ts → types/ajax.d.ts} +0 -1
  189. package/types/types/{async.d.ts → types/async.d.ts} +0 -0
  190. package/types/types/{context.d.ts → types/context.d.ts} +0 -0
  191. package/types/types/{core.ts → types/core.ts} +0 -0
  192. package/types/types/{create.d.ts → types/create.d.ts} +0 -0
  193. package/types/types/{dialog.d.ts → types/dialog.d.ts} +0 -0
  194. package/types/types/{events.d.ts → types/events.d.ts} +0 -0
  195. package/types/types/{file-browser.d.ts → types/file-browser.d.ts} +13 -1
  196. package/types/types/{form.d.ts → types/form.d.ts} +0 -0
  197. package/types/types/{index.d.ts → types/index.d.ts} +0 -0
  198. package/types/types/{jodit.d.ts → types/jodit.d.ts} +4 -1
  199. package/types/types/{observe.d.ts → types/observe.d.ts} +0 -0
  200. package/types/types/{plugin.d.ts → types/plugin.d.ts} +0 -0
  201. package/types/types/{popup.d.ts → types/popup.d.ts} +1 -0
  202. package/types/types/{select.d.ts → types/select.d.ts} +2 -0
  203. package/types/types/{source.d.ts → types/source.d.ts} +0 -0
  204. package/types/types/{storage.ts → types/storage.ts} +3 -3
  205. package/types/types/{style.d.ts → types/style.d.ts} +8 -0
  206. package/types/types/{toolbar.d.ts → types/toolbar.d.ts} +9 -2
  207. package/types/types/{traits.d.ts → types/traits.d.ts} +0 -0
  208. package/types/types/{types.d.ts → types/types.d.ts} +1 -1
  209. package/types/types/{ui.d.ts → types/ui.d.ts} +23 -4
  210. package/types/types/{uploader.d.ts → types/uploader.d.ts} +0 -0
  211. package/types/types/{view.d.ts → types/view.d.ts} +1 -0
  212. package/src/core/selection/style/api/post-process-list-element.ts +0 -33
  213. package/src/core/selection/style/api/toggle-styles.ts +0 -74
  214. package/types/modules/file-browser/consts.d.ts +0 -8
@@ -8,12 +8,13 @@ import './source.less';
8
8
 
9
9
  import type { IJodit, ISourceEditor } from '../../types';
10
10
  import * as consts from '../../core/constants';
11
- import { MODE_SOURCE } from '../../core/constants';
11
+ import { INVISIBLE_SPACE, MODE_SOURCE, MODE_SPLIT } from '../../core/constants';
12
12
  import { Plugin } from '../../core/plugin';
13
13
  import { Dom } from '../../core/dom';
14
14
  import { isString, loadNext } from '../../core/helpers';
15
15
  import { createSourceEditor } from './editor/factory';
16
16
  import { autobind, watch } from '../../core/decorators';
17
+ import { SOURCE_CONSUMER } from './const';
17
18
 
18
19
  /**
19
20
  * Plug-in change simple textarea on CodeMirror editor in Source code mode
@@ -55,7 +56,7 @@ export class source extends Plugin {
55
56
  private fromWYSIWYG(force: boolean | string = false): void {
56
57
  if (!this.__lock || force === true) {
57
58
  this.__lock = true;
58
- const new_value = this.j.getEditorValue(false);
59
+ const new_value = this.j.getEditorValue(false, SOURCE_CONSUMER);
59
60
 
60
61
  if (new_value !== this.getMirrorValue()) {
61
62
  this.setMirrorValue(new_value);
@@ -88,6 +89,20 @@ export class source extends Plugin {
88
89
 
89
90
  @autobind
90
91
  private getNormalPosition(pos: number, str: string): number {
92
+ str = str.replace(/<(script|style|iframe)[^>]*>.*?<\/\1>/is, m => {
93
+ let res = '';
94
+
95
+ for (let i = 0; i < m.length; i += 1) {
96
+ res += INVISIBLE_SPACE;
97
+ }
98
+
99
+ return res;
100
+ });
101
+
102
+ while (pos > 0 && str[pos] === INVISIBLE_SPACE) {
103
+ pos--;
104
+ }
105
+
91
106
  let start: number = pos;
92
107
 
93
108
  while (start > 0) {
@@ -294,7 +309,7 @@ export class source extends Plugin {
294
309
  .on('placeholder.source', (text: string) => {
295
310
  this.sourceEditor?.setPlaceHolder(text);
296
311
  })
297
- .on('change.source', this.fromWYSIWYG)
312
+ .on('change.source', this.syncValueFromWYSIWYG)
298
313
  .on('beautifyHTML', html => html);
299
314
 
300
315
  if (editor.o.beautifyHTML) {
@@ -319,11 +334,22 @@ export class source extends Plugin {
319
334
  }
320
335
  }
321
336
 
322
- this.fromWYSIWYG();
323
-
337
+ this.syncValueFromWYSIWYG(true);
324
338
  this.initSourceEditor(editor);
325
339
  }
326
340
 
341
+ @autobind
342
+ private syncValueFromWYSIWYG(force: boolean = false) {
343
+ const editor = this.j;
344
+
345
+ if (
346
+ editor.getMode() === MODE_SPLIT ||
347
+ editor.getMode() === MODE_SOURCE
348
+ ) {
349
+ this.fromWYSIWYG(force);
350
+ }
351
+ }
352
+
327
353
  private initSourceEditor(editor: IJodit): void {
328
354
  if (editor.o.sourceEditor !== 'area') {
329
355
  const sourceEditor = createSourceEditor(
@@ -337,12 +363,12 @@ export class source extends Plugin {
337
363
  sourceEditor.onReadyAlways(() => {
338
364
  this.sourceEditor?.destruct();
339
365
  this.sourceEditor = sourceEditor;
340
- this.fromWYSIWYG(true);
366
+ this.syncValueFromWYSIWYG(true);
341
367
  editor.events?.fire('sourceEditorReady', editor);
342
368
  });
343
369
  } else {
344
370
  this.sourceEditor?.onReadyAlways(() => {
345
- this.fromWYSIWYG(true);
371
+ this.syncValueFromWYSIWYG(true);
346
372
  editor.events?.fire('sourceEditorReady', editor);
347
373
  });
348
374
  }
@@ -24,7 +24,9 @@ declare module '../../config' {
24
24
  * ```
25
25
  */
26
26
  toolbarSticky: boolean;
27
+
27
28
  toolbarDisableStickyForMobile: boolean;
29
+
28
30
  /**
29
31
  * For example, in Joomla, the top menu bar closes Jodit toolbar when scrolling. Therefore, it is necessary to
30
32
  * move the toolbar Jodit by this amount [more](http://xdsoft.net/jodit/doc/#2.5.57)
@@ -60,6 +60,7 @@ import * as plus from './plus.svg';
60
60
  import * as print from './print.svg';
61
61
  import * as redo from './redo.svg';
62
62
  import * as resize from './resize.svg';
63
+ import * as resize_handler from './resize-handler.svg';
63
64
  import * as resizer from './resizer.svg';
64
65
  import * as right from './right.svg';
65
66
  import * as save from './save.svg';
@@ -143,6 +144,7 @@ export {
143
144
  print,
144
145
  redo,
145
146
  resize,
147
+ resize_handler,
146
148
  resizer,
147
149
  right,
148
150
  save,
@@ -0,0 +1,4 @@
1
+ <svg viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M5.9814 11.8049C5.59087 11.4144 5.59087 10.7812 5.9814 10.3907L10.224 6.14806C10.6146 5.75754 11.2477 5.75754 11.6383 6.14806C12.0288 6.53859 12.0288 7.17175 11.6383 7.56228L7.39561 11.8049C7.00509 12.1954 6.37192 12.1954 5.9814 11.8049Z"/>
3
+ <path d="M0.707107 12.0208C0.316582 11.6303 0.316582 10.9971 0.707107 10.6066L10.6066 0.707121C10.9971 0.316597 11.6303 0.316596 12.0208 0.707121C12.4113 1.09764 12.4113 1.73081 12.0208 2.12133L2.12132 12.0208C1.7308 12.4114 1.09763 12.4114 0.707107 12.0208Z"/>
4
+ </svg>
@@ -25,6 +25,12 @@
25
25
  }
26
26
  }
27
27
 
28
+ .jodit-wysiwyg {
29
+ *[contentEditable='false'] {
30
+ cursor: default;
31
+ }
32
+ }
33
+
28
34
  .jodit-container:not(.jodit_inline) {
29
35
  border: 1px solid var(--color-border);
30
36
  //background-color: var(--color-background-default);
@@ -96,3 +96,23 @@
96
96
 
97
97
  overflow-anchor: auto;
98
98
  }
99
+
100
+ .resize-handle() {
101
+ position: relative;
102
+
103
+ svg {
104
+ position: absolute;
105
+ right: 0;
106
+ bottom: 0;
107
+ overflow: hidden;
108
+
109
+ width: 12px;
110
+ height: 12px;
111
+
112
+ cursor: nwse-resize;
113
+
114
+ fill: var(--color-gray-dark);
115
+
116
+ user-select: none;
117
+ }
118
+ }
@@ -33,7 +33,7 @@
33
33
 
34
34
  .jodit-popup {
35
35
  &__content {
36
- background: var(--dark_background_color);
36
+ background: var(--dark_background_ligher);
37
37
  }
38
38
  }
39
39
 
@@ -55,8 +55,18 @@
55
55
  .jodit-status-bar {
56
56
  border-color: rgba(95, 92, 92, 0.8);
57
57
  background-color: rgba(95, 92, 92, 0.8);
58
+ color: var(--dark_text_color);
59
+
60
+ a.jodit-status-bar-link {
61
+ &,
62
+ &:hover,
63
+ &:visited {
64
+ color: var(--dark_text_color);
65
+ }
66
+ }
58
67
 
59
68
  &,
69
+ .jodit-status-bar__item a,
60
70
  .jodit-status-bar__item span {
61
71
  color: var(--dark_text_color);
62
72
  }
@@ -20,7 +20,6 @@ export interface IRequest {
20
20
  data: DataVariant;
21
21
  }
22
22
 
23
-
24
23
  export interface IResponse<T> {
25
24
  readonly status: number;
26
25
  readonly statusText: string;
@@ -13,6 +13,7 @@ import type {
13
13
  } from './types';
14
14
  import type { IUploader, IUploaderOptions } from './uploader';
15
15
  import type { IViewBased, IViewOptions } from './view';
16
+ import type { IUIElement } from './ui';
16
17
 
17
18
  /**
18
19
  * The module creates a web browser dialog box. In a Web browser ,you can select an image, remove, drag it. Upload new
@@ -92,7 +93,14 @@ export interface IFileBrowserOptions extends IViewOptions {
92
93
  preview: boolean;
93
94
  showPreviewNavigation: boolean;
94
95
  showSelectButtonInPreview: boolean;
95
- saveStateInStorage: boolean;
96
+
97
+ saveStateInStorage:
98
+ | false
99
+ | {
100
+ storeLastOpenedFolder?: boolean;
101
+ storeView?: boolean;
102
+ storeSortBy?: boolean;
103
+ };
96
104
 
97
105
  contextMenu: boolean;
98
106
 
@@ -104,6 +112,7 @@ export interface IFileBrowserOptions extends IViewOptions {
104
112
  renameFolder: boolean;
105
113
  moveFolder: boolean;
106
114
  moveFile: boolean;
115
+
107
116
  showFoldersPanel: boolean;
108
117
 
109
118
  width: number;
@@ -237,6 +246,9 @@ export interface IFileBrowser<
237
246
  readonly dataProvider: IFileBrowserDataProvider;
238
247
  readonly state: IFileBrowserState;
239
248
 
249
+ readonly tree: IUIElement;
250
+ readonly files: IUIElement;
251
+
240
252
  isOpened: boolean;
241
253
 
242
254
  open(
@@ -32,7 +32,10 @@ interface IJodit extends IViewWithToolbar {
32
32
  element: HTMLElement;
33
33
 
34
34
  getNativeEditorValue(): string;
35
- getEditorValue(removeSelectionMarkers?: boolean): string;
35
+ getEditorValue(
36
+ removeSelectionMarkers?: boolean,
37
+ consumer?: string
38
+ ): string;
36
39
  setEditorValue(value?: string): void;
37
40
 
38
41
  getReadOnly(): boolean;
@@ -12,6 +12,7 @@ export type PopupStrategy =
12
12
  | 'rightBottom'
13
13
  | 'leftTop'
14
14
  | 'rightTop';
15
+
15
16
  export interface IPopup extends IUIElement, IDestructible {
16
17
  container: HTMLElement;
17
18
 
@@ -38,6 +38,8 @@ export interface ISelect {
38
38
 
39
39
  save(silent?: boolean): MarkerInfo[];
40
40
  restore(): void;
41
+ readonly hasMarkers: boolean;
42
+ readonly markers: HTMLElement[];
41
43
  removeMarkers(): void;
42
44
  marker(atStart?: boolean, range?: Range): HTMLSpanElement;
43
45
 
@@ -12,9 +12,9 @@ export type StorageValueType =
12
12
  | StorageValueType[];
13
13
 
14
14
  export interface IStorage<T = StorageValueType> {
15
- set(key: string, value: T): void;
16
- delete(key: string): void;
15
+ set(key: string, value: T): IStorage<T>;
16
+ delete(key: string): IStorage<T>;
17
17
  get<R = T>(key: string): R | void;
18
18
  exists(key: string): boolean;
19
- clear(): void;
19
+ clear(): IStorage<T>;
20
20
  }
@@ -16,3 +16,11 @@ export interface IStyleOptions {
16
16
  className: CanUndef<string>;
17
17
  defaultTag: CanUndef<HTMLTagNames>;
18
18
  }
19
+
20
+ export type CommitMode =
21
+ | 'initial'
22
+ | 'wrap'
23
+ | 'unwrap'
24
+ | 'change'
25
+ | 'unset'
26
+ | 'replace';
@@ -11,11 +11,14 @@ import type {
11
11
  Modes,
12
12
  Nullable,
13
13
  IViewBased,
14
- IJodit
14
+ IJodit,
15
+ IPoint,
16
+ IBound
15
17
  } from './';
16
18
  import type { IFileBrowser } from './file-browser';
17
19
 
18
20
  import type { IUIButton, IUIElement, IUIList } from './ui';
21
+ import { IMods } from './';
19
22
 
20
23
  interface IControlType<
21
24
  T = IJodit | IViewBased | IFileBrowser,
@@ -299,9 +302,13 @@ interface IToolbarCollection extends IUIList {
299
302
  shouldBeDisabled(button: IToolbarButton): boolean | void;
300
303
  shouldBeActive(button: IToolbarButton): boolean | void;
301
304
  getTarget(button: IToolbarButton): Node | null;
305
+
306
+ show(): void;
307
+ hide(): void;
308
+ showInline(bound?: IBound): void;
302
309
  }
303
310
 
304
- export interface IStatusBar extends IComponent {
311
+ export interface IStatusBar extends IComponent, IMods {
305
312
  jodit: IViewBased;
306
313
 
307
314
  show(): void;
@@ -63,7 +63,7 @@ interface IComponent<T extends IViewBased = IViewBased> extends IDestructible {
63
63
  callback: (component: this) => void
64
64
  ): void;
65
65
 
66
- bindDestruct(jodit: T): this;
66
+ bindDestruct(component: IComponent): this;
67
67
  }
68
68
 
69
69
  interface IViewComponent<T extends IViewBased = IViewBased> extends IComponent {
package/src/types/ui.d.ts CHANGED
@@ -50,7 +50,7 @@ export interface IUIIconState {
50
50
  fill: string;
51
51
  }
52
52
 
53
- export type ButtonStatus =
53
+ export type ButtonVariant =
54
54
  | 'initial'
55
55
  | 'default'
56
56
  | 'primary'
@@ -62,7 +62,9 @@ export interface IUIButtonState {
62
62
  size: 'tiny' | 'xsmall' | 'small' | 'middle' | 'large';
63
63
  name: string;
64
64
  value: string | number | boolean;
65
- status: ButtonStatus;
65
+
66
+ variant: ButtonVariant;
67
+
66
68
  type: 'button' | 'submit';
67
69
  disabled: boolean;
68
70
  activated: boolean;
@@ -131,11 +133,11 @@ export interface IUIInput extends IUIElement {
131
133
  className: string;
132
134
  autocomplete: boolean;
133
135
  name: string;
134
- value: string;
136
+ value: string | number;
135
137
  icon: string;
136
138
  label: string;
137
139
  ref: string;
138
- type: 'text' | 'checkbox' | 'url' | 'file' | 'hidden';
140
+ type: 'text' | 'number' |'checkbox' | 'url' | 'file' | 'hidden';
139
141
  placeholder: string;
140
142
  required: boolean;
141
143
  validators: string[];
@@ -170,9 +172,26 @@ export interface IUISelect extends IUIInput {
170
172
  };
171
173
  }
172
174
 
175
+ export interface IUITextArea extends IUIInput {
176
+ readonly nativeInput: HTMLTextAreaElement;
177
+
178
+ readonly state: IUIInput['state'] & {
179
+ size?: number;
180
+ resizable?: boolean;
181
+ };
182
+ }
183
+
173
184
  export interface IUIRange extends IUIInput {
174
185
  readonly state: IUIInput['state'] & {
175
186
  min: number;
176
187
  max: number;
177
188
  };
178
189
  }
190
+
191
+
192
+ export interface IUICheckBox extends IUIInput {
193
+ readonly state: IUIInput['state'] & {
194
+ checked: boolean;
195
+ switch: boolean;
196
+ };
197
+ }
@@ -138,6 +138,7 @@ interface IViewWithToolbar<T = IViewOptions> extends IViewBased<T> {
138
138
  registeredButtons: Set<IPluginButton>;
139
139
  registerButton(btn: IPluginButton): this;
140
140
  unregisterButton(btn: IPluginButton): this;
141
+ getRegisteredButtonGroups(): IDictionary<string[]>;
141
142
 
142
143
  setPanel(element: HTMLElement | string): void;
143
144
  }
@@ -3,14 +3,19 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { ComponentStatus, IComponent, IDictionary, IViewBased, Nullable } from '../../types';
7
- import { STATUSES } from './statuses';
6
+ import type { ComponentStatus, IComponent, IDictionary, Nullable } from '../../types';
8
7
  /**
9
8
  * The base class of all Jodit UI components. Provides work with a life cycle.
10
9
  */
11
10
  export declare abstract class Component implements IComponent {
12
- static STATUSES: typeof STATUSES;
13
- readonly componentName: string;
11
+ static STATUSES: {
12
+ readonly beforeInit: "beforeInit";
13
+ readonly ready: "ready";
14
+ readonly beforeDestruct: "beforeDestruct";
15
+ readonly destructed: "destructed";
16
+ };
17
+ private __componentName;
18
+ get componentName(): string;
14
19
  readonly uid: string;
15
20
  /**
16
21
  * Calc BEM element class name
@@ -73,7 +78,7 @@ export declare abstract class Component implements IComponent {
73
78
  /**
74
79
  * Bind destructor to come View
75
80
  */
76
- bindDestruct(jodit: IViewBased): this;
81
+ bindDestruct(component: IComponent): this;
77
82
  abstract className(): string;
78
83
  protected constructor();
79
84
  /**
@@ -3,9 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export declare enum STATUSES {
7
- beforeInit = "beforeInit",
8
- ready = "ready",
9
- beforeDestruct = "beforeDestruct",
10
- destructed = "destructed"
11
- }
6
+ export declare const STATUSES: {
7
+ readonly beforeInit: "beforeInit";
8
+ readonly ready: "ready";
9
+ readonly beforeDestruct: "beforeDestruct";
10
+ readonly destructed: "destructed";
11
+ };
@@ -41,14 +41,15 @@ export declare class Dom {
41
41
  * // Replace the first <span> element to the < p >
42
42
  * ```
43
43
  */
44
- static replace(elm: HTMLElement, newTagName: HTMLTagNames | HTMLElement, create: ICreate, withAttributes?: boolean, notMoveContent?: boolean): HTMLElement;
44
+ static replace(elm: HTMLElement, newTagName: HTMLTagNames | HTMLElement | string, create: ICreate, withAttributes?: boolean, notMoveContent?: boolean): HTMLElement;
45
45
  /**
46
46
  * Checks whether the Node text and blank (in this case it may contain invisible auxiliary characters ,
47
47
  * it is also empty )
48
48
  *
49
49
  * @param node - The element of wood to be checked
50
50
  */
51
- static isEmptyTextNode(node: Node): boolean;
51
+ static isEmptyTextNode(node: Nullable<Node>): boolean;
52
+ static isEmptyContent(node: Node): boolean;
52
53
  /**
53
54
  * Check if element is empty
54
55
  */
@@ -22,3 +22,4 @@ export declare const appendScriptAsync: Loader;
22
22
  */
23
23
  export declare const appendStyleAsync: Loader;
24
24
  export declare const loadNext: (jodit: IViewBased, urls: string[], i?: number) => Promise<void>;
25
+ export declare const loadNextStyle: (jodit: IViewBased, urls: string[], i?: number) => Promise<void>;
@@ -3,8 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { HTMLTagNames, IDictionary, Nullable } from '../../types/';
7
- import { UIElement } from '../ui';
6
+ import type { HTMLTagNames, IDictionary, IUIElement, Nullable } from '../../types/';
8
7
  /**
9
8
  * Find all elements by selector and return Array. If it did not find any element it return empty array
10
9
  *
@@ -28,7 +27,7 @@ export declare const getXPathByElement: (element: HTMLElement, root: HTMLElement
28
27
  /**
29
28
  * Find all `ref` or `data-ref` elements inside HTMLElement
30
29
  */
31
- export declare const refs: <T extends HTMLElement>(root: HTMLElement | UIElement) => IDictionary<T>;
30
+ export declare const refs: <T extends HTMLElement>(root: HTMLElement | IUIElement) => IDictionary<T>;
32
31
  /**
33
32
  * Calculate full CSS selector
34
33
  */
@@ -8,3 +8,4 @@ export * from './get-scroll-parent';
8
8
  export * from './inner-width';
9
9
  export * from './offset';
10
10
  export * from './position';
11
+ export * from './object-size';
@@ -0,0 +1,7 @@
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 { CanUndef } from '../../../types';
7
+ export declare function size(subject: CanUndef<object | string | Array<unknown>>): number;
@@ -3,19 +3,20 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { CommitStyle } from '../commit-style';
7
- import type { Nullable } from '../../../../types';
6
+ import type { IJodit } from '../../../../types';
8
7
  /**
9
8
  * If the selection area is inside an element that matches the commit (suitable relative),
10
9
  * but does not completely fill it.
11
10
  * Then the method cuts the parent and leaves itself in a copy of the parent (suitable relative) in the middle.
12
- * And returns it copy.
13
11
  *
14
12
  * @example
13
+ * Apply strong to
15
14
  * ```html
16
15
  * <strong><span>some<font>SELECTED</font>text</span></strong>
17
- * to
16
+ * ```
17
+ * Should extract selection from parent `strong`
18
+ * ```html
18
19
  * `<strong><span>some</span></strong><strong><span><font>SELECTED</font></span></strong><strong><span>test</span></strong>
19
20
  * ```
20
21
  */
21
- export declare function getClosestWrapper(style: CommitStyle, font: HTMLElement, root: HTMLElement, getRange: () => Range): Nullable<HTMLElement>;
22
+ export declare function extractSelectedPart(wrapper: HTMLElement, font: HTMLElement, jodit: IJodit): void;
@@ -0,0 +1,21 @@
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 { CanUndef, IDictionary } from '../../../../types';
7
+ /**
8
+ * A state machine implementation for applying styles.
9
+ */
10
+ export declare class FiniteStateMachine {
11
+ private state;
12
+ private readonly transitions;
13
+ setState(state: string, subState?: string): void;
14
+ private subState;
15
+ getState(): string;
16
+ getSubState(): string;
17
+ private silent;
18
+ disableSilent(): void;
19
+ constructor(state: string, transitions: IDictionary<IDictionary<(this: FiniteStateMachine, ...attrs: any[]) => any>>);
20
+ dispatch<T>(actionName: string, ...attrs: any[]): CanUndef<T>;
21
+ }
@@ -3,11 +3,18 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export * from './get-suit-parent';
6
+ export * from './toggle/toggle-css';
7
+ export * from './toggle/toggle-ordered-list';
8
+ export * from './element-has-same-style';
9
+ export * from './extract';
10
+ export * from './finite-state-machine';
7
11
  export * from './get-suit-child';
8
- export * from './check-special-elements';
9
- export * from './get-closest-wrapper';
12
+ export * from './get-suit-parent';
13
+ export * from './is-inside-invisible-element';
14
+ export * from './is-normal-node';
15
+ export * from './is-suit-element';
16
+ export * from './toggle-commit-styles';
10
17
  export * from './unwrap-children';
18
+ export * from './wrap-and-commit-style';
19
+ export * from './wrap-ordered-list';
11
20
  export * from './wrap-unwrapped-text';
12
- export * from './post-process-list-element';
13
- export * from './toggle-styles';
@@ -6,4 +6,4 @@
6
6
  /**
7
7
  * Check if FONT inside STYLE or SCRIPT element
8
8
  */
9
- export declare function checkSpecialElements(font: HTMLElement, root: HTMLElement): boolean;
9
+ export declare function isInsideInvisibleElement(font: HTMLElement, root: HTMLElement): boolean;
@@ -15,4 +15,13 @@ import type { CommitStyle } from '../commit-style';
15
15
  * @param strict - strict mode - false - the default tag is suitable for us if it is also in the commit
16
16
  */
17
17
  export declare function isSuitElement(commitStyle: CommitStyle, elm: Nullable<Node>, strict: boolean): elm is HTMLElement;
18
+ /**
19
+ * Внутри родительского элемента есть блок с теми же стилями
20
+ * @example
21
+ * For selection:
22
+ * ```html
23
+ * <p>|test<strong>test</strong>|</p>
24
+ * ```
25
+ * Apply `{element:'strong'}`
26
+ */
18
27
  export declare function isSameStyleChild(commitStyle: CommitStyle, elm: Nullable<Node>): elm is HTMLElement;
@@ -0,0 +1,11 @@
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 { CommitMode, IJodit } from '../../../../../types';
7
+ import type { CommitStyle } from '../../commit-style';
8
+ /**
9
+ * Toggles css and classname
10
+ */
11
+ export declare function toggleCSS(commitStyle: CommitStyle, elm: HTMLElement, jodit: IJodit, mode: CommitMode, dry?: boolean): CommitMode;
@@ -0,0 +1,11 @@
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 { IJodit, CommitMode } from '../../../../../types';
7
+ import type { CommitStyle } from '../../commit-style';
8
+ /**
9
+ * Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
10
+ */
11
+ export declare function toggleOrderedList(style: CommitStyle, li: HTMLElement, jodit: IJodit, mode: CommitMode): CommitMode;
@@ -4,10 +4,8 @@
4
4
  * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  import type { CommitStyle } from '../commit-style';
7
- import type { Nullable } from '../../../../types';
8
7
  /**
9
8
  * Add or remove styles to element
10
- *
11
9
  * @param elm - The element to switch styles
12
10
  */
13
- export declare function toggleStyles(style: CommitStyle, elm: HTMLElement, wrap: Nullable<boolean>): Nullable<boolean>;
11
+ export declare function toggleCommitStyles(commitStyle: CommitStyle, elm: HTMLElement): boolean;