jodit 3.8.2 → 3.8.3
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 +153 -155
- package/CHANGELOG.MD +36 -9
- package/app.css +2 -1
- package/build/jodit.css +73 -73
- package/build/jodit.es2018.css +56 -56
- package/build/jodit.es2018.en.css +56 -56
- package/build/jodit.es2018.en.js +172 -84
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +2 -2
- package/build/jodit.es2018.js +172 -84
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +2 -2
- package/build/jodit.js +835 -742
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +2 -2
- package/package.json +7 -7
- package/src/config.ts +4 -4
- package/src/core/create.ts +15 -15
- package/src/core/helpers/css.ts +3 -5
- package/src/core/helpers/html/strip-tags.ts +36 -4
- package/src/core/helpers/selector.ts +6 -8
- package/src/core/helpers/size/get-scroll-parent.ts +28 -0
- package/src/core/helpers/size/index.ts +1 -0
- package/src/core/selection/select.ts +35 -45
- package/src/core/ui/button/button/button.less +4 -1
- package/src/core/ui/button/button/button.ts +6 -8
- package/src/core/ui/popup/popup.less +4 -4
- package/src/core/ui/popup/popup.ts +17 -7
- package/src/core/view/view-with-toolbar.less +3 -2
- package/src/jodit.ts +6 -3
- package/src/modules/dialog/dialog.ts +1 -2
- package/src/modules/file-browser/builders/context-menu.ts +1 -1
- package/src/modules/file-browser/listeners/state-listeners.ts +2 -1
- package/src/modules/file-browser/styles/preview.less +17 -14
- package/src/modules/widget/color-picker/color-picker.less +12 -11
- package/src/modules/widget/color-picker/color-picker.ts +20 -30
- package/src/plugins/clipboard/paste-storage/paste-storage.ts +9 -20
- package/src/plugins/fix/clean-html.ts +36 -3
- package/src/plugins/iframe.ts +12 -2
- package/src/plugins/link/link.ts +14 -2
- package/src/plugins/resizer/resizer.ts +22 -4
- package/src/plugins/size/resize-handler.ts +1 -1
- package/src/plugins/size/size.less +10 -7
- package/src/plugins/symbols/symbols.less +12 -7
- package/src/plugins/symbols/symbols.ts +9 -6
- package/src/plugins/xpath/xpath.ts +1 -1
- package/src/styles/jodit.less +1 -1
- package/src/types/ui.d.ts +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jodit",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.3",
|
|
4
4
|
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
|
|
5
5
|
"main": "build/jodit.min.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/ace": "^0.0.47",
|
|
53
|
-
"@types/node": "^16.10.
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
55
|
-
"@typescript-eslint/parser": "^4.
|
|
53
|
+
"@types/node": "^16.10.2",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
|
55
|
+
"@typescript-eslint/parser": "^4.32.0",
|
|
56
56
|
"autoprefixer": "^10.3.6",
|
|
57
57
|
"chai": "^4.3.4",
|
|
58
58
|
"classlist-polyfill": "^1.2.0",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"karma-mocha": "^2.0.1",
|
|
77
77
|
"karma-sourcemap-loader": "^0.3.8",
|
|
78
78
|
"karma-webpack": "^5.0.0",
|
|
79
|
-
"less": "^4.1.
|
|
79
|
+
"less": "^4.1.2",
|
|
80
80
|
"less-loader": "^10.0.1",
|
|
81
|
-
"lint-staged": "^11.
|
|
81
|
+
"lint-staged": "^11.2.0",
|
|
82
82
|
"merge-stream": "^2.0.0",
|
|
83
83
|
"mini-css-extract-plugin": "^2.3.0",
|
|
84
84
|
"mocha": "^9.1.2",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"tslib": "^2.3.1",
|
|
101
101
|
"typescript": "^4.4.3",
|
|
102
102
|
"url-loader": "^4.1.1",
|
|
103
|
-
"webpack": "^5.
|
|
103
|
+
"webpack": "^5.56.1",
|
|
104
104
|
"webpack-cli": "^4.8.0",
|
|
105
105
|
"webpack-dev-middleware": "^5.2.1",
|
|
106
106
|
"webpack-dev-server": "^4.3.0",
|
package/src/config.ts
CHANGED
|
@@ -627,10 +627,6 @@ export class Config implements IViewOptions {
|
|
|
627
627
|
* ```
|
|
628
628
|
*/
|
|
629
629
|
buttons: ButtonsOption = [
|
|
630
|
-
{
|
|
631
|
-
group: 'source',
|
|
632
|
-
buttons: []
|
|
633
|
-
},
|
|
634
630
|
{
|
|
635
631
|
group: 'font-style',
|
|
636
632
|
buttons: []
|
|
@@ -684,6 +680,10 @@ export class Config implements IViewOptions {
|
|
|
684
680
|
group: 'search',
|
|
685
681
|
buttons: []
|
|
686
682
|
},
|
|
683
|
+
{
|
|
684
|
+
group: 'source',
|
|
685
|
+
buttons: []
|
|
686
|
+
},
|
|
687
687
|
{
|
|
688
688
|
group: 'other',
|
|
689
689
|
buttons: []
|
package/src/core/create.ts
CHANGED
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
css,
|
|
21
21
|
isFunction,
|
|
22
22
|
kebabCase,
|
|
23
|
-
refs
|
|
23
|
+
refs,
|
|
24
|
+
isString
|
|
24
25
|
} from './helpers/';
|
|
25
26
|
|
|
26
27
|
import { Dom } from './dom';
|
|
@@ -40,9 +41,6 @@ export class Create implements ICreate {
|
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Apply some object key-value to HTMLElement
|
|
43
|
-
*
|
|
44
|
-
* @param elm
|
|
45
|
-
* @param attrs
|
|
46
44
|
*/
|
|
47
45
|
private applyAttributes = (elm: HTMLElement, attrs: Attributes) => {
|
|
48
46
|
each(attrs, (key: string, value) => {
|
|
@@ -86,9 +84,7 @@ export class Create implements ICreate {
|
|
|
86
84
|
|
|
87
85
|
if (children) {
|
|
88
86
|
asArray(children).forEach((child: string | Node) =>
|
|
89
|
-
elm.appendChild(
|
|
90
|
-
typeof child === 'string' ? this.fromHTML(child) : child
|
|
91
|
-
)
|
|
87
|
+
elm.appendChild(isString(child) ? this.fromHTML(child) : child)
|
|
92
88
|
);
|
|
93
89
|
}
|
|
94
90
|
|
|
@@ -161,7 +157,6 @@ export class Create implements ICreate {
|
|
|
161
157
|
|
|
162
158
|
/**
|
|
163
159
|
* Create text node
|
|
164
|
-
* @param value
|
|
165
160
|
*/
|
|
166
161
|
text(value: string): Text {
|
|
167
162
|
return this.doc.createTextNode(value);
|
|
@@ -169,7 +164,6 @@ export class Create implements ICreate {
|
|
|
169
164
|
|
|
170
165
|
/**
|
|
171
166
|
* Create invisible text node
|
|
172
|
-
* @param value
|
|
173
167
|
*/
|
|
174
168
|
fake(): Text {
|
|
175
169
|
return this.text(INVISIBLE_SPACE);
|
|
@@ -185,16 +179,23 @@ export class Create implements ICreate {
|
|
|
185
179
|
/**
|
|
186
180
|
* Create DOM element from HTML text
|
|
187
181
|
*
|
|
188
|
-
* @param
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
182
|
+
* @param refsToggleElement - State dictionary in which you can set the visibility of some of the elements
|
|
183
|
+
* ```js
|
|
184
|
+
* const editor = Jodit.make('#editor');
|
|
185
|
+
* editor.createInside.fromHTML(`<div>
|
|
186
|
+
* <input name="name" ref="name"/>
|
|
187
|
+
* <input name="email" ref="email"/>
|
|
188
|
+
* </div>`, {
|
|
189
|
+
* name: true,
|
|
190
|
+
* email: false
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
192
193
|
*/
|
|
193
194
|
fromHTML(
|
|
194
195
|
html: string | number,
|
|
195
196
|
refsToggleElement?: IDictionary<boolean | void>
|
|
196
197
|
): HTMLElement {
|
|
197
|
-
const div
|
|
198
|
+
const div = this.div();
|
|
198
199
|
|
|
199
200
|
div.innerHTML = html.toString();
|
|
200
201
|
|
|
@@ -222,7 +223,6 @@ export class Create implements ICreate {
|
|
|
222
223
|
|
|
223
224
|
/**
|
|
224
225
|
* Apply to element `createAttributes` options
|
|
225
|
-
* @param elm
|
|
226
226
|
*/
|
|
227
227
|
applyCreateAttributes(elm: HTMLElement): void {
|
|
228
228
|
if (this.createAttributes) {
|
package/src/core/helpers/css.ts
CHANGED
|
@@ -30,10 +30,9 @@ export function css(
|
|
|
30
30
|
* Get the value of a computed style property for the first element in the set of matched elements or set one or
|
|
31
31
|
* more CSS properties for every matched element
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
36
|
-
* @param [onlyStyleMode] Get value from style attribute, without calculating
|
|
33
|
+
* @param key - An object of property-value pairs to set. A CSS property name.
|
|
34
|
+
* @param value - A value to set for the property.
|
|
35
|
+
* @param onlyStyleMode - Get value from style attribute, without calculating
|
|
37
36
|
*/
|
|
38
37
|
export function css(
|
|
39
38
|
element: HTMLElement,
|
|
@@ -113,7 +112,6 @@ export function css(
|
|
|
113
112
|
|
|
114
113
|
/**
|
|
115
114
|
* Clear center align
|
|
116
|
-
* @param image
|
|
117
115
|
*/
|
|
118
116
|
export const clearCenterAlign = (image: HTMLElement): void => {
|
|
119
117
|
if (css(image, 'display') === 'block') {
|
|
@@ -8,18 +8,16 @@ import { isString } from '../checker';
|
|
|
8
8
|
import { $$ } from '../selector';
|
|
9
9
|
import { trim } from '../string';
|
|
10
10
|
import { Dom } from '../../dom';
|
|
11
|
+
import { attr } from '../utils';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Extract plain text from HTML text
|
|
14
|
-
*
|
|
15
|
-
* @param html
|
|
16
|
-
* @param doc
|
|
17
15
|
*/
|
|
18
16
|
export function stripTags(
|
|
19
17
|
html: string | Node,
|
|
20
18
|
doc: Document = document
|
|
21
19
|
): string {
|
|
22
|
-
const tmp
|
|
20
|
+
const tmp = doc.createElement('div');
|
|
23
21
|
|
|
24
22
|
if (isString(html)) {
|
|
25
23
|
tmp.innerHTML = html;
|
|
@@ -46,3 +44,37 @@ export function stripTags(
|
|
|
46
44
|
|
|
47
45
|
return trim(tmp.innerText) || '';
|
|
48
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Removes dangerous constructs from HTML
|
|
50
|
+
*/
|
|
51
|
+
export function safeHTML(
|
|
52
|
+
box: HTMLElement,
|
|
53
|
+
options: {
|
|
54
|
+
removeOnError: boolean;
|
|
55
|
+
safeJavaScriptLink: boolean;
|
|
56
|
+
}
|
|
57
|
+
): void {
|
|
58
|
+
if (!Dom.isElement(box)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const removeOnError = (elm: HTMLElement) => attr(elm, 'onerror', null),
|
|
63
|
+
safeLink = (elm: HTMLElement) => {
|
|
64
|
+
const href = elm.getAttribute('href');
|
|
65
|
+
|
|
66
|
+
if (href && href.trim().indexOf('javascript') === 0) {
|
|
67
|
+
attr(elm, 'href', location.protocol + '//' + href);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
if (options.removeOnError) {
|
|
72
|
+
removeOnError(box);
|
|
73
|
+
$$('[onerror]', box).forEach(removeOnError);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (options.safeJavaScriptLink) {
|
|
77
|
+
safeLink(box);
|
|
78
|
+
$$<HTMLAnchorElement>('a[href^="javascript"]', box).forEach(safeLink);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -32,10 +32,8 @@ const $$temp = () => {
|
|
|
32
32
|
* });
|
|
33
33
|
* })
|
|
34
34
|
* ```
|
|
35
|
-
* @param selector CSS like selector
|
|
36
|
-
* @param root
|
|
35
|
+
* @param selector - CSS like selector
|
|
37
36
|
*
|
|
38
|
-
* @return {HTMLElement[]}
|
|
39
37
|
*/
|
|
40
38
|
export function $$<K extends HTMLTagNames>(
|
|
41
39
|
selector: K,
|
|
@@ -47,7 +45,7 @@ export function $$<T extends HTMLElement>(
|
|
|
47
45
|
root: HTMLElement | HTMLDocument
|
|
48
46
|
): T[];
|
|
49
47
|
|
|
50
|
-
export function $$<T extends
|
|
48
|
+
export function $$<T extends Element>(
|
|
51
49
|
selector: string | HTMLTagNames,
|
|
52
50
|
root: HTMLElement | HTMLDocument
|
|
53
51
|
): T[] {
|
|
@@ -59,19 +57,19 @@ export function $$<T extends HTMLElement>(
|
|
|
59
57
|
IS_IE &&
|
|
60
58
|
!(root && root.nodeType === Node.DOCUMENT_NODE)
|
|
61
59
|
) {
|
|
62
|
-
const id: string = (root as
|
|
60
|
+
const id: string = (root as Element).id,
|
|
63
61
|
temp_id: string =
|
|
64
62
|
id ||
|
|
65
63
|
'_selector_id_' + String(Math.random()).slice(2) + $$temp();
|
|
66
64
|
|
|
67
65
|
selector = selector.replace(/:scope/g, '#' + temp_id);
|
|
68
66
|
|
|
69
|
-
!id && (root as
|
|
67
|
+
!id && (root as Element).setAttribute('id', temp_id);
|
|
70
68
|
|
|
71
|
-
result = (root.parentNode as
|
|
69
|
+
result = (root.parentNode as Element).querySelectorAll(selector);
|
|
72
70
|
|
|
73
71
|
if (!id) {
|
|
74
|
-
(root as
|
|
72
|
+
(root as Element).removeAttribute('id');
|
|
75
73
|
}
|
|
76
74
|
} else {
|
|
77
75
|
result = root.querySelectorAll(selector);
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { Nullable } from '../../../types';
|
|
8
|
+
import { css } from '../css';
|
|
9
|
+
import { Dom } from '../../dom';
|
|
10
|
+
|
|
11
|
+
export function getScrollParent(node: Nullable<Node>): Nullable<Element> {
|
|
12
|
+
const isElement = Dom.isHTMLElement(node);
|
|
13
|
+
const overflowY = isElement && css(node, 'overflowY');
|
|
14
|
+
const isScrollable =
|
|
15
|
+
isElement && overflowY !== 'visible' && overflowY !== 'hidden';
|
|
16
|
+
|
|
17
|
+
if (!node) {
|
|
18
|
+
return null;
|
|
19
|
+
} else if (isScrollable && node.scrollHeight >= node.clientHeight) {
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
getScrollParent(node.parentNode) ||
|
|
25
|
+
document.scrollingElement ||
|
|
26
|
+
document.body
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -33,7 +33,8 @@ import {
|
|
|
33
33
|
$$,
|
|
34
34
|
css,
|
|
35
35
|
call,
|
|
36
|
-
toArray
|
|
36
|
+
toArray,
|
|
37
|
+
getScrollParent
|
|
37
38
|
} from '../helpers';
|
|
38
39
|
import { CommitStyle } from './style/commit-style';
|
|
39
40
|
import { autobind } from '../decorators';
|
|
@@ -226,9 +227,6 @@ export class Select implements ISelect {
|
|
|
226
227
|
|
|
227
228
|
/**
|
|
228
229
|
* Create marker element
|
|
229
|
-
*
|
|
230
|
-
* @param atStart
|
|
231
|
-
* @param range
|
|
232
230
|
*/
|
|
233
231
|
marker(atStart = false, range?: Range): HTMLSpanElement {
|
|
234
232
|
let newRange: Range | null = null;
|
|
@@ -397,7 +395,6 @@ export class Select implements ISelect {
|
|
|
397
395
|
|
|
398
396
|
/**
|
|
399
397
|
* Set focus in editor
|
|
400
|
-
* @param options
|
|
401
398
|
*/
|
|
402
399
|
@autobind
|
|
403
400
|
focus(
|
|
@@ -406,6 +403,9 @@ export class Select implements ISelect {
|
|
|
406
403
|
}
|
|
407
404
|
): boolean {
|
|
408
405
|
if (!this.isFocused()) {
|
|
406
|
+
const scrollParent = getScrollParent(this.j.container),
|
|
407
|
+
scrollTop = scrollParent?.scrollTop;
|
|
408
|
+
|
|
409
409
|
if (this.j.iframe) {
|
|
410
410
|
if (this.doc.readyState === 'complete') {
|
|
411
411
|
this.j.iframe.focus();
|
|
@@ -415,6 +415,10 @@ export class Select implements ISelect {
|
|
|
415
415
|
this.win.focus();
|
|
416
416
|
this.area.focus(options);
|
|
417
417
|
|
|
418
|
+
if (scrollTop) {
|
|
419
|
+
scrollParent?.scrollTo(0, scrollTop);
|
|
420
|
+
}
|
|
421
|
+
|
|
418
422
|
const sel = this.sel,
|
|
419
423
|
range = sel?.rangeCount ? sel?.getRangeAt(0) : null;
|
|
420
424
|
|
|
@@ -437,7 +441,7 @@ export class Select implements ISelect {
|
|
|
437
441
|
|
|
438
442
|
/**
|
|
439
443
|
* Checks whether the current selection is something or just set the cursor is
|
|
440
|
-
* @
|
|
444
|
+
* @returns true Selection does't have content
|
|
441
445
|
*/
|
|
442
446
|
isCollapsed(): boolean {
|
|
443
447
|
const sel = this.sel;
|
|
@@ -543,9 +547,8 @@ export class Select implements ISelect {
|
|
|
543
547
|
/**
|
|
544
548
|
* Insert element in editor
|
|
545
549
|
*
|
|
546
|
-
* @param
|
|
547
|
-
* @param
|
|
548
|
-
* @param [fireChange] After insert, editor fire change event. You can prevent this behavior
|
|
550
|
+
* @param insertCursorAfter - After insert, cursor will move after element
|
|
551
|
+
* @param fireChange - After insert, editor fire change event. You can prevent this behavior
|
|
549
552
|
*/
|
|
550
553
|
insertNode(
|
|
551
554
|
node: Node,
|
|
@@ -554,6 +557,8 @@ export class Select implements ISelect {
|
|
|
554
557
|
): void {
|
|
555
558
|
this.errorNode(node);
|
|
556
559
|
|
|
560
|
+
this.j.e.fire('safeHTML', <HTMLElement>node);
|
|
561
|
+
|
|
557
562
|
if (!this.isFocused() && this.j.isEditorMode()) {
|
|
558
563
|
this.focus();
|
|
559
564
|
this.restore();
|
|
@@ -608,7 +613,7 @@ export class Select implements ISelect {
|
|
|
608
613
|
/**
|
|
609
614
|
* Inserts in the current cursor position some HTML snippet
|
|
610
615
|
*
|
|
611
|
-
* @param
|
|
616
|
+
* @param html - HTML The text toWYSIWYG be inserted into the document
|
|
612
617
|
* @example
|
|
613
618
|
* ```javascript
|
|
614
619
|
* parent.s.insertHTML('<img src="image.png"/>');
|
|
@@ -669,11 +674,11 @@ export class Select implements ISelect {
|
|
|
669
674
|
/**
|
|
670
675
|
* Insert image in editor
|
|
671
676
|
*
|
|
672
|
-
* @param url URL for image, or HTMLImageElement
|
|
673
|
-
* @param
|
|
674
|
-
* @param defaultWidth
|
|
677
|
+
* @param url - URL for image, or HTMLImageElement
|
|
678
|
+
* @param styles - If specified, it will be applied <code>$(image).css(styles)</code>
|
|
675
679
|
*
|
|
676
|
-
*
|
|
680
|
+
* eslint-disable-next-line tsdoc/syntax
|
|
681
|
+
* @emits afterInsertImage - Triggered aafter insert image
|
|
677
682
|
*/
|
|
678
683
|
insertImage(
|
|
679
684
|
url: string | HTMLImageElement,
|
|
@@ -698,7 +703,13 @@ export class Select implements ISelect {
|
|
|
698
703
|
dw += 'px';
|
|
699
704
|
}
|
|
700
705
|
|
|
701
|
-
|
|
706
|
+
call(
|
|
707
|
+
// @ts-ignore
|
|
708
|
+
this.j.o.resizer.forImageChangeAttributes ? attr : css,
|
|
709
|
+
image,
|
|
710
|
+
'width',
|
|
711
|
+
dw
|
|
712
|
+
);
|
|
702
713
|
}
|
|
703
714
|
|
|
704
715
|
if (styles && typeof styles === 'object') {
|
|
@@ -820,10 +831,10 @@ export class Select implements ISelect {
|
|
|
820
831
|
/**
|
|
821
832
|
* Checks if the cursor is at the end(start) block
|
|
822
833
|
*
|
|
823
|
-
* @param
|
|
824
|
-
* @param
|
|
834
|
+
* @param start - true - check whether the cursor is at the start block
|
|
835
|
+
* @param parentBlock - Find in this
|
|
825
836
|
*
|
|
826
|
-
* @
|
|
837
|
+
* @returns true - the cursor is at the end(start) block, null - cursor somewhere outside
|
|
827
838
|
*/
|
|
828
839
|
cursorInTheEdge(
|
|
829
840
|
start: boolean,
|
|
@@ -882,7 +893,6 @@ export class Select implements ISelect {
|
|
|
882
893
|
|
|
883
894
|
/**
|
|
884
895
|
* Wrapper for cursorInTheEdge
|
|
885
|
-
* @param parentBlock
|
|
886
896
|
*/
|
|
887
897
|
cursorOnTheLeft(parentBlock: HTMLElement): Nullable<boolean> {
|
|
888
898
|
return this.cursorInTheEdge(true, parentBlock);
|
|
@@ -890,7 +900,6 @@ export class Select implements ISelect {
|
|
|
890
900
|
|
|
891
901
|
/**
|
|
892
902
|
* Wrapper for cursorInTheEdge
|
|
893
|
-
* @param parentBlock
|
|
894
903
|
*/
|
|
895
904
|
cursorOnTheRight(parentBlock: HTMLElement): Nullable<boolean> {
|
|
896
905
|
return this.cursorInTheEdge(false, parentBlock);
|
|
@@ -898,9 +907,7 @@ export class Select implements ISelect {
|
|
|
898
907
|
|
|
899
908
|
/**
|
|
900
909
|
* Set cursor after the node
|
|
901
|
-
*
|
|
902
|
-
* @param {Node} node
|
|
903
|
-
* @return {Node} fake invisible textnode. After insert it can be removed
|
|
910
|
+
* @returns fake invisible textnode. After insert it can be removed
|
|
904
911
|
*/
|
|
905
912
|
@autobind
|
|
906
913
|
setCursorAfter(node: Node): Nullable<Text> {
|
|
@@ -909,9 +916,7 @@ export class Select implements ISelect {
|
|
|
909
916
|
|
|
910
917
|
/**
|
|
911
918
|
* Set cursor before the node
|
|
912
|
-
*
|
|
913
|
-
* @param node
|
|
914
|
-
* @return fake invisible textnode. After insert it can be removed
|
|
919
|
+
* @returns fake invisible textnode. After insert it can be removed
|
|
915
920
|
*/
|
|
916
921
|
@autobind
|
|
917
922
|
setCursorBefore(node: Node): Nullable<Text> {
|
|
@@ -920,9 +925,6 @@ export class Select implements ISelect {
|
|
|
920
925
|
|
|
921
926
|
/**
|
|
922
927
|
* Add fake node for new cursor position
|
|
923
|
-
*
|
|
924
|
-
* @param node
|
|
925
|
-
* @param inStart
|
|
926
928
|
*/
|
|
927
929
|
private setCursorNearWith(node: Node, inStart: boolean): Nullable<Text> {
|
|
928
930
|
this.errorNode(node);
|
|
@@ -966,9 +968,7 @@ export class Select implements ISelect {
|
|
|
966
968
|
|
|
967
969
|
/**
|
|
968
970
|
* Set cursor in the node
|
|
969
|
-
*
|
|
970
|
-
* @param node
|
|
971
|
-
* @param [inStart] set cursor in start of element
|
|
971
|
+
* @param inStart - set cursor in start of element
|
|
972
972
|
*/
|
|
973
973
|
@autobind
|
|
974
974
|
setCursorIn(node: Node, inStart: boolean = false): Node {
|
|
@@ -1019,11 +1019,7 @@ export class Select implements ISelect {
|
|
|
1019
1019
|
|
|
1020
1020
|
/**
|
|
1021
1021
|
* Set range selection
|
|
1022
|
-
*
|
|
1023
|
-
* @param range
|
|
1024
|
-
* @param [focus]
|
|
1025
|
-
*
|
|
1026
|
-
* @fires changeSelection
|
|
1022
|
+
* @emits changeSelection
|
|
1027
1023
|
*/
|
|
1028
1024
|
selectRange(range: Range, focus: boolean = true): void {
|
|
1029
1025
|
const sel = this.sel;
|
|
@@ -1039,7 +1035,6 @@ export class Select implements ISelect {
|
|
|
1039
1035
|
|
|
1040
1036
|
/**
|
|
1041
1037
|
* Fired after change selection
|
|
1042
|
-
*
|
|
1043
1038
|
* @event changeSelection
|
|
1044
1039
|
*/
|
|
1045
1040
|
this.j.e.fire('changeSelection');
|
|
@@ -1047,9 +1042,7 @@ export class Select implements ISelect {
|
|
|
1047
1042
|
|
|
1048
1043
|
/**
|
|
1049
1044
|
* Select node
|
|
1050
|
-
*
|
|
1051
|
-
* @param {Node} node
|
|
1052
|
-
* @param {boolean} [inward=false] select all inside
|
|
1045
|
+
* @param inward - select all inside
|
|
1053
1046
|
*/
|
|
1054
1047
|
select(
|
|
1055
1048
|
node: Node | HTMLElement | HTMLTableElement | HTMLTableCellElement,
|
|
@@ -1109,6 +1102,7 @@ export class Select implements ISelect {
|
|
|
1109
1102
|
'font',
|
|
1110
1103
|
INVISIBLE_SPACE
|
|
1111
1104
|
);
|
|
1105
|
+
|
|
1112
1106
|
this.insertNode(font, false, false);
|
|
1113
1107
|
|
|
1114
1108
|
const [marker] = this.markers;
|
|
@@ -1219,8 +1213,6 @@ export class Select implements ISelect {
|
|
|
1219
1213
|
/**
|
|
1220
1214
|
* Apply some css rules for all selections. It method wraps selections in nodeName tag.
|
|
1221
1215
|
*
|
|
1222
|
-
* @param cssRules
|
|
1223
|
-
* @param options
|
|
1224
1216
|
* @param options.element - tag - equal CSSRule (e.g. strong === font-weight: 700)
|
|
1225
1217
|
* @param options.defaultTag - tag for wrapping and apply styles
|
|
1226
1218
|
* @example
|
|
@@ -1253,8 +1245,6 @@ export class Select implements ISelect {
|
|
|
1253
1245
|
|
|
1254
1246
|
/**
|
|
1255
1247
|
* Split selection on two parts: left and right
|
|
1256
|
-
* @param currentBox
|
|
1257
|
-
* @return Left part
|
|
1258
1248
|
*/
|
|
1259
1249
|
splitSelection(currentBox: HTMLElement): Nullable<Element> {
|
|
1260
1250
|
if (!this.isCollapsed()) {
|
|
@@ -137,8 +137,11 @@
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
.jodit-ui-button-statuses {
|
|
140
|
+
&_status_initial {
|
|
141
|
+
}
|
|
142
|
+
|
|
140
143
|
&_status_default {
|
|
141
|
-
.jodit_status(#
|
|
144
|
+
.jodit_status(#e3e3e3, #212529, #c9cdd1, #212529, #dae0e5, #212529);
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
&_status_primary {
|
|
@@ -10,7 +10,8 @@ import type {
|
|
|
10
10
|
IUIButton,
|
|
11
11
|
IUIButtonState,
|
|
12
12
|
IUIButtonStatePartial,
|
|
13
|
-
IViewBased
|
|
13
|
+
IViewBased,
|
|
14
|
+
ButtonStatus
|
|
14
15
|
} from '../../../../types';
|
|
15
16
|
import { UIElement } from '../../element';
|
|
16
17
|
import { Dom } from '../../../dom';
|
|
@@ -26,7 +27,7 @@ export const UIButtonState = (): IUIButtonState => ({
|
|
|
26
27
|
name: '',
|
|
27
28
|
value: '',
|
|
28
29
|
|
|
29
|
-
status: '',
|
|
30
|
+
status: 'initial',
|
|
30
31
|
disabled: false,
|
|
31
32
|
activated: false,
|
|
32
33
|
|
|
@@ -57,7 +58,6 @@ export class UIButton extends UIElement implements IUIButton {
|
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* Set state
|
|
60
|
-
* @param state
|
|
61
61
|
*/
|
|
62
62
|
setState(state: IUIButtonStatePartial): this {
|
|
63
63
|
Object.assign(this.state, state);
|
|
@@ -228,7 +228,6 @@ export class UIButton extends UIElement implements IUIButton {
|
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Add action handler
|
|
231
|
-
* @param originalEvent
|
|
232
231
|
*/
|
|
233
232
|
onAction(callback: (originalEvent: MouseEvent) => void): this {
|
|
234
233
|
this.actionHandlers.push(callback);
|
|
@@ -237,7 +236,6 @@ export class UIButton extends UIElement implements IUIButton {
|
|
|
237
236
|
|
|
238
237
|
/**
|
|
239
238
|
* Fire all click handlers
|
|
240
|
-
* @param e
|
|
241
239
|
*/
|
|
242
240
|
@autobind
|
|
243
241
|
private onActionFire(e: MouseEvent): void {
|
|
@@ -259,19 +257,19 @@ export function Button(
|
|
|
259
257
|
jodit: IViewBased,
|
|
260
258
|
icon: string,
|
|
261
259
|
text: string,
|
|
262
|
-
status?:
|
|
260
|
+
status?: ButtonStatus
|
|
263
261
|
): IUIButton;
|
|
264
262
|
export function Button(
|
|
265
263
|
jodit: IViewBased,
|
|
266
264
|
state: IUIButtonStatePartial,
|
|
267
|
-
status?:
|
|
265
|
+
status?: ButtonStatus
|
|
268
266
|
): IUIButton;
|
|
269
267
|
|
|
270
268
|
export function Button(
|
|
271
269
|
jodit: IViewBased,
|
|
272
270
|
stateOrText: string | IUIButtonStatePartial,
|
|
273
271
|
text?: string,
|
|
274
|
-
status?:
|
|
272
|
+
status?: ButtonStatus
|
|
275
273
|
): IUIButton {
|
|
276
274
|
const button = new UIButton(jodit);
|
|
277
275
|
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
.jodit-box();
|
|
15
15
|
|
|
16
16
|
position: fixed;
|
|
17
|
-
display: inline-block;
|
|
18
17
|
z-index: var(--z-index-popup);
|
|
19
|
-
|
|
18
|
+
display: inline-block;
|
|
20
19
|
box-shadow: var(--box-shadow);
|
|
20
|
+
transform: translate3d(0, 0, 0);
|
|
21
21
|
|
|
22
22
|
&__content {
|
|
23
23
|
.font();
|
|
24
|
+
overflow: auto;
|
|
25
|
+
max-height: 300px;
|
|
24
26
|
padding: var(--padding-default);
|
|
25
27
|
background: var(--color-background-default);
|
|
26
28
|
overflow-scrolling: touch;
|
|
27
|
-
overflow: auto;
|
|
28
|
-
max-height: 300px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
&_padding_false &__content {
|