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.
- package/.idea/workspace.xml +301 -299
- package/CHANGELOG.MD +88 -7
- package/CONTRIBUTING.md +97 -0
- package/README.md +7 -7
- package/build/jodit.css +38 -32
- package/build/jodit.es2018.css +37 -31
- package/build/jodit.es2018.en.css +37 -31
- package/build/jodit.es2018.en.js +1981 -1393
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +2053 -1447
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +3475 -2625
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/build/vdom.css +1 -1
- package/build/vdom.js +32 -20
- package/package.json +13 -13
- package/src/README.md +1 -1
- package/src/config.ts +69 -36
- package/src/core/async/async.ts +46 -24
- package/src/core/constants.ts +1 -0
- package/src/core/decorators/README.md +35 -0
- package/src/core/decorators/cache/cache.ts +1 -1
- package/src/core/decorators/debounce/debounce.ts +20 -9
- package/src/core/decorators/idle/README.md +14 -0
- package/src/core/decorators/idle/idle.ts +1 -1
- package/src/core/decorators/watch/watch.ts +8 -7
- package/src/core/dom/README.md +42 -0
- package/src/core/dom/dom.ts +37 -23
- package/src/core/dom/index.ts +1 -0
- package/src/core/dom/lazy-walker.ts +133 -0
- package/src/core/event-emitter/event-emitter.ts +8 -8
- package/src/core/event-emitter/eventify.ts +73 -0
- package/src/core/event-emitter/index.ts +1 -0
- package/src/core/helpers/html/apply-styles.ts +1 -1
- package/src/core/helpers/html/strip-tags.ts +3 -2
- package/src/core/helpers/string/fuzzy-search-index.ts +58 -0
- package/src/core/helpers/string/i18n.ts +1 -1
- package/src/core/helpers/string/index.ts +3 -2
- package/src/core/helpers/utils/append-script.ts +1 -1
- package/src/core/helpers/utils/css.ts +1 -1
- package/src/core/helpers/utils/selector.ts +1 -1
- package/src/core/helpers/utils/utils.ts +3 -3
- package/src/core/plugin/plugin-system.ts +14 -8
- package/src/core/request/ajax.ts +3 -3
- package/src/core/selection/select.ts +10 -10
- package/src/core/selection/style/api/toggle/toggle-css.ts +5 -2
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -1
- package/src/core/selection/style/apply-style.ts +4 -4
- package/src/core/storage/engines/local-storage-provider.ts +20 -19
- package/src/core/ui/button/button/button.ts +5 -5
- package/src/core/ui/element.ts +2 -2
- package/src/core/ui/form/inputs/input/input.ts +1 -1
- package/src/core/ui/form/inputs/select/select.ts +1 -1
- package/src/core/ui/group/list.ts +2 -2
- package/src/core/vdom/render/index.ts +12 -8
- package/src/core/vdom/v-dom-jodit.ts +1 -1
- package/src/core/view/view.ts +1 -1
- package/src/index.ts +3 -3
- package/src/jodit.ts +72 -55
- package/src/langs/README.md +1 -1
- package/src/langs/ar.js +2 -1
- package/src/langs/cs_cz.js +2 -1
- package/src/langs/de.js +2 -1
- package/src/langs/es.js +2 -1
- package/src/langs/fa.js +2 -1
- package/src/langs/fr.js +2 -1
- package/src/langs/he.js +2 -1
- package/src/langs/hu.js +2 -1
- package/src/langs/id.js +2 -1
- package/src/langs/index.ts +1 -1
- package/src/langs/it.js +2 -1
- package/src/langs/ja.js +2 -1
- package/src/langs/ko.js +2 -1
- package/src/langs/nl.js +2 -1
- package/src/langs/pl.js +2 -1
- package/src/langs/pt_br.js +2 -1
- package/src/langs/ru.js +2 -1
- package/src/langs/tr.js +2 -1
- package/src/langs/zh_cn.js +2 -1
- package/src/langs/zh_tw.js +2 -1
- package/src/modules/dialog/dialog.ts +6 -6
- package/src/modules/dialog/prompt.ts +1 -1
- package/src/modules/file-browser/README.md +2 -2
- package/src/modules/file-browser/builders/context-menu.ts +12 -13
- package/src/modules/file-browser/fetch/load-tree.ts +1 -1
- package/src/modules/file-browser/file-browser.ts +10 -7
- package/src/modules/history/README.md +5 -0
- package/src/modules/{observer → history}/command.ts +5 -5
- package/src/modules/{observer/observer.ts → history/history.ts} +97 -55
- package/src/modules/{observer → history}/snapshot.ts +3 -4
- package/src/modules/{observer → history}/stack.ts +4 -4
- package/src/modules/image-editor/image-editor.ts +8 -8
- package/src/modules/image-editor/templates/form.ts +2 -2
- package/src/modules/index.ts +3 -3
- package/src/modules/status-bar/status-bar.ts +4 -0
- package/src/modules/table/table.ts +2 -2
- package/src/modules/toolbar/button/button.ts +2 -2
- package/src/modules/toolbar/collection/collection.ts +1 -1
- package/src/modules/uploader/helpers/process-old-browser-drag.ts +1 -1
- package/src/modules/uploader/helpers/send-files.ts +1 -1
- package/src/modules/uploader/helpers/send.ts +1 -1
- package/src/modules/uploader/uploader.ts +3 -3
- package/src/modules/widget/color-picker/color-picker.ts +2 -3
- package/src/modules/widget/tabs/tabs.ts +17 -12
- package/src/plugins/add-new-line/add-new-line.ts +8 -8
- package/src/plugins/class-span/class-span.ts +1 -1
- package/src/plugins/clipboard/copy-format.ts +1 -1
- package/src/plugins/clipboard/drag-and-drop-element.ts +4 -2
- package/src/plugins/clipboard/paste/config.ts +19 -3
- package/src/plugins/clipboard/paste/helpers.ts +17 -50
- package/src/plugins/clipboard/paste/interface.ts +6 -0
- package/src/plugins/clipboard/paste/paste.ts +22 -8
- package/src/plugins/clipboard/paste-from-word/config.ts +17 -0
- package/src/plugins/clipboard/paste-from-word/paste-from-word.ts +15 -6
- package/src/plugins/clipboard/paste-storage/paste-storage.ts +6 -6
- package/src/plugins/color/color.ts +2 -2
- package/src/plugins/error-messages/error-messages.ts +2 -2
- package/src/plugins/fix/clean-html/README.md +26 -0
- package/src/plugins/fix/{clean-html.ts → clean-html/clean-html.ts} +59 -142
- package/src/plugins/fix/clean-html/config.ts +106 -0
- package/src/plugins/fix/index.ts +12 -0
- package/src/plugins/fix/wrap-nodes/README.md +27 -0
- package/src/plugins/fix/wrap-nodes/config.ts +24 -0
- package/src/plugins/fix/{wrap-text-nodes.ts → wrap-nodes/wrap-nodes.ts} +9 -4
- package/src/plugins/focus/focus.ts +1 -1
- package/src/plugins/format-block/format-block.ts +1 -1
- package/src/plugins/fullsize/fullsize.ts +4 -4
- package/src/plugins/iframe/iframe.ts +3 -3
- package/src/plugins/image/image-properties/image-properties.ts +12 -13
- package/src/plugins/indent/indent.ts +1 -1
- package/src/plugins/index.ts +2 -2
- package/src/plugins/inline-popup/config/items/a.ts +2 -2
- package/src/plugins/inline-popup/config/items/cells.ts +11 -11
- package/src/plugins/inline-popup/config/items/iframe.ts +1 -1
- package/src/plugins/inline-popup/config/items/img.ts +7 -7
- package/src/plugins/inline-popup/inline-popup.ts +5 -5
- package/src/plugins/keyboard/backspace/backspace.ts +1 -1
- package/src/plugins/keyboard/backspace/cases/check-join-neighbors.ts +1 -1
- package/src/plugins/keyboard/helpers.ts +1 -1
- package/src/plugins/keyboard/hotkeys.ts +1 -1
- package/src/plugins/limit/limit.ts +3 -3
- package/src/plugins/line-height/line-height.ts +1 -1
- package/src/plugins/link/link.ts +8 -8
- package/src/plugins/link/template.ts +2 -2
- package/src/plugins/media/file.ts +1 -1
- package/src/plugins/media/media.ts +1 -1
- package/src/plugins/media/video/config.ts +1 -1
- package/src/plugins/mobile/config.ts +1 -1
- package/src/plugins/mobile/mobile.ts +1 -1
- package/src/plugins/ordered-list/config.ts +61 -0
- package/src/plugins/ordered-list/ordered-list.ts +3 -153
- package/src/plugins/placeholder/placeholder.ts +3 -3
- package/src/plugins/print/helpers.ts +14 -7
- package/src/plugins/print/index.ts +1 -1
- package/src/plugins/print/{preview.less → preview/preview.less} +1 -1
- package/src/plugins/print/{preview.ts → preview/preview.ts} +9 -8
- package/src/plugins/print/print.ts +19 -10
- package/src/plugins/redo-undo/redo-undo.ts +3 -3
- package/src/plugins/resizer/resizer.ts +11 -11
- package/src/plugins/search/README.md +38 -0
- package/src/plugins/search/config.ts +82 -0
- package/src/plugins/search/helpers/index.ts +12 -0
- package/src/plugins/search/helpers/sentence-finder.ts +103 -0
- package/src/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.ts +120 -0
- package/src/plugins/search/search.ts +269 -615
- package/src/plugins/search/ui/search.less +159 -0
- package/src/plugins/search/ui/search.ts +256 -0
- package/src/plugins/select/select.ts +1 -1
- package/src/plugins/size/config.ts +8 -8
- package/src/plugins/size/resize-handler.ts +3 -3
- package/src/plugins/size/size.ts +4 -4
- package/src/plugins/source/editor/engines/ace.ts +9 -9
- package/src/plugins/source/editor/engines/area.ts +3 -3
- package/src/plugins/source/source.ts +6 -6
- package/src/plugins/spellcheck/README.md +1 -0
- package/src/plugins/spellcheck/config.ts +34 -0
- package/src/plugins/spellcheck/spellcheck.svg +4 -0
- package/src/plugins/spellcheck/spellcheck.ts +48 -0
- package/src/plugins/sticky/sticky.ts +3 -3
- package/src/plugins/table/resize-cells.ts +11 -11
- package/src/plugins/table/select-cells.ts +2 -2
- package/src/plugins/tooltip/tooltip.ts +1 -1
- package/src/plugins/xpath/xpath.ts +8 -8
- package/src/polyfills.ts +5 -4
- package/src/styles/icons/README.md +2 -2
- package/src/types/async.d.ts +12 -2
- package/src/types/core.ts +1 -1
- package/src/types/events.d.ts +6 -2
- package/src/types/file-browser.d.ts +1 -2
- package/{types/types/observer.d.ts → src/types/history.d.ts} +11 -7
- package/src/types/index.d.ts +1 -1
- package/src/types/jodit.d.ts +12 -4
- package/src/types/toolbar.d.ts +5 -5
- package/src/types/types.d.ts +11 -4
- package/types/config.d.ts +68 -35
- package/types/core/async/async.d.ts +11 -4
- package/types/core/constants.d.ts +1 -0
- package/types/core/dom/dom.d.ts +3 -5
- package/types/core/dom/index.d.ts +1 -0
- package/types/core/dom/lazy-walker.d.ts +37 -0
- package/types/core/event-emitter/eventify.d.ts +39 -0
- package/types/core/event-emitter/index.d.ts +1 -0
- package/types/core/helpers/string/fuzzy-search-index.d.ts +10 -0
- package/types/core/helpers/string/i18n.d.ts +1 -1
- package/types/core/helpers/string/index.d.ts +3 -2
- package/types/core/helpers/utils/utils.d.ts +1 -1
- package/types/core/selection/select.d.ts +1 -1
- package/types/core/ui/button/button/button.d.ts +4 -4
- package/types/core/view/view.d.ts +1 -1
- package/types/jodit.d.ts +19 -6
- package/types/modules/{observer → history}/command.d.ts +4 -4
- package/types/modules/{observer/observer.d.ts → history/history.d.ts} +17 -9
- package/types/modules/{observer → history}/snapshot.d.ts +1 -1
- package/types/modules/{observer → history}/stack.d.ts +3 -3
- package/types/modules/image-editor/image-editor.d.ts +1 -1
- package/types/modules/index.d.ts +3 -3
- package/types/modules/toolbar/button/button.d.ts +2 -5
- package/types/modules/widget/tabs/tabs.d.ts +1 -1
- package/types/plugins/class-span/class-span.d.ts +1 -1
- package/types/plugins/clipboard/paste/config.d.ts +8 -0
- package/types/plugins/clipboard/paste/helpers.d.ts +2 -2
- package/types/plugins/clipboard/paste/interface.d.ts +5 -0
- package/types/plugins/clipboard/paste-from-word/config.d.ts +5 -0
- package/types/plugins/clipboard/paste-from-word/paste-from-word.d.ts +3 -2
- package/types/plugins/fix/clean-html/clean-html.d.ts +70 -0
- package/types/plugins/fix/{clean-html.d.ts → clean-html/config.d.ts} +2 -57
- package/types/plugins/fix/index.d.ts +10 -0
- package/types/plugins/fix/wrap-nodes/config.d.ts +16 -0
- package/types/plugins/fix/{wrap-text-nodes.d.ts → wrap-nodes/wrap-nodes.d.ts} +5 -2
- package/types/plugins/fullsize/fullsize.d.ts +2 -2
- package/types/plugins/index.d.ts +2 -2
- package/types/plugins/ordered-list/config.d.ts +6 -0
- package/types/plugins/ordered-list/ordered-list.d.ts +1 -1
- package/types/plugins/print/helpers.d.ts +2 -2
- package/types/plugins/print/index.d.ts +1 -1
- package/types/plugins/print/{preview.d.ts → preview/preview.d.ts} +1 -1
- package/types/plugins/search/config.d.ts +36 -0
- package/types/plugins/search/helpers/index.d.ts +10 -0
- package/types/plugins/search/helpers/sentence-finder.d.ts +21 -0
- package/types/plugins/search/helpers/wrap-ranges-texts-in-tmp-span.d.ts +14 -0
- package/types/plugins/search/search.d.ts +25 -39
- package/types/plugins/search/ui/search.d.ts +37 -0
- package/types/plugins/spellcheck/config.d.ts +15 -0
- package/types/plugins/spellcheck/spellcheck.d.ts +19 -0
- package/types/plugins/sticky/sticky.d.ts +2 -2
- package/types/types/async.d.ts +12 -2
- package/types/types/core.d.ts +1 -1
- package/types/types/core.ts +1 -1
- package/types/types/events.d.ts +6 -2
- package/types/types/file-browser.d.ts +1 -2
- package/{src/types/observer.d.ts → types/types/history.d.ts} +11 -7
- package/types/types/index.d.ts +1 -1
- package/types/types/jodit.d.ts +12 -4
- package/types/types/toolbar.d.ts +5 -5
- package/types/types/types.d.ts +11 -4
- package/src/modules/observer/README.md +0 -0
- package/src/plugins/search/search.less +0 -152
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* @module plugins/spellcheck
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { IControlType, IJodit } from 'jodit/types';
|
|
12
|
+
import { Config } from 'jodit/config';
|
|
13
|
+
|
|
14
|
+
declare module 'jodit/config' {
|
|
15
|
+
interface Config {
|
|
16
|
+
/**
|
|
17
|
+
* Options specifies whether the editor is to have its spelling and grammar checked or not
|
|
18
|
+
* @see {@link http://www.w3schools.com/tags/att_global_spellcheck.asp}
|
|
19
|
+
*/
|
|
20
|
+
spellcheck: boolean;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Config.prototype.spellcheck = false;
|
|
25
|
+
|
|
26
|
+
Config.prototype.controls.spellcheck = {
|
|
27
|
+
isActive(e: IJodit): boolean {
|
|
28
|
+
return e.o.spellcheck;
|
|
29
|
+
},
|
|
30
|
+
icon: require('./spellcheck.svg'),
|
|
31
|
+
name: 'spellcheck',
|
|
32
|
+
command: 'toggleSpellcheck',
|
|
33
|
+
tooltip: 'Spellchecking'
|
|
34
|
+
} as IControlType;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* [[include:plugins/spellcheck/README.md]]
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
* @module plugins/spellcheck
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { IJodit } from 'jodit/types';
|
|
14
|
+
import { Plugin } from 'jodit/core/plugin';
|
|
15
|
+
import { attr } from 'jodit/core/helpers/utils/utils';
|
|
16
|
+
import { autobind } from 'jodit/core/decorators';
|
|
17
|
+
|
|
18
|
+
import './config';
|
|
19
|
+
|
|
20
|
+
export class spellcheck extends Plugin {
|
|
21
|
+
override buttons: Plugin['buttons'] = [
|
|
22
|
+
{
|
|
23
|
+
group: 'state',
|
|
24
|
+
name: 'spellcheck'
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
protected afterInit(jodit: IJodit): void {
|
|
29
|
+
jodit.e.on(
|
|
30
|
+
'afterInit afterAddPlace prepareWYSIWYGEditor',
|
|
31
|
+
this.toggleSpellcheck
|
|
32
|
+
);
|
|
33
|
+
this.toggleSpellcheck();
|
|
34
|
+
|
|
35
|
+
jodit.registerCommand('toggleSpellcheck', () => {
|
|
36
|
+
this.jodit.o.spellcheck = !this.jodit.o.spellcheck;
|
|
37
|
+
this.toggleSpellcheck();
|
|
38
|
+
this.j.e.fire('updateToolbar');
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@autobind
|
|
43
|
+
private toggleSpellcheck(): void {
|
|
44
|
+
attr(this.jodit.editor, 'spellcheck', this.jodit.o.spellcheck);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected beforeDestruct(jodit: IJodit): void {}
|
|
48
|
+
}
|
|
@@ -22,7 +22,7 @@ declare module 'jodit/config' {
|
|
|
22
22
|
/**
|
|
23
23
|
* @example
|
|
24
24
|
* ```javascript
|
|
25
|
-
* var editor =
|
|
25
|
+
* var editor = Jodit.make('#someid', {
|
|
26
26
|
* toolbarSticky: false
|
|
27
27
|
* })
|
|
28
28
|
* ```
|
|
@@ -37,7 +37,7 @@ declare module 'jodit/config' {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* ```javascript
|
|
40
|
-
* var editor =
|
|
40
|
+
* var editor = Jodit.make('#someid', {
|
|
41
41
|
* toolbarStickyOffset: 100
|
|
42
42
|
* })
|
|
43
43
|
* ```
|
|
@@ -54,7 +54,7 @@ export class sticky extends Plugin {
|
|
|
54
54
|
private isToolbarSticked: boolean = false;
|
|
55
55
|
private dummyBox?: HTMLElement;
|
|
56
56
|
|
|
57
|
-
private createDummy = (toolbar: HTMLElement) => {
|
|
57
|
+
private createDummy = (toolbar: HTMLElement): void => {
|
|
58
58
|
if (!isESNext && IS_IE && !this.dummyBox) {
|
|
59
59
|
this.dummyBox = this.j.c.div();
|
|
60
60
|
this.dummyBox.classList.add('jodit_sticky-dummy_toolbar');
|
|
@@ -47,12 +47,12 @@ export class resizeCells extends Plugin {
|
|
|
47
47
|
private resizeDelta: number = 0;
|
|
48
48
|
private resizeHandler!: HTMLElement;
|
|
49
49
|
|
|
50
|
-
private showResizeHandle() {
|
|
50
|
+
private showResizeHandle(): void {
|
|
51
51
|
this.j.async.clearTimeout(this.hideTimeout);
|
|
52
52
|
this.j.workplace.appendChild(this.resizeHandler);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
private hideResizeHandle() {
|
|
55
|
+
private hideResizeHandle(): void {
|
|
56
56
|
this.hideTimeout = this.j.async.setTimeout(
|
|
57
57
|
() => {
|
|
58
58
|
Dom.safeRemove(this.resizeHandler);
|
|
@@ -64,7 +64,7 @@ export class resizeCells extends Plugin {
|
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
private createResizeHandle = () => {
|
|
67
|
+
private createResizeHandle = (): void => {
|
|
68
68
|
if (!this.resizeHandler) {
|
|
69
69
|
this.resizeHandler = this.j.c.div('jodit-table-resizer');
|
|
70
70
|
|
|
@@ -97,7 +97,7 @@ export class resizeCells extends Plugin {
|
|
|
97
97
|
* Click on resize handle
|
|
98
98
|
*/
|
|
99
99
|
@autobind
|
|
100
|
-
private onHandleMouseDown(event: MouseEvent) {
|
|
100
|
+
private onHandleMouseDown(event: MouseEvent): boolean | void {
|
|
101
101
|
if (this.j.isLocked) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
@@ -166,7 +166,7 @@ export class resizeCells extends Plugin {
|
|
|
166
166
|
* Mouse move after click on resize handle
|
|
167
167
|
*/
|
|
168
168
|
@autobind
|
|
169
|
-
private onMouseMove(event: MouseEvent) {
|
|
169
|
+
private onMouseMove(event: MouseEvent): void {
|
|
170
170
|
if (!this.drag) {
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
@@ -235,14 +235,14 @@ export class resizeCells extends Plugin {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
this.j.
|
|
238
|
+
this.j.synchronizeValues();
|
|
239
239
|
this.j.s.focus();
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
243
|
* Resize only one column
|
|
244
244
|
*/
|
|
245
|
-
private resizeColumns() {
|
|
245
|
+
private resizeColumns(): void {
|
|
246
246
|
const delta = this.resizeDelta;
|
|
247
247
|
|
|
248
248
|
const marked: HTMLTableCellElement[] = [];
|
|
@@ -274,7 +274,7 @@ export class resizeCells extends Plugin {
|
|
|
274
274
|
/**
|
|
275
275
|
* Resize whole table
|
|
276
276
|
*/
|
|
277
|
-
private resizeTable() {
|
|
277
|
+
private resizeTable(): void {
|
|
278
278
|
const delta = this.resizeDelta * (this.isRTL ? -1 : 1);
|
|
279
279
|
|
|
280
280
|
const width = this.workTable.offsetWidth,
|
|
@@ -316,7 +316,7 @@ export class resizeCells extends Plugin {
|
|
|
316
316
|
private setWorkCell(
|
|
317
317
|
cell: HTMLTableCellElement,
|
|
318
318
|
wholeTable: boolean | null = null
|
|
319
|
-
) {
|
|
319
|
+
): void {
|
|
320
320
|
this.wholeTable = wholeTable;
|
|
321
321
|
|
|
322
322
|
this.workCell = cell;
|
|
@@ -336,7 +336,7 @@ export class resizeCells extends Plugin {
|
|
|
336
336
|
cell: HTMLTableCellElement,
|
|
337
337
|
offsetX: number = 0,
|
|
338
338
|
delta: number = 0
|
|
339
|
-
) {
|
|
339
|
+
): void {
|
|
340
340
|
const box = offset(cell, this.j, this.j.ed);
|
|
341
341
|
|
|
342
342
|
if (offsetX > consts.NEARBY && offsetX < box.width - consts.NEARBY) {
|
|
@@ -435,7 +435,7 @@ export class resizeCells extends Plugin {
|
|
|
435
435
|
* Add to every Table listeners
|
|
436
436
|
*/
|
|
437
437
|
@autobind
|
|
438
|
-
private observe(table: HTMLTableElement) {
|
|
438
|
+
private observe(table: HTMLTableElement): void {
|
|
439
439
|
if (dataBind(table, key)) {
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
@@ -197,7 +197,7 @@ export class selectCells extends Plugin {
|
|
|
197
197
|
e.stopPropagation();
|
|
198
198
|
|
|
199
199
|
// Hack for FireFox for force redraw selection
|
|
200
|
-
(() => {
|
|
200
|
+
((): void => {
|
|
201
201
|
const n = this.j.createInside.fromHTML(
|
|
202
202
|
'<div style="color:rgba(0,0,0,0.01);width:0;height:0"> </div>'
|
|
203
203
|
);
|
|
@@ -299,7 +299,7 @@ export class selectCells extends Plugin {
|
|
|
299
299
|
/**
|
|
300
300
|
* Remove selection for all cells
|
|
301
301
|
*/
|
|
302
|
-
private unselectCells(currentCell?: Nullable<HTMLTableCellElement>) {
|
|
302
|
+
private unselectCells(currentCell?: Nullable<HTMLTableCellElement>): void {
|
|
303
303
|
const module = this.module;
|
|
304
304
|
const cells = module.getAllSelectedCells();
|
|
305
305
|
|
|
@@ -31,7 +31,7 @@ Config.prototype.showXPathInStatusbar = true;
|
|
|
31
31
|
* Show path to current element in status bar
|
|
32
32
|
*/
|
|
33
33
|
export class xpath extends Plugin {
|
|
34
|
-
private onContext = (bindElement: Node, event: MouseEvent) => {
|
|
34
|
+
private onContext = (bindElement: Node, event: MouseEvent): boolean => {
|
|
35
35
|
if (!this.menu) {
|
|
36
36
|
this.menu = new ContextMenu(this.j);
|
|
37
37
|
}
|
|
@@ -40,19 +40,19 @@ export class xpath extends Plugin {
|
|
|
40
40
|
{
|
|
41
41
|
icon: 'bin',
|
|
42
42
|
title: bindElement === this.j.editor ? 'Clear' : 'Remove',
|
|
43
|
-
exec: () => {
|
|
43
|
+
exec: (): void => {
|
|
44
44
|
if (bindElement !== this.j.editor) {
|
|
45
45
|
Dom.safeRemove(bindElement);
|
|
46
46
|
} else {
|
|
47
47
|
this.j.value = '';
|
|
48
48
|
}
|
|
49
|
-
this.j.
|
|
49
|
+
this.j.synchronizeValues();
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
icon: 'select-all',
|
|
54
54
|
title: 'Select',
|
|
55
|
-
exec: () => {
|
|
55
|
+
exec: (): void => {
|
|
56
56
|
this.j.s.select(bindElement);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -61,7 +61,7 @@ export class xpath extends Plugin {
|
|
|
61
61
|
return false;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
private onSelectPath = (bindElement: Node, event: MouseEvent) => {
|
|
64
|
+
private onSelectPath = (bindElement: Node, event: MouseEvent): boolean => {
|
|
65
65
|
this.j.s.focus();
|
|
66
66
|
|
|
67
67
|
const path = attr(event.target as HTMLElement, '-path') || '/';
|
|
@@ -110,14 +110,14 @@ export class xpath extends Plugin {
|
|
|
110
110
|
|
|
111
111
|
private selectAllButton?: IToolbarButton;
|
|
112
112
|
|
|
113
|
-
private removeSelectAll = () => {
|
|
113
|
+
private removeSelectAll = (): void => {
|
|
114
114
|
if (this.selectAllButton) {
|
|
115
115
|
this.selectAllButton.destruct();
|
|
116
116
|
delete this.selectAllButton;
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
private appendSelectAll = () => {
|
|
120
|
+
private appendSelectAll = (): void => {
|
|
121
121
|
this.removeSelectAll();
|
|
122
122
|
|
|
123
123
|
this.selectAllButton = makeButton(this.j, {
|
|
@@ -134,7 +134,7 @@ export class xpath extends Plugin {
|
|
|
134
134
|
);
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
private calcPathImd = () => {
|
|
137
|
+
private calcPathImd = (): void => {
|
|
138
138
|
if (this.isDestructed) {
|
|
139
139
|
return;
|
|
140
140
|
}
|
package/src/polyfills.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { IDictionary } from 'jodit/types';
|
|
7
|
+
import type { CanUndef, IDictionary } from 'jodit/types';
|
|
8
8
|
|
|
9
9
|
import 'classlist-polyfill';
|
|
10
10
|
import 'es6-promise/auto';
|
|
11
11
|
import 'core-js/es/symbol';
|
|
12
|
+
import 'core-js/es/array/find-index';
|
|
12
13
|
|
|
13
14
|
if (!Array.from) {
|
|
14
15
|
Array.from = <T>(object: T[]): T[] => {
|
|
@@ -24,7 +25,7 @@ if (!Array.from) {
|
|
|
24
25
|
|
|
25
26
|
// for ie11
|
|
26
27
|
if (!Array.prototype.includes) {
|
|
27
|
-
Array.prototype.includes = function (value: any) {
|
|
28
|
+
Array.prototype.includes = function (value: any): boolean {
|
|
28
29
|
return this.indexOf(value) > -1;
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -69,13 +70,13 @@ if (typeof Object.assign !== 'function') {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
if (!Array.prototype.find) {
|
|
72
|
-
Array.prototype.find = function (value:
|
|
73
|
+
Array.prototype.find = function <T>(value: T): CanUndef<T> {
|
|
73
74
|
return this.indexOf(value) > -1 ? value : undefined;
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
if (!String.prototype.endsWith) {
|
|
78
|
-
String.prototype.endsWith = function (value: any) {
|
|
79
|
+
String.prototype.endsWith = function (value: any): boolean {
|
|
79
80
|
return this[this.length - 1] === value;
|
|
80
81
|
};
|
|
81
82
|
}
|
|
@@ -63,7 +63,7 @@ Create input element
|
|
|
63
63
|
And define event `getIcon`:
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
|
-
const editor =
|
|
66
|
+
const editor = Jodit.make('#editor', {
|
|
67
67
|
events: {
|
|
68
68
|
getIcon: function (name, control, clearName) {
|
|
69
69
|
var code = name;
|
|
@@ -88,7 +88,7 @@ const editor = new Jodit('#editor', {
|
|
|
88
88
|
For full replacing you can copy this code:
|
|
89
89
|
|
|
90
90
|
```js
|
|
91
|
-
const editor =
|
|
91
|
+
const editor = Jodit.make('#editor', {
|
|
92
92
|
events: {
|
|
93
93
|
getIcon: function (name, control, clearName) {
|
|
94
94
|
var code = clearName;
|
package/src/types/async.d.ts
CHANGED
|
@@ -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
|
}
|
package/src/types/core.ts
CHANGED
package/src/types/events.d.ts
CHANGED
|
@@ -171,9 +171,9 @@ interface IEventEmitter extends IDestructible {
|
|
|
171
171
|
* events.fire(document.body.querySelector('div'), 'click');
|
|
172
172
|
* ```
|
|
173
173
|
*/
|
|
174
|
-
fire(
|
|
174
|
+
fire(eventsList: string, ...args: any[]): any;
|
|
175
175
|
fire(
|
|
176
|
-
|
|
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 './
|
|
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
|
|
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
|
}
|
package/src/types/index.d.ts
CHANGED
|
@@ -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 './
|
|
20
|
+
export * from './history';
|
|
21
21
|
export * from './select';
|
|
22
22
|
export * from './plugin';
|
|
23
23
|
export * from './popup';
|
package/src/types/jodit.d.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
93
|
+
* var editor = Jodit.make('#editor');
|
|
86
94
|
* console.log(editor.getRealMode());
|
|
87
95
|
* ```
|
|
88
96
|
*/
|
package/src/types/toolbar.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ interface IControlType<
|
|
|
44
44
|
* @see copyformat plugin
|
|
45
45
|
* @example
|
|
46
46
|
* ```javascript
|
|
47
|
-
* var editor =
|
|
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 =
|
|
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
|
-
*
|
|
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 =
|
|
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 =
|
|
219
|
+
* var editor = Jodit.make('.editor', {
|
|
220
220
|
* buttons: [
|
|
221
221
|
* {
|
|
222
222
|
* icon: "insertCode",
|
package/src/types/types.d.ts
CHANGED
|
@@ -110,10 +110,10 @@ export interface IPointBound extends IPoint {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
export interface ISelectionRange {
|
|
113
|
-
startContainer:
|
|
114
|
-
startOffset: number
|
|
115
|
-
endContainer:
|
|
116
|
-
endOffset: number
|
|
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
|
+
}
|