jodit 3.23.3 → 3.24.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 (175) hide show
  1. package/README.md +4 -4
  2. package/build/jodit.css +8 -3
  3. package/build/jodit.es2018.css +7 -2
  4. package/build/jodit.es2018.en.css +7 -2
  5. package/build/jodit.es2018.en.js +8384 -7869
  6. package/build/jodit.es2018.en.min.css +1 -1
  7. package/build/jodit.es2018.en.min.js +1 -1
  8. package/build/jodit.es2018.js +8384 -7869
  9. package/build/jodit.es2018.min.css +1 -1
  10. package/build/jodit.es2018.min.js +1 -1
  11. package/build/jodit.js +2954 -2414
  12. package/build/jodit.min.css +2 -2
  13. package/build/jodit.min.js +1 -1
  14. package/build/plugins/debug/debug.es2018.en.js +8 -8
  15. package/build/plugins/debug/debug.es2018.en.min.js +1 -1
  16. package/build/plugins/debug/debug.es2018.js +8 -8
  17. package/build/plugins/debug/debug.es2018.min.js +1 -1
  18. package/build/plugins/debug/debug.js +8 -8
  19. package/build/plugins/debug/debug.min.js +1 -1
  20. package/build/plugins/speech-recognize/speech-recognize.css +1 -1
  21. package/build/plugins/speech-recognize/speech-recognize.es2018.css +1 -1
  22. package/build/plugins/speech-recognize/speech-recognize.es2018.en.css +1 -1
  23. package/build/plugins/speech-recognize/speech-recognize.es2018.en.js +38 -38
  24. package/build/plugins/speech-recognize/speech-recognize.es2018.en.min.js +1 -1
  25. package/build/plugins/speech-recognize/speech-recognize.es2018.js +38 -38
  26. package/build/plugins/speech-recognize/speech-recognize.es2018.min.js +1 -1
  27. package/build/plugins/speech-recognize/speech-recognize.js +30 -30
  28. package/build/plugins/speech-recognize/speech-recognize.min.js +1 -1
  29. package/build/vdom.css +12 -1
  30. package/build/vdom.js +1445 -41
  31. package/package.json +23 -23
  32. package/src/core/constants.ts +10 -8
  33. package/src/core/dom/dom.test.js +25 -0
  34. package/src/core/dom/dom.ts +90 -41
  35. package/src/core/helpers/checker/has-browser-color-picker.ts +2 -2
  36. package/src/core/helpers/checker/index.ts +1 -0
  37. package/src/core/helpers/checker/is-boolean.ts +1 -1
  38. package/src/core/helpers/checker/is-marker.ts +20 -0
  39. package/src/core/helpers/normalize/normalize-css-value.ts +19 -0
  40. package/src/core/helpers/normalize/normalize-node.ts +2 -2
  41. package/src/core/helpers/size/position.test.js +198 -187
  42. package/src/core/helpers/utils/css.ts +7 -14
  43. package/src/core/plugin/plugin.ts +1 -1
  44. package/src/core/selection/interface.ts +24 -0
  45. package/src/core/selection/select.ts +69 -29
  46. package/src/core/selection/selection.test.js +5 -17
  47. package/src/core/selection/style/api/extract.ts +6 -7
  48. package/src/core/selection/style/api/finite-state-machine.ts +40 -35
  49. package/src/core/selection/style/api/get-suit-child.ts +3 -4
  50. package/src/core/selection/style/api/get-suit-parent.ts +3 -4
  51. package/src/core/selection/style/api/{element-has-same-style.ts → has-same-style.ts} +25 -6
  52. package/src/core/selection/style/api/index.ts +6 -6
  53. package/src/core/selection/style/api/is-inside-invisible-element.ts +1 -1
  54. package/src/core/selection/style/api/is-normal-node.ts +3 -3
  55. package/src/core/selection/style/api/is-same-attributes.ts +56 -0
  56. package/src/core/selection/style/api/is-suit-element.ts +22 -12
  57. package/src/core/selection/style/api/list/toggle-ordered-list.ts +100 -0
  58. package/src/core/selection/style/api/list/wrap-list.ts +71 -0
  59. package/src/core/selection/style/api/toggle-attributes.ts +251 -0
  60. package/src/core/selection/style/api/unwrap-children.ts +10 -8
  61. package/src/core/selection/style/api/wrap-unwrapped-text.ts +7 -8
  62. package/src/core/selection/style/api/{wrap-and-commit-style.ts → wrap.ts} +8 -11
  63. package/src/core/selection/style/apply-style.ts +32 -181
  64. package/src/core/selection/style/commit-style.ts +79 -4
  65. package/src/core/selection/style/style.test.js +457 -128
  66. package/src/core/selection/style/transactions.ts +256 -0
  67. package/src/core/ui/button/tooltip/tooltip.test.js +95 -76
  68. package/src/core/ui/popup/popup.test.js +158 -153
  69. package/src/{plugins/backspace/interface.d.ts → core/vdom/on-demand.ts} +7 -5
  70. package/src/core/vdom/render/index.ts +2 -4
  71. package/src/core/vdom/render/patcher.ts +14 -0
  72. package/src/core/vdom/v-dom-jodit.less +17 -0
  73. package/src/core/vdom/v-dom-jodit.ts +102 -3
  74. package/src/core/view/view.ts +2 -2
  75. package/src/index.ts +2 -0
  76. package/src/jodit.ts +5 -1
  77. package/src/langs/i18n.test.js +221 -216
  78. package/src/modules/dialog/dialog.less +9 -1
  79. package/src/modules/dialog/dialog.ts +25 -16
  80. package/src/modules/file-browser/data-provider.ts +44 -12
  81. package/src/modules/file-browser/file-browser.test.js +1019 -958
  82. package/src/modules/file-browser/file-browser.ts +0 -1
  83. package/src/modules/messages/messages.ts +3 -8
  84. package/src/plugins/backspace/backspace.test.js +2 -9
  85. package/src/plugins/backspace/backspace.ts +5 -0
  86. package/src/plugins/backspace/cases/check-join-neighbors.ts +7 -1
  87. package/src/plugins/backspace/cases/check-join-two-lists.ts +2 -1
  88. package/src/plugins/backspace/helpers.ts +9 -1
  89. package/src/plugins/backspace/interface.ts +31 -0
  90. package/src/plugins/clean-html/helpers/visitor/filters/fill-empty-paragraph.ts +2 -1
  91. package/src/plugins/color/color.test.js +122 -119
  92. package/src/plugins/enter/enter.test.js +18 -5
  93. package/src/plugins/enter/enter.ts +9 -5
  94. package/src/plugins/enter/interface.ts +41 -0
  95. package/src/plugins/font/config.ts +8 -8
  96. package/src/plugins/font/font.test.js +18 -23
  97. package/src/plugins/hotkeys/hotkeys.test.js +35 -47
  98. package/src/plugins/iframe/iframe.test.js +206 -195
  99. package/src/plugins/image/image.ts +1 -1
  100. package/src/plugins/image-properties/config.ts +22 -0
  101. package/src/plugins/image-properties/image-properties.test.js +174 -93
  102. package/src/plugins/image-properties/templates/position-tab.ts +22 -1
  103. package/src/plugins/indent/indent.test.js +2 -8
  104. package/src/plugins/link/link.test.js +19 -0
  105. package/src/plugins/link/link.ts +25 -15
  106. package/src/plugins/placeholder/placeholder.ts +8 -7
  107. package/src/plugins/size/size.test.js +239 -225
  108. package/src/plugins/tab/cases/on-tab-inside-li.ts +131 -22
  109. package/src/plugins/tab/tab.test.js +95 -11
  110. package/src/plugins/tab/tab.ts +22 -2
  111. package/src/plugins/wrap-nodes/config.ts +11 -0
  112. package/src/plugins/wrap-nodes/wrap-nodes.ts +0 -1
  113. package/src/types/events.d.ts +4 -0
  114. package/src/types/file-browser.d.ts +17 -10
  115. package/src/types/select.d.ts +6 -1
  116. package/src/types/style.d.ts +72 -5
  117. package/src/types/uploader.d.ts +14 -0
  118. package/src/types/view.d.ts +2 -2
  119. package/types/core/async/async.d.ts +1 -1
  120. package/types/core/constants.d.ts +3 -3
  121. package/types/core/dom/dom.d.ts +6 -3
  122. package/types/core/helpers/checker/index.d.ts +1 -0
  123. package/types/core/helpers/checker/is-boolean.d.ts +1 -1
  124. package/types/core/helpers/checker/is-marker.d.ts +10 -0
  125. package/types/core/helpers/html/safe-html.d.ts +1 -1
  126. package/types/core/helpers/normalize/normalize-css-value.d.ts +2 -0
  127. package/types/core/helpers/normalize/normalize-node.d.ts +1 -1
  128. package/types/core/helpers/utils/append-script.d.ts +1 -1
  129. package/types/core/selection/interface.d.ts +19 -0
  130. package/types/core/selection/select.d.ts +22 -5
  131. package/types/core/selection/style/api/finite-state-machine.d.ts +10 -9
  132. package/types/core/selection/style/api/get-suit-child.d.ts +2 -3
  133. package/types/core/selection/style/api/get-suit-parent.d.ts +2 -3
  134. package/types/core/selection/style/api/{element-has-same-style.d.ts → has-same-style.d.ts} +2 -2
  135. package/types/core/selection/style/api/index.d.ts +6 -6
  136. package/types/core/selection/style/api/is-same-attributes.d.ts +12 -0
  137. package/types/core/selection/style/api/is-suit-element.d.ts +4 -4
  138. package/types/core/selection/style/api/{toggle → list}/toggle-ordered-list.d.ts +2 -3
  139. package/types/core/selection/style/api/{wrap-ordered-list.d.ts → list/wrap-list.d.ts} +2 -3
  140. package/types/core/selection/style/api/toggle-attributes.d.ts +11 -0
  141. package/types/core/selection/style/api/unwrap-children.d.ts +2 -2
  142. package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -3
  143. package/types/core/selection/style/api/{wrap-and-commit-style.d.ts → wrap.d.ts} +2 -3
  144. package/types/core/selection/style/apply-style.d.ts +3 -3
  145. package/types/core/selection/style/commit-style.d.ts +6 -2
  146. package/types/core/selection/style/transactions.d.ts +29 -0
  147. package/types/core/ui/popup/popup.d.ts +1 -1
  148. package/types/core/view/view.d.ts +1 -1
  149. package/types/index.d.ts +2 -0
  150. package/types/modules/file-browser/builders/elements-map.d.ts +1 -1
  151. package/types/modules/file-browser/data-provider.d.ts +5 -0
  152. package/types/modules/messages/messages.d.ts +2 -1
  153. package/types/plugins/backspace/helpers.d.ts +5 -1
  154. package/types/plugins/backspace/interface.d.ts +21 -0
  155. package/types/plugins/enter/enter.d.ts +2 -0
  156. package/types/plugins/enter/interface.d.ts +32 -0
  157. package/types/plugins/image-properties/config.d.ts +19 -0
  158. package/types/plugins/link/link.d.ts +1 -1
  159. package/types/plugins/paste/interface.d.ts +2 -2
  160. package/types/plugins/tab/cases/on-tab-inside-li.d.ts +1 -1
  161. package/types/plugins/wrap-nodes/config.d.ts +10 -0
  162. package/types/types/events.d.ts +4 -0
  163. package/types/types/file-browser.d.ts +17 -10
  164. package/types/types/select.d.ts +6 -1
  165. package/types/types/storage.d.ts +1 -1
  166. package/types/types/style.d.ts +72 -5
  167. package/types/types/uploader.d.ts +14 -0
  168. package/types/types/view.d.ts +2 -2
  169. package/vdom.html +20 -0
  170. package/src/core/selection/style/api/toggle/toggle-css.ts +0 -136
  171. package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +0 -54
  172. package/src/core/selection/style/api/toggle-commit-styles.ts +0 -35
  173. package/src/core/selection/style/api/wrap-ordered-list.ts +0 -42
  174. package/types/core/selection/style/api/toggle/toggle-css.d.ts +0 -12
  175. package/types/core/selection/style/api/toggle-commit-styles.d.ts +0 -13
@@ -0,0 +1,10 @@
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
+ import type { Nullable } from '../../../types';
7
+ /**
8
+ * Define element is selection helper
9
+ */
10
+ export declare function isMarker(elm: Nullable<Node>): elm is HTMLElement;
@@ -3,7 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- declare type safeOptions = {
6
+ type safeOptions = {
7
7
  removeOnError: boolean;
8
8
  safeJavaScriptLink: boolean;
9
9
  };
@@ -3,4 +3,6 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
+ export declare const NUMBER_FIELDS_REG: RegExp;
7
+ export declare function normalizeCssNumericValue(key: string, value: string | number | undefined | null): string | number | undefined | null;
6
8
  export declare function normalizeCssValue(key: string, value: string | number): string | number;
@@ -3,4 +3,4 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export declare const normalizeNode: (node: Node | null) => void;
6
+ export declare function normalizeNode(node: Node | null): void;
@@ -7,7 +7,7 @@
7
7
  * @module helpers/utils
8
8
  */
9
9
  import type { IViewBased } from '../../../types';
10
- export declare type Loader = (jodit: IViewBased, url: string) => Promise<any>;
10
+ export type Loader = (jodit: IViewBased, url: string) => Promise<any>;
11
11
  export interface CallbackAndElement {
12
12
  callback: EventListener;
13
13
  element: HTMLElement;
@@ -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
+ * @module selection
8
+ */
9
+ declare module '../../types/events' {
10
+ interface IEventEmitter {
11
+ /**
12
+ * The cursorInTheEdge method checks whether the cursor is at the beginning or at the end of the element,
13
+ * this event allows you to override the logic
14
+ * determining whether the element before/after the cursor is significant for its position
15
+ * true - element is not significant
16
+ */
17
+ on(event: 'isInvisibleForCursor', callback: (elm: HTMLElement) => void | true): this;
18
+ }
19
+ }
@@ -8,7 +8,8 @@
8
8
  * @packageDocumentation
9
9
  * @module selection
10
10
  */
11
- import type { CanUndef, HTMLTagNames, IDictionary, IJodit, ISelect, IStyle, MarkerInfo, Nullable } from '../../types';
11
+ import type { CanUndef, HTMLTagNames, IDictionary, IJodit, ISelect, IStyle, IStyleOptions, MarkerInfo, Nullable } from '../../types';
12
+ import './interface';
12
13
  export declare class Select implements ISelect {
13
14
  readonly jodit: IJodit;
14
15
  constructor(jodit: IJodit);
@@ -69,10 +70,6 @@ export declare class Select implements ISelect {
69
70
  * @returns false - Something went wrong
70
71
  */
71
72
  insertCursorAtPoint(x: number, y: number): boolean;
72
- /**
73
- * Define element is selection helper
74
- */
75
- static isMarker(elm: Nullable<Node>): elm is HTMLElement;
76
73
  /**
77
74
  * Check if editor has selection markers
78
75
  */
@@ -206,6 +203,23 @@ export declare class Select implements ISelect {
206
203
  * Wrap all selected fragments inside Tag or apply some callback
207
204
  */
208
205
  wrapInTag(tagOrCallback: HTMLTagNames | ((font: HTMLElement) => any)): HTMLElement[];
206
+ /**
207
+ * Apply some css rules for all selections. It method wraps selections in nodeName tag.
208
+ * @example
209
+ * ```js
210
+ * const editor = Jodit.make('#editor');
211
+ * editor.value = 'test';
212
+ * editor.execCommand('selectall');
213
+ *
214
+ * editor.s.commitStyle({
215
+ * style: {color: 'red'}
216
+ * }) // will wrap `text` in `span` and add style `color:red`
217
+ * editor.s.commitStyle({
218
+ * style: {color: 'red'}
219
+ * }) // will remove `color:red` from `span`
220
+ * ```
221
+ */
222
+ commitStyle(options: IStyleOptions): void;
209
223
  /**
210
224
  * Apply some css rules for all selections. It method wraps selections in nodeName tag.
211
225
  * @example
@@ -217,13 +231,16 @@ export declare class Select implements ISelect {
217
231
  * editor.s.applyStyle({color: 'red'}) // will wrap `text` in `span` and add style `color:red`
218
232
  * editor.s.applyStyle({color: 'red'}) // will remove `color:red` from `span`
219
233
  * ```
234
+ * @deprecated
220
235
  */
221
236
  applyStyle(style: CanUndef<IStyle>, options?: {
222
237
  /**
223
238
  * equal CSSRule (e.g. strong === font-weight: 700)
224
239
  */
225
240
  element?: HTMLTagNames;
241
+ /** @deprecated Instead use attributes.class*/
226
242
  className?: string;
243
+ attributes?: IDictionary<string | number>;
227
244
  /**
228
245
  * tag for wrapping and apply styles
229
246
  */
@@ -3,19 +3,20 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { CanUndef, IDictionary } from '../../../../types';
6
+ import type { IDictionary } from '../../../../types';
7
7
  /**
8
8
  * A state machine implementation for applying styles.
9
9
  */
10
- export declare class FiniteStateMachine {
11
- private state;
10
+ export declare class FiniteStateMachine<K extends string, V extends object & {
11
+ next: K;
12
+ }, T extends IDictionary<IDictionary<(value: V) => V>, K> = IDictionary<IDictionary<(...attrs: any[]) => any>, K>, A extends keyof T[K] = keyof T[K]> {
12
13
  private readonly transitions;
13
- setState(state: string, subState?: string): void;
14
- private subState;
15
- getState(): string;
16
- getSubState(): string;
14
+ private __state;
15
+ private setState;
16
+ getState(): K;
17
17
  private silent;
18
18
  disableSilent(): void;
19
- constructor(state: string, transitions: IDictionary<IDictionary<(this: FiniteStateMachine, ...attrs: any[]) => any>>);
20
- dispatch<T>(actionName: string, ...attrs: any[]): CanUndef<T>;
19
+ private __previewsStates;
20
+ constructor(state: K, transitions: T);
21
+ dispatch(actionName: A, value: V): V;
21
22
  }
@@ -3,8 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { Nullable } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { Nullable, ICommitStyle } from '../../../../types';
8
7
  /**
9
8
  * Checks if child elements are suitable for applying styles.
10
9
  * An element is suitable for us only if it is the only significant child.
@@ -13,4 +12,4 @@ import type { CommitStyle } from '../commit-style';
13
12
  * `<font><strong>selected</strong></font>`
14
13
  * @private
15
14
  */
16
- export declare function getSuitChild(style: CommitStyle, font: HTMLElement): Nullable<HTMLElement>;
15
+ export declare function getSuitChild(style: ICommitStyle, font: HTMLElement): Nullable<HTMLElement>;
@@ -3,8 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { Nullable } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { Nullable, ICommitStyle } from '../../../../types';
8
7
  /**
9
8
  * Checks if the parent of an element is suitable for applying styles, if applicable, then returns the parent *
10
9
  *
@@ -13,4 +12,4 @@ import type { CommitStyle } from '../commit-style';
13
12
  * @param root - editor root
14
13
  * @private
15
14
  */
16
- export declare function getSuitParent(style: CommitStyle, node: Node, root: Node): Nullable<HTMLElement>;
15
+ export declare function getSuitParent(style: ICommitStyle, node: Node, root: Node): Nullable<HTMLElement>;
@@ -8,8 +8,8 @@ import type { IStyle } from '../../../../types';
8
8
  * Element has the same styles as in the commit
9
9
  * @private
10
10
  */
11
- export declare function elementHasSameStyle(elm: Node, rules: IStyle): boolean;
11
+ export declare function hasSameStyle(elm: Node, rules: IStyle): boolean;
12
12
  /**
13
13
  * Element has the similar styles
14
14
  */
15
- export declare function elementHasSameStyleKeys(elm: Node, rules: IStyle): boolean;
15
+ export declare function hasSameStyleKeys(elm: Node, rules: IStyle): boolean;
@@ -3,18 +3,18 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- export * from './toggle/toggle-css';
7
- export * from './toggle/toggle-ordered-list';
8
- export * from './element-has-same-style';
6
+ export * from './toggle-attributes';
7
+ export * from './list/toggle-ordered-list';
8
+ export * from './list/wrap-list';
9
+ export * from './has-same-style';
9
10
  export * from './extract';
10
11
  export * from './finite-state-machine';
11
12
  export * from './get-suit-child';
12
13
  export * from './get-suit-parent';
13
14
  export * from './is-inside-invisible-element';
15
+ export * from './is-same-attributes';
14
16
  export * from './is-normal-node';
15
17
  export * from './is-suit-element';
16
- export * from './toggle-commit-styles';
17
18
  export * from './unwrap-children';
18
- export * from './wrap-and-commit-style';
19
- export * from './wrap-ordered-list';
19
+ export * from './wrap';
20
20
  export * from './wrap-unwrapped-text';
@@ -0,0 +1,12 @@
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
+ import type { IDictionary } from '../../../../types';
7
+ /**
8
+ * Compares whether the given attributes match the element's own attributes
9
+ * @private
10
+ */
11
+ export declare function isSameAttributes(elm: HTMLElement, attrs?: IDictionary): elm is HTMLElement;
12
+ export declare function elementsEqualAttributes(elm1: HTMLElement, elm2: HTMLElement): boolean;
@@ -3,8 +3,7 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { Nullable } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { Nullable, ICommitStyle } from '../../../../types';
8
7
  /**
9
8
  * Checks if an item is suitable for applying a commit. The element suits us if it
10
9
  * - has the same styles as in the commit (commitStyle.options.style)
@@ -15,7 +14,8 @@ import type { CommitStyle } from '../commit-style';
15
14
  * @param strict - strict mode - false - the default tag is suitable for us if it is also in the commit
16
15
  * @private
17
16
  */
18
- export declare function isSuitElement(commitStyle: CommitStyle, elm: Nullable<Node>, strict: boolean): elm is HTMLElement;
17
+ export declare function isSuitElement(commitStyle: ICommitStyle, elm: Nullable<Node>, strict: boolean): elm is HTMLElement;
18
+ export declare function findSuitClosest(commitStyle: ICommitStyle, element: HTMLElement, root: HTMLElement): Nullable<HTMLElement>;
19
19
  /**
20
20
  * Inside the parent element there is a block with the same styles
21
21
  * @example
@@ -25,4 +25,4 @@ export declare function isSuitElement(commitStyle: CommitStyle, elm: Nullable<No
25
25
  * ```
26
26
  * Apply `{element:'strong'}`
27
27
  */
28
- export declare function isSameStyleChild(commitStyle: CommitStyle, elm: Nullable<Node>): elm is HTMLElement;
28
+ export declare function isSameStyleChild(commitStyle: ICommitStyle, elm: Nullable<Node>): elm is HTMLElement;
@@ -3,10 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { IJodit, CommitMode } from '../../../../../types';
7
- import type { CommitStyle } from '../../commit-style';
6
+ import type { IJodit, CommitMode, ICommitStyle } from '../../../../../types';
8
7
  /**
9
8
  * Replaces `ul->ol` or `ol->ul`, apply styles to the list, or remove a list item from it
10
9
  * @private
11
10
  */
12
- export declare function toggleOrderedList(style: CommitStyle, li: HTMLElement, jodit: IJodit, mode: CommitMode): CommitMode;
11
+ export declare function toggleOrderedList(commitStyle: ICommitStyle, li: HTMLElement, jodit: IJodit, mode: CommitMode): CommitMode;
@@ -3,11 +3,10 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { IJodit } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { IJodit, ICommitStyle } from '../../../../../types';
8
7
  /**
9
8
  * Replaces non-leaf items with leaf items and either creates a new list or
10
9
  * adds a new item to the nearest old list
11
10
  * @private
12
11
  */
13
- export declare function wrapOrderedList(commitStyle: CommitStyle, wrapper: HTMLElement, jodit: IJodit): HTMLElement;
12
+ export declare function wrapList(commitStyle: ICommitStyle, wrapper: HTMLElement, jodit: IJodit): 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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ import type { CommitMode, IJodit, ICommitStyle } from '../../../../types';
7
+ /**
8
+ * Toggles attributes
9
+ * @private
10
+ */
11
+ export declare function toggleAttributes(commitStyle: ICommitStyle, elm: HTMLElement, jodit: IJodit, mode: CommitMode, dry?: boolean): CommitMode;
@@ -3,9 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { CommitStyle } from '../commit-style';
6
+ import type { ICommitStyle } from '../../../../types';
7
7
  /**
8
8
  * Unwrap all suit elements inside
9
9
  * @private
10
10
  */
11
- export declare function unwrapChildren(style: CommitStyle, font: HTMLElement): boolean;
11
+ export declare function unwrapChildren(style: ICommitStyle, font: HTMLElement): boolean;
@@ -3,10 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { IJodit } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { IJodit, ICommitStyle } from '../../../../types';
8
7
  /**
9
8
  * Wrap text or inline elements inside Block element
10
9
  * @private
11
10
  */
12
- export declare function wrapUnwrappedText(style: CommitStyle, elm: Node, jodit: IJodit, getRange: () => Range): HTMLElement;
11
+ export declare function wrapUnwrappedText(style: ICommitStyle, elm: Node, jodit: IJodit): HTMLElement;
@@ -3,10 +3,9 @@
3
3
  * Released under MIT see LICENSE.txt in the project root for license information.
4
4
  * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
5
  */
6
- import type { IJodit } from '../../../../types';
7
- import type { CommitStyle } from '../commit-style';
6
+ import type { IJodit, ICommitStyle } from '../../../../types';
8
7
  /**
9
8
  * Replaces the parent tag with the applicable one, or wraps the text and also replaces the tag
10
9
  * @private
11
10
  */
12
- export declare function wrapAndCommitStyle(commitStyle: CommitStyle, font: HTMLElement, jodit: IJodit): HTMLElement;
11
+ export declare function wrap(commitStyle: ICommitStyle, font: HTMLElement, jodit: IJodit): HTMLElement;
@@ -6,6 +6,6 @@
6
6
  /**
7
7
  * @module selection
8
8
  */
9
- import type { IJodit } from '../../../types';
10
- import type { CommitStyle } from './commit-style';
11
- export declare function ApplyStyle(jodit: IJodit, cs: CommitStyle): void;
9
+ import type { IJodit, ICommitStyle } from '../../../types';
10
+ /** @internal */
11
+ export declare function ApplyStyle(jodit: IJodit, cs: ICommitStyle): void;
@@ -6,15 +6,19 @@
6
6
  /**
7
7
  * @module selection
8
8
  */
9
- import type { HTMLTagNames, IJodit, IStyleOptions } from '../../../types';
9
+ import type { HTMLTagNames, IJodit, IStyleOptions, ICommitStyle } from '../../../types';
10
10
  export declare const WRAP = "wrap";
11
11
  export declare const UNWRAP = "unwrap";
12
12
  export declare const CHANGE = "change";
13
13
  export declare const UNSET = "unset";
14
14
  export declare const INITIAL = "initial";
15
15
  export declare const REPLACE = "replace";
16
- export declare class CommitStyle {
16
+ export declare const _PREFIX = "commitStyle";
17
+ export declare class CommitStyle implements ICommitStyle {
17
18
  readonly options: IStyleOptions;
19
+ private __applyMap;
20
+ isApplied(elm: HTMLElement, key: string): boolean;
21
+ setApplied(elm: HTMLElement, key: string): void;
18
22
  get elementIsList(): boolean;
19
23
  get element(): HTMLTagNames;
20
24
  /**
@@ -0,0 +1,29 @@
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
+ import type { IJodit, IDictionary, CommitMode, ICommitStyle } from '../../../types';
7
+ export declare const states: {
8
+ readonly START: "START";
9
+ readonly ELEMENT: "ELEMENT";
10
+ readonly UNWRAP: "UNWRAP";
11
+ readonly UNWRAP_CHILDREN: "UNWRAP_CHILDREN";
12
+ readonly CHANGE: "CHANGE";
13
+ readonly REPLACE_DEFAULT: "REPLACE_DEFAULT";
14
+ readonly LIST: "LIST";
15
+ readonly TOGGLE_LIST: "TOGGLE_LIST";
16
+ readonly WRAP: "WRAP";
17
+ readonly EXTRACT: "EXTRACT";
18
+ readonly END: "END";
19
+ };
20
+ export interface IStyleTransactionValue {
21
+ next: keyof typeof states;
22
+ element: HTMLElement;
23
+ style: ICommitStyle;
24
+ jodit: IJodit;
25
+ mode: CommitMode;
26
+ }
27
+ type IStyleTransactions = IDictionary<IDictionary<(value: IStyleTransactionValue) => IStyleTransactionValue>, keyof typeof states>;
28
+ export declare const transactions: IStyleTransactions;
29
+ export {};
@@ -11,7 +11,7 @@
11
11
 
12
12
  import type { IBound, IPopup, IUIElement, IViewBased, PopupStrategy } from '../../../types';
13
13
  import { UIElement } from '../../../core/ui/element';
14
- declare type getBoundFunc = () => IBound;
14
+ type getBoundFunc = () => IBound;
15
15
  export declare class Popup extends UIElement implements IPopup {
16
16
  readonly smart: boolean;
17
17
  /** @override */
@@ -42,7 +42,7 @@ export declare abstract class View extends Component implements IViewBased, Mods
42
42
  * @see copyformat plugin
43
43
  */
44
44
  readonly buffer: IStorage;
45
- readonly message: IMessages;
45
+ message: IMessages;
46
46
  /**
47
47
  * Container for persistent set/get value
48
48
  */
package/types/index.d.ts CHANGED
@@ -13,3 +13,5 @@ import { Jodit as DefaultJodit } from './jodit';
13
13
  import './plugins/index';
14
14
 
15
15
  export { DefaultJodit as Jodit };
16
+ export declare class CommitMode {
17
+ }
@@ -7,7 +7,7 @@
7
7
  * @module modules/file-browser
8
8
  */
9
9
  import type { IDictionary, IFileBrowserItem, IViewBased } from '../../../types';
10
- declare type ElementsMap = IDictionary<{
10
+ type ElementsMap = IDictionary<{
11
11
  elm: HTMLElement;
12
12
  item: IFileBrowserItem;
13
13
  }>;
@@ -26,10 +26,15 @@ export default class DataProvider implements IFileBrowserDataProvider {
26
26
  */
27
27
  permissions(path: string, source: string): Promise<Nullable<IPermissions>>;
28
28
  canI(action: string): boolean;
29
+ private __items;
29
30
  /**
30
31
  * Load items list by path and source
31
32
  */
32
33
  items(path: string, source: string, mods?: IFileBrowserDataProviderItemsMods): Promise<IFileBrowserItem[]>;
34
+ /**
35
+ * Load items list by path and source
36
+ */
37
+ itemsEx(path: string, source: string, mods?: IFileBrowserDataProviderItemsMods): ReturnType<IFileBrowserDataProvider['itemsEx']>;
33
38
  private generateItemsList;
34
39
  tree(path: string, source: string): Promise<ISourcesFiles>;
35
40
  /**
@@ -15,12 +15,13 @@ import { UIGroup } from '../../core/ui/group/group';
15
15
  * Plugin display pop-up messages in the lower right corner of the editor
16
16
  */
17
17
  export declare class UIMessages extends UIGroup implements IMessages {
18
+ private readonly __box;
18
19
  readonly options: {
19
20
  defaultTimeout: number;
20
21
  defaultOffset: number;
21
22
  };
22
23
  className(): string;
23
- constructor(jodit: IViewBased, options?: {
24
+ constructor(jodit: IViewBased, __box: HTMLElement, options?: {
24
25
  defaultTimeout: number;
25
26
  defaultOffset: number;
26
27
  });
@@ -6,9 +6,13 @@
6
6
  /**
7
7
  * @module plugins/keyboard
8
8
  */
9
- import type { Nullable } from '../../types';
9
+ import type { IJodit, Nullable } from '../../types';
10
10
  /**
11
11
  * Finds the nearest neighbor that would be in the maximum nesting depth.
12
12
  * Ie if neighbor `<DIV><SPAN>Text` then return Text node.
13
13
  */
14
14
  export declare function findMostNestedNeighbor(node: Node, right: boolean, root: HTMLElement, onlyInlide?: boolean): Nullable<Node>;
15
+ /**
16
+ * @private
17
+ */
18
+ export declare function getMoveFilter(jodit: IJodit): (node: Node) => boolean;
@@ -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-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
+ */
6
+ /**
7
+ * @module plugins/backspace
8
+ */
9
+ export type DeleteMode = 'char' | 'word' | 'sentence';
10
+ declare module '../../types/events' {
11
+ interface IEventEmitter {
12
+ /**
13
+ * Allows you to prepare the content before deletion or completely override the deletion logic if you return true
14
+ */
15
+ on(event: 'backSpaceBeforeCases', callback: (backspace: boolean, fakeNode: Node) => void | true): this;
16
+ /**
17
+ * Emits after backspace or delete key pressed and were processed
18
+ */
19
+ on(event: 'backSpaceAfterDelete', callback: (backspace: boolean, fakeNode: Node) => void): this;
20
+ }
21
+ }
@@ -10,6 +10,7 @@
10
10
  */
11
11
  import type { IJodit } from '../../types';
12
12
  import { Plugin } from '../../core/plugin/plugin';
13
+ import './interface';
13
14
  /**
14
15
  * One of most important core plugins. It is responsible for all the browsers to have the same effect when the Enter
15
16
  * button is pressed. By default, it should insert the <p>
@@ -19,6 +20,7 @@ export declare class enter extends Plugin {
19
20
  protected afterInit(editor: IJodit): void;
20
21
  protected onEnterKeyDown(event: KeyboardEvent): false | void;
21
22
  private onEnter;
23
+ private __isEmptyListLeaf;
22
24
  private getCurrentOrFillEmpty;
23
25
  /** @override */
24
26
  beforeDestruct(editor: IJodit): void;
@@ -0,0 +1,32 @@
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 '../../types/events' {
7
+ interface IEventEmitter {
8
+ /**
9
+ * Fired on processing `Enter` key. If return some value, plugin `enter` will do nothing.
10
+ * if return false - prevent default Enter behavior
11
+ */
12
+ on(event: 'beforeEnter', callback: (e: KeyboardEvent) => void | false): this;
13
+ /**
14
+ * Fired after processing `Enter` key.
15
+ */
16
+ on(event: 'afterEnter', callback: (e: KeyboardEvent) => void): this;
17
+ /**
18
+ * When inside the list there is a click on an empty element of the list, then it is deleted if empty.
19
+ * This event can handle this situation.
20
+ * @example
21
+ * ```javascript
22
+ * Jodit.make('#editor', {
23
+ * events: {
24
+ * enterIsEmptyListLeaf(li){
25
+ * return Jodit.ns.Dom.isEmpty(li);
26
+ * }
27
+ * }
28
+ * });
29
+ */
30
+ on(event: 'enterIsEmptyListLeaf', callback: (li: HTMLElement) => void): this;
31
+ }
32
+ }
@@ -44,6 +44,25 @@ declare module '../../config' {
44
44
  * Show edit classNames input
45
45
  */
46
46
  editClass: boolean;
47
+ /**
48
+ * Pre-define available classes to select from
49
+ *
50
+ * Classes can be provided as list of strings or as list of tuples
51
+ * `["classname", "human label"]`.
52
+ *
53
+ * @example
54
+ * ```javascript
55
+ * new Jodit('#editor', {
56
+ * image: {
57
+ * availableClasses: [
58
+ * "rte-image-width-50",
59
+ * ["rte-image-width-75", "75 % width"]
60
+ * ]
61
+ * }
62
+ * })
63
+ * ```
64
+ */
65
+ availableClasses: [string, string][] | string[];
47
66
  /**
48
67
  * Show style edit input
49
68
  */
@@ -21,7 +21,7 @@ export declare class link extends Plugin {
21
21
  protected afterInit(jodit: IJodit): void;
22
22
  private onDblClickOnLink;
23
23
  private onProcessPasteLink;
24
- private generateForm;
24
+ private __generateForm;
25
25
  /** @override */
26
26
  protected beforeDestruct(jodit: IJodit): void;
27
27
  }
@@ -7,8 +7,8 @@
7
7
  * @module plugins/paste
8
8
  */
9
9
  import type { InsertMode } from '../../types';
10
- export declare type PasteEvent = ClipboardEvent | DragEvent;
11
- export declare type PastedValue = {
10
+ export type PasteEvent = ClipboardEvent | DragEvent;
11
+ export type PastedValue = {
12
12
  html: string | Node;
13
13
  action?: InsertMode;
14
14
  };
@@ -12,4 +12,4 @@ import type { IJodit } from '../../../types';
12
12
  * If so then add an internal list
13
13
  * @private
14
14
  */
15
- export declare function onTabInsideLi(jodit: IJodit): boolean;
15
+ export declare function onTabInsideLi(jodit: IJodit, shift?: boolean): boolean;