jodit 3.15.2 → 3.16.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 (260) hide show
  1. package/.idea/workspace.xml +301 -299
  2. package/CHANGELOG.MD +88 -7
  3. package/CONTRIBUTING.md +97 -0
  4. package/README.md +7 -7
  5. package/build/jodit.css +38 -32
  6. package/build/jodit.es2018.css +37 -31
  7. package/build/jodit.es2018.en.css +37 -31
  8. package/build/jodit.es2018.en.js +1981 -1393
  9. package/build/jodit.es2018.en.min.css +1 -1
  10. package/build/jodit.es2018.en.min.js +1 -1
  11. package/build/jodit.es2018.js +2053 -1447
  12. package/build/jodit.es2018.min.css +1 -1
  13. package/build/jodit.es2018.min.js +1 -1
  14. package/build/jodit.js +3475 -2625
  15. package/build/jodit.min.css +2 -2
  16. package/build/jodit.min.js +1 -1
  17. package/build/vdom.css +1 -1
  18. package/build/vdom.js +32 -20
  19. package/package.json +13 -13
  20. package/src/README.md +1 -1
  21. package/src/config.ts +69 -36
  22. package/src/core/async/async.ts +46 -24
  23. package/src/core/constants.ts +1 -0
  24. package/src/core/decorators/README.md +35 -0
  25. package/src/core/decorators/cache/cache.ts +1 -1
  26. package/src/core/decorators/debounce/debounce.ts +20 -9
  27. package/src/core/decorators/idle/README.md +14 -0
  28. package/src/core/decorators/idle/idle.ts +1 -1
  29. package/src/core/decorators/watch/watch.ts +8 -7
  30. package/src/core/dom/README.md +42 -0
  31. package/src/core/dom/dom.ts +37 -23
  32. package/src/core/dom/index.ts +1 -0
  33. package/src/core/dom/lazy-walker.ts +133 -0
  34. package/src/core/event-emitter/event-emitter.ts +8 -8
  35. package/src/core/event-emitter/eventify.ts +73 -0
  36. package/src/core/event-emitter/index.ts +1 -0
  37. package/src/core/helpers/html/apply-styles.ts +1 -1
  38. package/src/core/helpers/html/strip-tags.ts +3 -2
  39. package/src/core/helpers/string/fuzzy-search-index.ts +58 -0
  40. package/src/core/helpers/string/i18n.ts +1 -1
  41. package/src/core/helpers/string/index.ts +3 -2
  42. package/src/core/helpers/utils/append-script.ts +1 -1
  43. package/src/core/helpers/utils/css.ts +1 -1
  44. package/src/core/helpers/utils/selector.ts +1 -1
  45. package/src/core/helpers/utils/utils.ts +3 -3
  46. package/src/core/plugin/plugin-system.ts +14 -8
  47. package/src/core/request/ajax.ts +3 -3
  48. package/src/core/selection/select.ts +10 -10
  49. package/src/core/selection/style/api/toggle/toggle-css.ts +5 -2
  50. package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -1
  51. package/src/core/selection/style/apply-style.ts +4 -4
  52. package/src/core/storage/engines/local-storage-provider.ts +20 -19
  53. package/src/core/ui/button/button/button.ts +5 -5
  54. package/src/core/ui/element.ts +2 -2
  55. package/src/core/ui/form/inputs/input/input.ts +1 -1
  56. package/src/core/ui/form/inputs/select/select.ts +1 -1
  57. package/src/core/ui/group/list.ts +2 -2
  58. package/src/core/vdom/render/index.ts +12 -8
  59. package/src/core/vdom/v-dom-jodit.ts +1 -1
  60. package/src/core/view/view.ts +1 -1
  61. package/src/index.ts +3 -3
  62. package/src/jodit.ts +72 -55
  63. package/src/langs/README.md +1 -1
  64. package/src/langs/ar.js +2 -1
  65. package/src/langs/cs_cz.js +2 -1
  66. package/src/langs/de.js +2 -1
  67. package/src/langs/es.js +2 -1
  68. package/src/langs/fa.js +2 -1
  69. package/src/langs/fr.js +2 -1
  70. package/src/langs/he.js +2 -1
  71. package/src/langs/hu.js +2 -1
  72. package/src/langs/id.js +2 -1
  73. package/src/langs/index.ts +1 -1
  74. package/src/langs/it.js +2 -1
  75. package/src/langs/ja.js +2 -1
  76. package/src/langs/ko.js +2 -1
  77. package/src/langs/nl.js +2 -1
  78. package/src/langs/pl.js +2 -1
  79. package/src/langs/pt_br.js +2 -1
  80. package/src/langs/ru.js +2 -1
  81. package/src/langs/tr.js +2 -1
  82. package/src/langs/zh_cn.js +2 -1
  83. package/src/langs/zh_tw.js +2 -1
  84. package/src/modules/dialog/dialog.ts +6 -6
  85. package/src/modules/dialog/prompt.ts +1 -1
  86. package/src/modules/file-browser/README.md +2 -2
  87. package/src/modules/file-browser/builders/context-menu.ts +12 -13
  88. package/src/modules/file-browser/fetch/load-tree.ts +1 -1
  89. package/src/modules/file-browser/file-browser.ts +10 -7
  90. package/src/modules/history/README.md +5 -0
  91. package/src/modules/{observer → history}/command.ts +5 -5
  92. package/src/modules/{observer/observer.ts → history/history.ts} +97 -55
  93. package/src/modules/{observer → history}/snapshot.ts +3 -4
  94. package/src/modules/{observer → history}/stack.ts +4 -4
  95. package/src/modules/image-editor/image-editor.ts +8 -8
  96. package/src/modules/image-editor/templates/form.ts +2 -2
  97. package/src/modules/index.ts +3 -3
  98. package/src/modules/status-bar/status-bar.ts +4 -0
  99. package/src/modules/table/table.ts +2 -2
  100. package/src/modules/toolbar/button/button.ts +2 -2
  101. package/src/modules/toolbar/collection/collection.ts +1 -1
  102. package/src/modules/uploader/helpers/process-old-browser-drag.ts +1 -1
  103. package/src/modules/uploader/helpers/send-files.ts +1 -1
  104. package/src/modules/uploader/helpers/send.ts +1 -1
  105. package/src/modules/uploader/uploader.ts +3 -3
  106. package/src/modules/widget/color-picker/color-picker.ts +2 -3
  107. package/src/modules/widget/tabs/tabs.ts +17 -12
  108. package/src/plugins/add-new-line/add-new-line.ts +8 -8
  109. package/src/plugins/class-span/class-span.ts +1 -1
  110. package/src/plugins/clipboard/copy-format.ts +1 -1
  111. package/src/plugins/clipboard/drag-and-drop-element.ts +4 -2
  112. package/src/plugins/clipboard/paste/config.ts +19 -3
  113. package/src/plugins/clipboard/paste/helpers.ts +17 -50
  114. package/src/plugins/clipboard/paste/interface.ts +6 -0
  115. package/src/plugins/clipboard/paste/paste.ts +22 -8
  116. package/src/plugins/clipboard/paste-from-word/config.ts +17 -0
  117. package/src/plugins/clipboard/paste-from-word/paste-from-word.ts +15 -6
  118. package/src/plugins/clipboard/paste-storage/paste-storage.ts +6 -6
  119. package/src/plugins/color/color.ts +2 -2
  120. package/src/plugins/error-messages/error-messages.ts +2 -2
  121. package/src/plugins/fix/clean-html/README.md +26 -0
  122. package/src/plugins/fix/{clean-html.ts → clean-html/clean-html.ts} +59 -142
  123. package/src/plugins/fix/clean-html/config.ts +106 -0
  124. package/src/plugins/fix/index.ts +12 -0
  125. package/src/plugins/fix/wrap-nodes/README.md +27 -0
  126. package/src/plugins/fix/wrap-nodes/config.ts +24 -0
  127. package/src/plugins/fix/{wrap-text-nodes.ts → wrap-nodes/wrap-nodes.ts} +9 -4
  128. package/src/plugins/focus/focus.ts +1 -1
  129. package/src/plugins/format-block/format-block.ts +1 -1
  130. package/src/plugins/fullsize/fullsize.ts +4 -4
  131. package/src/plugins/iframe/iframe.ts +3 -3
  132. package/src/plugins/image/image-properties/image-properties.ts +12 -13
  133. package/src/plugins/indent/indent.ts +1 -1
  134. package/src/plugins/index.ts +2 -2
  135. package/src/plugins/inline-popup/config/items/a.ts +2 -2
  136. package/src/plugins/inline-popup/config/items/cells.ts +11 -11
  137. package/src/plugins/inline-popup/config/items/iframe.ts +1 -1
  138. package/src/plugins/inline-popup/config/items/img.ts +7 -7
  139. package/src/plugins/inline-popup/inline-popup.ts +5 -5
  140. package/src/plugins/keyboard/backspace/backspace.ts +1 -1
  141. package/src/plugins/keyboard/backspace/cases/check-join-neighbors.ts +1 -1
  142. package/src/plugins/keyboard/helpers.ts +1 -1
  143. package/src/plugins/keyboard/hotkeys.ts +1 -1
  144. package/src/plugins/limit/limit.ts +3 -3
  145. package/src/plugins/line-height/line-height.ts +1 -1
  146. package/src/plugins/link/link.ts +8 -8
  147. package/src/plugins/link/template.ts +2 -2
  148. package/src/plugins/media/file.ts +1 -1
  149. package/src/plugins/media/media.ts +1 -1
  150. package/src/plugins/media/video/config.ts +1 -1
  151. package/src/plugins/mobile/config.ts +1 -1
  152. package/src/plugins/mobile/mobile.ts +1 -1
  153. package/src/plugins/ordered-list/config.ts +61 -0
  154. package/src/plugins/ordered-list/ordered-list.ts +3 -153
  155. package/src/plugins/placeholder/placeholder.ts +3 -3
  156. package/src/plugins/print/helpers.ts +14 -7
  157. package/src/plugins/print/index.ts +1 -1
  158. package/src/plugins/print/{preview.less → preview/preview.less} +1 -1
  159. package/src/plugins/print/{preview.ts → preview/preview.ts} +9 -8
  160. package/src/plugins/print/print.ts +19 -10
  161. package/src/plugins/redo-undo/redo-undo.ts +3 -3
  162. package/src/plugins/resizer/resizer.ts +11 -11
  163. package/src/plugins/search/README.md +38 -0
  164. package/src/plugins/search/config.ts +82 -0
  165. package/src/plugins/search/helpers/index.ts +12 -0
  166. package/src/plugins/search/helpers/sentence-finder.ts +103 -0
  167. package/src/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.ts +120 -0
  168. package/src/plugins/search/search.ts +269 -615
  169. package/src/plugins/search/ui/search.less +159 -0
  170. package/src/plugins/search/ui/search.ts +256 -0
  171. package/src/plugins/select/select.ts +1 -1
  172. package/src/plugins/size/config.ts +8 -8
  173. package/src/plugins/size/resize-handler.ts +3 -3
  174. package/src/plugins/size/size.ts +4 -4
  175. package/src/plugins/source/editor/engines/ace.ts +9 -9
  176. package/src/plugins/source/editor/engines/area.ts +3 -3
  177. package/src/plugins/source/source.ts +6 -6
  178. package/src/plugins/spellcheck/README.md +1 -0
  179. package/src/plugins/spellcheck/config.ts +34 -0
  180. package/src/plugins/spellcheck/spellcheck.svg +4 -0
  181. package/src/plugins/spellcheck/spellcheck.ts +48 -0
  182. package/src/plugins/sticky/sticky.ts +3 -3
  183. package/src/plugins/table/resize-cells.ts +11 -11
  184. package/src/plugins/table/select-cells.ts +2 -2
  185. package/src/plugins/tooltip/tooltip.ts +1 -1
  186. package/src/plugins/xpath/xpath.ts +8 -8
  187. package/src/polyfills.ts +5 -4
  188. package/src/styles/icons/README.md +2 -2
  189. package/src/types/async.d.ts +12 -2
  190. package/src/types/core.ts +1 -1
  191. package/src/types/events.d.ts +6 -2
  192. package/src/types/file-browser.d.ts +1 -2
  193. package/{types/types/observer.d.ts → src/types/history.d.ts} +11 -7
  194. package/src/types/index.d.ts +1 -1
  195. package/src/types/jodit.d.ts +12 -4
  196. package/src/types/toolbar.d.ts +5 -5
  197. package/src/types/types.d.ts +11 -4
  198. package/types/config.d.ts +68 -35
  199. package/types/core/async/async.d.ts +11 -4
  200. package/types/core/constants.d.ts +1 -0
  201. package/types/core/dom/dom.d.ts +3 -5
  202. package/types/core/dom/index.d.ts +1 -0
  203. package/types/core/dom/lazy-walker.d.ts +37 -0
  204. package/types/core/event-emitter/eventify.d.ts +39 -0
  205. package/types/core/event-emitter/index.d.ts +1 -0
  206. package/types/core/helpers/string/fuzzy-search-index.d.ts +10 -0
  207. package/types/core/helpers/string/i18n.d.ts +1 -1
  208. package/types/core/helpers/string/index.d.ts +3 -2
  209. package/types/core/helpers/utils/utils.d.ts +1 -1
  210. package/types/core/selection/select.d.ts +1 -1
  211. package/types/core/ui/button/button/button.d.ts +4 -4
  212. package/types/core/view/view.d.ts +1 -1
  213. package/types/jodit.d.ts +19 -6
  214. package/types/modules/{observer → history}/command.d.ts +4 -4
  215. package/types/modules/{observer/observer.d.ts → history/history.d.ts} +17 -9
  216. package/types/modules/{observer → history}/snapshot.d.ts +1 -1
  217. package/types/modules/{observer → history}/stack.d.ts +3 -3
  218. package/types/modules/image-editor/image-editor.d.ts +1 -1
  219. package/types/modules/index.d.ts +3 -3
  220. package/types/modules/toolbar/button/button.d.ts +2 -5
  221. package/types/modules/widget/tabs/tabs.d.ts +1 -1
  222. package/types/plugins/class-span/class-span.d.ts +1 -1
  223. package/types/plugins/clipboard/paste/config.d.ts +8 -0
  224. package/types/plugins/clipboard/paste/helpers.d.ts +2 -2
  225. package/types/plugins/clipboard/paste/interface.d.ts +5 -0
  226. package/types/plugins/clipboard/paste-from-word/config.d.ts +5 -0
  227. package/types/plugins/clipboard/paste-from-word/paste-from-word.d.ts +3 -2
  228. package/types/plugins/fix/clean-html/clean-html.d.ts +70 -0
  229. package/types/plugins/fix/{clean-html.d.ts → clean-html/config.d.ts} +2 -57
  230. package/types/plugins/fix/index.d.ts +10 -0
  231. package/types/plugins/fix/wrap-nodes/config.d.ts +16 -0
  232. package/types/plugins/fix/{wrap-text-nodes.d.ts → wrap-nodes/wrap-nodes.d.ts} +5 -2
  233. package/types/plugins/fullsize/fullsize.d.ts +2 -2
  234. package/types/plugins/index.d.ts +2 -2
  235. package/types/plugins/ordered-list/config.d.ts +6 -0
  236. package/types/plugins/ordered-list/ordered-list.d.ts +1 -1
  237. package/types/plugins/print/helpers.d.ts +2 -2
  238. package/types/plugins/print/index.d.ts +1 -1
  239. package/types/plugins/print/{preview.d.ts → preview/preview.d.ts} +1 -1
  240. package/types/plugins/search/config.d.ts +36 -0
  241. package/types/plugins/search/helpers/index.d.ts +10 -0
  242. package/types/plugins/search/helpers/sentence-finder.d.ts +21 -0
  243. package/types/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.d.ts +14 -0
  244. package/types/plugins/search/search.d.ts +25 -39
  245. package/types/plugins/search/ui/search.d.ts +37 -0
  246. package/types/plugins/spellcheck/config.d.ts +15 -0
  247. package/types/plugins/spellcheck/spellcheck.d.ts +19 -0
  248. package/types/plugins/sticky/sticky.d.ts +2 -2
  249. package/types/types/async.d.ts +12 -2
  250. package/types/types/core.d.ts +1 -1
  251. package/types/types/core.ts +1 -1
  252. package/types/types/events.d.ts +6 -2
  253. package/types/types/file-browser.d.ts +1 -2
  254. package/{src/types/observer.d.ts → types/types/history.d.ts} +11 -7
  255. package/types/types/index.d.ts +1 -1
  256. package/types/types/jodit.d.ts +12 -4
  257. package/types/types/toolbar.d.ts +5 -5
  258. package/types/types/types.d.ts +11 -4
  259. package/src/modules/observer/README.md +0 -0
  260. package/src/plugins/search/search.less +0 -152
@@ -4,67 +4,53 @@
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
6
  /**
7
+ * [[include:plugins/search/README.md]]
8
+ * @packageDocumentation
7
9
  * @module plugins/search
8
10
  */
9
- import './search.less';
10
- import type { ISelectionRange, IJodit, IPlugin } from 'jodit/types';
11
+ import type { IJodit, Nullable, IPlugin } from 'jodit/types';
12
+ import { LazyWalker } from 'jodit/core/dom';
11
13
  import { Plugin } from 'jodit/core/plugin';
12
- declare module 'jodit/config' {
13
- interface Config {
14
- /**
15
- * Enable custom search plugin
16
- * ![search](https://user-images.githubusercontent.com/794318/34545433-cd0a9220-f10e-11e7-8d26-7e22f66e266d.gif)
17
- */
18
- useSearch: boolean;
19
- }
20
- }
14
+ import './config';
21
15
  /**
22
16
  * Search plugin. it is used for custom search in text
23
17
  * ![search](https://user-images.githubusercontent.com/794318/34545433-cd0a9220-f10e-11e7-8d26-7e22f66e266d.gif)
24
18
  *
25
19
  * @example
26
20
  * ```typescript
27
- * var jodit = new Jodit('#editor', {
21
+ * var jodit = Jodit.make('#editor', {
28
22
  * useSearch: false
29
23
  * });
30
24
  * // or
31
- * var jodit = new Jodit('#editor', {
25
+ * var jodit = Jodit.make('#editor', {
32
26
  * disablePlugins: 'search'
33
27
  * });
34
28
  * ```
35
29
  */
36
30
  export declare class search extends Plugin {
37
31
  buttons: IPlugin['buttons'];
38
- static getSomePartOfStringIndex(needle: string, haystack: string, start?: boolean): number | false;
39
- static findSomePartOfString(needle: string, haystack: string, start?: boolean, getIndex?: boolean): boolean | string | number;
40
- private template;
41
- private isOpened;
42
- private selInfo;
43
- private current;
44
- private eachMap;
32
+ private get ui();
45
33
  private updateCounters;
46
- private boundAlreadyWas;
34
+ protected onPressReplaceButton(): void;
47
35
  private tryScrollToElement;
48
- searchBox: HTMLDivElement;
49
- queryInput: HTMLInputElement;
50
- replaceInput: HTMLInputElement;
51
- closeButton: HTMLButtonElement;
52
- nextButton: HTMLButtonElement;
53
- prevButton: HTMLButtonElement;
54
- replaceButton: HTMLButtonElement;
55
- counterBox: HTMLSpanElement;
56
- calcCounts: (query: string, current?: ISelectionRange | false) => [number, number];
57
- findAndReplace: (start: Node | null, query: string) => boolean;
58
- findAndSelect: (start: Node | null, query: string, next: boolean) => boolean;
59
- find: (start: Node | null, query: string, next: boolean, deep: number, range: Range) => false | ISelectionRange;
60
- open: (searchAndReplace?: boolean) => void;
61
- close: () => void;
36
+ protected calcCounts(query: string): Promise<number>;
37
+ findAndReplace(query: string): Promise<boolean>;
38
+ private previousQuery;
39
+ private drawPromise;
40
+ findAndSelect(query: string, next: boolean): Promise<boolean>;
41
+ private findCurrentIndexInRanges;
42
+ walker: Nullable<LazyWalker>;
43
+ walkerCount: Nullable<LazyWalker>;
44
+ private cache;
45
+ private isValidCache;
46
+ private find;
47
+ private wrapFrameRequest;
48
+ private drawSelectionRanges;
49
+ protected onAfterGetValueFromEditor(data: {
50
+ value: string;
51
+ }): void;
62
52
  /** @override */
63
53
  afterInit(editor: IJodit): void;
64
54
  /** @override */
65
55
  beforeDestruct(jodit: IJodit): void;
66
- /**
67
- * Calculate position if sticky is enabled
68
- */
69
- private calcSticky;
70
56
  }
@@ -0,0 +1,37 @@
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module plugins/search
8
+ */
9
+ import './search.less';
10
+ import type { IJodit, MarkerInfo, Nullable } from 'jodit/types';
11
+ import { UIElement } from 'jodit/core/ui';
12
+ export declare class UISearch extends UIElement<IJodit> {
13
+ className(): string;
14
+ private queryInput;
15
+ private replaceInput;
16
+ selInfo: Nullable<MarkerInfo[]>;
17
+ private closeButton;
18
+ private replaceButton;
19
+ private currentBox;
20
+ private countBox;
21
+ render(): string;
22
+ private _currentIndex;
23
+ get currentIndex(): number;
24
+ set currentIndex(value: number);
25
+ set count(value: number);
26
+ get query(): string;
27
+ get replace(): string;
28
+ constructor(jodit: IJodit);
29
+ protected onEditorKeyDown(e: KeyboardEvent): void;
30
+ isOpened: boolean;
31
+ open(searchAndReplace?: boolean): void;
32
+ close(): void;
33
+ /**
34
+ * Calculate position if sticky is enabled
35
+ */
36
+ private calcSticky;
37
+ }
@@ -0,0 +1,15 @@
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ declare module 'jodit/config' {
7
+ interface Config {
8
+ /**
9
+ * Options specifies whether the editor is to have its spelling and grammar checked or not
10
+ * @see {@link http://www.w3schools.com/tags/att_global_spellcheck.asp}
11
+ */
12
+ spellcheck: boolean;
13
+ }
14
+ }
15
+ export {};
@@ -0,0 +1,19 @@
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * [[include:plugins/spellcheck/README.md]]
8
+ * @packageDocumentation
9
+ * @module plugins/spellcheck
10
+ */
11
+ import type { IJodit } from 'jodit/types';
12
+ import { Plugin } from 'jodit/core/plugin';
13
+ import './config';
14
+ export declare class spellcheck extends Plugin {
15
+ buttons: Plugin['buttons'];
16
+ protected afterInit(jodit: IJodit): void;
17
+ private toggleSpellcheck;
18
+ protected beforeDestruct(jodit: IJodit): void;
19
+ }
@@ -14,7 +14,7 @@ declare module 'jodit/config' {
14
14
  /**
15
15
  * @example
16
16
  * ```javascript
17
- * var editor = new Jodit('#someid', {
17
+ * var editor = Jodit.make('#someid', {
18
18
  * toolbarSticky: false
19
19
  * })
20
20
  * ```
@@ -27,7 +27,7 @@ declare module 'jodit/config' {
27
27
  *
28
28
  * @example
29
29
  * ```javascript
30
- * var editor = new Jodit('#someid', {
30
+ * var editor = Jodit.make('#someid', {
31
31
  * toolbarStickyOffset: 100
32
32
  * })
33
33
  * ```
@@ -61,7 +61,17 @@ export interface IAsync extends IDestructible {
61
61
  firstCallImmediately?: boolean
62
62
  ): CallbackFunction;
63
63
 
64
- requestIdleCallback(fn: IdleRequestCallback): number;
65
- requestIdlePromise(): RejectablePromise<number>;
64
+ requestIdleCallback(fn: IdleRequestCallback, options?: {timeout: number}): number;
65
+ requestIdlePromise(options?: {timeout: number}): RejectablePromise<number>;
66
66
  cancelIdleCallback(request: number): void;
67
+
68
+ /**
69
+ * Smart wrapper for `requestAnimationFrame`
70
+ */
71
+ requestAnimationFrame(callback: FrameRequestCallback): number;
72
+
73
+ /**
74
+ * Smart wrapper for `cancelAnimationFrame`
75
+ */
76
+ cancelAnimationFrame(request: number): void;
67
77
  }
@@ -7,4 +7,4 @@
7
7
  * @module types
8
8
  */
9
9
  import type { IComponent, IDictionary } from './types';
10
- export declare type DecoratorHandler = <T extends IComponent & IDictionary>(target: T, propertyKey: string) => void;
10
+ export declare type DecoratorHandler = <T extends IComponent & IDictionary>(target: T, propertyKey: string) => void | PropertyDescriptor;
@@ -13,4 +13,4 @@ import type { IComponent, IDictionary } from './types';
13
13
  export type DecoratorHandler = <T extends IComponent & IDictionary>(
14
14
  target: T,
15
15
  propertyKey: string
16
- ) => void;
16
+ ) => void | PropertyDescriptor;
@@ -171,9 +171,9 @@ interface IEventEmitter extends IDestructible {
171
171
  * events.fire(document.body.querySelector('div'), 'click');
172
172
  * ```
173
173
  */
174
- fire(subjectOrEvents: string, ...args: any[]): any;
174
+ fire(eventsList: string, ...args: any[]): any;
175
175
  fire(
176
- subjectOrEvents: object,
176
+ subject: object,
177
177
  eventsList: string | Event,
178
178
  ...args: any[]
179
179
  ): any;
@@ -183,3 +183,7 @@ interface IEventEmitter extends IDestructible {
183
183
  ...args: any[]
184
184
  ): any;
185
185
  }
186
+
187
+ export interface IObservable {
188
+ on(event: string | string[], callback: CallbackFunction): this;
189
+ }
@@ -18,8 +18,7 @@ import type {
18
18
  import type { IUploader, IUploaderOptions } from './uploader';
19
19
  import type { IViewBased, IViewOptions } from './view';
20
20
  import type { IUIGroup } from './ui';
21
- import type { IObservable } from './observer';
22
- import type { IDialog } from './dialog';
21
+ import type { IObservable } from './events';
23
22
 
24
23
  /**
25
24
  * The module creates a web browser dialog box. In a Web browser ,you can select an image, remove, drag it. Upload new
@@ -15,16 +15,14 @@ import type {
15
15
  SnapshotType
16
16
  } from './types';
17
17
 
18
- export interface IObservable {
19
- on(event: string | string[], callback: CallbackFunction): this;
20
- }
21
-
22
18
  export interface ICommand {
19
+ tick: number;
23
20
  undo(): void;
24
21
  redo(): void;
25
22
  }
26
23
 
27
24
  export interface IStack {
25
+ readonly length: number;
28
26
  clear(): void;
29
27
  push(command: ICommand): void;
30
28
  replace(command: ICommand): void;
@@ -36,17 +34,23 @@ export interface IStack {
36
34
  }
37
35
 
38
36
  export interface ISnapshot {
37
+ isBlocked: boolean;
39
38
  make(): SnapshotType;
40
39
  restoreOnlySelection(snapshot: SnapshotType): void;
41
40
  restore(snapshot: SnapshotType): void;
42
41
  }
43
42
 
44
- export interface IObserver extends IComponent {
45
- stack: IStack;
43
+ export interface IHistory {
46
44
  snapshot: ISnapshot;
45
+
47
46
  redo(): void;
47
+ canRedo(): boolean;
48
48
  undo(): void;
49
+ canUndo(): boolean;
50
+ readonly length: number;
51
+
52
+ processChanges(): void;
53
+
49
54
  clear(): void;
50
- replaceSnapshot(): void;
51
55
  upTick(): void;
52
56
  }
@@ -17,7 +17,7 @@ export * from './dialog';
17
17
  export * from './events';
18
18
  export * from './file-browser';
19
19
  export * from './jodit';
20
- export * from './observer';
20
+ export * from './history';
21
21
  export * from './select';
22
22
  export * from './plugin';
23
23
  export * from './popup';
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { IViewOptions, IViewWithToolbar } from './view';
12
12
  import type { Config } from 'jodit/config';
13
- import type { CustomCommand, ICreate, IObserver, IStatusBar, Modes } from './';
13
+ import type { CustomCommand, ICreate, IDestructible, IHistory, IStatusBar, Modes } from './';
14
14
  import type { IUploader } from './uploader';
15
15
  import type { IFileBrowser } from './file-browser';
16
16
  import { ISelect } from './select';
@@ -23,7 +23,7 @@ interface IWorkPlace {
23
23
  statusbar: IStatusBar;
24
24
  iframe?: HTMLIFrameElement | void;
25
25
  editorWindow: Window;
26
- observer: IObserver;
26
+ history: IHistory & IDestructible;
27
27
  options: IViewOptions;
28
28
  }
29
29
 
@@ -31,13 +31,21 @@ interface IJodit extends IViewWithToolbar {
31
31
  isJodit: true;
32
32
 
33
33
  options: Config;
34
- observer: IObserver;
34
+
35
+ history: IHistory;
36
+
37
+ /**
38
+ * @deprecated Instead use `Jodit.history`
39
+ */
40
+ observer: IHistory;
41
+
35
42
  editor: HTMLElement;
36
43
  element: HTMLElement;
37
44
 
38
45
  getNativeEditorValue(): string;
39
46
  getEditorValue(removeSelectionMarkers?: boolean, consumer?: string): string;
40
47
  setEditorValue(value?: string): void;
48
+ synchronizeValues(): void;
41
49
 
42
50
  getReadOnly(): boolean;
43
51
  setReadOnly(enable: boolean): void;
@@ -82,7 +90,7 @@ interface IJodit extends IViewWithToolbar {
82
90
  *
83
91
  * @example
84
92
  * ```javascript
85
- * var editor = new Jodit('#editor');
93
+ * var editor = Jodit.make('#editor');
86
94
  * console.log(editor.getRealMode());
87
95
  * ```
88
96
  */
@@ -44,7 +44,7 @@ interface IControlType<
44
44
  * @see copyformat plugin
45
45
  * @example
46
46
  * ```javascript
47
- * var editor = new Jodit('.selectorclass', {
47
+ * var editor = Jodit.make('.selectorclass', {
48
48
  * buttons: {
49
49
  * checkbox: {
50
50
  * data: {
@@ -82,7 +82,7 @@ interface IControlType<
82
82
  * @see copyformat plugin
83
83
  * @example
84
84
  * ```javascript
85
- * var editor = new Jodit('.selectorclass', {
85
+ * var editor = Jodit.make('.selectorclass', {
86
86
  * buttons: {
87
87
  * checkbox: {
88
88
  * data: {
@@ -117,7 +117,7 @@ interface IControlType<
117
117
  * (or array value) (see .[[Jodit.execCommand]] or define 'exec' function. See example
118
118
  * @example
119
119
  * ```javascript
120
- * new Jodit('#editor2', {
120
+ * Jodit.make('#editor2', {
121
121
  * buttons: Jodit.defaultOptions.buttons.concat([{
122
122
  * name: 'listsss',
123
123
  * iconURL: 'stuf/dummy.png',
@@ -164,7 +164,7 @@ interface IControlType<
164
164
  * String name for existing icons.
165
165
  * @example
166
166
  * ```javascript
167
- * var editor = new Jodit('.editor', {
167
+ * var editor = Jodit.make('.editor', {
168
168
  * buttons: [
169
169
  * {
170
170
  * icon: 'source',
@@ -216,7 +216,7 @@ interface IControlType<
216
216
  * After click on the button it will show popup element which consist value that this function returned
217
217
  * @example
218
218
  * ```javascript
219
- * var editor = new Jodit('.editor', {
219
+ * var editor = Jodit.make('.editor', {
220
220
  * buttons: [
221
221
  * {
222
222
  * icon: "insertCode",
@@ -110,10 +110,10 @@ export interface IPointBound extends IPoint {
110
110
  }
111
111
 
112
112
  export interface ISelectionRange {
113
- startContainer: Node | null;
114
- startOffset: number | null;
115
- endContainer: Node | null;
116
- endOffset: number | null;
113
+ startContainer: Text;
114
+ startOffset: number;
115
+ endContainer: Text;
116
+ endOffset: number;
117
117
  }
118
118
 
119
119
  export interface IRGB {
@@ -275,3 +275,10 @@ declare global {
275
275
  buffer?: IDictionary;
276
276
  }
277
277
  }
278
+
279
+ export interface FuzzySearch {
280
+ (needle: string, haystack: string, offset?: number, maxDistance?: number): [
281
+ number,
282
+ number
283
+ ];
284
+ }
File without changes
@@ -1,152 +0,0 @@
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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- @import (reference) '../../styles/variables';
8
-
9
- :root {
10
- --height-search: 30px;
11
- --width-search: 320px;
12
- --width-search-input-box: 60%;
13
- --width-search-count-box: 15%;
14
- --transform-button-active: 0.95;
15
- --timeout-button-active: 0.1s;
16
- }
17
-
18
- .jodit-search {
19
- position: absolute;
20
- top: 0;
21
- right: 0;
22
- width: 0;
23
- height: 0;
24
-
25
- visibility: hidden;
26
-
27
- &_sticky {
28
- position: fixed;
29
- }
30
-
31
- &.jodit-search_active {
32
- visibility: visible;
33
- }
34
-
35
- .jodit-search__box {
36
- position: absolute;
37
- right: 0;
38
-
39
- display: flex;
40
-
41
- width: var(--width-search);
42
- max-width: 100vw;
43
- padding: calc(var(--padding-default) / 2);
44
-
45
- border: solid var(--color-border);
46
- border-width: 0 0 1px 1px;
47
- background-color: var(--color-panel);
48
-
49
- input {
50
- width: 100%;
51
- height: 100%;
52
- padding: 0 var(--padding-default);
53
- border: 0;
54
- margin: 0;
55
- background-color: transparent;
56
- outline: none;
57
-
58
- &[data-ref='replace'] {
59
- display: none;
60
- }
61
- }
62
-
63
- input:not(:focus) + input:not(:focus) {
64
- border-top: 1px solid var(--color-border);
65
- }
66
-
67
- .jodit-search__buttons,
68
- .jodit-search__counts,
69
- .jodit-search__inputs {
70
- height: var(--height-search);
71
- }
72
-
73
- .jodit-search__inputs {
74
- width: var(--width-search-input-box);
75
- padding-right: calc(var(--padding-default) / 2);
76
- }
77
-
78
- .jodit-search__counts {
79
- display: flex;
80
- width: var(--width-search-count-box);
81
- align-items: center;
82
- justify-content: center;
83
- border-left: 1px solid var(--color-border);
84
- color: var(--color-border);
85
- }
86
-
87
- .jodit-search__buttons {
88
- display: flex;
89
- flex: 1;
90
- align-items: center;
91
- justify-content: center;
92
- padding-left: 0;
93
-
94
- button {
95
- width: 32%;
96
- height: 100%;
97
- border: 1px solid transparent;
98
- margin-right: 1%;
99
- background-color: transparent;
100
-
101
- &[data-ref='replace-btn'] {
102
- display: none;
103
- width: 100%;
104
- border: 1px solid var(--color-border);
105
- margin-top: 2px;
106
- }
107
-
108
- &:hover {
109
- background-color: var(--color-background-button-hover);
110
- }
111
-
112
- &:focus {
113
- border: 1px solid
114
- var(--color-background-selection_opacity50);
115
- }
116
-
117
- &:active {
118
- border: 1px solid var(--color-background-selection);
119
- transform: scale(
120
- var(--transform-button-active),
121
- var(--transform-button-active)
122
- );
123
- }
124
- }
125
- }
126
- }
127
-
128
- &.jodit-search_replace {
129
- .jodit-search__counts,
130
- .jodit-search__inputs {
131
- height: calc(var(--height-search) * 2);
132
-
133
- input {
134
- height: 50%;
135
- transition: background-color var(--timeout-button-active) linear;
136
-
137
- &:focus {
138
- box-shadow: inset 0 0 3px 0 var(--color-border);
139
- }
140
- }
141
- }
142
-
143
- .jodit-search__buttons {
144
- flex-wrap: wrap;
145
- }
146
-
147
- .jodit-search__inputs input[data-ref='replace'],
148
- .jodit-search__buttons button[data-ref='replace-btn'] {
149
- display: block;
150
- }
151
- }
152
- }