jodit 3.9.3 → 3.9.4

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 (85) hide show
  1. package/.idea/workspace.xml +129 -121
  2. package/CHANGELOG.MD +21 -5
  3. package/build/jodit.css +92 -33
  4. package/build/jodit.es2018.css +65 -29
  5. package/build/jodit.es2018.en.css +65 -29
  6. package/build/jodit.es2018.en.js +854 -466
  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 +854 -466
  10. package/build/jodit.es2018.min.css +1 -1
  11. package/build/jodit.es2018.min.js +1 -1
  12. package/build/jodit.js +1804 -1360
  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 +1 -1
  17. package/src/config.ts +1 -1
  18. package/src/core/dom.ts +10 -3
  19. package/src/core/helpers/size/index.ts +1 -0
  20. package/src/core/helpers/size/object-size.ts +22 -0
  21. package/src/core/selection/select.ts +1 -0
  22. package/src/core/selection/style/api/{get-closest-wrapper.ts → extract.ts} +26 -43
  23. package/src/core/selection/style/api/finite-state-machine.ts +66 -0
  24. package/src/core/selection/style/api/index.ts +12 -5
  25. package/src/core/selection/style/api/{check-special-elements.ts → is-inside-invisible-element.ts} +1 -1
  26. package/src/core/selection/style/api/is-suit-element.ts +12 -1
  27. package/src/core/selection/style/api/toggle/toggle-css.ts +134 -0
  28. package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +49 -0
  29. package/src/core/selection/style/api/toggle-commit-styles.ts +27 -0
  30. package/src/core/selection/style/api/wrap-and-commit-style.ts +68 -0
  31. package/src/core/selection/style/api/wrap-ordered-list.ts +37 -0
  32. package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -4
  33. package/src/core/selection/style/apply-style.ts +161 -97
  34. package/src/core/selection/style/commit-style.ts +13 -0
  35. package/src/core/ui/button/button/button.less +2 -0
  36. package/src/core/ui/helpers/buttons.ts +14 -6
  37. package/src/core/ui/list/list.less +1 -0
  38. package/src/core/ui/popup/popup.less +5 -3
  39. package/src/core/view/view-with-toolbar.ts +4 -0
  40. package/src/modules/status-bar/status-bar.less +27 -1
  41. package/src/modules/status-bar/status-bar.ts +15 -1
  42. package/src/modules/widget/tabs/tabs.less +1 -0
  43. package/src/plugins/bold.ts +2 -2
  44. package/src/plugins/font.ts +11 -1
  45. package/src/plugins/index.ts +1 -0
  46. package/src/plugins/mobile.ts +10 -14
  47. package/src/plugins/ordered-list.ts +40 -1
  48. package/src/plugins/powered-by-jodit.ts +39 -0
  49. package/src/plugins/print/preview.ts +9 -2
  50. package/src/plugins/resizer/resizer.less +10 -7
  51. package/src/plugins/resizer/resizer.ts +12 -14
  52. package/src/plugins/size/assests/resize-handler.svg +4 -0
  53. package/src/plugins/size/resize-handler.ts +4 -4
  54. package/src/plugins/size/size.less +6 -8
  55. package/src/plugins/source/source.ts +15 -1
  56. package/src/styles/themes/dark.less +11 -1
  57. package/src/types/style.d.ts +2 -0
  58. package/src/types/toolbar.d.ts +2 -1
  59. package/src/types/view.d.ts +1 -0
  60. package/types/core/dom.d.ts +2 -1
  61. package/types/core/helpers/size/index.d.ts +1 -0
  62. package/types/core/helpers/size/object-size.d.ts +7 -0
  63. package/types/core/selection/style/api/{get-closest-wrapper.d.ts → extract.d.ts} +6 -5
  64. package/types/core/selection/style/api/finite-state-machine.d.ts +21 -0
  65. package/types/core/selection/style/api/index.d.ts +12 -5
  66. package/types/core/selection/style/api/{check-special-elements.d.ts → is-inside-invisible-element.d.ts} +1 -1
  67. package/types/core/selection/style/api/is-suit-element.d.ts +9 -0
  68. package/types/core/selection/style/api/toggle/toggle-css.d.ts +11 -0
  69. package/types/core/selection/style/api/toggle/toggle-ordered-list.d.ts +11 -0
  70. package/types/core/selection/style/api/{toggle-styles.d.ts → toggle-commit-styles.d.ts} +1 -3
  71. package/types/core/selection/style/api/{post-process-list-element.d.ts → wrap-and-commit-style.d.ts} +3 -3
  72. package/types/core/selection/style/api/wrap-ordered-list.d.ts +12 -0
  73. package/types/core/selection/style/apply-style.d.ts +1 -4
  74. package/types/core/selection/style/commit-style.d.ts +7 -0
  75. package/types/core/ui/helpers/buttons.d.ts +2 -2
  76. package/types/core/view/view-with-toolbar.d.ts +2 -1
  77. package/types/modules/status-bar/status-bar.d.ts +6 -1
  78. package/types/plugins/index.d.ts +1 -0
  79. package/types/plugins/ordered-list.d.ts +8 -1
  80. package/types/plugins/powered-by-jodit.d.ts +12 -0
  81. package/types/types/style.d.ts +2 -0
  82. package/types/types/toolbar.d.ts +2 -1
  83. package/types/types/view.d.ts +1 -0
  84. package/src/core/selection/style/api/post-process-list-element.ts +0 -33
  85. package/src/core/selection/style/api/toggle-styles.ts +0 -74
@@ -1,33 +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-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- import type { CommitStyle } from '../commit-style';
8
- import type { ICreate } from '../../../../types';
9
- import { Dom } from '../../../dom';
10
-
11
- /**
12
- * Post process UL or OL element
13
- */
14
- export function postProcessListElement(
15
- style: CommitStyle,
16
- wrapper: HTMLElement,
17
- ci: ICreate
18
- ): HTMLElement {
19
- // Add extra LI inside UL/OL
20
- if (
21
- /^(OL|UL)$/i.test(style.element) &&
22
- !Dom.isTag(wrapper.firstElementChild, 'li')
23
- ) {
24
- const li = Dom.replace(wrapper, 'li', ci),
25
- ul = Dom.wrap(li, style.element, ci);
26
-
27
- if (ul) {
28
- return ul;
29
- }
30
- }
31
-
32
- return wrapper;
33
- }
@@ -1,74 +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-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
5
- */
6
-
7
- import type { CommitStyle } from '../commit-style';
8
- import type { Nullable } from '../../../../types';
9
- import { attr, css, normalizeCssValue } from '../../../helpers';
10
- import { Dom } from '../../../dom';
11
-
12
- /**
13
- * Add or remove styles to element
14
- *
15
- * @param elm - The element to switch styles
16
- */
17
- export function toggleStyles(
18
- style: CommitStyle,
19
- elm: HTMLElement,
20
- wrap: Nullable<boolean>
21
- ): Nullable<boolean> {
22
- const {
23
- options: { style: styles },
24
- defaultTag,
25
- element
26
- } = style;
27
-
28
- const tag = elm.nodeName.toLowerCase(),
29
- isStyleCommit = style.elementIsDefault && Dom.isInlineBlock(elm);
30
-
31
- // toggle CSS rules
32
- if (styles && (tag === defaultTag || isStyleCommit)) {
33
- Object.keys(styles).forEach(rule => {
34
- if (
35
- wrap === false ||
36
- css(elm, rule) ===
37
- normalizeCssValue(rule, styles[rule] as string)
38
- ) {
39
- css(elm, rule, '');
40
-
41
- if (wrap == null) {
42
- wrap = false;
43
- }
44
- } else {
45
- css(elm, rule, styles[rule]);
46
-
47
- if (wrap == null) {
48
- wrap = true;
49
- }
50
- }
51
- });
52
- }
53
-
54
- const isBlock = Dom.isBlock(elm);
55
-
56
- const isSuitableInline =
57
- !isBlock &&
58
- (!attr(elm, 'style') || (tag !== defaultTag && tag === element));
59
-
60
- // h1 apply h1
61
- const isSameBlockElement = !isSuitableInline && isBlock && tag === element;
62
-
63
- if (isSuitableInline || isSameBlockElement) {
64
- // toggle `<strong>test</strong>` to `test`, and
65
- // `<span style="">test</span>` to `test`
66
- Dom.unwrap(elm);
67
-
68
- if (wrap == null) {
69
- wrap = false;
70
- }
71
- }
72
-
73
- return wrap;
74
- }