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.
- package/.idea/workspace.xml +129 -121
- package/CHANGELOG.MD +21 -5
- package/build/jodit.css +92 -33
- package/build/jodit.es2018.css +65 -29
- package/build/jodit.es2018.en.css +65 -29
- package/build/jodit.es2018.en.js +854 -466
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +854 -466
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +1804 -1360
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/index.d.ts +10 -0
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/core/dom.ts +10 -3
- package/src/core/helpers/size/index.ts +1 -0
- package/src/core/helpers/size/object-size.ts +22 -0
- package/src/core/selection/select.ts +1 -0
- package/src/core/selection/style/api/{get-closest-wrapper.ts → extract.ts} +26 -43
- package/src/core/selection/style/api/finite-state-machine.ts +66 -0
- package/src/core/selection/style/api/index.ts +12 -5
- package/src/core/selection/style/api/{check-special-elements.ts → is-inside-invisible-element.ts} +1 -1
- package/src/core/selection/style/api/is-suit-element.ts +12 -1
- package/src/core/selection/style/api/toggle/toggle-css.ts +134 -0
- package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +49 -0
- package/src/core/selection/style/api/toggle-commit-styles.ts +27 -0
- package/src/core/selection/style/api/wrap-and-commit-style.ts +68 -0
- package/src/core/selection/style/api/wrap-ordered-list.ts +37 -0
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -4
- package/src/core/selection/style/apply-style.ts +161 -97
- package/src/core/selection/style/commit-style.ts +13 -0
- package/src/core/ui/button/button/button.less +2 -0
- package/src/core/ui/helpers/buttons.ts +14 -6
- package/src/core/ui/list/list.less +1 -0
- package/src/core/ui/popup/popup.less +5 -3
- package/src/core/view/view-with-toolbar.ts +4 -0
- package/src/modules/status-bar/status-bar.less +27 -1
- package/src/modules/status-bar/status-bar.ts +15 -1
- package/src/modules/widget/tabs/tabs.less +1 -0
- package/src/plugins/bold.ts +2 -2
- package/src/plugins/font.ts +11 -1
- package/src/plugins/index.ts +1 -0
- package/src/plugins/mobile.ts +10 -14
- package/src/plugins/ordered-list.ts +40 -1
- package/src/plugins/powered-by-jodit.ts +39 -0
- package/src/plugins/print/preview.ts +9 -2
- package/src/plugins/resizer/resizer.less +10 -7
- package/src/plugins/resizer/resizer.ts +12 -14
- package/src/plugins/size/assests/resize-handler.svg +4 -0
- package/src/plugins/size/resize-handler.ts +4 -4
- package/src/plugins/size/size.less +6 -8
- package/src/plugins/source/source.ts +15 -1
- package/src/styles/themes/dark.less +11 -1
- package/src/types/style.d.ts +2 -0
- package/src/types/toolbar.d.ts +2 -1
- package/src/types/view.d.ts +1 -0
- package/types/core/dom.d.ts +2 -1
- package/types/core/helpers/size/index.d.ts +1 -0
- package/types/core/helpers/size/object-size.d.ts +7 -0
- package/types/core/selection/style/api/{get-closest-wrapper.d.ts → extract.d.ts} +6 -5
- package/types/core/selection/style/api/finite-state-machine.d.ts +21 -0
- package/types/core/selection/style/api/index.d.ts +12 -5
- package/types/core/selection/style/api/{check-special-elements.d.ts → is-inside-invisible-element.d.ts} +1 -1
- package/types/core/selection/style/api/is-suit-element.d.ts +9 -0
- package/types/core/selection/style/api/toggle/toggle-css.d.ts +11 -0
- package/types/core/selection/style/api/toggle/toggle-ordered-list.d.ts +11 -0
- package/types/core/selection/style/api/{toggle-styles.d.ts → toggle-commit-styles.d.ts} +1 -3
- package/types/core/selection/style/api/{post-process-list-element.d.ts → wrap-and-commit-style.d.ts} +3 -3
- package/types/core/selection/style/api/wrap-ordered-list.d.ts +12 -0
- package/types/core/selection/style/apply-style.d.ts +1 -4
- package/types/core/selection/style/commit-style.d.ts +7 -0
- package/types/core/ui/helpers/buttons.d.ts +2 -2
- package/types/core/view/view-with-toolbar.d.ts +2 -1
- package/types/modules/status-bar/status-bar.d.ts +6 -1
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/ordered-list.d.ts +8 -1
- package/types/plugins/powered-by-jodit.d.ts +12 -0
- package/types/types/style.d.ts +2 -0
- package/types/types/toolbar.d.ts +2 -1
- package/types/types/view.d.ts +1 -0
- package/src/core/selection/style/api/post-process-list-element.ts +0 -33
- 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
|
-
}
|